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
+3 -3
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,7 +95,7 @@ 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));
@@ -105,7 +105,7 @@ if (isset($_GET['format']) && preg_match("/^[a-z]*$/", $_GET['format']))
$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)
-1
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");
+1 -1
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))
{
@@ -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"); }
if ($debug) { echo("\n[$plugin_data]\n"); }
foreach(explode("\n", $plugin_data) as $line)
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'],
+2 -2
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 {