Warning and Bad Status for CPU test

All questions related to installations, configurations and maintenance of Advanced Host Monitor (including additional tools such as RMA for Windows, RMA Manager, Web Servie, RCC).
Post Reply
JuergenF
Posts: 331
Joined: Sun Jan 26, 2003 6:00 pm
Location: Germany, North Rhine-Westphalia

Warning and Bad Status for CPU test

Post by JuergenF »

Dear KS-Team,

many thanks for the new feature in 6.50 Beta
As it is complex maybe I've not fully understood the idea how it should work.
I've the following test
In short Words:
If CPU usage is more than 20%
- set WARNING for the first 2 recurrences
- if more than 2, set BAD
;-----------------------------------------------------------------------------
;- HostMonitor`s export/import file -
;- Generated by HostMonitor at 2006-12-09 11:21:57 -
;- Source file: D:\User\HostMonitor\Warning-Test.hml -
;- Generation mode: Selected_Tests -
;-----------------------------------------------------------------------------


; ------- Test #01 -------


Method = CPU
;--- Common properties ---
;DestFolder = Root\
Title = CPU <local computer>
Comment = CPU Usage on <local computer>
RelatedURL =
ScheduleMode= Regular
Schedule =
Interval = 10
Alerts = Message, Sound
ReverseAlert= No
UnknownIsBad= No
WarningIsBad= No
UseWarning = Yes
WarningExpr = ("%SimpleStatus%"=="DOWN") and (%Recurrences%<3)
UseCommonLog= Yes
PrivLogMode = Default
CommLogMode = Default
;--- Test specific properties ---
Computer =
OS = NT
MaxCPUUsage = 20

;-----------------------------------------------------------------------------
; Exported 1 items
That results in the following behaviour (seen in native GUI):
- Status is OK and Recurrences are 40 (as an example)
Now more than 20% CPU-Usage is created (cpustres.exe)
- Status is BAD and Recurrences are 1 and BAD Action ist started
- Status is WARNING and Recurrences are 1
- Status is WARNING and Recurrences are 2
- Status is WARNING and Recurrences are 3
- Status is BAD and Recurrences are 1 and BAD Action ist started
- Status is WARNING and Recurrences are 1
- Status is WARNING and Recurrences are 2
- Status is WARNING and Recurrences are 3
- Status is BAD and Recurrences are 1 and BAD Action ist started
.
.
.
If that works as it should, can you please explain why.
For me that is not clear. Maybe I don't understand the simple Status ?!

Many thanks.

Juergen
KS-Soft
Posts: 13012
Joined: Wed Apr 03, 2002 6:00 pm
Location: USA
Contact:

Post by KS-Soft »

If CPU usage is more than 20%
- set WARNING for the first 2 recurrences
- if more than 2, set BAD
Then you should use settings similar to our example #3:
http://www.ks-soft.net/hostmon.eng/mfra ... usexamples
Example #3: You need to monitor a device that works unreliably – often changes its status from "good" to "bad" and vice versa and you want to be alerted when the device definitely is "dead", not just lost network connection for a minute. Then you may enable “Treat Warning status as Bad”, mark “Use Warning status” option and use expression like (‘%SimpleStatus%’==’DOWN’) and (%Recurrences%<3). In such case HostMonitor will use Warning status for initial 3 failed probes and change status to Bad after 4th failed check.
Similarly you may enable “Use Normal status” option and use expression like (‘%SimpleStatus%’==’UP’) and (%Recurrences%<3)
Note 1: You need to enable “Treat Warning status as Bad” option to avoid reset of “recurrences” counter.
Note 2: Most likely you will use “Start when 4 consecutive Bad results occur” option for the actions assigned to such test item.
You do not use "Treat Warning as Bad", as a result
1) HostMonitor resets Recurrences when you don't need that
2) %SimpleStatus% returns WARNING instead of DOWN

Regards
Alex
JuergenF
Posts: 331
Joined: Sun Jan 26, 2003 6:00 pm
Location: Germany, North Rhine-Westphalia

Post by JuergenF »

Thanks for the explanation.
So I must use "Treat Warning as Bad", otherwise it will not work ?

This works better now
Method = CPU
;--- Common properties ---
;DestFolder = Root\
Title = CPU <local computer> - WARNING as BAD
Comment = CPU Usage on <local computer>^M%Status% - %StatusID% ^M%SimpleStatus%
RelatedURL =
ScheduleMode= Regular
Schedule =
Interval = 10
Alerts = Message, Sound
ReverseAlert= No
UnknownIsBad= No
WarningIsBad= Yes
UseWarning = Yes
WarningExpr = ("%SimpleStatus%"=="DOWN") and (%Recurrences%<3)
UseCommonLog= Yes
PrivLogMode = Default
CommLogMode = Default
;--- Test specific properties ---
Computer =
OS = NT
MaxCPUUsage = 20
1st question: Why is the "BAD" status set starting from the 4th recurrence ? I'd expect 2 "WARNING"s and then "BAD"s

2nd question: Try the following:
- Status is OK and Recurrences are 3 or greater
Now more than 20% CPU-Usage is created (cpustres.exe)
- Status is BAD and Recurrences are 1
- Status is WARNING and Recurrences are 2
- Status is WARNING and Recurrences are 3
- Status is BAD and Recurrences are 4
- Status is BAD and Recurrences are 5
.
.

While I'm writing this .... maybe the answer to both questions is the same ?
You are using the wrong / an old value for the comparison with "<3"
KS-Soft
Posts: 13012
Joined: Wed Apr 03, 2002 6:00 pm
Location: USA
Contact:

Post by KS-Soft »

Yes, answer to both questions is the same:
1) HostMonitor performs the test
2) HM sets new temporary status and reply value, so you may use these values for warning/normal expression. However it does not change statistic counters yet because it doesn't know what status will be used after optional status processing
3) HM checks your logical expressions, sets the status, reply, calculates recurrences and other stat counters.
2nd question: Try the following:
- Status is OK and Recurrences are 3 or greater
Now more than 20% CPU-Usage is created (cpustres.exe)
- Status is BAD and Recurrences are 1
Yeah :roll: Looks like we need to set temporary Recurrences counter on step #2... its a litlle more complicated then temporary Status and Reply. Let me think about side effects...

Regards
Alex
KS-Soft
Posts: 13012
Joined: Wed Apr 03, 2002 6:00 pm
Location: USA
Contact:

Post by KS-Soft »

Probably we should change step #2 and implement new macro variables, e.g. %OriginStatus%, %OriginReply% and %OriginRecurrences% :roll:
Or may be %SuggestedStatus%, %SuggestedReply% and %SuggestedRecurrences% sounds more appropriate?

HostMonitor will perform the test; set %Origin..% variables for new status, reply and recurrences; then evaluate custom expressions where you may use these variables and set regular status, reply, recurrences that can be different from test result

Regards
Alex
JuergenF
Posts: 331
Joined: Sun Jan 26, 2003 6:00 pm
Location: Germany, North Rhine-Westphalia

Post by JuergenF »

You know best how your software works - hopefully :wink:

MHO:
- New variables may lead to more confusion - avoid if possible (if not choose "suggested")

- Do you really need a second "reply" variable - can that be changed by "custom expressions" ?

1. Set the SimpleStatus as it would be without the "custom expressions".
2. Set Recurrences as it would be without the "custom expressions".
That's what we need to start with "custom expressions"
3. Evaluate "custom expressions" and change status if necessary
4. Reset Recurrences if needed (otherwise its already set)

Maybe I missed a lot of side effects, because I don't know your coding.
KS-Soft
Posts: 13012
Joined: Wed Apr 03, 2002 6:00 pm
Location: USA
Contact:

Post by KS-Soft »

1. Set the SimpleStatus as it would be without the "custom expressions".
2. Set Recurrences as it would be without the "custom expressions".
That's what we need to start with "custom expressions"
3. Evaluate "custom expressions" and change status if necessary
4. Reset Recurrences if needed (otherwise its already set)
Item 1, 3, 4 - its how HostMonitor works right now.
Item 2 - that's what I suggested in my 1st post (change temporarily Recurrences counter and restore it back if necessary).

But I think my 2nd suggestion is much better - it allows you to check current Recurrences (before last test probe) and new suggested Recurrences as well.
Do you really need a second "reply" variable - can that be changed by "custom expressions" ?
Why not? If HostMonitor provides %SuggestedStatus% and %SuggestedRecurrences%, it would be logical to use %SuggestedReply%.
Especially if we implement option for tuning up Reply value

Regards
Alex
KS-Soft
Posts: 13012
Joined: Wed Apr 03, 2002 6:00 pm
Location: USA
Contact:

Post by KS-Soft »

Done. Update available at www.ks-soft.net/download/hm651.zip
Now HostMonitor performs the test, sets NEW variables without touching regular counters (Status, Reply, Recurrences), then checks expressions.
In the expression you may use 4 new variables:
- %SuggestedStatus%
- %SuggestedSimpleStatus%
- %SuggestedReply%
- %SuggestedRecurrences%

Regards
Alex
Post Reply