syntaxer run

git-svn-id: http://www.observium.org/svn/observer/trunk@3147 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
Tom Laermans
2012-05-07 16:23:43 +00:00
parent 56b2b49089
commit 6a1cce6090
8 changed files with 42 additions and 43 deletions

View File

@@ -60,7 +60,7 @@ if (isset($_GET['format']) && preg_match("/^[a-z]*$/", $_GET['format']))
$links = dbFetch("SELECT * from ports AS I, links AS L WHERE I.device_id = ? AND L.local_interface_id = I.interface_id ORDER BY L.remote_hostname", array($device['device_id']));
if (count($links))
{
if($anon) { $device['hostname'] = md5($device['hostname']); }
if ($anon) { $device['hostname'] = md5($device['hostname']); }
if (!isset($locations[$device['location']])) { $locations[$device['location']] = $loc_count; $loc_count++; }
$loc_id = $locations[$device['location']];
@@ -95,17 +95,17 @@ if (isset($_GET['format']) && preg_match("/^[a-z]*$/", $_GET['format']))
}
$src = $device['hostname'];
if($anon) { $src = md5($src); }
if ($anon) { $src = md5($src); }
if ($remote_interface_id)
{
$dst = dbFetchCell("SELECT `hostname` FROM `devices` AS D, `ports` AS I WHERE I.interface_id = ? AND D.device_id = I.device_id", array($remote_interface_id));
$dst = dbFetchCell("SELECT `hostname` FROM `devices` AS D, `ports` AS I WHERE I.interface_id = ? AND D.device_id = I.device_id", array($remote_interface_id));
$dst_host = dbFetchCell("SELECT D.device_id FROM `devices` AS D, `ports` AS I WHERE I.interface_id = ? AND D.device_id = I.device_id", array($remote_interface_id));
} else {
unset($dst_host);
$dst = $link['remote_hostname'];
}
if($anon) { $dst = md5($dst); $src = md5($src);}
if ($anon) { $dst = md5($dst); $src = md5($src);}
$sif = ifNameDescr(dbFetchRow("SELECT * FROM ports WHERE `interface_id` = ?", array($link['local_interface_id'])),$device);
if ($remote_interface_id)

View File

@@ -28,7 +28,7 @@ if ($_SESSION['userlevel'] < '7')
}
$panes['ipmi'] = 'IPMI';
print_optionbar_start();
unset($sep);

View File

@@ -60,7 +60,6 @@ for ($i = 0;$i < count($config['os'][$device['os']]['icons']);$i++)
echo('<input name="icon" type="radio" value="' . $icon . '"' . ($device['icon'] == $icon ? ' checked="1"' : '') . ' /></td>' . "\n");
}
if ($numicons %10 == 0)
{
echo(" </tr>\n");

View File

@@ -151,7 +151,7 @@ if ($config['enable_bgp'])
$j_afisafi[$index][] = $afisafi;
}
}
foreach ($j_afisafi[$j_peerIndexes[$peer['ip']]] as $afisafi)
{
list ($afi,$safi) = explode('.',$afisafi); $safi = $safis[$safi];

View File

@@ -32,7 +32,7 @@ if (($device['os'] == "vmware") || ($device['os'] == "linux"))
if ($oids != "")
{
$oids = explode("\n", $oids);
foreach ($oids as $oid)
{
/*
@@ -51,27 +51,27 @@ if (($device['os'] == "vmware") || ($device['os'] == "linux"))
* VMWARE-VMINFO-MIB::vmwVmCpus.224 = INTEGER: 2
* VMWARE-VMINFO-MIB::vmwVmCpus.416 = INTEGER: 2
*/
$vmwVmDisplayName = snmp_get($device, "VMWARE-VMINFO-MIB::vmwVmDisplayName." . $oid, "-Osqnv", "+VMWARE-ROOT-MIB:VMWARE-VMINFO-MIB", "+" . $config["install_dir"] . "/mibs/vmware:" . $config["install_dir"] . "/mibs");
$vmwVmGuestOS = snmp_get($device, "VMWARE-VMINFO-MIB::vmwVmGuestOS." . $oid, "-Osqnv", "+VMWARE-ROOT-MIB:VMWARE-VMINFO-MIB", "+" . $config["install_dir"] . "/mibs/vmware:" . $config["install_dir"] . "/mibs");
$vmwVmMemSize = snmp_get($device, "VMWARE-VMINFO-MIB::vmwVmMemSize." . $oid, "-Osqnv", "+VMWARE-ROOT-MIB:VMWARE-VMINFO-MIB", "+" . $config["install_dir"] . "/mibs/vmware:" . $config["install_dir"] . "/mibs");
$vmwVmState = snmp_get($device, "VMWARE-VMINFO-MIB::vmwVmState." . $oid, "-Osqnv", "+VMWARE-ROOT-MIB:VMWARE-VMINFO-MIB", "+" . $config["install_dir"] . "/mibs/vmware:" . $config["install_dir"] . "/mibs");
$vmwVmCpus = snmp_get($device, "VMWARE-VMINFO-MIB::vmwVmCpus." . $oid, "-Osqnv", "+VMWARE-ROOT-MIB:VMWARE-VMINFO-MIB", "+" . $config["install_dir"] . "/mibs/vmware:" . $config["install_dir"] . "/mibs");
/*
* VMware does not return an INTEGER but a STRING of the vmwVmMemSize. This bug
* might be resolved by VMware in the future making this code obsolete.
*/
if (preg_match("/^([0-9]+) .*$/", $vmwVmMemSize, $matches))
{
$vmwVmMemSize = $matches[1];
}
/*
* Check whether the Virtual Machine is already known for this host.
*/
if (mysql_result(mysql_query("SELECT COUNT(id) FROM vminfo WHERE device_id = '" . $device["device_id"] . "' AND vmwVmVMID = '" . $oid . "' AND vm_type='vmware'"), 0) == 0)
{
mysql_query("INSERT INTO vminfo (device_id, vm_type, vmwVmVMID, vmwVmDisplayName, vmwVmGuestOS, vmwVmMemSize, vmwVmCpus, vmwVmState) VALUES (" . $device["device_id"] . ",'vmware', " . $oid . ", '" . mres($vmwVmDisplayName) . "', '" . mres($vmwVmGuestOS) . "', " . $vmwVmMemSize . ", " . $vmwVmCpus . ", '" . mres($vmwVmState) . "')");
@@ -81,15 +81,15 @@ if (($device['os'] == "vmware") || ($device['os'] == "linux"))
echo(".");
}
# FIXME update code!
/*
* Save the discovered Virtual Machine.
*/
$vmw_vmlist[] = $oid;
}
}
/*
* Get a list of all the known Virtual Machines for this host.
*/
@@ -113,8 +113,8 @@ if (($device['os'] == "vmware") || ($device['os'] == "linux"))
/*
* Finished discovering VMware information.
*/
echo("\n");
}
?>

View File

@@ -20,7 +20,7 @@
$poll_device['sysObjectID'] = snmp_get($device, "sysObjectID.0", "-Oqvn", "SNMPv2-MIB");
$poll_device['sysName'] = strtolower($poll_device['sysName']);
if(!empty($agent_data['uptime'])) { list($uptime) = explode(" ", $agent_data['uptime']); $uptime = round($uptime); echo("Using UNIX Agent Uptime ($uptime)\n");}
if (!empty($agent_data['uptime'])) { list($uptime) = explode(" ", $agent_data['uptime']); $uptime = round($uptime); echo("Using UNIX Agent Uptime ($uptime)\n");}
if (empty($uptime))
{

View File

@@ -4,7 +4,7 @@
if (!empty($agent_data['munin']))
{
echo("Munin Plugins:");
if($debug) { print_r($agent_data['munin']); }
if ($debug) { print_r($agent_data['munin']); }
// Build array of existing plugins
$plugins_dbq = dbFetchRows("SELECT * FROM `munin_plugins` WHERE `device_id` = ?", array($device['device_id']));
@@ -18,12 +18,12 @@
if (is_dir($old_plugins_rrd_dir) && !is_dir($plugins_rrd_dir)) { rename($old_plugins_dir, $plugins_dir); }
if (!is_dir($plugins_rrd_dir)) { mkdir($plugins_rrd_dir); echo("Created directory : $plugins_rrd_dir\n"); }
$plugin = array();
foreach($agent_data['munin'] AS $plugin_type => $plugin_data)
foreach ($agent_data['munin'] AS $plugin_type => $plugin_data)
{
$plugin = array();
# list($plugin_type, $instance) = explode("_", $plugin_type);
# if(!empty($instance))
# if (!empty($instance))
# {
# echo("\nPlugin: $plugin_type ($instance)");
# $plugin_rrd = $plugins_rrd_dir . "/" . $plugin_type."_".$instance;
@@ -34,12 +34,12 @@
$plugin_uniq = $plugin_type."_";
# }
if($debug) { echo("\n[$plugin_data]\n"); }
foreach(explode("\n", $plugin_data) as $line)
if ($debug) { echo("\n[$plugin_data]\n"); }
foreach (explode("\n", $plugin_data) as $line)
{
list($key, $value) = explode(" ", $line, 2);
if(preg_match("/^graph_/", $key))
if (preg_match("/^graph_/", $key))
{
list(,$key) = explode("_", $key);
$plugin['graph'][$key] = $value;
@@ -49,7 +49,7 @@
}
}
if(!is_array($plugins_db[$plugin_type]))
if (!is_array($plugins_db[$plugin_type]))
{
$insert = array('device_id' => $device['device_id'], 'mplug_type' => $plugin_type,
'mplug_instance' => ($instance == NULL ? array('NULL') : $instance),
@@ -64,10 +64,10 @@
$mplug_id = $plugins_db[$plugin_type]['id'];
}
if($mplug_id)
if ($mplug_id)
{
echo(" ID: $mplug_id");
echo(" ID: $mplug_id");
$dbq = dbFetchRows("SELECT * FROM `munin_plugins_ds` WHERE `mplug_id` = ?", array($mplug_id));
foreach ($dbq as $v)
@@ -75,27 +75,27 @@
$vu = $v['mplug_id']."_".$v['ds_name'];
$ds_list[$vu] = 1;
}
unset($dbq); unset($v);
unset($dbq); unset($v);
foreach($plugin['values'] as $name => $data)
foreach ($plugin['values'] as $name => $data)
{
echo(" $name");
if(empty($data['type'])) { $data['type'] = "GAUGE"; }
if(empty($data['graph'])) { $data['graph'] = "yes"; }
if(empty($data['label'])) { $data['label'] = $name; }
if(empty($data['draw'])) { $data['draw'] = "LINE1.5"; }
if (empty($data['type'])) { $data['type'] = "GAUGE"; }
if (empty($data['graph'])) { $data['graph'] = "yes"; }
if (empty($data['label'])) { $data['label'] = $name; }
if (empty($data['draw'])) { $data['draw'] = "LINE1.5"; }
$cmd = "--step 300 DS:val:".$data['type'].":600:0:U ";
$cmd = "--step 300 DS:val:".$data['type'].":600:0:U ";
$cmd .= $config['rrd_rra'];
$ds_uniq = $mplug_id."_".$name;
$filename = $plugin_rrd."_".$name.".rrd";
if (!is_file($filename))
$filename = $plugin_rrd."_".$name.".rrd";
if (!is_file($filename))
{
rrdtool_create($filename, $cmd);
rrdtool_create($filename, $cmd);
}
rrdtool_update($filename,"N:".$data['value']);
rrdtool_update($filename,"N:".$data['value']);
if(empty($ds_list[$ds_uniq]))
if (empty($ds_list[$ds_uniq]))
{
$insert = array('mplug_id' => $mplug_id, 'ds_name' => $name,
'ds_type' => $data['type'], 'ds_label' => $data['label'],

View File

@@ -162,7 +162,7 @@ function rrdtool($command, $filename, $options)
$cmd .= " --daemon " . $config['rrdcached'];
}
if($config['norrd'])
if ($config['norrd'])
{
print Console_Color::convert("%g RRD Disabled %n", false);
} else {
@@ -194,7 +194,7 @@ function rrdtool_create($filename, $options)
{
global $config, $debug;
if($config['norrd'])
if ($config['norrd'])
{
print Console_Color::convert("%g RRD Disabled %n", false);
} else {