nagios安装

 

[root@hst ~]# yum install -y epel-release

[root@hst ~]# yum install -y httpd nagios nagios-plugins nagios-plugins-all nrpe nagios-plugins-nrpe


设置登录nagios后台的用户和密码:

[root@hst ~]# htpasswd -c /etc/nagios/passwd nagiosadmin
New password:
Re-type new password:
Adding password for user nagiosadmin

[root@hst ~]#

然后就可以在浏览器中登录

spacer.gif



然后在客户端(另外一台机器)安装:

[root@master ~]# yum install -y nagios-plugins nagios-plugins-all nrpe nagios-plugins-nrpe


编辑配置文件:

[root@master ~]# vim /etc/nagios/nrpe.cfg

spacer.gif



spacer.gif


然后启动客户端:

[root@master ~]# /etc/init.d/nrpe start

Starting nrpe:                                             [确定]


然后再到服务端配置:

客户端的IP:192.168.1.130并定义子配置文件:

[root@hst ~]# cd /etc/nagios/conf.d
You have new mail in /var/spool/mail/root
[root@hst conf.d]# ls
[root@hst conf.d]# vim 192.168.1.130.cfg
define host{
use          linux-server
host_name    192.168.1.130
alias        1.130
address      192.168.1.130

}

define service{
use             generic-service
host_name       192.168.1.130
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.1.130
service_description    check_ssh
check_command          check_ssh
max_check_attempts     5
normal_check_interval 1
notification_interval   60
}
define service{
use             generic-service
host_name       192.168.1.130
service_description   check_http
check_command         check_http
max_check_attempts    5
normal_check_interval 1
}




[root@hst conf.d]# service nagios restart
Running configuration check...done.
Stopping nagios: done.
Starting nagios: done.

[root@hst conf.d]#

spacer.gif



然后继续在服务端配置:

[root@hst conf.d]# vim /etc/nagios/objects/commands.cfg

加入:


define command{
command_name   check_nrpe
command_line   $USE1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$

}




然后继续编辑:

[root@hst conf.d]# vim /etc/nagios/conf.d/192.168.1.130.cfg

增加:

define service{
use generic-service
host_name       192.168.1.130
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.1.130
service_description   check_disk_hdal
check_command         check_nrpe!check_hdal
max_check_attempts 5
normal_check_interval 1
}

define  service{
use  generic-service
host_name    192.168.1.130
service_description    check_disk_hda2
check_command          check_nrpe!check_hda2
max_check_attempts 5
normal_check_interval 1
}






在客户机上配置:

[root@master ~]# vim /etc/nagios/nrpe.cfg


# The following examples use hardcoded command arguments...

command[check_users]=/usr/lib/nagios/plugins/check_users -w 5 -c 10
command[check_load]=/usr/lib/nagios/plugins/check_load -w 15,10,5 -c 30,25,20
command[check_hda1]=/usr/lib/nagios/plugins/check_disk -w 20% -c 10% -p /dev/sda1
command[check_hda2]=/usr/lib/nagios/plugins/check_disk -w 20% -c 10% -p /dev/sda2
command[check_zombie_procs]=/usr/lib/nagios/plugins/check_procs -w 5 -c 10 -s Z
command[check_total_procs]=/usr/lib/nagios/plugins/check_procs -w 150 -c 200


# The following examples allow user-supplied arguments and can

检测配置文件是否有错:

[root@hst conf.d]#  nagios -v /etc/nagios/nagios.cfg






然后客户机上:

[root@master ~]# service nrpe restart
Shutting down nrpe:                                        [确定]
Starting nrpe:                                             [确定]

[root@master ~]#

然后服务器上:

[root@hst conf.d]# service nagios restart
Running configuration check...done.
Stopping nagios: done.
Starting nagios: done.

[root@hst conf.d]#


spacer.gif


你可能感兴趣的:(浏览器,客户端,配置文件,密码,password)