== Nagios + Nrpe tar xzf nagios-version.tar.gz adduser nagios mkdir /usr/local/nagios chown nagios.nagios /usr/local/nagios /usr/sbin/groupadd nagcmd /usr/sbin/usermod -G nagcmd apache /usr/sbin/usermod -G nagcmd nagios ./configure --prefix=/usr/local/nagios --with-cgiurl=/nagios/cgi-bin --with-htmurl=/nagios/ --with-nagios-user=nagios --with-nagios-group=nagios --with-command-group=nagcmd make all make install make install-init make install-commandmode make install-config vi /etc/httpd/conf/httpd.conf ScriptAlias /nagios/cgi-bin /usr/local/nagios/sbin Options ExecCGI AllowOverride None Order allow,deny Allow from all AuthName "Nagios Access" AuthType Basic AuthUserFile /usr/local/nagios/etc/htpasswd.users Require valid-user Alias /nagios /usr/local/nagios/share Options None AllowOverride None Order allow,deny Allow from all AuthName "Nagios Access" AuthType Basic AuthUserFile /usr/local/nagios/etc/htpasswd.users Require valid-user htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin cd nagios-plugins-1.4.13 ./configure make make check make install tar zxvf nrpe-2.12.tar.gz cd nrpe-2.12 ./configure && make check_nrpe && make install-plugin tar zxvf nagios-plugins-1.4.11.tar.gz cd nagios-plugins-1.4.11 ./configure && make && make install vi /usr/local/nagios/etc/objects/commands.cfg # 'check_nrpe' command definition define command{ command_name check_nrpe command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$ } 監視対象 useradd -d /usr/local/nagios/ -M nagios mkdir /usr/local/nagios tar zxvf nrpe-2.12.tar.gz cd nrpe-2.12 ./configure && make nrpe && make install-daemon && make install-daemon-config && make install-xinetd echo "nrpe 5666/tcp # NRPE" >> /etc/services vi /etc/xinetd.d/nrpe      only_from = 192.168.2.240 #<--Nagios's IP only_from = 127.0.0.1 vi /usr/local/nagios/etc/nrpe.cfg command[check_http]=/usr/local/nagios/libexec/check_http -H 127.0.0.1 /etc/rc.d/init.d/xinetd restart Nagiosサーバー /usr/local/nagios/etc/servers/lvsc2.cfg define host{ use linux-server host_name lvsc3 alias lvsc3 address 192.168.2.238 } define service{ use generic-service host_name lvsc3 service_description PING check_command check_ping!100.0,20%!500.0,60% } define service{ use generic-service host_name lvsc3 service_description HTTP check_command check_nrpe!check_http } イベントハンドラの設定 vi /usr/local/nagios/etc/objects/localhost.cfg define service{ use generic-service host_name lvsc2 service_description HTTP max_check_attempts 4 normal_check_interval 1 check_command check_nrpe!check_http event_handler restart-httpd } vi /usr/local/nagios/etc/objects/commands.cfg define command{ command_name restart-httpd command_line /usr/local/nagios/libexec/eventhandlers/restart-httpd $SERVICESTATE$ $STAT ETYPE$ $SERVICEATTEMPT$ } vi /usr/local/nagios/libexec/eventhandlers/restart-httpd case "$1" in OK) ;; WARNING) ;; UNKNOWN) ;; CRITICAL) case "$2" in SOFT) case "$3" in 3) /usr/bin/sudo /etc/rc.d/init.d/httpd restart ;; esac ;; HARD) /usr/bin/sudo /etc/rc.d/init.d/httpd restart ;; esac ;; esac exit 0 Event Handlerを使ってsudoのエラーが出る場合は以下をコメントアウト vi /etc/sudoers #Defaults requiretty