Forum Discussion
Yes, it would be messy, but looking for minimum viable product to get moving in the right direction. If we had stdout/stderr as tokens, it wouldn't take much to build processing to loop over the lines, apply regex, push through a template, etc.
What i mean with the properties thing is to have the groovy script actually call the LM API as part of its execution. It would do an HTTP patch to the /device/devices/{deviceId}/devicedatasources/{hdsId}/instances or /device/devices/{deviceId}/properties/{name} endpoint (to add as instance or device property, respectively). The information pushed to the LM API in that HTTP patch would be the value of some variable in the groovy script.
For example:
Say you have a groovy based datasource: "IsItOkay", that gathers some data from the device. One of the pieces of data it gathers is the message you would want included in the alarm. Let's say the groovy script stores this message in a variable called `message`. After the part of the script that does the data collection finishes, you would have a section of the code that would do an HTTP Patch to the LM API updating/creating a property called `IsItOkay.detailedMessage` with the value of the `message` variable. The script would finish.
Once the script is finished, the data is compared to the threshold and since something is bad, it would open an alarm. The alarm body would reference all the tokens it references today with the addition of the `IsItOkay.detailedMessage` property.
Related Content
- 6 months ago