|
View previous topic :: View next topic |
Author |
Message |
Wabiloo
Joined: 05 Jun 2008 Posts: 26
|
Posted: Mon Feb 23, 2009 5:50 am Post subject: Reply value for File not exists test |
|
|
Hi,
I have a slight problem with the "file not exists" test. It never has a reply value. This is problematic for me as it therefore makes charts unreadable.
Would it be possible to get it to reply "1" or "0" when the result is "OK" or "Bad"? |
|
Back to top |
|
|
KS-Soft Europe
Joined: 16 May 2006 Posts: 2832
|
Posted: Mon Feb 23, 2009 7:11 am Post subject: |
|
|
I think, you may utilize the following trick. For the particular "Folder/File Availability" test, you may enable "Tune up Reply value" option with the following expression:
Code: | [%FileSize% mod (%FileSize%-1)] |
Quote from the manual:
http://www.ks-soft.net/hostmon.eng/mframe.htm#actions.htm#macro
====================================
the following variables provide information about the file detected by Folder/File Availability test method
%FileName% Name of the file (variable is useful when you setup the test using wildcards in filename)
%FileSize% Size of the file
%FileTime% Modification time
====================================
Regards,
Max |
|
Back to top |
|
|
KS-Soft Europe
Joined: 16 May 2006 Posts: 2832
|
Posted: Mon Feb 23, 2009 7:29 am Post subject: |
|
|
P.S. Please note: foregoing trick will not work for files, which have 1 byte size!
Regards,
Max |
|
Back to top |
|
|
greyhat64
Joined: 14 Mar 2008 Posts: 246 Location: USA
|
Posted: Mon Feb 23, 2009 1:11 pm Post subject: |
|
|
Max,
I ran a little 'discovery' test of my own, thinking that you could use the %StatusID% variable to accomplish this. But there are two problems:- The %StatusID% variable is interpreted as a string, so I can't 'Tune the reply' to give Wabiloo the 0 || 1 numeric reply that he's looking for, and (more troubling)
- I simply dropped the %StatusID% variable into the 'Tune up Reply' entry to see the result, and the value does not change, but remains '00' (not tested) no matter the current status.
Is this a bug?
Are there any 'conversion functions' to convert a string variable to numeric/integer?
I haven't done any charting, but maybe, if this were working, you could chart based on the 'raw' %Status% or %StatusID%, by use of a 'Count' function.
There's also the %FailureIteration% varialble that's available, if that's of any use. Use that in your mod statement and, as long as it's failed more than once, you'll get the same result as using the %FileSize% variable.
And, because I know you're gonna ask, I tested with the v7.72 I'm running in my production environment. |
|
Back to top |
|
|
KS-Soft Europe
Joined: 16 May 2006 Posts: 2832
|
Posted: Mon Feb 23, 2009 1:30 pm Post subject: |
|
|
greyhat64 wrote: | I ran a little 'discovery' test of my own, thinking that you could use the %StatusID% variable to accomplish this. But there are two problems:- The %StatusID% variable is interpreted as a string, so I can't 'Tune the reply' to give Wabiloo the 0 || 1 numeric reply that he's looking for, and (more troubling)
- I simply dropped the %StatusID% variable into the 'Tune up Reply' entry to see the result, and the value does not change, but remains '00' (not tested) no matter the current status.
Is this a bug? | You are thinking in proper way, but you forgot about one thing. HostMonitor evaluates "Tune up reply" expression before status, reply and statistics counters are set. There are bunch of %SuggestedXXX% (%SuggestedStatus%, %SuggestedSimpleStatus%, etc.) variables that could be used in this case. However, there is no %SuggestedStatusId% variable. Probably, this variable will be added in future versions.
greyhat64 wrote: | Are there any 'conversion functions' to convert a string variable to numeric/integer? | You may enclose variable into quotes, e.g. '900 Kb' is equivalent to 921600 but in this case it will not work because %StatusID% is undefuned.
greyhat64 wrote: | There's also the %FailureIteration% varialble that's available, if that's of any use. Use that in your mod statement and, as long as it's failed more than once, you'll get the same result as using the %FileSize% variable. | It makes sense. But it also will not work when %FailureIteration%== 1.
greyhat64 wrote: | And, because I know you're gonna ask, I tested with the v7.72 I'm running in my production environment. | Thank you.
Regards,
Max |
|
Back to top |
|
|
greyhat64
Joined: 14 Mar 2008 Posts: 246 Location: USA
|
Posted: Mon Feb 23, 2009 1:36 pm Post subject: |
|
|
Thanks for setting me straight
And here's another opportunity to set me straight - Can you use iterative statements in 'Tune up Reply'? I can see it being useful in some instances, but I've not run into any examples of that in the docs. |
|
Back to top |
|
|
KS-Soft
Joined: 03 Apr 2002 Posts: 12799 Location: USA
|
Posted: Mon Feb 23, 2009 2:06 pm Post subject: |
|
|
Not sure I understand what exactly means "iterative statements" in this context
Regards
Alex |
|
Back to top |
|
|
KS-Soft Europe
Joined: 16 May 2006 Posts: 2832
|
Posted: Mon Feb 23, 2009 2:16 pm Post subject: |
|
|
I think, "iterative statements", at least %SuggestedRecurrences% and %FailureIteration% can be used in "Tune up Reply" as well.
Regards,
Max |
|
Back to top |
|
|
greyhat64
Joined: 14 Mar 2008 Posts: 246 Location: USA
|
Posted: Mon Feb 23, 2009 3:52 pm Post subject: |
|
|
There may be another way to accomplish this, but I'm would like to 'Tune up Reply' using a statement similar to:
(Example below does not apply directly to current thread - simply used to illustrate a point):
Code: | If ([%SuggestedStatus% = 'Bad']) and [%CurrentStatusDuration_sec% < 14400] Then
[%Reply% ='ALARM!: %SuggestedReply%']
Else
[%Reply% ='PAST DUE ALARM!: %SuggestedReply%']
End If | In this case, both are 'Bad' results, I'm simply interested in tuning the reply, for use in an alert email subject line. This way I can use the same email profile for both situations. |
|
Back to top |
|
|
KS-Soft
Joined: 03 Apr 2002 Posts: 12799 Location: USA
|
Posted: Mon Feb 23, 2009 5:10 pm Post subject: |
|
|
I don't think we implement such option soon...
Regards
Alex |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|