This repository was archived by the owner on Jun 22, 2022. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ nginx_status
2+ ===============
3+
4+ python module for ganglia 3.1.
5+
6+ "nginx_status" send metrics on nginx's [ status stub module] ( http://wiki.nginx.org/HttpStubStatusModule ) .
7+
8+ ## Metrics
9+ * nginx_server_version
10+ * nginx_active_connections
11+ * nginx_accepts
12+ * nginx_handled
13+ * nginx_requests
14+ * nginx_reading
15+ * nginx_writing
16+ * nginx_waiting
17+
18+ ## Params
19+ * status_url (The url to query for nginx status. Default: 'http://localhost/nginx_status ')
20+ * nginx_bin (The full path to the nginx binary. Default '/usr/sbin/nginx')
21+ * refresh_rate (The time in seconds between polling nginx. Default: 15)
22+
23+ ## NOTES
24+ * This has only been tested on python 2.6.5 on Ubuntu 10.04.
25+ * Ensure that the status stub module is setup correctly when using this module.
26+
27+ ## AUTHOR
28+
29+ 30+
Original file line number Diff line number Diff line change 1+ #
2+
3+ modules {
4+ module {
5+ name = 'nginx_status'
6+ language = 'python'
7+
8+ param status_url {
9+ value = 'http://localhost/nginx_status'
10+ }
11+ param nginx_bin {
12+ value = '/usr/sbin/nginx'
13+ }
14+ param refresh_rate {
15+ value = '15'
16+ }
17+ }
18+ }
19+
20+ collection_group {
21+ collect_once = yes
22+ time_threshold = 20
23+
24+ metric {
25+ name = 'nginx_server_version'
26+ title = "Nginx Version"
27+ }
28+ }
29+
30+ collection_group {
31+ collect_every = 10
32+ time_threshold = 20
33+
34+ metric {
35+ name = "nginx_active_connections"
36+ title = "Total Active Connections"
37+ value_threshold = 1.0
38+ }
39+
40+ metric {
41+ name = "nginx_accepts"
42+ title = "Total Connections Accepted"
43+ value_threshold = 1.0
44+ }
45+
46+ metric {
47+ name = "nginx_handled"
48+ title = "Total Connections Handled"
49+ value_threshold = 1.0
50+ }
51+
52+ metric {
53+ name = "nginx_requests"
54+ title = "Total Requests"
55+ value_threshold = 1.0
56+ }
57+
58+ metric {
59+ name = "nginx_reading"
60+ title = "Connections Reading"
61+ value_threshold = 1.0
62+ }
63+
64+ metric {
65+ name = "nginx_writing"
66+ title = "Connections Writing"
67+ value_threshold = 1.0
68+ }
69+
70+ metric {
71+ name = "nginx_waiting"
72+ title = "Connections Waiting"
73+ value_threshold = 1.0
74+ }
75+ }
Original file line number Diff line number Diff line change 1+ <?php
2+ /*
3+ * Graphs take from the mysql-cacti-templates project:
4+ * http://code.google.com/p/mysql-cacti-templates/wiki/NginxTemplates
5+ */
6+
7+ /* Pass in by reference! */
8+ function graph_nginx_accepts_ratio_report ( &$ rrdtool_graph ) {
9+
10+ global $ context ,
11+ $ hostname ,
12+ $ range ,
13+ $ rrd_dir ,
14+ $ size ,
15+ $ strip_domainname ;
16+
17+ if ($ strip_domainname ) {
18+ $ hostname = strip_domainname ($ hostname );
19+ }
20+
21+ $ title = 'Nginx Accepts Ratio ' ;
22+ if ($ context != 'host ' ) {
23+ $ rrdtool_graph ['title ' ] = $ title ;
24+ } else {
25+ $ rrdtool_graph ['title ' ] = "$ hostname $ title last $ range " ;
26+ }
27+ $ rrdtool_graph ['lower-limit ' ] = '0 ' ;
28+ $ rrdtool_graph ['extras ' ] = '--rigid ' ;
29+ $ rrdtool_graph ['height ' ] += ($ size == 'medium ' ) ? 28 : 0 ;
30+
31+ $ series =
32+ "DEF:'accepts'=' $ {rrd_dir}/nginx_accepts.rrd':'sum':AVERAGE "
33+ ."DEF:'handled'=' $ {rrd_dir}/nginx_handled.rrd':'sum':AVERAGE "
34+ ."DEF:'requests'=' $ {rrd_dir}/nginx_requests.rrd':'sum':AVERAGE "
35+ ."CDEF:'handled_ratio'='accepts,handled,/' "
36+ ."CDEF:'requests_ratio'='requests,accepts,/' "
37+ ."LINE2:'handled_ratio'#850707:'Accepted / Handled' "
38+ ."LINE2:'requests_ratio'#D1642E:'Requests / Accepted' "
39+ ;
40+
41+ $ rrdtool_graph ['series ' ] = $ series ;
42+
43+ return $ rrdtool_graph ;
44+
45+ }
46+
47+ ?>
Original file line number Diff line number Diff line change 1+ <?php
2+ /*
3+ * Graphs take from the mysql-cacti-templates project:
4+ * http://code.google.com/p/mysql-cacti-templates/wiki/NginxTemplates
5+ */
6+
7+ /* Pass in by reference! */
8+ function graph_nginx_scoreboard_report ( &$ rrdtool_graph ) {
9+
10+ global $ context ,
11+ $ hostname ,
12+ $ range ,
13+ $ rrd_dir ,
14+ $ size ,
15+ $ strip_domainname ;
16+
17+ if ($ strip_domainname ) {
18+ $ hostname = strip_domainname ($ hostname );
19+ }
20+
21+ $ title = 'Nginx Scoreboard ' ;
22+ if ($ context != 'host ' ) {
23+ $ rrdtool_graph ['title ' ] = $ title ;
24+ } else {
25+ $ rrdtool_graph ['title ' ] = "$ hostname $ title last $ range " ;
26+ }
27+ $ rrdtool_graph ['lower-limit ' ] = '0 ' ;
28+ $ rrdtool_graph ['vertical-label ' ] = 'requests/sec ' ;
29+ $ rrdtool_graph ['extras ' ] = '--rigid ' ;
30+ $ rrdtool_graph ['height ' ] += ($ size == 'medium ' ) ? 28 : 0 ;
31+
32+ $ series =
33+ "DEF:'active'=' $ {rrd_dir}/nginx_active_connections.rrd':'sum':AVERAGE "
34+ ."DEF:'reading'=' $ {rrd_dir}/nginx_reading.rrd':'sum':AVERAGE "
35+ ."DEF:'writing'=' $ {rrd_dir}/nginx_writing.rrd':'sum':AVERAGE "
36+ ."DEF:'waiting'=' $ {rrd_dir}/nginx_waiting.rrd':'sum':AVERAGE "
37+ ."AREA:'reading'#D1642E:'Reading' "
38+ ."STACK:'writing'#850707:'Writing' "
39+ ."STACK:'waiting'#487860:'Waiting' "
40+ ."LINE1:'active'#000000:'Active' "
41+ ;
42+
43+ $ rrdtool_graph ['series ' ] = $ series ;
44+
45+ return $ rrdtool_graph ;
46+
47+ }
48+
49+ ?>
You can’t perform that action at this time.
0 commit comments