]> git.ipfire.org Git - ipfire-2.x.git/blobdiff - src/scripts/makegraphs
Graphen gefixt.
[ipfire-2.x.git] / src / scripts / makegraphs
index 9c680a8996cdd5694c0e54396b3cbb1217d36a9a..89159fbb53ecce2ed01fae436fc82c93746b6b0c 100644 (file)
@@ -55,7 +55,7 @@ if ((${Lang::language} eq 'el') ||
 
 # Settings
 my $rrdlog = "/var/log/rrd";
-my $graphs = "/home/httpd/html/graphs";
+my $graphs = "/srv/web/ipfire/html/graphs";
 $ENV{PATH}="/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin";
 my $hdd_device = "/dev/harddisk";
 my $temp = '';
@@ -184,6 +184,47 @@ sub updatecpudata {
 
 }
 
+sub updateloadgraph {
+       my $period    = $_[0];
+
+       RRDs::graph ("$graphs/load-$period.png",
+               "--start", "-1$period", "-aPNG",
+               "-w 600", "-h 100", "-i", "-z", "-l 0", "-r", "--alt-y-grid",
+               "-t Load Average",
+               "--color", "SHADEA#EAE9EE",
+               "--color", "SHADEB#EAE9EE",
+               "--color", "BACK#FFFFFF",
+               "DEF:load1=$rrdlog/load.rrd:load1:AVERAGE",
+               "DEF:load5=$rrdlog/load.rrd:load5:AVERAGE",
+               "DEF:load15=$rrdlog/load.rrd:load15:AVERAGE",
+               "AREA:load1#ff0000:1 Minute, letzter\:",
+               "GPRINT:load1:LAST:%5.2lf\n",
+               "AREA:load5#ff9900:5 Minuten, letzter\:",
+               "GPRINT:load5:LAST:%5.2lf\n",
+               "AREA:load15#ffff00:15 Minuten, letzter\:",
+               "GPRINT:load15:LAST:%5.2lf",
+               "LINE1:load5#ff9900:",
+               "LINE1:load1#ff0000:");
+       $ERROR = RRDs::error;
+       print "Error in RRD::graph for load: $ERROR\n" if $ERROR;
+}
+
+sub updateloaddata {
+       if ( ! -e "$rrdlog/load.rrd") {
+               RRDs::create ("$rrdlog/load.rrd", "--step=60",
+                       "DS:load1:GAUGE:120:0:U",
+                       "DS:load5:GAUGE:120:0:U",
+                       "DS:load15:GAUGE:120:0:U",
+                       "RRA:AVERAGE:0.5:1:2160",
+                       "RRA:AVERAGE:0.5:5:2016",
+                       "RRA:AVERAGE:0.5:15:2880",
+                       "RRA:AVERAGE:0.5:60:8760");
+
+               $ERROR = RRDs::error;
+               print "Error in RRD::create for cpu: $ERROR\n" if $ERROR;
+       }
+}
+
 sub updatememgraph {
        my $period    = $_[0];
 
@@ -859,7 +900,7 @@ sub updatetempgraph
     "--alt-y-grid", "-w 600", "-h 100", "--alt-autoscale",
     "--color", "SHADEA#EAE9EE",
     "--color", "SHADEB#EAE9EE",
-    "--color", "BACK#EAE9EE",
+    "--color", "BACK#FFFFFF",
     "-t $tr{'mbmon temp'} ($tr{'graph per'} $tr{$period})" );
 
   $count = 1;
@@ -899,7 +940,7 @@ sub updatefangraph
     "--alt-y-grid", "-w 600", "-h 100", "--alt-autoscale",
     "--color", "SHADEA#EAE9EE",
     "--color", "SHADEB#EAE9EE",
-    "--color", "BACK#EAE9EE",
+    "--color", "BACK#FFFFFF",
     "-t $tr{'mbmon temp'} ($tr{'graph per'} $tr{$period})" );
 
   $count = 1;
@@ -939,7 +980,7 @@ sub updatevoltgraph
     "--alt-y-grid", "-w 600", "-h 100", "--alt-autoscale",
     "--color", "SHADEA#EAE9EE",
     "--color", "SHADEB#EAE9EE",
-    "--color", "BACK#EAE9EE",
+    "--color", "BACK#FFFFFF",
     "-t $tr{'mbmon temp'} ($tr{'graph per'} $tr{$period})" );
 
   $count = 1;
@@ -979,7 +1020,7 @@ sleep 8;
 ### Squid Graphs
 ###
 if ( -e "/var/log/squid/access.log") {
-       system ("/usr/bin/squid-graph -o=/home/httpd/html/sgraph --tcp-only < /var/log/squid/access.log >/dev/null 2>&1");
+       system ("/usr/bin/squid-graph -o=/srv/web/ipfire/html/sgraph --tcp-only < /var/log/squid/access.log >/dev/null 2>&1");
 }
 
 ###
@@ -1013,6 +1054,12 @@ updatecpugraph ("week");
 updatecpugraph ("month");
 updatecpugraph ("year");
 
+updateloaddata();
+updateloadgraph ("day");
+updateloadgraph ("week");
+updateloadgraph ("month");
+updateloadgraph ("year");
+
 updatememdata();
 updatememgraph ("day");
 updatememgraph ("week");
@@ -1223,6 +1270,6 @@ if ($settings{'CONFIG_TYPE'} =~ /^(4|5|6|7)$/ && -e "$rrdlog/BLUE.rrd") {
        updateifgraph ("BLUE", "year");
 }
 
-system("chmod -R 0777 /home/httpd/html/graphs");
-system("chmod -R 0777 /home/httpd/html/sgraph");
+system("chmod -R 0777 /srv/web/ipfire/html/graphs");
+system("chmod -R 0777 /srv/web/ipfire/html/sgraph");