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.

:+1: all.

Using the JSON feed, I’ve got a PHP script running outputting this

Just need to action the alerts now and we’re good.

1 Like

This is the sort of thing I’d either plug into Home Assistant or Node-red as creating the alerts is far simpler.

Right now, my NodeRed has died for some unknown reason! That’s the reason I’m not using it :slight_smile:

1 Like

I run my instance on a mini server in a VM and it is very stable.

Mine is on an RPi 2. Maybe I should upgrade to a 3 or 4.

It tends to be a bit hungry for memory. If you install netdata, you can monitor the memory usage remotely. Alternatively monit will do that too if you expose the httpd.