NRPE für das Monitoring konfigurieren
Als erstes muss der Nagios NRPE Dienst installiert werden.
Debian / Ubuntu:apt-get install nagios-nrpe-server
Danach muss die Konfigurationsdatei angepasst werden, so das unser System Ihr System abfragen darf.
Dies können Sie mit folgenden Befehl tun:
echo "log_facility=daemon
pid_file=/tmp/nrpe.pid
server_port=5666
nrpe_user=nagios
nrpe_group=nagios
allowed_hosts=192.168.0.0/21,46.182.16.0/24,46.182.17.0/24,icinga.nbiserv.de,nagios.nbiserv.de,10.0.0.0/8
dont_blame_nrpe=0
debug=0
command_timeout=123
connection_timeout=300
command[check_time]=/usr/lib/nagios/plugins/check_ntp_time -4 -o 23 -H ntp.nbiserv.de -w 60 -c 120
command[check_users]=/usr/lib/nagios/plugins/check_users -w 5 -c 10
command[check_load]=/usr/lib/nagios/plugins/check_load -w 50,49,48 -c 56,54,52
command[check_mailq]=/usr/lib/nagios/plugins/check_mailq
command[check_hdd_1]=/usr/lib/nagios/plugins/check_disk -w 10% -c 5% -p /
command[check_hdd_2]=/usr/lib/nagios/plugins/check_disk -w 10% -c 5% -p /Backup
command[check_swap]=/usr/lib/nagios/plugins/check_swap -w 40% -c 20%
command[check_hdd_sw_raid]=/usr/lib/nagios/plugins/check_raid
command[check_log_mail_ScP]=/usr/lib/nagios/plugins/check_nbi_log_mail_ScP
command[check_log_syslog]=/usr/lib/nagios/plugins/check_nbi_log_syslog
command[check_zpools]=/usr/lib/nagios/plugins/check_zpools -p ALL -w 90 -c 95
command[check_apt]=/usr/lib/nagios/plugins/check_apt
command[check_traceroute]=/usr/lib/nagios/plugins/check_nbi_traceroute -host nbiserv.de -minHops 3 -maxHops 12
command[check_proc1]=/usr/lib/nagios/plugins/check_procs -C fail2ban-server -c 1:2
command[check_proc2]=/usr/lib/nagios/plugins/check_procs -C liveconfig -c 1:1
command[check_proc3]=/usr/lib/nagios/plugins/check_procs -C mariadbd -c 1:1024
command[check_proc4]=/usr/lib/nagios/plugins/check_procs -C bms-queue -c 1:10 -w 1:2
command[check_proc5]=/usr/lib/nagios/plugins/check_procs -C apache2 -c 1:1024
command[check_proc6]=/usr/lib/nagios/plugins/check_procs -C lclogparse -c 1:1024
command[check_proc7]=/usr/lib/nagios/plugins/check_procs -C nginx -c 1:1024
command[check_proc8]=/usr/lib/nagios/plugins/check_procs -C named -c 1:1024
command[check_proc9]=/usr/lib/nagios/plugins/check_procs -C oscam.x86_64 -c 1:1024
command[check_proc10]=/usr/lib/nagios/plugins/check_procs -C dhcpd -c 1:1024
command[check_proc11]=/usr/lib/nagios/plugins/check_procs -C fastnetmon -c 1:1024
command[check_proc12]=/usr/lib/nagios/plugins/check_procs -C redis-server -c 1:1024
command[check_proc13]=/usr/lib/nagios/plugins/check_procs -C java -c 1:10
command[check_proc14]=/usr/lib/nagios/plugins/check_procs -C 3CXCallFlow -c 1:1
command[check_proc15]=/usr/lib/nagios/plugins/check_procs -C 3CXPhoneSystem -c 1:1
command[check_proc16]=/usr/lib/nagios/plugins/check_procs -C spamd -c 1:10
command[check_proc17]=/usr/lib/nagios/plugins/check_procs -C clamd -c 1:10
command[check_proc18]=/usr/lib/nagios/plugins/check_disk_inodes -w 90 -c 95 -p /
command[check_proc19]=/usr/lib/nagios/plugins/check_procs -C cron -c 1:15
command[check_proc20]=/usr/lib/nagios/plugins/check_procs -C amavisd-milter -c 1:15
#include=/etc/nagios/nrpe_local.cfg
include_dir=/etc/nagios/nrpe.d/
"> /etc/nagios/nrpe.cfg
Alternativ auch direkt mit einem Script von uns:
mkdir -p /root/nbiSuite/scripts/
wget -O /root/nbiSuite/scripts/nrpe.sh https://www.nbiserv.de/nbiSuiteScripte/OS/Debian/NRPE/nrpe.sh
bash /root/nbiSuite/scripts/nrpe.sh
Danach den Dienst neu starten, damit die Änderungen wirksam werden.
Befehl:
/etc/init.d/nagios-nrpe-server restart
Als letzte sollten Sie noch unser SSH-Keys installieren, damit wird dann auch beim erkennen eines Problems automatisch versucht dieses zu beheben.
z.B. durch Neustart des Dienstes
Befehl:
wget https://www.nbiserv.de/nbiSuiteScripte/nbiSuite/ssh_key.sh
chmod +x ssh_key.sh
./ssh_key.sh
rm -rf ssh_key.sh
Sofern Sie eine Firewall im Einsatz haben, erlauben Sie den Zugriff für PING und die entsprechenden Ports für folgendes IP-Netz: 46.182.16.0/23