mirror of
https://github.com/vincentmli/bpfire.git
synced 2026-04-19 15:32:59 +02:00
Add ACPI Thermal Zone support
This commit is contained in:
@@ -1039,6 +1039,97 @@ sub updatecpufreqgraph {
|
||||
print "Error in RRD::graph for cpu freq: ".$ERROR."\n" if $ERROR;
|
||||
}
|
||||
|
||||
# Generate the Thermal Zone Temp CPU Graph
|
||||
|
||||
sub updatethermaltempgraph {
|
||||
my $thermalcount = `ls -dA $mainsettings{'RRDLOG'}/collectd/localhost/thermal-thermal_zone* | wc -l`;
|
||||
my $period = $_[0];
|
||||
my @command = (
|
||||
"-",
|
||||
"--start",
|
||||
"-1".$period,
|
||||
"-aPNG",
|
||||
"-i",
|
||||
"-z",
|
||||
"-W www.ipfire.org",
|
||||
"--alt-y-grid",
|
||||
"-w 600",
|
||||
"-h 125",
|
||||
"-l 0",
|
||||
"-r",
|
||||
"-t "."ACPI Thermal-Zone Temperature"." ".$Lang::tr{$period},
|
||||
"-v Grad Celsius",
|
||||
"--color=SHADEA".$color{"color19"},
|
||||
"--color=SHADEB".$color{"color19"},
|
||||
"--color=BACK".$color{"color21"},
|
||||
"COMMENT:".sprintf("%-15s",$Lang::tr{'caption'}),
|
||||
"COMMENT:".sprintf("%15s",$Lang::tr{'maximal'}),
|
||||
"COMMENT:".sprintf("%15s",$Lang::tr{'average'}),
|
||||
"COMMENT:".sprintf("%15s",$Lang::tr{'minimal'}),
|
||||
"COMMENT:".sprintf("%15s",$Lang::tr{'current'})."\\j"
|
||||
);
|
||||
|
||||
for(my $i = 0; $i < $thermalcount; $i++) {
|
||||
my $j=$i+1;
|
||||
push(@command,"DEF:temp".$i."_=".$mainsettings{'RRDLOG'}."/collectd/localhost/thermal-thermal_zone".$i."/temperature-temperature.rrd:value:AVERAGE"
|
||||
,"CDEF:temp".$i."=temp".$i."_,1,/"
|
||||
,"LINE1:temp".$i.$color{"color1$j"}."A0:Temp ".$i." "
|
||||
,"GPRINT:temp".$i.":MAX:%3.0lf Grad C"
|
||||
,"GPRINT:temp".$i.":AVERAGE:%3.0lf Grad C"
|
||||
,"GPRINT:temp".$i.":MIN:%3.0lf Grad C"
|
||||
,"GPRINT:temp".$i.":LAST:%3.0lf Grad C\\j");
|
||||
}
|
||||
|
||||
RRDs::graph (@command);
|
||||
$ERROR = RRDs::error;
|
||||
print "Error in RRD::graph for thermal temp: ".$ERROR."\n" if $ERROR;
|
||||
}
|
||||
|
||||
sub updatethermalcoolinggraph {
|
||||
my $thermalcount = `ls -dA $mainsettings{'RRDLOG'}/collectd/localhost/thermal-cooling_device* | wc -l`;
|
||||
my $period = $_[0];
|
||||
my @command = (
|
||||
"-",
|
||||
"--start",
|
||||
"-1".$period,
|
||||
"-aPNG",
|
||||
"-i",
|
||||
"-z",
|
||||
"-W www.ipfire.org",
|
||||
"--alt-y-grid",
|
||||
"-w 600",
|
||||
"-h 125",
|
||||
"-l 0",
|
||||
"-r",
|
||||
"-t "."ACPI Thermal-Zone Cooling Device"." ".$Lang::tr{$period},
|
||||
"-v State",
|
||||
"--color=SHADEA".$color{"color19"},
|
||||
"--color=SHADEB".$color{"color19"},
|
||||
"--color=BACK".$color{"color21"},
|
||||
"COMMENT:".sprintf("%-15s",$Lang::tr{'caption'}),
|
||||
"COMMENT:".sprintf("%15s",$Lang::tr{'maximal'}),
|
||||
"COMMENT:".sprintf("%15s",$Lang::tr{'average'}),
|
||||
"COMMENT:".sprintf("%15s",$Lang::tr{'minimal'}),
|
||||
"COMMENT:".sprintf("%15s",$Lang::tr{'current'})."\\j"
|
||||
);
|
||||
|
||||
for(my $i = 0; $i < $thermalcount; $i++) {
|
||||
my $j=$i+1;
|
||||
push(@command,"DEF:cooling".$i."_=".$mainsettings{'RRDLOG'}."/collectd/localhost/thermal-cooling_device".$i."/gauge-cooling_state.rrd:value:AVERAGE"
|
||||
,"CDEF:cooling".$i."=cooling".$i."_,1,/"
|
||||
,"LINE1:cooling".$i.$color{"color1$j"}."A0:cooling ".$i." "
|
||||
,"GPRINT:cooling".$i.":MAX:%3.0lf"
|
||||
,"GPRINT:cooling".$i.":AVERAGE:%3.0lf"
|
||||
,"GPRINT:cooling".$i.":MIN:%3.0lf"
|
||||
,"GPRINT:cooling".$i.":LAST:%3.0lf\\j");
|
||||
}
|
||||
|
||||
RRDs::graph (@command);
|
||||
$ERROR = RRDs::error;
|
||||
print "Error in RRD::graph for thermal cooling: ".$ERROR."\n" if $ERROR;
|
||||
}
|
||||
|
||||
|
||||
# Generate a random color, used by Qos Graph to be independent from the amount of values
|
||||
|
||||
sub random_hex_color {
|
||||
|
||||
@@ -25,6 +25,7 @@ LoadPlugin processes
|
||||
LoadPlugin rrdtool
|
||||
LoadPlugin sensors
|
||||
LoadPlugin swap
|
||||
LoadPlugin thermal
|
||||
LoadPlugin syslog
|
||||
#LoadPlugin wireless
|
||||
|
||||
|
||||
@@ -63,6 +63,14 @@ if ( $querry[0] =~ "hwtemp"){
|
||||
print "Content-type: image/png\n\n";
|
||||
binmode(STDOUT);
|
||||
&Graphs::updatehwvoltgraph($querry[1]);
|
||||
}elsif ( $querry[0] =~ "thermaltemp"){
|
||||
print "Content-type: image/png\n\n";
|
||||
binmode(STDOUT);
|
||||
&Graphs::updatethermaltempgraph($querry[1]);
|
||||
}elsif ( $querry[0] =~ "thermalcooling"){
|
||||
print "Content-type: image/png\n\n";
|
||||
binmode(STDOUT);
|
||||
&Graphs::updatethermalcoolinggraph($querry[1]);
|
||||
}elsif ( $querry[0] =~ "sd?" || $querry[0] =~ "hd?" ){
|
||||
print "Content-type: image/png\n\n";
|
||||
binmode(STDOUT);
|
||||
@@ -97,20 +105,33 @@ if ( $querry[0] =~ "hwtemp"){
|
||||
&Header::closebox();
|
||||
}
|
||||
|
||||
&Header::openbox('100%', 'center', "hwtemp $Lang::tr{'graph'}");
|
||||
&Graphs::makegraphbox("hardwaregraphs.cgi","hwtemp","day");
|
||||
&Header::closebox();
|
||||
if ( `ls $mainsettings{'RRDLOG'}/collectd/localhost/thermal-thermal_zone*` ) {
|
||||
&Header::openbox('100%', 'center', "ACPI Thermal-Zone Temp $Lang::tr{'graph'}");
|
||||
&Graphs::makegraphbox("hardwaregraphs.cgi","thermaltemp","day");
|
||||
&Header::closebox();
|
||||
}
|
||||
|
||||
&Header::openbox('100%', 'center', "hwfan $Lang::tr{'graph'}");
|
||||
&Graphs::makegraphbox("hardwaregraphs.cgi","hwfan","day");
|
||||
&Header::closebox();
|
||||
if ( `ls $mainsettings{'RRDLOG'}/collectd/localhost/thermal-thermal_zone*` ) {
|
||||
&Header::openbox('100%', 'center', "ACPI Thermal-Zone Cooling $Lang::tr{'graph'}");
|
||||
&Graphs::makegraphbox("hardwaregraphs.cgi","thermalcooling","day");
|
||||
&Header::closebox();
|
||||
}
|
||||
|
||||
&Header::openbox('100%', 'center', "hwvolt $Lang::tr{'graph'}");
|
||||
&Graphs::makegraphbox("hardwaregraphs.cgi","hwvolt","day","375");
|
||||
&Header::closebox();
|
||||
if ( `ls $mainsettings{'RRDLOG'}/collectd/localhost/sonsors-*` ) {
|
||||
&Header::openbox('100%', 'center', "hwtemp $Lang::tr{'graph'}");
|
||||
&Graphs::makegraphbox("hardwaregraphs.cgi","hwtemp","day");
|
||||
&Header::closebox();
|
||||
|
||||
sensorsbox();
|
||||
&Header::openbox('100%', 'center', "hwfan $Lang::tr{'graph'}");
|
||||
&Graphs::makegraphbox("hardwaregraphs.cgi","hwfan","day");
|
||||
&Header::closebox();
|
||||
|
||||
&Header::openbox('100%', 'center', "hwvolt $Lang::tr{'graph'}");
|
||||
&Graphs::makegraphbox("hardwaregraphs.cgi","hwvolt","day","375");
|
||||
&Header::closebox();
|
||||
|
||||
sensorsbox();
|
||||
}
|
||||
&Header::closebigbox();
|
||||
&Header::closepage();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user