Using negative thresholds
Using negative thresholds
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,
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,
-
scottwilkerson
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: Using negative thresholds
I believe you want
Code: Select all
-Cv:65:Re: Using negative thresholds
@enoc, what is the full command you are running? I'd like to see it run from the command line along with the output.
Former Nagios employee
Re: Using negative thresholds
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.
Hope you guys would to take a look at it.
-
sreinhardt
- -fno-stack-protector
- Posts: 4366
- Joined: Mon Nov 19, 2012 12:10 pm
Re: Using negative thresholds
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.
Nagios-Plugins maintainer exclusively, unless you have other C language bugs with open-source nagios projects, then I am happy to help! Please pm or use other communication to alert me to issues as I no longer track the forum.
Re: Using negative thresholds
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
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
CCM->Services->...->View Text Config
Be sure to check out our Knowledgebase for helpful articles and solutions!
Re: Using negative thresholds
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$
}
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
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
Note: Using "~" with this check didn't work es expected either.
I will be filing an internal bug report
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;;I will be filing an internal bug report
Be sure to check out our Knowledgebase for helpful articles and solutions!
Re: Using negative thresholds
Update: I filed a bug report about this issue (TASK ID 4436).
Be sure to check out our Knowledgebase for helpful articles and solutions!