Error: Invalid command object directive?


#1

So i looked everywhere to find out whats going on but i cant seems to find out… Can you guys please help me out Thank you…

Nagios errors out…

[code]Nagios 2.9
Copyright © 1999-2007 Ethan Galstad (http://www.nagios.org)
Last Modified: 04-10-2007
License: GPL

Reading configuration data…

Error: Invalid command object directive ‘$SERVICESTATE$"’.
Error: Could not add object property in file ‘/etc/nagios/misccommand.cfg’ on line 24.

***> 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.[/code]

So im like ok then lets find the miscommand.cfg file and redo it but still not working…

Misccommand.cfg file

[code]################################################################################

SAMPLE NOTIFICATION COMMANDS

These are some example notification commands. They may or may not work on

your system without modification. As an example, some systems will require

you to use “/usr/bin/mailx” instead of “/usr/bin/mail” in the commands below.

################################################################################

‘host-notify-by-email’ command definition

define command{

command_name host-notify-by-email

command_line /usr/bin/printf “%b” "***** Nagios @VERSION@ *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo:

#$HOSTOUTPUT$\n\nDate /Time: $LONGDATETIME$\n" | mail -s “Host $HOSTSTATE$ alert for $HOSTNAME$!” $CONTACTEMAIL$

}

‘host-notify-by-epager’ command definition

define command{
command_name host-notify-by-epager
command_line /usr/bin/printf “%b” “Host ‘$HOSTALIAS$’ is $HOSTSTATE$\nInfo: $HOSTOUTPUT$\nTime: $LONGDATETIME$” | mail -s “$NOTIFICATIONTYPE$ alert - Host $HOSTNAME$ is
$SERVICESTATE$” $CONTACTPAGER$
}

‘notify-by-email’ command definition

define command{
command_name notify-by-email
command_line /usr/bin/printf “%b” “***** Nagios @VERSION@ ***\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress:
$HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$" | mail -s "
$NOTIFICATIONTYPE$ alert - $HOSTALIAS$/$SERVICEDESC$ is
$SERVICESTATE$ **” $CONTACTEMAIL$
}

‘notify-by-epager’ command definition

define command{
command_name notify-by-epager
command_line /usr/bin/printf “%b” “Service: $SERVICEDESC$\nHost: $HOSTNAME$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\nInfo: $SERVICEOUTPUT$\nDate: $LONGDATETIME$” |
mail -s “$NOTIFICATIONTYPE$: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$” $CONTACTPAGER$
}

[/code]

So from what i could find… Nagios has a problem with the variable SERVICESTATE, but the nagios site says it should work. This lists all the variables nagios.sourceforge.net/docs/3_0/ … #hoststate and its there! so im so lost to why nagios is giving me problems…


#2

I suspect you have a newline in there (after is) which shouldn’t be…