📅  最后修改于: 2020-10-31 13:46:59             🧑  作者: Mango
Nagios守护程序在NRPE(Nagios远程插件执行器)中的远程计算机上运行检查。它允许您在其他计算机上远程运行Nagios插件。您可以监视远程计算机指标,例如磁盘使用率,CPU负载等。它还可以通过某些Windows代理插件检查远程Windows计算机的指标。
让我们看看如何在需要监视的客户端计算机上逐步安装和配置NRPE。
步骤1-运行以下命令以在要监视的远程Linux计算机上安装NRPE。
sudo apt-get install nagios-nrpe-server nagios-plugins
步骤2-现在,在服务器目录中创建一个主机文件,并为主机放置所有必需的定义。
sudo gedit /usr/local/nagios/etc/servers/ubuntu_host.cfg
# Ubuntu Host configuration file
define host {
use linux-server
host_name ubuntu_host
alias Ubuntu Host
address 192.168.1.10
register 1
}
define service {
host_name ubuntu_host
service_description PING
check_command check_ping!100.0,20%!500.0,60%
max_check_attempts 2
check_interval 2
retry_interval 2
check_period 24x7
check_freshness 1
contact_groups admins
notification_interval 2
notification_period 24x7
notifications_enabled 1
register 1
}
define service {
host_name ubuntu_host
service_description Check Users
check_command check_local_users!20!50
max_check_attempts 2
check_interval 2
retry_interval 2
check_period 24x7
check_freshness 1
contact_groups admins
notification_interval 2
notification_period 24x7
notifications_enabled 1
register 1
}
define service {
host_name ubuntu_host
service_description Local Disk
check_command check_local_disk!20%!10%!/
max_check_attempts 2
check_interval 2
retry_interval 2
check_period 24x7
check_freshness 1
groups admins
notification_interval 2
notification_period 24x7
notifications_enabled 1
register 1
}
define service {
host_name ubuntu_host
service_description Check SSH
check_command check_ssh
max_check_attempts 2
check_interval 2
retry_interval 2
check_period 24x7
check_freshness 1
contact_groups admins
notification_interval 2
notification_period 24x7
notifications_enabled 1
register 1
}
define service {
host_name ubuntu_host
service_description Total Process
check_command check_local_procs!250!400!RSZDT
max_check_attempts 2
check_interval 2
retry_interval 2
check_period 24x7
check_freshness 1
contact_groups admins
notification_interval 2
notification_period 24x7
notifications_enabled 1
register 1
}
步骤3-运行以下命令验证配置文件。
sudo /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
步骤4-如果没有错误,请重新启动NRPE,Apache和Nagios。
service nagios-nrpe-server restart
service apache2 restart
service nagios restart
步骤5-打开浏览器并转到Nagios Web界面。您可以看到需要监视的主机已添加到Nagios核心服务中。同样,您可以添加更多要由Nagios监视的主机。