How to execute test only once?

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
xcentric
Posts: 176
Joined: Sat Oct 23, 2010 4:30 pm

How to execute test only once?

Post by xcentric »

Currently.
Test A does an HTTP post using the HTTP test method based on Test B's good status.

In order for Test A good to trigger based on Test B good, Test A MUST be in the schedule. To avoid Test A from triggering all the time I have it set to every 23 hours. Once every 24 hours is tolerable but not when this scheme applies to 50 tests.

I would like to have Test A only triggered once after good status from Test B.
The HTTP post only needs to happen once after Test B good status and not every 23 hours.

I believe I could use an expression but having difficulty breaking it down logically.
KS-Soft Europe
Posts: 2832
Joined: Tue May 16, 2006 4:41 am
Contact:

How to execute test only once?

Post by KS-Soft Europe »

Why don't you use "HTTP Request" action ?
It can perform HTTP POST only once after test gets "Bad" status.

Please check the manual or visit our web site for more information at:
http://www.ks-soft.net/hostmon.eng/mfra ... tm#actHTTP

If you still want to perform "HTTP test", you may use "This test depends on Expression" option with "Perform test if" expression like (for test "TEST A"):

Code: Select all

('%::TEST B::SimpleStatus%'=='UP') AND ('%::TEST B::Recurrences%'=='1')
Please check the manual or visit our web site for more information at:
http://www.ks-soft.net/hostmon.eng/mfra ... expression
xcentric
Posts: 176
Joined: Sat Oct 23, 2010 4:30 pm

Post by xcentric »

I apologixze. I was mistaken.

I am using the URL request to perform a GET.

Code: Select all

('%::TEST B::SimpleStatus%'=='UP') AND ('%::TEST B::Recurrences%'=='1')
This would be ok if the request did not fail once in a while.
If this expression is used a retry will never happen after a possible bad because the recurrence will be greater than 1.

Currently if a 'bad' occurs I have the repeat set 'until status changes' then change the interva back to its original value which is 23 hours after 'good'.

Maybe explaining what I'm trying to acomplish will help out. I may not have the best approach but it is working.

1. We have 2 redundant WAN iterfaces on our firewall which supports WAN failover.
2. We have multiple static ip's with both ISP's.
3. We have the ability to update the DNS zone records through our DNS providers update API via an http get with params. No matter which ISP we are currently on our DNS records will always resolve to the correct ip's.

We use a url request Test A to check a web page for the right ip that says we have switched over. Then Test B performs the update.

The idea is for Test B to update when Test A is bad.
If Test B is successful then no more tests.
If Test B fails then keep trying until successful then no more tests.


By the way, we would use a script and external test but we like the additional robustness of the URL request like checking results of the GET and Basic Authentication without exposing the password in clear test in a script.
KS-Soft
Posts: 13012
Joined: Wed Apr 03, 2002 6:00 pm
Location: USA
Contact:

Post by KS-Soft »

The idea is for Test B to update when Test A is bad.
If Test B is successful then no more tests.
If Test B fails then keep trying until successful then no more tests
Yes, I think you should use "Change test interval" action or "HM Script" action that can disable TestB. Action should be assigned to TestB.
Another HM Script action assigned to TestA can enable TestB when necessary...

Regards
Alex
xcentric
Posts: 176
Joined: Sat Oct 23, 2010 4:30 pm

Post by xcentric »

Wow. I have never used that test before. I read the manual for it and I am impressed. I should read the manual more often. There are so many capabilities in hm it is hard to know what cobination of things will achieve your goal. Little by little I guess. Thank you for being patient with my requests.

I was able to acomplish exactly was you suggested and it is working perfectly and better than before. I did not need to use the "change interval" action at all.

I did have trouble with the order of actions. For instance. I get different email behavior depending on the order.

If an existing action that uses expressions like an email action that is on top and you add an hms script action it adds above the email action which causes the email action to trigger for the hms script action like "test enabled or disabled" and not the status such as good. Reverse the action order and the email comes through for the status.

I needed to delete the actions and add them in a specific order.

I think the answer is a way to sort the actions with a spinbox or up down buttons. I believe I read someone else having the same issue here. Maybe it was me. :roll:

Even stranger, the test properties shows the actions in one order then open and look at the action profile the order is reversed. This is in both local and rcc.
KS-Soft
Posts: 13012
Joined: Wed Apr 03, 2002 6:00 pm
Location: USA
Contact:

Post by KS-Soft »

Well, if both actions have the same "condition to start" parameters then in general case we should assume actions will be started at the same time.
HostMonitor waits for actions that do not require much time for execution or actions that may change test status, while actions that may need some time to be performed are executed asynchronously (e.g. Send E-Mail, Send message to pager, Send message to ICQ, Send message to Jabber, etc).
If you want to send e-mail with current test status and then disable test, I think its better to do this in other way around: setup Execute HM Script action that will disable test, then setup Send E-Mail action using %LastStatus% variable instead of %Status%
I think the answer is a way to sort the actions with a spinbox or up down buttons
We will add such option but this will not change much. Actions with different conditions to start will be executed depending on test status and previous statuses. Actions with the same conditions will be started "almost" simultaneously.
Even stranger, the test properties shows the actions in one order then open and look at the action profile the order is reversed. This is in both local and rcc.
This should not happen. What version of the software do you use? HostMonitor 8.85, RCC 3.85?

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

Post by KS-Soft »

Even stranger, the test properties shows the actions in one order then open and look at the action profile the order is reversed. This is in both local and rcc.
We tested several versions of HostMonitor, we cannot reproduce the problem. Could you provide some tips?

Regards
Alex
xcentric
Posts: 176
Joined: Sat Oct 23, 2010 4:30 pm

Post by xcentric »

Nt sure how to reproduce. Using hm 8.85 and rcc 3.85.

Sent you an email with a screenshot.
KS-Soft
Posts: 13012
Joined: Wed Apr 03, 2002 6:00 pm
Location: USA
Contact:

Post by KS-Soft »

Oh, you are using "advanced mode" actions.
Then this is normal behavior.

Regards
Alex
Post Reply