#use warnings;
#use CGI::Carp 'fatalsToBrowser';
-require 'CONFIG_ROOT/general-functions.pl';
+require '/var/ipfire/general-functions.pl';
require "${General::swroot}/lang.pl";
require "${General::swroot}/header.pl";
&Header::showhttpheaders();
-my $graphdir = "/home/httpd/html/graphs";
+my $graphdir = "/srv/web/ipfire/html/graphs";
&General::readhash("${General::swroot}/ethernet/settings", \%netsettings);
$ENV{'QUERY_STRING'} =~ s/&//g;
} else {
&Header::openpage($Lang::tr{'system graphs'}, 1, '');
}
+
+sub diskbox {
+ my $disk = $_[0];
+ if (-e "$graphdir/disk-$disk-day.png") {
+
+ &Header::openbox('100%', 'center', "Disk /dev/$disk $Lang::tr{'graph'}");
+ my $ftime = localtime((stat("$graphdir/disk-$disk-day.png"))[9]);
+ print "<center><b>$Lang::tr{'the statistics were last updated at'}: $ftime</b></center><br />\n";
+ print "<a href='/cgi-bin/graphs.cgi?graph=disk-$disk'>";
+ print "<img alt='' src='/graphs/disk-$disk-day.png' border='0' />";
+ print "</a>";
+ print "<br />\n";
+ if (-e "/usr/local/bin/hddshutdown-state") {
+ system("/usr/local/bin/hddshutdown-state $disk");
+ }
+ &Header::closebox();
+ }
+}
+
&Header::openbigbox('100%', 'left');
-if ($cgigraphs[1] =~ /(GREEN|BLUE|ORANGE|RED|lq|cpu|memory|swap|disk)/) {
+if ($cgigraphs[1] =~ /(GREEN|BLUE|ORANGE|RED|lq|cpu|memory|swap|disk|load)/) {
my $graph = $cgigraphs[1];
my $graphname = ucfirst(lc($cgigraphs[1]));
&Header::openbox('100%', 'center', "$graphname $Lang::tr{'graph'}");
my $ftime = localtime((stat("$graphdir/${graph}-day.png"))[9]);
print "<center>";
print "<b>$Lang::tr{'the statistics were last updated at'}: $ftime</b></center><br /><hr />\n";
- print "<img src='/graphs/${graph}-day.png' border='0' /><hr />";
- print "<img src='/graphs/${graph}-week.png' border='0' /><hr />";
- print "<img src='/graphs/${graph}-month.png' border='0' /><hr />";
- print "<img src='/graphs/${graph}-year.png' border='0' />";
+ print "<img alt='' src='/graphs/${graph}-day.png' border='0' /><hr />";
+ print "<img alt='' src='/graphs/${graph}-week.png' border='0' /><hr />";
+ print "<img alt='' src='/graphs/${graph}-month.png' border='0' /><hr />";
+ print "<img alt='' src='/graphs/${graph}-year.png' border='0' />";
} else {
print $Lang::tr{'no information available'};
}
my $ftime = localtime((stat("$graphdir/${graphname}-day.png"))[9]);
print "<center><b>$Lang::tr{'the statistics were last updated at'}: $ftime</b></center><br />\n";
print "<a href='/cgi-bin/graphs.cgi?graph=$graphname'>";
- print "<img src='/graphs/${graphname}-day.png' border='0' />";
+ print "<img alt='' src='/graphs/${graphname}-day.png' border='0' />";
print "</a>";
} else {
print $Lang::tr{'no information available'};
my $ftime = localtime((stat("$graphdir/cpu-day.png"))[9]);
print "<center><b>$Lang::tr{'the statistics were last updated at'}: $ftime</b></center><br />\n";
print "<a href='/cgi-bin/graphs.cgi?graph=cpu'>";
- print "<img src='/graphs/cpu-day.png' border='0' />";
+ print "<img alt='' src='/graphs/cpu-day.png' border='0' />";
+ print "</a>";
+ } else {
+ print $Lang::tr{'no information available'};
+ }
+ print "<br />\n";
+ &Header::closebox();
+
+ &Header::openbox('100%', 'center', "Load $Lang::tr{'graph'}");
+ if (-e "$graphdir/load-day.png") {
+ my $ftime = localtime((stat("$graphdir/load-day.png"))[9]);
+ print "<center><b>$Lang::tr{'the statistics were last updated at'}: $ftime</b></center><br />\n";
+ print "<a href='/cgi-bin/graphs.cgi?graph=load'>";
+ print "<img alt='' src='/graphs/load-day.png' border='0' />";
print "</a>";
} else {
print $Lang::tr{'no information available'};
my $ftime = localtime((stat("$graphdir/memory-day.png"))[9]);
print "<center><b>$Lang::tr{'the statistics were last updated at'}: $ftime</b></center><br />\n";
print "<a href='/cgi-bin/graphs.cgi?graph=memory'>";
- print "<img src='/graphs/memory-day.png' border='0' />";
+ print "<img alt='' src='/graphs/memory-day.png' border='0' />";
print "</a>";
} else {
print $Lang::tr{'no information available'};
my $ftime = localtime((stat("$graphdir/swap-day.png"))[9]);
print "<center><b>$Lang::tr{'the statistics were last updated at'}: $ftime</b></center><br />\n";
print "<a href='/cgi-bin/graphs.cgi?graph=swap'>";
- print "<img src='/graphs/swap-day.png' border='0' />";
+ print "<img alt='' src='/graphs/swap-day.png' border='0' />";
print "</a>";
} else {
print $Lang::tr{'no information available'};
my $ftime = localtime((stat("$graphdir/disk-day.png"))[9]);
print "<center><b>$Lang::tr{'the statistics were last updated at'}: $ftime</b></center><br />\n";
print "<a href='/cgi-bin/graphs.cgi?graph=disk'>";
- print "<img src='/graphs/disk-day.png' border='0' />";
+ print "<img alt='' src='/graphs/disk-day.png' border='0' />";
print "</a>";
} else {
print $Lang::tr{'no information available'};
}
print "<br />\n";
&Header::closebox();
+
+ diskbox("hda");
+ diskbox("hdb");
+ diskbox("hdc");
+ diskbox("hdd");
+ diskbox("hde");
+ diskbox("hdf");
+ diskbox("hdg");
+ diskbox("hdh");
}
&Header::closebigbox();