cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

NGINX Agent Configuration problem

chao_wang
Guide

Hi

In our costomer envirment: nginx1.6 .

the dynatracews agent log :

【2016-04-26 15:03:12.403799 [31678/e12347f9] info [native] Executing script /home/mpos/dynatrace/dynatrace-6.3/agent/conf/generate_offsets.sh to generate Nginx Agent configuration
2016-04-26 15:03:12.958224 [31653/e12347f9] severe [native] generate_offsets.sh script exited with error: 7
2016-04-26 15:03:12.958341 [31653/e12347f9] info [native] Removed generate_offsets.sh script
2016-04-26 15:03:17.312660 [31653/e12347f9] severe [native] Something went wrong during creation of offset file, please contact support.】

I use the same nginx1.6 installation package,in my test envirment Agent IS OK

the agent log:
【2016-04-27 15:05:32.883590 [8955/f14f182d] severe [native] Nginx looks to be not from a repository. Trying to generate Nginx Agent configuration
2016-04-27 15:05:32.887533 [8979/f14f182d] info [native] Executing script /home/nginx/dynatrace-6.3/agent/conf/generate_offsets.sh to generate Nginx Agent configuration
2016-04-27 15:05:35.215066 [8955/f14f182d] info [native] Removed generate_offsets.sh script
2016-04-27 15:05:35.215234 [8955/f14f182d] info [native] Parsing JSON configuration.
2016-04-27 15:05:35.217731 [8955/f14f182d] info [native] Generated MD5 sum for a buffer - address: 169980672; MD5: 66bcae0fbfd8332b9fa5a83b6f1cc345
2016-04-27 15:05:35.217778 [8955/f14f182d] info [native] Configuration is valid.】

can you tell me error:7 means?

generate_offsets.sh script exited with error: 7

18 REPLIES 18

harald_zeitlhof
Inactive

what operating system are you using? is it possibly RedHat?

chao_wang
Guide

$uname -a
Linux lkltest01 2.6.18-92.el5 #1 SMP Tue Jun 10 18:51:06 EDT 2008 x86_64 x86_64 x86_64 GNU/Linux

~$cat /etc/issue
CentOS release 5.2 (Final)

chao_wang
Guide

Today, I setup Centos5.2 the same OS like our customer.Then found the same problem.

【Executing script /home/nginx/dynatrace-6.3/agent/conf/generate_offsets.sh to generate Nginx Agent configuration
2016-04-28 13:16:00.808387 [23546/cf4a9d3f] severe [native] generate_offsets.sh script exited with error: 7
2016-04-28 13:16:00.808482 [23546/cf4a9d3f] info [native] Removed generate_offsets.sh script
2016-04-28 13:16:03.822931 [23546/cf4a9d3f] severe [native] Something went wrong during creation of offset file, please contact support.】

exit 7 errors occurred during offset generation

harald_zeitlhof
Inactive

can you please send the output of following commands:

md5sum /usr/sbin/nginx

and

prelink -y /usr/sbin/nginx | md5sum

thanks,
Harald

chao_wang
Guide

Hi Harald Z Thanks

jarek_jatczak
Dynatracer
Dynatracer


Wilson,


it is rather old CentOS release so I think the error is caused by
missing or outdated utilities used internally by the script. Please execute the
script manually because it gives detailed information about what went wrong.
The script is embedded in agent libraries


Here is how to extract the script:

https://community.dynatrace.com/community/display/DOCDT63/NGINX+Agent+Configuration#NGINXAgentConfig...

Jarek

chao_wang
Guide

[nginx@localhost conf]$ ./generate_offsets.sh -b /home/nginx/nginx1.6/sbin/nginx -o jsonfile
Error: Cannot retrieve repository metadata (repomd.xml) for repository: base. Please verify its path and try again
objdump: unrecognized option `--insn-width=9'
Usage: objdump <option(s)> <file(s)>
Display information from object <file(s)>.
At least one of the following switches must be given:

************

objdump: supported targets: elf64-x86-64 elf32-i386 a.out-i386-linux efi-app-ia32 elf64-little elf64-big elf32-little elf32-big srec symbolsrec tekhex binary ihex
objdump: supported architectures: i386 i386:x86-64 i8086 i386:intel i386:x86-64:intel
Fatal error: Cannot locate references to ngx_modules in file /home/nginx/nginx1.6/sbin/nginx
*********************************************************
* This specific setup cannot be handled automatically *
*********************************************************
Please contact Dynatrace support, providing them with the following data:

OS info : unknown
kernel info : Linux localhost.localdomain 2.6.18-92.el5 #1 SMP Tue Jun 10 18:51:06 EDT 2008 x86_64 x86_64 x86_64 GNU/Linux
nginx binary location : /home/nginx/nginx1.6/sbin/nginx
nginx binary info : ELF 64-bit LSB executable, AMD x86-64, version 1 (SYSV), for GNU/Linux 2.6.9, dynamically linked (uses shared libs), for GNU/Linux 2.6.9, not stripped
nginx binary fingerprint : 0b8f877c18e3886e666f6ec984aaf705
nginx binary configuration : nginx version: nginx/1.6.0; built by gcc 4.1.2 20071124 (Red Hat 4.1.2-42); configure arguments: --prefix=/home/nginx/nginx1.6 --user=nginx --without-http_rewrite_module --with-debug
nginx package : file /home/nginx/nginx1.6/sbin/nginx is not owned by any package
[nginx@localhost conf]$

chao_wang
Guide

After I try to solve【Cannot retrieve repository metadata (repomd.xml) for repository】error by modify [/etc/yum.repos.d/CentOS-Base.repo ]

then run the ./generate_offsets.sh CMD

generate_offsets.sh -b NGINX_BINARY -d NGINX_DEBUG_SYMBOLS -o JSON_FILE : generate offset file for stripped NGINX_BINARY using the corresponding debug symbols

and where NGINX_DEBUG_SYMBOLS?

jarek_jatczak
Dynatracer
Dynatracer

Wilson,

please update objdump utility

objdump: unrecognized option `--insn-width=9' Usage: objdump
<option(s)> <file(s)> Display information from object
<file(s)>

chao_wang
Guide

Hi when I update the objdump (to binutils-2.21.1a-3.1.src.rpm).Instrument problem

JSON configuration file is corrupted.

using script:

jarek_jatczak
Dynatracer
Dynatracer

The manually generated file called "jsonfile" and dated 13:22 May 3rd is not used by nginx agent. As shown in the agent log it reads dtnginx_offsets.json so please rename your jsonfile

chao_wang
Guide

@Jarek J

[nginx@localhost conf]$ DT_DUMP_SCRIPT=1 LD_PRELOAD=/home/nginx/dynatrace-6.3/agent/lib64/libdtnginxagent.so ls


Script saved to file generate_offsets.sh at current working directory.


[nginx@localhost conf]$ ls

dthostagent.ini dtwsagent.ini generate_offsets.sh
dtnginx_offsets.json1 dynaTraceWebServerSharedMemory

[nginx@localhost conf]$

[nginx@localhost conf]$ chmod 777 generate_offsets.sh

[nginx@localhost conf]$

[nginx@localhost conf]$ ./generate_offsets.sh -b /home/nginx/nginx1.6/sbin/nginx -d /home/nginx/nginx1.6/sbin/nginx -o dtnginx_self_generated_offsets.json


Script: New JSON offset file generated
Script: Please restart Nginx if it is working


[nginx@localhost conf]$ ls

dthostagent.ini dtwsagent.ini
dtnginx_offsets.json1 dynaTraceWebServerSharedMemory
dtnginx_self_generated_offsets.json generate_offsets.sh

[nginx@localhost conf]$

[nginx@localhost conf]$ chmod 775 dtnginx_self_generated_offsets.json

[nginx@localhost conf]$ ll
total 24848
-rw-rw-rw- 1 nginx nginx 281 Feb 23 02:25 dthostagent.ini
-rwxr-xr-x 1 nginx nginx 25327981 Feb 18 03:07 dtnginx_offsets.json1
-rwxrwxr-x 1 nginx nginx 3292 May 4 17:03 dtnginx_self_generated_offsets.json
-rw-rw-rw- 1 nginx nginx 6744 Feb 23 02:25 dtwsagent.ini
-rw-rw-rw- 1 nginx nginx 4214416 Apr 28 12:44 dynaTraceWebServerSharedMemory
-rwxrwxrwx 1 nginx nginx 27349 May 4 17:01 generate_offsets.sh

[nginx@localhost conf]$

[nginx@localhost conf]$

[nginx@localhost conf]$ LD_PRELOAD=/home/nginx/dynatrace-6.3/agent/lib64/libdtnginxagent.so /home/nginx/nginx1.6/sbin/nginx

[nginx@localhost conf]$

[nginx@localhost conf]$

[nginx@localhost log]$ cat dt_dtnginxagent_dtwsagent_3421.0.log
2016-05-04 17:06:05.622034 [3421/08582cce] info [native] Reading configuration file: /home/nginx/dynatrace-6.3/agent/conf/dtwsagent.ini
2016-05-04 17:06:05.622352 [3421/08582cce] info [native] Initialized logfile: /home/nginx/dynatrace-6.3/log/dt_dtnginxagent_dtwsagent_3421.log
2016-05-04 17:06:05.622394 [3421/08582cce] info [native] Max. logfile size: 10485760 bytes
2016-05-04 17:06:05.622405 [3421/08582cce] info [native] No sharedmemoryfilename directive supplied in configuration. Using default.
2016-05-04 17:06:05.622412 [3421/08582cce] info [native] No port directive supplied in configuration. Using default: 0
2016-05-04 17:06:05.622430 [3421/08582cce] info [native] Using SHM location: /home/nginx/dynatrace-6.3/agent/conf/dynaTraceWebServerSharedMemory
2016-05-04 17:06:05.622449 [3421/08582cce] info [native] Successfully attached to shared memory file /home/nginx/dynatrace-6.3/agent/conf/dynaTraceWebServerSharedMemory
2016-05-04 17:06:05.624014 [3421/08582cce] info [native] ------------------------------------------------------------------------------------------------
2016-05-04 17:06:05.624223 [3421/08582cce] info [native] dynaTrace Agent for nginx Web Server Copyright (C) 2004-2015 Dynatrace, http://www.dynatrace.com
2016-05-04 17:06:05.624622 [3421/08582cce] info [native] ------------------------------------------------------------------------------------------------
2016-05-04 17:06:05.624679 [3421/08582cce] info [native] Version ..................... 6.3.0.1305, build date Feb 22 2016 19:07:13, svn rev. 589374
2016-05-04 17:06:05.624688 [3421/08582cce] info [native] SHM layout .................. 6.3.0.1305
2016-05-04 17:06:05.624709 [3421/08582cce] info [native] Command line is /home/nginx/nginx1.6/sbin/nginx
2016-05-04 17:06:05.624730 [3421/08582cce] info [native] Build platform .............. Linux x86 64-bit
2016-05-04 17:06:05.624755 [3421/08582cce] info [native] Platform .................... Linux 2.6.18-92.el5 x86_64
2016-05-04 17:06:05.624760 [3421/08582cce] warning [native] Bootstrap version ........... not bootstrapped
2016-05-04 17:06:05.624765 [3421/08582cce] info [native] Log level console ........... none
2016-05-04 17:06:05.624770 [3421/08582cce] info [native] Log level file .............. info
2016-05-04 17:06:05.624776 [3421/08582cce] info [native] Log file .................... /home/nginx/dynatrace-6.3/log/dt_dtnginxagent_dtwsagent_3421.0.log
2016-05-04 17:06:05.624848 [3421/08582cce] debug [native] Initializing nginx API...
2016-05-04 17:06:05.624856 [3421/08582cce] info [native] Trying to load self generated configuration.
2016-05-04 17:06:05.624898 [3421/08582cce] info [native] Parsing JSON configuration.
2016-05-04 17:06:05.630323 [3421/08582cce] info [native] Generated MD5 sum for a file - path: /proc/self/exe; MD5: 0b8f877c18e3886e666f6ec984aaf705
2016-05-04 17:06:05.630511 [3421/08582cce] info [native] JSON configuration file is corrupted.
2016-05-04 17:06:05.630597 [3421/08582cce] info [native] Failed to load self generated configuration.
2016-05-04 17:06:05.630756 [3421/08582cce] info [native] Trying to load external configuration.
2016-05-04 17:06:05.630899 [3421/08582cce] info [native] Cannot open file /home/nginx/dynatrace-6.3/agent/conf/dtnginx_offsets.json for reading.
2016-05-04 17:06:05.631000 [3421/08582cce] info [native] Trying to load internal configuration.
2016-05-04 17:06:05.631044 [3421/08582cce] info [native] Parsing JSON configuration.
2016-05-04 17:06:05.631084 [3421/08582cce] info [native] JSON configuration file is corrupted.
2016-05-04 17:06:05.631121 [3421/08582cce] info [native] Failed to load internal configuration.
2016-05-04 17:06:05.631236 [3421/08582cce] info [native] generate_offsets.sh script generated
2016-05-04 17:06:05.631423 [3422/08582cce] info [native] Trying to generate Nginx Agent configuration.
2016-05-04 17:06:05.977101 [3421/08582cce] info [native] Removed generate_offsets.sh script
2016-05-04 17:06:05.977137 [3421/08582cce] severe [native] Nginx looks to be not from a repository. Trying to generate Nginx Agent configuration
2016-05-04 17:06:05.977340 [3444/08582cce] info [native] Executing script /home/nginx/dynatrace-6.3/agent/conf/generate_offsets.sh to generate Nginx Agent configuration
2016-05-04 17:06:06.355039 [3421/08582cce] info [native] Removed generate_offsets.sh script
2016-05-04 17:06:06.355099 [3421/08582cce] info [native] Parsing JSON configuration.
2016-05-04 17:06:06.355158 [3421/08582cce] info [native] JSON configuration file is corrupted.
2016-05-04 17:06:09.359453 [3421/08582cce] severe [native] Something went wrong during creation of offset file, please contact support.

[nginx@localhost log]$

harald_zeitlhof
Inactive

you have to run the offset generation script as root!

chao_wang
Guide

reinstall agent and try

chao_wang
Guide

use man create script

jarek_jatczak
Dynatracer
Dynatracer

Wilson,

it seems prudent, given growing number of comments, to continue this topic in your SUPDT. Please attach the dtnginx_self_generated_offsets.json which you have manually created. It looks as if the script was failing to generate offsets file properly

Jarek

chao_wang
Guide

chao_wang
Guide