首页 > 代码库 > nagios监控服务
nagios监控服务
上一篇:nagios监控的安装 http://wangjiatong.blog.51cto.com/11834370/1886423
nagios服务器:192.168.217.131
被监控端:192.168.217.154
vim /usr/local/nagios/etc/objects/hosts.cfg (hosts.cfg新建的)
define host{
use linux-server
host_name lamp
alias lamp
address 192.168.217.154
}
definehostgroup{
hostgroup_name lamp-server
alias lamp-server
members lamp
}
vim /usr/local/nagios/etc/objects/services.cfg(service新建的)
define service{
use local-service
host_name lamp
service_description check-host-alive
check_command check-host-alive
}
define service{
use local-service,services-pnp
host_name lamp
service_description PING //表示监控ping服务
check_command check_ping!100.0,20%!500.0,60%
}
define service{
use local-service
host_name lamp
service_description SSH
check_command check_ssh
}
define service{
use local-service
host_name lamp
service_description Swap Usage
check_command check_local_swap!20!10
}
define service{
use local-service
host_name lamp
service_description Current Users
check_command check_local_users!20!50
}
检查是否配置有问题:/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
Total Warnings: 0
Total Errors: 0
看到2个0说明配置没问题:
在vim /usr/local/nagios/etc/nagios.cfg中添加
然后重启nagios服务:
[root@nagios objects]# /etc/init.d/nagios restart
Restarting nagios (via systemctl): [ 确定 ]
在服务器的浏览器中:http://http://192.168.217.131(服务器ip)/nagios/
需要输入账号和密码,见上篇nagios监控的安装 http://wangjiatong.blog.51cto.com/11834370/1886423
然后就看到这样的效果:
本文出自 “不忘初心” 博客,转载请与作者联系!
nagios监控服务