Page 1 of 1

Error in misccommands.cfg

Posted: Sun Dec 15, 2013 12:50 pm
by JulianM92
Hello everyone,

this is my first post, so i want to introduce myself shortly:

My Name is Julian, i am 21 years old and live in Duisburg, Germany.

I recently installed Nagios on Ubuntu 12.04 LTS with this instruction:
http://askubuntu.com/questions/145518/h ... all-nagios

After that i installed nconf as my Configuration Tool.
Everything fine, until i installed the NSClient++ on a virtual machine and tried to let it show in my Nagios Host-Overview.
Now i got the known Error Message: Could not read host and service status information!

I also got this Information:

Code: Select all

Warning: Duplicate definition found for command 'check-host-alive' (config file '/etc/nagios3/global/misccommands.cfg', starting on line 26)
Error: Could not add object property in file '/etc/nagios3/global/misccommands.cfg' on line 27.
   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.

 * errors in config!
                                                                                             [fail]
looking in the misccommands.cfg and i don't see anything, which could be wrong:

Code: Select all


define command {
                command_name                          service_is_stale
                command_line                          /usr/lib/nagios/plugins/eventhandlers/stale_service.sh
}

define command {
                command_name                          notify-host-by-email
                command_line                          /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $$
}

define command {
                command_name                          notify-service-by-email
                command_line                          /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\n$
}

define command {
                command_name                          process-host-perfdata
                command_line                          /usr/bin/printf "%b" "$LASTHOSTCHECK$\t$HOSTNAME$\t$HOSTSTATE$\t$HOSTATTEMPT$\t$HOSTSTATETYPE$\t$HOSTEXECUTIONTIME$\t$HOSTOUTPUT$\t$HOSTPERFDATA$\n" >> $
}

define command {
                command_name                          process-service-perfdata
                command_line                          /usr/bin/printf "%b" "$LASTSERVICECHECK$\t$HOSTNAME$\t$SERVICEDESC$\t$SERVICESTATE$\t$SERVICEATTEMPT$\t$SERVICESTATETYPE$\t$SERVICEEXECUTIONTIME$\t$SERV$
}

}

define command {
                command_name                          check-host-alive
                command_line                          $USER1$/check_ping -H $HOSTADDRESS$ -w 3000.0,80% -c 5000.0,100% -p 5
}

I would really appreciate it, if someone could help me to get it on working again.

Adding the host on nconf, was without an Instruction, which was not really clever for me as a beginner :?

Re: Error in misccommands.cfg

Posted: Mon Dec 16, 2013 10:44 am
by abrist
Something looks wrong with your commands config. It looks like you have an extra bracket and some truncation of a command. Could you post the full miscommands.cfg as an attachment?
JulianM92 wrote: define command {
command_name notify-service-by-email
command_line /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\n$
}

Re: Error in misccommands.cfg

Posted: Mon Dec 16, 2013 12:21 pm
by JulianM92
this is the full config-file. Theres nothing more in it.

Re: Error in misccommands.cfg

Posted: Mon Dec 16, 2013 12:40 pm
by abrist
Then you most likely have a truncated/broken/corrupt file (miscommands.cfg). Do you have a backup?

Re: Error in misccommands.cfg

Posted: Mon Dec 16, 2013 1:15 pm
by JulianM92
nope. This is the reason why i loaded a snapshot from the nagios machine to the point of naked installation 15 minutes ago. I'm almost ready now, only perl is on FAIL status on nconf pre-check installation.

I figured out that the path is in /usr/bin/perl , i think this is the reason, why it doesn't connect with nconf...

Re: Error in misccommands.cfg

Posted: Mon Dec 16, 2013 1:20 pm
by abrist
Your perl version may not be reported in the correct syntax. What is the output of:

Code: Select all

perl -v 
See:
http://serverfault.com/questions/435897 ... cting-perl

Re: Error in misccommands.cfg

Posted: Mon Dec 16, 2013 1:23 pm
by JulianM92

Code: Select all

This is perl 5, version 14, subversion 2 (v5.14.2) built for x86_64-linux-gnu-thread-multi
(with 56 registered patches, see perl -V for more detail)
I was on this page 3 minutes ago. I don't know which INSTALL.php they mean (which path)

Re: Error in misccommands.cfg

Posted: Mon Dec 16, 2013 1:25 pm
by abrist
I suggest looking at the solution in the stack overflow link above. We are not official nconf support, so I cannot guarantee anything, but that seems to be your issue.