The production environment is as follows:
Operating System: CentOS Release 6.8 (Final)
combat Mission : Implement cacti monitor Nginx operation status
Early to achieve cacti to the operating system, database, Apache and other elephant monitor, such as:
650) this.width=650; "Src=" Http://s4.51cto.com/wyfs02/M01/83/79/wKiom1d0a8LR0DUmAAGUaEICQcc006.jpg-wh_500x0-wm_3 -wmp_4-s_3393215506.jpg "style=" width:606px;height:300px; "title=" 1.JPG "alt=" Wkiom1d0a8lr0dumaaguaeicqcc006.jpg-wh_50 "width=" 606 "height=" "border=" 0 "hspace=" 0 "vspace=" 0 "/>
for nginx installation of the compilation process omitted, but note that when compiling the installation Nginx, to open this --with-http_stub_status_module.
in /application/nginx/conf/extra/nginx_vhosts.conf, the file is configured as follows:
Server
{
Listen 9090;
server_name 117.40.239.9;
Location/nginxstatus {
Stub_status on;
Access_log off;
}
}
[Email protected]]#. /.. /sbin/nginx-t
Nginx:the configuration File/application/nginx-1.10.1/conf/nginx.confsyntax is ok
Nginx:configuration File/application/nginx-1.10.1/conf/nginx.conftest is successful
[Email protected]]#. /.. /sbin/nginx-s Reload
Test Nginx Run Status Page : Http://117.40.239.9:9090/NginxStatus
650) this.width=650; "Src=" Http://s3.51cto.com/wyfs02/M02/83/79/wKiom1d0bA7iGaMiAABbPYuI_C0679.jpg-wh_500x0-wm_3 -wmp_4-s_821844493.jpg "title=" 2.JPG "alt=" Wkiom1d0ba7igamiaabbpyui_c0679.jpg-wh_50 "/>
#下载 cacti for Nginx plug-in package
[Email protected]]# wget http://www.oschina.net/uploads/code/cacti-nginx.tar.gz
[Email protected]]# Tree
.
├──Cacti_graph_template_nginx_clients_stat.xml
├──Cacti_graph_template_nginx_sockets_stat.xml
├── Cacti-nginx-readme
├── get_nginx_clients_status.pl
└── get_nginx_socket_status.pl
0 directories,5 Files
After extracting a total of 5 files, first put get_nginx_socket_status.pl
As well as get_nginx_clients_status.pl upload to the server cacti directory scripts and set executable permissions with 755 read and Write permissions.
[Email protected] scripts]#./get_nginx_clients_status.pl Http://117.40.239.9:9090/NginxStatus
Nginx_active:1 nginx_reading:0 nginx_writing:1nginx_waiting:0
Next, import two XML files in the Cacti admin panel
Imported by Import Templates > Import Template from localfile (Browse Import plugin package 2 additional files)
Cacti_graph_template_nginx_clients_stat.xml
Cacti_graph_template_nginx_sockets_stat.xml
1. Create the device:
650) this.width=650; "Src=" Http://s4.51cto.com/wyfs02/M01/83/77/wKioL1d0bH7RhVMtAAIHm2ZxWAo633.jpg-wh_500x0-wm_3 -wmp_4-s_4164628811.jpg "title=" 3.JPG "alt=" Wkiol1d0bh7rhvmtaaihm2zxwao633.jpg-wh_50 "/>
2.Create Graphs for this Host
650) this.width=650; "Src=" Http://s5.51cto.com/wyfs02/M01/83/79/wKiom1d0bKjBp5-xAACa0Z6Hlzs511.jpg-wh_500x0-wm_3 -wmp_4-s_3363512851.jpg "title=" 4.JPG "alt=" Wkiom1d0bkjbp5-xaaca0z6hlzs511.jpg-wh_50 "/>
3.Graph Trees
650) this.width=650; "Src=" Http://s4.51cto.com/wyfs02/M00/83/79/wKiom1d0bNKj4CQdAAChlhLaTss350.jpg-wh_500x0-wm_3 -wmp_4-s_820881488.jpg "title=" 5.JPG "alt=" Wkiom1d0bnkj4cqdaachlhlatss350.jpg-wh_50 "/>
The test results are as follows :
650) this.width=650; "Src=" Http://s2.51cto.com/wyfs02/M01/83/77/wKioL1d0bPKiA8TBAAFpQtdn4N8411.jpg-wh_500x0-wm_3 -wmp_4-s_1353974564.jpg "title=" 5.JPG "alt=" Wkiol1d0bpkia8tbaafpqtdn4n8411.jpg-wh_50 "/>
Attached: nginx operation status Information detailed
Active Connections:3 #活跃的连接数量
Server accepts handled requests# connection 32, handshake 32, request processing 27
32 32 27
reading:0 Writing:1waiting:2
reading-number of connections to read clients 0
writing-number of response data to clients 2
waiting-The keep-alive is turned on, this value equals active= (reading+writing) =3
This article is from the "sky9890" blog, make sure to keep this source http://sky9896.blog.51cto.com/2330653/1794418
Implement cacti monitor Nginx operation status