How to configure action in event process policy rule with java api

Started by moseszero, December 28, 2011, 09:33:20 AM

Previous topic - Next topic

moseszero

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".

Victor Kirhenshtein

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