I’m sure I’m just missing something really, really silly, but as this is my first time playing with Nagios, it wouldn’t surprise me.
So here is how I am set up:
CentOS 4.4
nagios 2.8 installed from tarball
installed in /usr/local/nagios
I’ve broken up the config files so that the switches are all together, servers all together, etc.
The switches are:
/usr/local/nagios/etc/Monitored-Objects/Switches
Here is where I think I made the mistake. I tried to use object inheritance, and have a generic service file (ServiceTemplate.cfg) that contains the following:
define service{
name Switch-service ; The name of this service template
use generic-service ; Inherit default values from the generic-service definition
check_period 24x7 ; The service can be checked at any time of the day
max_check_attempts 4 ; Re-check the service up to 4 times in order to determine its final (hard) state
normal_check_interval 5 ; Check the service every 5 minutes under normal conditions
retry_check_interval 1 ; Re-check the service every minute until a hard state can be determined
contact_groups network_admins ; Notifications get sent out to everyone in the 'admins' group
notification_options w,u,c,r ; Send notifications about warning, unknown, critical, and recovery events
notification_interval 60 ; Re-notify about service problems every hour
notification_period 24x7 ; Notifications can be sent out at any time
register 0 ; DONT REGISTER THIS DEFINITION - ITS NOT A REAL SERVICE, JUST A TEMPLATE!
}
and then below it I have:
# Define a service to check the load on the local machine.
define service{
use Switch-service ; Name of service template to use
name currentLoad-HP
service_description Current Load
check_command check_local_load!5.0,4.0,3.0!10.0,6.0,4.0
In my CoreSwitch.cfg file, I have:
# Define a service to check the load on the local machine.
define service{
use currentLoad-HP ; Name of service template to use
host_name CoreSwitch
name CoreSwitchCurrentLoad
}
Yet when I run nagios -v nagios.cfg, I keep getting the error "
Error: Service description, host name, or check command is NULL
Error: Could not register service (config file ‘/usr/local/nagios/etc/Monitored-Objects/Switches/ServiceTemplate.cfg’, starting on line 41)
Was trying to use inheritance a bad idea? Or am I just missing something small?
Jon.