Page 1 of 4

Python Plugin: PiMonitor

Posted: Tuesday 09 January 2018 22:22
by Xorfor
A small plugin available for the Raspberry Pi:

https://github.com/Xorfor/Domoticz-PiMonitor-Plugin

To monitor CPU speed, usage, temperature, etc.
PiMonitor.png
PiMonitor.png (20.56 KiB) Viewed 13620 times

Re: Python Plugin: PiMonitor

Posted: Monday 15 January 2018 20:34
by Xorfor
Added extra devices, like memory, up time, number of network connections, etc.

Re: Python Plugin: PiMonitor

Posted: Monday 15 January 2018 21:10
by emme
just a question.....
what's the difference between this plugin and the Motherboard sensors hardware?

Re: Python Plugin: PiMonitor

Posted: Monday 15 January 2018 21:27
by Xorfor
I wrote this plugin to monitor the RPi on which I develop other plugins. I want to see eg. the cpu speed, number of connections, which is not possible with the Motherboard sensors hardware. So, this plugin shows some more information.
PiMonitor.png
PiMonitor.png (38.36 KiB) Viewed 13510 times
A disadvantage of this plugin, that it works on a RPi and probably also other Linux devices (not tested). Not on Windows!

That is also the reason that I wrote the Disc usage plugin (https://github.com/Xorfor/Domoticz-Disc-usage-Plugin). The standard Motherboard sensors only displays some directories. With the Disc usage plugin, I am able to also monitor mounted disks.

Re: Python Plugin: PiMonitor

Posted: Monday 15 January 2018 21:34
by Siewert308SW
Besides that, Hardware monitor Memory Usage looks at the amount Domoticz uses or the calculation is different.
While the plugin looks for the total amount of memory used.

Re: Python Plugin: PiMonitor

Posted: Saturday 27 January 2018 16:15
by Velly
Hi<
following LOG errors:
2018-01-27 18:11:48.970 Error: (PiMonitor) 'onStart' failed 'KeyError'.
2018-01-27 18:11:48.970 Error: (PiMonitor) ----> Line 162 in /home/pi/domoticz/plugins/PiMonitor/plugin.py, function onStart
2018-01-27 18:11:48.970 Error: (PiMonitor) ----> Line 56 in /home/pi/domoticz/plugins/PiMonitor/plugin.py, function onStart


What could be wrong with?
Thanks!

Re: Python Plugin: PiMonitor

Posted: Saturday 27 January 2018 17:34
by Xorfor
@Velly,

Did you also placed the xfr_pimonitor.zip in the plugin directory? This contains the images of the plugin, and it seems that the plugin has problems to get these images.

Re: Python Plugin: PiMonitor

Posted: Saturday 27 January 2018 17:37
by Velly
yes, pictures are fine

Re: Python Plugin: PiMonitor

Posted: Tuesday 30 January 2018 12:26
by htilburgs
I was wondering if it is possible to monitor a 'remote' pi?
In mine situation I've 2 Raspberrys.
  • RPi 2B (DHCP, DNS, VPN, MQTT, HomeBridge)
  • RPi 3 (Domoticz)
While running Domoticz on the RPi3 I'm able to monitor this one with the PiMonitor Plugin.
What I like to do is monitor the other (RPi2B) also with the PiMonitor Plugin. Is this possible?

Re: Python Plugin: PiMonitor

Posted: Tuesday 30 January 2018 12:44
by emme
thanks for clarify....

It looks a good script! (like I am a linux guru!! :lol: :lol: :lol: :lol: )
I'm testing it

Re: Python Plugin: PiMonitor

Posted: Wednesday 31 January 2018 21:52
by Al33Rob
Hello,

Thanks for developing this script, i am trying to use and have the basic setup installed, ie i can create the hardware and the devices are created as well however in the log i'm seeing the below messages. Can you advise if i'm missing something.


2018-01-31 20:50:32.568 (RasPi_Info) Calling message handler 'onHeartbeat'.
2018-01-31 20:50:32.569 (RasPi_Info) onHeartbeat called
2018-01-31 20:50:32.569 (RasPi_Info) CPU count...: 1
2018-01-31 20:50:32.605 (RasPi_Info) CPU temp....: 37.4 °C
2018-01-31 20:50:32.605 Error: (CDevice_update) RasPi_Info - CPU temperature: Failed to parse parameters: 'nValue', 'sValue', 'SignalLevel', 'BatteryLevel' or 'Options' expected.
2018-01-31 20:50:32.605 Error: (RasPi_Info) 'CDevice_update' failed 'TypeError':''TimedOut' is an invalid keyword argument for this function'.
2018-01-31 20:50:32.606 (RasPi_Info) Update RasPi_Info - CPU temperature: 37 - '37.4'
2018-01-31 20:50:32.647 (RasPi_Info) GPU temp....: 36.9 °C
2018-01-31 20:50:32.648 Error: (CDevice_update) RasPi_Info - GPU temperature: Failed to parse parameters: 'nValue', 'sValue', 'SignalLevel', 'BatteryLevel' or 'Options' expected.
2018-01-31 20:50:32.648 Error: (RasPi_Info) 'CDevice_update' failed 'TypeError':''TimedOut' is an invalid keyword argument for this function'.
2018-01-31 20:50:32.648 (RasPi_Info) Update RasPi_Info - GPU temperature: 36 - '36.9'
2018-01-31 20:50:32.684 (RasPi_Info) GPU memory..: 64.0 Mb
2018-01-31 20:50:32.684 Error: (RasPi_Info) 'onHeartbeat' failed 'AttributeError':''Domoticz.Device' object has no attribute 'TimedOut''.
2018-01-31 20:50:32.685 Error: (RasPi_Info) ----> Line 190 in /home/pi/domoticz/plugins/pimonitor/plugin.py, function onHeartbeat
2018-01-31 20:50:32.685 Error: (RasPi_Info) ----> Line 115 in /home/pi/domoticz/plugins/pimonitor/plugin.py, function onHeartbeat
2018-01-31 20:50:32.685 Error: (RasPi_Info) ----> Line 216 in /home/pi/domoticz/plugins/pimonitor/plugin.py, function UpdateDevice

Re: Python Plugin: PiMonitor

Posted: Thursday 01 February 2018 10:41
by Xorfor
@htilburgs: No is not possible

@Al33Rob: Please use the latest Domoticz beta! Your version is too old for this (and probably other) plugin.

Re: Python Plugin: PiMonitor

Posted: Thursday 01 February 2018 19:42
by Al33Rob
@Xorfor Thanks this sorted it!

Re: Python Plugin: PiMonitor

Posted: Thursday 08 February 2018 16:09
by Velly
Hi

sometimes there is huge difference between Monit memory data and PiMonitor data:
like on screens

Any reason/solution? Thank you!

Re: Python Plugin: PiMonitor

Posted: Thursday 08 February 2018 20:03
by Xorfor
@Velly,

On internet you will find a lot of different ways to calculate the memory usage. The all give different values. The plugin is using an algorithm based on 'free' eg. as can be found on https://gist.github.com/funvill/5252169.
I have no idea how Monit is calculating the memory usage.

Re: Python Plugin: PiMonitor

Posted: Thursday 08 February 2018 20:30
by EddyG
I use both RPi-Monitor https://github.com/XavierBerger/RPi-Monitor as Monit https://mmonit.com/monit/
Both do an excellent job outside of Domoticz.

Re: Python Plugin: PiMonitor

Posted: Sunday 11 February 2018 19:41
by McMelloW
Velly wrote: Saturday 27 January 2018 16:15 Hi<
following LOG errors:
2018-01-27 18:11:48.970 Error: (PiMonitor) 'onStart' failed 'KeyError'.
2018-01-27 18:11:48.970 Error: (PiMonitor) ----> Line 162 in /home/pi/domoticz/plugins/PiMonitor/plugin.py, function onStart
2018-01-27 18:11:48.970 Error: (PiMonitor) ----> Line 56 in /home/pi/domoticz/plugins/PiMonitor/plugin.py, function onStart
Xorfor wrote: Saturday 27 January 2018 17:34 Did you also placed the xfr_pimonitor.zip in the plugin directory? This contains the images of the plugin, and it seems that the plugin has problems to get these images.
Hi Xorfor, I have the same errors as Velly. The xfr_pimonitor.zip is in the same directory as the plugin.py Do I have to unpack the xfr_pimonitor.zip? Is the name of the plugin-dicetory important?

Re: Python Plugin: PiMonitor

Posted: Monday 12 February 2018 20:50
by Xorfor
@McMelloW,

You don't need to unpack the zipfile. Last week I had another RPi with the same problem.
I found out that there was a problem updating the database. The image files were created in the www/images folder, but in Setup -> More options -> Custom Icons, the image did not appear. I don't have this problem at this moment with V3.8914!!!

I suggest:

1. to upgrade to the latest beta,
2. in Hardware, delete PiMonitor
3. Add PiMonitor again.

Re: Python Plugin: PiMonitor

Posted: Wednesday 14 February 2018 17:03
by Velly
@xorfor

Hi
I tried:
1. to upgrade to the latest beta,
2. in Hardware, delete PiMonitor
3. Add PiMonitor again.

Result:
I get NO devices anymore (tried to reboot etc etc)
I am getting same errors in log, but this time I am unable to see new PiMonitor devices in list..
Needed to restore from IMG file - or I had no chances at all to see PiMonitor devices in my list..

actual working (with errors) setup: 3.8820 beta, pi3 Jessie, python 3.4

Re: Python Plugin: PiMonitor

Posted: Wednesday 14 February 2018 20:39
by Xorfor
@velly,

Hummm, my RPi is running on v3.8914. Yours seems older, not the latest beta. As far as I remember that was also the version I got this problem.
Try:
cd domoticz
./updatebeta

Then you are on the latest beta. Try the steps 2-3 again.
If still no devices available, check in Setup -> More options -> Custom icons. Do you see the pimonitor icons? If not try to upload the zip file.
If zip file succesfully uploaded, try step 2-3 again.