Problems with check-host-alive (?)

I’m setting up Nagios to verify IP connectivity of my servers. All servers do respond to ping from the outside world as long as they’re up. I’d like to have Nagios only attempt to ping the IP addresses I enter into the config file and then send out a notice if they are down. Everything seems to be working and I do get a notice if the IP is not reachable…but…I have to have smtp/ftp/pop added to the services in order for it to load the config file. I’m not concerened about smtp/ftp/pop…all I want to know is if the IP responds and send out a notice if it does not. I’ve tried loading the config file with just check_ping added to the config file, but I get the error message “There are no services defined!” in the logs. What am I doing wrong?

These are the current things I have added to the file:

timeperiod[24x7]=24 Hours A Day, 7 Days A Week;00:00-24:00;00:00-24:00;00:00-24:00;00:00-24:00;00:00-24:00;00:00-24:00;00:00-24:00
timeperiod[workhours]=“Normal” Working Hours;;09:00-17:00;09:00-17:00;09:00-17:00;09:00-17:00;09:00-17:00;
timeperiod[nonworkhours]=Non-Work Hours;00:00-24:00;00:00-09:00,17:00-24:00;00:00-09:00,17:00-24:00;00:00-09:00,17:00-24:00;00:00-09:00,17:00-24:00;00:00-09:00,17:00-24:00;00:00-24:00
timeperiod[none]=No Time Is A Good Time;;;;;;;

host[testip]=VoIP Test IP;68.167.x.x;;check-host-alive;5;5;24x7;1;1;1;

hostgroup[VoIP-Customers]=All VoIP Cusotmers;VoIP-Alert;testip

command[notify-by-email]=/usr/bin/printf '***** NetSaint 0.0.7 \n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $DATETIME$\n\nAdditional Info:\n\n$OUTPUT$’ | /usr/bin/mail -s ’ $NOTIFICATIONTYPE$ alert - $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ ’ $CONTACTEMAIL$
command[notify-by-epager]=/usr/bin/printf “Service: $SERVICEDESC$\nHost: $HOSTNAME$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\nInfo: $OUTPUT$\nDate: $DATETIME$” | /usr/bin/mail -s ‘$NOTIFICATIONTYPE$: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$’ $CONTACTPAGER$
command[host-notify-by-email]=/usr/bin/printf "
NetSaint 0.0.7 *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $OUTPUT$\n\nDate/Time: $DATETIME$\n" | /usr/bin/mail -s ‘Host $HOSTSTATE$ alert for $HOSTNAME$!’ $CONTACTEMAIL$
command[host-notify-by-epager]=/usr/bin/printf “Host ‘$HOSTALIAS$’ is $HOSTSTATE$\nInfo: $OUTPUT$\nTime: $DATETIME$” | /usr/bin/mail -s ‘$NOTIFICATIONTYPE$ alert - Host $HOSTNAME$ is $HOSTSTATE$’ $CONTACTPAGER$
command[process-host-perfdata]=/usr/bin/printf “$LASTCHECK$\t$HOSTNAME$\t$HOSTSTATE$\t$HOSTATTEMPT$\t$STATETYPE$\t$EXECUTIONTIME$\t$OUTPUT$\t$PERFDATA$” >> /tmp/host-perfdata
command[process-service-perfdata]=/usr/bin/printf “$LASTCHECK$\t$HOSTNAME$\t$SERVICEDESC$\t$SERVICESTATE$\t$SERVICEATTEMPT$\t$STATETYPE$\t$EXECUTIONTIME$\t$LATENCY$\t$OUTPUT$\t$PERFDATA$” >> /tmp/service-perfdata

contact[andysmith]=Andy Smith;24x7;24x7;1;1;1;1;1;1;notify-by-email;host-notify-by-email;[email protected]

contactgroup[VoIP-Alert]=Voip Alert Notification;andysmith

service[testip]=SMTP;0;24x7;3;3;1;VoIP-Alert;120;24x7;1;1;1;;check_smtp
service[testip]=FTP;0;24x7;3;5;1;VoIP-Alert;120;24x7;1;1;1;;check_ftp
service[testip]=POP3;0;24x7;3;5;1;VoIP-Alert;120;24x7;1;1;1;;check_pop
service[testip]=PING;0;24x7;3;5;1;VoIP-Alert;120;24x7;1;1;0;;check_ping

You need a service defined for each host… use a simple ping.

Luca

Thanks for the quick response! Leaving the service defined as just “service[testip]=PING;0;24x7;3;5;1;VoIP-Alert;120;24x7;1;1;0;;check_ping” results in the error message “There are no services defined”. Am I not able to just use check_ping…or am I required to add additional services?

First, I have to ask why you compiled nagios with --with-default-objects
nagios.sourceforge.net/docs/1_0/ … bject.html
In the docs, it states that this is not the suggested method.
But, since that is what you have…(I’d start over and do it right, but that’s just me).

I’ve looked over the sytax in your defintions, and I have to assume that you configured nagios to NOT use --with-default-objects, since you sytax looks correct.

This is my configure command:
./configure --with-mysql-comments --with-mysql-status --with-template-extinfo --with-mysql-retention --with-template-objects --with-mysql-downtime --with-mysql-lib=/usr/lib/mysql --with-mysql-inc=/usr/include/mysql

Notice that I don’t have --with-default-objects in it. That means that I will be using --with-template-objects, which is not needed to be included in the command since it’s the default method to compile nagios.

Paste the contents of the line in config.status that shows what you used to compile nagios please.
Edited Thu Nov 10 2005, 08:41AM ]