17 wrz

Typowe błędy występujące w nagiosie

1. „Error: Invalid max_check_attempts value for host”

Błąd ten dotyczy braku zdefiniowania wartości max_check_attemps dla danego hosta.

[root@localhost objects]# /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

Nagios Core 3.5.1
Copyright (c) 2009-2011 Nagios Core Development Team and Community Contributors
Copyright (c) 1999-2009 Ethan Galstad
Last Modified: 08-30-2013
License: GPL

Website: http://www.nagios.org
Reading configuration data...
 Read main config file okay...
Processing object config file '/usr/local/nagios/etc/objects/commands.cfg'...
Processing object config file '/usr/local/nagios/etc/objects/contacts.cfg'...
Processing object config file '/usr/local/nagios/etc/objects/timeperiods.cfg'...
Processing object config file '/usr/local/nagios/etc/objects/templates.cfg'...
Processing object config file '/usr/local/nagios/etc/objects/localhost.cfg'...
Processing object config file '/usr/local/nagios/etc/objects/serwery_www.cfg'...
Error: Invalid max_check_attempts value for host 'www.onet.pl'
Error: Could not register host (config file '/usr/local/nagios/etc/objects/serwery_www.cfg', starting on line 1)
 Error processing object config files!

***> One or more problems was encountered while processing the config files...

Check your configuration file(s) to ensure that they contain valid
 directives and data defintions. If you are upgrading from a previous
 version of Nagios, you should be aware that some variables/definitions
 may have been removed or modified in this version. Make sure to read
 the HTML documentation regarding the config files, as well as the
 'Whats New' section to find out what has changed.

…w celu usunięcia błędu należy dodać tą wartość do definicji hosta (12 linia poniższego przykładu) w pliku /usr/local/nagios/objects/templates.cfg

define host{
 name generic-host
 notifications_enabled 1
 event_handler_enabled 1
 flap_detection_enabled 1
 failure_prediction_enabled 1
 process_perf_data 1
 retain_status_information 1
 retain_nonstatus_information 1
 notification_period 24x7
 register 0
 max_check_attempts 10
 }

2. „Return code of 127 is out of bounds – plugin may be missing”

W 99,9% przypadków problem dotyczy braku wtyczek. Pierwszym krokiem jest sprawdzenie obecności używanej wtyczki w katalogu /usr/local/nagios/libexec/. W przypadku jej braku należy ją doinstalować. Poniżej widok katalogu zaraz po instalacji wtyczek.


[root@localhost libexec]# ls -l
total 3856
-rwxr-xr-x. 1 nagios nagcmd 91298 Sep 17 13:57 check_apt
-rwxr-xr-x. 1 nagios nagcmd 2254 Sep 17 13:57 check_breeze
-rwxr-xr-x. 1 nagios nagcmd 104660 Sep 17 13:57 check_by_ssh
lrwxrwxrwx. 1 root root 9 Sep 17 13:57 check_clamd -> check_tcp
-rwxr-xr-x. 1 nagios nagcmd 68130 Sep 17 13:57 check_cluster
-r-sr-xr-x. 1 root nagcmd 99457 Sep 17 13:57 check_dhcp
-rwxr-xr-x. 1 nagios nagcmd 99258 Sep 17 13:57 check_dig
-rwxr-xr-x. 1 nagios nagcmd 128713 Sep 17 13:57 check_disk
-rwxr-xr-x. 1 nagios nagcmd 9148 Sep 17 13:57 check_disk_smb
-rwxr-xr-x. 1 nagios nagcmd 107151 Sep 17 13:57 check_dns
-rwxr-xr-x. 1 nagios nagcmd 63703 Sep 17 13:57 check_dummy
-rwxr-xr-x. 1 nagios nagcmd 3056 Sep 17 13:57 check_file_age
-rwxr-xr-x. 1 nagios nagcmd 6318 Sep 17 13:57 check_flexlm
-rwxr-xr-x. 1 nagios nagcmd 102970 Sep 17 13:57 check_fping
lrwxrwxrwx. 1 root root 9 Sep 17 13:57 check_ftp -> check_tcp
-rwxr-xr-x. 1 nagios nagcmd 86681 Sep 17 13:57 check_game
-rwxr-xr-x. 1 nagios nagcmd 101201 Sep 17 13:57 check_hpjd
-rwxr-xr-x. 1 nagios nagcmd 217421 Sep 17 13:57 check_http
-r-sr-xr-x. 1 root nagcmd 108803 Sep 17 13:57 check_icmp
-rwxr-xr-x. 1 nagios nagcmd 74078 Sep 17 13:57 check_ide_smart
-rwxr-xr-x. 1 nagios nagcmd 15137 Sep 17 13:57 check_ifoperstatus
-rwxr-xr-x. 1 nagios nagcmd 12601 Sep 17 13:57 check_ifstatus
lrwxrwxrwx. 1 root root 9 Sep 17 13:57 check_imap -> check_tcp
-rwxr-xr-x. 1 nagios nagcmd 6890 Sep 17 13:57 check_ircd
lrwxrwxrwx. 1 root root 9 Sep 17 13:57 check_jabber -> check_tcp
-rwxr-xr-x. 1 nagios nagcmd 85931 Sep 17 13:57 check_load
-rwxr-xr-x. 1 nagios nagcmd 6020 Sep 17 13:57 check_log
-rwxr-xr-x. 1 nagios nagcmd 20287 Sep 17 13:57 check_mailq
-rwxr-xr-x. 1 nagios nagcmd 74570 Sep 17 13:57 check_mrtg
-rwxr-xr-x. 1 nagios nagcmd 73453 Sep 17 13:57 check_mrtgtraf
-rwxr-xr-x. 1 nagios nagcmd 86076 Sep 17 13:57 check_nagios
lrwxrwxrwx. 1 root root 9 Sep 17 13:57 check_nntp -> check_tcp
lrwxrwxrwx. 1 root root 9 Sep 17 13:57 check_nntps -> check_tcp
-rwxr-xr-x. 1 nagios nagcmd 103025 Sep 17 13:57 check_nt
-rwxr-xr-x. 1 nagios nagcmd 103087 Sep 17 13:57 check_ntp
-rwxr-xr-x. 1 nagios nagcmd 96073 Sep 17 13:57 check_ntp_peer
-rwxr-xr-x. 1 nagios nagcmd 93237 Sep 17 13:57 check_ntp_time
-rwxr-xr-x. 1 nagios nagcmd 129446 Sep 17 13:57 check_nwstat
-rwxr-xr-x. 1 nagios nagcmd 8324 Sep 17 13:57 check_oracle
-rwxr-xr-x. 1 nagios nagcmd 86748 Sep 17 13:57 check_overcr
-rwxr-xr-x. 1 nagios nagcmd 107891 Sep 17 13:57 check_ping
lrwxrwxrwx. 1 root root 9 Sep 17 13:57 check_pop -> check_tcp
-rwxr-xr-x. 1 nagios nagcmd 108119 Sep 17 13:57 check_procs
-rwxr-xr-x. 1 nagios nagcmd 84038 Sep 17 13:57 check_real
-rwxr-xr-x. 1 nagios nagcmd 9584 Sep 17 13:57 check_rpc
-rwxr-xr-x. 1 nagios nagcmd 1412 Sep 17 13:57 check_sensors
lrwxrwxrwx. 1 root root 9 Sep 17 13:57 check_simap -> check_tcp
-rwxr-xr-x. 1 nagios nagcmd 155669 Sep 17 13:57 check_smtp
-rwxr-xr-x. 1 nagios nagcmd 155382 Sep 17 13:57 check_snmp
lrwxrwxrwx. 1 root root 9 Sep 17 13:57 check_spop -> check_tcp
-rwxr-xr-x. 1 nagios nagcmd 82120 Sep 17 13:57 check_ssh
lrwxrwxrwx. 1 root root 9 Sep 17 13:57 check_ssmtp -> check_tcp
-rwxr-xr-x. 1 nagios nagcmd 88211 Sep 17 13:57 check_swap
-rwxr-xr-x. 1 nagios nagcmd 134741 Sep 17 13:57 check_tcp
-rwxr-xr-x. 1 nagios nagcmd 83976 Sep 17 13:57 check_time
lrwxrwxrwx. 1 root root 9 Sep 17 13:57 check_udp -> check_tcp
-rwxr-xr-x. 1 nagios nagcmd 95152 Sep 17 13:57 check_ups
-rwxr-xr-x. 1 nagios nagcmd 66150 Sep 17 13:57 check_users
-rwxr-xr-x. 1 nagios nagcmd 2939 Sep 17 13:57 check_wave
-rwxr-xr-x. 1 nagios nagcmd 88261 Sep 17 13:57 negate
-rwxr-xr-x. 1 nagios nagcmd 82350 Sep 17 13:57 urlize
-rwxr-xr-x. 1 nagios nagcmd 1939 Sep 17 13:57 utils.pm
-rwxr-xr-x. 1 nagios nagcmd 2728 Sep 17 13:57 utils.sh

3. Serwer Apache działa, konfiguracja jest poprawna – brak dostępu do nagiosa

W takiej sytuacji warto sprawdzić konfigurację firewalla:


[root@localhost mntos-1.0]# service iptables status
Table: filter
Chain INPUT (policy ACCEPT)
num target prot opt source destination
1 ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 state RELATED,ESTABLISHED
2 ACCEPT icmp -- 0.0.0.0/0 0.0.0.0/0
3 ACCEPT all -- 0.0.0.0/0 0.0.0.0/0
4 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:22
5 REJECT all -- 0.0.0.0/0 0.0.0.0/0 reject-with icmp-host-prohibited

Chain FORWARD (policy ACCEPT)
num target prot opt source destination
1 REJECT all -- 0.0.0.0/0 0.0.0.0/0 reject-with icmp-host-prohibited

Chain OUTPUT (policy ACCEPT)
num target prot opt source destination

…należy wyłączyć profilaktycznie firewalla poleceniem. Jeżeli to pomoże musimy dodać odpowiednią regułę do firewalla przepuszczającą nagiosa.

service iptables stop

4. „Error: Could not read host and service status information!”

…w trakcie opisu

nagios_error