Grafana alert feature is not working and throwing the error message “The data source does not support alerting queries”

Unfortunately the Grafana openHistorian Datasource does not support Grafana Alerts.
The DataSource does support annotations and it is possible to show alarms set up in the openHistorian as annotations in Grafana.

Because the openHistorian has its own alarm engine there is currently no need for integration with the Grafana Alert Engine.
In newer versions of the OpenHistorian (2.8.X) there is limited support for displaying openHistorian alarms on the Graph Panel similarly to Grafana Alerts. However this only displays alerts set up in the openHistorian and still ignores any alerts set up in the Grafana Alert Engine.

HI Clackner,
Thanks for your quick response and understood the issue.
We would like to setup the alarm using openHistorian Manager and send notification to designated people using email or telegram.
Is there any provision available in openHistoran?
Or
Do we have any other tools/option to handle this kind of requirements?

Also I checked openHistorian database, looks like there is no option to record the alarm status, can you please clarify, where alarm status is currently maintained in openHistorian.

Please clarify.

Regards
Logu

By default alarm status is archived in the local “Statistics” historian.

Option exists to send an e-mail alert upon alarm - see DynamicCalculator.EmailNotifier action adapter.

Thanks,
Ritchie

Hi,

I could not able to find any specific configuration parameters for Alarm email notification or email notification/DynamicCalculator.EmailNotifier in openHistorian.config file. Could you please explain the steps to configure the email notification for Alarm status?

Also, if you have any document related to that, please share.

Thanks & Regards

Logu

This is an adapter that is configured with a connection string, there are no config file parameters for this feature.

Open the openHistorian UI Manager (not the web interface) and navigate to Actions > Manage Custom Actions then go to the last page of actions, i.e., click the >> button on the bottom right of the page. Now click Add New button and select E-Mail Notifier from the Type list.

This will create an e-mail based on a custom boolean expression, for example:

VariableList={x = PPA:1; y = PPA:2};
ExpressionText=x+y > 0

You will also need to set all the e-mail parameters…

Thanks,
Ritchie

Here is another article you might find useful for dynamic expressions like those used in the 'E-Mail Notifier`:

Hi Ritchie,

Thanks for your clarification and able to configure the email alert message successfully.

I have some additional queries, please clarify

  1. How to use actual variable in email body?

VariableList= {x = PPA:20274};

I need to use variable X in email body

  1. How to add current time as part of email body?
  2. If I need to send message for each measurement independently, what is the procedure?
    E.g.
  3. PPA:20274
  4. PPA:20275

If PPA: 20274 > 0 then I need to send email to different set of receipts (like A, B and C)
If PPA: 20275 > 20 then I need to send email to different set of receipts (like P, Q and R)

Can we use single email notification configuration, or do I need to setup independent alarm for each measurement and set separate email notifier?

Please clarify.

Thanks & Regards
Logu

So it didn’t have that feature, but it was super easy to add - so I put that option in the code:

So now you can have a body like the following:

Body={This is my e-mail text. The value of x is: {x}. The local time is: {LOCALTIME}}; 

I would use different adapter instances for different measurements.

FYI - this change will be in next nightly build which happens around midnight or so in the US Eastern time zone. Once built, you can download and install from here:
https://gridprotectionalliance.org/NightlyBuilds/openHistorian/Beta/openHistorian.Installs.zip

Thanks,
Ritchie

By the way, this supports string formatting like the following:

Body={This is my e-mail text.
The value of x is: {x:N3}.
The local time is: {LOCALTIME:yyyy-MM-dd HH:mm:ss.fff}}; 

Hi ritchi,

Thanks for your quick response.

When alarm is raised, email notifier is keep sending lot of emails per minute.

We have configured an alarm and it was raised only 2 times for the past 24 hrs, but we received around 3000 emails.

Am I missing any configuration?

Please clarify

Thanks & Regards
Logu

Are you sure you are alarming off of the alarm measurement? You’ll need to give me some more context, like alarming parameters, frequency of alarm input, e-mail adapter connection string, etc.

Hi Ritchie,

Please find all settings,

Alarm Settings:

  1. • Tag Name: AL-HIGH: ABCX !TP!ABC:FREQ
  2. • Operation: Greater than
  3. • Alarm point: 50.05
  4. • Hysteresis: 5
  5. • Severity :HIGH
  6. • Load order 0
  7. • Enabled : Yes
  8. • Create Associated Measurement: Yes
    Alarm Service connection String
    • Name: Alarm ! Services
    • Connection String : useAlarmLog=True; FramesPerSecond=30

Email Notifier connection string
From=abc@Test.com.au; SmtpServer=Test; Subject=OpenHistorian Alarm; Body={The value of x is: {x}.}; ToRecipients=abc@Test.com.au; VariableList={x = PPA:20274}; ExpressionText=x > 50.050; FramesPerSecond=1

Please review it and let us know, where it needs to be corrected?

You need to use both the alarm value (for the trigger - set to ‘x’) and the include the frequency value (for the e-mail - set to ‘y’). You then need to set the e-mail condition trigger to only evaluate when the alarm is triggered, i.e., ExpressionText=x > 0.

You will need to process values continuously to pull this off, so frame rate will need to match frequency rate, e.g., 30, and you will need to set UseLatestVaues to false so that measurements are processed at their native rate.

Also, since the alarm value will arrive rarely and the frequency value will arrive consistently, the alarm value will be substituted with a sentinel value which defaults to NaN. We set sentinel value to -1 instead to produce a cleaner negative answer to the expression condition of x > 0 which will be evaluated with each received frequency. See updates to connection string below:

Email Notifier connection string

From=abc@Test.com.au; SmtpServer=Test; Subject=OpenHistorian Alarm;
Body={The frequency value (y) is {y:N3}.}; ToRecipients=abc@Test.com.au;
VariableList={x = AL-HIGH:ABCX!TP!ABC:FREQ; y = PPA:20274};
ExpressionText=x > 0; FramesPerSecond=30; LeadTime=5.0; LagTime=5.0;
UseLatestValues=false; SentinelValue=-1.0

Hi Ritchi,

Thanks for your reply.

I’m using below connection string for email notifier,

From=abc@Test.com.au; SmtpServer=Test; Subject=OpenHistorian Alarm; Body={The value of x is: {x}.}; ToRecipients=abc@Test.com.au; VariableList={x = AL-HIGH:NOJA_AZURE!EQL!NP!ECROWE:FREQ; y = PPA:20274}; ExpressionText=x > 0; FramesPerSecond=30; LagTime=5; UseLatestValues=False; SentinelValue=-1.0

But I’m getting below error while specifying the alarm tag as part of expression. I’m using openHistorian 2.6.x. Is there any limitation?

[6/19/2020 11:56:28 AM] [Action Adapter Collection] Failed to initialize adapter ALERT_EMAIL_NOTIFIER: The value is not in the correct format for a MeasurementKey value

[6/19/2020 11:56:28 AM] (Inner Exception)
Date and Time: 6/19/2020 11:56:28 AM
Machine Name: NOJA-180
Machine IP: fe80::341b:7fcc:e46d:cc2c%12
Machine OS: Microsoft Windows NT 6.2.9200.0

Application Domain: openHistorian.exe
Assembly Codebase: C:/Program Files/openHistorian/openHistorian.exe
Assembly Full Name: openHistorian, Version=2.6.30.2, Culture=neutral, PublicKeyToken=null
Assembly Version: 2.6.30.2
Assembly Build Date: 3/31/2020 5:29:18 PM
.Net Runtime Version: 4.0.30319.42000

Exception Source: GSF.TimeSeries
Exception Type: System.FormatException
Exception Message: The value is not in the correct format for a MeasurementKey value
Exception Target Site: Parse

---- Stack Trace ----
GSF.TimeSeries.MeasurementKey.Parse(value As String)
openHistorian.exe: N 00094
DynamicCalculator.DynamicCalculator.GetKey(token As String)
openHistorian.exe: N 00048
DynamicCalculator.DynamicCalculator.AddAliasedVariable(token As String)
openHistorian.exe: N 00108
DynamicCalculator.DynamicCalculator.set_VariableList(value As String)
openHistorian.exe: N 00280
DynamicCalculator.DynamicCalculator.Initialize()
openHistorian.exe: N 00151
DynamicCalculator.EmailNotifier.Initialize()
openHistorian.exe: N 00378
GSF.TimeSeries.Adapters.AdapterCollectionBase`1.Initialize(item As T)
openHistorian.exe: N 00359

You can’t use the point tag for variables. You’ll need to use the measurement key of that alarm measurement. You can find it on the Manage Measurements page in the ID column. It has the format STAT:###.

Hi Stephen,

Earlier I used VariableList={x = PPA:20274};, but it was keep sending the email, more than 1500 per events.

Ritchi suggested to use
VariableList={x = AL-HIGH:ABCX!TP!ABC:FREQ; y = PPA:20274};
But I’m getting initialization error.

Is there any problem with openHistorian 2.6.x?

No, the problem is x = AL-HIGH:ABCX!TP!ABC:FREQ. You need to go to the Manage Measurements page, search for that measurement, record what’s in the ID column, and then use that in your variable list instead.

Hi Stephen,


Here PPA11:20274 is the key.
Please tell me, how should I write?
VariableList={x = AL-HIGH:NOJA_AZURE!EQL!NP!ECROWE:FREQ; y = PPA:20274};

Logu

Looks to me like it should be VariableList={ x=STAT:20371; y=PPA:20274 }.

Ok thanks. Let me check