本文是小弟整合几位大神的文章,见笑@@
Linux利用sendmail和fetion发送报警通知
nagios监控windows主机 && linux主机
CentOS 5/6.X 使用 EPEL YUM源:
实验环境:
两台64位的centos-6.6
一台window-server-2003
安装网络yum源:
centos5.x--32位
[root@centos-server ~]# wget http://mirrors.yun-idc.com/epel/5/i386/epel-release-5-4.noarch.rpm
centos5.x--64位
[root@centos-server ~]# wget http://mirrors.hust.edu.cn/epel//5/x86_64/epel-release-5-4.noarch.rpm
centos6.x--32位
[root@centos-server ~]# wget http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
centos6.x--64位
[root@centos-server ~]# wget http://mirrors.hust.edu.cn/epel//6/x86_64/epel-release-6-8.noarch.rpm
[root@centos-server ~]# rpm -ivh epel-release-6-8.noarch.rpm
搭建nagios监控服务器:
yum install httpd php* openssl openssl-devel nagios nagios-plugins*
setenforce 0
iptables -I INPUT -p tcp --dport 80 -j ACCEPT
增加httpd的访问验证
[root@centos-server ~]# htpasswd -c /etc/nagios/htpasswd nagiosadmin
New password:
Re-type new password:
Adding password for user nagiosadmin
注意nagios的默认用户就是nagiosadmin,如果你使用的不是此用户,需要修改以下项目
[root@centos-server objects]# cat /etc/nagios/cgi.cfg |grep nagiosadmin
authorized_for_system_information=nagiosadmin
authorized_for_configuration_information=nagiosadmin
authorized_for_system_commands=nagiosadmin
authorized_for_all_services=nagiosadmin
authorized_for_all_hosts=nagiosadmin
authorized_for_all_service_commands=nagiosadmin
authorized_for_all_host_commands=nagiosadmin
快速修改命令
[root@centos-server ~]# sed -i 's/nagiosadmin/dragon/g' /etc/nagios/cgi.cfg
通过httpd访问nagios的web文件
[root@centos-server objects]# cat >> /etc/httpd/conf/httpd.conf /etc/mail.rc |