I have 4 instances of emonTx/RPi running the SD image Oct 2018 to monitor a largish PV system – at the inverter, grid incoming meter, air source heat pump and car charger.
Periodically one or another will stop recording inputs/feeds but I do not discover this until several days later.
Each instance has an AC-AC adapter and so the Vrms input/feed is available as a sign of ‘continuing life’.
I would like to create a script that can be run as a cron job periodically to report on system status/failure.
A simple script to ping each emonTx/RPi is not adequate as I’ve experienced that an emonTX/RPi instance being discoverable on the network does not necessarily mean that emoncms is running correctly.
Forum Resources suggest sudo service emonhub status as a diagnostic command. I’ve tried that – it produces quite a lengthy report …
pi@watchman:~ $ sudo service emonhub status
● emonhub.service - LSB: Start/stop emonHub
Loaded: loaded (/etc/init.d/emonhub; generated; vendor preset: enabled)
Active: active (running) since Wed 2019-02-13 18:02:04 GMT; 6 days ago
Docs: man:systemd-sysv-generator(8)
Process: 938 ExecStart=/etc/init.d/emonhub start (code=exited, status=0/SUCCES
CGroup: /system.slice/emonhub.service
└─987 python /usr/share/emonhub/emonhub.py --config-file /home/pi/dat
Feb 13 18:02:04 watchman sudo[948]: pam_unix(sudo:session): session opened for u
Feb 13 18:02:04 watchman sudo[948]: pam_unix(sudo:session): session closed for u
Feb 13 18:02:04 watchman sudo[957]: root : TTY=unknown ; PWD=/ ; USER=root ;
Feb 13 18:02:04 watchman sudo[957]: pam_unix(sudo:session): session opened for u
Feb 13 18:02:04 watchman sudo[957]: pam_unix(sudo:session): session closed for u
Feb 13 18:02:04 watchman sudo[966]: root : TTY=unknown ; PWD=/ ; USER=root ;
Feb 13 18:02:04 watchman sudo[966]: pam_unix(sudo:session): session opened for u
Feb 13 18:02:04 watchman sudo[966]: pam_unix(sudo:session): session closed for u
Feb 13 18:02:04 watchman emonhub[938]: Starting OpenEnergyMonitor emonHub: emonh
Feb 13 18:02:04 watchman systemd[1]: Started LSB: Start/stop emonHub.
lines 1-18/18 (END)
How in a script to test for the key words … ‘active (running)’?
Any suggestions would be most welcome
Thank you
John Banks