MSSQL Plugin - How to show the query results

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: MSSQL Plugin - How to show the query results

Post 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
You do not have the required permissions to view the files attached to this post.
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
infrati.fornecedores
Posts: 17
Joined: Tue Jan 08, 2013 6:49 pm

Re: MSSQL Plugin - How to show the query results

Post by infrati.fornecedores »

So it means that it will show us the stdout from the query? Keeping --result flag as "0" always?

Many thanks
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: MSSQL Plugin - How to show the query results

Post 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
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
infrati.fornecedores
Posts: 17
Joined: Tue Jan 08, 2013 6:49 pm

Re: MSSQL Plugin - How to show the query results

Post 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!
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: MSSQL Plugin - How to show the query results

Post 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.
Be sure to check out our Knowledgebase for helpful articles and solutions!
infrati.fornecedores
Posts: 17
Joined: Tue Jan 08, 2013 6:49 pm

Re: MSSQL Plugin - How to show the query results

Post 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
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: MSSQL Plugin - How to show the query results

Post 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
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
Locked