Auto alarm acknowledgement server side

I am looking for a way to automatically acknowledge an alarm server side.  We have a condition “expression” that when determined false it fires an alarm directly from the agent.  These alarms do not require human interaction so we would like to auto acknowledge once the enterprise receives them.  These alarms will happen very infrequently so I am not concerned about hiding the noise.  Thanks for any help you can provide.

 

Howdy Matt, There are a few

Howdy Matt,

 

There are a few ways to accomplish this using Custom Objects. The easiest way is to configure an Alarm Rule which will perform the auto-acknowledge behavior. The code below should do the trick:

 

/**
 * Auto-acknowledge alarms script
 *
 * Configure this script as a Custom Object -> Alarm Rule
 *
 * Alarm Rules receive the following injected resources:
 * - logger : A log4j logger
 * - context : An instance of a RuleContext
 * - alarm : The Alarm which triggered the Rule
 */

import com.axeda.drm.sdk.data.AlarmFinder;
import com.axeda.drm.sdk.data.Alarm;

logger.debug("Running alarm auto-acknowledge rule for alarm ${alarm.name}");
logger.debug();

// since this rule does not run on the persistence thread
// it is safest to wait until we can be sure the persistence has finished
try
{
    Thread.sleep(15000);
}
catch (InterruptedException ex)
{
}

AlarmFinder finder = new AlarmFinder(context.context);
// find alarms for this device
finder.setDevice(alarm.getDevice());
// that are unacknowledged
finder.setAcknowledged(finder.UNACKNOWLEDGED);
// and match this alarm name
finder.setAlarmName(alarm.getName());
// find the alarm from the DB
Alarm persistedAlarm = finder.find();

// once the alarm is found, acknowledge it
if (persistedAlarm != null) {
      persistedAlarm.acknowledge();
}

// allow the alarm to continue processing
return true;

Even easier

Actually, with the Axeda Platform 6 release, using ExpressionRules it is way easier. You can try this out with your developer connection platform access.

In the IF of an Expression Rule, add a condition you would like, and in the THEN, simply use the SetAlarmState action. Here's the full example

UI: Configuration->New->Expression Rule

Rule type: Alarm

IF: Alarm.name == "Noise"

THEN: SetAlarmState("CLOSED", "Automatically closing alarm")

Save the rule and then associate it with your model.

Access Control

Great job here.  I really enjoyed what you had to
say.  Keep going because you definitely bring a new voice to this
subject.  Not many people would say what you’ve said and still make
it interesting.  Well, at least I’m interested. You’ve put together a
great blog space --great graphics, videos, and layout.  This is
definitely a must-see blog!

Access Control

//Custom Alarm ruleimport

//Custom Alarm rule
import com.axeda.drm.sdk.data.AlarmFinder;
import com.axeda.drm.sdk.data.Alarm;

def alarmFinder = new AlarmFinder(context.getContext());

alarmFinder.setAlarmName(parameters.argalarmname);
alarmFinder.setDevice(context.getDevice());
alarmFinder.setAcknowledged(AlarmFinder.UNACKNOWLEDGED);

Alarm alarm = alarmFinder.find();
alarm?.acknowledge();