Monitoring a Raspberry Pi on EmonCMS

Hi,

Attached is a short php script to monitor my Raspberry Pi that is running Emonhub+EmonCMS (with a hdd).

It posts the following data on EmonCMS: memory used,  memory shared, memory buffers, memory cached, GPU temp, CPU temp, CPU usage. Just modify the node id that will receive data and put you APIKEY.

- Copy this script into the home pi directory  (/home/pi)

- Rename it (php file can't be attached in that forum):

mv /home/pi/SCRIPT_Post_info_RPI.txt /home/pi/SCRIPT_Post_info_RPI.php

- Modify the nodeid, the APIKEY and the target

nano /home/pi/SCRIPT_Post_info_RPI.php (modify it, save and exit with Ctrl-X / Y / Enter)

- To post data on EmonCMS, run  :

php /home/pi/SCRIPT_Post_info_RPI.php

To run this script every minute, add a cron task :

sudo crontab -e and add the following line at the end of the file  :   * * * * * php /home/pi/SCRIPT_Post_info_RPI.php. Save and exit with Ctrl-X / Y / Enter

Then restart cron service : sudo service cron restart

 

First observation

I noticed that the used RAM was always increasing on my RPI. So, I was worrying about a memory leak. In fact, it seems to be normal as it's only disk caching, a normal behavior on linux machine (See http://www.linuxatemyram.com/). When clearing the memory cache by running "sudo /sbin/sysctl vm.drop_caches=3", the RAM used magically comes back (see attached). Now, I will pay attention to the "real free memory" : mem free + mem buffer + mem cached.

Second observation

I put my RPI + a hub USB + a USB HDD in plastic junction box to make it cleaner. I'm using the pre-drilled holes for ventilation (see attached). When the box is in horizontal position, the RPI's CPU gets hot (65°C). When the box is in vertical position, the RPI's CPU gets colder (55°C). The natural chimney effect with aeration is better in that position. Do you think it can be a problem for the hdd (which is also in vertical position )

Eric

 

 

pb66's picture

Re: Monitoring a Raspberry Pi on EmonCMS

Does the hdd have an accessible temp sensor maybe?

Does having the pi vertical within the horizontal box run any cooler if you can't have the box mounted vertically?

I don't think the either the pi or hdd will mind being mounted vertically, especially if it keeps the temp lower.

I think this is a pretty cool function that could be very useful thanks for sharing.

Paul

Eric_AMANN's picture

Re: Monitoring a Raspberry Pi on EmonCMS

Does the hdd have an accessible temp sensor maybe?

>>>   I don't know

Does having the pi vertical within the horizontal box run any cooler if you can't have the box mounted vertically?

>>>   I can't have the pi vertical within the horizontal box (too small). So I didn't test that. According to me, the most important thing is to have holes both at the bottom and the the top of the box to create a natural chimney effect.

I think this is a pretty cool function that could be very useful thanks for sharing.

>>> more data could be collected : disk usage, network usage, ...

 

Eric

 

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.