check_mssql_health failed-jobs mode question

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
pkam
Posts: 10
Joined: Mon Dec 15, 2014 1:20 pm

check_mssql_health failed-jobs mode question

Post 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!
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: check_mssql_health failed-jobs mode question

Post 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
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
pkam
Posts: 10
Joined: Mon Dec 15, 2014 1:20 pm

Re: check_mssql_health failed-jobs mode question

Post 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!
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: check_mssql_health failed-jobs mode question

Post 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?
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
pkam
Posts: 10
Joined: Mon Dec 15, 2014 1:20 pm

Re: check_mssql_health failed-jobs mode question

Post 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.
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: check_mssql_health failed-jobs mode question

Post 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?
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
pkam
Posts: 10
Joined: Mon Dec 15, 2014 1:20 pm

Re: check_mssql_health failed-jobs mode question

Post 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...
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: check_mssql_health failed-jobs mode question

Post 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
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
renaud.lepape
Posts: 1
Joined: Wed May 06, 2015 12:22 pm

Re: check_mssql_health failed-jobs mode question

Post 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..)
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: check_mssql_health failed-jobs mode question

Post by Box293 »

Please start a new thread for your problem and include all troubleshooting steps you have taken.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Locked