TANGO

Device Servers




TANGO Device Server
Device Description

PyAlarm Class

Revision: - Author: srubio@cells.es

PyAlarm Device Server User Guide

  1. Description
  2. Global Properties
    1. AlarmList:
    2. AlarmDescription
    3. AlarmReceivers:
    4. PhoneBook (pending)
  3. Usage Examples
    1. Sending a Test Message at Startup
    2. Testing a device availability
    3. Creating a periodic self-reset alarm
  4. More Specific Properties
    1. LogFile
    2. FlagFile
    3. PollingPeriod
    4. MaxAlarmsPerDay
    5. AlarmThreshold
    6. FromAddress
    7. SMSConfig
    8. AlertOnRecovery
    9. MaxMessagesPerAlarm
  5. Device Server Example
  6. Mail Messages
    1. Format of Alarm message
    2. Format of Recovered message
  7. Features to be implemented in next releases

Description

This device server is used as a alarm logger, it connects to the list of attributes provided and verifies its values.
Its focused on notifying Alarms by log files, Mail, SMS and (some day in the future) electronic logbook.
You can acknowledge these alarms by a proper command.


Global Properties

AlarmList:

Format of alarms will be:

  TAG1:LT/VC/Dev1
  TAG2:LT/VC/Dev1/State
  TAG3:LT/VC/Dev1/Pressure > 1e-4

NOTE: This property was previously called AlarmsList?; it is still loaded if AlarmList? is empty for backward compatibility

AlarmDescription

Description to be included in emails for each alarm. The format is:

  TAG:AlarmDescription...

NOTE: Special Tags like $NAME (for name of PyAlarm device) or $TAG (for name of the Alarm) will be automatically replaced in description.

AlarmReceivers:

  TAG1:vacuum@accelerator.es,SMS:+34935924381,file:/tmp/err.log
  vacuum@accelerator.es:TAG1,TAG2,TAG3

PhoneBook (pending)

File where alarm receivers aliases are declared; e.g. User:user@accelerator.es;SMS:+34666555666 Default: $HOME/var/alarm_phone_book.log If User and Operator are defined in phonebook AlarmsList can be:

  TAG2:User,Operator

Usage Examples

Sending a Test Message at Startup

AlarmList -> DEBUG:True
AlarmDescriptions -> DEBUG:The PyAlarm Device $NAME has been restarted


Testing a device availability

It is done if you put directly the name of the device or its State as a condition by itself:

PRESSURE:SR/VC/VGCT/Pressure > 1e-4
STATE_AND_PRESSURE:SR/VC/VGCT and SR/VC/VGCT/Pressure > 1e-4

In the second case and alarm will be triggered either if the Pressure is above threshold or the device is not reachable.

Creating a periodic self-reset alarm

It's a bit hackish

PERIODIC:(FrontEnds/VC/Elotech-01/Temperature and FrontEnds/VC/VGCT-01/P1 and (1920<(now%3600)<3200)) or (ResetAlarm('PERIODIC') and False)

More Specific Properties

(In future releases these properties could be individually configurable for each alarm)

LogFile

File where alarms are logged Default: "/tmp/alarm_$NAME.log"

FlagFile

File where a 1 or 0 value will be written depending if theres active alarms or not.\n<br>This file can be used by other notification systems. Default: "/tmp/alarm_ds.nagios"

PollingPeriod

Periode in ms. in which all attributes not event-driven will be polled. Default: 60000

MaxAlarmsPerDay

Max Number of Alarms to be sent each day to the same receiver. Default: 3

AlarmThreshold

Min number of consecutive Events/Pollings that must trigger an Alarm. Default: 3

FromAddress

Address that will appear as Sender in mail and SMS Default: "controls"

SMSConfig

Arguments for sendSMS command Default: ":"

AlertOnRecovery

A message is sent if an alarm is active but the conditions of the attributes return to a safe value. To enable the message the content of this property must contain 'email', 'sms' or both.

MaxMessagesPerAlarm

To avoid the previous property to send a lot of messages continuously this property has been added to limit the maximum number of messages to be sent each time that an alarm is enabled/recovered/reset.


Device Server Example

 
#---------------------------------------------------------
# SERVER PyAlarm/AssemblyArea, PyAlarm device declaration
#---------------------------------------------------------
PyAlarm/AssemblyArea/DEVICE/PyAlarm: "LAB/VC/Alarms"
# --- LAB/VC/Alarms properties
LAB/VC/Alarms->AlarmDescriptions: "OVENPRESSURE:The pressure in the Oven exceeds Range",\
                                  "ADIXENPRESSURE:The pressure in the Roughing Station exceeds Range",\
                                  "OVENTEMPERATURE:The Temperature of the Oven exceeds Range",\
                                  "DEBUG:Just for debugging purposes"
LAB/VC/Alarms->AlarmReceivers: OVENPRESSURE:somebody@cells.es,someone_else@cells.es,SMS:+34999666333,\
                               ADIXENPRESSURE:somebody@cells.es,someone_else@cells.es,SMS:+34999666333,\
                               OVENTEMPERATURE:somebody@cells.es,someone_else@cells.es,SMS:+34999666333,\
                               DEBUG:somebody@cells.es
LAB/VC/Alarms->AlarmsList: "OVENPRESSURE:LAB/VC/BestecOven-1/Pressure_mbar > 5e-4",\
                           "OVENRUNNING:LAB/VC/BestecOven-1/MaxValue > 70",\
                           "ADIXENPRESSURE:LAB/VC/Adixen-01/P1 > 1e-4 and OVENRUNNING",\
                           "OVENTEMPERATURE:LAB/VC/BestecOven-1/MaxValue > 220",\
                           "DEBUG:OVENRUNNING and not PCISDOWN"
LAB/VC/Alarms->PollingPeriod: 30
LAB/VC/Alarms->SMSConfig: ...


Mail Messages

Format of Alarm message

Subject:     LAB/VC/Alarms: Alarm RECOVERED (OVENTEMPERATURE)
Date:     Wed, 12 Nov 2008 11:52:39 +0100

TAG: OVENTEMPERATURE
             LAB/VC/BestecOven-1/MaxValue > 220 was RECOVERED at Wed Nov 12 11:52:39 2008

Alarm receivers are:
             somebody@cells.es
             someone_else@cells.es
Other Active Alarms are:
             DEBUG:Fri Nov  7 18:37:35 2008:OVENRUNNING and not PCISDOWN
             OVENRUNNING:Fri Nov  7 18:37:17 2008:LAB/VC/BestecOven-1/MaxValue > 70
Past Alarms were:
             OVENTEMPERATURE:Fri Nov  7 20:49:46 2008

Format of Recovered message

Subject:     LAB/VC/Alarms: Alarm RECOVERED (OVENTEMPERATURE)
Date:     Wed, 12 Nov 2008 11:52:39 +0100

TAG: OVENTEMPERATURE
             LAB/VC/BestecOven-1/MaxValue > 220 was RECOVERED at Wed Nov 12 11:52:39 2008

Alarm receivers are:
             somebody@cells.es
             someone_else@cells.es
Other Active Alarms are:
             DEBUG:Fri Nov  7 18:37:35 2008:OVENRUNNING and not PCISDOWN
             OVENRUNNING:Fri Nov  7 18:37:17 2008:LAB/VC/BestecOven-1/MaxValue > 70
Past Alarms were:
             OVENTEMPERATURE:Fri Nov  7 20:49:46 2008


Features to be implemented in next releases

Ticket Summary Milestone
#6 Snapshots triggered by Alarms PyAlarm 2.2 - Alarms on quality and timestamps
#16 Alarms for DB Backup fail PyAlarm 2.2 - Alarms on quality and timestamps
#27 Log file should keep register of all sent alarms PyAlarm 2.2 - Alarms on quality and timestamps
#18 Configuration for each Alarm PyAlarm 2.2 - Alarms on quality and timestamps
#24 Alarms appliable to groups of attributes PyAlarm 2.2 - Alarms on quality and timestamps
#5 Alarms triggered by Quality PyAlarm 2.2 - Alarms on quality and timestamps
#8 Prepare Nagios Alarms Bliss package Booster CS
#9 AlarmGUI Booster CS
#10 CREATE CHEKC_ARCHIVING , CHECK_LINAC ALARMS IN YOUR CRONTAB! Booster CS
#14 Add Wildcards to alarms declaration PyAlarm 2.2 - Alarms on quality and timestamps
#21 Check new Elettra Alarm server features
#22 PyAlarm using events (with Tau) PyAlarm 2.2 - Alarms on quality and timestamps
#13 ALARMS and ThreadDict: CRON for Device Servers StorageRing CS




TANGO is an open source project hosted by :
Sourceforge logo small
Core and Tools : CVS repository on tango-cs project
Device Servers : CVS repository on tango-ds project