KS-Soft. Network Management Solutions
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister    ProfileProfile    Log inLog in 

Reply value for File not exists test

 
Post new topic   Reply to topic    KS-Soft Forum Index -> Configuration, Maintenance, Troubleshooting
View previous topic :: View next topic  
Author Message
Wabiloo



Joined: 05 Jun 2008
Posts: 26

PostPosted: Mon Feb 23, 2009 5:50 am    Post subject: Reply value for File not exists test Reply with quote

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
View user's profile Send private message
KS-Soft Europe



Joined: 16 May 2006
Posts: 2832

PostPosted: Mon Feb 23, 2009 7:11 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
KS-Soft Europe



Joined: 16 May 2006
Posts: 2832

PostPosted: Mon Feb 23, 2009 7:29 am    Post subject: Reply with quote

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

Regards,
Max
Back to top
View user's profile Send private message Send e-mail Visit poster's website
greyhat64



Joined: 14 Mar 2008
Posts: 246
Location: USA

PostPosted: Mon Feb 23, 2009 1:11 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
KS-Soft Europe



Joined: 16 May 2006
Posts: 2832

PostPosted: Mon Feb 23, 2009 1:30 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
greyhat64



Joined: 14 Mar 2008
Posts: 246
Location: USA

PostPosted: Mon Feb 23, 2009 1:36 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
KS-Soft



Joined: 03 Apr 2002
Posts: 12799
Location: USA

PostPosted: Mon Feb 23, 2009 2:06 pm    Post subject: Reply with quote

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

Regards
Alex
Back to top
View user's profile Send private message Visit poster's website
KS-Soft Europe



Joined: 16 May 2006
Posts: 2832

PostPosted: Mon Feb 23, 2009 2:16 pm    Post subject: Reply with quote

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

Regards,
Max
Back to top
View user's profile Send private message Send e-mail Visit poster's website
greyhat64



Joined: 14 Mar 2008
Posts: 246
Location: USA

PostPosted: Mon Feb 23, 2009 3:52 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
KS-Soft



Joined: 03 Apr 2002
Posts: 12799
Location: USA

PostPosted: Mon Feb 23, 2009 5:10 pm    Post subject: Reply with quote

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

Regards
Alex
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    KS-Soft Forum Index -> Configuration, Maintenance, Troubleshooting All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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

KS-Soft Forum Index