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

Nginx installation help

babu_raju1
Contributor

I’m planning to setup web server agents in NGINX servers, based on your wiki page, I tried but unable to succeed.

I had mentioned this line in nginx.conf,

#Dynatrace module

LD_PRELOAD=/opt/dynatrace-6.2/agent/lib64/libdtagent.so nginx

It gives this below error.

nginx: [emerg] unknown directive "LD_PRELOAD=/opt/dynatrace-6.2/agent/lib64/libdtagent.so" in /app/icws/nginx/conf/nginx.conf:13

Any inputs.

19 REPLIES 19

pahofmann
Champion

The nginx configuration is a bit different then apache, you don´t add the config line to the nginx.conf file.

You have to start nginx with the prefix LD_PRELOAD=/opt/dynatrace-6.2/agent/lib64/libdtagent.so, thats why the line is LD_PRELOAD=/opt/dynatrace-6.2/agent/lib64/libdtagent.so nginx

You can run that manually, which of course would not persist over restarts. But you can add the line via the systemd/upstart/init.d start script, depending on your system.

Here is the documentation for adding the nginx agent: https://community.dynatrace.com/community/display/...

If you tell me your startup system or distro/version I can help you with fining the correct way.

babu_raju1
Contributor

Thanks Patrick, i did it start up, and i see in DT logs, its connected to collector, but still its not showing up in Dynatrace either under system profile agents overview or all the agents overview

Is the webserver primary agent visible in the Agent Overview?

babu_raju1
Contributor

its not coming up in agents overview, that was the issue i mentioned.

babu_raju1
Contributor

if i restart nginx, i see in DT bootstrap log, its Connected to Server/Collector and "Loading Agent /opt/dynatrace-6.2/agent/downloads/6.2.11.1005/native/linux-x86-64/libdtnginxagent.so".

in the other DT log, it gives one "warning [native] Some stub module variables are missing."

and in the next log it says, "bash: syntax error near unexpected token `('"

The nginx agent should not connect to the collector directly, but to the primary webserver agent which is a service/daemon running on the nginx machine. Could you attach the agent logifles?

babu_raju1
Contributor

i specified the collector server name and agent mapping name in dtwsagent.ini file, similar to how we configure it for apache. Is this not right.

#The name of the web server agent (used for agent mapping on the dynaTrace Server).

Name PRF_xxx_Nginx

#The address of the dynaTrace Collector this agent should connect to.
# The address is of the form host:port, e.g. exampleserver:9998

Server xxxxxtac300.xxx.xxx.net:9998

That's correct. Now if you start the Webserver agent you configured with the dtwsagent.ini, it should already be visible in the agent overview, even if the nginx isn't started yet. If not, there is a connection problem with the webserver agent.

log shows its connected, i have tomcat running in those boxes,those are connecting to collectors very well, no issues.

babu_raju1
Contributor

attached the log files.

babu_raju1
Contributor

if i try to reload nginx, i see this,

./nginx -s reload

2017-05-16 10:21:43 [9614386f] info [native] Loading collector peer list from /opt/dynatrace-6.2/agent/conf/collectorlist.PRF_CCS_Nginx

babu_raju1
Contributor

still stuck on "not showing up in Agents overview..."

babu_raju1
Contributor

i missed one step, forgot to add dynaTraceWebServerAgent as service, after i did. it shows up.

But it says NGINX state is not running, even though nginx is up.

Have you restarted nginx after starting the webserver agent service?

yes, tried multiple times.

But you see the subagent connected in the Agent Overview, just with the error state? Could you add a screenshot of the subagent details? Anything in the log of the subagent?

i stopped one by one and restarted web agent first and then nginx, now i see its coming up.

Great! The webserver agent must always be started before startig the webserver itself, else the agent in the webserver can't connect.