retmt: RETrieve Machine Temperature
Author | Wim Nelis |
---|---|
Compatibility | Xymon 4.2 |
Requirements | Perl |
Download | None |
Last Update | 2020-01-28 |
Description
This client-side script retrieves the CPU and GPU temperatures of a Raspberry Pi 3 and reports them to the xymon server. A rather generic way of reporting the values is used, in which the minimum, the maximum and the average temperature are reported. The graph shows the range of the temperatures (a 100% confidence interval) and the average of the temperatures. (This method is usable for an arbitrary number of temperature sensors. It is also used to report the temperatures of a switch with 29 temperature sensors.)
Installation
At the client side the script and the invocation of the script need to be installed. On the server side an extension of the RRD definitions, an extension of the graph definitions and a configuration of this test in xymon server are needed.
Client side
The script, written in Perl, is installed in (copied to) file ~xymon/client/ext/retmt.pl, typically /usr/lib/xymon/client/ext/retmt.pl.
retmt.pl
Script retmt.pl is invoked once every 5 minutes. This is configured by copying the snippet below to file ~xymon/client/etc/clientlaunch.d/retmt.cfg and restarting the xymon client.
# # Test retmt retrieves the temperatures of this machine. # [retmt] ENVFILE $XYMONCLIENTHOME/etc/xymonclient.cfg CMD $XYMONCLIENTHOME/ext/retmt.pl LOGFILE $XYMONCLIENTLOGS/retmt.log INTERVAL 5m
Server side
Before any data is captured in an RRD, the definition of the RRD needed for this monitor needs to be installed. Add the snippet below to file ~xymon/server/etc/rrddefinitions.cfg, somewhere before the default setup.
# Definition for the measurement of the environmental temperature(s). # Besides the average the minimum and the maximum are measured, and # thus the MIN and MAX consolidation functions are needed too. [env] RRA:AVERAGE:0.5:1:576 RRA:AVERAGE:0.5:6:576 RRA:AVERAGE:0.5:24:576 RRA:AVERAGE:0.5:288:576 RRA:MIN:0.5:1:576 RRA:MIN:0.5:6:576 RRA:MIN:0.5:24:576 RRA:MIN:0.5:288:576 RRA:MAX:0.5:1:576 RRA:MAX:0.5:6:576 RRA:MAX:0.5:24:576 RRA:MAX:0.5:288:576
Next the graph definition shown below is saved in file ~xymon/server/etc/graphs.d/graphs.retmt.cfg.
# # Graph definition for test 'env'. # [env] FNPATTERN ^env\.temp\.(.+)\.rrd$ TITLE , Temperature YAXIS Temperature [C] DEF:temp@RRDIDX@=@RRDFN@:Temperature:AVERAGE DEF:tmin@RRDIDX@=@RRDFN@:MinTemp:MIN DEF:tmax@RRDIDX@=@RRDFN@:MaxTemp:MAX CDEF:trng@RRDIDX@=tmax@RRDIDX@,tmin@RRDIDX@,- LINE1:tmin@RRDIDX@#ffa07a AREA:trng@RRDIDX@#ffa07a::STACK LINE1:temp@RRDIDX@#EE0000:@RRDPARAM@ GPRINT:tmin@RRDIDX@:MIN:Min \: %5.1lf C GPRINT:tmax@RRDIDX@:MAX:Max \: %5.1lf C GPRINT:temp@RRDIDX@:AVERAGE:Avg \: %5.1lf C GPRINT:temp@RRDIDX@:LAST:Cur \: %5.1lf C\n
The definition file xymonserver.cfg is extended by copying the snippet below to file ~xymon/server/etc/xymonserver.d/env.cfg. It specifies that the status message for test named 'env' uses the DEVMON format to pass measurements.
TEST2RRD+=",env=devmon" GRAPHS+=",env"
Changelog
- 2017-10-18
- Initial release
- 2020-01-28
- Include 'cpu' in the name of the RRD, change graph definition accordingly.