Page 1 of 2

Using negative thresholds

Posted: Wed Jun 11, 2014 3:08 am
by reincarne
Hi,
I'm using check_mssql_nt.exe to monitor specific queries.
Here are the specs of this tool:

Usage: check_mssql_nt.exe [/h] /H:hostname [/D:dbname] [/U:username] [/P:passwor
d] [/t:timeout] [/CHK_CONNECT] [/CHK_CONNECTIONCOUNT] [/CHK_QUERY:ownquery] /w:w
arn_secs /c:crit_secs /Wv:[max_value|min_value:max_value] /Cv:[max_value|min_va
lue:max_value] [/PF:outformatter]

My problem is that I need to monitor a negative value.
That means if the query goes lower then 65, I need to get an alert.
Usually I was doing it by setting Warnign value higher then the Critical and it worked.
I tried to define also a range by setting -Cv:0:65 but then Nagios returns "65" and the OK message.

Can someone please help me how can I set a negative value for monitoring using this tool? Thanks,

Re: Using negative thresholds

Posted: Wed Jun 11, 2014 10:09 am
by scottwilkerson
I believe you want

Code: Select all

-Cv:65:

Re: Using negative thresholds

Posted: Tue Sep 02, 2014 3:17 pm
by tmcdonald
@enoc, what is the full command you are running? I'd like to see it run from the command line along with the output.

Re: Using negative thresholds

Posted: Tue Nov 11, 2014 4:10 pm
by sujitt
I have the exact issue. Looks like the plugin does not follow any rules specified by nagios plug-in development. I am really bummed that this comes with XI and Nagios XI as a product is using with the wizard and is not exactly the best plugin.

Hope you guys would to take a look at it.

Re: Using negative thresholds

Posted: Tue Nov 11, 2014 4:42 pm
by sreinhardt
sjujitt, where are you seeing this as a default? I do not have a check_mssql_nt.exe. In fact, that would appear to be a windows executable, which we ship very few if any of.

Re: Using negative thresholds

Posted: Tue Nov 11, 2014 5:14 pm
by sujitt
When we create a service check using the wizard. by default it uses check_mssql. this code is not the same quality as your other check_xi_mssql_database command. I was surprised that the wizard uses check_mssql which does not have the features defined in thehttps://nagios-plugins.org/doc/guidelin ... HOLDFORMAT

Re: Using negative thresholds

Posted: Tue Nov 11, 2014 5:48 pm
by lmiltchev
What is the wizard that you ran? Can you show us the service definition that was created by the wizard?

CCM->Services->...->View Text Config

Re: Using negative thresholds

Posted: Tue Nov 11, 2014 6:00 pm
by sujitt
I do not know which option on XI gives you the view textconfig. but here is the config

define service {
host_name goneisql2010
service_description MSSQL Query - Test Query
use xiwizard_mssqlquery_service
check_command check_xi_mssql_query!--username xxx --password "xxx" --database master --query "SELECT+COUNT%28%2A%29+FROM+sys.sysperfinfo" --result "Expected result" --decode --warning 50 --critical 200 --querywarning 50 --querycritical 200 --result Expected result
max_check_attempts 5
check_interval 5
retry_interval 1
check_period xi_timeperiod_24x7
notification_interval 60
notification_period xi_timeperiod_24x7
contacts nagiosadmin
_xiwizard mssqlquery
register 1
}


define service {
name xiwizard_mssqlquery_service
use xiwizard_generic_service
check_command check_xi_mssql_query
register 0

}



define command {
command_name check_xi_mssql_query
command_line $USER1$/check_mssql -H $HOSTADDRESS$ $ARG1$
}

Re: Using negative thresholds

Posted: Wed Nov 12, 2014 12:24 pm
by lmiltchev
I just verified that the plugin is not honoring the nagios plugin development guidelines in regards to thresholds and ranges. Here, I am getting an OK state in both cases, even though 999 is less than the warning and the critical threshold and I should be getting a non-OK state in the second check.

https://nagios-plugins.org/doc/guidelin ... HOLDFORMAT

Code: Select all

[root@testbox libexec]# ./check_mssql -H 192.168.x.x --username xxx --password "xxx" --database master --instance xxx --query "SELECT COUNT%28%2A%29 FROM sys.sysperfinfo" --result "999" --decode --warning 1 --critical 2 --querywarning 1000 --querycritical 2000 --result 999
OK: Query duration=0.002158 seconds.|query_duration=0.002158s;1;2 query_perf=999;;

[root@testbox libexec]# ./check_mssql -H 192.168.x.x --username xxx --password "xxx" --database master --instance xxx --query "SELECT COUNT%28%2A%29 FROM sys.sysperfinfo" --result "999" --decode --warning 1 --critical 2 --querywarning 1000: --querycritical 2000: --result 999
OK: Query duration=0.001837 seconds.|query_duration=0.001837s;1;2 query_perf=999;;
Note: Using "~" with this check didn't work es expected either.

I will be filing an internal bug report

Re: Using negative thresholds

Posted: Wed Nov 12, 2014 12:32 pm
by lmiltchev
Update: I filed a bug report about this issue (TASK ID 4436).