Icinga-config
Zur Navigation springen
Zur Suche springen
grundinstallation
config dir
- /etc/icinga
dateien
apache konfig datei
apache.conf
cgi konfig date
cgi.conf
kommando definitionen
commands.cfg
allgeimeine konfig datei
icinga.cfg
anbindung zur datebank
ido2db.cfg
plugins und eventhandler
resource.cfg
verzeichnisse
konfig verzeichnis für module
modules
erscheinungsbild der oberfläche
stylesheets
konfig verzeichnis allgemein
objects
kontakte
contacts_icinga.cfg
beispielweise debian png für debian host
extinfo_icinga.cfg
default einstellungen für rechner
generic-host_icinga.cfg
default einstellungen für services
generic-service_icinga.cfg
hostgruppen
hostgroups_icinga.cfg
ido2db
ido2db_check_proc.cfg
erste überwachungs datei hier localhost
localhost_icinga.cfg
definition der services
services_icinga.cfg
definition der zeitperiode
timeperiods_icinga.cfg
beginnen mit einem beispiel
der rechner wheezy
define host{ use generic-host host_name wheezy address 192.168.244.83 }
plugins
plugins liefern rückgabewerte
Exit-Wert | Text | Bedeutung |
---|---|---|
0 | OK | Alles im Grünen |
1 | WARNING | Serviceproblem |
2 | CRITICAL | Kritische Serverproblem |
3 | UNKNOWN | Problem mit dem Plugin |
plugin beispiel
plugin ausführen
./check_http -I 192.168.244.83 HTTP OK: HTTP/1.1 200 OK - 453 bytes in 0,001 second response time |time=0,001231s;;;0,000000 size=453B;;;0
rückgabewert checken
echo $? 0
eigenes plugin
- /usr/lib/nagios/plugins/check_file
#!/bin/bash if test "$#" -ne "1" then echo "plugin problem" exit 3 fi if test -f "$1" then echo "file here" exit 0 else echo "file not here" exit 2 fi
einbinden
define command{ command_name check_file command_line $USER1$/check_file $ARG1$ } define service{ use generic-service service_description status_file host pcdozent check_command check_file!/tmp/sux.dat }
weiter gehts
define host{ use generic-host host_name wheezy address 192.168.244.83 } define command{ command_name check_myhttp command_line $USER1$/check_http -I $HOSTNAME$ } define service{ use generic-service service_description http_status host wheezy check_command check_myhttp }
vordefinierte komandos
beispiel check_http
http.cfg
define command{ command_name check_httpname command_line /usr/lib/nagios/plugins/check_http -H '$HOSTNAME$' -I '$HOSTADDRESS$' }
unsere definition
define host{ use generic-host host_name wiki.local.xinux.org address 192.168.244.83 } define service{ use generic-service service_description http_wiki.local.xinux.org host wiki.local.xinux.org check_command check_httpname }
fremde rechner überwachen
auf dem client muss man einen nagios-nrpe-server installieren
apt-get install nagios-nrpe-server
haupt konfigurationsdatei
/etc/nagios/nrpe.cfg
log_facility=daemon pid_file=/var/run/nagios/nrpe.pid server_port=5666 nrpe_user=nagios nrpe_group=nagios allowed_hosts=127.0.0.1,192.168.244.90 dont_blame_nrpe=1 allow_bash_command_substitution=0 debug=0 command_timeout=60 connection_timeout=300 command[check_users]=/usr/lib/nagios/plugins/check_users -w 5 -c 10 command[check_load]=/usr/lib/nagios/plugins/check_load -w 15,10,5 -c 30,25,20 command[check_hda1]=/usr/lib/nagios/plugins/check_disk -w 20% -c 10% -p /dev/hda1 command[check_zombie_procs]=/usr/lib/nagios/plugins/check_procs -w 5 -c 10 -s Z command[check_total_procs]=/usr/lib/nagios/plugins/check_procs -w 150 -c 200 include=/etc/nagios/nrpe_local.cfg include_dir=/etc/nagios/nrpe.d/
nach der änderung neustart
service nagios-nrpe-server restart
wieder auf dem icinga server
install nagios-nrpe-plugin
apt-get install nagios-nrpe-plugin
wegen faullheit :-)
echo 'PATH=$PATH:/usr/lib/nagios/plugins' > ~/.bashrc source ~/.bashrc
erster check
check_nrpe -H wheezy NRPE v2.15
beispiel check_load
check_nrpe -H wheezy -c check_load OK - load average: 0.23, 0.35, 0.37|load1=0.230;15.000;30.000;0; load5=0.350;10.000;25.000;0; load15=0.370;5.000;20.000;0;
wir schauen uns /etc/nagios-plugins/config/check_nrpe an.
# this command runs a program $ARG1$ with arguments $ARG2$ define command { command_name check_nrpe command_line /usr/lib/nagios/plugins/check_nrpe -H $HOSTADDRESS$ -c $ARG1$ -a $ARG2$ } # this command runs a program $ARG1$ with no arguments define command { command_name check_nrpe_1arg command_line /usr/lib/nagios/plugins/check_nrpe -H $HOSTADDRESS$ -c $ARG1$ }
wir wählen das zweite wheezy.cfg
define service{ use generic-service service_description check_load host wheezy check_command check_nrpe_1arg!check_load }
service icinga reload
gruppen bilden
define hostgroup { hostgroup_name linux-generic-servers members wheezy,debian,suxer register 0 } define service { hostgroup_name linux-generic-servers service_description disks check_command check_nrpe_1arg!check_all_disks use generic-service notification_interval 0 ; set > 0 if you want to be renotified } define service { hostgroup_name linux-generic-servers service_description load check_command check_nrpe_1arg!check_load use generic-service notification_interval 0 ; set > 0 if you want to be renotified } define service { hostgroup_name linux-generic-servers service_description users check_command check_nrpe_1arg!check_users use generic-service notification_interval 0 ; set > 0 if you want to be renotified } define service { hostgroup_name linux-generic-servers service_description total-procs check_command check_nrpe_1arg!check_total_procs use generic-service notification_interval 0 ; set > 0 if you want to be renotified } define service { hostgroup_name linux-generic-servers service_description check_nrpe_function check_command check_nrpe_function use generic-service notification_interval 0 ; set > 0 if you want to be renotified }