mirror of
https://github.com/stylersnico/librenms.git
synced 2026-07-28 08:02:41 +02:00
Major updates on the road to 0.7
git-svn-id: http://www.observium.org/svn/observer/trunk@492 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
+31
-69
@@ -3,7 +3,6 @@
|
||||
function mailerrorgraphUnix ($rrd, $graph, $from, $to, $width, $height, $title, $vertical) {
|
||||
global $config, $installdir;
|
||||
$database = $config['rrd_dir'] . "/" . $rrd;
|
||||
$imgfile = "graphs/" . "$graph";
|
||||
$period = $to - $from;
|
||||
$options = "--alt-autoscale-max -E --start $from --end $to --width $width --height $height ";
|
||||
if($width <= "300") { $options .= " --font LEGEND:7:".$config['mono_font']." --font AXIS:6:".$config['mono_font']." --font-render-mode normal "; }
|
||||
@@ -55,14 +54,14 @@ function mailerrorgraphUnix ($rrd, $graph, $from, $to, $width, $height, $title,
|
||||
$options .= " GPRINT:sspam:MAX:\ %6.0lf";
|
||||
$options .= " GPRINT:rspam:AVERAGE:\ \ %5.2lf/min";
|
||||
$options .= " GPRINT:rmspam:MAX:\ %5.2lf/min\\\\l";
|
||||
shell_exec($config['rrdtool'] . " graph $imgfile $options");
|
||||
return $imgfile;
|
||||
shell_exec($config['rrdtool'] . " graph $graph $options");
|
||||
return $graph;
|
||||
}
|
||||
|
||||
function mailsgraphUnix ($rrd, $graph, $from, $to, $width, $height, $title, $vertical) {
|
||||
global $config, $installdir;
|
||||
$database = $config['rrd_dir'] . "/" . $rrd;
|
||||
$imgfile = "graphs/" . "$graph";
|
||||
|
||||
$period = $to - $from;
|
||||
$options = "--alt-autoscale-max -E --start $from --end $to --width $width --height $height ";
|
||||
if($width <= "300") { $options .= " --font LEGEND:7:".$config['mono_font']." --font AXIS:6:".$config['mono_font']." --font-render-mode normal "; }
|
||||
@@ -93,14 +92,14 @@ function mailsgraphUnix ($rrd, $graph, $from, $to, $width, $height, $title, $ver
|
||||
$options .= " GPRINT:srecv:MAX:\ \ %6.0lf";
|
||||
$options .= " GPRINT:rrecv:AVERAGE:\ \ %5.2lf/min";
|
||||
$options .= " GPRINT:rmrecv:MAX:\ %5.2lf/min\\\\l";
|
||||
shell_exec($config['rrdtool'] . " graph $imgfile $options");
|
||||
return $imgfile;
|
||||
shell_exec($config['rrdtool'] . " graph $graph $options");
|
||||
return $graph;
|
||||
}
|
||||
|
||||
function memgraphUnix ($rrd, $graph, $from, $to, $width, $height, $title, $vertical) {
|
||||
global $config, $installdir;
|
||||
$database = $config['rrd_dir'] . "/" . $rrd;
|
||||
$imgfile = "graphs/" . "$graph";
|
||||
|
||||
$options = "--alt-autoscale-max -E --start $from --end $to --width $width --height $height -b 1024";
|
||||
if($width <= "300") { $options .= " --font LEGEND:7:".$config['mono_font']." --font AXIS:6:".$config['mono_font']." --font-render-mode normal "; }
|
||||
$options .= " DEF:atotalswap=$database:totalswap:AVERAGE";
|
||||
@@ -158,14 +157,14 @@ function memgraphUnix ($rrd, $graph, $from, $to, $width, $height, $title, $verti
|
||||
$options .= " LINE1:totalreal#050505:total";
|
||||
$options .= " GPRINT:totalreal:AVERAGE:\ \ %7.2lf%sB";
|
||||
|
||||
shell_exec($config['rrdtool'] . " graph $imgfile $options");
|
||||
return $imgfile;
|
||||
shell_exec($config['rrdtool'] . " graph $graph $options");
|
||||
return $graph;
|
||||
}
|
||||
|
||||
function loadgraphUnix ($rrd, $graph, $from, $to, $width, $height, $title, $vertical) {
|
||||
global $config, $installdir;
|
||||
$database = $config['rrd_dir'] . "/" . $rrd;
|
||||
$imgfile = "graphs/" . "$graph";
|
||||
|
||||
$period = $to - $from;
|
||||
$options = "--alt-autoscale-max -E --start $from --end $to --width $width --height $height ";
|
||||
if($width <= "300") { $options .= " --font LEGEND:7:".$config['mono_font']." --font AXIS:6:".$config['mono_font']." --font-render-mode normal "; }
|
||||
@@ -190,15 +189,15 @@ function loadgraphUnix ($rrd, $graph, $from, $to, $width, $height, $title, $vert
|
||||
$options .= " GPRINT:c:LAST:\ \ \ %7.2lf";
|
||||
$options .= " GPRINT:c:AVERAGE:\ \ %7.2lf";
|
||||
$options .= " GPRINT:c:MAX:\ \ %7.2lf\\\\n";
|
||||
shell_exec($config['rrdtool'] . " graph $imgfile $options");
|
||||
return $imgfile;
|
||||
shell_exec($config['rrdtool'] . " graph $graph $options");
|
||||
return $graph;
|
||||
}
|
||||
|
||||
|
||||
function usersgraphUnix ($rrd, $graph, $from, $to, $width, $height, $title, $vertical) {
|
||||
global $config, $installdir;
|
||||
$database = $config['rrd_dir'] . "/" . $rrd;
|
||||
$imgfile = "graphs/" . "$graph";
|
||||
|
||||
$period = $to - $from;
|
||||
$options = "--alt-autoscale-max -E --start $from --end $to --width $width --height $height -l 0";
|
||||
if($width <= "300") { $options .= " --font LEGEND:7:".$config['mono_font']." --font AXIS:6:".$config['mono_font']." --font-render-mode normal "; }
|
||||
@@ -210,14 +209,13 @@ function usersgraphUnix ($rrd, $graph, $from, $to, $width, $height, $title, $ver
|
||||
$options .= " GPRINT:users:AVERAGE:%6.2lf";
|
||||
$options .= " GPRINT:users:MIN:%6.2lf";
|
||||
$options .= " GPRINT:users:MAX:%6.2lf\\\\n";
|
||||
shell_exec($config['rrdtool'] . " graph $imgfile $options");
|
||||
return $imgfile;
|
||||
shell_exec($config['rrdtool'] . " graph $graph $options");
|
||||
return $graph;
|
||||
}
|
||||
|
||||
function procsgraphUnix ($rrd, $graph, $from, $to, $width, $height, $title, $vertical) {
|
||||
global $config, $installdir;
|
||||
$database = $config['rrd_dir'] . "/" . $rrd;
|
||||
$imgfile = "graphs/" . "$graph";
|
||||
$period = $to - $from;
|
||||
$options = "--alt-autoscale-max -E --start $from --end $to --width $width --height $height -l 0";
|
||||
if($width <= "300") { $options .= " --font LEGEND:7:".$config['mono_font']." --font AXIS:6:".$config['mono_font']." --font-render-mode normal "; }
|
||||
@@ -229,17 +227,15 @@ function procsgraphUnix ($rrd, $graph, $from, $to, $width, $height, $title, $ver
|
||||
$options .= " GPRINT:procs:AVERAGE:%6.2lf";
|
||||
$options .= " GPRINT:procs:MIN:%6.2lf";
|
||||
$options .= " GPRINT:procs:MAX:%6.2lf\\\\n";
|
||||
shell_exec($config['rrdtool'] . " graph $imgfile $options");
|
||||
return $imgfile;
|
||||
|
||||
shell_exec($config['rrdtool'] . " graph $graph $options");
|
||||
return $graph;
|
||||
}
|
||||
|
||||
|
||||
|
||||
function cpugraphUnix ($rrd, $graph, $from, $to, $width, $height, $title, $vertical) {
|
||||
global $config, $installdir;
|
||||
global $config;
|
||||
$database = $config['rrd_dir'] . "/" . $rrd;
|
||||
$imgfile = "graphs/" . "$graph";
|
||||
$period = $to - $from;
|
||||
$options = "-l 0 --alt-autoscale-max -E --start $from --end $to --width $width --height $height ";
|
||||
if($width <= "300") { $options .= " --font LEGEND:7:".$config['mono_font']." --font AXIS:6:".$config['mono_font']." --font-render-mode normal "; }
|
||||
@@ -269,14 +265,13 @@ function cpugraphUnix ($rrd, $graph, $from, $to, $width, $height, $title, $verti
|
||||
$options .= " GPRINT:idle_perc:LAST:\ \ \ \ \ %5.2lf%%";
|
||||
$options .= " GPRINT:idle_perc:AVERAGE:\ \ \ %5.2lf%%";
|
||||
$options .= " GPRINT:idle_perc:MAX:\ \ \ %5.2lf%%\\\\n";
|
||||
shell_exec($config['rrdtool'] . " graph $imgfile $options");
|
||||
return $imgfile;
|
||||
shell_exec($config['rrdtool'] . " graph $graph $options");
|
||||
return $graph;
|
||||
}
|
||||
|
||||
function couriergraphUnix ($rrd, $graph, $from, $to, $width, $height, $title, $vertical) {
|
||||
global $config, $installdir;
|
||||
$database = $config['rrd_dir'] . "/" . $rrd;
|
||||
$imgfile = "graphs/" . "$graph";
|
||||
$database = $config['rrd_dir'] . "/" . $rrd;
|
||||
$period = $to - $from;
|
||||
$options = "--alt-autoscale-max -E --start $from --end $to --width $width --height $height ";
|
||||
if($width <= "300") { $options .= " --font LEGEND:7:".$config['mono_font']." --font AXIS:6:".$config['mono_font']." --font-render-mode normal "; }
|
||||
@@ -319,14 +314,14 @@ function couriergraphUnix ($rrd, $graph, $from, $to, $width, $height, $title, $v
|
||||
$options .= " GPRINT:vimapd_ssl_login:AVERAGE:\ %6.0lf";
|
||||
$options .= " GPRINT:rimapd_ssl_login:AVERAGE:%5.2lf/min";
|
||||
$options .= " GPRINT:rmimapd_ssl_login:MAX:%5.2lf/min\\\\l";
|
||||
shell_exec($config['rrdtool'] . " graph $imgfile $options");
|
||||
return $imgfile;
|
||||
shell_exec($config['rrdtool'] . " graph $graph $options");
|
||||
return $graph;
|
||||
}
|
||||
|
||||
function apachehitsgraphUnix ($rrd, $graph, $from, $to, $width, $height, $title, $vertical) {
|
||||
global $config, $installdir;
|
||||
$database = $config['rrd_dir'] . "/" . $rrd;
|
||||
$imgfile = "graphs/" . "$graph";
|
||||
|
||||
$options = "--alt-autoscale-max -E --start $from --end $to --width $width --height $height -l 0";
|
||||
if($width <= "300") { $options .= " --font LEGEND:7:".$config['mono_font']." --font AXIS:6:".$config['mono_font']." --font-render-mode normal "; }
|
||||
$options .= " DEF:hits=$database:hits:AVERAGE";
|
||||
@@ -336,13 +331,13 @@ function apachehitsgraphUnix ($rrd, $graph, $from, $to, $width, $height, $title,
|
||||
$options .= " GPRINT:hits:LAST:\ %6.2lf/sec";
|
||||
$options .= " GPRINT:hits:AVERAGE:%6.2lf/sec";
|
||||
$options .= " GPRINT:hits:MAX:%6.2lf/sec\\\\n";
|
||||
shell_exec($config['rrdtool'] . " graph $imgfile $options");
|
||||
return $imgfile;
|
||||
shell_exec($config['rrdtool'] . " graph $graph $options");
|
||||
return $graph;
|
||||
}
|
||||
|
||||
function unixfsgraph ($id, $graph, $from, $to, $width, $height, $title, $vertical) {
|
||||
global $config, $installdir;
|
||||
$imgfile = "graphs/" . "$graph";
|
||||
|
||||
$options = "--alt-autoscale-max -E --start $from --end $to --width $width --height $height -b 1024 -l 0";
|
||||
if($width <= "300") { $options .= " --font LEGEND:7:".$config['mono_font']." --font AXIS:6:".$config['mono_font']." --font-render-mode normal "; }
|
||||
$hostname = gethostbyid($device);
|
||||
@@ -367,47 +362,14 @@ function unixfsgraph ($id, $graph, $from, $to, $width, $height, $title, $vertica
|
||||
$options .= " GPRINT:$fs[storage_id]p:LAST:%5.2lf%%\\\\l";
|
||||
$iter++;
|
||||
}
|
||||
shell_exec($config['rrdtool'] . " graph $imgfile $options");
|
||||
return $imgfile;
|
||||
shell_exec($config['rrdtool'] . " graph $graph $options");
|
||||
return $graph;
|
||||
}
|
||||
|
||||
|
||||
function unixfsgraph_dev ($device, $graph, $from, $to, $width, $height, $title, $vertical) {
|
||||
global $config, $installdir;
|
||||
$database = $config['rrd_dir'] . "/" . $rrd;
|
||||
$imgfile = "graphs/" . "$graph";
|
||||
$options = "--alt-autoscale-max -E --start $from --end $to --width $width --height $height -b 1024 -l 0";
|
||||
if($width <= "300") { $options .= " --font LEGEND:7:".$config['mono_font']." --font AXIS:6:".$config['mono_font']." --font-render-mode normal "; }
|
||||
$hostname = gethostbyid($device);
|
||||
$iter = "1";
|
||||
$sql = mysql_query("SELECT * FROM storage where host_id = '$device'");
|
||||
$options .= "COMMENT:\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ Size\ \ \ \ \ \ Used\ \ \ \ %age\l";
|
||||
while($fs = mysql_fetch_array($sql)) {
|
||||
if($iter=="1") {$colour="CC0000";} elseif($iter=="2") {$colour="008C00";} elseif($iter=="3") {$colour="4096EE";
|
||||
} elseif($iter=="4") {$colour="73880A";} elseif($iter=="5") {$colour="D01F3C";} elseif($iter=="6") {$colour="36393D";
|
||||
} elseif($iter=="7") {$colour="FF0084"; $iter = "0"; }
|
||||
|
||||
$descr = str_pad($fs[hrStorageDescr], 14);
|
||||
$descr = substr($descr,0,14);
|
||||
$text = str_replace("/", "_", $fs['hrStorageDescr']);
|
||||
$rrd = $config['rrd_dir'] . "/$hostname/storage-$text.rrd";
|
||||
$options .= " DEF:$fs[storage_id]=$rrd:used:AVERAGE";
|
||||
$options .= " DEF:$fs[storage_id]s=$rrd:size:AVERAGE";
|
||||
$options .= " DEF:$fs[storage_id]p=$rrd:perc:AVERAGE";
|
||||
$options .= " LINE1.25:$fs[storage_id]p#" . $colour . ":'$descr'";
|
||||
$options .= " GPRINT:$fs[storage_id]s:LAST:%6.2lf%SB";
|
||||
$options .= " GPRINT:$fs[storage_id]:LAST:%6.2lf%SB";
|
||||
$options .= " GPRINT:$fs[storage_id]p:LAST:%5.2lf%%\\\\l";
|
||||
$iter++;
|
||||
}
|
||||
shell_exec($config['rrdtool'] . " graph $imgfile $options");
|
||||
return $imgfile;
|
||||
}
|
||||
|
||||
function apachebitsgraphUnix ($rrd, $graph, $from, $to, $width, $height, $title, $vertical) {
|
||||
global $config, $installdir;
|
||||
$database = $config['rrd_dir'] . "/" . $rrd;
|
||||
$imgfile = "graphs/" . "$graph";
|
||||
$database = $config['rrd_dir'] . "/" . $rrd;
|
||||
$options = "--alt-autoscale-max -E --start $from --end $to --width $width --height $height -l 0";
|
||||
if($width <= "300") { $options .= " --font LEGEND:7:".$config['mono_font']." --font AXIS:6:".$config['mono_font']." --font-render-mode normal "; }
|
||||
$options .= " DEF:bits=$database:bits:AVERAGE";
|
||||
@@ -417,6 +379,6 @@ function apachebitsgraphUnix ($rrd, $graph, $from, $to, $width, $height, $title,
|
||||
$options .= " GPRINT:bits:LAST:\ %6.2lf/sec";
|
||||
$options .= " GPRINT:bits:AVERAGE:%6.2lf/sec";
|
||||
$options .= " GPRINT:bits:MAX:%6.2lf/sec\\\\n";
|
||||
shell_exec($config['rrdtool'] . " graph $imgfile $options");
|
||||
return $imgfile;
|
||||
shell_exec($config['rrdtool'] . " graph $graph $options");
|
||||
return $graph;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user