Execute a script on an alarm

I would like to execute a script when an alarm goes active. The script would do an httpPost to send an email from a web camera.

Is there a way to do this?

You could do this in FactoryPMI by monitoring the alarm condition using a global Timer Script, and then sending a post using the fpmi.net.httpPost function (See the user manual)

The only odd thing here is that this logic will run on every client, or not at all if no clients are running.

It might be a better approach to run a FactorySQL group triggered on your alarm condition, and write a custom action item plugin that did a HTTP post.

If you know that a particular client should be doing the HTTP post, you can write that into the script (by IP or computer name).

Alternatively, if you can make some assumptions about the alarm condition and how your process deals with multiple alarms, you can use a DB SQLTag or the SQL Database to store a record of the HTTP post based on last alarm and date/time. You can use this to determine if a client wants to act on the alarm state change.

I agree with Carl - an FSQL action item would be the cleanest, most robust way to go. Unfortunately it requires a .NET plugin to do the HTTP post. You might hit up Colby or Travis to help you with this.