monitors:retmt

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
monitors:retmt [2017/10/18 10:59] – [Server side] wnelismonitors:retmt [2020/01/28 10:22] (current) – [Changelog] wnelis
Line 1: Line 1:
 ====== retmt: RETrieve Machine Temperature ====== ====== retmt: RETrieve Machine Temperature ======
  
-^ Author | [[ wim.nelis@ziggo.nl | Wim Nelis ]] | +^ Author         | [[wim.nelis@ziggo.nl| Wim Nelis ]]  
-^ Compatibility | Xymon 4.2 | +^ Compatibility  | Xymon 4.2                           
-^ Requirements | Perl | +^ Requirements   | Perl                                
-^ Download | None | +^ Download       | None                                
-^ Last Update | 2017-10-18 |+^ Last Update    2020-01-28                          |
  
 ===== Description ===== ===== 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 used to report the temperatures of a switch with 29 temperature sensors.)+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 ===== ===== Installation =====
Line 31: Line 31:
 # #
 # Written by W.J.M. Nelis, wim.nelis@ziggo.nl, 2017.10 # Written by W.J.M. Nelis, wim.nelis@ziggo.nl, 2017.10
 +#
 +# Modified by W.J.M. Nelis, wim.nelis@ziggo.nl, 2018.07
 +# - Specify the device type in the RRD file name, in this case 'cpu'.
 # #
 use strict ; use strict ;
Line 46: Line 49:
 chomp $HostName ; chomp $HostName ;
 my $TestName= 'env' ; # Test name my $TestName= 'env' ; # Test name
-my $ThresholdYellow= 50 ; # Warning threshold [C] +my $ThresholdYellow= 60 ; # Warning threshold [C] 
-my $ThresholdRed   60 ; # Error threshold [C]+my $ThresholdRed   70 ; # Error threshold [C]
  
 my @ColourOf= ( 'red', 'yellow', 'clear', 'green' ) ; my @ColourOf= ( 'red', 'yellow', 'clear', 'green' ) ;
Line 68: Line 71:
  
 # #
-# Issue a message the the logfile. As this script is run periodically by Xymon,+# Issue a message to the logfile. As this script is run periodically by Xymon,
 # StdOut will be redirected to the logfile. # StdOut will be redirected to the logfile.
 # #
Line 102: Line 105:
   $Result= "\"status $HostName.$TestName $Colour $Now\n" .   $Result= "\"status $HostName.$TestName $Colour $Now\n" .
     "<b>Temperature sensor readings</b>\n\n" .     "<b>Temperature sensor readings</b>\n\n" .
-           "$ErrMsg$Result\"\n"+    "$ErrMsg$Result\"\n"
-  `$XySend $XyDisp $Result` ;           # Inform Xymon+  `$XySend $XyDisp $Result` ; # Inform Xymon
  
-  $Result= ''                        # Reset message parameters+  $Result= '' ; # Reset message parameters
   $Colour=  3 ;   $Colour=  3 ;
   $ErrMsg{$_}= [] foreach ( @ColourOf ) ;   $ErrMsg{$_}= [] foreach ( @ColourOf ) ;
Line 137: Line 140:
   @Lines= `$GpuCmd` ; # Retrieve information   @Lines= `$GpuCmd` ; # Retrieve information
   if ( @Lines == 0 ) {   if ( @Lines == 0 ) {
-    push @{$ErrMsg{clear}}, "Cannot read GPU temperature from $GpuCmd:\n" .+    push @{$ErrMsg{clear}}, "Cannot read GPU temperature from \`$GpuCmd\`:\n" .
      "  no data returned" ;      "  no data returned" ;
   } else {   } else {
     chomp $Lines[0] ;     chomp $Lines[0] ;
     unless ( $Lines[0] =~ m/^temp=([\d\.]+).+C$/ ) {     unless ( $Lines[0] =~ m/^temp=([\d\.]+).+C$/ ) {
-      push @{$ErrMsg{clear}}, "Cannot read GPU temperature from $GpuCmd:\n" .+      push @{$ErrMsg{clear}}, "Cannot read GPU temperature from \`$GpuCmd\`:\n" .
        "  unexpected input : $Lines[0]" ;        "  unexpected input : $Lines[0]" ;
     } else {     } else {
Line 209: Line 212:
   $Result.= "<!--DEVMON RRD: env 0 0\n" ;   $Result.= "<!--DEVMON RRD: env 0 0\n" ;
   $Result.= "DS:Temperature:GAUGE:600:-100:100 DS:MinTemp:GAUGE:600:-100:100 DS:MaxTemp:GAUGE:600:-100:100\n" ;   $Result.= "DS:Temperature:GAUGE:600:-100:100 DS:MinTemp:GAUGE:600:-100:100 DS:MaxTemp:GAUGE:600:-100:100\n" ;
-  $Result.= "temp $TempAvg:$TempMin:$TempMax\n" ;+  $Result.= "temp.cpu $TempAvg:$TempMin:$TempMax\n" ;
   $Result.= "-->" ;   $Result.= "-->" ;
 }  # of BuildMessage }  # of BuildMessage
Line 266: Line 269:
 <code> <code>
 # #
-# Graph definitions for test 'env'.+# Graph definition for test 'env'.
 # #
 [env] [env]
- TITLE , temperature  + FNPATTERN ^env\.temp\.(.+)\.rrd$ 
 + TITLE , Temperature  
  YAXIS Temperature [C]  YAXIS Temperature [C]
- -l 0 + DEF:temp@RRDIDX@=@RRDFN@:Temperature:AVERAGE 
- DEF:temp=env.temp.rrd:Temperature:AVERAGE + DEF:tmin@RRDIDX@=@RRDFN@:MinTemp:MIN 
- DEF:tmin=env.temp.rrd:MinTemp:MIN + DEF:tmax@RRDIDX@=@RRDFN@:MaxTemp:MAX 
- DEF:tmax=env.temp.rrd:MaxTemp:MAX + CDEF:trng@RRDIDX@=tmax@RRDIDX@,tmin@RRDIDX@,- 
- CDEF:trng=tmax,tmin,+ LINE1:tmin@RRDIDX@#ffa07a 
- LINE1:tmin#ffa07a + AREA:trng@RRDIDX@#ffa07a::STACK 
- AREA:trng#ffa07a::STACK + LINE1:temp@RRDIDX@#EE0000:@RRDPARAM@ 
- LINE1:temp#EE0000:Average + GPRINT:tmin@RRDIDX@:MIN:Min \: %5.1lf C 
- GPRINT:tmin:MIN:Min \: %5.1lf C + GPRINT:tmax@RRDIDX@:MAX:Max \: %5.1lf C 
- GPRINT:tmax:MAX:Max \: %5.1lf C + GPRINT:temp@RRDIDX@:AVERAGE:Avg \: %5.1lf C 
- GPRINT:temp:AVERAGE:Avg \: %5.1lf C + GPRINT:temp@RRDIDX@:LAST:Cur \: %5.1lf C\n
- GPRINT:temp:LAST:Cur \: %5.1lf C\n+
 </code> </code>
  
Line 292: Line 295:
 </code> </code>
  
- 
-===== Source ===== 
- 
-===== Known  Bugs and Issues ===== 
- 
-===== To Do ===== 
- 
-===== Credits ===== 
  
 ===== Changelog ===== ===== Changelog =====
Line 305: Line 300:
   * **2017-10-18**   * **2017-10-18**
     * Initial release     * Initial release
 +  * **2020-01-28**
 +    * Include 'cpu' in the name of the RRD, change graph definition accordingly.
  
  • monitors/retmt.txt
  • Last modified: 2020/01/28 10:22
  • by wnelis