mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
syntaxer run
git-svn-id: http://www.observium.org/svn/observer/trunk@2966 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
@@ -21,86 +21,86 @@ foreach ($data as $str)
|
||||
}
|
||||
|
||||
$mapping = array(
|
||||
'IDBLBSe' => 'cr',
|
||||
'IBLFh' => 'ct',
|
||||
'IBLWn' => 'cu',
|
||||
'IBLWn' => 'cu',
|
||||
'SRows' => 'ck',
|
||||
'SRange' => 'cj',
|
||||
'SMPs' => 'ci',
|
||||
'SScan' => 'cl',
|
||||
'IBIRd' => 'ai',
|
||||
'IBIWr' => 'aj',
|
||||
'IBILg' => 'ak',
|
||||
'IBIFSc' => 'ah',
|
||||
'IDBRDd' => 'b2',
|
||||
'IDBRId' => 'b0',
|
||||
'IDBRRd' => 'b3',
|
||||
'IDBRUd' => 'b1',
|
||||
'IBRd' => 'ae',
|
||||
'IBCd' => 'af',
|
||||
'IBWr' => 'ag',
|
||||
'TLIe' => 'b5',
|
||||
'TLWd' => 'b4',
|
||||
'IBPse' => 'aa',
|
||||
'IBPDBp' => 'ac',
|
||||
'IBPFe' => 'ab',
|
||||
'IBPMps' => 'ad',
|
||||
'TOC' => 'bc',
|
||||
'OFs' => 'b7',
|
||||
'OTs' => 'b8',
|
||||
'OdTs' => 'b9',
|
||||
'IBSRs' => 'ay',
|
||||
'IBSWs' => 'ax',
|
||||
'IBOWs' => 'az',
|
||||
'QCs' => 'c1',
|
||||
'QCeFy' => 'bu',
|
||||
'MaCs' => 'bl',
|
||||
'MUCs' => 'bf',
|
||||
'ACs' => 'bd',
|
||||
'AdCs' => 'be',
|
||||
'TCd' => 'bi',
|
||||
'Cs' => 'bn',
|
||||
'IBTNx' => 'a5',
|
||||
'KRRs' => 'a0',
|
||||
'KRs' => 'a1',
|
||||
'KWR' => 'a2',
|
||||
'KWs' => 'a3',
|
||||
'QCQICe' => 'bz',
|
||||
'QCHs' => 'bv',
|
||||
'QCIs' => 'bw',
|
||||
'QCNCd' => 'by',
|
||||
'QCLMPs' => 'bx',
|
||||
'CTMPDTs' => 'cn',
|
||||
'CTMPTs' => 'cm',
|
||||
'CTMPFs' => 'co',
|
||||
'IBIIs' => 'au',
|
||||
'IBIMRd' => 'av',
|
||||
'IBIMs' => 'aw',
|
||||
'IBILog' => 'al',
|
||||
'IBISc' => 'am',
|
||||
'IBIFLg' => 'an',
|
||||
'IBFBl' => 'aq',
|
||||
'IBIIAo' => 'ap',
|
||||
'IBIAd' => 'as',
|
||||
'IBIAe' => 'at',
|
||||
'SFJn' => 'cd',
|
||||
'SFRJn' => 'ce',
|
||||
'SRe' => 'cf',
|
||||
'SRCk' => 'cg',
|
||||
'SSn' => 'ch',
|
||||
'SQs' => 'b6',
|
||||
'BRd' => 'cq',
|
||||
'BSt' => 'cp',
|
||||
'CDe' => 'c6',
|
||||
'CIt' => 'c4',
|
||||
'CISt' => 'ca',
|
||||
'CLd' => 'c8',
|
||||
'CRe' => 'c7',
|
||||
'CRSt' => 'cc',
|
||||
'CSt' => 'c5',
|
||||
'CUe' => 'c3',
|
||||
'CUMi' => 'c9',
|
||||
'IDBLBSe' => 'cr',
|
||||
'IBLFh' => 'ct',
|
||||
'IBLWn' => 'cu',
|
||||
'IBLWn' => 'cu',
|
||||
'SRows' => 'ck',
|
||||
'SRange' => 'cj',
|
||||
'SMPs' => 'ci',
|
||||
'SScan' => 'cl',
|
||||
'IBIRd' => 'ai',
|
||||
'IBIWr' => 'aj',
|
||||
'IBILg' => 'ak',
|
||||
'IBIFSc' => 'ah',
|
||||
'IDBRDd' => 'b2',
|
||||
'IDBRId' => 'b0',
|
||||
'IDBRRd' => 'b3',
|
||||
'IDBRUd' => 'b1',
|
||||
'IBRd' => 'ae',
|
||||
'IBCd' => 'af',
|
||||
'IBWr' => 'ag',
|
||||
'TLIe' => 'b5',
|
||||
'TLWd' => 'b4',
|
||||
'IBPse' => 'aa',
|
||||
'IBPDBp' => 'ac',
|
||||
'IBPFe' => 'ab',
|
||||
'IBPMps' => 'ad',
|
||||
'TOC' => 'bc',
|
||||
'OFs' => 'b7',
|
||||
'OTs' => 'b8',
|
||||
'OdTs' => 'b9',
|
||||
'IBSRs' => 'ay',
|
||||
'IBSWs' => 'ax',
|
||||
'IBOWs' => 'az',
|
||||
'QCs' => 'c1',
|
||||
'QCeFy' => 'bu',
|
||||
'MaCs' => 'bl',
|
||||
'MUCs' => 'bf',
|
||||
'ACs' => 'bd',
|
||||
'AdCs' => 'be',
|
||||
'TCd' => 'bi',
|
||||
'Cs' => 'bn',
|
||||
'IBTNx' => 'a5',
|
||||
'KRRs' => 'a0',
|
||||
'KRs' => 'a1',
|
||||
'KWR' => 'a2',
|
||||
'KWs' => 'a3',
|
||||
'QCQICe' => 'bz',
|
||||
'QCHs' => 'bv',
|
||||
'QCIs' => 'bw',
|
||||
'QCNCd' => 'by',
|
||||
'QCLMPs' => 'bx',
|
||||
'CTMPDTs' => 'cn',
|
||||
'CTMPTs' => 'cm',
|
||||
'CTMPFs' => 'co',
|
||||
'IBIIs' => 'au',
|
||||
'IBIMRd' => 'av',
|
||||
'IBIMs' => 'aw',
|
||||
'IBILog' => 'al',
|
||||
'IBISc' => 'am',
|
||||
'IBIFLg' => 'an',
|
||||
'IBFBl' => 'aq',
|
||||
'IBIIAo' => 'ap',
|
||||
'IBIAd' => 'as',
|
||||
'IBIAe' => 'at',
|
||||
'SFJn' => 'cd',
|
||||
'SFRJn' => 'ce',
|
||||
'SRe' => 'cf',
|
||||
'SRCk' => 'cg',
|
||||
'SSn' => 'ch',
|
||||
'SQs' => 'b6',
|
||||
'BRd' => 'cq',
|
||||
'BSt' => 'cp',
|
||||
'CDe' => 'c6',
|
||||
'CIt' => 'c4',
|
||||
'CISt' => 'ca',
|
||||
'CLd' => 'c8',
|
||||
'CRe' => 'c7',
|
||||
'CRSt' => 'cc',
|
||||
'CSt' => 'c5',
|
||||
'CUe' => 'c3',
|
||||
'CUMi' => 'c9',
|
||||
);
|
||||
|
||||
$values = array();
|
||||
@@ -110,7 +110,6 @@ foreach ($mapping as $key)
|
||||
}
|
||||
$string = implode(':', $values);
|
||||
|
||||
|
||||
#$data = explode("\n", $mysql);
|
||||
#$nstring = trim(implode(':',$data),':');
|
||||
|
||||
@@ -213,3 +212,4 @@ if (!is_file($mysql_rrd))
|
||||
rrdtool_update($mysql_rrd, "N:$string");
|
||||
echo("done ");
|
||||
|
||||
?>
|
||||
|
||||
@@ -5,7 +5,7 @@ $rserver_db = dbFetchRows("SELECT * FROM `loadbalancer_rservers` WHERE `device_i
|
||||
|
||||
foreach ($rserver_db as $serverfarm) { $serverfarms[$serverfarm['farm_id']] = $serverfarm;}
|
||||
|
||||
foreach($rserver_array as $index => $serverfarm)
|
||||
foreach ($rserver_array as $index => $serverfarm)
|
||||
{
|
||||
|
||||
$clean_index = preg_replace('@\d+\."(.*?)"\.\d+@', '\\1', $index);
|
||||
@@ -17,12 +17,11 @@ foreach($rserver_array as $index => $serverfarm)
|
||||
|
||||
$db_oids = array($clean_index => 'farm_id', "cesServerFarmRserverStateDescr" => "StateDescr");
|
||||
|
||||
|
||||
if(!is_array( $serverfarms[$clean_index]))
|
||||
if (!is_array( $serverfarms[$clean_index]))
|
||||
{
|
||||
$rserver_id = dbInsert(array('device_id' => $device['device_id'], 'farm_id' => $clean_index, 'StateDescr' => $serverfarm['cesServerFarmRserverStateDescr']), 'loadbalancer_rservers');
|
||||
} else {
|
||||
foreach($db_oids as $db_oid => $db_value) {
|
||||
foreach ($db_oids as $db_oid => $db_value) {
|
||||
$db_update[$db_value] = $serverfarm[$db_oid];
|
||||
}
|
||||
|
||||
@@ -59,7 +58,6 @@ foreach($rserver_array as $index => $serverfarm)
|
||||
rrdtool_update($rrd_file, $rrdupdate);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
unset($oids, $oid, $serverfarm);
|
||||
|
||||
@@ -5,13 +5,13 @@ $serverfarm_db = dbFetchRows("SELECT * FROM `loadbalancer_vservers` WHERE `devic
|
||||
|
||||
foreach ($serverfarm_db as $vserver) { $classmaps[$vserver['classmap']] = $vserver;}
|
||||
|
||||
foreach($serverfarm_array as $index => $vserver)
|
||||
foreach ($serverfarm_array as $index => $vserver)
|
||||
{
|
||||
|
||||
$classmap = str_replace("class-map-", "", $vserver['slbVServerClassMap']);
|
||||
$classmap_id = str_replace("9.", "" , $index);
|
||||
$classmap = str_replace("class-map-", "", $vserver['slbVServerClassMap']);
|
||||
$classmap_id = str_replace("9.", "" , $index);
|
||||
|
||||
$oids = array (
|
||||
$oids = array (
|
||||
"slbVServerNumberOfConnections",
|
||||
"slbVServerDroppedConnections",
|
||||
"slbVServerClientPacketCounts",
|
||||
@@ -19,55 +19,50 @@ foreach($serverfarm_array as $index => $vserver)
|
||||
"slbVServerPacketCounts",
|
||||
"slbVServerByteCounts");
|
||||
|
||||
$db_oids = array($classmap_id => 'classmap_id', $classmap => 'classmap', "slbVServerState" => "serverstate");
|
||||
$db_oids = array($classmap_id => 'classmap_id', $classmap => 'classmap', "slbVServerState" => "serverstate");
|
||||
|
||||
|
||||
if(!is_array( $classmaps[$classmap]))
|
||||
if (!is_array( $classmaps[$classmap]))
|
||||
{
|
||||
$classmap_in = dbInsert(array('device_id' => $device['device_id'], 'classmap_id' => $classmap_id, 'classmap' => $classmap, 'serverstate' => $vserver['slbVServerState']), 'loadbalancer_vservers');
|
||||
$classmap_in = dbInsert(array('device_id' => $device['device_id'], 'classmap_id' => $classmap_id, 'classmap' => $classmap, 'serverstate' => $vserver['slbVServerState']), 'loadbalancer_vservers');
|
||||
} else {
|
||||
foreach($db_oids as $db_oid => $db_value) {
|
||||
foreach ($db_oids as $db_oid => $db_value)
|
||||
{
|
||||
$db_update[$db_value] = $vserver[$db_oid];
|
||||
}
|
||||
|
||||
$updated = dbUpdate($db_update, 'loadbalancer_vservers', '`classmap_id` = ?', $vserver['slbVServerState']['classmap']);
|
||||
}
|
||||
|
||||
|
||||
$rrd_file = $config['rrd_dir'] . "/" . $device['hostname'] . "/vserver-".$classmap_id.".rrd";
|
||||
$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 \
|
||||
$rrd_file = $config['rrd_dir'] . "/" . $device['hostname'] . "/vserver-".$classmap_id.".rrd";
|
||||
$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";
|
||||
|
||||
foreach ($oids as $oid)
|
||||
{
|
||||
$oid_ds = truncate(str_replace("slbVServer", "", $oid), 19, '');
|
||||
# $rrd_create .= " DS:$oid_ds:GAUGE:600:-1:100000000";
|
||||
$rrd_create .= " DS:$oid_ds:COUNTER:600:U:1000000000";
|
||||
}
|
||||
foreach ($oids as $oid)
|
||||
{
|
||||
$oid_ds = truncate(str_replace("slbVServer", "", $oid), 19, '');
|
||||
$rrd_create .= " DS:$oid_ds:COUNTER:600:U:1000000000";
|
||||
}
|
||||
|
||||
$rrdupdate = "N";
|
||||
|
||||
foreach ($oids as $oid)
|
||||
{
|
||||
if (is_numeric($vserver[$oid]))
|
||||
{
|
||||
$value = $vserver[$oid];
|
||||
} else {
|
||||
$value = "0";
|
||||
}
|
||||
$rrdupdate .= ":$value";
|
||||
}
|
||||
|
||||
if (isset($classmaps[$classmap]))
|
||||
{
|
||||
if (!file_exists($rrd_file)) { rrdtool_create($rrd_file, $rrd_create); }
|
||||
rrdtool_update($rrd_file, $rrdupdate);
|
||||
}
|
||||
$rrdupdate = "N";
|
||||
|
||||
foreach ($oids as $oid)
|
||||
{
|
||||
if (is_numeric($vserver[$oid]))
|
||||
{
|
||||
$value = $vserver[$oid];
|
||||
} else {
|
||||
$value = "0";
|
||||
}
|
||||
$rrdupdate .= ":$value";
|
||||
}
|
||||
|
||||
if (isset($classmaps[$classmap]))
|
||||
{
|
||||
if (!file_exists($rrd_file)) { rrdtool_create($rrd_file, $rrd_create); }
|
||||
rrdtool_update($rrd_file, $rrdupdate);
|
||||
}
|
||||
}
|
||||
|
||||
unset($oids, $oid, $vserver);
|
||||
|
||||
?>
|
||||
|
||||
|
||||
@@ -13,7 +13,6 @@ foreach ($cefs_query as $ceftmp)
|
||||
$cefs_db[$cef_id] = $ceftmp['cef_switching_id'];
|
||||
}
|
||||
|
||||
|
||||
if ($debug) { print_r($cefs); }
|
||||
|
||||
if (is_array($cefs))
|
||||
@@ -43,7 +42,7 @@ if (is_array($cefs))
|
||||
$cef_id = $device['device_id']."-".$entity."-".$afi."-".$path;
|
||||
|
||||
# if (dbFetchCell("SELECT COUNT(*) FROM `cef_switching` WHERE `device_id` = ? AND `entPhysicalIndex` = ? AND `afi` = ? AND `cef_index` = ?", array($device['device_id'], $entity, $afi, $path)) != "1")
|
||||
if(!isset($cefs_db[$cef_id]))
|
||||
if (!isset($cefs_db[$cef_id]))
|
||||
{
|
||||
dbInsert(array('device_id' => $device['device_id'], 'entPhysicalIndex' => $entity, 'afi' => $afi, 'cef_index' => $path, 'cef_path' => $cef_stat['cefSwitchingPath']), 'cef_switching');
|
||||
echo("+");
|
||||
@@ -98,7 +97,7 @@ if (is_array($cefs))
|
||||
|
||||
print_r($cefs_db);
|
||||
|
||||
foreach($cefs_db as $cef_switching_id)
|
||||
foreach ($cefs_db as $cef_switching_id)
|
||||
{
|
||||
dbDelete("cef_switching", "`cef_switching_id` = ?", array($cef_switching_id));
|
||||
echo("-");
|
||||
|
||||
@@ -12,7 +12,7 @@ if ($device['os_group'] == "cisco")
|
||||
{
|
||||
$data = snmpwalk_cache_oid($device, "cvpdnSystemEntry", NULL, "CISCO-VPDN-MGMT-MIB");
|
||||
|
||||
foreach($data as $type => $vpdn)
|
||||
foreach ($data as $type => $vpdn)
|
||||
{
|
||||
|
||||
$rrd_filename = $config['rrd_dir'] . "/" . $device['hostname'] . "/" . safename("vpdn-".$type.".rrd");
|
||||
|
||||
@@ -11,21 +11,21 @@ if($device['os'] == "ios")
|
||||
$chan_stats = snmpwalk_cache_oid($device, "cc6kxbarModuleChannelTable", array(), "CISCO-CAT6K-CROSSBAR-MIB");
|
||||
$chan_stats = snmpwalk_cache_oid($device, "cc6kxbarStatisticsTable", $chan_stats, "CISCO-CAT6K-CROSSBAR-MIB");
|
||||
|
||||
foreach($mod_stats as $index => $entry)
|
||||
foreach ($mod_stats as $index => $entry)
|
||||
{
|
||||
$group = 'c6kxbar';
|
||||
foreach($entry as $key => $value)
|
||||
foreach ($entry as $key => $value)
|
||||
{
|
||||
$subindex = NULL;
|
||||
$entPhysical_state[$index][$subindex][$group][$key] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
foreach($chan_stats as $index => $entry)
|
||||
foreach ($chan_stats as $index => $entry)
|
||||
{
|
||||
list($index,$subindex) = explode(".", $index, 2);
|
||||
$group = 'c6kxbar';
|
||||
foreach($entry as $key => $value)
|
||||
foreach ($entry as $key => $value)
|
||||
{
|
||||
$entPhysical_state[$index][$subindex][$group][$key] = $value;
|
||||
}
|
||||
@@ -70,8 +70,6 @@ if($device['os'] == "ios")
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Set Entity state
|
||||
foreach (dbFetch("SELECT * FROM `entPhysical_state` WHERE `device_id` = ?", array($device['device_id'])) as $entity)
|
||||
{
|
||||
@@ -80,7 +78,7 @@ foreach (dbFetch("SELECT * FROM `entPhysical_state` WHERE `device_id` = ?", arra
|
||||
dbDelete('entPhysical_state', "`device_id` = ? AND `entPhysicalIndex` = ? AND `subindex` = ? AND `group` = ? AND `key` = ?",
|
||||
array($device['device_id'], $entity['entPhysicalIndex'], $entity['subindex'], $entity['group'], $entity['key']));
|
||||
} else {
|
||||
if($entPhysical_state[$entity['entPhysicalIndex']][$entity['subindex']][$entity['group']][$entity['key']] != $entity['value'])
|
||||
if ($entPhysical_state[$entity['entPhysicalIndex']][$entity['subindex']][$entity['group']][$entity['key']] != $entity['value'])
|
||||
{
|
||||
echo("no match!");
|
||||
}
|
||||
@@ -92,11 +90,11 @@ foreach (dbFetch("SELECT * FROM `entPhysical_state` WHERE `device_id` = ?", arra
|
||||
// Delete Entity state
|
||||
foreach ($entPhysical_state as $epi => $entity)
|
||||
{
|
||||
foreach($entity as $subindex => $si)
|
||||
foreach ($entity as $subindex => $si)
|
||||
{
|
||||
foreach($si as $group => $ti)
|
||||
foreach ($si as $group => $ti)
|
||||
{
|
||||
foreach($ti as $key => $value)
|
||||
foreach ($ti as $key => $value)
|
||||
{
|
||||
dbInsert(array('device_id' => $device['device_id'], 'entPhysicalIndex' => $epi, 'subindex' => $subindex, 'group' => $group, 'key' => $key, 'value' => $value), 'entPhysical_state');
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
<?php
|
||||
|
||||
|
||||
if ($device['os'] == "avaya-ers")
|
||||
{
|
||||
# Memory information only known to work with 5500 and 5600 switches
|
||||
if (preg_match("/5[56][0-9][0-9]/", $device["sysDescr"])) {
|
||||
if (preg_match("/5[56][0-9][0-9]/", $device["sysDescr"]))
|
||||
{
|
||||
$index = $mempool['mempool_index'];
|
||||
|
||||
|
||||
@@ -13,5 +13,4 @@ $mempool['perc'] = snmp_get($device, ".1.3.6.1.4.1.5951.4.1.1.41.2.0", "-OvQ");
|
||||
$mempool['used'] = $mempool['total'] / 100 * $mempool['perc'];
|
||||
$mempool['free'] = $mempool['total'] - $mempool['used'];
|
||||
|
||||
|
||||
?>
|
||||
|
||||
@@ -31,9 +31,8 @@
|
||||
# NS-ROOT-MIB::vsvrTotalClients."observium" = Counter64: 43023
|
||||
# NS-ROOT-MIB::vsvrClientConnOpenRate."observium" = STRING: "0"
|
||||
|
||||
if($device['os'] == "netscaler")
|
||||
if ($device['os'] == "netscaler")
|
||||
{
|
||||
|
||||
echo("Netscaler VServers\n");
|
||||
|
||||
$oids_gauge = array('vsvrCurClntConnections','vsvrCurSrvrConnections');
|
||||
@@ -60,23 +59,18 @@ if($device['os'] == "netscaler")
|
||||
$rrd_create .= " DS:$oid_ds:COUNTER:600:U:100000000000";
|
||||
}
|
||||
|
||||
|
||||
$vsvr_array = snmpwalk_cache_oid($device, "vserverEntry", array(), "NS-ROOT-MIB");
|
||||
|
||||
$vsvr_db = dbFetchRows("SELECT * FROM `netscaler_vservers` WHERE `device_id` = ?", array($device['device_id']));
|
||||
foreach ($vsvr_db as $vsvr) { $vsvrs[$vsvr['vsvr_name']] = $vsvr; print_r($vsvr); }
|
||||
if($debug) { print_r($vsvrs); }
|
||||
if ($debug) { print_r($vsvrs); }
|
||||
|
||||
foreach($vsvr_array as $index => $vsvr)
|
||||
foreach ($vsvr_array as $index => $vsvr)
|
||||
{
|
||||
|
||||
if(isset($vsvr['vsvrName']))
|
||||
if (isset($vsvr['vsvrName']))
|
||||
{
|
||||
|
||||
$vsvr_exist[$vsvr['vsvrName']] = 1;
|
||||
|
||||
$rrd_file = $config['rrd_dir'] . "/" . $device['hostname'] . "/netscaler-vsvr-".safename($vsvr['vsvrName']).".rrd";
|
||||
|
||||
$rrdupdate = "N";
|
||||
|
||||
foreach ($oids as $oid)
|
||||
@@ -95,10 +89,10 @@ if($device['os'] == "netscaler")
|
||||
$db_update = array('vsvr_ip' => $vsvr['vsvrIpAddress'], 'vsvr_port' => $vsvr['vsvrPort'], 'vsvr_state' => $vsvr['vsvrState'], 'vsvr_type' => $vsvr['vsvrType'],
|
||||
'vsvr_req_rate' => $vsvr['RequestRate'], 'vsvr_bps_in' => $vsvr['vsvrRxBytesRate'], 'vsvr_bps_out' => $vsvr['vsvrTxBytesRate']);
|
||||
|
||||
if(!is_array($vsvrs[$vsvr['vsvrName']]))
|
||||
if (!is_array($vsvrs[$vsvr['vsvrName']]))
|
||||
{
|
||||
$db_insert = array_merge(array('device_id' => $device['device_id'], 'vsvr_name' => $vsvr['vsvrName']), $db_update);
|
||||
$vsvr_id = dbInsert($db_insert, 'netscaler_vservers'); echo (" +");
|
||||
$vsvr_id = dbInsert($db_insert, 'netscaler_vservers'); echo(" +");
|
||||
} else {
|
||||
$updated = dbUpdate($db_update, 'netscaler_vservers', '`vsvr_id` = ?', array($vsvrs[$vsvr['vsvrName']]['vsvr_id']));
|
||||
echo(" U");
|
||||
@@ -112,17 +106,16 @@ if($device['os'] == "netscaler")
|
||||
|
||||
}
|
||||
|
||||
if($debug) { print_r($vsvr_exist); }
|
||||
if ($debug) { print_r($vsvr_exist); }
|
||||
|
||||
foreach($vsvrs as $db_name => $db_id)
|
||||
foreach ($vsvrs as $db_name => $db_id)
|
||||
{
|
||||
if(!$vsvr_exist[$db_name])
|
||||
if (!$vsvr_exist[$db_name])
|
||||
{
|
||||
echo("-".$db_name);
|
||||
dbDelete('netscaler_vservers', "`vsvr_id` = ?", array($db_id));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@@ -2,12 +2,12 @@
|
||||
|
||||
if (is_file($config['install_dir'] . "/includes/polling/os/".$device['os'].".inc.php"))
|
||||
{
|
||||
/// OS Specific
|
||||
## OS Specific
|
||||
include($config['install_dir'] . "/includes/polling/os/".$device['os'].".inc.php");
|
||||
}
|
||||
elseif ($device['os_group'] && is_file($config['install_dir'] . "/includes/polling/os/".$device['os_group'].".inc.php"))
|
||||
{
|
||||
/// OS Group Specific
|
||||
## OS Group Specific
|
||||
include($config['install_dir'] . "/includes/polling/os/".$device['os_group'].".inc.php");
|
||||
}
|
||||
else
|
||||
|
||||
@@ -25,7 +25,6 @@ $details = str_replace("ERS-", "Ethernet Routing Switch ", $details);
|
||||
$hardware = explode(" (", $details[0]);
|
||||
$hardware = $hardware[0];
|
||||
|
||||
|
||||
# Is this a 5500 series or 5600 series stack?
|
||||
$features = "";
|
||||
|
||||
@@ -36,7 +35,6 @@ if ($stack_size > 1) {
|
||||
$features = "Stack of $stack_size units";
|
||||
}
|
||||
|
||||
|
||||
$version = str_replace("\"","", $version);
|
||||
$features = str_replace("\"","", $features);
|
||||
$hardware = str_replace("\"","", $hardware);
|
||||
|
||||
@@ -2,13 +2,13 @@
|
||||
|
||||
if (preg_match('/^Cisco IOS Software, .+? Software \([^\-]+-([\w\d]+)-\w\), Version ([^,]+)/', $poll_device['sysDescr'], $regexp_result))
|
||||
{
|
||||
$features = $regexp_result[1];
|
||||
$version = $regexp_result[2];
|
||||
$features = $regexp_result[1];
|
||||
$version = $regexp_result[2];
|
||||
}
|
||||
elseif( false )
|
||||
{
|
||||
# Placeholder
|
||||
# Other regexp for other type of string
|
||||
# Placeholder
|
||||
# Other regexp for other type of string
|
||||
}
|
||||
|
||||
echo("\n".$poll_device['sysDescr']."\n");
|
||||
@@ -35,7 +35,6 @@ if ($data[1]['entPhysicalContainedIn'] == "0")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
# if ($slot_1 == "-1" && strpos($descr_1, "No") === FALSE) { $ciscomodel = $descr_1; }
|
||||
# if (($contained_1 == "0" || $name_1 == "Chassis") && strpos($model_1, "No") === FALSE) { $ciscomodel = $model_1; list($version_1) = explode(",",$ver_1); }
|
||||
# if ($contained_1001 == "0" && strpos($model_1001, "No") === FALSE) { $ciscomodel = $model_1001; }
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
|
||||
echo("Comware OS...");
|
||||
|
||||
|
||||
$hardware = snmp_get($device, "sysObjectID.0", "-OQsv", "SNMPv2-MIB:HH3C-PRODUCT-ID-MIB", "+".$config['install_dir']."/mibs/h3c");
|
||||
|
||||
list(,$version,$features) = explode(",", $poll_device['sysDescr']);
|
||||
|
||||
@@ -39,7 +39,6 @@ else
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
# if ($slot_1 == "-1" && strpos($descr_1, "No") === FALSE) { $ciscomodel = $descr_1; }
|
||||
# if (($contained_1 == "0" || $name_1 == "Chassis") && strpos($model_1, "No") === FALSE) { $ciscomodel = $model_1; list($version_1) = explode(",",$ver_1); }
|
||||
# if ($contained_1001 == "0" && strpos($model_1001, "No") === FALSE) { $ciscomodel = $model_1001; }
|
||||
|
||||
@@ -2,13 +2,13 @@
|
||||
|
||||
if (preg_match('/^Cisco IOS XR Software \(Cisco ([^\)]+)\),\s+Version ([^\[]+)\[([^\]]+)\]/', $poll_device['sysDescr'], $regexp_result))
|
||||
{
|
||||
$hardware = $regexp_result[1];
|
||||
$features = $regexp_result[3];
|
||||
$version = $regexp_result[2];
|
||||
$hardware = $regexp_result[1];
|
||||
$features = $regexp_result[3];
|
||||
$version = $regexp_result[2];
|
||||
}
|
||||
else
|
||||
{
|
||||
# It is not an IOS-XR ... What should we do ?
|
||||
# It is not an IOS-XR ... What should we do ?
|
||||
}
|
||||
|
||||
echo("\n".$poll_device['sysDescr']."\n");
|
||||
|
||||
@@ -101,8 +101,8 @@ if (isset($port_stats[$port['ifIndex']]['adslLineCoding']))
|
||||
}
|
||||
dbUpdate($port['adsl_update'], 'ports_adsl', '`interface_id` = ?', array($port['interface_id']));
|
||||
|
||||
if($this_port['adslAtucCurrSnrMgn'] > "1280") { $this_port['adslAtucCurrSnrMgn'] = "U"; }
|
||||
if($this_port['adslAturCurrSnrMgn'] > "1280") { $this_port['adslAturCurrSnrMgn'] = "U"; }
|
||||
if ($this_port['adslAtucCurrSnrMgn'] > "1280") { $this_port['adslAtucCurrSnrMgn'] = "U"; }
|
||||
if ($this_port['adslAturCurrSnrMgn'] > "1280") { $this_port['adslAturCurrSnrMgn'] = "U"; }
|
||||
|
||||
$rrdupdate = "N";
|
||||
foreach ($adsl_oids as $oid)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
// Build SNMP Cache Array
|
||||
### Build SNMP Cache Array
|
||||
$data_oids = array('ifName','ifDescr','ifAlias', 'ifAdminStatus', 'ifOperStatus', 'ifMtu', 'ifSpeed', 'ifHighSpeed', 'ifType', 'ifPhysAddress',
|
||||
'ifPromiscuousMode','ifConnectorPresent','ifDuplex', 'ifTrunk', 'ifVlan');
|
||||
|
||||
@@ -9,7 +9,7 @@ $stat_oids = array('ifInErrors', 'ifOutErrors', 'ifInUcastPkts', 'ifOutUcastPkts
|
||||
'ifInOctets', 'ifOutOctets', 'ifHCInOctets', 'ifHCOutOctets', 'ifInDiscards', 'ifOutDiscards', 'ifInUnknownProtos',
|
||||
'ifInBroadcastPkts', 'ifOutBroadcastPkts', 'ifInMulticastPkts', 'ifOutMulticastPkts');
|
||||
|
||||
$stat_oids_db = array('ifInOctets', 'ifOutOctets', 'ifInErrors', 'ifOutErrors', 'ifInUcastPkts', 'ifOutUcastPkts'); /// From above for DB
|
||||
$stat_oids_db = array('ifInOctets', 'ifOutOctets', 'ifInErrors', 'ifOutErrors', 'ifInUcastPkts', 'ifOutUcastPkts'); ### From above for DB
|
||||
|
||||
$etherlike_oids = array('dot3StatsAlignmentErrors', 'dot3StatsFCSErrors', 'dot3StatsSingleCollisionFrames', 'dot3StatsMultipleCollisionFrames',
|
||||
'dot3StatsSQETestErrors', 'dot3StatsDeferredTransmissions', 'dot3StatsLateCollisions', 'dot3StatsExcessiveCollisions',
|
||||
@@ -66,7 +66,7 @@ if ($device['adsl_count'] > "0")
|
||||
$port_stats = snmpwalk_cache_oid($device, ".1.3.6.1.2.1.10.94.1.1.7.1.7", $port_stats, "ADSL-LINE-MIB");
|
||||
}
|
||||
|
||||
/// FIXME This probably needs re-enabled. We need to clear these things when they get unset, too.
|
||||
### FIXME This probably needs re-enabled. We need to clear these things when they get unset, too.
|
||||
#foreach ($etherlike_oids as $oid) { $port_stats = snmpwalk_cache_oid($device, $oid, $port_stats, "EtherLike-MIB"); }
|
||||
#foreach ($cisco_oids as $oid) { $port_stats = snmpwalk_cache_oid($device, $oid, $port_stats, "OLD-CISCO-INTERFACES-MIB"); }
|
||||
#foreach ($pagp_oids as $oid) { $port_stats = snmpwalk_cache_oid($device, $oid, $port_stats, "CISCO-PAGP-MIB"); }
|
||||
@@ -75,17 +75,16 @@ if ($device['os_group'] == "cisco")
|
||||
{
|
||||
$port_stats = snmp_cache_portIfIndex ($device, $port_stats);
|
||||
$port_stats = snmp_cache_portName ($device, $port_stats);
|
||||
foreach ($pagp_oids as $oid) { $port_stats = snmpwalk_cache_oid($device, $oid, $port_stats, "CISCO-PAGP-MIB"); }
|
||||
foreach ($pagp_oids as $oid) { $port_stats = snmpwalk_cache_oid($device, $oid, $port_stats, "CISCO-PAGP-MIB"); }
|
||||
$data_oids[] = "portName";
|
||||
|
||||
/// Grab data to put ports into vlans or make them trunks
|
||||
/// FIXME we probably shouldn't be doing this from the VTP MIB, right?
|
||||
### Grab data to put ports into vlans or make them trunks
|
||||
### FIXME we probably shouldn't be doing this from the VTP MIB, right?
|
||||
$port_stats = snmpwalk_cache_oid($device, "vmVlan", $port_stats, "CISCO-VLAN-MEMBERSHIP-MIB");
|
||||
$port_stats = snmpwalk_cache_oid($device, "vlanTrunkPortEncapsulationOperType", $port_stats, "CISCO-VTP-MIB");
|
||||
$port_stats = snmpwalk_cache_oid($device, "vlanTrunkPortNativeVlan", $port_stats, "CISCO-VTP-MIB");
|
||||
|
||||
} else
|
||||
{
|
||||
} else {
|
||||
$port_stats = snmpwalk_cache_oid($device, "dot1qPortVlanTable", $port_stats, "Q-BRIDGE-MIB");
|
||||
|
||||
$vlan_ports = snmpwalk_cache_twopart_oid($device, "dot1qVlanCurrentEgressPorts", $vlan_stats, "Q-BRIDGE-MIB");
|
||||
@@ -115,11 +114,11 @@ if ($device['os_group'] == "cisco")
|
||||
|
||||
$polled = time();
|
||||
|
||||
/// End Building SNMP Cache Array
|
||||
### End Building SNMP Cache Array
|
||||
|
||||
if ($debug) { print_r($port_stats); }
|
||||
|
||||
/// Build array of ports in the database
|
||||
### Build array of ports in the database
|
||||
|
||||
## FIXME -- this stuff is a little messy, looping the array to make an array just seems wrong. :>
|
||||
## -- i can make it a function, so that you don't know what it's doing.
|
||||
@@ -128,7 +127,7 @@ if ($debug) { print_r($port_stats); }
|
||||
$ports_db = dbFetchRows("SELECT * FROM `ports` WHERE `device_id` = ?", array($device['device_id']));
|
||||
foreach ($ports_db as $port) { $ports[$port['ifIndex']] = $port; }
|
||||
|
||||
/// New interface detection
|
||||
### New interface detection
|
||||
foreach ($port_stats as $ifIndex => $port)
|
||||
{
|
||||
if (is_port_valid($port, $device))
|
||||
@@ -143,48 +142,48 @@ foreach ($port_stats as $ifIndex => $port)
|
||||
dbUpdate(array('deleted' => '0'), 'ports', '`interface_id` = ?', array($ports[$ifIndex]['interface_id']));
|
||||
$ports[$ifIndex]['deleted'] = "0";
|
||||
}
|
||||
} else {
|
||||
} else {
|
||||
dbUpdate(array('deleted' => '1'), 'ports', '`interface_id` = ?', array($ports[$ifIndex]['interface_id']));
|
||||
$ports[$ifIndex]['deleted'] = "1";
|
||||
}
|
||||
}
|
||||
/// End New interface detection
|
||||
### End New interface detection
|
||||
|
||||
echo("\n");
|
||||
/// Loop ports in the DB and update where necessary
|
||||
### Loop ports in the DB and update where necessary
|
||||
foreach ($ports as $port)
|
||||
{
|
||||
echo ("Port " . $port['ifDescr'] . "(".$port['ifIndex'].") ");
|
||||
echo("Port " . $port['ifDescr'] . "(".$port['ifIndex'].") ");
|
||||
if ($port_stats[$port['ifIndex']] && $port['disabled'] != "1")
|
||||
{ /// Check to make sure Port data is cached.
|
||||
{ ### Check to make sure Port data is cached.
|
||||
$this_port = &$port_stats[$port['ifIndex']];
|
||||
|
||||
if ($device['os'] == "vmware" && preg_match("/Device ([a-z0-9]+) at .*/", $this_port['ifDescr'], $matches)) { $this_port['ifDescr'] = $matches[1]; }
|
||||
|
||||
if($config['memcached']['enable'])
|
||||
if ($config['memcached']['enable'])
|
||||
{
|
||||
$port['poll_time'] = $memcache->get('port-'.$port['interface_id'].'-poll_time');
|
||||
# echo("time".$port['poll_time']);
|
||||
}
|
||||
|
||||
|
||||
$polled_period = $polled - $port['poll_time'];
|
||||
|
||||
$port['update'] = array();
|
||||
if($config['slow_statistics'] == TRUE) {
|
||||
if ($config['slow_statistics'] == TRUE)
|
||||
{
|
||||
$port['update']['poll_time'] = $polled;
|
||||
$port['update']['poll_prev'] = $port['poll_time'];
|
||||
$port['update']['poll_period'] = $polled_period;
|
||||
}
|
||||
|
||||
if($config['memcached']['enable'])
|
||||
if ($config['memcached']['enable'])
|
||||
{
|
||||
$memcache->set('port-'.$port['interface_id'].'-poll_time', $polled);
|
||||
$memcache->set('port-'.$port['interface_id'].'-poll_prev', $port['poll_time']);
|
||||
$memcache->set('port-'.$port['interface_id'].'-poll_period', $polled_period);
|
||||
}
|
||||
|
||||
/// Copy ifHC[In|Out]Octets values to non-HC if they exist
|
||||
### Copy ifHC[In|Out]Octets values to non-HC if they exist
|
||||
if ($this_port['ifHCInOctets'] > 0 && is_numeric($this_port['ifHCInOctets']) && $this_port['ifHCOutOctets'] > 0 && is_numeric($this_port['ifHCOutOctets']))
|
||||
{
|
||||
echo("HC ");
|
||||
@@ -192,7 +191,7 @@ foreach ($ports as $port)
|
||||
$this_port['ifOutOctets'] = $this_port['ifHCOutOctets'];
|
||||
}
|
||||
|
||||
/// rewrite the ifPhysAddress
|
||||
### rewrite the ifPhysAddress
|
||||
if (strpos($this_port['ifPhysAddress'], ":"))
|
||||
{
|
||||
list($a_a, $a_b, $a_c, $a_d, $a_e, $a_f) = explode(":", $this_port['ifPhysAddress']);
|
||||
@@ -208,21 +207,21 @@ foreach ($ports as $port)
|
||||
$this_port['ifOutMulticastPkts'] = $this_port['ifHCOutMulticastPkts'];
|
||||
}
|
||||
|
||||
/// Overwrite ifSpeed with ifHighSpeed if it's over 10G
|
||||
### Overwrite ifSpeed with ifHighSpeed if it's over 10G
|
||||
if (is_numeric($this_port['ifHighSpeed']) && $this_port['ifSpeed'] > "1000000000")
|
||||
{
|
||||
echo("HighSpeed ");
|
||||
$this_port['ifSpeed'] = $this_port['ifHighSpeed'] * 1000000;
|
||||
}
|
||||
|
||||
/// Overwrite ifDuplex with dot3StatsDuplexStatus if it exists
|
||||
### Overwrite ifDuplex with dot3StatsDuplexStatus if it exists
|
||||
if (isset($this_port['dot3StatsDuplexStatus']))
|
||||
{
|
||||
echo("dot3Duplex ");
|
||||
$this_port['ifDuplex'] = $this_port['dot3StatsDuplexStatus'];
|
||||
}
|
||||
|
||||
/// Set VLAN and Trunk from Cisco
|
||||
### Set VLAN and Trunk from Cisco
|
||||
if (isset($this_port['vlanTrunkPortEncapsulationOperType']) && $this_port['vlanTrunkPortEncapsulationOperType'] != "notApplicable")
|
||||
{
|
||||
$this_port['ifTrunk'] = $this_port['vlanTrunkPortEncapsulationOperType'];
|
||||
@@ -234,7 +233,7 @@ foreach ($ports as $port)
|
||||
$this_port['ifVlan'] = $this_port['vmVlan'];
|
||||
}
|
||||
|
||||
/// Set VLAN and Trunk from Q-BRIDGE-MIB
|
||||
### Set VLAN and Trunk from Q-BRIDGE-MIB
|
||||
if (!isset($this_port['ifVlan']) && isset($this_port['dot1qPvid']))
|
||||
{
|
||||
$this_port['ifVlan'] = $this_port['dot1qPvid'];
|
||||
@@ -243,7 +242,7 @@ foreach ($ports as $port)
|
||||
|
||||
echo("VLAN == ".$this_port['ifVlan']);
|
||||
|
||||
/// Update IF-MIB data
|
||||
### Update IF-MIB data
|
||||
foreach ($data_oids as $oid)
|
||||
{
|
||||
if ($port[$oid] != $this_port[$oid] && !isset($this_port[$oid]))
|
||||
@@ -258,10 +257,11 @@ foreach ($ports as $port)
|
||||
}
|
||||
}
|
||||
|
||||
/// Parse description (usually ifAlias) if config option set
|
||||
### Parse description (usually ifAlias) if config option set
|
||||
if (isset($config['port_descr_parser']) && is_file($config['install_dir'] . "/" . $config['port_descr_parser']))
|
||||
{
|
||||
$port_attribs = array('type','descr','circuit','speed','notes');
|
||||
|
||||
include($config['install_dir'] . "/" . $config['port_descr_parser']);
|
||||
|
||||
foreach ($port_attribs as $attrib)
|
||||
@@ -274,22 +274,22 @@ foreach ($ports as $port)
|
||||
}
|
||||
}
|
||||
}
|
||||
/// End parse ifAlias
|
||||
### End parse ifAlias
|
||||
|
||||
/// Update IF-MIB metrics
|
||||
### Update IF-MIB metrics
|
||||
foreach ($stat_oids_db as $oid)
|
||||
{
|
||||
# echo("\n".$oid.":");
|
||||
|
||||
if($config['slow_statistics'] == TRUE) {
|
||||
if ($config['slow_statistics'] == TRUE) {
|
||||
$port['update'][$oid] = $this_port[$oid];
|
||||
$port['update'][$oid.'_prev'] = $port[$oid];
|
||||
}
|
||||
|
||||
if($config['memcached']['enable'])
|
||||
if ($config['memcached']['enable'])
|
||||
{
|
||||
$port[$oid] = $memcache->get('port-'.$port['interface_id'].'-'.$oid);
|
||||
$memcache->set('port-'.$port['interface_id'].'-'.$oid, $this_port[$oid]);
|
||||
$memcache->set('port-'.$port['interface_id'].'-'.$oid, $this_port[$oid]);
|
||||
$memcache->set('port-'.$port['interface_id'].'-'.$oid.'_prev', $port[$oid]);
|
||||
# echo("MEMCACHE!");
|
||||
}
|
||||
@@ -308,19 +308,19 @@ foreach ($ports as $port)
|
||||
$port['stats'][$oid.'_rate'] = $oid_rate;
|
||||
$port['stats'][$oid.'_diff'] = $oid_diff;
|
||||
|
||||
if($config['slow_statistics'] == TRUE) {
|
||||
if ($config['slow_statistics'] == TRUE) {
|
||||
$port['update'][$oid.'_rate'] = $oid_rate;
|
||||
$port['update'][$oid.'_delta'] = $oid_diff;
|
||||
}
|
||||
|
||||
if($config['memcached']['enable'])
|
||||
{
|
||||
if ($config['memcached']['enable'])
|
||||
{
|
||||
$memcache->set('port-'.$port['interface_id'].'-'.$oid.'_rate', $oid_rate);
|
||||
$memcache->set('port-'.$port['interface_id'].'-'.$oid.'_delta', $oid_diff);
|
||||
# echo($oid."[".$oid_rate."]");
|
||||
}
|
||||
# echo($oid."[".$oid_rate."]");
|
||||
}
|
||||
|
||||
if ($debug) {echo("\n $oid ($oid_diff B) $oid_rate Bps $polled_period secs\n"); }
|
||||
if ($debug) { echo("\n $oid ($oid_diff B) $oid_rate Bps $polled_period secs\n"); }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -331,7 +331,7 @@ foreach ($ports as $port)
|
||||
echo('pkts('.format_si($port['stats']['ifInUcastPkts_rate']).'pps/'.format_si($port['stats']['ifOutUcastPkts_rate']).'pps)');
|
||||
|
||||
### Port utilisation % threshold alerting. ## Fixme allow setting threshold per-port. probably 90% of ports we don't care about.
|
||||
if($config['alerts']['port_util_alert'])
|
||||
if ($config['alerts']['port_util_alert'])
|
||||
{
|
||||
// Check for port saturation of $config['alerts']['port_util_perc'] or higher. Alert if we see this.
|
||||
// Check both inbound and outbound rates
|
||||
@@ -344,7 +344,7 @@ foreach ($ports as $port)
|
||||
}
|
||||
}
|
||||
|
||||
/// Update RRDs
|
||||
### Update RRDs
|
||||
$rrdfile = $host_rrd . "/port-" . safename($port['ifIndex'] . ".rrd");
|
||||
if (!is_file($rrdfile))
|
||||
{
|
||||
@@ -375,7 +375,7 @@ foreach ($ports as $port)
|
||||
}
|
||||
|
||||
foreach ($stat_oids as $oid)
|
||||
{ /// Copy values from array to global variables and force numeric.
|
||||
{ ### Copy values from array to global variables and force numeric.
|
||||
$$oid = $this_port[$oid];
|
||||
if (!is_numeric($$oid)) { $$oid = "U"; }
|
||||
}
|
||||
@@ -383,44 +383,44 @@ foreach ($ports as $port)
|
||||
$if_rrd_update = "$polled:$ifInOctets:$ifOutOctets:$ifInErrors:$ifOutErrors:$ifInUcastPkts:$ifOutUcastPkts:$ifInNUcastPkts:$ifOutNUcastPkts:$ifInDiscards:$ifOutDiscards:$ifInUnknownProtos";
|
||||
$if_rrd_update .= ":$ifInBroadcastPkts:$ifOutBroadcastPkts:$ifInMulticastPkts:$ifOutMulticastPkts";
|
||||
$ret = rrdtool_update("$rrdfile", $if_rrd_update);
|
||||
/// End Update IF-MIB
|
||||
### End Update IF-MIB
|
||||
|
||||
/// Update PAgP
|
||||
### Update PAgP
|
||||
if ($this_port['pagpOperationMode'] || $port['pagpOperationMode'])
|
||||
{
|
||||
foreach ($pagp_oids as $oid)
|
||||
{ /// Loop the OIDs
|
||||
{ ### Loop the OIDs
|
||||
if ($this_port[$oid] != $port[$oid])
|
||||
{ /// If data has changed, build a query
|
||||
{ ### If data has changed, build a query
|
||||
$port['update'][$oid] = $this_port[$oid];
|
||||
echo("PAgP ");
|
||||
log_event("$oid -> ".$this_port[$oid], $device, 'interface', $port['interface_id']);
|
||||
}
|
||||
}
|
||||
}
|
||||
/// End Update PAgP
|
||||
### End Update PAgP
|
||||
|
||||
/// Do EtherLike-MIB
|
||||
### Do EtherLike-MIB
|
||||
if ($config['enable_ports_etherlike']) { include("port-etherlike.inc.php"); }
|
||||
|
||||
/// Do ADSL MIB
|
||||
### Do ADSL MIB
|
||||
if ($config['enable_ports_adsl']) { include("port-adsl.inc.php"); }
|
||||
|
||||
/// Do PoE MIBs
|
||||
### Do PoE MIBs
|
||||
if ($config['enable_ports_poe']) { include("port-poe.inc.php"); }
|
||||
|
||||
/// Do Alcatel Detailed Stats
|
||||
### Do Alcatel Detailed Stats
|
||||
if ($device['os'] == "aos") { include("port-alcatel.inc.php"); }
|
||||
|
||||
/// Update Database
|
||||
### Update Database
|
||||
if (count($port['update']))
|
||||
{
|
||||
$updated = dbUpdate($port['update'], 'ports', '`interface_id` = ?', array($port['interface_id']));
|
||||
if ($debug) { echo("$updated updated"); }
|
||||
}
|
||||
/// End Update Database
|
||||
### End Update Database
|
||||
|
||||
/// Send alerts for interface flaps.
|
||||
### Send alerts for interface flaps.
|
||||
if ($config['alerts']['port']['ifdown'] && ($port['ifOperStatus'] != $this_port['ifOperStatus']) && $port['ignore'] == 0)
|
||||
{
|
||||
if ($this_port['ifAlias'])
|
||||
@@ -442,7 +442,7 @@ foreach ($ports as $port)
|
||||
}
|
||||
elseif ($port['disabled'] != "1")
|
||||
{
|
||||
echo("Port Deleted"); /// Port missing from SNMP cache.
|
||||
echo("Port Deleted"); ### Port missing from SNMP cache.
|
||||
dbUpdate(array('deleted' => '1'), 'ports', '`device_id` = ? AND `ifIndex` = ?', array($device['device_id'], $port['ifIndex']));
|
||||
} else {
|
||||
echo("Port Disabled.");
|
||||
@@ -450,11 +450,11 @@ foreach ($ports as $port)
|
||||
|
||||
echo("\n");
|
||||
|
||||
/// Clear Per-Port Variables Here
|
||||
### Clear Per-Port Variables Here
|
||||
unset($this_port);
|
||||
}
|
||||
|
||||
/// Clear Variables Here
|
||||
### Clear Variables Here
|
||||
unset($port_stats);
|
||||
|
||||
?>
|
||||
|
||||
@@ -13,30 +13,30 @@ if(!$agent)
|
||||
echo "failed";
|
||||
exit();
|
||||
} else {
|
||||
while (!feof($agent))
|
||||
{
|
||||
$agent_raw .= fgets($agent, 128);
|
||||
}
|
||||
while (!feof($agent))
|
||||
{
|
||||
$agent_raw .= fgets($agent, 128);
|
||||
}
|
||||
}
|
||||
|
||||
if(!empty($agent_raw))
|
||||
{
|
||||
foreach(explode("<<<", $agent_raw) as $section)
|
||||
foreach (explode("<<<", $agent_raw) as $section)
|
||||
{
|
||||
|
||||
list($section, $data) = explode(">>>", $section);
|
||||
$agent_data[$section] = trim($data);
|
||||
}
|
||||
|
||||
if(!empty($agent_data['rpm']))
|
||||
if (!empty($agent_data['rpm']))
|
||||
{
|
||||
echo("RPM Packages ");
|
||||
## Build array of existing packages
|
||||
$manager = "rpm";
|
||||
|
||||
$pkgs_db_db = dbFetchRows("SELECT * FROM `packages` WHERE `device_id` = ?", array($device['device_id']));
|
||||
foreach ($pkgs_db_db as $pkg_db)
|
||||
{
|
||||
foreach ($pkgs_db_db as $pkg_db)
|
||||
{
|
||||
$pkgs_db[$pkg_db['manager']][$pkg_db['name']][$pkg_db['arch']][$pkg_db['version']][$pkg_db['build']]['id'] = $pkg_db['pkg_id'];
|
||||
$pkgs_db[$pkg_db['manager']][$pkg_db['name']][$pkg_db['arch']][$pkg_db['version']][$pkg_db['build']]['status'] = $pkg_db['status'];
|
||||
$pkgs_db[$pkg_db['manager']][$pkg_db['name']][$pkg_db['arch']][$pkg_db['version']][$pkg_db['build']]['size'] = $pkg_db['size'];
|
||||
@@ -48,9 +48,9 @@ if(!empty($agent_raw))
|
||||
$pkgs_db_id[$pkg_db['pkg_id']]['build'] = $pkg_db['build'];
|
||||
}
|
||||
|
||||
foreach(explode("\n", $agent_data['rpm']) as $package)
|
||||
foreach (explode("\n", $agent_data['rpm']) as $package)
|
||||
{
|
||||
list($name, $version, $build, $arch, $size) = explode(" ", $package);
|
||||
list($name, $version, $build, $arch, $size) = explode(" ", $package);
|
||||
$pkgs[$manager][$name][$arch][$version][$build]['manager'] = $manager;
|
||||
$pkgs[$manager][$name][$arch][$version][$build]['name'] = $name;
|
||||
$pkgs[$manager][$name][$arch][$version][$build]['arch'] = $arch;
|
||||
@@ -62,29 +62,29 @@ if(!empty($agent_raw))
|
||||
$pkgs_id[] = $pkgs[$manager][$name][$arch][$version][$build];
|
||||
}
|
||||
|
||||
foreach($pkgs_id as $pkg) {
|
||||
foreach ($pkgs_id as $pkg) {
|
||||
$name = $pkg['name'];
|
||||
$version = $pkg['version'];
|
||||
$build = $pkg['build'];
|
||||
$arch = $pkg['arch'];
|
||||
$size = $pkg['size'];
|
||||
|
||||
|
||||
#echo(str_pad($name, 20)." ".str_pad($version, 10)." ".str_pad($build, 10)." ".$arch."\n");
|
||||
#echo($name." ");
|
||||
|
||||
if(is_array($pkgs_db[$pkg['manager']][$pkg['name']][$pkg['arch']][$pkg['version']][$pkg['build']]))
|
||||
if (is_array($pkgs_db[$pkg['manager']][$pkg['name']][$pkg['arch']][$pkg['version']][$pkg['build']]))
|
||||
{
|
||||
### FIXME - packages_history table
|
||||
$id = $pkgs_db[$pkg['manager']][$pkg['name']][$pkg['arch']][$pkg['version']][$pkg['build']]['id'];
|
||||
if($pkgs_db[$pkg['manager']][$pkg['name']][$pkg['arch']][$pkg['version']][$pkg['build']]['status'] != '1')
|
||||
if ($pkgs_db[$pkg['manager']][$pkg['name']][$pkg['arch']][$pkg['version']][$pkg['build']]['status'] != '1')
|
||||
{
|
||||
$pkg_update['status'] = '1';
|
||||
}
|
||||
if($pkgs_db[$pkg['manager']][$pkg['name']][$pkg['arch']][$pkg['version']][$pkg['build']]['size'] != $size)
|
||||
if ($pkgs_db[$pkg['manager']][$pkg['name']][$pkg['arch']][$pkg['version']][$pkg['build']]['size'] != $size)
|
||||
{
|
||||
$pkg_update['size'] = $size;
|
||||
$pkg_update['size'] = $size;
|
||||
}
|
||||
if(!empty($pkg_update))
|
||||
if (!empty($pkg_update))
|
||||
{
|
||||
dbUpdate($pkg_update, 'packages', '`pkg_id` = ?', array($id));
|
||||
echo("u");
|
||||
@@ -92,18 +92,18 @@ if(!empty($agent_raw))
|
||||
echo(".");
|
||||
}
|
||||
unset($pkgs_db_id[$id]);
|
||||
} else {
|
||||
if(count($pkgs[$manager][$name][$arch], 1) > "10" || count($pkgs_db[$manager][$name][$arch], 1) == '0') {
|
||||
} else {
|
||||
if (count($pkgs[$manager][$name][$arch], 1) > "10" || count($pkgs_db[$manager][$name][$arch], 1) == '0') {
|
||||
dbInsert(array('device_id' => $device['device_id'], 'name' => $name, 'manager' => $manager,
|
||||
'status' => 1, 'version' => $version, 'build' => $build, 'arch' => $arch, 'size' => $size), 'packages');
|
||||
echo("+".$name."-".$version."-".$build."-".$arch);
|
||||
log_event('Package installed: '.$name.' ('.$arch.') version '.$version.'-'.$build, $device, 'package');
|
||||
log_event('Package installed: '.$name.' ('.$arch.') version '.$version.'-'.$build, $device, 'package');
|
||||
} elseif(count($pkgs_db[$manager][$name][$arch], 1)) {
|
||||
$pkg_c = dbFetchRow("SELECT * FROM `packages` WHERE `device_id` = ? AND `manager` = ? AND `name` = ? and `arch` = ? ORDER BY version DESC, build DESC", array($device['device_id'], $manager, $name, $arch));
|
||||
echo("U(".$pkg_c['name']."-".$pkg_c['version']."-".$pkg_c['build']."|".$name."-".$version."-".$build.")");
|
||||
echo("U(".$pkg_c['name']."-".$pkg_c['version']."-".$pkg_c['build']."|".$name."-".$version."-".$build.")");
|
||||
$pkg_update = array('version' => $version, 'build' => $build, 'status' => '1', 'size' => $size);
|
||||
dbUpdate($pkg_update, 'packages', '`pkg_id` = ?', array($pkg_c['pkg_id']));
|
||||
log_event('Package updated: '.$name.' ('.$arch.') from '.$pkg_c['version'].'-'.$pkg_c['build'] .' to '.$version.'-'.$build, $device, 'package');
|
||||
dbUpdate($pkg_update, 'packages', '`pkg_id` = ?', array($pkg_c['pkg_id']));
|
||||
log_event('Package updated: '.$name.' ('.$arch.') from '.$pkg_c['version'].'-'.$pkg_c['build'] .' to '.$version.'-'.$build, $device, 'package');
|
||||
unset($pkgs_db_id[$pkg_c['pkg_id']]);
|
||||
}
|
||||
}
|
||||
@@ -111,7 +111,7 @@ if(!empty($agent_raw))
|
||||
}
|
||||
}
|
||||
|
||||
foreach($pkgs_db_id as $id => $pkg)
|
||||
foreach ($pkgs_db_id as $id => $pkg)
|
||||
{
|
||||
dbDelete('packages', "`pkg_id` = ?", array($id));
|
||||
echo("-".$pkg['text']);
|
||||
|
||||
Reference in New Issue
Block a user