Please note that VisualCron support is not actively monitoring this community forum. Please use our contact page for contacting the VisualCron support directly.


Guest
2017-04-07T07:44:10Z
Hi all,

Maybe someone can help me.
We are a company with FuelStations.
I want to monitor all fuelstations if they are online (for payment at the gasstation)
I made a job with e-mailnotification.
I used the ping (ICMP) option to check every 5 minutes.
When ping fails, I get a notification -> on error ->e-mail with the variables I need.
When ping is succesfull I don't want a e-mail, -> success -> next task

What I want to acomplish is the following.
When ping fails -> on error -> e-mail with the variables I need.
When the Fuelstation is back online again -> I want a notification with the variables I need.
I played around with exit-code 77777 change to 0 then e-mail, but I can't get it to work.
But when the last error code was 0 (succesfull) I don't want an e-mail.
I hope you understand,
Can someone help me?
Sponsor
Forum information
thomas
2017-04-07T09:21:54Z
You need to create a condition (see conditions in menu), that checks exit code of the previous task, and calls an appropriate action. On the email task you add the condition.
thomas
2017-04-07T09:26:03Z
You should be able to make it work with the Flow logic you are trying also. Can you post an img of how your flow task is set up?
Guest
2017-04-07T11:49:55Z


Thank you for replying.
I can not use PrevTASK, because I need results of active task, but the previous value.
What works is:
On succes go to next task in the job WITHOUT e-mail notification
On Error go to next task in the job WITH e-mail notification (e-mail uses variables which station is down)
What not works is:
When a station was down last poll, but now it is back online again, I want an e-mail that tells me the station is online

Thank you in advance

Iwan
Maybe 1 type of notification could do it, but I dont know how to do this in VisualCron.
$lastCode = 'Result1'
$newCode = 'Result2'
if $lastCode <> $newCode send notification else exit

Notification could send taskname with result (when up or down as long as the value differs from previous poll)
$lastcode = 0
$newCode = 77777
Send mail station x status is failed
or
$lastcode = 77777
$newcode= 0
Send mail station x status is success
or
$last code = 0
$new code = 0
no need for e-mail, wait for next interval to check ping
Guest
2017-04-10T09:46:25Z
😕
can't get it to work...
anyone?
Or do I need to create an external script with array or file with values in it?

Iwan
Support
2017-04-10T14:47:03Z
I guess you have a list of ip-addresses or hosts. I suggest looping through this list in the Ping Task. If failing you can do something by running a Notification in the Flow tab.
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
Guest
2017-04-10T14:57:00Z
Hi Henrik,
What you suggest, I already do.
I get a notification when a host is down.
But I also need a notification when the host is online again.
I cannot use notification on success, because I will get 100 e-mails every minute.
I only want mail when the host is offline and when it gets back online again.
If ping is succesfull I don't need a notification except when the last poll was offline.
__________
I tried conditions and multiple jobs, but I get stuck in loops.
For Example:
Condition -> 77777 go to job x run notification
condition -> 0 go to job y run notification

Result Always e-mail...
Support
2017-04-10T15:47:58Z
Originally Posted by: Vollenhoven 

Hi Henrik,
What you suggest, I already do.
I get a notification when a host is down.
But I also need a notification when the host is online again.
I cannot use notification on success, because I will get 100 e-mails every minute.
I only want mail when the host is offline and when it gets back online again.
If ping is succesfull I don't need a notification except when the last poll was offline.
__________
I tried conditions and multiple jobs, but I get stuck in loops.
For Example:
Condition -> 77777 go to job x run notification
condition -> 0 go to job y run notification

Result Always e-mail...



The loops are not very Condition friendly at the moment. You can use Flow but it will not get you exactly what you need. I think you need some script logic this.
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
Guest
2017-04-11T09:47:53Z
Thomas,

after reviewing and testing, I can get it to work with the hints you gave me.
What I will do is:
job with conditions
if condition (exit code) = 77777 then start task 1 (send notifiction when successfull and don't send if unsuccessfull)
if condition (exit code) = 0 then start task 2 (send notification when unsuccessfull and don't send if succesfull)
Glady I can clone the task.
So I will make for all gasstions 2 tasks which will be called from the condition from the job. (200/300 tasks in 1 job)
Hell of a work, but it seems it can't be done easier.

This way I don't get stuck in a loop and only get mail when a condition is changed.

So thank you Thomas for pointing me in the right direction.
If there is an easier way...please tell me :-)

Iwan
thomas
2017-04-11T13:29:23Z
Well done! My contribution was close to zero.

i don't see an easier way (unless you write the results to a database or file). I thought about writing result to job variables, but it's messy.
Scroll to Top