diff --git a/html/graph.php b/html/graph.php index d8b6494d5..045020a8c 100644 --- a/html/graph.php +++ b/html/graph.php @@ -72,31 +72,31 @@ $graph = unixfsgraph ($_GET['id'], $graphfile, $from, $to, $width, $height, $title, $vertical); break; case 'calls': - $graph = callsgraphSNOM ($hostname . "-data.rrd", $graphfile, $from, $to, $width, $height, $title, $vertical); + $graph = callsgraphSNOM ($hostname . "/data.rrd", $graphfile, $from, $to, $width, $height, $title, $vertical); break; case 'ip_graph': - $graph = ip_graph ($hostname . "-netinfo.rrd", $graphfile, $from, $to, $width, $height, $title, $vertical); + $graph = ip_graph ($hostname . "/netinfo.rrd", $graphfile, $from, $to, $width, $height, $title, $vertical); break; case 'icmp_graph': - $graph = icmp_graph ($hostname . "-netinfo.rrd", $graphfile, $from, $to, $width, $height, $title, $vertical); + $graph = icmp_graph ($hostname . "/netinfo.rrd", $graphfile, $from, $to, $width, $height, $title, $vertical); break; case 'tcp_graph': - $graph = tcp_graph ($hostname . "-netinfo.rrd", $graphfile, $from, $to, $width, $height, $title, $vertical); + $graph = tcp_graph ($hostname . "/netinfo.rrd", $graphfile, $from, $to, $width, $height, $title, $vertical); break; case 'udp_graph': - $graph = udp_graph ($hostname . "-netinfo.rrd", $graphfile, $from, $to, $width, $height, $title, $vertical); + $graph = udp_graph ($hostname . "/netinfo.rrd", $graphfile, $from, $to, $width, $height, $title, $vertical); break; case 'cpu': if($os == "Linux" || $os == "NetBSD" || $os == "FreeBSD" || $os == "DragonFly" || $os == "OpenBSD" || $os == "Windows" || $os == "m0n0wall" || $os == "Voswall" || $os == "pfSense" || $os == "DragonFly" || $os == "OpenBSD") { - $graph = cpugraphUnix ($hostname . "-cpu.rrd", $graphfile, $from, $to, $width, $height, $title, $vertical); + $graph = cpugraphUnix ($hostname . "/cpu.rrd", $graphfile, $from, $to, $width, $height, $title, $vertical); } elseif($os == "IOS") { - $graph = cpugraph ($hostname . "-cpu.rrd", $graphfile, $from, $to, $width, $height, $title, $vertical); + $graph = cpugraph ($hostname . "/cpu.rrd", $graphfile, $from, $to, $width, $height, $title, $vertical); } elseif($os == "Windows") { - $graph = cpugraphwin ($hostname . "-cpu.rrd", $graphfile, $from, $to, $width, $height, $title, $vertical); + $graph = cpugraphwin ($hostname . "/cpu.rrd", $graphfile, $from, $to, $width, $height, $title, $vertical); } elseif($os == "ProCurve") { - $graph = cpugraphHP ($hostname . "-cpu.rrd", $graphfile, $from, $to, $width, $height, $title, $vertical); + $graph = cpugraphHP ($hostname . "/cpu.rrd", $graphfile, $from, $to, $width, $height, $title, $vertical); } elseif($os == "Snom") { - $graph = callsgraphSNOM ($hostname . "-data.rrd", $graphfile, $from, $to, $width, $height, $title, $vertical); + $graph = callsgraphSNOM ($hostname . "/data.rrd", $graphfile, $from, $to, $width, $height, $title, $vertical); } break; case 'temp': @@ -107,35 +107,35 @@ break; case 'mem': if($os == "Linux" || $os == "FreeBSD" || $os == "DragonFly" || $os == "OpenBSD" || $os == "NetBSD" ) { - $graph = memgraphUnix ($hostname . "-mem.rrd", $graphfile, $from, $to, $width, $height, $title, $vertical); + $graph = memgraphUnix ($hostname . "/mem.rrd", $graphfile, $from, $to, $width, $height, $title, $vertical); } elseif($os == "IOS") { - $graph = memgraph ($hostname . "-mem.rrd", $graphfile, $from, $to, $width, $height, $title, $vertical); + $graph = memgraph ($hostname . "/mem.rrd", $graphfile, $from, $to, $width, $height, $title, $vertical); } elseif($os == "Windows") { } elseif($os == "ProCurve") { - $graph = memgraphHP ($hostname . "-mem.rrd", $graphfile, $from, $to, $width, $height, $title, $vertical); + $graph = memgraphHP ($hostname . "/mem.rrd", $graphfile, $from, $to, $width, $height, $title, $vertical); } break; case 'load': if($os == "Linux" || $os == "FreeBSD" || $os == "DragonFly" || $os == "OpenBSD" || $os == "NetBSD" ) { - $graph = loadgraphUnix ($hostname . "-load.rrd", $graphfile, $from, $to, $width, $height, $title, $vertical); + $graph = loadgraphUnix ($hostname . "/load.rrd", $graphfile, $from, $to, $width, $height, $title, $vertical); } elseif($os == "IOS") { - $graph = loadgraph ($hostname . "-load.rrd", $graphfile, $from, $to, $width, $height, $title, $vertical); + $graph = loadgraph ($hostname . "/load.rrd", $graphfile, $from, $to, $width, $height, $title, $vertical); } elseif($os == "Windows") { - $graph = loadgraphwin ($hostname . "-load.rrd", $graphfile, $from, $to, $width, $height, $title, $vertical); + $graph = loadgraphwin ($hostname . "/load.rrd", $graphfile, $from, $to, $width, $height, $title, $vertical); } break; case 'users': if($os == "Linux" || $os == "FreeBSD" || $os == "DragonFly" || $os == "OpenBSD" || $os == "NetBSD" ) { - $graph = usersgraphUnix ($hostname . "-sys.rrd", $graphfile, $from, $to, $width, $height, $title, $vertical); + $graph = usersgraphUnix ($hostname . "/sys.rrd", $graphfile, $from, $to, $width, $height, $title, $vertical); } elseif($os == "Windows") { - $graph = usersgraphwin ($hostname . "-sys.rrd", $graphfile, $from, $to, $width, $height, $title, $vertical); + $graph = usersgraphwin ($hostname . "/sys.rrd", $graphfile, $from, $to, $width, $height, $title, $vertical); } break; case 'procs': if($os == "Linux" || $os == "FreeBSD" || $os == "DragonFly" || $os == "OpenBSD" || $os == "NetBSD" ) { - $graph = procsgraphUnix ($hostname . "-sys.rrd", $graphfile, $from, $to, $width, $height, $title, $vertical); + $graph = procsgraphUnix ($hostname . "/sys.rrd", $graphfile, $from, $to, $width, $height, $title, $vertical); } elseif($os == "Windows") { - $graph = procsgraphwin ($hostname . "-sys.rrd", $graphfile, $from, $to, $width, $height, $title, $vertical); + $graph = procsgraphwin ($hostname . "/sys.rrd", $graphfile, $from, $to, $width, $height, $title, $vertical); } break; case 'unixfs': @@ -146,7 +146,7 @@ case 'postfix': case 'mail': if($os == "Linux" || $os == "FreeBSD" || $os == "DragonFly" || $os == "OpenBSD") { - $graph = mailsgraphUnix ($hostname . "-mailstats.rrd", $graphfile, $from, $to, $width, $height, $title, $vertical); + $graph = mailsgraphUnix ($hostname . "/mailstats.rrd", $graphfile, $from, $to, $width, $height, $title, $vertical); } break; case 'mailerrors': @@ -157,17 +157,17 @@ break; case 'courier': if($os == "Linux" || $os == "FreeBSD" || $os == "DragonFly" || $os == "OpenBSD") { - $graph = couriergraphUnix ($hostname . "-courierstats.rrd", $graphfile, $from, $to, $width, $height, $title, $vertical); + $graph = couriergraphUnix ($hostname . "/courierstats.rrd", $graphfile, $from, $to, $width, $height, $title, $vertical); } break; case 'apachehits': if($os == "Linux" || $os == "FreeBSD" || $os == "DragonFly" || $os == "OpenBSD") { - $graph = apachehitsgraphUnix ($hostname . "-apache.rrd", $graphfile, $from, $to, $width, $height, $title, $vertical); + $graph = apachehitsgraphUnix ($hostname . "/apache.rrd", $graphfile, $from, $to, $width, $height, $title, $vertical); } break; case 'apachebits': if($os == "Linux" || $os == "FreeBSD" || $os == "DragonFly" || $os == "OpenBSD") { - $graph = apachebitsgraphUnix ($hostname . "-apache.rrd", $graphfile, $from, $to, $width, $height, $title, $vertical); + $graph = apachebitsgraphUnix ($hostname . "/apache.rrd", $graphfile, $from, $to, $width, $height, $title, $vertical); } break; diff --git a/includes/graphing.php b/includes/graphing.php index 4ca5f3fc6..1a02bae33 100644 --- a/includes/graphing.php +++ b/includes/graphing.php @@ -57,7 +57,7 @@ function temp_graph ($temp, $graph, $from, $to, $width, $height, $title, $vertic } elseif($iter=="7") {$colour="FF0084"; unset($iter); } $temperature['temp_descr_fixed'] = str_pad($temperature['temp_descr'], 28); $temperature['temp_descr_fixed'] = substr($temperature['temp_descr_fixed'],0,28); - $temprrd = addslashes("rrd/$hostname-temp-" . str_replace("/", "_", str_replace(" ", "_",$temperature['temp_descr'])) . ".rrd"); + $temprrd = addslashes("rrd/$hostname/temp-" . str_replace("/", "_", str_replace(" ", "_",$temperature['temp_descr'])) . ".rrd"); $temprrd = str_replace(")", "_", $temprrd); $temprrd = str_replace("(", "_", $temprrd); $opts[] = "DEF:temp" . $temperature[temp_id] . "=$temprrd:temp:AVERAGE"; @@ -117,7 +117,7 @@ function temp_graph_dev ($device, $graph, $from, $to, $width, $height, $title, $ } elseif($iter=="7") {$colour="FF0084"; unset($iter); } $temperature['temp_descr_fixed'] = str_pad($temperature['temp_descr'], 28); $temperature['temp_descr_fixed'] = substr($temperature['temp_descr_fixed'],0,28); - $temprrd = addslashes("rrd/$hostname-temp-" . str_replace("/", "_", str_replace(" ", "_",$temperature['temp_descr'])) . ".rrd"); + $temprrd = addslashes("rrd/$hostname/temp-" . str_replace("/", "_", str_replace(" ", "_",$temperature['temp_descr'])) . ".rrd"); $temprrd = str_replace(")", "_", $temprrd); $temprrd = str_replace("(", "_", $temprrd); $options .= " DEF:temp" . $temperature[temp_id] . "=$temprrd:temp:AVERAGE "; diff --git a/includes/polling/device-ios.inc.php b/includes/polling/device-ios.inc.php index 64ce6fc45..0a3feb5d9 100755 --- a/includes/polling/device-ios.inc.php +++ b/includes/polling/device-ios.inc.php @@ -4,12 +4,19 @@ $id = $device['device_id']; $hostname = $device['hostname']; - $temprrd = "rrd/" . $hostname . "-temp.rrd"; - $tempgraph = "public_html/graphs/" . $hostname . "-temp.png"; - $cpurrd = "rrd/" . $hostname . "-cpu.rrd"; - $cpugraph = "public_html/graphs/" . $hostname . "-cpu.png"; - $memrrd = "rrd/" . $hostname . "-mem.rrd"; - $memgraph = "public_html/graphs/" . $hostname . "-mem.png"; + $Otemprrd = "rrd/" . $hostname . "-temp.rrd"; + $Ocpurrd = "rrd/" . $hostname . "-cpu.rrd"; + $Omemrrd = "rrd/" . $hostname . "-mem.rrd"; + + $temprrd = $rrd_dir . "/" . $hostname . "/temp.rrd"; + $cpurrd = $rrd_dir . "/" . $hostname . "/cpu.rrd"; + $memrrd = $rrd_dir . "/" . $hostname . "/mem.rrd"; + + if(is_file($Otemprrd) && !is_file($temprrd)) { rename($Otemprrd, $temprrd); echo("Moving $Otemprrd to $temprrd"); } + if(is_file($Ocpurrd) && !is_file($cpurrd)) { rename($Ocpurrd, $cpurrd); echo("Moving $Ocpurrd to $cpurrd"); } + if(is_file($Omemrrd) && !is_file($memrrd)) { rename($Omemrrd, $memrrd); echo("Moving $Omemrrd to $memrrd"); } + + list ($cpu5m, $cpu5s) = explode("\n", `snmpget -O qv -v2c -c $community $hostname 1.3.6.1.4.1.9.2.1.58.0 1.3.6.1.4.1.9.2.1.56.0`); $cpu5m = $cpu5m + 0; $cpu5s = $cpu5s + 0; diff --git a/includes/polling/device-netstats.inc.php b/includes/polling/device-netstats.inc.php index aba8cb97b..59fc373c1 100755 --- a/includes/polling/device-netstats.inc.php +++ b/includes/polling/device-netstats.inc.php @@ -12,7 +12,11 @@ if($device[os] != "Snom") { 'tcpEstabResets','tcpInSegs','tcpOutSegs','tcpRetransSegs','udpInDatagrams','udpOutDatagrams','udpInErrors', 'udpNoPorts'); - $rrdfile = "rrd/" . $device['hostname'] . "-netinfo.rrd"; + $rrdfile = $rrd_file . "/" . $device['hostname'] . "/netinfo.rrd"; + + $Orrdfile = "rrd/" . $device['hostname'] . "-netinfo.rrd"; + if(is_file($Orrdfile) && !is_file($rrdfile)) { rename($Orrdfile, $rrdfile); echo("Moving $Orrdfile to $rrdfile"); } + $rrd_create = "rrdtool create $rrdfile "; $rrd_create .= "RRA:AVERAGE:0.5:1:600 RRA:AVERAGE:0.5:6:700 RRA:AVERAGE:0.5:24:775 RRA:AVERAGE:0.5:288:797 RRA:MAX:0.5:1:600 \ RRA:MAX:0.5:6:700 RRA:MAX:0.5:24:775 RRA:MAX:0.5:288:797"; diff --git a/includes/polling/device-procurve.inc.php b/includes/polling/device-procurve.inc.php index b7c785bb5..4b6d2c332 100755 --- a/includes/polling/device-procurve.inc.php +++ b/includes/polling/device-procurve.inc.php @@ -1,7 +1,14 @@ = '40') { diff --git a/includes/polling/temperatures.inc.php b/includes/polling/temperatures.inc.php index 9661a0536..074f268cc 100755 --- a/includes/polling/temperatures.inc.php +++ b/includes/polling/temperatures.inc.php @@ -9,10 +9,15 @@ while($temperature = mysql_fetch_array($temp_data)) { echo("Checking temp " . $temperature['temp_descr'] . "... "); - $temprrd = addslashes("rrd/" . $device['hostname'] . "-temp-" . str_replace("/", "_", str_replace(" ", "_",$temperature['temp_descr'])) . ".rrd"); + $temprrd = addslashes($rrd_dir . "/" . $device['hostname'] . "/temp-" . str_replace("/", "_", str_replace(" ", "_",$temperature['temp_descr'])) . ".rrd"); $temprrd = str_replace(")", "_", $temprrd); $temprrd = str_replace("(", "_", $temprrd); + $otemprrd = addslashes("rrd/" . $device['hostname'] . "-temp-" . str_replace("/", "_", str_replace(" ", "_",$temperature['temp_descr'])) . ".rrd"); + $otemprrd = str_replace(")", "_", $otemprrd); + $otemprrd = str_replace("(", "_", $otemprrd); + + if(is_file($otemprrd) && !is_file($temprrd)) { rename($otemprrd, $temprrd); echo("Moving $otemprrd to $temprrd"); } if (!is_file($temprrd)) { `rrdtool create $temprrd \ diff --git a/includes/unix-graphing.php b/includes/unix-graphing.php index 84b9046a5..1c3a95b6d 100755 --- a/includes/unix-graphing.php +++ b/includes/unix-graphing.php @@ -3,8 +3,8 @@ // Start Graphing Functions function mailerrorgraphUnix ($rrd, $graph, $from, $to, $width, $height, $title, $vertical) { - global $config, $rrdtool, $installdir, $mono_font; - $database = "rrd/" . $rrd; + global $config, $rrdtool, $installdir, $mono_font, $rrd_dir; + $database = $rrd_dir . "/" . $rrd; $imgfile = "graphs/" . "$graph"; $period = $to - $from; $options = "--alt-autoscale-max -E --start $from --end $to --width $width --height $height "; @@ -14,7 +14,7 @@ function mailerrorgraphUnix ($rrd, $graph, $from, $to, $width, $height, $title, $points_per_sample = 3; $xpoints = '540'; $step = $range*$points_per_sample/$xpoints; - $database = "rrd/" . $rrd . "-mailstats.rrd"; + $database = $rrd_dir . "/" . $rrd . "-mailstats.rrd"; $options .= " DEF:rejected=$database:reject:AVERAGE"; $options .= " DEF:mrejected=$database:reject:MAX"; @@ -62,8 +62,8 @@ function mailerrorgraphUnix ($rrd, $graph, $from, $to, $width, $height, $title, } function mailsgraphUnix ($rrd, $graph, $from, $to, $width, $height, $title, $vertical) { - global $config, $rrdtool, $installdir, $mono_font; - $database = "rrd/" . $rrd; + global $config, $rrdtool, $installdir, $mono_font, $rrd_dir; + $database = $rrd_dir . "/" . $rrd; $imgfile = "graphs/" . "$graph"; $period = $to - $from; $options = "--alt-autoscale-max -E --start $from --end $to --width $width --height $height "; @@ -72,7 +72,7 @@ function mailsgraphUnix ($rrd, $graph, $from, $to, $width, $height, $title, $ver $points_per_sample = 3; $xpoints = '540'; $step = $range*$points_per_sample/$xpoints; - $rrd = "rrd/" . $rrd; + $rrd = $rrd_dir . "/" . $rrd; $options .= " DEF:sent=$rrd:sent:AVERAGE"; $options .= " DEF:msent=$rrd:sent:MAX"; $options .= " CDEF:rsent=sent,60,*"; @@ -100,8 +100,8 @@ function mailsgraphUnix ($rrd, $graph, $from, $to, $width, $height, $title, $ver } function memgraphUnix ($rrd, $graph, $from, $to, $width, $height, $title, $vertical) { - global $config, $rrdtool, $installdir, $mono_font; - $database = "rrd/" . $rrd; + global $config, $rrdtool, $installdir, $mono_font, $rrd_dir; + $database = $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:$mono_font --font AXIS:6:$mono_font --font-render-mode normal "; } @@ -165,8 +165,8 @@ function memgraphUnix ($rrd, $graph, $from, $to, $width, $height, $title, $verti } function loadgraphUnix ($rrd, $graph, $from, $to, $width, $height, $title, $vertical) { - global $config, $rrdtool, $installdir, $mono_font; - $database = "rrd/" . $rrd; + global $config, $rrdtool, $installdir, $mono_font, $rrd_dir; + $database = $rrd_dir . "/" . $rrd; $imgfile = "graphs/" . "$graph"; $period = $to - $from; $options = "--alt-autoscale-max -E --start $from --end $to --width $width --height $height "; @@ -198,8 +198,8 @@ function loadgraphUnix ($rrd, $graph, $from, $to, $width, $height, $title, $vert function usersgraphUnix ($rrd, $graph, $from, $to, $width, $height, $title, $vertical) { - global $config, $rrdtool, $installdir, $mono_font; - $database = "rrd/" . $rrd; + global $config, $rrdtool, $installdir, $mono_font, $rrd_dir; + $database = $rrd_dir . "/" . $rrd; $imgfile = "graphs/" . "$graph"; $period = $to - $from; $options = "--alt-autoscale-max -E --start $from --end $to --width $width --height $height -l 0"; @@ -217,8 +217,8 @@ function usersgraphUnix ($rrd, $graph, $from, $to, $width, $height, $title, $ver } function procsgraphUnix ($rrd, $graph, $from, $to, $width, $height, $title, $vertical) { - global $config, $rrdtool, $installdir, $mono_font; - $database = "rrd/" . $rrd; + global $config, $rrdtool, $installdir, $mono_font, $rrd_dir; + $database = $rrd_dir . "/" . $rrd; $imgfile = "graphs/" . "$graph"; $period = $to - $from; $options = "--alt-autoscale-max -E --start $from --end $to --width $width --height $height -l 0"; @@ -239,8 +239,8 @@ function procsgraphUnix ($rrd, $graph, $from, $to, $width, $height, $title, $ver function cpugraphUnix ($rrd, $graph, $from, $to, $width, $height, $title, $vertical) { - global $config, $rrdtool, $installdir, $mono_font; - $database = "rrd/" . $rrd; + global $config, $rrdtool, $installdir, $mono_font, $rrd_dir; + $database = $rrd_dir . "/" . $rrd; $imgfile = "graphs/" . "$graph"; $period = $to - $from; $options = "--alt-autoscale-max -E --start $from --end $to --width $width --height $height "; @@ -276,8 +276,8 @@ function cpugraphUnix ($rrd, $graph, $from, $to, $width, $height, $title, $verti } function couriergraphUnix ($rrd, $graph, $from, $to, $width, $height, $title, $vertical) { - global $config, $rrdtool, $installdir, $mono_font; - $database = "rrd/" . $rrd; + global $config, $rrdtool, $installdir, $mono_font, $rrd_dir; + $database = $rrd_dir . "/" . $rrd; $imgfile = "graphs/" . "$graph"; $period = $to - $from; $options = "--alt-autoscale-max -E --start $from --end $to --width $width --height $height "; @@ -326,8 +326,8 @@ function couriergraphUnix ($rrd, $graph, $from, $to, $width, $height, $title, $v } function apachehitsgraphUnix ($rrd, $graph, $from, $to, $width, $height, $title, $vertical) { - global $config, $rrdtool, $installdir, $mono_font; - $database = "rrd/" . $rrd; + global $config, $rrdtool, $installdir, $mono_font, $rrd_dir; + $database = $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:$mono_font --font AXIS:6:$mono_font --font-render-mode normal "; } @@ -343,8 +343,7 @@ function apachehitsgraphUnix ($rrd, $graph, $from, $to, $width, $height, $title, } function unixfsgraph ($id, $graph, $from, $to, $width, $height, $title, $vertical) { - global $config, $rrdtool, $installdir, $mono_font; - $database = "rrd/" . $rrd; + global $config, $rrdtool, $installdir, $mono_font, $rrd_dir; $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:$mono_font --font AXIS:6:$mono_font --font-render-mode normal "; } @@ -360,9 +359,10 @@ function unixfsgraph ($id, $graph, $from, $to, $width, $height, $title, $vertica $descr = str_pad($fs[hrStorageDescr], 14); $descr = substr($descr,0,14); $text = str_replace("/", "_", $fs['hrStorageDescr']); - $options .= " DEF:$fs[storage_id]=rrd/$hostname-storage-$text.rrd:used:AVERAGE"; - $options .= " DEF:$fs[storage_id]s=rrd/$hostname-storage-$text.rrd:size:AVERAGE"; - $options .= " DEF:$fs[storage_id]p=rrd/$hostname-storage-$text.rrd:perc:AVERAGE"; + $rrd = $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"; @@ -375,8 +375,8 @@ function unixfsgraph ($id, $graph, $from, $to, $width, $height, $title, $vertica function unixfsgraph_dev ($device, $graph, $from, $to, $width, $height, $title, $vertical) { - global $config, $rrdtool, $installdir, $mono_font; - $database = "rrd/" . $rrd; + global $config, $rrdtool, $installdir, $mono_font, $rrd_dir; + $database = $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:$mono_font --font AXIS:6:$mono_font --font-render-mode normal "; } @@ -391,11 +391,11 @@ function unixfsgraph_dev ($device, $graph, $from, $to, $width, $height, $title, $descr = str_pad($fs[hrStorageDescr], 14); $descr = substr($descr,0,14); - $text = str_replace("/", "_", $fs['hrStorageDescr']); - $options .= " DEF:$fs[storage_id]=rrd/$hostname-storage-$text.rrd:used:AVERAGE"; - $options .= " DEF:$fs[storage_id]s=rrd/$hostname-storage-$text.rrd:size:AVERAGE"; - $options .= " DEF:$fs[storage_id]p=rrd/$hostname-storage-$text.rrd:perc:AVERAGE"; + $rrd = $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"; @@ -407,8 +407,8 @@ function unixfsgraph_dev ($device, $graph, $from, $to, $width, $height, $title, } function apachebitsgraphUnix ($rrd, $graph, $from, $to, $width, $height, $title, $vertical) { - global $config, $rrdtool, $installdir, $mono_font; - $database = "rrd/" . $rrd; + global $config, $rrdtool, $installdir, $mono_font, $rrd_dir; + $database = $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:$mono_font --font AXIS:6:$mono_font --font-render-mode normal "; }