Reply value for File not exists 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
Wabiloo
Posts: 26
Joined: Thu Jun 05, 2008 12:15 am

Reply value for File not exists test

Post by Wabiloo »

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"?
KS-Soft Europe
Posts: 2832
Joined: Tue May 16, 2006 4:41 am
Contact:

Post by KS-Soft Europe »

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: Select all

[%FileSize% mod (%FileSize%-1)]
Quote from the manual:
http://www.ks-soft.net/hostmon.eng/mfra ... .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
KS-Soft Europe
Posts: 2832
Joined: Tue May 16, 2006 4:41 am
Contact:

Post by KS-Soft Europe »

P.S. Please note: foregoing trick will not work for files, which have 1 byte size!

Regards,
Max
User avatar
greyhat64
Posts: 246
Joined: Fri Mar 14, 2008 9:10 am
Location: USA

Post by greyhat64 »

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. :roll:
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.
KS-Soft Europe
Posts: 2832
Joined: Tue May 16, 2006 4:41 am
Contact:

Post by KS-Soft Europe »

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
User avatar
greyhat64
Posts: 246
Joined: Fri Mar 14, 2008 9:10 am
Location: USA

Post by greyhat64 »

Thanks for setting me straight :D
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.
KS-Soft
Posts: 13012
Joined: Wed Apr 03, 2002 6:00 pm
Location: USA
Contact:

Post by KS-Soft »

Not sure I understand what exactly means "iterative statements" in this context :roll:

Regards
Alex
KS-Soft Europe
Posts: 2832
Joined: Tue May 16, 2006 4:41 am
Contact:

Post by KS-Soft Europe »

I think, "iterative statements", at least %SuggestedRecurrences% and %FailureIteration% can be used in "Tune up Reply" as well.

Regards,
Max
User avatar
greyhat64
Posts: 246
Joined: Fri Mar 14, 2008 9:10 am
Location: USA

Post by greyhat64 »

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: Select all

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.
KS-Soft
Posts: 13012
Joined: Wed Apr 03, 2002 6:00 pm
Location: USA
Contact:

Post by KS-Soft »

I don't think we implement such option soon...

Regards
Alex
Post Reply