How to set Invert Warning and Critical values
How to set Invert Warning and Critical values
Hello Nagios Support team
Please advise how to set the invert Warning and Critical Values?
In this case, for SQL Query to interpret integer results as follows:
SELECT
[cntr_value] as 'Page life expectancy' FROM sys.dm_os_performance_counters
WHERE [object_name] LIKE '%Manager%'
AND [counter_name] = 'Page life expectancy'
BELOW 100 - produce CRITICAL
In between 300 and 100 - Produce WARNING
ABOVE 300 - OK
Please advise how to set the invert Warning and Critical Values?
In this case, for SQL Query to interpret integer results as follows:
SELECT
[cntr_value] as 'Page life expectancy' FROM sys.dm_os_performance_counters
WHERE [object_name] LIKE '%Manager%'
AND [counter_name] = 'Page life expectancy'
BELOW 100 - produce CRITICAL
In between 300 and 100 - Produce WARNING
ABOVE 300 - OK
Re: How to set Invert Warning and Critical values
I would assume you are using the check_mssql plugin. You could set your thresholds as such:
From the plugin's usage:
Hope this helps.
Code: Select all
-W 300: -C 100Code: Select all
Note: Warning and critical threshold values should be formatted via the
Nagios Plugin guidelines. See guidelines here:
https://nagios-plugins.org/doc/guidelines.html#THRESHOLDFORMAT
Examples: 10 Alerts if value is > 10
30: Alerts if value < 30
~:30 Alerts if value > 30
30:100 Alerts if 30 > value > 100
@10:200 Alerts if 30 >= value <= 100
@10 Alerts if value = 10Be sure to check out our Knowledgebase for helpful articles and solutions!
Re: How to set Invert Warning and Critical values
Hilmiltchev wrote:I would assume you are using the check_mssql plugin. You could set your thresholds as such:From the plugin's usage:Code: Select all
-W 300: -C 100Hope this helps.Code: Select all
Note: Warning and critical threshold values should be formatted via the Nagios Plugin guidelines. See guidelines here: https://nagios-plugins.org/doc/guidelines.html#THRESHOLDFORMAT Examples: 10 Alerts if value is > 10 30: Alerts if value < 30 ~:30 Alerts if value > 30 30:100 Alerts if 30 > value > 100 @10:200 Alerts if 30 >= value <= 100 @10 Alerts if value = 10
The builtin Wizard creates this Query command:
--username "secret" --password "shadow" --database Mydb --port 1435 --query "SELECT+%0D%0A%5Bcntr_value%5D+as+%27Page+life+expectancy%27+FROM+sys.dm_os_performance_counters%0D%0AWHERE+%5Bobject_name%5D+LIKE+%27%25Manager%25%27%0D%0AAND+%5Bcounter_name%5D+%3D+%27Page+life+expectancy%27%0D%0A" --decode --warning 50 --critical 200 --querywarning 300 --querycritical :100 --result "Expected result"
CRITICAL: Query result 13404 was higher than Query critical threshold 100:
this approach have worked
Last edited by dlukinski on Fri Mar 22, 2019 2:16 pm, edited 1 time in total.
Re: How to set Invert Warning and Critical values
Please try this one:
Let us know the results.
Code: Select all
--username "secret" --password "shadow" --database Mydb --port 1435 --query "SELECT+%0D%0A%5Bcntr_value%5D+as+%27Page+life+expectancy%27+FROM+sys.dm_os_performance_counters%0D%0AWHERE+%5Bobject_name%5D+LIKE+%27%25Manager%25%27%0D%0AAND+%5Bcounter_name%5D+%3D+%27Page+life+expectancy%27%0D%0A" --decode --warning 50 --critical 200 --querywarning 100:300 --querycritical 100: --result "Expected result"Re: How to set Invert Warning and Critical values
WARNING: Query result 2751 was higher than Query warning threshold 100:300.ssax wrote:Please try this one:
Let us know the results.Code: Select all
--username "secret" --password "shadow" --database Mydb --port 1435 --query "SELECT+%0D%0A%5Bcntr_value%5D+as+%27Page+life+expectancy%27+FROM+sys.dm_os_performance_counters%0D%0AWHERE+%5Bobject_name%5D+LIKE+%27%25Manager%25%27%0D%0AAND+%5Bcounter_name%5D+%3D+%27Page+life+expectancy%27%0D%0A" --decode --warning 50 --critical 200 --querywarning 100:300 --querycritical 100: --result "Expected result"
WARNING portion does to work.. had to be OK
-
scottwilkerson
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: How to set Invert Warning and Critical values
Actually, there was a mistake, should have been
Code: Select all
--username "secret" --password "shadow" --database Mydb --port 1435 --query "SELECT+%0D%0A%5Bcntr_value%5D+as+%27Page+life+expectancy%27+FROM+sys.dm_os_performance_counters%0D%0AWHERE+%5Bobject_name%5D+LIKE+%27%25Manager%25%27%0D%0AAND+%5Bcounter_name%5D+%3D+%27Page+life+expectancy%27%0D%0A" --decode --warning 50 --critical 200 --querywarning 100:300 --querycritical ~:100 --result "Expected result"Re: How to set Invert Warning and Critical values
scottwilkerson wrote:Actually, there was a mistake, should have been
Code: Select all
--username "secret" --password "shadow" --database Mydb --port 1435 --query "SELECT+%0D%0A%5Bcntr_value%5D+as+%27Page+life+expectancy%27+FROM+sys.dm_os_performance_counters%0D%0AWHERE+%5Bobject_name%5D+LIKE+%27%25Manager%25%27%0D%0AAND+%5Bcounter_name%5D+%3D+%27Page+life+expectancy%27%0D%0A" --decode --warning 50 --critical 200 --querywarning 100:300 --querycritical ~:100 --result "Expected result"
This one actually did not work at all:
fikc-m4cldb01s2.res.kcg.globalView service status details for this host MSSQL Query - Count of Page Life expectancyThis service is flappingNotifications are disabled for this service Critical 4m 31s 5/5 2019-03-25 20:48:35 CRITICAL: Query result 1389 was higher than Query critical threshold ~:100.
fikc-m4dbq01s1.res.kcg.globalView service status details for this host MSSQL Query - Count of Page Life expectancyNotifications are disabled for this service Critical 6m 11s 5/5 2019-03-25 20:51:54 CRITICAL: Query result 5024 was higher than Query critical threshold ~:100.
fikc-m4dbq01s2.res.kcg.globalView service status details for this host MSSQL Query - Count of Page Life expectancyNotifications are disabled for this service Critical 3m 45s 5/5 2019-03-25 20:49:21 CRITICAL: Query result 4693 was higher than Query critical threshold ~:100.
-
scottwilkerson
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: How to set Invert Warning and Critical values
Sorry about that, I misread your criteria, try
Code: Select all
--username "secret" --password "shadow" --database Mydb --port 1435 --query "SELECT+%0D%0A%5Bcntr_value%5D+as+%27Page+life+expectancy%27+FROM+sys.dm_os_performance_counters%0D%0AWHERE+%5Bobject_name%5D+LIKE+%27%25Manager%25%27%0D%0AAND+%5Bcounter_name%5D+%3D+%27Page+life+expectancy%27%0D%0A" --decode --warning 50 --critical 200 --querywarning @100:300 --querycritical 100: --result "Expected result"Re: How to set Invert Warning and Critical values
scottwilkerson wrote:Sorry about that, I misread your criteria, tryCode: Select all
--username "secret" --password "shadow" --database Mydb --port 1435 --query "SELECT+%0D%0A%5Bcntr_value%5D+as+%27Page+life+expectancy%27+FROM+sys.dm_os_performance_counters%0D%0AWHERE+%5Bobject_name%5D+LIKE+%27%25Manager%25%27%0D%0AAND+%5Bcounter_name%5D+%3D+%27Page+life+expectancy%27%0D%0A" --decode --warning 50 --critical 200 --querywarning @100:300 --querycritical 100: --result "Expected result"
This worked
Thank you,
Please close the case