- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
#!/usr/bin/perl
#
# Plugin to monitor thermal sensors inside ThinkPad
#
# Origional Author: Kamen Naydenov @pau4o
# Contributors:
#
#
use warnings;
use strict;
if ($ARGV[0] and $ARGV[0] eq "autoconf")
{
if (-r "/proc/acpi/ibm/thermal")
{
print "yes\n";
exit 0;
}
else
{
print "/proc/acpi/ibm/thermal not found\n You must load ibm_acpi kernel module\n";
exit 1;
}
}
my ($i, $val, @sensors, @values);
@sensors=qw/CPU MiniPCI HDD GPU Bat0 Na0 Bat1 Na1/;
$val=qx|cat /proc/acpi/ibm/thermal|;
if ($ARGV[0] and $ARGV[0] eq "config")
{
print "graph_args --base 1000 -l 0 --vertical-label Temp\n";
print "graph_title Some temperatures in ThinkPad\n";
print "graph_category sensors\n";
print "graph_info There is some themperatures detected by ibm_acpi kernel module. The location of sensors may vary on other models (these are for R51)\n";
print "graph_order @sensors\n";
print "graph_scale off\n";
for (@sensors) {
print "$_.label $_\n";
print "$_.info Temperature near $_\n";
print "$_.max 100\n";
}
exit 0;
}
@values=split(/:|\s+/,$val);
shift @values;
shift @values;
for ($i=0; $i <= 7; $i++) {
if ($values[$i]=~/^-(\d*)$/) {
print "$sensors[$i].value $1\n";
} else {
print "$sensors[$i].value $values[$i]\n";
}
}
Комментарии (0) RSS
Добавить комментарий