本文共 2780 字,大约阅读时间需要 9 分钟。
cd /opt
wget wgetyum install -y gcc glibc make cmake glibc-common gd gd-devel php perl-devel mysql-server
cd /opt/nagios-plugins-2.1.2
./configure --prefix=/usr/local/nagiosmake && make install && echo $?cd /opt/nrpe-3.2.1
./configure --prefix=/usr/local/nagios --enable-command-argsmake all#添加nagios用户make install-groups-users#安装make install#添加主配置文件make install-config#配置xinetdmake install-inetd#设置nrpe管理命令make install-init#编译插件make check_nrpe#安装插件make install-plugin#先备份
cp /usr/local/nagios/etc/nrpe.cfg{,.bak}#修改配置文件vim /usr/local/nagios/etc/nrpe.cfg#将hda1改为sda1command[check_sda1]=/usr/local/nagios/libexec/check_disk -w 20% -c 10% -p /dev/sda1
/usr/local/nagios/bin/nrpe -c /usr/local/nagios/etc/nrpe.cfg -d
#生成配置文件(建议cp原因的配置文件进行修改)(这里以test命名,建议用主机名命名)
cd /usr/local/nagios/etc/servers/vim test.cfg## HOST DEFINITION#define host{ use linux-server ; Name of host template to use ; This host definition will inherit all variables that are defined ; in (or inherited by) the linux-server host template definition. host_name test #客户端主机名 alias test address 客户端IP地址 }## HOST GROUP DEFINITION# define hostgroup{ hostgroup_name test; The name of the hostgroup alias test; Long name of the group members test ; Comma separated list of hosts that belong to this group }## service DEFINITION# define service{ use local-service ; Name of service template to use host_name test service_description Root Partition check_command check_local_disk!20%!10%!/ } define service{ use local-service ; Name of service template to use host_name study service_description Root Partition check_command check_local_disk!20%!10%!/ } ......
systemctl reload nagios
notifications_enabled允许报警,1表示允许,0表示不允许
在nagios中enable_notifications=1定义了默认允许发送报警信息notifications_enabled是在定义主机配置中对某个服务的定义,如define service{use local-service ; Name of service template to usehost_name testservice_description HTTPcheck_command check_httpnotifications_enabled 1}
转载于:https://blog.51cto.com/13323775/2085635