[Git][NTPsec/ntpsec][master] Deleted 1 commit: Add temper-temp-log. Change all temp log formats.

Gary E. Miller gitlab at mg.gitlab.com
Fri Aug 19 18:03:25 UTC 2016


Gary E. Miller pushed to branch master at NTPsec / ntpsec


WARNING: The push did not contain any new commits, but force pushed to delete the commits and changes below.


Deleted commits:
9a9d2c4b by Gary E. Miller at 2016-08-19T11:03:10-07:00
Add temper-temp-log.  Change all temp log formats.

Later all the temp stats will just dump into one file, instead of
two.

All three seem to work fine.

- - - - -


5 changed files:

- contrib/README
- contrib/cpu-temp-log
- contrib/pi-temp-log
- + contrib/temper-temp-log
- ntpstats/ntpviz


Changes:

=====================================
contrib/README
=====================================
--- a/contrib/README
+++ b/contrib/README
@@ -3,9 +3,14 @@ conveniences, examples or rudimetary starting points for other development
 efforts.
 
 cpu-temp-log is a tool to use the output of 'sensors -u' and write the
-motherboard temperatures to stdout.  Usefull to create a log that can be used
+motherboard temperatures to stdout.  Useful to create a log that can be used
 by 'ntpviz --local-cpu-temp'
 
 pi-temp-log for the Raspberry Pi.  It is a tool to read a magic /sys file
-to get the CPU temperature and write the temperatures to stdout.  Usefull
+to get the CPU temperature and write the temperatures to stdout.  Useful
 to create a log that can be used by 'ntpviz --local-cpu-temp'
+
+temper-temp-log for TEMPer USB thermometer.  Useful for logging room
+temperature.  This reads the thermometer using the temper-python command
+line utility and writes the temperatures to stdout.  Useful to create a
+og that can be used by 'ntpviz --local-cpu-temp'


=====================================
contrib/cpu-temp-log
=====================================
--- a/contrib/cpu-temp-log
+++ b/contrib/cpu-temp-log
@@ -14,16 +14,17 @@ on your lm_sensors configuration and your motherboard.
 
 Sample log from an Supermicro Quad Core Xeon:
 
-1471573103 37.000 35.000 31.000 31.000 30.000
-1471573104 37.000 35.000 30.000 31.000 29.000
-1471573105 37.000 35.000 30.000 31.000 29.000
+1471573103 LM 37.000 35.000 31.000 31.000 30.000
+1471573104 LM 37.000 35.000 30.000 31.000 29.000
+1471573105 LM 37.000 35.000 30.000 31.000 29.000
 
 Field 1: unix UTC time in seconds
-Field 2: North Bridge temperature in degrees C
-Field 3: CPU0 temperature in degrees C
-Field 4: CPU1 temperature in degrees C
-Field 5: CPU2 temperature in degrees C
-Field 6: CPU3 temperature in degrees C
+Field 2: Log source (LM)
+Field 3: North Bridge temperature in degrees C
+Field 4: CPU0 temperature in degrees C
+Field 5: CPU1 temperature in degrees C
+Field 6: CPU2 temperature in degrees C
+Field 7: CPU3 temperature in degrees C
 
 Sample crontab usage:
 
@@ -36,7 +37,7 @@ temperatures will be hardware specific.
 """
 
 
-import sys, re, time, subprocess
+import sys,  re, time, subprocess
 
 output = subprocess.check_output(["sensors", "-u"], universal_newlines=True)
 
@@ -45,13 +46,13 @@ lines = output.split( '\n' )
 pat = re.compile('^\s+temp\d+_input:\s+([\d\.]+).*$')
 
 now = int(time.time())
-sys.stdout.write(  str(now) )
+sys.stdout.write( str(now) + ' LM')
 
 #lines = sys.stdin.readlines()
 line = ''
 for line in lines:
     match = pat.match( line )
     if match and match.group(1):
-        sys.stdout.write(  ' ' + match.group(1) )
+        sys.stdout.write(' ' + match.group(1))
 
-sys.stdout.write(  '\n' )
+sys.stdout.write( '\n' )


=====================================
contrib/pi-temp-log
=====================================
--- a/contrib/pi-temp-log
+++ b/contrib/pi-temp-log
@@ -10,14 +10,15 @@ preceeded by the unix UTC time in seconds.
 
 Sample log:
 
-1471582083 56.92
-1471582084 57.458
-1471582085 56.92
-1471582086 56.92
+1471582083 PI 56.92
+1471582084 PI 57.458
+1471582085 PI 56.92
+1471582086 PI 56.92
 
 
 Field 1: unix UTC time in seconds
-Field 2: CPU Temerature
+Field 2: Loug source (PI)
+Field 3: CPU Temerature
 
 Sample crontab usage:
 
@@ -29,11 +30,9 @@ to read your system temperatures will be hardware specific.
 
 """
 
-
-import sys, time
+import time
 
 now = int(time.time())
-sys.stdout.write(  str(now) )
 
 f = open( '/sys/class/thermal/thermal_zone0/temp', 'r')
 for line in f:
@@ -44,4 +43,4 @@ f.close()
 
 temp /= 1000
 
-sys.stdout.write(  ' ' + str(temp) + '\n' )
+print str(now) + ' PI ' + str(temp)


=====================================
contrib/temper-temp-log
=====================================
--- /dev/null
+++ b/contrib/temper-temp-log
@@ -0,0 +1,39 @@
+#!/usr/bin/env python
+# coding: utf-8
+"""\
+Usage: temper-temper-log
+
+Reads 'temper-poll -c' for room temperature data.  Writes the temperature
+found to stdout on one line, preceeded by the unix UTC time in seconds
+and the Log source ID.
+
+Before you can use this utility you must have a TEMPer USB thermometer
+plugged in, and the temper-python package must be installed and configured.
+See their documentation for that procedure.
+
+Sample log from a TEMPer:
+
+1471573103 TEMPER 37.000
+1471573104 TEMPER 37.000
+1471573105 TEMPER 37.000
+
+Field 1: unix UTC time in seconds
+Field 1: Log source (TEMPER)
+Field 3: CPU temperature in degrees C
+
+Sample crontab usage:
+
+# take and log cpu temp every 5 mins
+*/5 * * * * /usr/local/sbin/temper-temp-log >> /var/log/ntpstats/cputemp
+
+"""
+
+
+import re, time, subprocess
+
+output = subprocess.check_output(["temper-poll", "-c"], universal_newlines=True)
+
+now = int(time.time())
+
+temp = float( output )
+print str(now) + ' TEMPER ' + str(temp)


=====================================
ntpstats/ntpviz
=====================================
--- a/ntpstats/ntpviz
+++ b/ntpstats/ntpviz
@@ -81,7 +81,7 @@ set title "%(sitename)s: Local CPU Temp"
 set ytics format "@1.1f °C" nomirror textcolor rgb '#0060ad'
 set style line 1 lc rgb '#0060ad' lt 1 lw 1 pt 7 ps 0   # --- blue
 plot \
- "-" using 1:($2) title "CPU temp" with linespoints ls 1
+ "-" using 1:($3) title "CPU temp" with linespoints ls 1
 """ % locals()
         return plot_template.replace('@', '%')  \
             + "".join(lines)



View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/9a9d2c4bfabb85cda329a00c290b20a947d9f183
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ntpsec.org/pipermail/vc/attachments/20160819/1ff84eb3/attachment.html>


More information about the vc mailing list