Forum Discussion
What Mike and Stuart stated, all of the above is true. Sad but true. However....what caught my attention -
is it possible to pass the error message from a variable into the alarm message...in the same way that tokens work.
And the answer is unequivocally yes! We do it all the time here. Now, it takes little of bit elbow grease but it works great.
And it is all based on the fact you can use ##<DEVICEPROPERTYNAME>## as one of the DataSource Tokens in your alert message. Yeap, it is stated so right there on Tokens Available in LogicModule Alert Messages support website. So then, why not craft your own custom Device Property name that you can pass to the alert message?
In your DataSource you define a customized Alert message for one of the DataPoints and you can pass the value of your device property (ie token) into the Subject and/or Description. Like this;
Subject:
##LEVEL## - ##HOST## ##DATASOURCE## ##DATAPOINT## ##VALUE##
Description:
This alert will be raised when the reported value of Autoclient State is other than STARTED (value 1). See command output below for detailed description of error.
Possible State values;
1=STARTED <-- all good
0=STOPPED <-- alert raised
AutoClient command output:
##MB.SWIFT.AUTOCLIENT.SUMMARY##
Host: ##HOST##
Datasource: ##DATASOURCE##
Datapoint: ##DATAPOINT##
Level: ##LEVEL##
Start: ##START##
Duration: ##DURATION##
Value: ##VALUE##
ClearValue: ##CLEARVALUE##
Reason: ##DATAPOINT## ##THRESHOLD##
Notice I use ##MB.SWIFT.AUTOCLIENT.SUMMARY## custom token that I manipulate in my DataSource to update its value with free text. The trick is - you need to update this property BEFORE you output whatever DPs you are collecting in your DataSource.
And how do you do that? Use LM API and /device/devices/{device_id}/properties/{prop_name} endpoint.
Maybe little bit kludgy but again, once you figure out the syntax and workflow in your script it works remarkably well.
Thanks - this would work, but it would hammer the API with the amount of datasources we would have per device...not to mention all the calls, and we are already doing a frequent amount of calls already.
Although in saying that, would you share the code you use within the datasource to update the property? My groovyscript is still a bit iffy.
- mmatec018 months agoNeophyte
I don't think you would hammer the API because you don't run the API call unless the issue is detected. Right? Not every poll needs to employ API call. Only when exception is found that results in raising alert. I actually have a logic inside my script to fetch the property value at the beginning of poll and only update it if the issue is detected and the new property value needs to be output. Hopefully you don't run into too many alerts per device per DataSource per day, if you do, you create Alert fatigue and that's not good either.
As far as the script I use PowerShell as my choice of scripting language and I would have to scrub it in order to publish it. But there are tons of examples out there for both, groovy and PS on how to update API enpoints.
Lastly, I am again acknowledging, it would be nice if this capability was available out of the box. But since it is not, and based on business requirements, I have to do custom solution instead.
Related Content
- 8 months ago
- 6 months ago
- 2 years ago
- 2 months agoAnonymous