News:

We really need your input in this questionnaire

Main Menu

Using best notification action

Started by Goriem, March 21, 2012, 01:03:31 PM

Previous topic - Next topic

Goriem

Hi

my question is this:
can i scipt an action that chooses between sendiing sms or execute command depending on status of a situation?

i have an action for sending sms and an action that sends an online notification to my notifo account via curl

i also have a situation evaluation if there is internet access called internetaccess - i have used this to evaluate if a ping to an external host should generate an alarm based upon avaliability of my router and firewall.

i would like my action to notify me via the execute command action when there is internet access but then to default to sending sms when no internet is accessible.

is this possible and if it is - how do i do this in the smartest way?

regards

Victor Kirhenshtein

Hi!

Yes, this is possible. You have to create two rules: one for sending SMS and second for executing your notification script. In first rule you have to add filtering script, which will return TRUE if there are no internet connection. For second rule you can use the same script, but with reversed return values: FALSE if there are no internet connection and TRUE if internet connection is available. Depending on your policy, you may also add "stop processing" flag to first rule (for SMS sending), and do not use filtering script in second rule at all.

Best regards,
Victor

Goriem

Hi
thanks for your reply i had hoped to accomplish this a "smarter" way, by getting my alert action to evaluate upon status of my internetaccess so that i did not need two events for every alert but this aproach will work, you're quite right.

thankyou

Victor Kirhenshtein

You don't need two events, just two different rules for same event.

Also, if you want to put this logic into your script, it is also possible. You can just pass additional parameter to your script, giving current status of internet connection. In action definition, you can use macro %[script_name], and in the script return different values depending on internet connection state.

Best regards,
Victor