/Alarms ODB tree: Difference between revisions

From MidasWiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 7: Line 7:




== Purpose ==
= Links =
<div style="column-count:3;-moz-column-count:3;-webkit-column-count:3">
* [[Alarms Page]]
* [[Alarm System]]
* [[Mhttpd|mhttpd MIDAS web server]]
* [[odbedit]]
</div>
= Purpose =
The ODB /Alarms tree contains user and system information related to alarms (see [[Alarm System]]).
The ODB /Alarms tree contains user and system information related to alarms (see [[Alarm System]]).


== Creating the /Alarms tree ==
= Creating the /Alarms tree =
When the ODB is created, the /Alarms tree is automatically created, with  
When the ODB is created, the /Alarms tree is automatically created, with  
* two Alarms with  [[#<alarm-name> subtree|<alarm name>]] "Demo ODB" and "Demo periodic" and  
* two Alarms with  [[#<alarm-name> subtree|<alarm name>]] "Demo ODB" and "Demo periodic" and  
Line 23: Line 30:




== Examples ==
= Examples =
=== Default /Alarms tree ===
== Default /Alarms tree ==


This /Alarms tree is shown using [[odbedit]] (see also mhttpd Alarm page).
This /Alarms tree is shown using [[odbedit]] (see also mhttpd Alarm page).
Line 101: Line 108:




=== Alarm triggering Email or SMS alerts ===
== Alarm triggering Email or SMS alerts ==


It is also possible to have the MIDAS alarm system send email or SMS alerts to cell phones when alarms are triggered. This can be configured by defining an ODB alarm on a critical ODB parameter, e.g.
It is also possible to have the MIDAS alarm system send email or SMS alerts to cell phones when alarms are triggered. This can be configured by defining an ODB alarm on a critical ODB parameter, e.g.
Line 146: Line 153:


<div id="Alarm class"></div>
<div id="Alarm class"></div>
== /Alarms tree structure ==
= /Alarms tree structure =
The Alarms structure is split into 2 sections:
The Alarms structure is split into 2 sections:
*"Alarms" which define the condition to be tested. The user can create as many Alarms as desired, but each must be one of the four defined Alarm Types .
*"Alarms" which define the condition to be tested. The user can create as many Alarms as desired, but each must be one of the four defined Alarm Types .
*"Classes" which define the action to be taken when the alarm occurs. Two Classes (Alarm and Warning) are defined by default. The user can add more [[#Classes subtree|Classes]] as desired.
*"Classes" which define the action to be taken when the alarm occurs. Two Classes (Alarm and Warning) are defined by default. The user can add more [[#Classes subtree|Classes]] as desired.
<br><br>
<br><br>
In order to make the system flexible, each alarm class may perform different actions when an alarm is given. For example, it may
* write a system message (see [[#Write System Message|Write System Message]])
* write to the elog (see [[#Write Elog Message|Write Elog Message]])
* stop the run (see [[#Stop run|Stop run]])
* spawn a detached script listed in the ODB variable [[#Execute command|Execute command]]. This feature is used when an Alarm triggers Email or SMS alerts (see [[#Alarm triggering Email or SMS alerts|example]]).
<br>
'''<div id="Alarm Type"></div>'''
'''<div id="Alarm Type"></div>'''
The four available '''Alarm Types''' are shown in the following table. They are defined in midas.h.  The Alarm Type appears in the [[#Type|Type]] key.


{|  style="text-align: left; width: 50%; background-color: rgb(255, 255, 255);" border="3" cellpadding="2" cellspacing="2"
The four available Alarm Types are shown in Table 1. They are defined in [http://ladd00.triumf.ca/~daqweb/doc/midas-old/html/midas_8h.html&nbsp midas.h]. The alarm type is entered into the [[/Alarms ODB tree#Type|Type]] key.
 


{|  style="text-align: left; width: 100%; background-color: white;" border="3" cellpadding="2" cellspacing="2"
|+ Table 1 : Defined Alarm Types
|-
|-
| colspan="2" rowspan="1" style="vertical-align: top; background-color: mediumslateblue; color:white; text-align:center; font-weight: bold;" | Alarm Type
| colspan="2" rowspan="1" style="vertical-align: top; background-color: lavender; font-weight: bold;" | Alarm Type
| colspan="1" rowspan="1" style="vertical-align: top; background-color: mediumslateblue; color:white; text-align:center; font-weight: bold;" | INT value
| colspan="1" rowspan="1" style="vertical-align: top; background-color: lavender; font-weight: bold;" | INT value
| colspan="1" rowspan="1" style="vertical-align: top; background-color: mediumslateblue; color:white; text-align:center; font-weight: bold;" | Explanation
| colspan="1" rowspan="1" style="vertical-align: top; background-color: lavender; font-weight: bold;" | Explanation
 


|-   
|-   
| style=" font-weight: bold;"  |Internal
| colspan="1" rowspan="1"  style="vertical-align: top; background-color: white; font-weight: bold;"  |Internal alarms
| AT_INTERNAL
| colspan="1" rowspan="1"  style="vertical-align: top; background-color: white; font-weight: normal;" | AT_INTERNAL
| 1
|1
| Trigger on internal alarm setting through the use of the al_...() functions.
|Trigger on internal (program) alarm setting through the use of the al_...() functions.  
 


|-   
|-   
| style="font-weight: bold;"|Program
|Program alarms
| AT_PROGRAM
|AT_PROGRAM
| 2
|2
| Triggered on condition of the state of the defined task. See [[#Program Alarm|Program alarm]].
|Triggered on condition of the state of the defined task.  
 
 


|-   
|-   
|  style=" font-weight: bold;"  |Evaluated
|Evaluated alarms
| AT_EVALUATED
|AT_EVALUATED
| 3
|3
| Triggered by ODB value on given arithmetical condition. See [[#Evaluated Alarm conditions|Evaluated Alarm Conditions]].
|Triggered by ODB value on given arithmetical condition.  
 
 


|-   
|-   
| style="font-weight: bold;" |Periodic
|Periodic alarms
| AT_PERIODIC
|AT_PERIODIC
| 4
|4
| Triggered by timeout condition defined in the alarm setting. See [[#Periodic Alarm|Periodic alarm]].
|Triggered by timeout condition defined in the alarm setting.  
 


|}
|}




 
== Program Alarm ==
 
In order to make the system flexible, each alarm class may perform different actions when an alarm is given. For example, it may
* write a system message (see [[#Write System Message|Write System Message]])
* write to the elog (see [[#Write Elog Message|Write Elog Message]])
* stop the run (see [[#Stop run|Stop run]])
* spawn a detached script listed in the ODB variable [[#Execute command|Execute command]]. This feature is used when an Alarm triggers Email or SMS alerts (see [[#Alarm triggering Email or SMS alerts|example]]).
 
 
=== Program Alarm ===
The Program Alarms are enabled for individual programs by setting [[/Programs/<program>/Alarm class]]. For example,
The Program Alarms are enabled for individual programs by setting [[/Programs/<program>/Alarm class]]. For example,
the alarm Fepol  (see [[#Example of an /Alarms tree]]) was added automatically when the user filled the alarm class field in the <span style="color: purple; font-style:italic;">/Programs/fepol</span>  sub-tree.
the alarm Fepol  (see [[#Example of an /Alarms tree]]) was added automatically when the user filled the alarm class field in the <span style="color: purple; font-style:italic;">/Programs/fepol</span>  sub-tree.


=== Periodic Alarm ===
== Periodic Alarm ==
The periodic alarm is activated periodically according to the time in [[#Check interval]]. An example of a periodic alarm is "Demp Periodic" in the  [[#Default /Alarms tree|example above]].
The periodic alarm is activated periodically according to the time in [[#Check interval]]. An example of a periodic alarm is "Demp Periodic" in the  [[#Default /Alarms tree|example above]].


=== Evaluated Alarm conditions ===
== Evaluated Alarm conditions ==


The alarm condition for evaluated alarms is entered into the ODB key [[#Condition|Condition]] in the  [[#<alarm_name> subtree|<alarm_name> subtree]].
The alarm condition for evaluated alarms is entered into the ODB key [[#Condition|Condition]] in the  [[#<alarm_name> subtree|<alarm_name> subtree]].
Line 228: Line 228:
The alarm is triggered if bit #2 is set in Input[0].
The alarm is triggered if bit #2 is set in Input[0].


== Keys in the  <span  style="color: purple;">''/Alarms''</span> ODB tree  ==
= Keys in the  <span  style="color: purple;">''/Alarms''</span> ODB tree  =


===  <span  style="color: purple;">''Alarm system active''</span>  ===
==  <span  style="color: purple;">''Alarm system active''</span>  ==
<div style="column-count:3;-moz-column-count:3;-webkit-column-count:3">
<div style="column-count:3;-moz-column-count:3;-webkit-column-count:3">
* '''Type:''' BOOL
* '''Type:''' BOOL
Line 244: Line 244:
<br>
<br>


===  <span  style="color: purple;">''Alarms''</span> subtree  ===
==  <span  style="color: purple;">''Alarms''</span> subtree  ==
<div style="column-count:3;-moz-column-count:3;-webkit-column-count:3">
<div style="column-count:3;-moz-column-count:3;-webkit-column-count:3">
* '''Type:''' DIR
* '''Type:''' DIR
Line 259: Line 259:




====  <span  style="color: purple;">''<alarm-name>''</span> subtree  ====
===  <span  style="color: purple;">''<alarm-name>''</span> subtree  ===
<div style="column-count:3;-moz-column-count:3;-webkit-column-count:3">
<div style="column-count:3;-moz-column-count:3;-webkit-column-count:3">
* '''Type:''' DIR
* '''Type:''' DIR
Line 274: Line 274:




=====  <span  style="color: purple;">''Active''</span> =====
====  <span  style="color: purple;">''Active''</span> ====
<div style="column-count:3;-moz-column-count:3;-webkit-column-count:3">
<div style="column-count:3;-moz-column-count:3;-webkit-column-count:3">
* '''Type:''' BOOL
* '''Type:''' BOOL
Line 290: Line 290:




=====  <span  style="color: purple;">''Triggered''</span> =====
===  <span  style="color: purple;">''Triggered''</span> ===
<div style="column-count:3;-moz-column-count:3;-webkit-column-count:3">
<div style="column-count:3;-moz-column-count:3;-webkit-column-count:3">
* '''Type:''' INT
* '''Type:''' INT
Line 306: Line 306:




=====  <span  style="color: purple;">''Type''</span> =====
====  <span  style="color: purple;">''Type''</span> ====
<div style="column-count:3;-moz-column-count:3;-webkit-column-count:3">
<div style="column-count:3;-moz-column-count:3;-webkit-column-count:3">
* '''Type:''' INT
* '''Type:''' INT
Line 321: Line 321:




=====  <span  style="color: purple;">''Check interval''</span> =====
====  <span  style="color: purple;">''Check interval''</span> ====
<div style="column-count:3;-moz-column-count:3;-webkit-column-count:3">
<div style="column-count:3;-moz-column-count:3;-webkit-column-count:3">
* '''Type:''' INT
* '''Type:''' INT
Line 338: Line 338:




=====  <span  style="color: purple;">''Checked last''</span> =====
====  <span  style="color: purple;">''Checked last''</span> ====
<div style="column-count:3;-moz-column-count:3;-webkit-column-count:3">
<div style="column-count:3;-moz-column-count:3;-webkit-column-count:3">
* '''Type:''' DWORD
* '''Type:''' DWORD
Line 355: Line 355:




=====  <span  style="color: purple;">''Time triggered first''</span> =====
====  <span  style="color: purple;">''Time triggered first''</span> ====
<div style="column-count:3;-moz-column-count:3;-webkit-column-count:3">
<div style="column-count:3;-moz-column-count:3;-webkit-column-count:3">
* '''Type:''' STRING
* '''Type:''' STRING
Line 371: Line 371:




=====  <span  style="color: purple;">''Time triggered last''</span> =====
====  <span  style="color: purple;">''Time triggered last''</span> ====
<div style="column-count:3;-moz-column-count:3;-webkit-column-count:3">
<div style="column-count:3;-moz-column-count:3;-webkit-column-count:3">
* '''Type:''' STRING
* '''Type:''' STRING
Line 388: Line 388:




=====  <span  style="color: purple;">''Condition''</span> =====
====  <span  style="color: purple;">''Condition''</span> ====
<div style="column-count:3;-moz-column-count:3;-webkit-column-count:3">
<div style="column-count:3;-moz-column-count:3;-webkit-column-count:3">
* '''Type:''' STRING
* '''Type:''' STRING
Line 405: Line 405:




=====  <span  style="color: purple;">''Alarm class''</span> =====
====  <span  style="color: purple;">''Alarm class''</span> ====
<div style="column-count:3;-moz-column-count:3;-webkit-column-count:3">
<div style="column-count:3;-moz-column-count:3;-webkit-column-count:3">
* '''Type:''' STRING
* '''Type:''' STRING
Line 420: Line 420:




=====  <span  style="color: purple;">''Alarm message''</span> =====
====  <span  style="color: purple;">''Alarm message''</span> ====
<div style="column-count:3;-moz-column-count:3;-webkit-column-count:3">
<div style="column-count:3;-moz-column-count:3;-webkit-column-count:3">
* '''Type:''' STRING
* '''Type:''' STRING
Line 436: Line 436:




===  <span  style="color: purple;">''Classes''</span> subtree ===
==  <span  style="color: purple;">''Classes''</span> subtree ==
<div style="column-count:3;-moz-column-count:3;-webkit-column-count:3">
<div style="column-count:3;-moz-column-count:3;-webkit-column-count:3">
* '''Type:''' DIR  
* '''Type:''' DIR  
Line 450: Line 450:




====  <span  style="color: purple;">''<class-name>''</span> subtree ====
===  <span  style="color: purple;">''<class-name>''</span> subtree ===
<div style="column-count:3;-moz-column-count:3;-webkit-column-count:3">
<div style="column-count:3;-moz-column-count:3;-webkit-column-count:3">
* '''Type:''' DIR
* '''Type:''' DIR
Line 464: Line 464:




=====  <span  style="color: purple;">''Write System Message''</span> =====
====  <span  style="color: purple;">''Write System Message''</span> ====
<div style="column-count:3;-moz-column-count:3;-webkit-column-count:3">
<div style="column-count:3;-moz-column-count:3;-webkit-column-count:3">
* '''Type:''' BOOL
* '''Type:''' BOOL
Line 479: Line 479:




=====  <span  style="color: purple;">''Write Elog Message''</span> =====
====  <span  style="color: purple;">''Write Elog Message''</span> ====
<div style="column-count:3;-moz-column-count:3;-webkit-column-count:3">
<div style="column-count:3;-moz-column-count:3;-webkit-column-count:3">
* '''Type:''' BOOL
* '''Type:''' BOOL
Line 499: Line 499:




=====  <span  style="color: purple;">''System message interval''</span> =====
====  <span  style="color: purple;">''System message interval''</span> ====
<div style="column-count:3;-moz-column-count:3;-webkit-column-count:3">
<div style="column-count:3;-moz-column-count:3;-webkit-column-count:3">
* '''Type:''' INT
* '''Type:''' INT
Line 514: Line 514:
<br>
<br>


=====  <span  style="color: purple;">''System message last''</span> =====
====  <span  style="color: purple;">''System message last''</span> ====
<div style="column-count:3;-moz-column-count:3;-webkit-column-count:3">
<div style="column-count:3;-moz-column-count:3;-webkit-column-count:3">
* '''Type:''' DWORD
* '''Type:''' DWORD
Line 530: Line 530:




=====  <span  style="color: purple;">''Execute command''</span> =====
====  <span  style="color: purple;">''Execute command''</span> ====
<div style="column-count:3;-moz-column-count:3;-webkit-column-count:3">
<div style="column-count:3;-moz-column-count:3;-webkit-column-count:3">
* '''Type:''' STRING
* '''Type:''' STRING
Line 548: Line 548:




=====  <span  style="color: purple;">''Execute last''</span> =====
====  <span  style="color: purple;">''Execute last''</span> ====
<div style="column-count:3;-moz-column-count:3;-webkit-column-count:3">
<div style="column-count:3;-moz-column-count:3;-webkit-column-count:3">
* '''Type:''' DWORD
* '''Type:''' DWORD
Line 565: Line 565:




=====  <span  style="color: purple;">''Stop run''</span> =====
====  <span  style="color: purple;">''Stop run''</span> ====
<div style="column-count:3;-moz-column-count:3;-webkit-column-count:3">
<div style="column-count:3;-moz-column-count:3;-webkit-column-count:3">
* '''Type:''' BOOL
* '''Type:''' BOOL
Line 581: Line 581:




=====  <span  style="color: purple;">''Display BGColor''</span> =====
====  <span  style="color: purple;">''Display BGColor''</span> ====
<div style="column-count:3;-moz-column-count:3;-webkit-column-count:3">
<div style="column-count:3;-moz-column-count:3;-webkit-column-count:3">
* '''Type:''' STRING
* '''Type:''' STRING
Line 598: Line 598:




=====  <span  style="color: purple;">''Display FGColor''</span> =====
====  <span  style="color: purple;">''Display FGColor''</span> ====
<div style="column-count:3;-moz-column-count:3;-webkit-column-count:3">
<div style="column-count:3;-moz-column-count:3;-webkit-column-count:3">
* '''Type:''' STRING
* '''Type:''' STRING

Revision as of 17:53, 11 August 2014


Links

Purpose

The ODB /Alarms tree contains user and system information related to alarms (see Alarm System).

Creating the /Alarms tree

When the ODB is created, the /Alarms tree is automatically created, with

These are shown in the example below.

The user may create other alarms and classes by copying an existing <alarm-name> or <alarm-class> subtree and editing as required.

By default, the Alarm System is NOT active Currently, the overall alarm is checked once every minute. Once the alarm has been triggered, the message associated with the alarm can be repeated at a different rate.


Examples

Default /Alarms tree

This /Alarms tree is shown using odbedit (see also mhttpd Alarm page).

$ odbedit
[local:pol:S]/>cd /alarms
[local:pol:S]/Alarms>ls
Alarm system active             y
Alarms
Classes
[local:pol:S]/Alarms>ls -r -lt
Key name                        Type    #Val  Size  Last Opn Mode Value
---------------------------------------------------------------------------
Alarms                          DIR
   Alarm system active         BOOL    1     4     4h   0   RWD  y
   Alarms                      DIR
       Demo ODB                DIR
           Active              BOOL    1     4     >99d 0   RWD  n
           Triggered           INT     1     4     >99d 0   RWD  0
           Type                INT     1     4     >99d 0   RWD  3
           Check interval      INT     1     4     >99d 0   RWD  60
           Checked last        DWORD   1     4     >99d 0   RWD  0
           Time triggered firstSTRING  1     32    >99d 0   RWD
           Time triggered last STRING  1     32    >99d 0   RWD
           Condition           STRING  1     256   >99d 0   RWD  /Runinfo/Run number > 100
           Alarm Class         STRING  1     32    >99d 0   RWD  Alarm
           Alarm Message       STRING  1     80    >99d 0   RWD  Run number became too large
       Demo periodic           DIR
             Active              BOOL    1     4     >99d 0   RWD  n
           Triggered           INT     1     4     >99d 0   RWD  0
           Type                INT     1     4     >99d 0   RWD  4
           Check interval      INT     1     4     >99d 0   RWD  28800
           Checked last        DWORD   1     4     >99d 0   RWD  1058817867
           Time triggered firstSTRING  1     32    >99d 0   RWD
           Time triggered last STRING  1     32    >99d 0   RWD
           Condition           STRING  1     256   >99d 0   RWD
           Alarm Class         STRING  1     32    >99d 0   RWD  Warning
           Alarm Message       STRING  1     80    >99d 0   RWD  Please do your shift checks
     fePOL                   DIR
           Active              BOOL    1     4     19s  0   RWD  y
           Triggered           INT     1     4     19s  0   RWD  205
           Type                INT     1     4     3s   0   RWD  2
           Check interval      INT     1     4     19s  0   RWD  60
           Checked last        DWORD   1     4     19s  0   RWD  1259196026
           Time triggered firstSTRING  1     32    19s  0   RWD  Wed Nov 25 12:59:33 2009
           Time triggered last STRING  1     32    19s  0   RWD  Wed Nov 25 16:40:26 2009
           Condition           STRING  1     256   3s   0   RWD  Program not running
           Alarm Class         STRING  1     32    19s  0   RWD  Caution
           Alarm Message       STRING  1     80    19s  0   RWD  Program fePOL is not running
 Classes                      DIR
       Alarm                   DIR
           Write system messageBOOL    1     4     27h  0   RWD  y
           Write Elog message  BOOL    1     4     27h  0   RWD  n
           System message interINT     1     4     27h  0   RWD  60
           System message last DWORD   1     4     27h  0   RWD  0
           Execute command     STRING  1     256   27h  0   RWD
           Execute interval    INT     1     4     27h  0   RWD  0
           Execute last        DWORD   1     4     27h  0   RWD  0
           Stop run            BOOL    1     4     27h  0   RWD  n
           Display BGColor     STRING  1     32    27h  0   RWD  red
           Display FGColor     STRING  1     32    27h  0   RWD  black
       Warning                 DIR
           Write system messageBOOL    1     4     >99d 0   RWD  y
           Write Elog message  BOOL    1     4     >99d 0   RWD  n
           System message interINT     1     4     >99d 0   RWD  60
           System message last DWORD   1     4     >99d 0   RWD  0
           Execute command     STRING  1     256   >99d 0   RWD
           Execute interval    INT     1     4     >99d 0   RWD  0
           Execute last        DWORD   1     4     >99d 0   RWD  0
           Stop run            BOOL    1     4     >99d 0   RWD  n
           Display BGColor     STRING  1     32    >99d 0   RWD  red
           Display FGColor     STRING  1     32    >99d 0   RWD  black



Alarm triggering Email or SMS alerts

It is also possible to have the MIDAS alarm system send email or SMS alerts to cell phones when alarms are triggered. This can be configured by defining an ODB alarm on a critical ODB parameter, e.g.

/Alarms/Alarms/Liquid Level
Active                   y
Triggered                0 (0x0)
Type                     3 (0x3)
Check interval          60 (0x3C)
Checked last    1227690148 (0x492D10A4)
Time triggered first    (empty)
Time triggered last     (empty)
Condition               /Equipment/Environment/Variables/Input[0] < 10
Alarm Class             Level Alarm
Alarm Message           Liquid Level is only %s

In this example, the alarm triggers an alarm of class "Level Alarm". This alarm class is defined as follows:

/Alarms/Classes/Level Alarm
Write system message    y
Write Elog message      n
System message interval 600 (0x258)
System message last     0 (0x0)
Execute command         /home/midas/level_alarm '%s'
Execute interval        1800 (0x708)
Execute last            0 (0x0)
Stop run                n
Display BGColor         red
Display FGColor         black

The key here is to call a script "level_alarm", which can send emails. Use something like:

#/bin/csh
echo $1 | mail -s \"Level Alarm\" your.name@domain.edu
odbedit -c 'msg 2 level_alarm \"Alarm was sent to your.name@domain.edu\"'

The second command just generates a MIDAS system message for confirmation. Most cell phones (depends on the provider) have an email address. If you send an email there, it will be translated into a SMS message.

The script file above can of course be more complicated. A perl script could be used that parses an address list, so other interested parties can register by adding his/her email address to that list. The script may also collects some other slow control variables (like pressure, temperature) and combine them into the SMS message.

For very sensitive systems, having an alarm via SMS may not be sufficient, since the alarm system could be down (e.g. computer crash, network failure). In this case 'negative alarms' can be used. For example, every 30 minutes the system may send an SMS with the current parameter values. If the expected message is not received, it may indicate that something in the MIDAS system is wrong.


/Alarms tree structure

The Alarms structure is split into 2 sections:

  • "Alarms" which define the condition to be tested. The user can create as many Alarms as desired, but each must be one of the four defined Alarm Types .
  • "Classes" which define the action to be taken when the alarm occurs. Two Classes (Alarm and Warning) are defined by default. The user can add more Classes as desired.



In order to make the system flexible, each alarm class may perform different actions when an alarm is given. For example, it may


The four available Alarm Types are shown in Table 1. They are defined in midas.h. The alarm type is entered into the Type key.


Table 1 : Defined Alarm Types
Alarm Type INT value Explanation
Internal alarms AT_INTERNAL 1 Trigger on internal (program) alarm setting through the use of the al_...() functions.
Program alarms AT_PROGRAM 2 Triggered on condition of the state of the defined task.
Evaluated alarms AT_EVALUATED 3 Triggered by ODB value on given arithmetical condition.
Periodic alarms AT_PERIODIC 4 Triggered by timeout condition defined in the alarm setting.


Program Alarm

The Program Alarms are enabled for individual programs by setting [[/Programs/<program>/Alarm class]]. For example, the alarm Fepol (see #Example of an /Alarms tree) was added automatically when the user filled the alarm class field in the /Programs/fepol sub-tree.

Periodic Alarm

The periodic alarm is activated periodically according to the time in #Check interval. An example of a periodic alarm is "Demp Periodic" in the example above.

Evaluated Alarm conditions

The alarm condition for evaluated alarms is entered into the ODB key Condition in the <alarm_name> subtree. The condition may be simply a comparison between any ODB variable and a threshold parameter, e.g.

/Runinfo/Run number > 100

or it may be an evaluated condition. One can write conditions like

 /Equipment/HV/Variables/Input[*] < 100

or

 /Equipment/HV/Variables/Input[2-3] < 100

to check all values from an array or a certain range. If one array element fulfills the alarm condition, the alarm is triggerrd. In addition, bit-wise alarm conditions are possible, e.g.

 /Equipment/Environment/Variables/Input[0] & 8

The alarm is triggered if bit #2 is set in Input[0].

Keys in the /Alarms ODB tree

Alarm system active

  • Type: BOOL
  • Default: "n"

If this key in the /Alarms ODB tree is set to "y", the alarm system is active. Set to "n" to deactivate.





Alarms subtree

  • Type: DIR


Sub-tree in the /Alarms ODB tree defining each individual alarm condition.






<alarm-name> subtree

  • Type: DIR


This subtree in the /Alarms/alarms subtree specifies the name of one of the defined alarms, where name is substituted for <alarm-name>. This subtree will be repeated with a different name for each defined alarm. In the example two <alarm-name> subtrees are shown, called "demo odb" and "demo periodic"






Active

  • Type: BOOL
  • Default: "n"

If this key in the <alarm-name> subtree is set to "y" , this particular alarm is active.







Triggered

  • Type: INT
  • Default: 0

If this key in the <alarm-name> subtree is non-zero, this alarm has been triggered. Filled by System.







Type

  • Type: INT
  • Default:

This key in the <alarm-name> subtree must be one of the listed Alarm Types.






Check interval

  • Type: INT
  • Default: 60


This key in the <alarm-name> subtree contains the frequency in seconds at which this alarm condition is to be checked by the alarm system.






Checked last

  • Type: DWORD
  • Default:


This key in the <alarm-name> subtree is written by the Alarm System.







Time triggered first

  • Type: STRING
  • Default:


This key in the <alarm-name> subtree is written by the Alarm System.






Time triggered last

  • Type: STRING
  • Default:


This key in the <alarm-name> subtree is written by the Alarm System.







Condition

  • Type: STRING
  • Default:


This key in the <alarm-name> subtree contains the condition on which alarm should trigger for evaluated alarms. See #Evaluated Alarm conditions.






Alarm class

  • Type: STRING
  • Default:


This key in the <alarm-name> subtree is set to one of the existing Alarm classes, e.g. "Alarm","Warning". The Alarm class must be defined in the Classes subtree.





Alarm message

  • Type: STRING
  • Default:

This key in the <alarm-name> subtree constains the message to be written when alarm triggers.






Classes subtree

  • Type: DIR

Sub-tree in the /Alarms ODB tree defining each individual alarm class. Each class defines the individual action to be performed by a predefined and requested alarm.





<class-name> subtree

  • Type: DIR

This subtree in the #Classes subtree defines one of the alarm classes of name name, where name is substituted for <class-name>. This subtree will be repeated with a different name for each defined class. In the example above, two <class-name> subtrees are shown, named "Alarm" and "Warning".






Write System Message

  • Type: BOOL
  • Default: "y"


If this key in the <class-name> subtree is set to "y", a message will be sent to the System log when an alarm with this alarm class is triggered.





Write Elog Message

  • Type: BOOL
  • Default: "n"


If this key in the <class-name> subtree is set to "y", a message will be written to the Elog when an alarm with this alarm class is triggered.







System message interval

  • Type: INT
  • Default: 60

This key in the <class-name> subtree contains the interval in seconds between successive system messages when an alarm with this alarm class is triggered

See also Alarm System#Implementation of the MIDAS Alarm System for note on the implementation of this key by the alarm system.




System message last

  • Type: DWORD
  • Default: 0

This key in the <class-name> subtree contains the time when the last alarm system message was written. It is filled by the alarm system.






Execute command

  • Type: STRING
  • Default: ""

This key in the <class-name> subtree may contain a command to be executed when an alarm with this alarm class is triggered. This parameter can be used to trigger Email or SMS alerts.






Execute last

  • Type: DWORD
  • Default: 0

This key in the <class-name> subtree contains the time when the alarm system last executed the command in the key Execute command. It is filled by the alarm system.






Stop run

  • Type: BOOL
  • Default: "n"

This key in the <class-name> subtree if set to "y" will cause the run to stop when an alarm with this alarm class is triggered.






Display BGColor

  • Type: STRING
  • Default: "red"

This key in the <class-name> subtree contains the background colour of alarm banner (mhttpd only).






Display FGColor

  • Type: STRING
  • Default: "black"

This key in the <class-name> subtree contains the foreground colour of alarm banner (mhttpd only).