Python Plugin: PiMonitor

Python and python framework

Moderator: leecollings

Xorfor

Python Plugin: PiMonitor

Post 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 13685 times
Xorfor

Re: Python Plugin: PiMonitor

Post by Xorfor »

Added extra devices, like memory, up time, number of network connections, etc.
User avatar
emme
Posts: 909
Joined: Monday 27 June 2016 11:02
Target OS: Raspberry Pi / ODroid
Domoticz version: latest
Location: Milano, Italy
Contact:

Re: Python Plugin: PiMonitor

Post by emme »

just a question.....
what's the difference between this plugin and the Motherboard sensors hardware?
The most dangerous phrase in any language is:
"We always done this way"
Xorfor

Re: Python Plugin: PiMonitor

Post 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 13575 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.
User avatar
Siewert308SW
Posts: 288
Joined: Monday 29 December 2014 15:47
Target OS: Raspberry Pi / ODroid
Domoticz version: Stable
Location: The Netherlands
Contact:

Re: Python Plugin: PiMonitor

Post 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.
Setup:
- RPi4 - Domo Stable / Aeotec Z-stick7 / PiHole Unbound Gemini
- RPi4 - PiHole / PiVPN Unbound Gemini
- Synology DS923+ / DS218j
- P1 Gas/Power, SmartGateway watermeter
- Fibaro switches, contacts, plugs, smoke/Co2 ect
- rootfs @ USB HDD
Velly
Posts: 20
Joined: Sunday 22 October 2017 19:56
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: PiMonitor

Post 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!
Xorfor

Re: Python Plugin: PiMonitor

Post 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.
Velly
Posts: 20
Joined: Sunday 22 October 2017 19:56
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: PiMonitor

Post by Velly »

yes, pictures are fine
User avatar
htilburgs
Posts: 464
Joined: Tuesday 03 November 2015 11:01
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Python Plugin: PiMonitor

Post 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?
Hardware:
RPi3 - Aeon Labs Z-Stick GEN5 - Fibaro Dimmer 2 - Fibaro Roller Shutter 2 - Fibaro Smoke Sensor - Yeelight RGBW Led bulb - Yeelight Smart LED Light Strip - Neo Coolcam PIR Motion Sensor - Neo Coolcam PowerPlug - Nest Thermostat v3
User avatar
emme
Posts: 909
Joined: Monday 27 June 2016 11:02
Target OS: Raspberry Pi / ODroid
Domoticz version: latest
Location: Milano, Italy
Contact:

Re: Python Plugin: PiMonitor

Post by emme »

thanks for clarify....

It looks a good script! (like I am a linux guru!! :lol: :lol: :lol: :lol: )
I'm testing it
The most dangerous phrase in any language is:
"We always done this way"
Al33Rob
Posts: 3
Joined: Wednesday 31 January 2018 21:49
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.8914
Location: UK
Contact:

Re: Python Plugin: PiMonitor

Post 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
Xorfor

Re: Python Plugin: PiMonitor

Post 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.
Al33Rob
Posts: 3
Joined: Wednesday 31 January 2018 21:49
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.8914
Location: UK
Contact:

Re: Python Plugin: PiMonitor

Post by Al33Rob »

@Xorfor Thanks this sorted it!
Velly
Posts: 20
Joined: Sunday 22 October 2017 19:56
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: PiMonitor

Post by Velly »

Hi

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

Any reason/solution? Thank you!
Attachments
memory pi monit.JPG
memory pi monit.JPG (46.97 KiB) Viewed 13076 times
pimonitor memory.JPG
pimonitor memory.JPG (105.02 KiB) Viewed 13076 times
Xorfor

Re: Python Plugin: PiMonitor

Post 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.
EddyG
Posts: 1042
Joined: Monday 02 November 2015 5:54
Target OS: -
Domoticz version:

Re: Python Plugin: PiMonitor

Post 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.
User avatar
McMelloW
Posts: 427
Joined: Monday 20 November 2017 17:01
Target OS: Raspberry Pi / ODroid
Domoticz version: V2024.1
Location: Harderwijk, NL
Contact:

Re: Python Plugin: PiMonitor

Post 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?
Greetings McMelloW
Xorfor

Re: Python Plugin: PiMonitor

Post 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.
Velly
Posts: 20
Joined: Sunday 22 October 2017 19:56
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: PiMonitor

Post 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
Xorfor

Re: Python Plugin: PiMonitor

Post 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.
Post Reply

Who is online

Users browsing this forum: mvdp and 1 guest