{"id":2411,"date":"2015-09-21T14:08:18","date_gmt":"2015-09-21T13:08:18","guid":{"rendered":"http:\/\/roboblog.fatal-fury.de\/?p=2411"},"modified":"2015-09-21T14:08:18","modified_gmt":"2015-09-21T13:08:18","slug":"ganglia-lm-sensors","status":"publish","type":"post","link":"http:\/\/roboblog.fatal-fury.de\/?p=2411","title":{"rendered":"ganglia lm-sensors"},"content":{"rendered":"<pre><code>\r\nthomas@H8QGL:~$ cat gmetric-cpu-temp \r\n#!\/bin\/bash\r\n# this script read the core(s) temperature using lm sensors then calculate the average\r\n# and send it to the ganglia using gmetric\r\n# assumes that the lines reported by lm sensors are formated like this\r\n# Core 0: +46.0 C (high = +80.0 C, crit = +100.0 C)\r\n\r\nSENSORS=\/usr\/bin\/sensors\r\nGMETRIC=\/usr\/bin\/gmetric\r\n\r\n#sensors\r\nlet count=0\r\nsum=0.0\r\nfor temp in $($SENSORS | grep temp  |  grep -e '+.*C' | cut -f 2 -d '+'  | sed 's\/\u00b0\/ \/g' | cut -f 1 -d ' '); do\r\n    if (($(echo \"$temp > 1.0\" | bc) ))\r\n    then\r\n      sum=$(echo $sum+$temp | bc);\r\n#    echo $temp, $sum, $count\r\n      let count+=1;\r\n    fi\r\ndone\r\ntemp=$(echo \"scale=1; $sum\/$count\" | bc)\r\n#echo $temp\r\n$GMETRIC -t float -n \"avg temp\" -u \"Celcius\" -v $temp\r\n<\/code><\/pre>\n<p>Fehlerhaftes Original here: http:\/\/computational.engineering.or.id\/LM_Sensors#Integrasi_Dengan_Ganglia<br \/>\nIn meiner Version wird das Grad-Celsius Zeichen rausgefiltert.<br \/>\nEs werden nur echte Temperaturen verrechnet, keine min und max Werte.<br \/>\nFalsche Temperaturen wie z.b. 0.8C werden ignoriert nud erst ab 1Grad verrechnet.<\/p>\n<pre><code>\r\nthomas@H8QGL:~$ cat \/etc\/cron.d\/sensors \r\n* * * * * root \/usr\/local\/bin\/gmetric-cpu-temp \r\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>thomas@H8QGL:~$ cat gmetric-cpu-temp #!\/bin\/bash # this script read the core(s) temperature using lm sensors then calculate the average # and send it to the ganglia using gmetric # assumes that the lines reported by lm sensors are formated like this # Core 0: +46.0 C (high = +80.0 C, crit = +100.0 C) SENSORS=\/usr\/bin\/sensors GMETRIC=\/usr\/bin\/gmetric [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[18],"class_list":["post-2411","post","type-post","status-publish","format-standard","hentry","category-allgemein","tag-linux"],"_links":{"self":[{"href":"http:\/\/roboblog.fatal-fury.de\/index.php?rest_route=\/wp\/v2\/posts\/2411","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/roboblog.fatal-fury.de\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/roboblog.fatal-fury.de\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/roboblog.fatal-fury.de\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/roboblog.fatal-fury.de\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2411"}],"version-history":[{"count":2,"href":"http:\/\/roboblog.fatal-fury.de\/index.php?rest_route=\/wp\/v2\/posts\/2411\/revisions"}],"predecessor-version":[{"id":2413,"href":"http:\/\/roboblog.fatal-fury.de\/index.php?rest_route=\/wp\/v2\/posts\/2411\/revisions\/2413"}],"wp:attachment":[{"href":"http:\/\/roboblog.fatal-fury.de\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2411"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/roboblog.fatal-fury.de\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2411"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/roboblog.fatal-fury.de\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2411"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}