tkaiser Posted July 29, 2015 Posted July 29, 2015 Hi, I started to adjust RPi-Monitor's settings for the Banana Pi a while ago and reworked the whole stuff in the meantime (since it was focused on Banana Pi and some parts were too quick&dirty -- especially temp file handling of the temperature daemon). I also adjusted the consumption measurements for Lamobo R1 since it's the best idea to power the board through the LiPo battery connector -- for this case you need the axp209_cpu_pmu_temp_r1.conf template! Here you find an installation overview for RPi-Monitor (takes you 3 minutes if you are able to copy&paste): http://rpi-experiences.blogspot.fr/p/rpi-monitor-installation.html Here you find what's different on sunxi: https://github.com/ThomasKaiser/RPi-Monitor/blob/master/README_sunxi.md Here you find the adjustments: http://kaiser-edv.de/downloads/sunxi-monitor.tar.gz (MD5: 6822bcd7fe5cb2403eed9747e7cfff52. It will take you additional 3 minutes to 'install' -- see below) The archive contains the following: /etc/rpimonitor/data.conf /etc/rpimonitor/template/sunxi_axp209.conf /etc/rpimonitor/template/axp209_cpu_pmu_temp.conf /etc/rpimonitor/template/axp209_cpu_pmu_temp_r1.conf /usr/share/rpimonitor/scripts/sunxi_tp_temp /usr/share/rpimonitor/scripts/sunxi-temp-daemon.sh Contents: data.conf is relinked to template/sunxi_axp209.conf which includes all the basic RPi-Monitor stuff but uses template/axp209_cpu_pmu_temp.conf for all the A10/A20/AXP209 specific stuff since this differs totally from Raspberry Pi. The sunxi_tp_temp binary is able to read out A20's temperature and sunxi-temp-daemon.sh is a script I rewrote from scratch since it's not possible to collect thermal data from disks/SoC under heavy load (RPi-Monitor isn't that patient waiting for external ressources to respond. So I created a daemon that collects thermal data into 3 temporary files and redirect RPi-Monitor to read from there). WARNING: Most of the sunxi stuff works only with kernel 3.4.x since in mainline the I2C/sysfs interface to the AXP209 PMU disappeared. Installation: Install RPi-Monitor as outlined in the link above, then stop it, untar the archive from /, ensure that /usr/share/rpimonitor/scripts/sunxi-temp-daemon.sh will be running and start rpimonitor again. # become root eg. by "sudo su -" service rpimonitor stop cd / && tar -xzf /path/to/sunxi-monitor.tar.gz nohup /usr/share/rpimonitor/scripts/sunxi-temp-daemon.sh & service rpimonitor start To let the collection of thermal data survive a reboot it's a good idea to add "/usr/share/rpimonitor/scripts/sunxi-temp-daemon.sh &" prior to "exit 0" to /etc/rc.local 2
tkaiser Posted July 30, 2015 Author Posted July 30, 2015 If anyone is testing here's a bugfix version of sunxi-temp-daemon.sh: http://pastebin.com/pxxKaTQ4 Changes: Check existence of /dev/sda prior to testing, make check intervals configurable, check disk temperature less frequently
petrmaje Posted July 30, 2015 Posted July 30, 2015 Hi Tkaiser, It looks, that hddtemp.rrd is missing in /var/lib/rpimonitor/stat/ after installation?? When I created the one, everything works well. P.
tkaiser Posted July 30, 2015 Author Posted July 30, 2015 It looks, that hddtemp.rrd is missing in /var/lib/rpimonitor/stat/ after installation?? When I created the one, everything works well. Thx for reporting that, found the problem. It was defined as "GAUGE " with trailing whitespace instead of "GAUGE". I fixed that (as well as other stuff, eg. smoothing temperature graphs for SoC/PMU, less frequent disk checks, configurable check interval and so on): http://kaiser-edv.de/downloads/sunxi-monitor.tar.gz (MD5: 6822bcd7fe5cb2403eed9747e7cfff52) Same procedure as before. Stop rpimonitor, untar from / and restart. Now everything should work out of the box. Feedback welcome!
petrmaje Posted July 30, 2015 Posted July 30, 2015 Now everything should work out of the box. Feedback welcome! Check Status/Temperature Decimal separator missing This is very nice tool to understand, how the board working. And what about the BCM chip in R1? There is no monitoring feature?
tkaiser Posted July 30, 2015 Author Posted July 30, 2015 Check Status/Temperature Decimal separator missing This is very nice tool to understand, how the board working. And what about the BCM chip in R1? There is no monitoring feature? Can you please elaborate on the error you get? A screenshot or terminal output (if it's directly related to the temp daemon) would help. Regarding the switch IC: I don't know whether it has a thermal sensor inside that can be queried. I would doubt it. For network packets you have to query kernel interfaces. But I don't know whether the BCM provides per port statistics.
petrmaje Posted July 30, 2015 Posted July 30, 2015 I did simply stop rpimonitor, copied files downloaded from you and rpimonitor start. If you need some additional info, let me know. PM
tkaiser Posted July 30, 2015 Author Posted July 30, 2015 I did simply stop rpimonitor, copied files downloaded from you and rpimonitor start. If you need some additional info, let me know. Ah, ok. I forgot to mention that it's essential to stop and restart the temperature daemon since the old daemon writes 'degrees * 1000' into the temp files and the new one only 'degrees * 10'. So currently you have a mismatch between the daemon reporting old values and the config interpreting according to new rules. pkill -f '/bin/bash /usr/share/rpimonitor/scripts/sunxi-temp-daemon.sh' && (cd /tmp && nohup /usr/share/rpimonitor/scripts/sunxi-temp-daemon.sh & ) should do the job (or a reboot if you want to play Windows )
petrmaje Posted July 30, 2015 Posted July 30, 2015 Ah, ok. I forgot to mention that it's essential to stop and restart the temperature daemon since the old daemon writes 'degrees * 1000' into the temp files and the new one only 'degrees * 10'. So currently you have a mismatch between the daemon reporting old values and the config interpreting according to new rules. pkill -f '/bin/bash /usr/share/rpimonitor/scripts/sunxi-temp-daemon.sh' && (cd /tmp && nohup /usr/share/rpimonitor/scripts/sunxi-temp-daemon.sh & ) should do the job (or a reboot if you want to play Windows ) yes, now ok 1
tkaiser Posted July 31, 2015 Author Posted July 31, 2015 FYI: Testing finished / feature freeze. I submitted a second pull request to Xavier to include the current state with the next RPi-Monitor release. In case you've further comments feel free to discuss them here :-) If you want to try it out in the meantime you should follow these steps: # become root eg. by "sudo su -" cd /tmp && wget http://kaiser-edv.de/downloads/sunxi-monitor.tar.gz md5sum sunxi-monitor.tar.gz | grep -i 6822bcd7fe5cb2403eed9747e7cfff52 || exit 1 service rpimonitor stop cd / && tar -xzf /tmp/sunxi-monitor.tar.gz pkill -f '/bin/bash /usr/share/rpimonitor/scripts/sunxi-temp-daemon.sh' 2>/dev/null nohup /usr/share/rpimonitor/scripts/sunxi-temp-daemon.sh & service rpimonitor start If you chose the first installation method (compare with http://rpi-experiences.blogspot.fr/p/rpi-monitor-installation.html please) then when RPi-Monitor 2.11 will be released all you've to do is a simple 'apt-get update/upgrade' and you're done. You should keep in mind that when you change templates then create them with a new and unique name otherwise conflicts while doing 'apt-get upgrade' will occur. 1
ClockworkOrangePi Posted August 5, 2015 Posted August 5, 2015 Hello there, I am using OrangePi with Wheezy. I installed your fix for RPiMonitor as my Pi didn't display any temperatures. Now it is a lot better and it displays this: But do you guys have any idea why disk is not monitored?
tkaiser Posted August 6, 2015 Author Posted August 6, 2015 I also think hddtemp is either missing or needs a fix (when the disk model is too young). You should give the following a try hddtemp /dev/sda --debug In case you've an USB disk check the comments regarding smartctl/hdparm (and be aware that when you're running wheezy that you might need to patch a smartmontools script since the version shipping with Wheezy is outdated as hell) https://github.com/ThomasKaiser/RPi-Monitor/blob/devel/scripts/sunxi-temp-daemon.sh#L118-L142 BTW: I reworked the sunxi_tp_temp code to be able to deal with both A10 and A20 (they've different temperature curves and I tried to adopt the new code from kernel 4.x for this). And with Yuri's help we're now able to distinguish between A10 and A20 (and possibly A13 as well. The A13 is said to have the same thermal sensor as A20 but is otherwise A10's direct sibling): #!/bin/bash CheckSunxiHardware() { SunxiGeneration="$(awk -F" " </proc/cpuinfo '/^Hardware/ {print $3$4}')" case ${SunxiGeneration} in *sun7i*) # A20 CpuPart="$(awk -F" " </proc/cpuinfo '/^CPU part/ {print $4}')" case ${CpuPart} in *0xc07*) echo "A20: /path/to/sunxi_axp209_temp 144700 100" ;; esac ;; *sun5i*|*A1X*) CpuRevision="$(awk -F" " </proc/cpuinfo '/^Revision/ {print $3}')" case ${CpuRevision} in *a13*|*A13*) # A13 echo "A13: /path/to/sunxi_axp209_temp 144700 100" ;; *) # A10 echo "A10: /path/to/sunxi_axp209_temp 257000 133" ;; esac ;; esac } # CheckSunxiHardware CheckSunxiHardware Will ship this as an update soon.
tkaiser Posted August 9, 2015 Author Posted August 9, 2015 Just a small follow-up: To get an idea what's going on inside enclosures I added one DS1820 externally to get ambient temperature and one DHT11 inside the server's enclosure close to the PSU (took me some time to patch the programm to read out the DHT11 without a pull-up resistor and to realize that it's not enough to add w1-gpio and w1_therm to /etc/modules when w1_sunxi is missing to be able to talk to the DS1820). Since the device is some sort of a surveillance server (feeds 5 RPi B+ with camera module via PoE and both records their video streams and 'transcodes' to be accessible in realtime via VLC) I also added the ability to record the internal temperature of all 5 PiSpy cams: RPi-Monitor is really great to realize obvious relationships otherwise invisible :-)
Basteljunge Posted August 15, 2015 Posted August 15, 2015 Hi tkaiser, thank you for your work on this and the newbie friendly instructions. With the help of the guide at rpi-experiences, i also added a DS18(S)20 temperature sensor. I get "xx,xxx" but i want just one decimal place "xx,x" like in your screenshot. Could you post me your regular expression, to get the same output. I`ve tried different expressions, but didn`t get it. Thanks in advance.
tkaiser Posted August 16, 2015 Author Posted August 16, 2015 When you divide by 100 do not use "$1/100" but "sprintf("%.1f", $1/100)" instead as regex. As a reference my whole config that deals with A20/AXP209, several sensor sources and now also CPU stats: http://pastebin.com/ARcjtjzL I do not read out the sensors directly but let my temperature daemon preprocess the raw data (sanitizes numbers if sensors report anomal values as it happens sometimes and does some averaging to get smoother graphs): For CPU stats I use a function that will be called every 20 seconds and processes the counters present in /proc/stat and writes the 6 values I'm interested in (see last graph above) into /tmp/cpustat from where they were picked up by a RPI-Monitor regex: ProcessStats() { set $(awk -F" " '/^cpu / {print $2"\t"$3"\t"$4"\t"$5"\t"$6"\t"$7"\t"$8}' </proc/stat) UserStat=$1 NiceStat=$2 SystemStat=$3 IdleStat=$4 IOWaitStat=$5 IrqStat=$6 SoftIrqStat=$7 UserDiff=$(( ${UserStat} - ${LastUserStat} )) NiceDiff=$(( ${NiceStat} - ${LastNiceStat} )) SystemDiff=$(( ${SystemStat} - ${LastSystemStat} )) IdleDiff=$(( ${IdleStat} - ${LastIdleStat} )) IOWaitDiff=$(( ${IOWaitStat} - ${LastIOWaitStat} )) IrqDiff=$(( ${IrqStat} - ${LastIrqStat} )) SoftIrqDiff=$(( ${SoftIrqStat} - ${LastSoftIrqStat} )) Total=$(( ${UserDiff} + ${NiceDiff} + ${SystemDiff} + ${IdleDiff} + ${IOWaitDiff} + ${IrqDiff} + ${SoftIrqDiff} )) CPULoad=$(( ( ${Total} - ${IdleDiff} ) * 100 / ${Total} )) UserLoad=$(( ${UserDiff} *100 / ${Total} )) SystemLoad=$(( ${SystemDiff} *100 / ${Total} )) NiceLoad=$(( ${NiceDiff} *100 / ${Total} )) IOWaitLoad=$(( ${IOWaitDiff} *100 / ${Total} )) IrqCombinedLoad=$(( ( ${IrqDiff} + ${SoftIrqDiff} ) *100 / ${Total} )) echo "${CPULoad} ${SystemLoad} ${UserLoad} ${NiceLoad} ${IOWaitLoad} ${IrqCombinedLoad}" >/tmp/cpustat LastUserStat=${UserStat} LastNiceStat=${NiceStat} LastSystemStat=${SystemStat} LastIdleStat=${IdleStat} LastIOWaitStat=${IOWaitStat} LastIrqStat=${IrqStat} LastSoftIrqStat=${SoftIrqStat} } # ProcessStats
Basteljunge Posted August 16, 2015 Posted August 16, 2015 When you divide by 100 do not use "$1/100" but "sprintf("%.1f", $1/100)" instead as regex. As a reference my whole config that deals with A20/AXP209, several sensor sources and now also CPU stats: http://pastebin.com/ARcjtjzL It works! Thank you.
Narkozzz Posted August 20, 2015 Posted August 20, 2015 Testing it, looks great, if it could be expanded with more monitoring featires - would be great! Number of active DHCP leases with mac-list, proxy-server log, network speed load and active router ports - this is very useful info! But even now this service is great addition, thank you for your efforts!
tkaiser Posted August 20, 2015 Author Posted August 20, 2015 Testing it, looks great, if it could be expanded with more monitoring featires - would be great! RPi-Monitor can be extended nearly unlimited since version 1.2 or 1.3 regarding custom data sources and various output types and starting with 2.10 also to customize the web pages extensively and include every stuff you like. The focus of my additions was simply to address the different data sources on sunxi devices regarding thermal things and power consumption (and some sort of a daemon to collect data since in my test setups -- torturing the devices under full load -- RPi-Monitor often failed to collect some stuff due to timeouts: ie querying a disk for its internal temperature under full load --> takes often more than a second to respond and in the meantime RPi-Monitor already gave up). If you want add the stuff you mentioned you can start directly. Just become familiar with RRD data collection types (GAUGE vs. COUNTER vs. DERIVE and so on) and how you apply regex to filter raw data and you're done. There are plenty of examples available on the web and you get many ideas by reading the full post including comments/links here: http://rpi-experiences.blogspot.fr/2013/06/rpi-monitor-version-20-advance-usage.html But since it sounds you like to monitor a router I would suggest checking better options first (eg. fully blown monitoring solutions that know alerts and triggers like OpenNMS or OMD -- prebuilt for ARMv7) 1
Tido Posted January 3, 2016 Posted January 3, 2016 I also think hddtemp is either missing or needs a fix I have some questions regarding the setup, I have Kernel 3.4.108 For my HDD it says: undefined root@lamobo:~# hddtemp /dev/sda --debug ================= hddtemp 0.3-beta15 ================== Model: HGST HTS541075A9E680 field(1) = 0 field(2) = 0 field(183) = 0 field(184) = 0 field(187) = 0 field(188) = 0 field(190) = 34 If one of the field value seems to match the temperature, be sure to read the hddtemp man page before sending a report (section REPORT). Thanks. Currently I power my R1 via USB, does it measure the mA correctly too or does this only work via Battery-Connector? To let the collection of thermal data survive a reboot it's a good idea to add "/usr/share/rpimonitor/scripts/sunxi-temp-daemon.sh &" prior to "exit 0" to /etc/rc.local Did you take prevention that this file is not getting too big? If I choose not to add this command, at reboot there is no information about the temperature? I had to: service rpimonitor stop nohup /usr/share/rpimonitor/scripts/sunxi-temp-daemon.sh & service rpimonitor start and then it reported me 100° C which frightened me a bit, but then came down 'fast'.
tkaiser Posted January 3, 2016 Author Posted January 3, 2016 (edited) RTFunnyM . Regarding hddtemp you might need to add an entry to its config file (use smartctl to get the right one). Edited January 3, 2016 by wildcat_paris Funny Manual :) 1
Tido Posted January 3, 2016 Posted January 3, 2016 (edited) Thank you Wildcat_paris - but I chat with TK already a couple of months - I know he is not perfect.This is not RTFM this would have been: I have written many notes inside the sunxi-temp-daemon.shSo the information is spread somewhere between this thread and the .sh - and you do not mention this in the first posting here.This is the reason that I wrote a user manual - because the information in the forum is scattered and it is not useful. For SATA HDD In case you receive no HDD temperature, make sure you have necessary software installed:apt-get install hddtemp smartmontoolsdo a reboot not to waste time, just in caseThen perform: sudo update-smart-drivedb if you receive an error message, update this line: nano /usr/sbin/update-smart-drivedb SRCEXPR='http://sourceforge.net/p/smartmontools/code/HEAD/tree/$location/smartmontools/drivedb.h?format=raw' Then try again: sudo update-smart-drivedbRestart the the RPi-Monitor and test it: service rpimonitor stop pkill -f '/bin/bash /usr/share/rpimonitor/scripts/sunxi-temp-daemon.sh' nohup /usr/share/rpimonitor/scripts/sunxi-temp-daemon.sh & service rpimonitor start Does it work - finished, if not: smartctl -a /dev/sda (look for temperature value) hddtemp --debug /dev/sda hddtemp -n /dev/sda fix it for yourself, read here this worked for me I hope this is of any help for you Edited January 15, 2016 by Tido 2
wildcat_paris Posted January 4, 2016 Posted January 4, 2016 Thank you Wildcat_paris - but I chat with TK already a couple of months - I know he is not perfect. yep, but a perfectionist and the hell of a benchmark maker What a man!
tkaiser Posted January 4, 2016 Author Posted January 4, 2016 This is not RTFM It's 2016. Using search engines is part of RTFM at least for the last decade. The hddtemp/smartmontools packages in Debian Wheezy are horribly outdated. So what? It's neither possible nor eligible to write instructions covering every single aspect (especially the more advanced like disk temperature where 'trying out' is part of getting it running) but feel free to add notes to this thread and your manual. But if you do so please clarify that this and that helped in your situation and describe this appropriately. So users of Jessie/Ubuntu or any other Debian based distro != Wheezy aren't confused that they do not run into your problems. Thx. This applies already to your suggested 'smartmontools fix' above!
Tido Posted January 5, 2016 Posted January 5, 2016 To let the collection of thermal data survive a reboot it's a good idea to add "/usr/sh this implies that the file is not flushed. To autostart the temperature collecting daemon (sunxi-temp-daemon.sh) at boot, you can add "/usr/share/rpimonitor/scripts/sunxi-temp-daemon.sh &" prior to "exit 0" in the file /etc/rc.local RPi-Monitor Status page This can automatically update every 10sec this works for me. RPi-Monitor Statistics page Tested it in Firefox and Vivaldi, this page does never update, is this intention ?
tkaiser Posted January 7, 2016 Author Posted January 7, 2016 Update: I adjusted the contents of the http://kaiser-edv.de/downloads/sunxi-monitor.tar.gzarchive (MD5 checksum: 6822bcd7fe5cb2403eed9747e7cfff52) in the following way: Now 2 templates exist: /etc/rpimonitor/template/axp209_cpu_pmu_temp.conf /etc/rpimonitor/template/axp209_cpu_pmu_temp_r1.conf The first will be used by default and calculates consumption correctly when being used with Olimex' Lime boards or the Lamobo R1 while running on battery (consumption calculated based on battery voltage read out through sysfs from AXP209 PMU). The axp209_cpu_pmu_temp_r1.conf template should only be used when you're trying to provide DC-IN through the battery connector on the Lamobo R1 (to compensate the crappy DC-IN 'solution' -- this is not necessary when using Olimex' boards). In this case (providing more than 4.2V on the LiPo connector and therefore disabling the charger) the voltage read-out doesn't work and 5V are hardcoded. Therefore nothing changes unless you're an unfortunate Lamobo R1 user since you might need to misuse the battery connector for DC-IN and then have to adjust the contents of /etc/rpimonitor/template/sunxi_axp209.conf to reference axp209_cpu_pmu_temp_r1.conf instead of axp209_cpu_pmu_temp.conf.
PaceyIV Posted January 13, 2016 Posted January 13, 2016 I can't understand what happens today on my OlimexA20 Lime2 board. See the image below, a screenshot of two graphs extracted by RPI-Monitor. I'm using axp209_cpu_pmu_temp.conf so I have this configuration. Voltage PWR in (V) ac_voltage = /sys/devices/platform/sunxi-i2c.0/i2c-0/0-0034/axp20-supplyer.28/power_supply/ac/voltage_now / 1000 Current PWR in (mA) ac_current = /sys/devices/platform/sunxi-i2c.0/i2c-0/0-0034/axp20-supplyer.28/power_supply/ac/current_now / 1000 ac_consumption = ac_voltage * ac_current Voltage USB OTG (V) usb_voltage = /sys/devices/platform/sunxi-i2c.0/i2c-0/0-0034/axp20-supplyer.28/power_supply/usb/voltage_now /1000 Current USB OTG (mA) usb_current = /sys/devices/platform/sunxi-i2c.0/i2c-0/0-0034/axp20-supplyer.28/power_supply/usb/current_now /1000 usb_consumption = usb_voltage * usb_current battery_voltage = /sys/devices/platform/sunxi-i2c.0/i2c-0/0-0034/axp20-supplyer.28/power_supply/battery/voltage_now /1000 battery_current = /sys/devices/platform/sunxi-i2c.0/i2c-0/0-0034/axp20-supplyer.28/power_supply/battery/current_now /1000 Consumption Battery (W) battery_consumption = battery_voltage * battery_current Consumption (W) total_consumption = battery_current * 5 + ac_consumption + usb_consumption I didn't have a power lost today. What means these graphs?
tkaiser Posted January 13, 2016 Author Posted January 13, 2016 @PaceyIV: Can you please elaborate on your setup (power through DC-IN, battery connected or not?) and put the whole contents of axp209_cpu_pmu_temp.conf on eg. pastebin.com and post a link here?
tkaiser Posted January 14, 2016 Author Posted January 14, 2016 total_consumption = battery_current * 5 + ac_consumption + usb_consumption I didn't have a power lost today. What means these graphs? That you're still using the wrong template (the one for Lamobo R1 when DC-IN is supplied through the battery connector). If you use this template when you do NOT mis-use the battery connector then calculations go wrong. That's the reason I provided updated templates a few days ago (and had to fix the statistical display for 'PMU current/voltage' right now to list LiPo Voltage/Current individually instead of a wrong calculated 'Consumption Battery'). These new templates should be used from now on when you're using a A10/A20 board that is also connected to a battery. If you don't use a battery or have a Lamobo R1 that is powered through the battery connector you can stay with the older templates.
PaceyIV Posted January 14, 2016 Posted January 14, 2016 Here my axp209_cpu_pmu_temp.conf http://pastebin.com/SM9exzC8 The board is powered through the 5V DC-IN and the battery is always connected to the board.
Recommended Posts