diff --git a/html/includes/functions.inc.php b/html/includes/functions.inc.php index cddac1edf..68241ce08 100644 --- a/html/includes/functions.inc.php +++ b/html/includes/functions.inc.php @@ -1,5 +1,45 @@ array("pipe", "r"), // stdin is a pipe that the child will read from + 1 => array("pipe", "w"), // stdout is a pipe that the child will write to + 2 => array("file", "/tmp/error-output.txt", "a") // stderr is a file to write to + ); + + $cwd = $config['rrd_dir']; + $env = array(); + + $process = proc_open($command, $descriptorspec, $pipes, $cwd, $env); + + if (is_resource($process)) { + // $pipes now looks like this: + // 0 => writeable handle connected to child stdin + // 1 => readable handle connected to child stdout + // Any error output will be appended to /tmp/error-output.txt + + fwrite($pipes[0], "graph $rrdfile $options"); + fclose($pipes[0]); + fclose($pipes[1]); + + // It is important that you close any pipes before calling + // proc_close in order to avoid a deadlock + $return_value = proc_close($process); +# echo "command returned $return_value\n"; + } +} + function generate_link($text, $vars, $new_vars = array()) { return ''.$text.''; diff --git a/html/includes/graphs/device/bits.inc.php b/html/includes/graphs/device/bits.inc.php index 019a9333b..2f3d9c84f 100644 --- a/html/includes/graphs/device/bits.inc.php +++ b/html/includes/graphs/device/bits.inc.php @@ -29,7 +29,7 @@ foreach (dbFetchRows("SELECT * FROM `ports` WHERE `device_id` = ?", array($id)) } $rrd_filename = $config['rrd_dir'] . "/" . $device['hostname'] . "/port-" . safename($port['ifIndex'] . ".rrd"); - if (is_file($rrd_filename) && $ignore != 1) + if ($ignore != 1 && is_file($rrd_filename)) { $rrd_filenames[] = $rrd_filename; $rrd_list[$i]['filename'] = $rrd_filename; diff --git a/html/includes/graphs/graph.inc.php b/html/includes/graphs/graph.inc.php index 9498e62b4..7fa1ce7f9 100644 --- a/html/includes/graphs/graph.inc.php +++ b/html/includes/graphs/graph.inc.php @@ -88,7 +88,8 @@ function graph_error($string) #$rrd_options .= " HRULE:0#cc0000"; #$rrd_cmd = $config['rrdtool'] . " graph $graphfile $rrd_options" . $rrd_switches; - $rrd_cmd = $config['rrdtool'] . " graph $graphfile --title='".$string."' -l 0 -u 100 -E --start -10y --end now --width $width --height $height -c BACK#ff9999cc -c SHADEA#EEEEEE00 -c SHADEB#EEEEEE00 -c FONT#000000 -c CANVAS#FFFFFF00 -c GRID#a5a5a5 -c MGRID#FF9999 -c FRAME#5e5e5e -c ARROW#5e5e5e -R normal --font LEGEND:8:DejaVuSansMono --font AXIS:7:DejaVuSansMono --font-render-mode normal HRULE:0#cc0000" . $rrd_switches; + + echo(rrdtool_graph($graphfile, " --title='".$string."' -l 0 -u 100 -E --start -10y --end now --width $width --height $height -c BACK#ff9999cc -c SHADEA#EEEEEE00 -c SHADEB#EEEEEE00 -c FONT#000000 -c CANVAS#FFFFFF00 -c GRID#a5a5a5 -c MGRID#FF9999 -c FRAME#5e5e5e -c ARROW#5e5e5e -R normal --font LEGEND:8:DejaVuSansMono --font AXIS:7:DejaVuSansMono --font-render-mode normal HRULE:0#cc0000")); if ($height > "99") { #$rrd_cmd .= " --only-graph"; } @@ -140,8 +141,7 @@ if ($error_msg) { if ($rrd_options) { if ($config['rrdcached']) { $rrd_switches = " --daemon ".$config['rrdcached'] . " "; } - $rrd_cmd = $config['rrdtool'] . " graph $graphfile $rrd_options" . $rrd_switches; - $woo = shell_exec($rrd_cmd); + rrdtool_graph($graphfile, " $rrd_options"); if ($debug) { echo("
".$rrd_cmd.""); } if (is_file($graphfile) && !$debug) { diff --git a/includes/defaults.inc.php b/includes/defaults.inc.php index 92a679e7c..3ee4f4720 100644 --- a/includes/defaults.inc.php +++ b/includes/defaults.inc.php @@ -221,17 +221,21 @@ $config['ignore_mount_removable'] = 1; # Ignore removable disk storage $config['ignore_mount_network'] = 1; # Ignore network mounted storage $config['ignore_mount_optical'] = 1; # Ignore mounted optical discs +### Per-device interface graph filters + $config['device_traffic_iftype'][] = '/loopback/'; $config['device_traffic_iftype'][] = '/tunnel/'; $config['device_traffic_iftype'][] = '/virtual/'; $config['device_traffic_iftype'][] = '/mpls/'; $config['device_traffic_iftype'][] = '/ieee8023adLag/'; +$config['device_traffic_iftype'][] = '/l2vlan/'; $config['device_traffic_descr'][] = '/loopback/'; $config['device_traffic_descr'][] = '/vlan/'; $config['device_traffic_descr'][] = '/tunnel/'; $config['device_traffic_descr'][] = '/:\d+/'; $config['device_traffic_descr'][] = '/bond/'; + ### IRC Bot configuration $config['irc_host'] = "chat.eu.freenode.net"; diff --git a/includes/discovery/current.inc.php b/includes/discovery/current.inc.php index e1a071bfb..608b98122 100644 --- a/includes/discovery/current.inc.php +++ b/includes/discovery/current.inc.php @@ -1,7 +1,11 @@ \ No newline at end of file +?> diff --git a/includes/discovery/mempools/hp-procurve.inc.php b/includes/discovery/mempools/hp-procurve.inc.php index 4fe95c26d..fb51a6839 100755 --- a/includes/discovery/mempools/hp-procurve.inc.php +++ b/includes/discovery/mempools/hp-procurve.inc.php @@ -1,7 +1,5 @@ \ No newline at end of file +?> diff --git a/includes/discovery/mempools/hrstorage.inc.php b/includes/discovery/mempools/hrstorage.inc.php index e4ae53df2..7cd97404b 100755 --- a/includes/discovery/mempools/hrstorage.inc.php +++ b/includes/discovery/mempools/hrstorage.inc.php @@ -1,7 +1,5 @@ \ No newline at end of file +?> diff --git a/includes/discovery/mempools/junos.inc.php b/includes/discovery/mempools/junos.inc.php index edb2038bb..4cd2c4e8b 100755 --- a/includes/discovery/mempools/junos.inc.php +++ b/includes/discovery/mempools/junos.inc.php @@ -1,7 +1,5 @@ \ No newline at end of file +?> diff --git a/includes/discovery/mempools/screenos.inc.php b/includes/discovery/mempools/screenos.inc.php index b10f1bb76..937850eeb 100755 --- a/includes/discovery/mempools/screenos.inc.php +++ b/includes/discovery/mempools/screenos.inc.php @@ -1,7 +1,5 @@ 'Te', + 'tengige' => 'Te', 'gigabitethernet' => 'Gi', 'fastethernet' => 'Fa', 'ethernet' => 'Et', @@ -779,6 +780,7 @@ $rewrite_ios_features = array( 'vlan' => 'Vlan', 'tunnel' => 'Tunnel', 'serviceinstance' => 'SI', + 'dwdm' => 'DWDM', ); $rewrite_iftype = array ( @@ -841,7 +843,7 @@ function makeshortif($if) $if = fixifName ($if); $if = strtolower($if); $if = array_str_replace($rewrite_shortif, $if); - + $if = ucfirst($if); return $if; } diff --git a/includes/rrdtool.inc.php b/includes/rrdtool.inc.php index 8b73d82cf..79a91c7ae 100644 --- a/includes/rrdtool.inc.php +++ b/includes/rrdtool.inc.php @@ -21,10 +21,10 @@ function rrdtool_fetch($rrdfile, $rrdupdate) return rrdtool("fetch", $rrdfile, $rrdupdate); } -function rrdtool_graph($rrdfile, $rrdupdate) -{ - return rrdtool("graph", $rrdfile, $rrdupdate); -} +#function rrdtool_graph($rrdfile, $rrdupdate) +#{ +# return rrdtool("graph", $rrdfile, $rrdupdate); +#} function rrdtool_last($rrdfile, $rrdupdate) { @@ -51,4 +51,4 @@ function rrdtool($command, $file, $options) return shell_exec($command); } -?> \ No newline at end of file +?>