From 613e8b1e296fd2b07c8167ec87f9cc8b2d48204d Mon Sep 17 00:00:00 2001 From: Tom Laermans Date: Wed, 2 May 2012 22:02:30 +0000 Subject: [PATCH] syntaxer run git-svn-id: http://www.observium.org/svn/observer/trunk@3117 61d68cd4-352d-0410-923a-c4978735b2b8 --- .../application/memcached_uptime.inc.php | 1 - html/includes/graphs/device/bits.inc.php | 1 + .../graphs/generic_multi_line.inc.php | 4 ++-- html/includes/graphs/munin/auth.inc.php | 2 +- html/includes/graphs/munin/graph.inc.php | 7 +++--- html/pages/device.inc.php | 1 - html/pages/device/apps.inc.php | 2 +- html/pages/device/apps/memcached.inc.php | 2 +- html/pages/device/graphs.inc.php | 9 ++++---- html/pages/device/overview.inc.php | 2 ++ .../device/overview/generic/sensor.inc.php | 2 +- html/pages/device/port.inc.php | 5 ++--- html/pages/device/ports.inc.php | 22 +++++++++---------- html/pages/device/services.inc.php | 2 +- html/pages/health/sensors.inc.php | 6 ++--- html/pages/search/arp.inc.php | 13 +++++------ html/pages/services.inc.php | 2 +- includes/defaults.inc.php | 4 ++-- includes/discovery/cisco-pw.inc.php | 9 ++++---- includes/discovery/humidity/pcoweb.inc.php | 2 +- includes/discovery/os/linux.inc.php | 4 ++-- .../discovery/temperatures/pcoweb.inc.php | 2 +- includes/discovery/vlans.inc.php | 9 ++++---- includes/discovery/vlans/cisco-vtp.inc.php | 2 +- includes/functions.php | 3 ++- includes/polling/applications/drbd.inc.php | 4 ++-- .../polling/applications/memcached.inc.php | 3 +-- includes/polling/applications/mysql.inc.php | 1 - includes/polling/functions.inc.php | 2 +- includes/polling/unix-agent.inc.php | 8 +++---- includes/versioncheck.inc.php | 3 +-- 31 files changed, 66 insertions(+), 73 deletions(-) diff --git a/html/includes/graphs/application/memcached_uptime.inc.php b/html/includes/graphs/application/memcached_uptime.inc.php index 116c593c1..e50a0e506 100644 --- a/html/includes/graphs/application/memcached_uptime.inc.php +++ b/html/includes/graphs/application/memcached_uptime.inc.php @@ -7,7 +7,6 @@ include("includes/graphs/common.inc.php"); $device = device_by_id_cache($id); - $rrd_options .= " DEF:uptime=".$rrd_filename.":uptime:AVERAGE"; $rrd_options .= " CDEF:cuptime=uptime,86400,/"; $rrd_options .= " 'COMMENT:Days Current Minimum Maximum Average\\n'"; diff --git a/html/includes/graphs/device/bits.inc.php b/html/includes/graphs/device/bits.inc.php index e1c12bd43..6da8678d7 100644 --- a/html/includes/graphs/device/bits.inc.php +++ b/html/includes/graphs/device/bits.inc.php @@ -68,6 +68,7 @@ $colour_area_in = "91B13C"; $colour_area_out = "8080BD"; include("includes/graphs/generic_multi_seperated.inc.php"); + #include("includes/graphs/generic_multi_bits_separated.inc.php"); #include("includes/graphs/generic_multi_data_separated.inc.php"); diff --git a/html/includes/graphs/generic_multi_line.inc.php b/html/includes/graphs/generic_multi_line.inc.php index 50a4ba8a8..e6411bba9 100644 --- a/html/includes/graphs/generic_multi_line.inc.php +++ b/html/includes/graphs/generic_multi_line.inc.php @@ -53,10 +53,10 @@ foreach ($rrd_list as $rrd) { $rrd_options .= " CDEF:".$id."i=".$id.",-1,*"; $rrd_optionsb .= " LINE1.25:".$id."i#".$colour.":'$descr'"; - if(!empty($rrd['areacolour'])) { $rrd_optionsb .= " AREA:".$id."i#" . $rrd['areacolour']; } + if (!empty($rrd['areacolour'])) { $rrd_optionsb .= " AREA:".$id."i#" . $rrd['areacolour']; } } else { $rrd_optionsb .= " LINE1.25:".$id."#".$colour.":'$descr'"; - if(!empty($rrd['areacolour'])) { $rrd_optionsb .= " AREA:".$id."#" . $rrd['areacolour']; } + if (!empty($rrd['areacolour'])) { $rrd_optionsb .= " AREA:".$id."#" . $rrd['areacolour']; } } $rrd_optionsb .= " GPRINT:".$id.":LAST:%5.2lf%s GPRINT:".$id."min:MIN:%5.2lf%s"; diff --git a/html/includes/graphs/munin/auth.inc.php b/html/includes/graphs/munin/auth.inc.php index ad7008fd5..9664f7e78 100755 --- a/html/includes/graphs/munin/auth.inc.php +++ b/html/includes/graphs/munin/auth.inc.php @@ -8,7 +8,7 @@ if (is_numeric($id)) { $device = device_by_id_cache($mplug['device_id']); $title = generate_device_link($device); -# if(!empty($mplug['mplug_instance'])) +# if (!empty($mplug['mplug_instance'])) # { # $plugfile = $config['rrd_dir']."/".$device['hostname']."/munin/".$mplug['mplug_type']."_".$mplug['mplug_instance']; # $title .= " :: Plugin :: " . $mplug['mplug_type'] . " :: " . $mplug['mplug_title']; diff --git a/html/includes/graphs/munin/graph.inc.php b/html/includes/graphs/munin/graph.inc.php index a151f9b4c..2484c3823 100644 --- a/html/includes/graphs/munin/graph.inc.php +++ b/html/includes/graphs/munin/graph.inc.php @@ -23,7 +23,6 @@ if($width > "500") $rrd_options .= " COMMENT:'".substr(str_pad($mplug['mplug_vlabel'], $descr_len),0,$descr_len)." Current Average Maximum\l'"; } - $c_i = 0; $dbq = dbFetchRows("SELECT * FROM `munin_plugins_ds` WHERE `mplug_id` = ?", array($mplug['mplug_id'])); foreach ($dbq as $ds) @@ -33,15 +32,15 @@ foreach ($dbq as $ds) $cmd_def .= " DEF:".$ds['ds_name']."=".$ds_filename.":val:AVERAGE"; - if(!empty($ds['ds_cdef'])) + if (!empty($ds['ds_cdef'])) { $cmd_cdef .= ""; $ds_name = $ds['ds_name']."_cdef"; } - if($ds['ds_graph'] == "yes") + if ($ds['ds_graph'] == "yes") { - if(empty($ds['colour'])) + if (empty($ds['colour'])) { if (!$config['graph_colours']['mixed'][$c_i]) { $c_i = 0; } $colour=$config['graph_colours']['mixed'][$c_i]; $c_i++; diff --git a/html/pages/device.inc.php b/html/pages/device.inc.php index d907903ee..64f5ab157 100644 --- a/html/pages/device.inc.php +++ b/html/pages/device.inc.php @@ -227,7 +227,6 @@ if (device_permitted($vars['device']) || $check_device == $vars['device']) '); } - if ($_SESSION['userlevel'] >= "5" && dbFetchCell("SELECT COUNT(*) FROM links AS L, ports AS I WHERE I.device_id = '".$device['device_id']."' AND I.interface_id = L.local_interface_id")) { $discovery_links = TRUE; diff --git a/html/pages/device/apps.inc.php b/html/pages/device/apps.inc.php index 5eca3710a..215e8fd26 100644 --- a/html/pages/device/apps.inc.php +++ b/html/pages/device/apps.inc.php @@ -25,7 +25,7 @@ foreach (dbFetchRows("SELECT * FROM `applications` WHERE `device_id` = ?", array } $link_add = array('app'=>$app['app_type']); $text = ucfirst($app['app_type']); - if(!empty($app['app_instance'])) + if (!empty($app['app_instance'])) { $text .= "(".$app['app_instance'].")"; $link_add['instance'] = $app['app_id']; diff --git a/html/pages/device/apps/memcached.inc.php b/html/pages/device/apps/memcached.inc.php index aab74021e..28aaeaa41 100644 --- a/html/pages/device/apps/memcached.inc.php +++ b/html/pages/device/apps/memcached.inc.php @@ -6,7 +6,7 @@ $graphs = array('memcached_bits' => 'Traffic', 'memcached_commands' => 'Commands', 'memcached_data' => 'Data Size', 'memcached_items' => 'Items', - 'memcached_uptime' => 'Uptime', + 'memcached_uptime' => 'Uptime', 'memcached_threads' => 'Threads', ); diff --git a/html/pages/device/graphs.inc.php b/html/pages/device/graphs.inc.php index 03f129791..cadfeaf0f 100644 --- a/html/pages/device/graphs.inc.php +++ b/html/pages/device/graphs.inc.php @@ -19,7 +19,7 @@ $sep = ""; foreach (dbFetchRows("SELECT * FROM munin_plugins WHERE device_id = ? ORDER BY mplug_category, mplug_type", array($device['device_id'])) as $mplug) { -# if(strlen($mplug['mplug_category']) == 0) { $mplug['mplug_category'] = "general"; } else { } +# if (strlen($mplug['mplug_category']) == 0) { $mplug['mplug_category'] = "general"; } else { } $graph_enable[$mplug['mplug_category']][$mplug['mplug_type']]['id'] = $mplug['mplug_id']; $graph_enable[$mplug['mplug_category']][$mplug['mplug_type']]['title'] = $mplug['mplug_title']; } @@ -31,7 +31,7 @@ foreach (dbFetchRows("SELECT * FROM device_graphs WHERE device_id = ? ORDER BY g } #foreach ($config['graph_sections'] as $section) -foreach($graph_enable as $section => $nothing) +foreach ($graph_enable as $section => $nothing) { if (isset($graph_enable) && is_array($graph_enable[$section])) { @@ -57,11 +57,11 @@ print_optionbar_end(); $graph_enable = $graph_enable[$vars['group']]; #foreach ($config['graph_types']['device'] as $graph => $entry) -foreach($graph_enable as $graph => $entry) +foreach ($graph_enable as $graph => $entry) { if ($graph_enable[$graph]) { - if(is_numeric($entry['id'])) + if (is_numeric($entry['id'])) { $graph_title = $entry['title']; $graph_array['type'] = "munin_graph"; @@ -70,6 +70,7 @@ foreach($graph_enable as $graph => $entry) $graph_title = $config['graph_types']['device'][$graph]['descr']; $graph_array['type'] = "device_" . $graph; } + include("includes/print-device-graph.php"); } } diff --git a/html/pages/device/overview.inc.php b/html/pages/device/overview.inc.php index 4ad42ad91..b16739191 100644 --- a/html/pages/device/overview.inc.php +++ b/html/pages/device/overview.inc.php @@ -18,7 +18,9 @@ if ($ports['down']) { $ports_colour = $warn_colour_a; } else { $ports_colour = $ echo("
"); + include("includes/dev-overview-data.inc.php"); + echo(""); include("overview/ports.inc.php"); diff --git a/html/pages/device/overview/generic/sensor.inc.php b/html/pages/device/overview/generic/sensor.inc.php index 48895b9cb..ececd96f0 100644 --- a/html/pages/device/overview/generic/sensor.inc.php +++ b/html/pages/device/overview/generic/sensor.inc.php @@ -14,7 +14,7 @@ if (count($sensors)) $sensor['sensor_current'] = $memcache->get('sensor-'.$sensor['sensor_id'].'-value'); } - if(empty($sensor['sensor_current'])) + if (empty($sensor['sensor_current'])) { $sensor['sensor_current'] = "NaN"; } diff --git a/html/pages/device/port.inc.php b/html/pages/device/port.inc.php index 1ccedbe3a..e0445f0cf 100644 --- a/html/pages/device/port.inc.php +++ b/html/pages/device/port.inc.php @@ -7,14 +7,13 @@ $port = dbFetchRow("SELECT * FROM `ports` WHERE `interface_id` = ?", array($vars if ($config['memcached']['enable']) { $oids = array('ifInOctets', 'ifOutOctets', 'ifInUcastPkts', 'ifOutUcastPkts', 'ifInErrors', 'ifOutErrors'); - foreach($oids as $oid) + foreach ($oids as $oid) { $port[$oid.'_rate'] = $memcache->get('port-'.$port['interface_id'].'-'.$oid.'_rate'); - if($debug) { echo("MC[".$oid."->".$port[$oid.'_rate']."]"); } + if ($debug) { echo("MC[".$oid."->".$port[$oid.'_rate']."]"); } } } - $port_details = 1; $hostname = $device['hostname']; diff --git a/html/pages/device/ports.inc.php b/html/pages/device/ports.inc.php index c116de733..8443867a5 100644 --- a/html/pages/device/ports.inc.php +++ b/html/pages/device/ports.inc.php @@ -70,8 +70,7 @@ if ($vars['view'] == 'minigraphs') echo("
"); unset ($seperator); - ## FIX THIS. UGLY. - + ## FIXME - FIX THIS. UGLY. foreach (dbFetchRows("select * from ports WHERE device_id = ? ORDER BY ifIndex", array($device['device_id'])) as $port) { echo("
@@ -107,19 +106,18 @@ if ($vars['view'] == 'minigraphs') foreach ($ports as $port) { - if ($config['memcached']['enable']) -{ - $oids = array('ifInOctets', 'ifOutOctets', 'ifInUcastPkts', 'ifOutUcastPkts', 'ifInErrors', 'ifOutErrors'); - foreach($oids as $oid) - { - $port[$oid.'_rate'] = $memcache->get('port-'.$port['interface_id'].'-'.$oid.'_rate'); - if($debug) { echo("MC[".$oid."->".$port[$oid.'_rate']."]"); } - } -} - + { + $oids = array('ifInOctets', 'ifOutOctets', 'ifInUcastPkts', 'ifOutUcastPkts', 'ifInErrors', 'ifOutErrors'); + foreach ($oids as $oid) + { + $port[$oid.'_rate'] = $memcache->get('port-'.$port['interface_id'].'-'.$oid.'_rate'); + if ($debug) { echo("MC[".$oid."->".$port[$oid.'_rate']."]"); } + } + } include("includes/print-interface.inc.php"); + $i++; } echo("
"); diff --git a/html/pages/device/services.inc.php b/html/pages/device/services.inc.php index 74cdff910..ed55669f1 100644 --- a/html/pages/device/services.inc.php +++ b/html/pages/device/services.inc.php @@ -10,7 +10,7 @@ if (!$vars['view']) { $vars['view'] = "basic"; } $sep = ""; foreach ($menu_options as $option => $text) { - if(empty($vars['view'])) { $vars['view'] = $option; } + if (empty($vars['view'])) { $vars['view'] = $option; } echo($sep); if ($vars['view'] == $option) { echo(""); } echo(generate_link($text, $vars, array('view'=>$option))); diff --git a/html/pages/health/sensors.inc.php b/html/pages/health/sensors.inc.php index 131c70317..df671f87b 100644 --- a/html/pages/health/sensors.inc.php +++ b/html/pages/health/sensors.inc.php @@ -31,9 +31,9 @@ foreach (dbFetchRows($sql, $param) as $sensor) $sensor['sensor_current'] = $memcache->get('sensor-'.$sensor['sensor_id'].'-value'); } - if(empty($sensor['sensor_current'])) - { - $sensor['sensor_current'] = "NaN"; + if (empty($sensor['sensor_current'])) + { + $sensor['sensor_current'] = "NaN"; } else { if ($sensor['sensor_current'] >= $sensor['sensor_limit']) { $alert = 'alert'; } else { $alert = ""; } } diff --git a/html/pages/search/arp.inc.php b/html/pages/search/arp.inc.php index 22a493a31..38b64e504 100644 --- a/html/pages/search/arp.inc.php +++ b/html/pages/search/arp.inc.php @@ -18,7 +18,7 @@ foreach (dbFetchRows("SELECT D.device_id AS device_id, `hostname` FROM `ipv4_mac ?> - Search by + Search by