nagios 監控

nagios 服務端安裝linux

[root@localhost ~]# yum install -y epel-release ; yum install -y httpd nagios nagios-plugins nagios-plugins-all nrpe nagios-plugins-nrpeios

[root@localhost ~]# htpasswd -c /etc/nagios/passwd nagiosadminweb

[root@localhost ~]# nagios -v /etc/nagios/nagios.cfgssh

[root@localhost ~]# /etc/init.d/httpd restart ; /etc/init.d/nagios restartide


web  訪問  http://192.168.10.29/nagios/ rest


nagios客戶端安裝-添加服務1(不須要nrpe支持)orm

[root@localhost ~]# yum install -y epel-release ; yum install -y nagios-plugins nagios-plugins-all nrpe nagios-plugins-nrpeserver

[root@localhost ~]# vi /etc/nagios/nrpe.cfgip

allowed_hosts=127.0.0.1,192.168.10.29get

dont_blame_nrpe=1

如下在服務端操做

[root@localhost ~]# vi /etc/nagios/conf.d/192.168.10.39.cfg

define host {

        use     linux-server

        host_name       192.168.10.39

        alias   10.39

        address 192.168.10.39

        }


define service {

        use     generic-service

        host_name       192.168.10.39

        service_description     check_ping

        check_command   check_ping!100.0,20%!200.0,50%

        max_check_attempts      5

        normal_check_interval   1

        }


define service {

        use     generic-service

        host_name       192.168.10.39

        service_description     check_ssh

        check_command   check_ssh

        max_check_attempts      5

        normal_check_interval   1

        }

[root@localhost ~]# /etc/init.d/nagios restart


nagios客戶端安裝-添加服務2(須要nrpe支持)

如下在服務端操做

[root@localhost ~]# vi /etc/nagios/objects/commands.cfg

define command {

        command_name    check_nrpe

        command_line    $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$

        }

[root@localhost ~]# vi /etc/nagios/conf.d/192.168.10.39.cfg

define host {

        use     linux-server

        host_name       192.168.10.39

        alias   10.39

        address 192.168.10.39

        }


define service {

        use     generic-service

        host_name       192.168.10.39

        service_description     check_load

        check_command   check_nrpe!check_load

        max_check_attempts      5

        normal_check_interval   1

        }


define service {

        use     generic-service

        host_name       192.168.10.39

        service_description     check_disk_sda1

        check_command   check_nrpe!check_sda1

        max_check_attempts      5

        normal_check_interval   1

        }

[root@localhost ~]# /etc/init.d/nagios restart

[root@localhost ~]# /etc/init.d/nrpe restart

如下在客戶端操做

[root@localhost ~]# vi /etc/nagios/nrpe.cfg

command[check_sda1]=/usr/lib/nagios/plugins/check_disk -w 20% -c 10% -p /dev/sda1

[root@localhost ~]# /etc/init.d/nrpe restart


至此,nagios搭建完畢

相關文章
相關標籤/搜索