all trailing spaces must die, this concludes the polling part

git-svn-id: http://www.observium.org/svn/observer/trunk@1881 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
Tom Laermans
2011-03-16 17:57:40 +00:00
parent 31b2092041
commit f0ed749a26
10 changed files with 32 additions and 32 deletions

View File

@@ -10,7 +10,7 @@ if (mysql_affected_rows())
while ($app = mysql_fetch_array($app_data))
{
$app_include = $config['install_dir'].'/includes/polling/applications/'.$app['app_type'].'.inc.php';
if (is_file($app_include))
if (is_file($app_include))
{
include($app_include);
}

View File

@@ -6,7 +6,7 @@ while ($sensor = mysql_fetch_array($sensors))
{
echo("Checking Entity Sensor " . $sensor['entPhysicalName'] . " - " . $sensor['cempsensorName']);
$oid = $sensor['entPhysicalIndex'];
$oid = $sensor['entPhysicalIndex'];
$sensor_cmd = $config['snmpget'] . " -M ".$config['mibdir']." -m CISCO-ENTITY-SENSOR-MIB -O Uqnv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'];
$sensor_cmd .= " entSensorValue.$oid entSensorStatus.$oid";

View File

@@ -81,10 +81,10 @@ if ($device['os_group'] == "ios")
if (is_file($rrd_filename) || $data['cipSecGlobalActiveTunnels'])
{
if (!file_exists($rrd_filename))
if (!file_exists($rrd_filename))
{
rrdtool_create($rrd_filename, $rrd_create);
}
}
$rrd_update = "N";
$rrd_update .= ":".$data['cipSecGlobalActiveTunnels'];

View File

@@ -4,10 +4,10 @@ $cip_oids = array('cipMacHCSwitchedBytes', 'cipMacHCSwitchedPkts');
echo("Caching OID: ");
$cip_array = array();
foreach ($cip_oids as $oid)
{
echo("$oid ");
$cip_array = snmpwalk_cache_cip($device, $oid, $cip_array, "CISCO-IP-STAT-MIB");
foreach ($cip_oids as $oid)
{
echo("$oid ");
$cip_array = snmpwalk_cache_cip($device, $oid, $cip_array, "CISCO-IP-STAT-MIB");
}
$polled = time();
@@ -37,7 +37,7 @@ while ($acc = mysql_fetch_assoc($mac_accounting_query))
$p_in = $cip_array[$ifIndex][$mac]['cipMacHCSwitchedPkts']['input'];
$p_out = $cip_array[$ifIndex][$mac]['cipMacHCSwitchedPkts']['output'];
$this_ma = &$cip_array[$ifIndex][$mac];
$this_ma = &$cip_array[$ifIndex][$mac];
/// Update metrics
foreach ($cip_oids as $oid)

View File

@@ -63,10 +63,10 @@ if ($device['os_group'] == "ios")
if (is_file($rrd_filename) || $data['crasEmailNumSessions'] || $data['crasIPSecNumSessions'] || $data['crasL2LNumSessions'] || $data['crasLBNumSessions'] || $data['crasSVCNumSessions'] || $data['crasWebvpnSessions'])
{
if (!file_exists($rrd_filename))
if (!file_exists($rrd_filename))
{
rrdtool_create($rrd_filename, $rrd_create);
}
}
$rrd_update = "N";
$rrd_update .= ":".$data['crasEmailNumSessions'];

View File

@@ -24,7 +24,7 @@ if (is_numeric($hrSystem[0]['hrSystemProcesses']))
RRA:MAX:0.5:24:800 \
RRA:MAX:0.5:288:800");
}
rrdtool_update($rrd_file, "N:".$hrSystem[0]['hrSystemProcesses']);
$graphs['hr_processes'] = TRUE;
echo(" Processes");
@@ -46,7 +46,7 @@ if (is_numeric($hrSystem[0]['hrSystemNumUsers']))
RRA:MAX:0.5:24:800 \
RRA:MAX:0.5:288:800");
}
rrdtool_update($rrd_file, "N:".$hrSystem[0]['hrSystemNumUsers']);
$graphs['hr_users'] = TRUE;
echo(" Users");

View File

@@ -2,9 +2,9 @@
/* FIXME: dead file */
if ($device['os_group'] == "ios") {
if ($device['os_group'] == "ios") {
$portifIndex = array();
$cmd = ($device['snmpver'] == 'v1' ? $config['snmpwalk'] : $config['snmpbulkwalk']) . " -M ".$config['mibdir']. " -CI -m CISCO-STACK-MIB -O q -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'] . " portIfIndex";
$cmd = ($device['snmpver'] == 'v1' ? $config['snmpwalk'] : $config['snmpbulkwalk']) . " -M ".$config['mibdir']. " -CI -m CISCO-STACK-MIB -O q -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'] . " portIfIndex";
#echo("$cmd");
$portifIndex_output = trim(shell_exec($cmd));
foreach (explode("\n", $portifIndex_output) as $entry){
@@ -54,7 +54,7 @@ while ($interface = mysql_fetch_array($interface_query)) {
$ifDescr = trim($ifDescr);
$ifIndex = $interface['ifIndex'];
if ($portifIndex[$ifIndex]) {
if ($portifIndex[$ifIndex]) {
if ($device['os'] == "CatOS") {
$cmd = $config['snmpget'] . " -M ".$config['mibdir'] . " -m CISCO-STACK-MIB -O qv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'] . " portName." . $portifIndex[$ifIndex];
$ifAlias = trim(shell_exec($cmd));
@@ -63,7 +63,7 @@ while ($interface = mysql_fetch_array($interface_query)) {
if ($config['os'][$device[os]]['ifname']) { $ifDescr = $ifName; }
$rrdfile = $host_rrd . "/" . safename($interface['ifIndex'] . ".rrd");
$rrdfile = $host_rrd . "/" . safename($interface['ifIndex'] . ".rrd");
if (!is_file($rrdfile)) {
rrdtool_create($rrdfile,"DS:INOCTETS:COUNTER:600:0:12500000000 \
@@ -97,7 +97,7 @@ while ($interface = mysql_fetch_array($interface_query)) {
$seperator = ", ";
eventlog("ifName -> $ifName", $interface['device_id'], $interface['interface_id']);
}
if ($interface['ifAlias'] != $ifAlias && $ifAlias != "" ) {
$update .= $seperator . "`ifAlias` = '".mres($ifAlias)."'";
$seperator = ", ";

View File

@@ -83,14 +83,14 @@ if ($ipSystemStats)
if (strstr($stats[$oid], "No") || strstr($stats[$oid], "d") || strstr($stats[$oid], "s")) { $stats[$oid] = "0"; }
$rrdupdate .= ":".$stats[$oid];
}
if (!file_exists($rrdfile)) { rrdtool_create($rrdfile,$rrd_create); }
rrdtool_update($rrdfile, $rrdupdate);
unset($rrdupdate, $rrd_create);
## FIXME per-AF?
$graphs['ipsystemstats_'.$af] = TRUE;
$graphs['ipsystemstats_'.$af.'_frag'] = TRUE;
}

View File

@@ -12,7 +12,7 @@ if (!is_array($mempool_cache['hpGlobal']))
{
$mempool_cache['hpGlobal'] = snmpwalk_cache_oid($device, "hpGlobal", NULL, "NETSWITCH-MIB", $config['mibdir'].":".$config['mibdir']."/hp");
if ($debug) { print_r($mempool_cache); }
}
}
else
{
if ($debug) { echo("Cached!"); }

View File

@@ -1,26 +1,26 @@
<?php
$cpe_oids = array('cpeExtPsePortEnable', 'cpeExtPsePortDiscoverMode', 'cpeExtPsePortDeviceDetected', 'cpeExtPsePortIeeePd',
'cpeExtPsePortAdditionalStatus', 'cpeExtPsePortPwrMax', 'cpeExtPsePortPwrAllocated', 'cpeExtPsePortPwrAvailable', 'cpeExtPsePortPwrConsumption',
'cpeExtPsePortMaxPwrDrawn', 'cpeExtPsePortEntPhyIndex', 'cpeExtPsePortEntPhyIndex', 'cpeExtPsePortPolicingCapable', 'cpeExtPsePortPolicingEnable',
$cpe_oids = array('cpeExtPsePortEnable', 'cpeExtPsePortDiscoverMode', 'cpeExtPsePortDeviceDetected', 'cpeExtPsePortIeeePd',
'cpeExtPsePortAdditionalStatus', 'cpeExtPsePortPwrMax', 'cpeExtPsePortPwrAllocated', 'cpeExtPsePortPwrAvailable', 'cpeExtPsePortPwrConsumption',
'cpeExtPsePortMaxPwrDrawn', 'cpeExtPsePortEntPhyIndex', 'cpeExtPsePortEntPhyIndex', 'cpeExtPsePortPolicingCapable', 'cpeExtPsePortPolicingEnable',
'cpeExtPsePortPolicingAction', 'cpeExtPsePortPwrManAlloc');
$peth_oids = array('pethPsePortAdminEnable', 'pethPsePortPowerPairsControlAbility', 'pethPsePortPowerPairs', 'pethPsePortDetectionStatus',
'pethPsePortPowerPriority', 'pethPsePortMPSAbsentCounter', 'pethPsePortType', 'pethPsePortPowerClassifications', 'pethPsePortInvalidSignatureCounter',
$peth_oids = array('pethPsePortAdminEnable', 'pethPsePortPowerPairsControlAbility', 'pethPsePortPowerPairs', 'pethPsePortDetectionStatus',
'pethPsePortPowerPriority', 'pethPsePortMPSAbsentCounter', 'pethPsePortType', 'pethPsePortPowerClassifications', 'pethPsePortInvalidSignatureCounter',
'pethPsePortPowerDeniedCounter', 'pethPsePortOverLoadCounter', 'pethPsePortShortCounter', 'pethMainPseConsumptionPower');
$port_stats = snmpwalk_cache_oid($device, "pethPsePortEntry", $port_stats, "POWER-ETHERNET-MIB");
$port_stats = snmpwalk_cache_oid($device, "cpeExtPsePortEntry", $port_stats, "CISCO-POWER-ETHERNET-EXT-MIB");
$port_stats = snmpwalk_cache_oid($device, "pethPsePortEntry", $port_stats, "POWER-ETHERNET-MIB");
$port_stats = snmpwalk_cache_oid($device, "cpeExtPsePortEntry", $port_stats, "CISCO-POWER-ETHERNET-EXT-MIB");
if ($port_stats[$port['ifIndex']] && $port['ifType'] == "ethernetCsmacd"
&& isset($port_stats[$port['ifIndex']]['dot3StatsIndex']))
if ($port_stats[$port['ifIndex']] && $port['ifType'] == "ethernetCsmacd"
&& isset($port_stats[$port['ifIndex']]['dot3StatsIndex']))
{ // Check to make sure Port data is cached.
$this_port = &$port_stats[$port['ifIndex']];
$rrdfile = $config['rrd_dir'] . "/" . $device['hostname'] . "/" . safename("port-".$port['ifIndex']."-poe.rrd");
if (!file_exists($rrdfile))
if (!file_exists($rrdfile))
{
$rrd_create .= "RRA:AVERAGE:0.5:1:600 RRA:AVERAGE:0.5:6:700 RRA:AVERAGE:0.5:24:775 RRA:AVERAGE:0.5:288:797 RRA:MAX:0.5:1:600 \
RRA:MAX:0.5:6:700 RRA:MAX:0.5:24:775 RRA:MAX:0.5:288:797";