Page 1 of 2

check_mssql_health failed-jobs mode question

Posted: Fri Jan 02, 2015 7:02 pm
by pkam
Just wonder if anyone is using the failed-jobs option for the SQL monitoring?

I try to use it but it gives me an error on the nagios core web interface
**ePN /usr/lib/nagios/plugins/check_mssql_health: "Use of uninitialized value $params{"lastrunstatus"} in lc at (eval 1) line 1694,".

if I run it using command line, I don't have the issue. It looks like it doesn't happen to another server.

Does anyone have any clues why it happens?

Thanks!

Re: check_mssql_health failed-jobs mode question

Posted: Fri Jan 02, 2015 7:06 pm
by Box293
Can you provide the command definition and service definition please.

Also, what are you executing at the command line when it works?

When testing at the command line, are you doing it as the nagios user?

Code: Select all

su nagios
/usr/lib/nagios/plugins/check_mssql_health blah blah blah

Re: check_mssql_health failed-jobs mode question

Posted: Fri Jan 02, 2015 7:19 pm
by pkam
Box293 wrote:Can you provide the command definition and service definition please.

Also, what are you executing at the command line when it works?

When testing at the command line, are you doing it as the nagios user?

Code: Select all

su nagios
/usr/lib/nagios/plugins/check_mssql_health blah blah blah
I use sudo /usr/lib/nagios/plugins/check_mssql_health/-server servername -username username -password password -mode failed-jobs and it works

when I run it under web interface, it gave me the error. Below are the details of my configuration file:
my define function within the servername.cfg file looks like this

define service {
use generic-service
hostname severname
service_description check SQL failed-jobs
check_command check_mssql_health!failed-jobs
contact_groups admin
}

my command in the commands.cfg file looks like this

define command{
command_name check_mssql_health
command_line $USER1$/check_mssql_health -usename $USER3$ -password $USER4$ -server $HOSTNAME$ -mode $ARG1 -commit
}

Please let me know if you need more info.

Thanks!

Re: check_mssql_health failed-jobs mode question

Posted: Fri Jan 02, 2015 7:24 pm
by Box293
If you are using sudo at the command line, wouldn't your command definition also need this?

Code: Select all

command_line sudo $USER1$/check_mssql_health -usename $USER3$ -password $USER4$ -server $HOSTNAME$ -mode $ARG1 -commit
I noticed your command definition has -commit at the end whereas your command line example does not.
I noticed your command line example "sudo /usr/lib/nagios/plugins/check_mssql_health/" has a trailing forward slash but I assume this is a typo.

When testing at the command line, are you doing it as the nagios user?

Re: check_mssql_health failed-jobs mode question

Posted: Fri Jan 02, 2015 8:11 pm
by pkam
Box293 wrote:If you are using sudo at the command line, wouldn't your command definition also need this?

Code: Select all

command_line sudo $USER1$/check_mssql_health -usename $USER3$ -password $USER4$ -server $HOSTNAME$ -mode $ARG1 -commit
I noticed your command definition has -commit at the end whereas your command line example does not.
I noticed your command line example "sudo /usr/lib/nagios/plugins/check_mssql_health/" has a trailing forward slash but I assume this is a typo.

When testing at the command line, are you doing it as the nagios user?

sorry I am missing the -commit for my command, it actually has the -commit at the end for both

and yes the slash is the typo, it doesn't have it when I run it.... any helps will be appreciated.

not sure why it runs okay on the commandline but not with the nagios web interface..... and also, I am using the same username and password for both commandline and config file.

Re: check_mssql_health failed-jobs mode question

Posted: Sun Jan 04, 2015 6:18 pm
by Box293
When testing at the command line, are you doing it as the nagios user?

Code: Select all

su nagios
/usr/lib/nagios/plugins/check_mssql_health blah blah blah
Did you try adding sudo to your command definition as I suggested? Did that help?

Re: check_mssql_health failed-jobs mode question

Posted: Wed Jan 21, 2015 1:39 pm
by pkam
Box293 wrote:When testing at the command line, are you doing it as the nagios user?

Code: Select all

su nagios
/usr/lib/nagios/plugins/check_mssql_health blah blah blah
Did you try adding sudo to your command definition as I suggested? Did that help?
yes I have tried and still have the same issue...

Re: check_mssql_health failed-jobs mode question

Posted: Wed Jan 21, 2015 7:20 pm
by Box293
OK then in that case lets turn on debugging for Nagios and see exactly how the command is being constructed.

This turns on debugging:

Code: Select all

sed -i 's/.*debug_level=.*/debug_level=-1/g' /usr/local/nagios/etc/nagios.cfg
service nagios restart
Go and force an immediate check of the service to make it run.
Then grab a copy of the file /usr/local/nagios/var/nagios.debug and post it here.

This turns off debugging:

Code: Select all

sed -i 's/.*debug_level=.*/debug_level=0/g' /usr/local/nagios/etc/nagios.cfg
service nagios restart

Re: check_mssql_health failed-jobs mode question

Posted: Wed May 06, 2015 12:54 pm
by renaud.lepape
has this been resolved ?
I have a similar issue with check_mysql_health, was working OK until yesterday, My Nagios shows (Return code of 127 is out of bounds - plugin may be missing), but this is working perfectly OK from the command (using both root user and nagios user..)

Re: check_mssql_health failed-jobs mode question

Posted: Wed May 06, 2015 4:58 pm
by Box293
Please start a new thread for your problem and include all troubleshooting steps you have taken.