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

NGINX Plugin Monitoring Plus

mark_medley
Organizer

. Nginx has logging
capabilities that are currently turned off, but are designed to give the timing
stats. e.g.


  • <a href="http://nginx.org/en/docs/http/ngx_http_upstream_module.html#var_upstream_connect_time">$upstream_connect_time</a> – The time spent on establishing a connection with an upstream server
  • <a href="http://nginx.org/en/docs/http/ngx_http_upstream_module.html#var_upstream_header_time">$upstream_header_time</a> – The time between establishing a connection and receiving the first byte of the response header from the upstream server
  • <a href="http://nginx.org/en/docs/http/ngx_http_upstream_module.html#var_upstream_response_time">$upstream_response_time</a> – The time between establishing a connection and receiving the last byte of the response body from the upstream server
  • <a href="http://nginx.org/en/docs/http/ngx_http_log_module.html#var_request_time">$request_time</a> – The total time spent processing a request

Now I have install the plugin and walk thru the steps setting up. But getting error when I setup monitoring in DT. I have the accurate hostname and IP, is there something else I'm missing?

Reason for failure:
External error occurred
Error message: invalid Content-type
Detailed error message
IllegalArgumentException

Maybe something on NGINX side?

8 REPLIES 8

Anthony_Jamora
Contributor

It might help to add this question into the comments section of the plugin page too.

https://community.dynatrace.com/community/pages/viewpage.action?title=NGINX+Plus+Monitoring+Plugin&spaceKey=DL

michael_wolf
Newcomer

That error is thrown when the plugin doesn't receive a JSON object from the NGINX server due, most likely, to an error in making the connection. I was receiving this error due to the fact the the plugin was initially hardcoded to communicate to NGINX on port 80. You can troubleshoot by trying to curl the NGINX endpoint from wherever your plugin is being executed on to see what response you get back.

mark_medley
Organizer

So I got the nginx status page implemented:

Active connections: 1 
server accepts handled requests
32801 32801 659

Reading: 0 Writing: 1 Waiting: 0

but still having trouble getting the Nginx Plus Monitoring working.

The page works I click on the URL which displays the stats above, but I can't seem to figure the issue from within DT. I done a curl with the URL from server and it the same stats from above appeared. I might be missing a step. Also I keep getting the error during the Test Plugin option in Dev. Status: 500 (Invalid Content-type)
Message: IllegalArgumentException
Exception: java.lang.IllegalArgumentException: Invalid response header, expected application/json, but got nulljava.lang.IllegalArgumentException: Invalid response header, expected application/json, but got null
at com.dynatrace.plugin.nginx.NginxPlusMonitoringConnection.getStatusJson(NginxPlusMonitoringConnection.java:35)
at com.dynatrace.plugin.nginx.NginxPlusMonitor.execute(NginxPlusMonitor.java:66)
at com.dynatrace.diagnostics.sdk.UserPluginManager.a(SourceFile:713)
at com.dynatrace.diagnostics.sdk.UserPluginManager.b(SourceFile:476)
at com.dynatrace.diagnostics.sdk.UserPluginManager.executePlugin(SourceFile:274)
at com.dynatrace.diagnostics.sdk.MonitorPluginExecutor.execute(SourceFile:50)
at com.dynatrace.diagnostics.sdk.MonitorPluginExecutor.execute(SourceFile:26)
at com.dynatrace.diagnostics.schedule.ServerJobCenterRegistry.a(SourceFile:190)
at com.dynatrace.diagnostics.schedule.ServerJobCenterRegistry.a(SourceFile:413)
at com.dynatrace.diagnostics.schedule.ServerJobCenterRegistry.execute(SourceFile:337)
at com.dynatrace.diagnostics.schedule.SchedulerJob.a(SourceFile:101)
at com.dynatrace.diagnostics.schedule.SchedulerJob.work(SourceFile:92)
at com.dynatrace.diagnostics.schedule.SchedulerJob.executeJobInfo(SourceFile:241)
at com.dynatrace.diagnostics.schedule.QuartzJob.execute(SourceFile:45)
at org.quartz.core.JobRunShell.run(JobRunShell.java:202)
at com.dynatrace.diagnostics.schedule.QuartzThreadPool$WorkerThread.run(SourceFile:788)

michael_wolf
Newcomer

Hello Mark, I'm not sure I can tell from this post whether or not you're getting the correct output from the status page. Is the response in JSON format? Could you post the curl command you're using?

mark_medley
Organizer

CURL HTTPS://Hostname/Nginx_Stats2/:80. This brought back the Active connection information.

Here is the error I get from setting up the monitor portion.

Reason for failure
External error occurred

Error message:
Url connection failed

Detailed error message:
IOException

The 500 error is from me trying to test the plugin development. I was just wondering why I;m still getting the error message.

michael_wolf
Newcomer

Hi Mark, can you post a bit of the active connection information you receive when you cURL the NGINX status endpoint? In order for the plugin to process the data, that response needs to be in the JSON format. If the content-type is not "JSON", the script cannot process it and thus throws a 500

Status: 500 (Invalid Content-type) Message: IllegalArgumentException Exception: java.lang.IllegalArgumentException: Invalid response header, expected application/json, but got null

Make sure you are hitting the JSON endpoint (and not the html one!)

mark_medley
Organizer

So you sen this code

listen $URL:$PORT;

location /status {


status;

}

Do you have snippet of json code it should bring back?

Actually following the instructions on how to implement , there is NO directory for

/usr/share/nginx/html

Also Ops did said:

It turns out that Socialtext comes with nginx_status
compiled in, and setup - but secured so that no one can access it.

I've opened up the config setting within Socialtext - but I
think that will go away once we upgrade the site.

below is the way our status is turned on

location

/nginx_status2

{
stub_status on;

access_log off;
allow all;
deny 1.1.1.1;
}

michael_wolf
Newcomer

The response should begin something like this:

{"version": 6,"nginx_version": "1.11.3","address": "158.48.136.57","generation": 17971,"load_timestamp": 1492087035680,"timestamp": 1492087181842,"pid": 10056,"processes": {"respawned": 0},"connections": {"accepted": 10103394,"dropped": 0,"active": 8,"idle": 95},"ssl": {"handshakes": 940,"handshakes_failed": 4,"session_reuses": 51},"requests": {"total": 431394841,"current": 8},"server_zones": {},"upstreams": {"API_List_Cluster": {"peers": [{"id": 0,"server": "10.2.136.19:50002","backup": false,"weight": 1,"state": "up","active": 0,"requests": 1,"header_time": 210,"response_time": 212,"responses": {"1xx": 0,"2xx": 1,"3xx": 0,"4xx": 0,"5xx": 0,"total": 1},"sent": 4147,"received": 4065,"fails": 0,"unavail": 0,"health_checks": {"checks": 73,"fails": 0,"unhealthy": 0,"last_passed": true},"downtime": 0,"downstart": 0,"downcount": 0,"refs": 1,"selected": 1492087036000},{"id": 1,"server": "10.2.136.25:50002","backup": false,"weight": 1,"state": "up","active": 0,"requests": 80,"header_time": 77,"response_time": 80,"responses": {"1xx": 0,"2xx": 75,"3xx": 0,"4xx": 5,"5xx": 0,"total": 80},"sent": 366282,"received": 216523,"fails": 0,"unavail": 0,"health_checks": {"checks": 73,"fails": 0,"unhealthy": 0,"last_passed": true},"downtime": 0,"downstart": 0,"downcount": 0,"refs": 1,"selected": 1492087144000},{"id": 2,"server": "10.2.136.26:50002"....