NetXMS Support Forum

English Support => General Support => Topic started by: Mystery on May 16, 2025, 11:53:29 AM

Title: Sending mail from Event Processing Policy not working
Post by: Mystery on May 16, 2025, 11:53:29 AM
Hello, I just migrated our NetXMS instance from 2.2 to the latest version of NetXMS (5.2.1).
Somehow the Event Processing Policy do not send emails. 
First, I had to configure new row in Notification Channels - done.
In the Tools - Send notification - I tried to send me test email - done, email recieved.
In the Event Processing Policy - I have custom event code and server action - send email (called "Network_Device_not_OK").
In the Actions Configuration - I have row "Network Device not OK" with Send notification and correct Channel name (which I tested and recieved email before) with my Recipient's address, subject and mesage text.

I have mailing template which polls ICPM ping packet loss (origin: internal) - last(5) polled values > 99 triggers Event "Network_Device_not_OK "

I can see that in Event Log - correct Event, message, ... But my email is nowhere.
Can you help me to fix that? It was working in previous version.

One more question, do you know how to send emails from template and polled values better than ICMP ping - packet loss? Some devices do not have agents or SNMP configured, so I want to get notified when they go offline (but not all - thats why I use template and apply only to specifiec ones) and also not instantly? Thats why I wait for like 5 polls to notify me.

Thank you in advance.
Title: Re: Sending mail from Event Processing Policy not working
Post by: Filipp Sudanov on May 16, 2025, 05:23:40 PM
For delayed notifications pls check screenshots in this documentation chapter: https://netxms.org/documentation/adminguide/event-processing.html#actions

What about Server Action Execution and Notification logs, is there anything there related to the email?
Title: Re: Sending mail from Event Processing Policy not working
Post by: Mystery on May 19, 2025, 10:45:04 AM
In the notification log, there are only rows from testing events.
In the event log, there is correct event, which should send these emails as event processing policy define that.

{
  "id": 11134,
  "rootId": 0,
  "code": 100074,
  "name": "Network_Device_not_OK",
  "timestamp": 1747638739,
  "originTimestamp": 1747638739,
  "origin": 0,
  "source": 356,
  "zone": 0,
  "dci": 1137,
  "severity": 4,
  "message": "NetXMS - OFFLINE :-( ",
  "lastAlarmKey": "",
  "lastAlarmMessage": "",
  "tags": null,
  "parameters": [
    {
      "name": "dciName",
      "value": "ICMP.PacketLoss"
    },
    {
      "name": "dciDescription",
      "value": "ICMP ping: packet loss"
    },
    {
      "name": "thresholdValue",
      "value": "99"
    },
    {
      "name": "currentValue",
      "value": "100"
    },
    {
      "name": "dciId",
      "value": "0x00000471"
    },
    {
      "name": "instance",
      "value": ""
    },
    {
      "name": "isRepeatedEvent",
      "value": "1"
    },
    {
      "name": "dciValue",
      "value": "100"
    },
    {
      "name": "operation",
      "value": "4"
    },
    {
      "name": "function",
      "value": "0"
    },
    {
      "name": "pollCount",
      "value": "5"
    },
    {
      "name": "thresholdDefinition",
      "value": "last(5) \u003e 99"
    }
  ]
}
Title: Re: Sending mail from Event Processing Policy not working
Post by: Filipp Sudanov on May 19, 2025, 11:35:35 AM
What about EPP rules which are before that one that should send the notification? Could there be some rule with "stop event processiong" checkbox?
Title: Re: Sending mail from Event Processing Policy not working
Post by: Mystery on May 19, 2025, 01:16:16 PM
I exported all EPPs from old verions of NetXMS and imported to new NetXMS instance. 
Somehow, the imported ones are not working (sending emails).
I created new EPP with same definitions and email is sent.

(https://i.ibb.co/3YmTBLDy/screen.png)

See rule 60 is not working while rule 79 is working. Strange.
I also see a new row in the notification log.
There is no rule with "stop event processiong" checkbox.
Title: Re: Sending mail from Event Processing Policy not working
Post by: Filipp Sudanov on May 19, 2025, 01:18:18 PM
Can you share the exported .xml (or at least it's part related to this specific rule).
Export was performed in v 2.2, right?
Title: Re: Sending mail from Event Processing Policy not working
Post by: Mystery on May 19, 2025, 01:26:47 PM
Yes, XML (from 2.2 version) of this rule ID is here:
Do you need some more details?

<rule id="5">
<guid>0cdde918-dc08-4096-9418-0197355b2833</guid>
<flags>7936</flags>
<alarmMessage>%m</alarmMessage>
<alarmKey></alarmKey>
<alarmSeverity>5</alarmSeverity>
<alarmTimeout>0</alarmTimeout>
<alarmTimeoutEvent>43</alarmTimeoutEvent>
<script></script>
<comments>Network Device is OFFLINE - Send E-mail</comments>
<sources>
</sources>
<events>
<event id="100032">
<name>Network_Device_not_OK</name>
</event>
</events>
<actions>
<action id="16">
<guid>9b8807fa-f8d4-4ad7-ac5d-61f85cd27795</guid>
<timerDelay>
0</timerDelay>
<timerKey>
</timerKey>
</action>
</actions>
<timerCancellations>
</timerCancellations>
<pStorageActions>
</pStorageActions>
</rule>
<event id="100032">
<name>Network_Device_not_OK</name>
<guid>06cdfff3-bce6-4bbd-8c02-0a444a29e90f</guid>
<code>100032</code>
<severity>4</severity>
<flags>1</flags>
<message>NetXMS - Cisco Router/Switch/ASA IS OFFLINE!</message>
<description></description>
</event>
Title: Re: Sending mail from Event Processing Policy not working
Post by: Filipp Sudanov on May 19, 2025, 05:54:34 PM
Can you also select this from the DB and show the output (IDs are less by 1 then what's visible in the UI):

select rule_id, flags, comments from event_policy where rule_id in (59, 78);
Title: Re: Sending mail from Event Processing Policy not working
Post by: Mystery on May 20, 2025, 09:11:17 AM
MariaDB [netxms]> select rule_id, flags, comments from event_policy where rule_id in (59, 78);
+---------+-------+-----------------------------------------+
| rule_id | flags | comments                                |
+---------+-------+-----------------------------------------+
|      59 |  7936 | Network Device is OFFLINE - Send E-mail |
|      78 |  7936 | Test new                                |
+---------+-------+-----------------------------------------+
2 rows in set (0,001 sec)
Title: Re: Sending mail from Event Processing Policy not working
Post by: Filipp Sudanov on May 20, 2025, 12:20:14 PM
We've fixed a bug in import - when importing from older version of xml state of Action (active or not) was not correctly imported. The fix will be included in next release.

In overall it's better to upgrade just with the same database - new server will upgrade it's structure. Installing a new system and migrating config approach is used not so often, while perfectly valid.
Title: Re: Sending mail from Event Processing Policy not working
Post by: Mystery on May 20, 2025, 02:34:54 PM
Ok, thank you for info. 
Is there any way how to fix these bad imported EPPs? Like disable and enable etc? Or should I delete them and create again?

I couldn't upgrade the server, there were many errors in the upgrading process so I had to make it this way.
Title: Re: Sending mail from Event Processing Policy not working
Post by: Filipp Sudanov on May 20, 2025, 03:02:36 PM
Yes, pls try disabling and reenabling the actions. If this does not help, we will check how to fix them with a database query.
Title: Re: Sending mail from Event Processing Policy not working
Post by: Mystery on May 20, 2025, 05:05:59 PM
I tried disabling (+save) and reenabling (+save) and EP is still not working. If you don't mind, database query would be helpfull.
Thank you:)
Title: Re: Sending mail from Event Processing Policy not working
Post by: Filipp Sudanov on May 20, 2025, 05:48:40 PM
This query should list EPP rules that have actions. In the "active" column you should have 1 for active actions and 0 for inactive, but may be you'll get some other values.
select p.comments, a.action_id, a.active from POLICY_ACTION_LIST a INNER JOIN event_policy p ON a.rule_id = p.rule_id;
A query to activate them all should be just this:
update policy_action_list set active = 1;
Note that netxms server should be stopped before running any update queries to the DB.
Title: Re: Sending mail from Event Processing Policy not working
Post by: Mystery on May 22, 2025, 04:37:56 PM
Thank you, it helped:)
Title: Re: Sending mail from Event Processing Policy not working
Post by: Filipp Sudanov on May 23, 2025, 01:20:52 PM
Great, thanks for the update