]> git.ipfire.org Git - people/teissler/ipfire-2.x.git/blobdiff - config/cfgroot/graphs.pl
Add an entropy graph.
[people/teissler/ipfire-2.x.git] / config / cfgroot / graphs.pl
index 19c0546da2d3d16bcffdd17f4da7ccefece452b6..a0df5c07d93188cd0b1ed3eeaffce5dade3a32c8 100644 (file)
@@ -1114,3 +1114,38 @@ sub getprocesses {
        my @processesgraph = `ls -dA $mainsettings{'RRDLOG'}/collectd/localhost/processes-*/ 2>/dev/null`;
        return @processesgraph;
 }
+
+sub updateentropygraph {
+       my $period    = $_[0];
+       my @command = (
+               "-",
+               "--start",
+               "-1".$period,
+               "-aPNG",
+               "-i",
+               "-z",
+               "-W www.ipfire.org",
+               "--alt-y-grid",
+               "-w 600",
+               "-h 225",
+               "-r",
+               "--lower-limit","0",
+               "-t $Lang::tr{'entropy'}",
+               "-v $Lang::tr{'bit'}",
+               "DEF:entropy=$mainsettings{'RRDLOG'}/collectd/localhost/entropy/entropy.rrd:entropy:AVERAGE",
+               "CDEF:entropytrend=entropy,43200,TREND",
+               "LINE3:entropy#ff0000:" . sprintf("%-15s", $Lang::tr{'entropy'}),
+               "VDEF:entrmin=entropy,MINIMUM",
+               "VDEF:entrmax=entropy,MAXIMUM",
+               "VDEF:entravg=entropy,AVERAGE",
+               "GPRINT:entrmax:" . sprintf("%12s\\: %%5.0lf", $Lang::tr{'maximum'}),
+               "GPRINT:entrmin:" . sprintf("%12s\\: %%5.0lf", $Lang::tr{'minimum'}),
+               "GPRINT:entravg:" . sprintf("%12s\\: %%5.0lf", $Lang::tr{'average'}) . "\\n",
+               "LINE3:entropytrend#000000",
+       );
+
+       RRDs::graph (@command);
+       $ERROR = RRDs::error;
+
+       print "Error in RRD::graph for entropy: ".$ERROR."\n" if $ERROR;
+}