[Git][NTPsec/ntpsec][master] Deleted 2 commits: Create a contrib/ directory for random stuff.

Gary E. Miller gitlab at mg.gitlab.com
Thu Aug 18 20:07:20 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:
b31e98c4 by Gary E. Miller at 2016-08-18T13:01:27-07:00
Create a contrib/ directory for random stuff.

- - - - -
75259a56 by Gary E. Miller at 2016-08-18T13:06:09-07:00
Add cpu-temp-log to contrib/

This tool uses 'sensors -u' to log motherboard temperatures.

- - - - -


3 changed files:

- README
- + contrib/README
- + contrib/cpu-temp-log


Changes:

=====================================
README
=====================================
--- a/README
+++ b/README
@@ -23,6 +23,8 @@ README::	This file.
 
 VERSION::	The version stamp, to be used by scripts and programs.
 
+contrib/::	Directory containing contributed scripts, dragons dwell here.
+
 devel/::	Documentation aimed at developers.
 
 docs/::		Directory containing a complete set of documentation on


=====================================
contrib/README
=====================================
--- /dev/null
+++ b/contrib/README
@@ -0,0 +1,7 @@
+The following tools are not production-ready. They are included only as
+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
+by 'ntpviz --local-cpu-temp'


=====================================
contrib/cpu-temp-log
=====================================
--- /dev/null
+++ b/contrib/cpu-temp-log
@@ -0,0 +1,57 @@
+#!/usr/bin/env python
+# coding: utf-8
+"""\
+Usage: cpu-temper-log
+
+Reads 'sensors -u' for temperature data.  Writes all temperatures
+found to stdout on one line, preceeded by the unix UTC time in seconds.
+
+Before you can use this utility lm_sensors must be installed and
+configured.  See their documentation for that procedure.
+
+How many temperatures, which temeratures and in which order will depend
+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
+
+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
+
+Sample crontab usage:
+
+# take and log cpu temp every 5 mins
+*/5 * * * * /usr/local/sbin/cpu-temp-log >> /var/log/ntpstats/cputemp
+
+This file is only useful as a template.  The way to read your system
+temperatures will be hardware specific.
+
+"""
+
+
+import sys, re, datetime, subprocess
+
+output = subprocess.check_output(["sensors", "-u"], universal_newlines=True)
+
+lines = output.split( '\n' )
+
+pat = re.compile('^\s+temp\d+_input:\s+([\d\.]+).*$')
+
+now = datetime.datetime.utcnow()
+sys.stdout.write(  now.strftime("%s") )
+
+#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(  '\n' )



View it on GitLab: https://gitlab.com/NTPsec/ntpsec/compare/e1ea8680d292135c73c71e0337d25f892847c7de...75259a560217e74693ef022d97f3bf6e438154e9
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ntpsec.org/pipermail/vc/attachments/20160818/816bb6ef/attachment.html>


More information about the vc mailing list