1,加载插件
# ln -s /usr/share/munin/plugins/nginx* /etc/munin/plugins
munin自带的nginx功能就二个,如果下了第三方的插件,可以一并放到/etc/munin/plugins,这样监控的会多些
2,配置nginx的munin
# vim /etc/nginx/conf.d/munin.conf //添加以下内容 location /nginx_status { stub_status on; access_log off; allow 127.0.0.1; deny all; } # /etc/init.d/nginx restart //重启nginx
然后看一下http://xxxx.com/nginx_status是否能访问,如果配置正确,会出现以下内容
Active connections: 2
server accepts handled requests
374 374 1726
Reading: 0 Writing: 1 Waiting: 1
3,配置munin的nginx
# vim /etc/munin/plugin-conf.d/nginx //创建文件 [nginx*] env.url http://xxxx.com/nginx_status env.port 80 [nginx_error] //查看nginx错误信息的,默认没有这个插件 user tank env.logpath /var/log/nginx # /etc/init.d/munin-node restart //重启munin
4,检查munin是否配置正确
[root@node1 plugins]# munin-node-configure |grep nginx //检查nginx是否激活 nginx_request | yes | nginx_status | yes | [root@node1 plugins]# munin-node-configure --suggest 2>&1 | grep nginx //检查nginx是否配置正确 nginx_request | yes | yes nginx_status | yes | yes
如果上面二步都是yes的话,说明已安装配置成功了。
转载请注明
作者:海底苍鹰
地址:http://blog.51yip.com/server/1692.html