Create event detector that applies to all/specific datapoints
-
Hi All,
I need to ensure all of my data is up to date. What can I do to make a datapoint fire an alarm once the data goes more than a few hours old? Not so keen on trying to apply individual events to every single datapoint, I've got a few thousand here....
Fox
-
Hi MattFox
Interesting topic, I am keen to follow it. I spent a few minutes trying to come up with something. But I could only come up with more questions...
- What does "up to date data" mean ? This will vary per type of data source.
- What type of data sources are you working with?
- if the data source is healthy does that mean the data point is healthy? If not then how would you know when the
DP is up to date.?
-
-
Up to date is easy as I know that my nodes update every five to ten minutes.
-
The datasource is irrelevant, It's the age of the timestamp of the individual datapoints themselves. That's why I said a few hours.
-
I have other systems in place to monitor live connections to my data nodes over the air. If I have a poor connection, all associated datapoints with that datasource will fail to update altogether. So the issue comes with the nodes themselves to ensure data is being sent and utilising Mango's events system to assist in monitoring point updates and providing an edge to be more proactive in support and troubleshooting.
-
-
I'm getting the feeling that this is not currently possible in Mango....
-
@mattfox said in Create event detector that applies to all/specific datapoints:
I'm getting the feeling that this is not currently possible in Mango....
Well then it's good you bumped it as I missed it somehow! Of course it's possible (probably). You'd have a bunch of options to hack it up. I think compiling a JSON object and placing that into the JSON store will be a useful example. This is a scripting data source:
var allPoints = DataPointQuery.query("limit(1000000)"); var delayedUpdates = {}; var now = Number(CONTEXT.getRuntime()); for (var k = 0; k < allPoints.length; k+=1) { if ( allPoints[k].runtime === null ) //Point or source not enabled continue; //We could add it to another status object, instead, or set its key to "disabled" so we can see it if ( now - allPoints[k].runtime.time > 600000 ) //Ten minutes milliseconds delayedUpdates[ allPoints[k].extendedName ] = allPoints[k].runtime.time; } function newJsonDataObject() { var jsonDataVO = new com.serotonin.m2m2.vo.json.JsonDataVO(); jsonDataVO.setPublicData( false ); jsonDataVO.setReadPermission( "" ); jsonDataVO.setEditPermission( "" ); jsonDataVO.setXid( "JSON_delayed_updates" ); jsonDataVO.setName( "Delayed Updates" ); return jsonDataVO; } var jsonDataVO = com.serotonin.m2m2.db.dao.JsonDataDao.instance.getByXid( "JSON_delayed_updates" ); if(jsonDataVO === null) jsonDataVO = newJsonDataObject(); jsonDataVO.setJsonData( delayedUpdates ); //print(JSON.stringify(delayedUpdates)); com.serotonin.m2m2.db.dao.JsonDataDao.instance.save( jsonDataVO );
Have that on a cron that updates as often as you need to. If loading that point list is cumbersome because your system is massive, that can probably be worked around. The result of this will be a JSON store item with a map of point extended names to last update timestamps iff that update was at least ten minutes ago.
-
@phildunlap said in Create event detector that applies to all/specific datapoints:
You'd have a bunch of options to hack it up.
You had me at hack
I've got a status dashboard doing something similar already. Although I can likely extend what you've done here and implement an email with a template listing all iffy datapoints. It's not an alarm per se but it sure is a darn good start.
I'll put it in the wishlist. I think it'd be good to datasource/point template wide alarm settings that individual points have.
Inidividual point alarms override template -> template override datasource. That's my idea.Thanks again Phil!
Fox