如何在Linux系统中使用Nagios远程监控。 NRPE允许Nagios服务器在其他Linux/Unix机器上远程执行插件。安装NRPE。
CentOS/RHEL 6, 32 Bit: rpm -Uvh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm CentOS/RHEL 6, 64 Bit: rpm -Uvh http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm CentOS/RHEL 5, 32 Bit: # rpm -Uvh http://dl.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm CentOS/RHEL 5, 64 Bit: # rpm -Uvh http://dl.fedoraproject.org/pub/epel/5/x86_64/epel-releas5-4.noarch.rpm
# yum --enablerepo=epel -y install nrpe nagios-plugins我们还需要安装NRPE用于执行监控服务的命令。使用下面的命令来获得可用的命令包的列表。安装所需的软件包。
# yum --enablerepo=epel -y list nagios-plugins* Installed Packages nagios-plugins.x86_64 1.4.16-5.el6 @epel Available Packages nagios-plugins-by_ssh.x86_64 1.4.16-5.el6 epel nagios-plugins-dhcp.x86_64 1.4.16-5.el6 epel nagios-plugins-dig.x86_64 1.4.16-5.el6 epel nagios-plugins-disk.x86_64 1.4.16-5.el6 epel nagios-plugins-fping.x86_64 1.4.16-5.el6 epel nagios-plugins-http.x86_64 1.4.16-5.el6 epel nagios-plugins-icmp.x86_64 1.4.16-5.el6 epel nagios-plugins-linux_raid.x86_64 1.4.16-5.el6 epel nagios-plugins-load.x86_64 1.4.16-5.el6 epel nagios-plugins-log.x86_64 1.4.16-5.el6 epel nagios-plugins-mailq.x86_64 1.4.16-5.el6 epel
# vim /etc/nagios/nrpe.cfg
allowed_hosts=127.0.0.1, 192.168.1.110加入上面的条目后,您将看到的Nagios服务器能够连接NRPE客户端。让我们添加命令来监控服务。在同一个文件中添加新的命令或更新现有的命令,如下所示。
command[check_root_disk]=/usr/lib/nagios/plugins/check_disk -w 20% -c 10% -p / command[check_load]=/usr/lib/nagios/plugins/check_load -w 15,10,5 -c 30,25,20您可以根据监测要求像上面添加更多命令。
# service nrpe start # chkconfig nrpe on
# check_nrpe -H 192.168.2.23 NRPE v2.14
关注云架构公众号
Linux入门
QQ交流群:308781113