-
Notifications
You must be signed in to change notification settings - Fork 5.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
new plugin: nginx_plus #3214
new plugin: nginx_plus #3214
Changes from 10 commits
0f772a3
02eb8cd
74374cb
079ff75
579952e
5987e64
c95dad2
6bfc295
f3d0931
f965bca
767fd53
33fe1f0
c84861a
b19a1da
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,125 @@ | ||
# Telegraf Plugin: nginx_plus | ||
|
||
Nginx Plus is a commercial version of the open source web server Nginx. The use this plugin you will need a license. For more information about the differences between Nginx (F/OSS) and Nginx Plus, [click here](https://www.nginx.com/blog/whats-difference-nginx-foss-nginx-plus/). | ||
|
||
Structures for Nginx Plus have been built based on history of | ||
[status module documentation](http://nginx.org/en/docs/http/ngx_http_status_module.html) | ||
|
||
### Configuration: | ||
|
||
``` | ||
# Read Nginx Plus' advanced status information | ||
[[inputs.nginx_plus]] | ||
## An array of Nginx status URIs to gather stats. | ||
urls = ["http://localhost/status"] | ||
``` | ||
|
||
### Measurements & Fields: | ||
|
||
- nginx_plus_processes | ||
- respawned | ||
- nginx_plus_connections | ||
- accepted | ||
- dropped | ||
- active | ||
- idle | ||
- nginx_plus_ssl | ||
- handshakes | ||
- handshakes_failed | ||
- session_reuses | ||
- nginx_plus_requests | ||
- total | ||
- current | ||
- nginx_plus_upstream, nginx_plus_stream_upstream | ||
- keepalive | ||
- zombies | ||
- nginx_plus_upstream_peer, nginx_plus_stream_upstream_peer | ||
- requests | ||
- unavail | ||
- healthchecks_checks | ||
- header_time | ||
- response_time | ||
- state | ||
- active | ||
- downstart | ||
- healthchecks_last_passed | ||
- weight | ||
- responses_1xx | ||
- responses_2xx | ||
- responses_3xx | ||
- responses_4xx | ||
- responses_5xx | ||
- received | ||
- selected | ||
- healthchecks_fails | ||
- healthchecks_unhealthy | ||
- backup | ||
- responses_total | ||
- sent | ||
- fails | ||
- downtime | ||
|
||
|
||
### Tags: | ||
|
||
- nginx_plus_processes, nginx_plus_connections, nginx_plus_ssl, nginx_plus_requests | ||
- server | ||
- port | ||
- host | ||
|
||
- nginx_plus_upstream, nginx_plus_stream_upstream | ||
- host | ||
- upstream | ||
- server | ||
- port | ||
|
||
- nginx_plus_upstream_peer, nginx_plus_stream_upstream_peer | ||
- id | ||
- host | ||
- upstream | ||
- server | ||
- port | ||
- serverAddress | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should be |
||
|
||
### Example Output: | ||
|
||
Using this configuration: | ||
``` | ||
[[inputs.nginx_plus]] | ||
## An array of Nginx Plus status URIs to gather stats. | ||
urls = ["http://localhost/status"] | ||
``` | ||
|
||
When run with: | ||
``` | ||
./telegraf -config telegraf.conf -input-filter nginx_plus -test | ||
``` | ||
|
||
It produces: | ||
``` | ||
* Plugin: inputs.nginx_plus, Collection 1 | ||
> nginx_plus_processes,server=localhost,port=12021,host=word.local respawned="0xc420075538" 1504922954000000000 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. respawned is an address, this is probably a bug where we need to dereference a pointer. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @danielnelson I think I fixed all of these. Here's the commit: 33fe1f0 - It looks like in the original commits the test was written like this, which was making the tests pass:
I updated the test to just expect the int64:
And updated the map:
Those were the only two instances where this was happening. I made the changes to both nginx_plus.go and the tests, and made sure this compiled. I then ran telegraf in test mode against one of our load balancers and I did not see any addresses in the output. If this looks like a good fix I will update the README to remove the addresses from the sample output. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You will want to check that they are not nil before dereferencing, I assume they are pointers because in some versions they don't exist. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How would you recommend I do that? Something like this for respawned?
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Pushed a fix in c84861a |
||
> nginx_plus_connections,server=localhost,port=12021,host=word.local accepted=4458727685i,dropped=10138424i,active=10256i,idle=29390i 1504922954000000000 | ||
> nginx_plus_ssl,server=localhost,port=12021,host=word.local handshakes=0i,handshakes_failed=0i,session_reuses=0i 1504922954000000000 | ||
> nginx_plus_requests,host=word.local,server=localhost,port=12021 total=147885504244i,current=10019i 1504922954000000000 | ||
> nginx_plus_upstream,host=word.local,upstream=dataserver80,server=localhost,port=12021 zombies=0i,keepalive=0i 1504922954000000000 | ||
> nginx_plus_upstream_peer,id=0,server=localhost,port=12021,host=word.local,upstream=dataserver80,serverAddress=10.10.102.181:80 responses_5xx=27831i,healthchecks_unhealthy=1i,downtime=484817i,healthchecks_last_passed=true,responses_1xx=0i,active=22i,requests=2620930i,responses_total=2620652i,fails=4i,downstart=0i,state="up",responses_4xx=16i,healthchecks_checks=14133i,selected="0xc4201b22e8",response_time=95i,responses_2xx=2592805i,weight=1i,responses_3xx=0i,sent=3802831967i,received=536695496i,unavail=4i,healthchecks_fails=27i,header_time=94i,backup=false 1504922954000000000 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. selected also has an address and probably needs dereferenced. Double check that other similar pointers are dereferenced. |
||
``` | ||
|
||
### Reference material | ||
|
||
Subsequent versions of status response structure available here: | ||
|
||
- [version 1](http://web.archive.org/web/20130805111222/http://nginx.org/en/docs/http/ngx_http_status_module.html) | ||
|
||
- [version 2](http://web.archive.org/web/20131218101504/http://nginx.org/en/docs/http/ngx_http_status_module.html) | ||
|
||
- version 3 - not available | ||
|
||
- [version 4](http://web.archive.org/web/20141218170938/http://nginx.org/en/docs/http/ngx_http_status_module.html) | ||
|
||
- [version 5](http://web.archive.org/web/20150414043916/http://nginx.org/en/docs/http/ngx_http_status_module.html) | ||
|
||
- [version 6](http://web.archive.org/web/20150918163811/http://nginx.org/en/docs/http/ngx_http_status_module.html) | ||
|
||
- [version 7](http://web.archive.org/web/20161107221028/http://nginx.org/en/docs/http/ngx_http_status_module.html) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't list host since it is added globally by Telegraf (depending on config).