Page 2 of 2
Re: MSSQL Plugin - How to show the query results
Posted: Wed Feb 06, 2013 12:15 pm
by scottwilkerson
Here is an example, I changed the name.
In order to actually work you do still need to use the --result '0' flag, otherwise it just returns the time it took to execute the query
Re: MSSQL Plugin - How to show the query results
Posted: Wed Feb 06, 2013 12:24 pm
by infrati.fornecedores
So it means that it will show us the stdout from the query? Keeping --result flag as "0" always?
Many thanks
Re: MSSQL Plugin - How to show the query results
Posted: Wed Feb 06, 2013 12:27 pm
by scottwilkerson
infrati.fornecedores wrote:So it means that it will show us the stdout from the query? Keeping --result flag as "0" always?
yep
Re: MSSQL Plugin - How to show the query results
Posted: Thu Feb 14, 2013 5:20 am
by infrati.fornecedores
Hello there,
So now the modificated plugin works as we spoke, like to show us the query result context, so if the query must show "100" its happens.
But now we are trying understand why the --wairning and --critical is not working, follow the command below:
check_xi_mssql_query!-H 10.10.10.1 --username obama --password 'whitehouse' --database wdc --port 1433 --query 'select COUNT(*) from table' --result ' ' --warning 900000 --critical 940000
The result from this query is: 532464 but we received an alert always and not only when the result is 9000000.
" Nagios has detected a problem with this service.
Notification Type: PROBLEM
Service: MSSQL Query
Host: 10.10.10.1
Address: 10.10.10.1
State: CRITICAL
Info:532464
Date/Time: 2013-02-14 08:01:10
"
Could you help us with that?
Many Thanks!
Re: MSSQL Plugin - How to show the query results
Posted: Thu Feb 14, 2013 10:56 am
by lmiltchev
The flags for "warning" and "critical" thresholds use the duration in seconds:
-w, --warning
Warning threshold in seconds on duration of check (Default is 2).
Accepts decimal values, note however that there must be at least a
leading 0. Example, .0023 is not a valid entry, but 0.0023 is.
-c, --critical
Critical threshold in seconds on duration of check (Default is 5).
Accepts decimal values, note however that there must be at least a
leading 0. Example, .0023 is not a valid entry, but 0.0023 is.
You can view the help file by running in terminal:
Code: Select all
/usr/local/nagios/libexec/check_mssql -h
Hope this helps.
Re: MSSQL Plugin - How to show the query results
Posted: Tue Mar 19, 2013 9:12 am
by infrati.fornecedores
Good morning,
Nagios has a plugin that shows the result of a query in SQL?
And depending on this result send an e-mail with a warning or critical.
Example:
If the result of the query is less than 5 - OK
If the result of the query is between 5 and 10 - Warning
If the query result is greater than 10 - Critical
Is there something like that?
thank you
Re: MSSQL Plugin - How to show the query results
Posted: Tue Mar 19, 2013 10:38 am
by scottwilkerson
There are 2 options, using the current plugin you would have to not use the --warning and --critical as they only test response time.
You could craft you SQL query to return a specific expected response if you are under 5 and use the -r flag to match that response.
Alternately you will need a different plugin. Searching the Exchange I found
this which has some different options