Created
June 2, 2014 05:58
-
-
Save informationsea/7498a2fbc3a4bdc0e9bf to your computer and use it in GitHub Desktop.
Munin temp script for OS X (works with https://github.com/informationsea/smc)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
use strict; | |
use warnings; | |
use utf8; | |
my $SMC_RESULT=`/usr/local/bin/smc -t`; | |
my $COUNTER = 0; | |
if (@ARGV == 1 && $ARGV[0] eq "config") { | |
print <<__END__; | |
graph_title Temperature | |
graph_info Temperature | |
graph_vlabel degrees Celsius | |
graph_args --base 1000 -l 0 | |
graph_category sensors | |
__END__ | |
} | |
foreach my $one (split(/\n/, $SMC_RESULT)) { | |
$one =~ /\s+([\w\s\d]+) : ([\d\.]+)/; | |
if (@ARGV == 1 && $ARGV[0] eq "config") { | |
print "temp${COUNTER}.label $1\n"; | |
} | |
if (@ARGV == 0) { | |
print "temp${COUNTER}.value $2\n"; | |
} | |
$COUNTER += 1 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment