# Intercepting Alarm Events and overriding the alarm function

**URL:** <https://forum.inductiveautomation.com/t/intercepting-alarm-events-and-overriding-the-alarm-function/4031>\
**Category:** General Discussion\
**Created:** [February 21, 2012, 6:18am UTC](https://forum.inductiveautomation.com/t/intercepting-alarm-events-and-overriding-the-alarm-function/4031 "2012-02-21T06:18:32Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Egen-Prasad](https://avatars.discourse-cdn.com/v4/letter/e/ecd19e/32.png) [@Egen-Prasad](https://forum.inductiveautomation.com/u/Egen-Prasad)\
**Post date:** [February 21, 2012, 6:18am UTC](https://forum.inductiveautomation.com/t/intercepting-alarm-events-and-overriding-the-alarm-function/4031/1 "2012-02-21T06:18:32Z")

</div>

We want to intercept the Alarm Events and write the Alarm information ( date time, text etc.) as it appears in the database to a text file.  
For eg. If I configure a Alarm like Valve 1 is On and link it to a Tag-Valve1Tag then when Valve1Tag changes I get the information in the database - Time, Valve1 is On… .

We want to write this same information into a text file.

Whats the best way to do it? Which is the place to intercept the stanard Alarm function of Ignition and override it.

Best Regards  
-Prasad

---

<div class="post-metadata">

**Author:** ![Travis.Cox](https://avatars.discourse-cdn.com/v4/letter/t/b9bd4f/32.png) [@Travis.Cox](https://forum.inductiveautomation.com/u/Travis.Cox)\
**Post date:** [February 22, 2012, 4:23pm UTC](https://forum.inductiveautomation.com/t/intercepting-alarm-events-and-overriding-the-alarm-function/4031/2 "2012-02-22T16:23:45Z")

</div>

Well, there is no way to intercept the standard alarm function and override it. However, you can add tag change scripts (on the gateway side so it is one place) that listens for when the tag’s alert active meta property goes to 1. You can use all of the meta properties to log that to a text file using the system.file.writeFile function. That function can append to a file.

---

<div class="post-metadata">

**Author:** ![Colby.Clegg](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/colby.clegg/32/3282_2.png) [@Colby.Clegg](https://forum.inductiveautomation.com/u/Colby.Clegg)\
**Post date:** [February 22, 2012, 4:50pm UTC](https://forum.inductiveautomation.com/t/intercepting-alarm-events-and-overriding-the-alarm-function/4031/3 "2012-02-22T16:50:20Z")

</div>

Just wanted to mention that if you are up to writing a module in the sdk, you probably could do this. You could create a listener that would get installed on the “Alert Bus” and would receive all alert info, which you could do what you wanted with.

Regards,

---

<div class="post-metadata">

**Author:** ![Robert](https://avatars.discourse-cdn.com/v4/letter/r/e95f7d/32.png) [@Robert](https://forum.inductiveautomation.com/u/Robert)\
**Post date:** [February 22, 2012, 8:28pm UTC](https://forum.inductiveautomation.com/t/intercepting-alarm-events-and-overriding-the-alarm-function/4031/4 "2012-02-22T20:28:55Z")

</div>

Another option could be a trigger in the database that fires on a write. Then you can catch other\* things that write to the alert table.

\*other things could be non-ignition applications eg: voice alarm systems

---

<div class="post-metadata">

**Author:** ![Kyle\_Chase](https://avatars.discourse-cdn.com/v4/letter/k/9de0a6/32.png) [@Kyle\_Chase](https://forum.inductiveautomation.com/u/Kyle_Chase)\
**Post date:** [February 22, 2012, 11:03pm UTC](https://forum.inductiveautomation.com/t/intercepting-alarm-events-and-overriding-the-alarm-function/4031/5 "2012-02-22T23:03:09Z")

</div>

We currently do this in one of our internal modules, responding to alerts on the bus.

---

<div class="post-metadata">

**Author:** ![WKetcham](https://avatars.discourse-cdn.com/v4/letter/w/c57346/32.png) [@WKetcham](https://forum.inductiveautomation.com/u/WKetcham)\
**Post date:** [February 23, 2012, 4:23am UTC](https://forum.inductiveautomation.com/t/intercepting-alarm-events-and-overriding-the-alarm-function/4031/6 "2012-02-23T04:23:39Z")

</div>

Prasad,

Just to clarify, do you actually want to override the Alarm Function or do you just want to write the timestamp and some tag meta data to a text file when the tag goes into alarm?

---

<div class="post-metadata">

**Author:** ![Egen-Prasad](https://avatars.discourse-cdn.com/v4/letter/e/ecd19e/32.png) [@Egen-Prasad](https://forum.inductiveautomation.com/u/Egen-Prasad)\
**Post date:** [February 25, 2012, 1:00pm UTC](https://forum.inductiveautomation.com/t/intercepting-alarm-events-and-overriding-the-alarm-function/4031/7 "2012-02-25T13:00:57Z")

</div>

Sorry for the confusion caused by the Override word. We would like to write the alert info to additional destination.

Best Regards
