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
MSSQL Plugin - How to show the query results
-
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
You do not have the required permissions to view the files attached to this post.
-
infrati.fornecedores
- Posts: 17
- Joined: Tue Jan 08, 2013 6:49 pm
Re: MSSQL Plugin - How to show the query results
So it means that it will show us the stdout from the query? Keeping --result flag as "0" always?
Many thanks
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
yepinfrati.fornecedores wrote:So it means that it will show us the stdout from the query? Keeping --result flag as "0" always?
-
infrati.fornecedores
- Posts: 17
- Joined: Tue Jan 08, 2013 6:49 pm
Re: MSSQL Plugin - How to show the query results
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!
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
The flags for "warning" and "critical" thresholds use the duration in seconds:
Hope this helps.
You can view the help file by running in terminal:-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.
Code: Select all
/usr/local/nagios/libexec/check_mssql -hBe 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
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
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
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
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