Page 1 of 1

check_mssql PHP problem

Posted: Thu Jan 03, 2013 7:55 am
by blariv
hi all,

need some help again...

I'm running the following and getting the undefined error. I cant seem to figure out why. running the query outputs ok from SQL.

I have the latest versions of all the wizards and all the pre-reqs.

[root@nagiosxi libexec]# /usr/local/nagios/libexec/check_mssql -H HOSTNAME -U user -P password -d DATABASE -q "select count(*) from [commonspot-site-hasbro-enus].[dbo].[FileActionQueue]" -r "0" -w 100 -c 5000
PHP Notice: Undefined variable: exit_code in /usr/local/nagios/libexec/check_mssql on line 315
OK: Query duration=0.00057 seconds.|query_duration=0.00057s;100;5000;0;

CentOS 6.3
Manual install of NagiosXI 2012R1.3
No special configs

Re: check_mssql PHP problem

Posted: Thu Jan 03, 2013 10:44 am
by nscott
What do you get when you run

grep '^display_errors =' /etc/php.ini

This error is just raising a notice, which isn't an error, and the developer may be defaulting that to 0 on OK status.

Re: check_mssql PHP problem

Posted: Thu Jan 03, 2013 10:49 am
by blariv
output is

display_errors = Off

Re: check_mssql PHP problem

Posted: Thu Jan 03, 2013 10:50 am
by yancy
blariv,

Also, which version of the plugin are you using?

grep "Version" check_mssql.php


-Yancy

Re: check_mssql PHP problem

Posted: Thu Jan 03, 2013 10:53 am
by blariv
# Version 0.6.6, Copyright (c) 2008 Gary Danko <[email protected]>
# Version 0.6.7,0.6.8 2012 Nicholas Scott <[email protected]>
# Version 0.1.0 - 2008/08/14
# Version 0.2.0 - 2008/08/15
# Version 0.2.2 - 2008/08/18
# Version 0.5.0 - 2008/09/29
# Version 0.6.0 - 2008/10/23
# Version 0.6.3 - 2008/10/26
# Version 0.6.4 - 2008/10/31
# Version 0.6.5 - 2008/10/31
# Version 0.6.6 - 2008/10/31
# Version 0.6.7 - 2012/07/05
# Version 0.6.8 - 2012/08/30

Re: check_mssql PHP problem

Posted: Thu Jan 03, 2013 11:16 am
by nscott
I attached a potential fix, let me know if this fixes your issue.

Please note the attached file should be renamed check_mssql when you download it to your Nagios server.

Re: check_mssql PHP problem

Posted: Thu Jan 03, 2013 12:49 pm
by blariv
looks like that did it, awesome job as usual, thank you!

Re: check_mssql PHP problem

Posted: Thu Jan 03, 2013 1:09 pm
by nscott
Thanks for bringing that bug to my attention, I'll get this committed.

Re: check_mssql PHP problem

Posted: Thu Feb 27, 2014 3:57 pm
by vAJ
Just had to manually update this check_mssql as well. Has it not been updated in a release yet?

Fixed my problem same as OP.

Re: check_mssql PHP problem

Posted: Tue Sep 15, 2015 8:03 am
by nickwhite
nscott wrote:I attached a potential fix, let me know if this fixes your issue.

Please note the attached file should be renamed check_mssql when you download it to your Nagios server.
Thanks nscott for providing this. I know this thread is so old, but I just had this fix my issue as well. It seems that even as 2015-Sep-15th, the fix in this thread has not been merged with the download for check_mssql. Just giving a heads up, so that hopefully someone can resolve it.