0.配置安装包
[[email protected] ~]# yum install -y nagios-server-addons
1.配置监控指向文件
这里要让每个被监控节点都指向监控站点,同时重启服务。
[[email protected] ~]# vim /etc/nagios/nrpe.cfg
[[email protected] ~]# systemctl restart nrpe
[[email protected] ~]# vim /etc/nagios/nrpe.cfg
[[email protected] ~]# systemctl restart nrpe
[[email protected] ~]# vim /etc/nagios/nrpe.cfg
[[email protected] ~]# systemctl restart nrpe
[[email protected] ~]# vim /etc/nagios/nrpe.cfg
[[email protected] ~]# systemctl restart nrpe
2.配置集群监控
选中集群中的一个节点,让系统自动识别。
[[email protected] ~]# configure-gluster-nagios -c gluster-test -H servera.lab.example.com
Cluster configurations changed
Changes :
Hostgroup gluster-test - ADD
Host gluster-test - ADD
Service - Volume Utilization - secvol -ADD
Service - Volume Split-brain status - secvol -ADD
Service - Volume Status - secvol -ADD
Service - Volume Utilization - prodvol -ADD
Service - Volume Quota - prodvol -ADD
Service - Volume Split-brain status - prodvol -ADD
Service - Volume Status - prodvol -ADD
Service - Volume Utilization - testvol -ADD
Service - Volume Geo-Replication - testvol -ADD
Service - Volume Status - testvol -ADD
Service - Volume Utilization - tiervol -ADD
Service - Volume Status - tiervol -ADD
Service - Cluster Utilization -ADD
Service - Cluster - Quorum Status -ADD
Service - Cluster Auto Config -ADD
Host servera.lab.example.com - ADD
Service - Brick Utilization - /bricks/prod/prodvol_n1 -ADD
Service - Brick - /bricks/prod/prodvol_n1 -ADD
Service - Brick Utilization - /bricks/test/testvol_n1 -ADD
Service - Brick - /bricks/test/testvol_n1 -ADD
Host serverb.lab.example.com - ADD
Service - Brick Utilization - /bricks/prod/prodvol_n2 -ADD
Service - Brick - /bricks/prod/prodvol_n2 -ADD
Service - Brick Utilization - /bricks/test/testvol_n2 -ADD
Service - Brick - /bricks/test/testvol_n2 -ADD
Host serverc.lab.example.com - ADD
Service - Brick Utilization - /bricks/sec/secvol_n3 -ADD
Service - Brick - /bricks/sec/secvol_n3 -ADD
Service - Brick Utilization - /bricks/prod/prodvol_n3 -ADD
Service - Brick - /bricks/prod/prodvol_n3 -ADD
Host serverd.lab.example.com - ADD
Service - Brick Utilization - /bricks/sec/secvol_n4 -ADD
Service - Brick - /bricks/sec/secvol_n4 -ADD
Service - Brick Utilization - /bricks/prod/prodvol_n4 -ADD
Service - Brick - /bricks/prod/prodvol_n4 -ADD
Are you sure, you want to commit the changes? (Yes, No) [Yes]:
Enter Nagios server address [manager.lab.example.com]:
Cluster configurations synced successfully from host servera.lab.example.com
Do you want to restart Nagios to start monitoring newly discovered entities? (Yes, No) [Yes]:
Nagios re-started successfully
3.修改配置文件
修改集群联络配置文件,增加root进行email监控。
修改集群模板配置文件,增加root为联络人。
修改集群对象请求配置文件,增加提示变量。
[[email protected] ~]# vim /etc/nagios/gluster/gluster-contacts.cfg
[[email protected] ~]# vim /etc/nagios/gluster/gluster-templates.cfg
[[email protected] ~]# vim /etc/nagios/objects/commands.cfg
4.重启服务
重启Nagios监控服务。重启邮件服务。发送测试邮件。
[[email protected] ~]# service nagios restart
Running configuration check...done.
Stopping nagios: .done.
Starting nagios: done.
[[email protected] ~]# service sendmail restart
Shutting down sm-client: [ OK ]
Shutting down sendmail: [ OK ]
Starting sendmail: [ OK ]
Starting sm-client: [ OK ]
[[email protected] ~]# echo test | mail -s test [email protected]
[[email protected] ~]# mail
Heirloom Mail version 12.4 7/29/08. Type ? for help.
"/var/spool/mail/root": 1 message 1 new
>N 1 root Sat Mar 23 15:22 20/810 "test"
& q
Held 1 message in /var/spool/mail/root