Specific Interfaces send email to another additional address

Started by johnny, March 26, 2018, 04:56:23 PM

Previous topic - Next topic

johnny

Hello all,
I have a question, is there a way for some specific interfaces from a node send email alerts on another additional email address, when the interface change state other than expected?
thank you in advance

Tursiops

I haven't actually tried this with interfaces (done something similar, but not quite the same with nodes), but the following should work:

  • add the email address you want as a custom attribute to the interface
  • Create a new action using macro %M (the "CUSTOM_MESSAGE" or a filter script, you will set this later) as your email recipient in your action
  • Create another event processing policy for the event you want to alert on, above the original. Configure it to use the action above.
  • reference the custom attribute you create earlier in the event processing policies filter script and return its value as CUSTOM_MESSAGE. If the custom attribute does not exist, return false in the filter script. Event processing will continue on "normal" interfaces and hit the next rule, alerting as normal, while interfaces with the custom attribute will trigger this policy and use the custom email address for alerting


johnny

I've done it little different,
What I was trying to do, is from a new event policy I selected the specific interfaces I wanted as source objects, but it was not working for some reason, It excecuted the general policy I had. What I mean, I had that specific policy if it match to send an email to one account. The general policy for interface down has another email account as action.
When the interface changed state it only send email to the general policy.
What I then did is in the event policy I removed the source object and add a filtering script.
What I've written down is:

IF ((($node ==Node-Name) && ($object == Interface-Name)) || (($node == Node-Name) && ($object == Interface-Name)))

well this works fine as I want, it sends email on both email addresses as I want but netxms gives me a Minor Alarm.
Event: SYS_SCRIPT_ERROR
message :Script(EPP::6) execution error: Error 11 in line 1:Function not found


Do you have any idea why this is an error as function not found, despite the fact the the policy works fine.
Also why the policy does not work when I select the source objects from the Source object field

Thank you in advance


1st Problem Found:
the function should be in lowercases: if
if ((($node ==Node-Name) && ($object == Interface-Name)) || (($node == Node-Name) && ($object == Interface-Name)))

Well I speaked too soon, the problem is now that for whatever interface that gets down the second emails gets all alerts, so it does not work as expected

Found the solution:
if (($1 == Interface-ID)||($1 == Interface-ID)||($1 == Interface-ID)) return true;
return false;

So now it works as it should.
When on those interfaces it sends on both emails, on every other interface it sends only on the general email