Home >Database >Mysql Tutorial >Cacti监控Nginx服务

Cacti监控Nginx服务

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-07 15:04:011163browse

1、 下载官方提供的 Nginx 监控 模版 cacti-nginx.tar.gz (模版见博文下方附件) 2、 解压后将 *.pl 可执行程序上传至 cacti 部署目录 /var/www/html/cacti/scripts 3、 赋予执行权限 chmod u+x *.pl 4、 导入 cacti_graph_template_nginx_clients_stat.xml

 1、  下载官方提供的Nginx监控模版cacti-nginx.tar.gz(模版见博文下方附件)

2、  解压后将*.pl可执行程序上传至cacti部署目录/var/www/html/cacti/scripts

3、  赋予执行权限chmod u+x *.pl

4、  导入cacti_graph_template_nginx_clients_stat.xml cacti_graph_template_nginx_sockets_stat.xml绘图模版;
导入步骤如下: 

登陆cacti监控平台Console(控制台) ---> Import Templates(导入模板)

5、  查看Nginx是否配置with-http_stub_status_module统计模块

[root@localhost sbin]# ./nginx -V

nginx version: nginx/1.3.3

TLS SNI support disabled

configure arguments: --add-module= --with-http_stub_status_module --with-http_ssl_module

以上信息显示Nginx已经添加了该模块。如果没哟则需要你重新编译将该模块添加进去并配置Nginx的配置文件如下所示:

    location /status  #统计Nginx运行状态

      {

        stub_status on;

        access_log /usr/local/nginx/logs/status.log;

        auth_basic "NginxStatus";

        allow 10.0.0.0/16;

        deny all;

       }

Tip:在你的server标签内添加

6、  测试Nginx是否正常返回信息

a)       浏览器端测试http://10.0.211.7/status如果返回信息则证明配置已经生效了

b)       cacti服务器的pl脚本目录执行

[root@localhost scripts]# ./get_nginx_socket_status.pl http://10.0.211.7/status

nginx_accepts:423864 nginx_handled:423864 nginx_requests:481538

 返回以上信息则证明你可以进行下一步的设置了,亲~

7、  现在我们就可以像添加其他监控对象方法在console->device->主机->Associated Graph Templates进行添加->创建图像
Cacti监控Nginx服务cacti-nginx.zip

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn