Subscribe to Historian Alerts and Messages

You can obtain a complete picture of the Historian Server's status by monitoring the server's Alerts and Messages. Additionally, if you are using iFIX with Historian, you can capture these subscriptions and forward them to iFIX alarm queues to ensure operator notification.

You can also use scripting in iFIX to subscribe to the Historian message queues using VBA. If you write a script as part of an iFIX picture, you will need to either keep the picture with the scripts running at all times or run the scripts in the FIXBackground Server application.

Creating Subscriptions in iFIX

To subscribe to messages or alerts in Historian, you must reference the SDK from within the VBA project. To access the References window, shown in the following figure, use the Tools menu in the iFIX VBA Editor.

Once you reference a VBA project to the Historian SDK, you must define two module level objects: a Server Object and a Messages Object. Declare these Objects to remain in scope for the duration that the subscription is active.
Note: You must declare the Messages Object using the WithEvents keyword. This keyword is only valid at the module or class level.
Typically, the Server and Messages Object are declared as private module level objects. Subscriptions are made during the module initialization or upon loading the method. You can subscribe to Alerts or Messages using either the SubscribeAlerts or SubscribeMessages Method of the Messages Object.

Specify Topics

When subscribing to Historian Messages you must specify which topics you are subscribing to. There are six topics.
  • Message Topics: Configuration Audit, Connections, General
  • Alert Topics: Performance, Security, ServiceControl
Once you make the subscription, the AlertReceived or MessagesReceived Event will fire when a new message is created on the Historian Server. The topic of the message determines which event fires. Additionally, the event receives a copy of the Message or Alert Object properties listed as follows:
  • MessageNumber – The NLS string number.
  • MessageString – Translated string, including substitutions for time stamp, user, or tag name.
  • Substitutions – A collection of substitutions used to make the message string.
  • TimeStamp – The time the message was created.
  • Topic – The topic number of the message.
  • TopicName – The string topic name of the message.
  • UserName – The user name for the message.

You can also send Alerts and Messages to the iFIX Operator Message alarm queue using the SendOperatorMessage method of the System object. This method will send the alerts and messages to all alarm queues, but NOT the Alarm Summary queue. To send a message that will appear on an alarm summary, send the message to the Alarm Extension field of a digital alarm block and toggle the alarm state.