NetXMS Support Forum

Development => General => Topic started by: moseszero on December 28, 2011, 09:33:20 AM

Title: How to configure action in event process policy rule with java api
Post by: moseszero on December 28, 2011, 09:33:20 AM
HI,
The work I tried to do is when some threshold  reached , an alarm should be recorded.Setting threshold is done with java api(version 1.1.6),and configuring action(simply generate an alarm) in java console is OK,too.But when I try to do add action with java api , I don't know what action id should be used here.
I wonder if there is some introduction about the original action of netxms?For example , the id for the action of "generate an alarm".
Title: Re: How to configure action in event process policy rule with java api
Post by: Victor Kirhenshtein on December 29, 2011, 10:55:16 AM
Hi!

Alarm generation and actions are different things. For generating alarm you do not need an action - it's just special attributes in event processing policy rule. To set rule to generate alarm, do the following (assuming you already have rule object called "rule" of type EventProcessingPolicyRule):


rule.setFlags(rule.getFlags() | EventProcessingPolicyRule.GENERATE_ALARM);
rule.setAlarmMessage("%m");  // it's an example, you can specify your real alarm message here
rule.setAlarmSeverity(0);   // specify your severity
rule.setAlarmKey("");   // specify alarm key


and to set rule to terminate alarm:


rule.setFlags(rule.getFlags() | EventProcessingPolicyRule.GENERATE_ALARM);
rule.setAlarmSeverity(Severity.UNMANAGED);   // Severity UNMANAGED indicates alarm termination rule
rule.setAlarmKey("");   // specify alarm key


Also, you can take a look at property pages in nxmc-epp plugin in management console.

Best regards,
Victor
Title: Re: How to configure action in event process policy rule with java api
Post by: moseszero on December 29, 2011, 11:09:09 AM
Thank you!