Alarm Service
The Alarm Service DSL is a wrapper for the Alarm Service module provided by CSW. You can refer to detailed documentation of the Alarm Service provided by CSW here.
This DSL provides an API to set the severity of an alarm. This is the the component API for CSW Alarm Service.
setSeverity
This API sets alarm severity for an AlarmKey
to the provided level and keeps refreshing it in the background with the interval of config value csw-alarm.refresh-interval
. Default value for csw-alarm.refresh-interval
config is 3 seconds which is configured in downstream CSW alarm modules reference.conf
file.
The setSeverity
API requires user to provide AlarmKey
and AlarmSeverity
.
AlarmKey
AlarmKey
represents unique alarm in the given subsystem and component e.g. nfiraos.trombone.tromboneaxislowlimitalarm
The following example demonstrates the creation of an AlarmKey
- Kotlin
-
val tromboneTemperatureAlarm = AlarmKey(Prefix(NFIRAOS, "trombone"), "tromboneMotorTemperatureAlarm")
AlarmSeverity
The supported AlarmSeverity
levels are:
- Okay
- Warning
- Major
- Critical
- Indeterminate
The following example demonstrates the usage of the setSeverity
API. In this example, a temperature FSM is created, and based on the state of the FSM, the severity is set accordingly.
State | Temperature | Severity |
---|---|---|
OK | Temperature less than or equal to 40 | Okay |
ERROR | Temperature is greater than 40 | Major |
- Kotlin
-
/** * temp <= 40 => Severity.Okay * else => Severity.Major */ val temperatureFsm = Fsm("TEMP", OK) { state(OK) { entry { setSeverity(tromboneTemperatureAlarm, Okay) } on(temperatureVar.first() > 40) { become(ERROR) } } state(ERROR) { entry { setSeverity(tromboneTemperatureAlarm, Major) } on(temperatureVar.first() <= 40) { become(OK) } } }