Invalid max_check_attempts value for host


#1

hai all.i have installed nagios 2.11 in my linux server.After editing the localhost.cfg i tried to compile nagios.cfg but i am getting the error like this.

Reading configuration data…

Error: Invalid max_check_attempts value for host 'linuxtest01.main.cobaltgroup.c om’
Error: Could not register host (config file '/usr/local/nagios/etc/localhost.cfg ', starting on line 177)

the machine which i have to monitor is linuxtest01.main.cobaltgroup.com

i am attaching the localhost.cfg file here.so please help me how to solve this problem as the editing part is very confusing for me…


#2

usually this means you don’t have a max_check_attempts in your service definition or in a template (the “use” entry).

i shall post one of my service definitions shortly, copy and paste it into yours then edit as appropriate


#3

define service{
host_name bgrsvr02
service_description NOD32 Virus Scanner
check_command check_nt!SERVICESTATE!-l NOD32Krn -d SHOWALL
max_check_attempts 3

check_interval 5

retry_interval		1
check_period			24x7
notification_interval	10
notification_period		24x7
notification_options		w,u,c,r,f,s
notifications_enabled	1
contact_groups		admins
}

#4

now i am getting a error like this after editing localhost.cfg.can any one send me a sample localhost.cfg file so that its easy for me to edit

Error: Could not add object property in file ‘/usr/local/nagios/etc/localhost.cfg’ on line 127


#5

can anyone tel me how to search the line no in vi editor


#6

You can use a vi editor such as SecureCRT, which will show the line number in the bottom right corner, you can then scroll down to the line you have the error on to double check it.


#7

thanks fixxxer…i have installed nagios 2.11 and i can see only 7 files in my /usr/local/nagios/etc directory.The 7 files are cgi.cfg,nagios.cfg,comand.cfg,htpasswd.user,nagios-server.cfg,resources.cfg and localhost.cfg.i have edited cgi.cfg and nagios.cfg…now wht all files i need to edit…


#8

after editing localhost.cfg i am getting lots of error
Error: Contact group ‘admins’ specified in service ‘Current Load’ for host ‘localhost’ is not defined anywhere!
Error: Contact group ‘admins’ specified in service ‘Current Users’ for host ‘localhost’ is not defined anywhere!
Error: Contact group ‘admins’ specified in service ‘PING’ for host ‘localhost’ is not defined anywhere!
Error: Contact group ‘admins’ specified in service ‘Root Partition’ for host ‘localhost’ is not defined anywhere!
Error: Contact group ‘admins’ specified in service ‘Total Processes’ for host ‘localhost’ is not defined anywhere!
Contact group ‘nagcmd’ is not used in any host/service definitions or host/service escalations!

define contact{
contact_name nagios
alias nagiosadmin
service_notification_period 24x7
host_notification_period 24x7
service_notification_options w,u,c,r
host_notification_options d,r
service_notification_commands notify-by-email
host_notification_commands host-notify-by-email
email [email protected]
}
define contactgroup{
contactgroup_name nagcmd
alias Nagios Administrators
members nagios
}
i have only edited these 2 section till now…