From 5d1e5f95928e3b8bb051677bf0cbdf4093a77d5d Mon Sep 17 00:00:00 2001 From: Tom Laermans Date: Fri, 18 Mar 2011 11:27:52 +0000 Subject: [PATCH] minor cleanups, also don't send png mime header when doing graph debug, firefox won't show the debug text then git-svn-id: http://www.observium.org/svn/observer/trunk@1919 61d68cd4-352d-0410-923a-c4978735b2b8 --- cleanup.php | 3 ++- html/includes/graphs/graph.inc.php | 2 +- html/includes/topnav.inc.php | 4 ++-- html/pages/ports/default.inc.php | 2 +- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/cleanup.php b/cleanup.php index 5e8a685f68..6f102bfe9d 100755 --- a/cleanup.php +++ b/cleanup.php @@ -67,7 +67,8 @@ while ($row = mysql_fetch_array($data)) $response = explode(" ", snmp_get($row, "ifIndex.$index", "-Osq")); $response = $response[1]; - if ($response != $index) { + if ($response != $index) + { mysql_query("DELETE from ports where interface_id = '" . $row['interface_id'] . "'"); mysql_query("DELETE from `adjacencies` WHERE `interface_id` = '" . $row['interface_id'] . "'"); mysql_query("DELETE from `links` WHERE `local_interface_id` = '" . $row['interface_id'] . "'"); diff --git a/html/includes/graphs/graph.inc.php b/html/includes/graphs/graph.inc.php index f195a52918..558835aa5d 100644 --- a/html/includes/graphs/graph.inc.php +++ b/html/includes/graphs/graph.inc.php @@ -117,7 +117,7 @@ if (!$auth) $rrd_cmd = $config['rrdtool'] . " graph $graphfile $rrd_options" . $rrd_switches; $woo = shell_exec($rrd_cmd); if ($debug) { echo("
".$rrd_cmd."
"); } - if (is_file($graphfile)) + if (is_file($graphfile) && !$debug) { header('Content-type: image/png'); $fd = fopen($graphfile,'r');fpassthru($fd);fclose($fd); diff --git a/html/includes/topnav.inc.php b/html/includes/topnav.inc.php index c173c20c5e..0a7822b482 100644 --- a/html/includes/topnav.inc.php +++ b/html/includes/topnav.inc.php @@ -12,8 +12,8 @@ if($_SESSION['userlevel'] >= 5) $ports['up'] = mysql_result(mysql_query("SELECT count(*) FROM ports AS I, devices AS D WHERE I.ifOperStatus = 'up' AND I.ignore = '0' AND I.device_id = D.device_id AND D.ignore = '0'"),0); $ports['down'] = mysql_result(mysql_query("SELECT count(*) FROM ports AS I, devices AS D WHERE I.ifOperStatus = 'down' AND I.ifAdminStatus = 'up' AND I.ignore = '0' AND D.device_id = I.device_id AND D.ignore = '0'"),0); $ports['shutdown'] = mysql_result(mysql_query("SELECT count(*) FROM ports AS I, devices AS D WHERE I.ifAdminStatus = 'down' AND I.ignore = '0' AND D.device_id = I.device_id AND D.ignore = '0'"),0); - $ports['ignored'] = mysql_result(mysql_query("SELECT count(*) FROM ports AS I, devices AS D WHERE D.device_id = I.device_id AND ( I.ignore = '1' OR D.ignore = '1')"),0); - $ports['errored'] = mysql_result(mysql_query("SELECT count(*) FROM ports AS I, devices AS D WHERE D.device_id = I.device_id AND ( I.ignore = '0' OR D.ignore = '0') AND (I.ifInErrors_delta > '0' OR I.ifOutErrors_delta > '0')"),0); + $ports['ignored'] = mysql_result(mysql_query("SELECT count(*) FROM ports AS I, devices AS D WHERE D.device_id = I.device_id AND (I.ignore = '1' OR D.ignore = '1')"),0); + $ports['errored'] = mysql_result(mysql_query("SELECT count(*) FROM ports AS I, devices AS D WHERE D.device_id = I.device_id AND (I.ignore = '0' OR D.ignore = '0') AND (I.ifInErrors_delta > '0' OR I.ifOutErrors_delta > '0')"),0); $services['count'] = mysql_result(mysql_query("SELECT count(service_id) FROM services"),0); $services['up'] = mysql_result(mysql_query("SELECT count(service_id) FROM services WHERE service_status = '1' AND service_ignore ='0'"),0); diff --git a/html/pages/ports/default.inc.php b/html/pages/ports/default.inc.php index ecf2b47b59..af32be77bf 100644 --- a/html/pages/ports/default.inc.php +++ b/html/pages/ports/default.inc.php @@ -91,7 +91,7 @@ if ($_GET['opta'] == "down" || $_GET['type'] == "down" || $_POST['state'] == "do } elseif ($_GET['opta'] == "admindown" || $_GET['type'] == "admindown" || $_POST['state'] == "admindown") { $where .= "AND I.ifAdminStatus = 'down'"; } elseif ($_GET['opta'] == "errors" || $_GET['type'] == "errors" || $_POST['state'] == "errors") { - $where .= "AND ( I.`ifInErrors_delta` > '0' OR I.`ifOutErrors_delta` > '0' )"; + $where .= "AND (I.`ifInErrors_delta` > '0' OR I.`ifOutErrors_delta` > '0')"; } elseif ($_GET['type'] == "up" || $_POST['state'] == "up") { $where .= "AND I.ifOperStatus = 'up'"; } elseif ($_GET['opta'] == "ignored" || $_GET['type'] == "ignored" || $_POST['state'] == "ignored") {