Esempio n. 1
0
function process_port_etherlike(&$this_port, $device)
{
    // Used to loop below for StatsD
    $etherlike_oids = array('dot3StatsAlignmentErrors', 'dot3StatsFCSErrors', 'dot3StatsSingleCollisionFrames', 'dot3StatsMultipleCollisionFrames', 'dot3StatsSQETestErrors', 'dot3StatsDeferredTransmissions', 'dot3StatsLateCollisions', 'dot3StatsExcessiveCollisions', 'dot3StatsInternalMacTransmitErrors', 'dot3StatsCarrierSenseErrors', 'dot3StatsFrameTooLongs', 'dot3StatsInternalMacReceiveErrors', 'dot3StatsSymbolErrors');
    // Overwrite ifDuplex with dot3StatsDuplexStatus if it exists
    if (isset($this_port['dot3StatsDuplexStatus'])) {
        // echo("dot3Duplex, ");
        $this_port['ifDuplex'] = $this_port['dot3StatsDuplexStatus'];
    }
    if ($this_port['ifType'] == "ethernetCsmacd" && isset($this_port['dot3StatsIndex'])) {
        // Check to make sure Port data is cached.
        rrdtool_update_ng($device, 'port-dot3', array('dot3StatsAlignmentErrors' => $this_port['dot3StatsAlignmentErrors'], 'dot3StatsFCSErrors' => $this_port['dot3StatsFCSErrors'], 'dot3StatsSingleCollisionFrames' => $this_port['dot3StatsSingleCollisionFrames'], 'dot3StatsMultipleCollisionFrames' => $this_port['dot3StatsMultipleCollisionFrames'], 'dot3StatsSQETestErrors' => $this_port['dot3StatsSQETestErrors'], 'dot3StatsDeferredTransmissions' => $this_port['dot3StatsDeferredTransmissions'], 'dot3StatsLateCollisions' => $this_port['dot3StatsLateCollisions'], 'dot3StatsExcessiveCollisions' => $this_port['dot3StatsExcessiveCollisions'], 'dot3StatsInternalMacTransmitErrors' => $this_port['dot3StatsInternalMacTransmitErrors'], 'dot3StatsCarrierSenseErrors' => $this_port['dot3StatsCarrierSenseErrors'], 'dot3StatsFrameTooLongs' => $this_port['dot3StatsFrameTooLongs'], 'dot3StatsInternalMacReceiveErrors' => $this_port['dot3StatsInternalMacReceiveErrors'], 'dot3StatsSymbolErrors' => $this_port['dot3StatsSymbolErrors']), get_port_rrdindex($this_port));
        if ($GLOBALS['config']['statsd']['enable'] == TRUE) {
            foreach ($etherlike_oids as $oid) {
                // Update StatsD/Carbon
                StatsD::gauge(str_replace(".", "_", $device['hostname']) . '.' . 'port' . '.' . $this_port['ifIndex'] . '.' . $oid, $this_port[$oid]);
            }
        }
    }
}
Esempio n. 2
0
function process_port_adsl(&$this_port, $device, $port)
{
    // Check to make sure Port data is cached.
    if (!isset($this_port['adslLineCoding'])) {
        return;
    }
    // Used below for StatsD only
    $adsl_oids = array('adslAtucCurrSnrMgn', 'adslAtucCurrAtn', 'adslAtucCurrOutputPwr', 'adslAtucCurrAttainableRate', 'adslAtucChanCurrTxRate', 'adslAturCurrSnrMgn', 'adslAturCurrAtn', 'adslAturCurrOutputPwr', 'adslAturCurrAttainableRate', 'adslAturChanCurrTxRate', 'adslAtucPerfLofs', 'adslAtucPerfLoss', 'adslAtucPerfLprs', 'adslAtucPerfESs', 'adslAtucPerfInits', 'adslAturPerfLofs', 'adslAturPerfLoss', 'adslAturPerfLprs', 'adslAturPerfESs', 'adslAtucChanCorrectedBlks', 'adslAtucChanUncorrectBlks', 'adslAturChanCorrectedBlks', 'adslAturChanUncorrectBlks');
    $adsl_db_oids = array('adslLineCoding', 'adslLineType', 'adslAtucInvVendorID', 'adslAtucInvVersionNumber', 'adslAtucCurrSnrMgn', 'adslAtucCurrAtn', 'adslAtucCurrOutputPwr', 'adslAtucCurrAttainableRate', 'adslAturInvSerialNumber', 'adslAturInvVendorID', 'adslAturInvVersionNumber', 'adslAtucChanCurrTxRate', 'adslAturChanCurrTxRate', 'adslAturCurrSnrMgn', 'adslAturCurrAtn', 'adslAturCurrOutputPwr', 'adslAturCurrAttainableRate');
    $adsl_tenth_oids = array('adslAtucCurrSnrMgn', 'adslAtucCurrAtn', 'adslAtucCurrOutputPwr', 'adslAturCurrSnrMgn', 'adslAturCurrAtn', 'adslAturCurrOutputPwr');
    foreach ($adsl_tenth_oids as $oid) {
        if (isset($this_port[$oid])) {
            $this_port[$oid] = $this_port[$oid] / 10;
        }
    }
    if (dbFetchCell("SELECT COUNT(*) FROM `ports_adsl` WHERE `port_id` = ?", array($port['port_id'])) == "0") {
        dbInsert(array('port_id' => $port['port_id']), 'ports_adsl');
    }
    $adsl_update = array('port_adsl_updated' => array('NOW()'));
    foreach ($adsl_db_oids as $oid) {
        $adsl_update[$oid] = $this_port[$oid];
    }
    dbUpdate($adsl_update, 'ports_adsl', '`port_id` = ?', array($port['port_id']));
    if ($this_port['adslAtucCurrSnrMgn'] > "1280") {
        $this_port['adslAtucCurrSnrMgn'] = "U";
    }
    if ($this_port['adslAturCurrSnrMgn'] > "1280") {
        $this_port['adslAturCurrSnrMgn'] = "U";
    }
    rrdtool_update_ng($device, 'port-adsl', array('AtucCurrSnrMgn' => $this_port['adslAtucCurrSnrMgn'], 'AtucCurrAtn' => $this_port['adslAtucCurrAtn'], 'AtucCurrOutputPwr' => $this_port['adslAtucCurrOutputPwr'], 'AtucCurrAttainableR' => $this_port['adslAtucCurrAttainableR'], 'AtucChanCurrTxRate' => $this_port['adslAtucChanCurrTxRate'], 'AturCurrSnrMgn' => $this_port['adslAturCurrSnrMgn'], 'AturCurrAtn' => $this_port['adslAturCurrAtn'], 'AturCurrOutputPwr' => $this_port['adslAturCurrOutputPwr'], 'AturCurrAttainableR' => $this_port['adslAturCurrAttainableR'], 'AturChanCurrTxRate' => $this_port['adslAturChanCurrTxRate'], 'AtucPerfLofs' => $this_port['adslAtucPerfLofs'], 'AtucPerfLoss' => $this_port['adslAtucPerfLoss'], 'AtucPerfLprs' => $this_port['adslAtucPerfLprs'], 'AtucPerfESs' => $this_port['adslAtucPerfESs'], 'AtucPerfInits' => $this_port['adslAtucPerfInits'], 'AturPerfLofs' => $this_port['adslAturPerfLofs'], 'AturPerfLoss' => $this_port['adslAturPerfLoss'], 'AturPerfLprs' => $this_port['adslAturPerfLprs'], 'AturPerfESs' => $this_port['adslAturPerfESs'], 'AtucChanCorrectedBl' => $this_port['adslAtucChanCorrectedBl'], 'AtucChanUncorrectBl' => $this_port['adslAtucChanUncorrectBl'], 'AturChanCorrectedBl' => $this_port['adslAturChanCorrectedBl'], 'AturChanUncorrectBl' => $this_port['adslAturChanUncorrectBl']), get_port_rrdindex($port));
    if ($GLOBALS['config']['statsd']['enable']) {
        foreach ($adsl_oids as $oid) {
            // Update StatsD/Carbon
            StatsD::gauge(str_replace(".", "_", $device['hostname']) . '.' . 'port' . '.' . $port['ifIndex'] . '.' . $oid, $this_port[$oid]);
        }
    }
    //echo("ADSL (".$this_port['adslLineCoding']."/".formatRates($this_port['adslAtucChanCurrTxRate'])."/".formatRates($this_port['adslAturChanCurrTxRate']).")");
}
Esempio n. 3
0
 $port['alert_array']['rx_ave_pktsize'] = $port['state']['ifInOctets_delta'] / ($port['state']['ifInUcastPkts_delta'] + $port['state']['ifInNUcastPkts_delta']);
 $port['alert_array']['tx_ave_pktsize'] = $port['state']['ifOutOctets_delta'] / ($port['state']['ifOutUcastPkts_delta'] + $port['state']['ifOutNUcastPkts_delta']);
 // Store aggregate in/out state
 $port['state']['ifOctets_rate'] = $port['stats']['ifOutOctets_rate'] + $port['stats']['ifInOctets_rate'];
 $port['state']['ifUcastPkts_rate'] = $port['stats']['ifOutUcastPkts_rate'] + $port['stats']['ifInUcastPkts_rate'];
 $port['state']['ifErrors_rate'] = $port['stats']['ifOutErrors_rate'] + $port['stats']['ifInErrors_rate'];
 // Send aggregate data to alerter too
 $port['alert_array']['ifOctets_rate'] = $port['state']['ifOctets_rate'];
 $port['alert_array']['ifUcastPkts_rate'] = $port['state']['ifUcastPkts_rate'];
 $port['alert_array']['ifNUcastPkts_rate'] = $port['stats']['ifOutNUcastPkts_rate'] + $port['stats']['ifInNUcastPkts_rate'];
 $port['alert_array']['ifErrors_rate'] = $port['state']['ifErrors_rate'];
 $port['alert_array']['ifBroadcastPkts_rate'] = $port['stats']['ifOutBroadcastPkts_rate'] + $port['stats']['ifInBroadcastPkts_rate'];
 $port['alert_array']['ifMulticastPkts_rate'] = $port['stats']['ifOutMulticastPkts_rate'] + $port['stats']['ifInMulticastPkts_rate'];
 $port['alert_array']['ifDiscards_rate'] = $port['stats']['ifOutDiscards_rate'] + $port['stats']['ifInDiscards_rate'];
 // Update RRDs
 rrdtool_update_ng($device, 'port', array('INOCTETS' => $this_port['ifInOctets'], 'OUTOCTETS' => $this_port['ifOutOctets'], 'INERRORS' => $this_port['ifInErrors'], 'OUTERRORS' => $this_port['ifOutErrors'], 'INUCASTPKTS' => $this_port['ifInUcastPkts'], 'OUTUCASTPKTS' => $this_port['ifOutUcastPkts'], 'INNUCASTPKTS' => $this_port['ifInNUcastPkts'], 'OUTNUCASTPKTS' => $this_port['ifOutNUcastPkts'], 'INDISCARDS' => $this_port['ifInDiscards'], 'OUTDISCARDS' => $this_port['ifOutDiscards'], 'INUNKNOWNPROTOS' => $this_port['ifInUnknownProtos'], 'INBROADCASTPKTS' => $this_port['ifInBroadcastPkts'], 'OUTBROADCASTPKTS' => $this_port['ifOutBroadcastPkts'], 'INMULTICASTPKTS' => $this_port['ifInMulticastPkts'], 'OUTMULTICASTPKTS' => $this_port['ifOutMulticastPkts']), get_port_rrdindex($port));
 // End Update IF-MIB
 // Update additional MIBS and modules
 foreach ($process_port_db as $port_module => $oids) {
     $log_event = array();
     foreach ($oids as $oid) {
         if ($port[$oid] != $this_port[$oid]) {
             if (isset($this_port[$oid])) {
                 $port['update'][$oid] = $this_port[$oid];
                 $msg = "[{$oid}] '" . $port[$oid] . "' -> '" . $this_port[$oid] . "'";
             } else {
                 $port['update'][$oid] = array('NULL');
                 $msg = "[{$oid}] '" . $port[$oid] . "' -> NULL";
             }
             $log_event[] = $msg;
             if (OBS_DEBUG) {
Esempio n. 4
0
if (is_numeric($fdb_count) && $fdb_count > 0) {
    rrdtool_update_ng($device, 'fdb_count', array('value' => $fdb_count));
    $graphs['fdb_count'] = TRUE;
} else {
    $graphs['fdb_count'] = FALSE;
}
// FIXME should non-global fdb count be in the ports poller?
$fdbcount_module = 'enable_ports_fdbcount';
if ($attribs[$fdbcount_module] || $config[$fdbcount_module] && !isset($attribs[$fdbcount_module])) {
    foreach ($fdb_portcount as $port => $count) {
        $port_info = $port_table[$port];
        if (!$port_info) {
            print_debug("No entry in port table for {$port}");
            continue;
        }
        rrdtool_update_ng($device, 'port-fdbcount', array('value' => $count), get_port_rrdindex($port_info));
        $graphs['port_fdb_count'] = TRUE;
    }
}
// print_cli_table($table_rows, array('%WVLAN%n', '%WMAC Address%n', '%WPort%n', '%WPort ID%n', '%WFDB Port%n', '%WifIndex%n', '%WStatus%n'));
// Loop the existing list and delete anything remaining
$table_rows = array();
foreach ($fdbs_db as $vlan => $fdb_macs) {
    foreach ($fdb_macs as $mac => $data) {
        $table_row = array();
        $table_row[] = $vlan;
        $table_row[] = $mac;
        //$table_row[] = $data['port_label_short'];
        $table_row[] = $data['port_id'];
        //$table_row[] = $fdb_port;
        //$table_row[] = $data['ifIndex'];
Esempio n. 5
0
function get_port_rrdfilename($port, $suffix = NULL, $fullpath = FALSE)
{
    $this_port_identifier = get_port_rrdindex($port);
    if ($suffix == "") {
        $filename = "port-" . $this_port_identifier . ".rrd";
    } else {
        $filename = "port-" . $this_port_identifier . "-" . $suffix . ".rrd";
    }
    if ($fullpath) {
        $device = device_by_id_cache($port['device_id']);
        $filename = get_rrd_path($device, $filename);
    }
    return $filename;
}
Esempio n. 6
0
<?php

/**
 * Observium
 *
 *   This file is part of Observium.
 *
 * @package    observium
 * @subpackage poller
 * @copyright  (C) 2006-2013 Adam Armstrong, (C) 2013-2016 Observium Limited
 *
 */
// This code is currently not used.
if (isset($port_stats[$port['ifIndex']]) && $port['ifType'] == "ethernetCsmacd") {
    // Check to make sure Port data is cached.
    $this_port =& $port_stats[$port['ifIndex']];
    if ($config['statsd']['enable'] == TRUE) {
        foreach (array('cpeExtPsePortPwrAllocated', 'cpeExtPsePortPwrAvailable', 'cpeExtPsePortPwrConsumption', 'cpeExtPsePortMaxPwrDrawn') as $oid) {
            // Update StatsD/Carbon
            StatsD::gauge(str_replace(".", "_", $device['hostname']) . '.' . 'port' . '.' . $port['ifIndex'] . '.' . $oid, $this_port[$oid]);
        }
    }
    rrdtool_update_ng($device, 'port-poe', array('PortPwrAllocated' => $port['cpeExtPsePortPwrAllocated'], 'PortPwrAvailable' => $port['cpeExtPsePortPwrAvailable'], 'PortConsumption' => $port['cpeExtPsePortPwrConsumption'], 'PortMaxPwrDrawn' => $port['cpeExtPsePortMaxPwrDrawn']), get_port_rrdindex($port));
    echo "PoE ";
}
// EOF