Inactive Feed Alerts

Occasionally some of my feeds into EmonCMS stop working and the feeds don’t get data, eventually showing “inactive”.

Is there anything I can setup to alert me that these feeds are inactive and I need to go and poke something?

I’ve tried using a 3rd party service like however it isn’t too reliable for me.

Anyone else solved this problem?

I dug a little into the JS (JS isn’t my area though), I can find a function called list_format_updated that seems to the last updated time of the feed and format it out for the UI.

I can’t quite trace it back far enough to work out where the data comes from.

I dumped all the Redis keys too, but nothing jumped out at me.

If I can extract that last update time from EmonCMS somehow, I think I could do a NodeRed script that would alert me if the feed is inactive.

When I call the:


API endpoint each feed has a “time” value of when it last received an update. It’s also got an “interval”. You could write a smidgen of code to say

if time + ( 3* interval ) > now then alert

so that it wouldn’t be too noisy about it. I might be tempted to say 20 rather than 3 so I had a quiet life :slight_smile:

You could write that code in anything you liked which could call the API (for example I have a load of code in Python that does it).

Hope that helps.

David Bowen

1 Like

Nice! Thank you.

I was going a slightly different direction, I found the same information in Redis by doing keys feeds*
That gives me the same info as the JSON feed.

I think I’ll use the JSON feed instead.


Whilst I love “going to the horse’s mouth” for data, the benefit with using the API here is that you’ll be somewhat insulated from technical changes at the backend. As we move between MySQL, PHPFINA, Redis and other improvements you’ll probably want to avoid having to re-write your alerting :slight_smile:

Might not be an issue. MySQL is used to store config data.
All the metrics are stored in the phpfina/phptimeseries data files.