/Alarms ODB tree: Difference between revisions

From MidasWiki
Jump to navigation Jump to search
(Alarm sound and trigger count)
(The midas documentation has moved to https://midas.triumf.ca/docs/)
Tag: Replaced
 
Line 1: Line 1:
{{Pagelinks}}
The midas documentation has moved. See [https://midas.triumf.ca/docs/develop/reference/reference/odb_keys/#alarms /Alarms] on the ODB keys page and [https://midas.triumf.ca/docs/develop/features/monitoring_and_control/alarms/configuring/ Alarms: configuring] for the new documentation about the /Alarms ODB keys.
 
= 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 information from this tree is displayed in the [[Alarms Page]].
 
= Creating the /Alarms tree =
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 Classes with [[#<class-name> subtree|<class name>]] "Alarm" and "Warning".
 
These are shown in the [[#Example of an /Alarms tree|example below]].
 
The user may create other alarms and classes by copying an existing <alarm-name> or <alarm-class> subtree and editing (via [[Alarms Page]] or [[odbedit]]) as required.
 
By default, the [[Alarm System]] is NOT active. When it is active,
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.  
 
 
= Example =
This example (using [[odbedit]]) shows the  default <span style="color: purple; font-style:italic;">/Alarms</span> tree. See also [[Alarms 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
            Trigger count      DWORD  1    4    >99d 0  RWD  0
            Trigger count requirDWORD  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
            Trigger count      DWORD  1    4    >99d 0  RWD  0
            Trigger count requirDWORD  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
            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
            Trigger count      DWORD  1    4    >99d 0  RWD  0
            Trigger count requirDWORD  1    4    >99d 0  RWD  0
            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
            Alarm sound        BOOL    1    4    27h  0  RWD  y
        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 sound        BOOL    1    4    27h  0  RWD  y
 
= /Alarms tree structure =
The <span  style="color: purple;">/Alarms</span> ODB tree is split into 2 subtrees:
* [[#Alarms subtree|Alarms subtree]] containing as many alarms (i.e. <span  style="color: purple;"><alarm-name></span> subtrees) as the user desires. Each alarm must be one of the four defined [[Alarm System#Alarm Types|Alarm Types]]. These also define the conditions that trigger the alarm.
* [[#Classes subtree|Classes subtree]] containing as many classes (i.e. <span  style="color: purple;"><class-name></span> subtrees)  as the user desires. Each class defines the action to be taken when the alarm occurs. Two Classes (Alarm and Warning) are defined by default (see [[#Example|Example]]).
 
See also [[Alarm System]].
 
<br><br>
 
= Keys in the  <span  style="color: purple;">''/Alarms''</span> ODB tree  =
 
==  <span  style="color: purple;">''Alarm system active''</span>  ==
<div style="column-count:3;-moz-column-count:3;-webkit-column-count:3">
* '''Type:''' BOOL
* '''Default:'''  "n"
</div>
 
If this key in the [[#top|/Alarms ODB tree]]
is set to "y", the alarm system is active. Set to "n" to deactivate.
 
 
<br>
---------
<br>
 
==  <span  style="color: purple;">''Alarms''</span> subtree  ==
<div style="column-count:3;-moz-column-count:3;-webkit-column-count:3">
* '''Type:''' DIR
</div>
 
 
 
Sub-tree in the [[#top|/Alarms ODB tree]] defining each individual alarm condition.
 
 
<br>
---------
<br>
 
 
===  <span  style="color: purple;">''<alarm-name>''</span> subtree  ===
<div style="column-count:3;-moz-column-count:3;-webkit-column-count:3">
* '''Type:''' DIR
</div>
 
 
This subtree in the [[#Alarms subtree|/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|example]] two ''<alarm-name>'' subtrees are shown, called "''demo odb''" and "''demo periodic''"
 
 
<br>
---------
<br>
 
 
====  <span  style="color: purple;">''Active''</span> ====
<div style="column-count:3;-moz-column-count:3;-webkit-column-count:3">
* '''Type:''' BOOL
* '''Default:'''  "n"
</div>
 
If this key in the [[#<alarm-name> subtree|<alarm-name> subtree]] is set to "y" , this particular alarm is active.
 
 
 
 
<br>
---------
<br>
 
 
====  <span  style="color: purple;">''Triggered''</span> ====
<div style="column-count:3;-moz-column-count:3;-webkit-column-count:3">
* '''Type:''' INT
* '''Default:'''  0
</div>
 
If this key in the [[#<alarm-name> subtree|<alarm-name> subtree]] is non-zero, this alarm has been triggered. Filled by System.
 
 
 
 
<br>
---------
<br>
 
 
====  <span  style="color: purple;">''Type''</span> ====
<div style="column-count:3;-moz-column-count:3;-webkit-column-count:3">
* '''Type:''' INT
* '''Default:''' 
</div>
 
This key in the [[#<alarm-name> subtree|<alarm-name> subtree]] must be one of the listed [[#Alarm Type|Alarm Types]].
 
 
 
<br>
---------
<br>
 
 
====  <span  style="color: purple;">''Check interval''</span> ====
<div style="column-count:3;-moz-column-count:3;-webkit-column-count:3">
* '''Type:''' INT
* '''Default:'''  60
</div>
 
 
This key in the [[#<alarm-name> subtree|<alarm-name> subtree]] contains the
frequency in seconds at which this alarm condition is to be checked by the alarm system.
 
 
 
<br>
---------
<br>
 
 
====  <span  style="color: purple;">''Checked last''</span> ====
<div style="column-count:3;-moz-column-count:3;-webkit-column-count:3">
* '''Type:''' DWORD
* '''Default:'''  0
</div>
 
 
This key in the [[#<alarm-name> subtree|<alarm-name> subtree]]  is written by the Alarm System. It notes the UNIX timestamp when the alarm condition was last checked.
 
 
 
 
<br>
---------
<br>
 
 
====  <span  style="color: purple;">''Trigger count''</span> ====
<div style="column-count:3;-moz-column-count:3;-webkit-column-count:3">
* '''Type:''' DWORD
* '''Default:'''  0
</div>
 
 
This key in the [[#<alarm-name> subtree|<alarm-name> subtree]]  is written by the Alarm System. It notes how many consecutive checks of the alarm condition have failed.
 
 
 
<br>
---------
<br>
 
 
====  <span  style="color: purple;">''Trigger count required''</span> ====
<div style="column-count:3;-moz-column-count:3;-webkit-column-count:3">
* '''Type:''' DWORD
* '''Default:'''  0
</div>
 
 
This key in the [[#<alarm-name> subtree|<alarm-name> subtree]]  can be set by the user.  
 
If it is set to 0 or 1 then the alarm will be triggered as soon as the failure condition is met.
 
If it is set to a number greater than 1 (N), then the alarm will only be triggered if the failure condition is met for N consecutive periods. The period is defined by the [[#Check interval|Check interval]] parameter for this alarm. This feature may be useful if transient failures are to be tolerated, but persistent failures indicate a real problem (e.g. if a brief excess voltage is okay when a device is ramping up, but a consistent excess voltage indicates a hardware problem).
 
If 'Check interval' is 10 and 'Trigger count required' is 3, then the alarm will only be triggered if the failure condition is met for 30s in total.
 
 
 
 
<br>
---------
<br>
 
 
====  <span  style="color: purple;">''Time triggered first''</span> ====
<div style="column-count:3;-moz-column-count:3;-webkit-column-count:3">
* '''Type:''' STRING
* '''Default:''' 
</div>
 
 
This key in the [[#<alarm-name> subtree|<alarm-name> subtree]]  is written by the Alarm System.
 
 
 
<br>
---------
<br>
 
 
====  <span  style="color: purple;">''Time triggered last''</span> ====
<div style="column-count:3;-moz-column-count:3;-webkit-column-count:3">
* '''Type:''' STRING
* '''Default:''' 
</div>
 
 
This key in the [[#<alarm-name> subtree|<alarm-name> subtree]]  is written by the Alarm System.
 
 
 
 
<br>
---------
<br>
 
 
====  <span  style="color: purple;">''Condition''</span> ====
<div style="column-count:3;-moz-column-count:3;-webkit-column-count:3">
* '''Type:''' STRING
* '''Default:''' 
</div>
 
 
This key in the [[#<alarm-name> subtree|<alarm-name> subtree]]  contains
the condition on which alarm should trigger for [[#/Alarms tree structure|evaluated alarms]]. See [[#Evaluated Alarm conditions]].
 
 
 
<br>
---------
<br>
 
 
====  <span  style="color: purple;">''Alarm class''</span> ====
<div style="column-count:3;-moz-column-count:3;-webkit-column-count:3">
* '''Type:''' STRING
* '''Default:''' 
</div>
 
 
This key in the [[#<alarm-name> subtree|<alarm-name> subtree]] is set to one of the existing Alarm classes, e.g. the defaults "Alarm","Warning" or a user-defined class, e.g. "Caution".
The Alarm class must be defined in the [[#<class-name> subtree|Classes subtree]].
 
<br>
---------
<br>
 
 
====  <span  style="color: purple;">''Alarm message''</span> ====
<div style="column-count:3;-moz-column-count:3;-webkit-column-count:3">
* '''Type:''' STRING
* '''Default:''' 
</div>
 
This key in the [[#<alarm-name> subtree|<alarm-name> subtree]] constains
the message to be written when alarm triggers.
 
 
 
<br>
---------
<br>
 
 
==  <span  style="color: purple;">''Classes''</span> subtree ==
<div style="column-count:3;-moz-column-count:3;-webkit-column-count:3">
* '''Type:''' DIR
</div>
 
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.
 
<br>
---------
<br>
 
 
 
===  <span  style="color: purple;">''<class-name>''</span> subtree ===
<div style="column-count:3;-moz-column-count:3;-webkit-column-count:3">
* '''Type:''' DIR
</div>
 
This subtree in the [[#Classes subtree|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 of an /Alarms tree|example above]], two <class-name> subtrees are shown, named "Alarm" and "Warning". 
 
 
<br>
---------
<br>
 
 
 
====  <span  style="color: purple;">''Write System Message''</span> ====
<div style="column-count:3;-moz-column-count:3;-webkit-column-count:3">
* '''Type:''' BOOL
* '''Default:'''  "y"
</div>
 
 
If this key in the [[#<class-name> subtree|<class-name> subtree]] is set to "y", a message will be sent to the [[System log]] when an alarm with this [[#Alarm class|alarm class]] is triggered.
 
<br>
---------
<br>
 
 
 
====  <span  style="color: purple;">''Write Elog Message''</span> ====
<div style="column-count:3;-moz-column-count:3;-webkit-column-count:3">
* '''Type:''' BOOL
* '''Default:'''  "n"
</div>
 
 
 
If this key in the [[#<class-name> subtree|<class-name> subtree]] is
set to "y", a message will be written to the Elog when an alarm with this  [[#Alarm class|alarm class]] is triggered.
 
 
 
 
<br>
---------
<br>
 
 
 
====  <span  style="color: purple;">''System message interval''</span> ====
<div style="column-count:3;-moz-column-count:3;-webkit-column-count:3">
* '''Type:''' INT
* '''Default:'''  60
</div>
This key in the [[#<class-name> subtree|<class-name> subtree]] contains the
interval in seconds between successive system messages when an alarm with this  [[#Alarm class|alarm class]] is triggered.
 
Set this key to 0 to ensure that every alarm is recorded into the [[Message System#MIDAS Log file|MIDAS log file]].
 
'''See important note ''' on the [[Alarm System#Implementation of the MIDAS Alarm System|implementation of this key]] by the alarm system.
 
<br>
---------
<br>
 
====  <span  style="color: purple;">''System message last''</span> ====
<div style="column-count:3;-moz-column-count:3;-webkit-column-count:3">
* '''Type:''' DWORD
* '''Default:'''  0
</div>
 
This key in the [[#<class-name> subtree|<class-name> subtree]] contains the time when the last alarm system
message was written. It is filled by the alarm system.
 
 
<br>
---------
<br>
 
 
 
====  <span  style="color: purple;">''Execute command''</span> ====
<div style="column-count:3;-moz-column-count:3;-webkit-column-count:3">
* '''Type:''' STRING
* '''Default:'''  ""
</div>
 
This key in the [[#<class-name> subtree|<class-name> subtree]] may contain a
command to be executed when an alarm with this  [[#Alarm class|alarm class]] is triggered.
This parameter can be used to trigger [[#Alarm triggers Email or SMS|Email or SMS]] alerts.
 
 
 
<br>
---------
<br>
 
 
====  <span  style="color: purple;">''Execute interval''</span> ====
<div style="column-count:3;-moz-column-count:3;-webkit-column-count:3">
* '''Type:''' INT
* '''Default:'''  0
</div>
 
When an alarm with this  [[#Alarm class|alarm class]] is triggered, if a valid
[[#Execute command|Execute command]] is supplied, the command will be repeated at an interval in seconds designated by this key in the [[#<class-name> subtree|<class-name> subtree]], providing the interval set is greater than 0.
 
 
 
 
<br>
---------
<br>
 
====  <span  style="color: purple;">''Execute last''</span> ====
<div style="column-count:3;-moz-column-count:3;-webkit-column-count:3">
* '''Type:''' DWORD
* '''Default:'''  0
</div>
 
This key in the [[#<class-name> subtree|<class-name> subtree]]
contains the time when the alarm system last executed the command in the key [[#Execute command|Execute command]].
It is filled by the alarm system.
 
 
<br>
---------
<br>
 
 
 
====  <span  style="color: purple;">''Stop run''</span> ====
<div style="column-count:3;-moz-column-count:3;-webkit-column-count:3">
* '''Type:''' BOOL
* '''Default:'''  "n"
</div>
 
This key in the [[#<class-name> subtree|<class-name> subtree]]  if set to "y"
will cause the run to stop when an alarm with this [[#Alarm class|alarm class]] is triggered.
 
 
<br>
---------
<br>
 
 
 
====  <span  style="color: purple;">''Display BGColor''</span> ====
<div style="column-count:3;-moz-column-count:3;-webkit-column-count:3">
* '''Type:''' STRING
* '''Default:'''  "red"
</div>
 
This key in the [[#<class-name> subtree|<class-name> subtree]] contains the
background colour of the alarm banner on the [[mhttpd]]  [[Status Page]]. The alarm banner
appears if the alarm is triggered.
 
 
 
<br>
---------
<br>
 
 
 
====  <span  style="color: purple;">''Display FGColor''</span> ====
<div style="column-count:3;-moz-column-count:3;-webkit-column-count:3">
* '''Type:''' STRING
* '''Default:'''  "black"
</div>
 
This key in the [[#<class-name> subtree|<class-name> subtree]] contains the
foreground colour of the alarm banner on the [[mhttpd]] [[Status Page]].  The alarm banner
appears if the alarm is triggered.
 
 
<br>
---------
<br>
 
 
 
====  <span  style="color: purple;">''Alarm sound''</span> ====
<div style="column-count:3;-moz-column-count:3;-webkit-column-count:3">
* '''Type:''' BOOL
* '''Default:'''  y
</div>
 
This key in the [[#<class-name> subtree|<class-name> subtree]] states whether this alarm
should produce a sound in a user's web browser or not. (Historically all alarms produced a
sound, but some experiments want to distinguish between "really bad" and "not so bad" alarms).
 
Note that all the following conditions must be met for the alarm sound to be heard:
* This key is set to 'y' for the alarm that gets triggered.
* The ODB key [[#Alarm_system_active|/Alarms/Alarm system active]] is 'y'.
* On the [[Config_Page|Config]] webpage, the 'Enable alarm sound' checkbox is ticked and the 'Alarm volume' is > 0 (this is a per-user setting).
* The user hasn't muted their speakers.
 
[[Category:ODB Tree]]
[[Category:Alarms]]

Latest revision as of 22:00, 30 October 2026

The midas documentation has moved. See /Alarms on the ODB keys page and Alarms: configuring for the new documentation about the /Alarms ODB keys.