syntaxer run

git-svn-id: http://www.observium.org/svn/observer/trunk@3117 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
Tom Laermans 2012-05-02 22:02:30 +00:00
parent 944130f0bb
commit 613e8b1e29
31 changed files with 66 additions and 73 deletions

View File

@ -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'";

View File

@ -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");

View File

@ -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";

View File

@ -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'];

View File

@ -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++;

View File

@ -227,7 +227,6 @@ if (device_permitted($vars['device']) || $check_device == $vars['device'])
</li>');
}
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;

View File

@ -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'];

View File

@ -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',
);

View File

@ -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");
}
}

View File

@ -18,7 +18,9 @@ if ($ports['down']) { $ports_colour = $warn_colour_a; } else { $ports_colour = $
echo("<table width=100% cellspacing=0 cellpadding=0><tr><td style='width: 50%; vertical-align: top;>");
echo("<div style='background-color: #eeeeee; margin: 5px; padding: 5px;'>");
include("includes/dev-overview-data.inc.php");
echo("</div>");
include("overview/ports.inc.php");

View File

@ -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";
}

View File

@ -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'];

View File

@ -70,8 +70,7 @@ if ($vars['view'] == 'minigraphs')
echo("<div style='display: block; clear: both; margin: auto; min-height: 500px;'>");
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("<div style='display: block; padding: 3px; margin: 3px; min-width: 183px; max-width:183px; min-height:90px; max-height:90px; text-align: center; float: left; background-color: #e9e9e9;'>
@ -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("</table></div>");

View File

@ -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("<span class='pagemenu-selected'>"); }
echo(generate_link($text, $vars, array('view'=>$option)));

View File

@ -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 = '<img src="images/16/flag_red.png" alt="alert" />'; } else { $alert = ""; }
}

View File

@ -18,7 +18,7 @@ foreach (dbFetchRows("SELECT D.device_id AS device_id, `hostname` FROM `ipv4_mac
?>
</select>
</td>
<td width="200" style="padding: 1px;">Search by
<td width="200" style="padding: 1px;">Search by
<select name="searchby" id="searchby">
<option value="mac" <?php if ($_POST['searchby'] != "ip") { echo("selected"); } ?> >MAC Address</option>
<option value="ip" <?php if ($_POST['searchby'] == "ip") { echo("selected"); } ?> >IP Address</option>
@ -70,22 +70,21 @@ foreach (dbFetchRows($query, $param) as $entry)
{
$error_img = generate_port_link($entry,"<img src='images/16/chart_curve_error.png' alt='Interface Errors' border=0>",errors);
} else { $error_img = ""; }
$arp_host = dbFetchRow("SELECT * FROM ipv4_addresses AS A, ports AS I, devices AS D WHERE A.ipv4_address = ? AND I.interface_id = A.interface_id AND D.device_id = I.device_id", array($entry['ipv4_address']));
$arp_host = dbFetchRow("SELECT * FROM ipv4_addresses AS A, ports AS I, devices AS D WHERE A.ipv4_address = ? AND I.interface_id = A.interface_id AND D.device_id = I.device_id", array($entry['ipv4_address']));
if ($arp_host) { $arp_name = generate_device_link($arp_host); } else { unset($arp_name); }
if ($arp_host) { $arp_if = generate_port_link($arp_host); } else { unset($arp_if); }
if ($arp_host['device_id'] == $entry['device_id']) { $arp_name = "Localhost"; }
if ($arp_host['interface_id'] == $entry['interface_id']) { $arp_if = "Local port"; }
echo('<tr class="search">
<td width="160">' . formatMac($entry['mac_address']) . '</td>
<td width="140">' . $entry['ipv4_address'] . '</td>
<td width="200" class="list-bold">' . generate_device_link($entry) . '</td>
<td width="200" class="list-bold">' . generate_device_link($entry) . '</td>
<td class="list-bold">' . generate_port_link($entry, makeshortif(fixifname($entry['ifDescr']))) . ' ' . $error_img . '</td>
<td width="200">'.$arp_name.'</td>
<td width="200">'.$arp_name.'</td>
<td class="list-bold">'.$arp_if.'</td>
</tr>');
</tr>');
}
unset($ignore);

View File

@ -14,7 +14,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("<span class='pagemenu-selected'>"); }
echo(generate_link($text, $vars, array('view'=>$option)));

View File

@ -55,7 +55,7 @@ $config['dot'] = "/usr/bin/dot";
$config['unflatten'] = "/usr/bin/unflatten";
$config['neato'] = "/usr/bin/neato";
$config['sfdp'] = "/usr/bin/sfdp";
$config['svn'] = "/usr/bin/svn";
$config['svn'] = "/usr/bin/svn";
### Memcached - Keep immediate statistics
@ -143,7 +143,7 @@ $config['email_smtp_port'] = 25; ## The port to con
$config['email_smtp_timeout'] = 10; ## SMTP connection timeout in seconds.
$config['email_smtp_secure'] = NULL; ## Enable encryption. Use 'tls' or 'ssl'
$config['email_smtp_auth'] = FALSE; ## Whether or not to use SMTP authentication.
$config['email_smtp_username'] = NULL; ## SMTP username.
$config['email_smtp_username'] = NULL; ## SMTP username.
$config['email_smtp_password'] = NULL; ## Password for SMTP authentication.
### Alerting Settings

View File

@ -9,7 +9,7 @@ if ($config['enable_pseudowires'] && $device['os_group'] == "cisco")
/// Pre-cache the existing state of pseudowires for this device from the database
$pws_db_raw = dbFetchRows("SELECT * FROM `pseudowires` WHERE `device_id` = ?", array($device['device_id']));
foreach($pws_db_raw as $pw_db)
foreach ($pws_db_raw as $pw_db)
{
$device['pws_db'][$pw_db['cpwVcID']] = $pw_db['pseudowire_id'];
}
@ -24,8 +24,7 @@ if ($config['enable_pseudowires'] && $device['os_group'] == "cisco")
/// For MPLS pseudowires
$pws = snmpwalk_cache_oid($device, "cpwVcMplsPeerLdpID", $pws, "CISCO-IETF-PW-MPLS-MIB");
foreach($pws as $pw_id => $pw)
foreach ($pws as $pw_id => $pw)
{
list($cpw_remote_id) = explode(":", $pw['cpwVcMplsPeerLdpID']);
$cpw_remote_device = @mysql_result(mysql_query("SELECT device_id FROM ipv4_addresses AS A, ports AS I WHERE A.ipv4_address = '".$cpw_remote_id."' AND A.interface_id = I.interface_id"),0);
@ -46,9 +45,9 @@ if ($config['enable_pseudowires'] && $device['os_group'] == "cisco")
}
/// Cycle the list of pseudowires we cached earlier and make sure we saw them again.
foreach($device['pws_db'] as $pw_id => $pseudowire_id)
foreach ($device['pws_db'] as $pw_id => $pseudowire_id)
{
if(empty($device['pws'][$pw_id]))
if (empty($device['pws'][$pw_id]))
{
dbDelete('vlans', "`pseudowire_id` = ?", array($pseudowire_id));
}

View File

@ -34,7 +34,7 @@ lhAlarmThrsh.0 = INTEGER: 30 rH%
smDehumSetp.0 = INTEGER: 75 rH%
smHumidSetp.0 = INTEGER: 35 rH%
*/
}
?>

View File

@ -11,7 +11,7 @@ if (!$os)
## Check for QNAP Systems TurboNAS
$entPhysicalMfgName = snmp_get($device, "ENTITY-MIB::entPhysicalMfgName.1", "-Osqnv");
if(strstr($sysObjectId, ".1.3.6.1.4.1.5528.100.20.10.2014")) { $os = "netbotz"; }
if (strstr($sysObjectId, ".1.3.6.1.4.1.5528.100.20.10.2014")) { $os = "netbotz"; }
elseif (strstr($sysDescr, "endian")) { $os = "endian"; }
elseif (preg_match("/Cisco Small Business/", $sysDescr)) { $os = "ciscosmblinux"; }
elseif (strpos($entPhysicalMfgName, "QNAP") !== FALSE) { $os = "qnap"; }
@ -25,7 +25,7 @@ if (!$os)
{
## Check for Carel PCOweb
$roomTemp = trim(snmp_get($device,"roomTemp.0", "-OqvU", "CAREL-ug40cdz-MIB"));
if (is_numeric($roomTemp))
{
$os = "pcoweb";

View File

@ -54,7 +54,7 @@ radcoolSpDX.0 = INTEGER: 280 degrees C
delTempLimit.0 = INTEGER: 14 degrees C x10
dtAutChgMLT.0 = INTEGER: 20 degrees C
*/
}
?>

View File

@ -4,7 +4,7 @@ echo("VLANs:\n");
/// Pre-cache the existing state of VLANs for this device from the database
$vlans_db_raw = dbFetchRows("SELECT * FROM `vlans` WHERE `device_id` = ?", array($device['device_id']));
foreach($vlans_db_raw as $vlan_db)
foreach ($vlans_db_raw as $vlan_db)
{
$vlans_db[$vlan_db['vlan_domain']][$vlan_db['vlan_vlan']] = $vlan_db;
}
@ -75,12 +75,11 @@ foreach ($device['vlans'] as $domain_id => $vlans)
}
}
foreach($vlans_db as $domain_id => $vlans)
foreach ($vlans_db as $domain_id => $vlans)
{
foreach($vlans as $vlan_id => $vlan)
foreach ($vlans as $vlan_id => $vlan)
{
if(empty($device['vlans'][$domain_id][$vlan_id]))
if (empty($device['vlans'][$domain_id][$vlan_id]))
{
dbDelete('vlans', "`device_id` = ? AND vlan_domain = ? AND vlan_vlan = ?", array($device['device_id'], $domain_id, $vlan_id));
}

View File

@ -13,7 +13,7 @@ if ($device['os_group'] == "cisco")
$vtpdomains = snmpwalk_cache_oid($device, "vlanManagementDomains", array(), "CISCO-VTP-MIB");
$vlans = snmpwalk_cache_twopart_oid($device, "vtpVlanEntry", array(), "CISCO-VTP-MIB");
foreach($vtpdomains as $vtpdomain_id => $vtpdomain)
foreach ($vtpdomains as $vtpdomain_id => $vtpdomain)
{
echo("VTP Domain ".$vtpdomain_id." ".$vtpdomain['managementDomainName']." ");
foreach ($vlans[$vtpdomain_id] as $vlan_id => $vlan)

View File

@ -17,6 +17,7 @@ include_once($config['install_dir'] . "/includes/snmp.inc.php");
include_once($config['install_dir'] . "/includes/services.inc.php");
include_once($config['install_dir'] . "/includes/dbFacile.php");
include_once($config['install_dir'] . "/includes/console_colour.php");
if ($config['alerts']['email']['enable'])
{
include_once($config['install_dir'] . "/includes/phpmailer/class.phpmailer.php");
@ -589,7 +590,7 @@ function notify($device,$title,$message)
break;
}
// Sending email
if(!$mail->Send()) { echo "Mailer Error: " . $mail->ErrorInfo . "\n"; }
if (!$mail->Send()) { echo "Mailer Error: " . $mail->ErrorInfo . "\n"; }
}
}
}

View File

@ -27,9 +27,9 @@ $rrd_filename = $config['rrd_dir'] . "/" . $device['hostname'] . "/app-drbd-".$
}
$ds_list = array('ns','nr','dw','dr','al','bm','lo','pe','ua','ap','oos');
foreach($ds_list as $ds)
foreach ($ds_list as $ds)
{
if(empty($drbd[$ds])) { $drbd[$ds] = "U"; }
if (empty($drbd[$ds])) { $drbd[$ds] = "U"; }
}
rrdtool_update($rrd_filename, "N:".$drbd['ns'].":".$drbd['nr'].":".$drbd['dw'].":".$drbd['dr'].":".$drbd['al'].":".$drbd['bm'].":".$drbd['lo'].":".$drbd['pe'].":".$drbd['ua'].":".$drbd['ap'].":".$drbd['oop']);

View File

@ -33,12 +33,11 @@ echo("memcached(".$app['app_instance'].") ");
'connection_structures','bytes','cmd_get','cmd_set','get_hits','get_misses','evictions','bytes_read','bytes_written');
$values = array();
foreach ($dslist as $ds)
foreach ($dslist as $ds)
{
$values[] = isset($data[$ds]) ? $data[$ds] : -1;
}
rrdtool_update($rrd_filename, "N:".implode(":", $values));
?>

View File

@ -241,5 +241,4 @@ if (!is_file($mysql_status_rrd))
rrdtool_update($mysql_status_rrd, "N:$string");
?>

View File

@ -139,7 +139,7 @@ function poll_device($device, $options)
if ($options['m'])
{
foreach(explode(",", $options['m']) as $module)
foreach (explode(",", $options['m']) as $module)
{
if (is_file("includes/polling/".$module.".inc.php"))
{

View File

@ -40,11 +40,11 @@ if($device['os_group'] == "unix")
list($section, $data) = explode(">>>", $section);
list($sa, $sb) = explode("-", $section, 2);
if($section == "apache") { $sa = "app"; $sb = "apache"; }
if($section == "mysql") { $sa = "app"; $sb = "mysql"; }
# if($section == "drbd") { $sa = "app"; $sb = "drbd"; }
if ($section == "apache") { $sa = "app"; $sb = "apache"; }
if ($section == "mysql") { $sa = "app"; $sb = "mysql"; }
# if ($section == "drbd") { $sa = "app"; $sb = "drbd"; }
if(!empty($sa) && !empty($sb))
if (!empty($sa) && !empty($sb))
{
$agent_data[$sa][$sb] = trim($data);
} else {

View File

@ -19,7 +19,6 @@ $stat_serial = base64_encode(serialize($stats));
$url = "http://www.observium.org/latest.php?i=".$stats['ports']."&d=".$stats['devices']."&stats=".$stat_serial."&v=".$config['version'];
$dataHandle = fopen($url, r);
if ($dataHandle)
{
while (!feof($dataHandle))
@ -44,7 +43,7 @@ if ($dataHandle)
{
echo("Current Revision : $cur_revision\n");
if ($omnipotence > $cur_revision)
if ($omnipotence > $cur_revision)
{
echo("New Revision : $omnipotence\n");
}