mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
first steps to new architecture! (new-poller.php and new-mac.php!)
git-svn-id: http://www.observium.org/svn/observer/trunk@487 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
13
html/includes/graphs/mac_acc_bits.inc.php
Normal file
13
html/includes/graphs/mac_acc_bits.inc.php
Normal file
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
function graph_mac_acc_bits ($id, $graph, $from, $to, $width, $height) {
|
||||
global $config;
|
||||
$imgfile = $config['install_dir'] . "/graphs/" . "$graph";
|
||||
$query = mysql_query("SELECT * FROM `mac_accounting` AS M, `interfaces` AS I, `devices` AS D WHERE M.ma_id = '".$id."' AND I.interface_id = M.interface_id AND I.device_id = D.device_id");
|
||||
$acc = mysql_fetch_array($query);
|
||||
$database = $acc['hostname'] . "/mac-accounting/" . $acc['ifIndex'] . "-" . $acc['mac'] . ".rrd";
|
||||
return graph_bits ($database, $graph, $from, $to, $width, $height, $title, $vertical);
|
||||
}
|
||||
|
||||
|
||||
?>
|
76
html/includes/graphs/multi_bits_separate.inc.php
Normal file
76
html/includes/graphs/multi_bits_separate.inc.php
Normal file
@@ -0,0 +1,76 @@
|
||||
<?php
|
||||
|
||||
function graph_multi_bits ($args) {
|
||||
|
||||
include("common.inc.php");
|
||||
$i = 1;
|
||||
$options .= " COMMENT:' In\: Current Maximum '";
|
||||
if(!$args['nototal']) {$options .= " COMMENT:'Total '";}
|
||||
$options .= " COMMENT:'Out\: Current Maximum'";
|
||||
if(!$args['nototal']) {$options .= " COMMENT:' Total'";}
|
||||
$options .= " COMMENT:'\\\\n'";
|
||||
|
||||
foreach(explode(",", $args['interfaces']) as $ifid) {
|
||||
$query = mysql_query("SELECT * FROM `interfaces` AS I, devices as D WHERE I.interface_id = '" . $ifid . "' AND I.device_id = D.device_id");
|
||||
$int = mysql_fetch_array($query);
|
||||
$this_rrd = $config['rrd_dir'] . "/" . $int['hostname'] . "/" . $int['ifIndex'] . ".rrd";
|
||||
$units='bps'; $unit='B'; $colours='greens'; $multiplier = "8"; $coloursb = 'blues';
|
||||
if(is_file($this_rrd)) {
|
||||
$name = $int['ifDescr'];
|
||||
if(!$config['graph_colours'][$colours][$iter] || !$config['graph_colours'][$coloursb][$iter]) { $iter = 0; }
|
||||
$colour=$config['graph_colours'][$colours][$iter];
|
||||
$colourb=$config['graph_colours'][$coloursb][$iter];
|
||||
$descr = str_pad($name, 30);
|
||||
$descr = substr($descr,0,30);
|
||||
$options .= " DEF:in".$ifid."=$this_rrd:INOCTETS:AVERAGE ";
|
||||
$options .= " DEF:out".$ifid."temp=$this_rrd:OUTOCTETS:AVERAGE ";
|
||||
$options .= " CDEF:inB".$ifid."=in".$ifid.",$multiplier,* ";
|
||||
$options .= " CDEF:outB".$ifid."temp=out".$ifid."temp,$multiplier,*";
|
||||
$options .= " CDEF:outB".$ifid."=outB".$ifid."temp,-1,*";
|
||||
$options .= " CDEF:octets".$ifid."=inB".$ifid.",outB".$ifid."temp,+";
|
||||
if(!$args['nototal']) {
|
||||
$options .= " VDEF:totin".$ifid."=inB".$ifid.",TOTAL";
|
||||
$options .= " VDEF:totout".$ifid."=outB".$ifid."temp,TOTAL";
|
||||
$options .= " VDEF:tot".$ifid."=octets".$ifid.",TOTAL";
|
||||
}
|
||||
$options .= " HRULE:999999999999999#" . $colourb . ":\\\s:";
|
||||
$options .= " AREA:inB".$ifid."#" . $colour . ":'" . $descr . "':STACK";
|
||||
if($optionsb) {$stack="STACK";}
|
||||
$optionsb .= " AREA:outB".$ifid."#" . $colourb . "::$stack";
|
||||
$options .= " GPRINT:inB".$ifid.":LAST:%6.2lf%s$units";
|
||||
$options .= " GPRINT:inB".$ifid.":MAX:%6.2lf%s$units";
|
||||
if(!$args['nototal']) {
|
||||
$options .= " GPRINT:totin".$ifid.":%6.2lf%s$unit";
|
||||
}
|
||||
$options .= " COMMENT:' '";
|
||||
$options .= " GPRINT:outB".$ifid."temp:LAST:%6.2lf%s$units";
|
||||
$options .= " GPRINT:outB".$ifid."temp:MAX:%6.2lf%s$units";
|
||||
if(!$args['nototal']) {
|
||||
$options .= " GPRINT:totout".$ifid.":%6.2lf%s$unit";
|
||||
}
|
||||
$options .= " COMMENT:\\\\n";
|
||||
$iter++;
|
||||
}
|
||||
}
|
||||
$options .= $optionsb;
|
||||
$options .= " HRULE:0#999999";
|
||||
#echo($config['rrdtool'] . " graph $graphfile $options");
|
||||
$thing = shell_exec($config['rrdtool'] . " graph $graphfile $options");
|
||||
return $graphfile;
|
||||
}
|
||||
|
||||
if($_GET['if']) { $args['interfaces'] = $_GET['if']; }
|
||||
if($_GET['interfaces']) { $args['interfaces'] = $_GET['interfaces']; }
|
||||
if($interfaces) {$args['interfaces'] = $interfaces; }
|
||||
|
||||
$args['graphfile'] = $graphfile;
|
||||
$args['from'] = $from;
|
||||
$args['to'] = $to;
|
||||
$args['width'] = $width;
|
||||
$args['height'] = $height;
|
||||
if($_GET['legend']) {
|
||||
$args['legend'] = $_GET['legend'];
|
||||
}
|
||||
$graph = graph_multi_bits ($args);
|
||||
|
||||
?>
|
22
html/includes/graphs/pagp_bits.inc.php
Normal file
22
html/includes/graphs/pagp_bits.inc.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
## Generate a list of interfaces and then call the multi_bits grapher to generate from the list
|
||||
|
||||
$parent = mysql_fetch_array(mysql_query("SELECT * FROM `interfaces` WHERE interface_id = '".$_GET['port']."'"));
|
||||
|
||||
$query = mysql_query("SELECT `ifIndex`,`interface_id` FROM `interfaces` WHERE `device_id` = '".$parent['device_id']."' AND `pagpGroupIfIndex` = '".$parent['ifIndex']."'");
|
||||
|
||||
while($int = mysql_fetch_row($query)) {
|
||||
if(is_file($config['rrd_dir'] . "/" . $hostname . "/" . $int[0] . ".rrd")) {
|
||||
$interfaces .= $seperator . $int[1];
|
||||
$seperator = ",";
|
||||
}
|
||||
}
|
||||
|
||||
$args['nototal'] = 1;
|
||||
|
||||
include ("multi_bits_separate.inc.php");
|
||||
|
||||
|
||||
|
||||
?>
|
@@ -71,6 +71,8 @@ if(mysql_result(mysql_query("SELECT count(*) from cempMemPool WHERE device_id =
|
||||
$mempool['descr_fixed'] = str_replace("Routing Processor", "RP", $mempool['descr_fixed']);
|
||||
$mempool['descr_fixed'] = str_replace("Switching Processor", "SP", $mempool['descr_fixed']);
|
||||
$mempool['descr_fixed'] = str_replace("Processor", "Proc", $mempool['descr_fixed']);
|
||||
$mempool['descr_fixed'] = str_replace("Sub-Module", "Mod", $mempool['descr_fixed']);
|
||||
$mempool['descr_fixed'] = str_replace("DFC Card", "DFC", $mempool['descr_fixed']);
|
||||
|
||||
$proc_url = "?page=device/".$device['device_id']."/sensors/mempools/";
|
||||
|
||||
|
@@ -98,7 +98,7 @@ while ($interface = mysql_fetch_array($interface_query)) {
|
||||
}
|
||||
|
||||
if ( $interface['ifAlias'] != $ifAlias && $ifAlias != "" ) {
|
||||
$update .= $seperator . "`ifAlias` = '$ifAlias'";
|
||||
$update .= $seperator . "`ifAlias` = '".mysql_real_escape_string($ifAlias)."'";
|
||||
$seperator = ", ";
|
||||
mysql_query("INSERT INTO eventlog (`host`, `interface`, `datetime`, `message`) VALUES ('" . $interface['device_id'] . "', '" . $interface['interface_id'] . "', NOW(), 'ifAlias -> $ifAlias')");
|
||||
}
|
||||
@@ -118,7 +118,7 @@ while ($interface = mysql_fetch_array($interface_query)) {
|
||||
$update_query = "UPDATE `interfaces` SET ";
|
||||
$update_query .= $update;
|
||||
$update_query .= " WHERE `interface_id` = '" . $interface['interface_id'] . "'";
|
||||
# echo("Updating : " . $device['hostname'] . " $ifDescr\nSQL :$update_query\n\n");
|
||||
echo("Updating : " . $device['hostname'] . " $ifDescr\nSQL :$update_query\n\n");
|
||||
$update_result = mysql_query($update_query);
|
||||
} else {
|
||||
# echo("Not Updating : " . $device['hostname'] ." $ifDescr ( " . $interface['ifDescr'] . " )\n\n");
|
||||
|
@@ -71,11 +71,16 @@ $exists = false;
|
||||
$columns = mysql_query("SHOW columns FROM `interfaces`");
|
||||
while($c = mysql_fetch_assoc($columns)){
|
||||
if($c['Field'] == "pagpOperationMode"){
|
||||
$pagp = true;
|
||||
break;
|
||||
$db_pagp = true;
|
||||
}
|
||||
if($c['Field'] == "portName"){
|
||||
$db_portName = true;
|
||||
}
|
||||
if($c['Field'] == "ifHighSpeed"){
|
||||
$db_ifHighSpeed = true;
|
||||
}
|
||||
}
|
||||
if(!$pagp) {
|
||||
if(!$db_pagp) {
|
||||
mysql_query("ALTER TABLE `interfaces` ADD `pagpOperationMode` VARCHAR( 32 ) NULL ,
|
||||
ADD `pagpPortState` VARCHAR( 16 ) NULL ,
|
||||
ADD `pagpPartnerDeviceId` VARCHAR( 48 ) NULL ,
|
||||
@@ -85,7 +90,10 @@ ADD `pagpPartnerGroupIfIndex` INT NULL ,
|
||||
ADD `pagpPartnerDeviceName` VARCHAR( 128 ) NULL ,
|
||||
ADD `pagpEthcOperationMode` VARCHAR( 16 ) NULL ,
|
||||
ADD `pagpDeviceId` VARCHAR( 48 ) NULL ,
|
||||
ADD `pagpGroupIfIndex` INT NULL");
|
||||
}
|
||||
ADD `pagpGroupIfIndex` INT NULL"); }
|
||||
|
||||
if(!$db_portName) { mysql_query("ALTER TABLE `interfaces` ADD `portName` VARCHAR( 128 ) NULL DEFAULT NULL AFTER `ifName`"); }
|
||||
if(!$db_ifHighSpeed) { mysql_query("ALTER TABLE `interfaces` ADD `ifHighSpeed` INT ( 11 ) NULL DEFAULT NULL AFTER `ifSpeed`"); }
|
||||
|
||||
|
||||
?>
|
||||
|
623
mibs/CISCO-LAG-MIB.my
Normal file
623
mibs/CISCO-LAG-MIB.my
Normal file
@@ -0,0 +1,623 @@
|
||||
-- *****************************************************************
|
||||
-- CISCO-LAG-MIB.my: Cisco LAG MIB
|
||||
--
|
||||
-- October 2001, Liwei Lue
|
||||
--
|
||||
-- Copyright (c) 2001-2003, 2004, 2006, 2008 by cisco Systems, Inc.
|
||||
-- All rights reserved.
|
||||
--
|
||||
-- *****************************************************************
|
||||
|
||||
CISCO-LAG-MIB DEFINITIONS ::= BEGIN
|
||||
|
||||
IMPORTS
|
||||
MODULE-IDENTITY,
|
||||
OBJECT-TYPE,
|
||||
Unsigned32
|
||||
FROM SNMPv2-SMI
|
||||
MODULE-COMPLIANCE,
|
||||
OBJECT-GROUP
|
||||
FROM SNMPv2-CONF
|
||||
TEXTUAL-CONVENTION
|
||||
FROM SNMPv2-TC
|
||||
ciscoMgmt
|
||||
FROM CISCO-SMI
|
||||
dot3adAggPortEntry,
|
||||
dot3adAggPortListEntry
|
||||
FROM IEEE8023-LAG-MIB
|
||||
ifIndex
|
||||
FROM IF-MIB;
|
||||
|
||||
|
||||
ciscoLagMIB MODULE-IDENTITY
|
||||
LAST-UPDATED "200801080000Z"
|
||||
ORGANIZATION "Cisco Systems, Inc."
|
||||
CONTACT-INFO
|
||||
"Cisco Systems
|
||||
Customer Service
|
||||
|
||||
Postal: 170 W Tasman Drive
|
||||
San Jose, CA 95134
|
||||
USA
|
||||
|
||||
Tel: +1 800 553-NETS
|
||||
|
||||
E-mail: cs-etherchan@cisco.com
|
||||
cs-lan-switch-snmp@cisco.com"
|
||||
DESCRIPTION
|
||||
"Cisco Link Aggregation module for managing IEEE Std
|
||||
802.3ad.
|
||||
|
||||
This MIB provides Link Aggregation information that are
|
||||
either excluded by IEEE Std 802.3ad (IEEE8023-LAG-MIB)
|
||||
or specific to Cisco products."
|
||||
REVISION "200801080000Z"
|
||||
DESCRIPTION
|
||||
"Modified the description of clagAggPortListPorts."
|
||||
REVISION "200606210000Z"
|
||||
DESCRIPTION
|
||||
"Added clagAggMaxAggregatorsGroup and modified the
|
||||
description of clagAggPortListPorts."
|
||||
REVISION "200406110000Z"
|
||||
DESCRIPTION
|
||||
"Added clagAggPortListTable."
|
||||
REVISION "200212130000Z"
|
||||
DESCRIPTION
|
||||
"Added a new value vlanIpPort(4) in TEXTUAL-CONVENTION
|
||||
ClagDistributionProtocol.
|
||||
Added a new object clagAggDistributionMplsProtocol."
|
||||
REVISION "200201020000Z"
|
||||
DESCRIPTION
|
||||
"Modified Description of clagAggDistributionProtocol."
|
||||
REVISION "200110230000Z"
|
||||
DESCRIPTION
|
||||
"Initial version of this MIB module.
|
||||
Support Distribution configuration for LACP, Aggregation
|
||||
protocol control, and Administrative status for LACP."
|
||||
::= { ciscoMgmt 225 }
|
||||
|
||||
|
||||
clagMIBObjects OBJECT IDENTIFIER
|
||||
::= { ciscoLagMIB 1 }
|
||||
|
||||
|
||||
-- -------------------------------------------------------------
|
||||
-- Textual Conventions
|
||||
-- -------------------------------------------------------------
|
||||
|
||||
ClagDistributionProtocol ::= TEXTUAL-CONVENTION
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"An enumerated type for all the supported load balancing
|
||||
algorithms used on the LACP interface to distribute
|
||||
outgoing data frames among its component interaces, such
|
||||
as IP address.
|
||||
|
||||
ip(1) IP address
|
||||
mac(2) MAC address
|
||||
port(3) port number
|
||||
vlanIpPort(4) vlan number, IP address and
|
||||
port number"
|
||||
SYNTAX INTEGER {
|
||||
ip(1),
|
||||
mac(2),
|
||||
port(3),
|
||||
vlanIpPort(4)
|
||||
}
|
||||
|
||||
ClagDistributionAddressMode ::= TEXTUAL-CONVENTION
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"An enumerated type for all the supported load
|
||||
balancing address modes to distribute traffic
|
||||
across multiple links. The address mode can be
|
||||
source, destination, or both used on this LACP
|
||||
interface to distribute outgoing data frames among
|
||||
its component interfaces.
|
||||
|
||||
source(1) Source address.
|
||||
destination(2) Destination address.
|
||||
both(3) both, Source and Destination."
|
||||
SYNTAX INTEGER {
|
||||
source(1),
|
||||
destination(2),
|
||||
both(3)
|
||||
}
|
||||
|
||||
ClagDistributionMplsProtocol ::= TEXTUAL-CONVENTION
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"An enumerated type for all the supported load balancing
|
||||
algorithms used on the LACP interface to distribute
|
||||
outgoing MPLS (Multi-Protocol Label Switching) data
|
||||
frames among its component interfaces, such as
|
||||
MPLS label.
|
||||
|
||||
label(1) MPLS label
|
||||
labelIp(2) MPLS label or IP address"
|
||||
SYNTAX INTEGER {
|
||||
label(1),
|
||||
labelIp(2)
|
||||
}
|
||||
|
||||
ClagAggregationProtocol ::= TEXTUAL-CONVENTION
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"An enumerated type for all the supported aggregation
|
||||
protocols.
|
||||
|
||||
lacp(1) Link Aggregation Control Protocol(LACP),
|
||||
IEEE 802.3ad
|
||||
pagp(2) Port Aggregation Protocol"
|
||||
SYNTAX INTEGER {
|
||||
lacp(1),
|
||||
pagp(2)
|
||||
}
|
||||
|
||||
ClagPortAdminStatus ::= TEXTUAL-CONVENTION
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"An enumerated type for all the LACP administrative states on
|
||||
a particular aggregation port.
|
||||
|
||||
off(1) No LACP involved on the aggregation port.
|
||||
|
||||
on(2) The aggregation port always join link
|
||||
aggregation whithout any LACP protocol
|
||||
involved.
|
||||
|
||||
active(3) Active LACP indicates the port's preference
|
||||
to participate in the protocol regardless of
|
||||
Partner's control value.
|
||||
|
||||
passive(4) Passive indicates the port's preference for
|
||||
not transmitting LACP PDU unless its Partner's
|
||||
control value is Active LACP."
|
||||
SYNTAX INTEGER {
|
||||
off(1),
|
||||
on(2),
|
||||
active(3),
|
||||
passive(4)
|
||||
}
|
||||
-- -------------------------------------------------------------
|
||||
--
|
||||
-- -------------------------------------------------------------
|
||||
-- groups in the LAG MIB
|
||||
-- -------------------------------------------------------------
|
||||
|
||||
clagGlobalConfigObjects OBJECT IDENTIFIER
|
||||
::= { clagMIBObjects 1 }
|
||||
|
||||
clagAgg OBJECT IDENTIFIER
|
||||
::= { clagMIBObjects 2 }
|
||||
|
||||
clagAggPort OBJECT IDENTIFIER
|
||||
::= { clagMIBObjects 3 }
|
||||
|
||||
clagAggPortList OBJECT IDENTIFIER
|
||||
::= { clagMIBObjects 4 }
|
||||
|
||||
|
||||
-- -------------------------------------------------------------
|
||||
--
|
||||
-- -------------------------------------------------------------
|
||||
-- The Aggregation Global Configuration
|
||||
-- -------------------------------------------------------------
|
||||
|
||||
clagAggDistributionProtocol OBJECT-TYPE
|
||||
SYNTAX ClagDistributionProtocol
|
||||
MAX-ACCESS read-write
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"This object controls the load balancing algorithms
|
||||
used on this LACP interface to distribute outgoing data
|
||||
frames among its component interfaces."
|
||||
::= { clagGlobalConfigObjects 1 }
|
||||
|
||||
clagAggDistributionAddressMode OBJECT-TYPE
|
||||
SYNTAX ClagDistributionAddressMode
|
||||
MAX-ACCESS read-write
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"The load balancing address mode for the device."
|
||||
::= { clagGlobalConfigObjects 2 }
|
||||
|
||||
clagAggDistributionMplsProtocol OBJECT-TYPE
|
||||
SYNTAX ClagDistributionMplsProtocol
|
||||
MAX-ACCESS read-write
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"This object controls the load balancing algorithms
|
||||
used on this LACP interface to distribute outgoing MPLS
|
||||
data frames among its component interfaces.
|
||||
|
||||
This object is only instantiated on platforms which
|
||||
support aggregation load balancing for MPLS packets."
|
||||
::= { clagGlobalConfigObjects 3 }
|
||||
|
||||
clagAggMaxAggregators OBJECT-TYPE
|
||||
SYNTAX Unsigned32
|
||||
MAX-ACCESS read-only
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"This object indicates the maximum number of aggregators
|
||||
supported by the device."
|
||||
::= { clagGlobalConfigObjects 4 }
|
||||
-- -------------------------------------------------------------
|
||||
-- The Aggregation Protocol Table
|
||||
-- -------------------------------------------------------------
|
||||
|
||||
clagAggProtocolTable OBJECT-TYPE
|
||||
SYNTAX SEQUENCE OF ClagAggProtocolEntry
|
||||
MAX-ACCESS not-accessible
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"A table that contains protocol information about every
|
||||
interface which supports link aggregation."
|
||||
::= { clagAgg 1 }
|
||||
|
||||
clagAggProtocolEntry OBJECT-TYPE
|
||||
SYNTAX ClagAggProtocolEntry
|
||||
MAX-ACCESS not-accessible
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"Entry containing aggregation protocol type for a
|
||||
particular interface. An entry is created in this
|
||||
table when its associated ifEntry is created and that
|
||||
interface supports link aggregation. The entry of this
|
||||
table is deleted when the associated ifEntry is removed."
|
||||
INDEX { ifIndex }
|
||||
::= { clagAggProtocolTable 1 }
|
||||
|
||||
ClagAggProtocolEntry ::= SEQUENCE {
|
||||
clagAggProtocolType ClagAggregationProtocol
|
||||
}
|
||||
|
||||
clagAggProtocolType OBJECT-TYPE
|
||||
SYNTAX ClagAggregationProtocol
|
||||
MAX-ACCESS read-write
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"The aggregation protocol type for the interface.
|
||||
|
||||
On some platforms, aggregation protocol may be assigned per
|
||||
group. The group can be a collection of the ports which belong
|
||||
to a module or system. If the aggregation protocol is assigned
|
||||
to any of the ports in such group then the aggregation protocol
|
||||
will apply to all ports in the same group.
|
||||
|
||||
On some platforms, aggregation protocol type can be assigned
|
||||
per aggregator. If multiple ports belong to a aggregator,
|
||||
the aggregation protocol assigned to any of the ports in such
|
||||
aggregator will apply to all ports in the same."
|
||||
::= { clagAggProtocolEntry 1 }
|
||||
|
||||
|
||||
-- -------------------------------------------------------------
|
||||
-- The Aggregation Port Configuration Table
|
||||
-- -------------------------------------------------------------
|
||||
|
||||
clagAggPortTable OBJECT-TYPE
|
||||
SYNTAX SEQUENCE OF ClagAggPortEntry
|
||||
MAX-ACCESS not-accessible
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"A table that contains information about every
|
||||
aggregation port that is associated with this system.
|
||||
This table contains additional objects for the
|
||||
dot3adAggPortTable."
|
||||
REFERENCE "IEEE 802.3 Subclause 30.7.2"
|
||||
::= { clagAggPort 1 }
|
||||
|
||||
clagAggPortEntry OBJECT-TYPE
|
||||
SYNTAX ClagAggPortEntry
|
||||
MAX-ACCESS not-accessible
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"An entry containing additional management information
|
||||
applicable to a particular aggregation port."
|
||||
AUGMENTS { dot3adAggPortEntry }
|
||||
|
||||
::= { clagAggPortTable 1 }
|
||||
|
||||
ClagAggPortEntry ::= SEQUENCE {
|
||||
clagAggPortAdminStatus ClagPortAdminStatus
|
||||
}
|
||||
|
||||
clagAggPortAdminStatus OBJECT-TYPE
|
||||
SYNTAX ClagPortAdminStatus
|
||||
MAX-ACCESS read-write
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"The administrative status of the LACP protocol on this
|
||||
aggregation port."
|
||||
::= { clagAggPortEntry 1 }
|
||||
|
||||
|
||||
-- -------------------------------------------------------------
|
||||
-- The Port List Table
|
||||
-- -------------------------------------------------------------
|
||||
|
||||
clagAggPortListTable OBJECT-TYPE
|
||||
SYNTAX SEQUENCE OF ClagAggPortListEntry
|
||||
MAX-ACCESS not-accessible
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"This table augments the dot3adAggPortListTable and
|
||||
provides the complete list of ports associated with
|
||||
each Aggregator."
|
||||
REFERENCE "IEEE 802.3 Subclause 30.7.1.1.30"
|
||||
::= { clagAggPortList 1 }
|
||||
|
||||
clagAggPortListEntry OBJECT-TYPE
|
||||
SYNTAX ClagAggPortListEntry
|
||||
MAX-ACCESS not-accessible
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"A list of the ports associated with a given Aggregator."
|
||||
AUGMENTS { dot3adAggPortListEntry }
|
||||
|
||||
::= { clagAggPortListTable 1 }
|
||||
|
||||
ClagAggPortListEntry ::= SEQUENCE {
|
||||
clagAggPortListPorts OCTET STRING
|
||||
}
|
||||
|
||||
clagAggPortListPorts OBJECT-TYPE
|
||||
SYNTAX OCTET STRING (SIZE (2..256))
|
||||
MAX-ACCESS read-only
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"This object contains a list of ports currently associated
|
||||
with this Aggregator in the format of
|
||||
'[number_of_ports][cieIfDot1dBaseMappingPort1][...]
|
||||
[cieIfDot1dBaseMappingPortn]'
|
||||
|
||||
where
|
||||
[number_of_ports] is of size 2 octet and indicates
|
||||
the number of ports contains in this object. It
|
||||
also indicates the number of cieIfDot1dBaseMappingPort field
|
||||
following this field.
|
||||
|
||||
[cieIfDot1dBaseMappingPort'n'] is the value of
|
||||
cieIfDot1dBaseMappingPort of the 'n' port associated with this
|
||||
Aggregation and has size of 2 octets where n is up to
|
||||
[number_of_ports]."
|
||||
REFERENCE "IEEE 802.3 Subclause 30.7.1.1.30"
|
||||
::= { clagAggPortListEntry 1 }
|
||||
|
||||
|
||||
-- -------------------------------------------------------------
|
||||
--
|
||||
-- -------------------------------------------------------------
|
||||
-- Notifications
|
||||
-- -------------------------------------------------------------
|
||||
|
||||
clagMIBNotifications OBJECT IDENTIFIER
|
||||
::= { ciscoLagMIB 2 }
|
||||
|
||||
-- no notifications defined
|
||||
--
|
||||
-- -------------------------------------------------------------
|
||||
-- Conformance
|
||||
-- -------------------------------------------------------------
|
||||
|
||||
clagMIBConformance OBJECT IDENTIFIER
|
||||
::= { ciscoLagMIB 3 }
|
||||
|
||||
clagMIBCompliances OBJECT IDENTIFIER
|
||||
::= { clagMIBConformance 1 }
|
||||
|
||||
clagMIBGroups OBJECT IDENTIFIER
|
||||
::= { clagMIBConformance 2 }
|
||||
|
||||
|
||||
-- -------------------------------------------------------------
|
||||
--
|
||||
-- -------------------------------------------------------------
|
||||
-- Compliance
|
||||
-- -------------------------------------------------------------
|
||||
|
||||
clagMIBCompliance MODULE-COMPLIANCE
|
||||
STATUS deprecated
|
||||
DESCRIPTION
|
||||
"The compliance statement for entities which implement
|
||||
the Cisco Link Aggregation MIB"
|
||||
MODULE -- this module
|
||||
MANDATORY-GROUPS {
|
||||
clagAggProtocolGroup,
|
||||
clagAggPortGroup
|
||||
}
|
||||
|
||||
GROUP clagAggDistributionGroup
|
||||
DESCRIPTION
|
||||
"This group is mandatory for the devices which
|
||||
supported aggregation load balancing."
|
||||
|
||||
OBJECT clagAggProtocolType
|
||||
MIN-ACCESS read-only
|
||||
DESCRIPTION
|
||||
"Write access is not required."
|
||||
|
||||
OBJECT clagAggPortAdminStatus
|
||||
MIN-ACCESS read-only
|
||||
DESCRIPTION
|
||||
"Write access is not required."
|
||||
::= { clagMIBCompliances 1 }
|
||||
|
||||
clagMIBCompliance2 MODULE-COMPLIANCE
|
||||
STATUS deprecated
|
||||
DESCRIPTION
|
||||
"The compliance statement for entities which implement
|
||||
the Cisco Link Aggregation MIB"
|
||||
MODULE -- this module
|
||||
MANDATORY-GROUPS {
|
||||
clagAggProtocolGroup,
|
||||
clagAggPortGroup
|
||||
}
|
||||
|
||||
GROUP clagAggDistributionGroup
|
||||
DESCRIPTION
|
||||
"This group is mandatory for the devices which
|
||||
supported aggregation load balancing."
|
||||
|
||||
GROUP clagAggDistributionMplsGroup
|
||||
DESCRIPTION
|
||||
"This group is mandatory for the devices which
|
||||
supported aggregation load balancing for MPLS
|
||||
packets."
|
||||
|
||||
OBJECT clagAggProtocolType
|
||||
MIN-ACCESS read-only
|
||||
DESCRIPTION
|
||||
"Write access is not required."
|
||||
|
||||
OBJECT clagAggPortAdminStatus
|
||||
MIN-ACCESS read-only
|
||||
DESCRIPTION
|
||||
"Write access is not required."
|
||||
::= { clagMIBCompliances 2 }
|
||||
|
||||
clagMIBCompliance3 MODULE-COMPLIANCE
|
||||
STATUS deprecated
|
||||
DESCRIPTION
|
||||
"The compliance statement for entities which implement
|
||||
the Cisco Link Aggregation MIB"
|
||||
MODULE -- this module
|
||||
MANDATORY-GROUPS {
|
||||
clagAggProtocolGroup,
|
||||
clagAggPortGroup
|
||||
}
|
||||
|
||||
GROUP clagAggDistributionGroup
|
||||
DESCRIPTION
|
||||
"This group is mandatory for the devices which
|
||||
supported aggregation load balancing."
|
||||
|
||||
GROUP clagAggDistributionMplsGroup
|
||||
DESCRIPTION
|
||||
"This group is mandatory for the devices which
|
||||
supported aggregation load balancing for MPLS
|
||||
packets."
|
||||
|
||||
GROUP clagAggPortListGroup
|
||||
DESCRIPTION
|
||||
"This group is mandatory for the devices which
|
||||
supports dot1dBasePort value greater than 2048."
|
||||
|
||||
OBJECT clagAggProtocolType
|
||||
MIN-ACCESS read-only
|
||||
DESCRIPTION
|
||||
"Write access is not required."
|
||||
|
||||
OBJECT clagAggPortAdminStatus
|
||||
MIN-ACCESS read-only
|
||||
DESCRIPTION
|
||||
"Write access is not required."
|
||||
::= { clagMIBCompliances 3 }
|
||||
|
||||
clagMIBCompliance4 MODULE-COMPLIANCE
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"The compliance statement for entities which implement
|
||||
the Cisco Link Aggregation MIB"
|
||||
MODULE -- this module
|
||||
MANDATORY-GROUPS {
|
||||
clagAggProtocolGroup,
|
||||
clagAggPortGroup
|
||||
}
|
||||
|
||||
GROUP clagAggDistributionGroup
|
||||
DESCRIPTION
|
||||
"This group is mandatory for the devices which
|
||||
supported aggregation load balancing."
|
||||
|
||||
GROUP clagAggDistributionMplsGroup
|
||||
DESCRIPTION
|
||||
"This group is mandatory for the devices which
|
||||
supported aggregation load balancing for MPLS
|
||||
packets."
|
||||
|
||||
GROUP clagAggPortListGroup
|
||||
DESCRIPTION
|
||||
"This group is mandatory for the devices which
|
||||
supports dot1dBasePort value greater than 2048."
|
||||
|
||||
GROUP clagAggMaxAggregatorsGroup
|
||||
DESCRIPTION
|
||||
"This group is mandatory for the devices which
|
||||
provides the information about the maximum number
|
||||
of aggregators supported by the device."
|
||||
|
||||
OBJECT clagAggProtocolType
|
||||
MIN-ACCESS read-only
|
||||
DESCRIPTION
|
||||
"Write access is not required."
|
||||
|
||||
OBJECT clagAggPortAdminStatus
|
||||
MIN-ACCESS read-only
|
||||
DESCRIPTION
|
||||
"Write access is not required."
|
||||
::= { clagMIBCompliances 4 }
|
||||
|
||||
-- -------------------------------------------------------------
|
||||
-- Units of Conformance
|
||||
-- -------------------------------------------------------------
|
||||
|
||||
clagAggProtocolGroup OBJECT-GROUP
|
||||
OBJECTS { clagAggProtocolType }
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"The object that provide aggregation protocol type of an
|
||||
interface. These are additional to the IEEE Std 802.3ad
|
||||
MIB."
|
||||
::= { clagMIBGroups 1 }
|
||||
|
||||
clagAggPortGroup OBJECT-GROUP
|
||||
OBJECTS { clagAggPortAdminStatus }
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"A collection of objects that provide admin status
|
||||
about an aggregation port. These are additional to the
|
||||
IEEE Std 802.3ad MIB."
|
||||
::= { clagMIBGroups 2 }
|
||||
|
||||
clagAggDistributionGroup OBJECT-GROUP
|
||||
OBJECTS {
|
||||
clagAggDistributionProtocol,
|
||||
clagAggDistributionAddressMode
|
||||
}
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"A collection of objects that provide the load balancing
|
||||
information for an aggregator. These are additional to
|
||||
the IEEE Std 802.3ad MIB."
|
||||
::= { clagMIBGroups 3 }
|
||||
|
||||
clagAggDistributionMplsGroup OBJECT-GROUP
|
||||
OBJECTS { clagAggDistributionMplsProtocol }
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"A collection of objects that provide the load balancing
|
||||
information for an aggregator for MPLS packets.
|
||||
These are additional to the IEEE Std 802.3ad MIB."
|
||||
::= { clagMIBGroups 4 }
|
||||
|
||||
clagAggPortListGroup OBJECT-GROUP
|
||||
OBJECTS { clagAggPortListPorts }
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"A collection of object that provides information about
|
||||
ports in an aggregation."
|
||||
::= { clagMIBGroups 5 }
|
||||
|
||||
clagAggMaxAggregatorsGroup OBJECT-GROUP
|
||||
OBJECTS { clagAggMaxAggregators }
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"A collection of object that provides information about
|
||||
the maximum number of aggregators supported by the
|
||||
device."
|
||||
::= { clagMIBGroups 6 }
|
||||
|
||||
END
|
1400
mibs/IEEE8023-LAG-MIB.my
Normal file
1400
mibs/IEEE8023-LAG-MIB.my
Normal file
File diff suppressed because it is too large
Load Diff
1276
mibs/SMON-MIB.mib
Normal file
1276
mibs/SMON-MIB.mib
Normal file
File diff suppressed because it is too large
Load Diff
112
new-mac.php
Executable file
112
new-mac.php
Executable file
@@ -0,0 +1,112 @@
|
||||
#!/usr/bin/php
|
||||
<?php
|
||||
|
||||
include("config.php");
|
||||
include("includes/functions.php");
|
||||
|
||||
if($argv[1]) { $where = "AND `device_id` = '$argv[1]'"; }
|
||||
|
||||
function snmp_cache_cip($oid, $device, $array, $mib = 0) {
|
||||
global $config;
|
||||
$cmd = $config['snmpbulkwalk'] . " -O snq -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'] . " ";
|
||||
if($mib) { $cmd .= "-m $mib "; }
|
||||
$cmd .= $oid;
|
||||
$data = trim(shell_exec($cmd));
|
||||
$device_id = $device['device_id'];
|
||||
echo("Caching: $oid\n");
|
||||
foreach(explode("\n", $data) as $entry) {
|
||||
list ($this_oid, $this_value) = split(" ", $entry);
|
||||
$this_oid = trim($this_oid);
|
||||
$this_value = trim($this_value);
|
||||
$this_oid = substr($this_oid, 30);
|
||||
list($ifIndex,$dir,$a,$b,$c,$d,$e,$f) = explode(".", $this_oid);
|
||||
$h_a = zeropad(dechex($a));
|
||||
$h_b = zeropad(dechex($b));
|
||||
$h_c = zeropad(dechex($c));
|
||||
$h_d = zeropad(dechex($d));
|
||||
$h_e = zeropad(dechex($e));
|
||||
$h_f = zeropad(dechex($f));
|
||||
$mac = "$h_a$h_b$h_c$h_d$h_e$h_f";
|
||||
if($dir == "1") { $dir = "input"; } elseif($dir == "2") { $dir = "output"; }
|
||||
if($mac && $dir) {
|
||||
$array[$device_id][$ifIndex][$mac][$oid][$dir] = $this_value;
|
||||
}
|
||||
}
|
||||
return $array;
|
||||
}
|
||||
|
||||
$i = 0;
|
||||
$device_query = mysql_query("SELECT * FROM `devices` WHERE `ignore` = '0' AND `disabled` = '0' AND `status` = '1' $where ORDER BY device_id DESC");
|
||||
while ($device = mysql_fetch_array($device_query)) {
|
||||
echo("-> " . $device['hostname'] . "\n");
|
||||
$i++;
|
||||
$cip_oids = array('cipMacHCSwitchedBytes', 'cipMacHCSwitchedPkts');
|
||||
foreach ($cip_oids as $oid) { $array = snmp_cache_cip($oid, $device, $array, "CISCO-IP-STAT-MIB"); }
|
||||
echo("\n");
|
||||
}
|
||||
|
||||
$mac_accounting_query = mysql_query("SELECT * FROM `mac_accounting` as A, `interfaces` AS I, `devices` AS D where A.interface_id = I.interface_id AND I.device_id = D.device_id AND D.status = '1'");
|
||||
while ($acc = mysql_fetch_array($mac_accounting_query)) {
|
||||
|
||||
$device_id = $acc['device_id'];
|
||||
$ifIndex = $acc['ifIndex'];
|
||||
$mac = $acc['mac'];
|
||||
if($array[$device_id][$ifIndex][$mac]) {
|
||||
|
||||
$b_in = $array[$device_id][$ifIndex][$mac]['cipMacHCSwitchedBytes']['input'];
|
||||
$b_out = $array[$device_id][$ifIndex][$mac]['cipMacHCSwitchedBytes']['output'];
|
||||
$p_in = $array[$device_id][$ifIndex][$mac]['cipMacHCSwitchedPkts']['input'];
|
||||
$p_out = $array[$device_id][$ifIndex][$mac]['cipMacHCSwitchedPkts']['output'];
|
||||
|
||||
#echo($acc['hostname']." ".$acc['ifDescr'] . " $mac -> $b_in:$b_out:$p_in:$p_out ");
|
||||
|
||||
$acc_rrd = $config['rrd_dir'] . "/" . $acc['hostname'] . "/mac-accounting";
|
||||
if(!is_dir($acc_rrd)) { mkdir($acc_rrd); echo("Created directory : $acc_rrd\n"); }
|
||||
$old_rrdfile = $acc_rrd . "/" . $acc['ifIndex'] . "-" . $acc['ip'] . ".rrd";
|
||||
$rrdfile = $acc_rrd . "/" . $acc['ifIndex'] . "-" . $acc['mac'] . ".rrd";
|
||||
if(is_file($old_rrdfile) && !is_file($rrdfile)) { rename($old_rrdfile, $rrdfile); echo("Moved $old_rrdfile -> $rrdfile \n"); };
|
||||
$pkts_rrdfile = $acc_rrd . "/" . $acc['ifIndex'] . "-" . $acc['mac'] . "-pkts.rrd";
|
||||
|
||||
if(!is_file($pkts_rrdfile)) {
|
||||
$woo = shell_exec($config['rrdtool'] ." create $pkts_rrdfile \
|
||||
DS:IN:COUNTER:600:0:12500000000 \
|
||||
DS:OUT:COUNTER:600:0:12500000000 \
|
||||
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");
|
||||
}
|
||||
|
||||
if(!is_file($rrdfile)) {
|
||||
$woo = shell_exec($config['rrdtool'] ." create $rrdfile \
|
||||
DS:IN:COUNTER:600:0:12500000000 \
|
||||
DS:OUT:COUNTER:600:0:12500000000 \
|
||||
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");
|
||||
}
|
||||
|
||||
$woo = "N:".($b_in+0).":".($b_out+0);
|
||||
$ret = rrdtool_update("$rrdfile", $woo);
|
||||
|
||||
$woo = "N:".($p_in+0).":".($p_out+0);
|
||||
$ret = rrdtool_update("$pkts_rrdfile", $woo);
|
||||
|
||||
#echo(" R!\n");
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
echo("$i devices polled");
|
||||
|
||||
?>
|
129
new-poller.php
129
new-poller.php
@@ -6,7 +6,7 @@ include("includes/functions.php");
|
||||
|
||||
if($argv[1]) { $where = "AND `device_id` = '$argv[1]'"; }
|
||||
|
||||
function snmp_array($oid, $device, $array, $mib = 0) {
|
||||
function snmp_cache($oid, $device, $array, $mib = 0) {
|
||||
global $config;
|
||||
$cmd = $config['snmpbulkwalk'] . " -O Qs -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'] . " ";
|
||||
if($mib) { $cmd .= "-m $mib "; }
|
||||
@@ -23,10 +23,44 @@ function snmp_array($oid, $device, $array, $mib = 0) {
|
||||
if(!strstr($this_value, "No Such Instance currently exists at this OID") && $this_index) {
|
||||
$array[$device_id][$this_index][$this_oid] = $this_value;
|
||||
}
|
||||
$array[$device_id][$oid] = '1';
|
||||
}
|
||||
return $array;
|
||||
}
|
||||
|
||||
function snmp_cache_portIfIndex ($device, $array) {
|
||||
global $config;
|
||||
$cmd = $config['snmpwalk'] . " -CI -m CISCO-STACK-MIB -O q -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'] . " portIfIndex";
|
||||
$output = trim(shell_exec($cmd));
|
||||
echo("Caching: portIfIndex\n");
|
||||
foreach(explode("\n", $output) as $entry){
|
||||
$entry = str_replace("CISCO-STACK-MIB::portIfIndex.", "", $entry);
|
||||
list($slotport, $ifIndex) = explode(" ", $entry);
|
||||
$array[$device_id][$ifIndex]['portIfIndex'] = $slotport;
|
||||
$array[$device_id][$slotport]['ifIndex'] = $ifIndex;
|
||||
}
|
||||
return $array;
|
||||
}
|
||||
|
||||
function snmp_cache_portName ($device, $array) {
|
||||
global $config;
|
||||
$cmd = $config['snmpwalk'] . " -CI -m CISCO-STACK-MIB -O Qs -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'] . " portName";
|
||||
$output = trim(shell_exec($cmd));
|
||||
echo("Caching: portName\n");
|
||||
foreach(explode("\n", $output) as $entry){
|
||||
$entry = str_replace("portName.", "", $entry);
|
||||
list($slotport, $portName) = explode("=", $entry);
|
||||
$slotport = trim($slotport); $portName = trim($portName);
|
||||
if ($array[$device_id][$slotport]['ifIndex']) {
|
||||
$ifIndex = $array[$device_id][$slotport]['ifIndex'];
|
||||
$array[$device_id][$slotport]['portName'] = $portName;
|
||||
$array[$device_id][$ifIndex]['portName'] = $portName;
|
||||
}
|
||||
}
|
||||
return $array;
|
||||
}
|
||||
|
||||
|
||||
$i = 0;
|
||||
$device_query = mysql_query("SELECT * FROM `devices` WHERE `ignore` = '0' AND `disabled` = '0' AND `status` = '1' $where ORDER BY device_id DESC");
|
||||
while ($device = mysql_fetch_array($device_query)) {
|
||||
@@ -34,26 +68,34 @@ while ($device = mysql_fetch_array($device_query)) {
|
||||
$i++;
|
||||
|
||||
// Build SNMP Cache Array
|
||||
$data_oids = array('ifName','ifDescr','ifAlias', 'ifAdminStatus', 'ifOperStatus', 'ifMtu', 'ifSpeed', 'ifHighSpeed', 'ifType', 'ifPhysAddress');
|
||||
$stat_oids = array('ifHCInOctets', 'ifHCOutOctets', 'ifInErrors', 'ifOutErrors', 'ifInUcastPkts', 'ifOutUcastPkts', 'ifInNUcastPkts', 'ifOutNUcastPkts');
|
||||
$etherlike_oids = array('dot3StatsAlignmentErrors', 'dot3StatsFCSErrors', 'dot3StatsSingleCollisionFrames', 'dot3StatsMultipleCollisionFrames', 'dot3StatsSQETestErrors', 'dot3StatsDeferredTransmissions', 'dot3StatsLateCollisions', 'dot3StatsExcessiveCollisions', 'dot3StatsInternalMacTransmitErrors', 'dot3StatsCarrierSenseErrors', 'dot3StatsFrameTooLongs', 'dot3StatsInternalMacReceiveErrors', 'dot3StatsSymbolErrors', 'dot3StatsDuplexStatus');
|
||||
$cisco_oids = array('locIfHardType', 'vmVlan', 'vlanTrunkPortEncapsulationOperType', 'vlanTrunkPortNativeVlan', 'locIfInRunts', 'locIfInGiants', 'locIfInCRC', 'locIfInFrame', 'locIfInOverrun', 'locIfInIgnored', 'locIfInAbort', 'locIfCollisions', 'locIfInputQueueDrops', 'locIfOutputQueueDrops');
|
||||
$pagp_oids = array('pagpOperationMode', 'pagpPortState', 'pagpPartnerDeviceId', 'pagpPartnerLearnMethod', 'pagpPartnerIfIndex', 'pagpPartnerGroupIfIndex', 'pagpPartnerDeviceName', 'pagpEthcOperationMode', 'pagpDeviceId', 'pagpGroupIfIndex');
|
||||
foreach ($data_oids as $oid) {
|
||||
# $array = snmp_array($oid, $device, $array);
|
||||
}
|
||||
foreach ($stat_oids as $oid) {
|
||||
# $array = snmp_array($oid, $device, $array);
|
||||
}
|
||||
foreach ($etherlike_oids as $oid) {
|
||||
# $array = snmp_array($oid, $device, $array, "EtherLike-MIB");
|
||||
}
|
||||
foreach ($cisco_oids as $oid) {
|
||||
# $array = snmp_array($oid, $device, $array, "CISCO-SMI:CISCO-VLAN-MEMBERSHIP-MIB:CISCO-VTP-MIB:OLD-CISCO-INTERFACES-MIB");
|
||||
}
|
||||
foreach ($pagp_oids as $oid) {
|
||||
$array = snmp_array($oid, $device, $array, "CISCO-PAGP-MIB");
|
||||
}
|
||||
$data_oids = array('ifName','ifDescr','ifAlias', 'ifAdminStatus', 'ifOperStatus', 'ifMtu', 'ifSpeed', 'ifHighSpeed', 'ifType', 'ifPhysAddress',
|
||||
'ifPromiscuousMode','ifConnectorPresent');
|
||||
$stat_oids = array('ifHCInOctets', 'ifHCOutOctets', 'ifInErrors', 'ifOutErrors', 'ifInUcastPkts', 'ifOutUcastPkts', 'ifInNUcastPkts', 'ifOutNUcastPkts',
|
||||
'ifHCInMulticastPkts', 'ifHCInBroadcastPkts', 'ifHCOutMulticastPkts', 'ifHCOutBroadcastPkts');
|
||||
$etherlike_oids = array('dot3StatsAlignmentErrors', 'dot3StatsFCSErrors', 'dot3StatsSingleCollisionFrames', 'dot3StatsMultipleCollisionFrames',
|
||||
'dot3StatsSQETestErrors', 'dot3StatsDeferredTransmissions', 'dot3StatsLateCollisions', 'dot3StatsExcessiveCollisions',
|
||||
'dot3StatsInternalMacTransmitErrors', 'dot3StatsCarrierSenseErrors', 'dot3StatsFrameTooLongs', 'dot3StatsInternalMacReceiveErrors',
|
||||
'dot3StatsSymbolErrors', 'dot3StatsDuplexStatus');
|
||||
$cisco_oids = array('locIfHardType', 'locIfInRunts', 'locIfInGiants', 'locIfInCRC', 'locIfInFrame', 'locIfInOverrun', 'locIfInIgnored', 'locIfInAbort',
|
||||
'locIfCollisions', 'locIfInputQueueDrops', 'locIfOutputQueueDrops');
|
||||
$pagp_oids = array('pagpOperationMode', 'pagpPortState', 'pagpPartnerDeviceId', 'pagpPartnerLearnMethod', 'pagpPartnerIfIndex', 'pagpPartnerGroupIfIndex',
|
||||
'pagpPartnerDeviceName', 'pagpEthcOperationMode', 'pagpDeviceId', 'pagpGroupIfIndex');
|
||||
|
||||
$cip_oids = array('cipMacHCSwitchedBytes', 'cipMacHCSwitchedBytes', 'cipMacHCSwitchedPkts', 'cipMacHCSwitchedPkts');
|
||||
|
||||
$array = snmp_cache_portIfIndex ($device, $array);
|
||||
$array = snmp_cache_portName ($device, $array);
|
||||
foreach ($data_oids as $oid) { $array = snmp_cache($oid, $device, $array, "IF-MIB"); }
|
||||
#foreach ($cip_oids as $oid) { $array = snmp_cache($oid, $device, $array, "CISCO-IP-STAT-MIB"); }
|
||||
foreach ($stat_oids as $oid) { $array = snmp_cache($oid, $device, $array, "IF-MIB"); }
|
||||
foreach ($etherlike_oids as $oid) { $array = snmp_cache($oid, $device, $array, "EtherLike-MIB"); }
|
||||
foreach ($cisco_oids as $oid) { $array = snmp_cache($oid, $device, $array, "OLD-CISCO-INTERFACES-MIB"); }
|
||||
foreach ($pagp_oids as $oid) { $array = snmp_cache($oid, $device, $array, "CISCO-PAGP-MIB"); }
|
||||
|
||||
snmp_cache("vmVlan", $device, $array, "CISCO-VLAN-MEMBERSHIP-MIB");
|
||||
snmp_cache("vlanTrunkPortEncapsulationOperType", $device, $array, "CISCO-VTP-MIB");
|
||||
snmp_cache("vlanTrunkPortNativeVlan", $device, $array, "CISCO-VTP-MIB");
|
||||
|
||||
// End Building SNMP Cache Array
|
||||
|
||||
// New interface detection
|
||||
@@ -64,38 +106,57 @@ while ($device = mysql_fetch_array($device_query)) {
|
||||
|
||||
$port_query = mysql_query("SELECT * FROM `interfaces` WHERE `device_id` = '".$device['device_id']."'");
|
||||
while ($port = mysql_fetch_array($port_query)) {
|
||||
|
||||
echo(" --> " . $port['ifDescr'] . " ");
|
||||
if($array[$device[device_id]][$port[ifIndex]]) { // Check to make sure Port data is cached.
|
||||
$this_port = $array[$device[device_id]][$port[ifIndex]];
|
||||
if($this_port['pagpOperationMode']) { // Check if this port has PAgP enabled.
|
||||
echo($this_port['pagpOperationMode'] ." -> " . $port['pagpOperationMode'] . " ");
|
||||
|
||||
/// Update IF-MIB
|
||||
foreach ($data_oids as $oid) {
|
||||
if ( $port[$oid] != $this_port[$oid]) {
|
||||
$update .= $separator . "`$oid` = '".$this_port[$oid]."'";
|
||||
$separator = ", ";
|
||||
mysql_query("INSERT INTO eventlog (`host`, `interface`, `datetime`, `message`) VALUES ('" . $port['device_id'] . "', '" . $port['interface_id'] . "', NOW(), '".$oid . ": ".$port[$oid]." -> " . $this_port[$oid]."')");
|
||||
#eventlog($device['device_id'], 'interface', $port['interface_id'], $oid . ": ".$port[$oid]." -> " . $this_port[$oid]);
|
||||
echo($oid . " ");
|
||||
}
|
||||
}
|
||||
/// End Update IF-MIB
|
||||
|
||||
/// Update PAgP
|
||||
if($this_port['pagpOperationMode']) {
|
||||
unset($separator); unset($update);
|
||||
foreach ($pagp_oids as $oid) { // Loop the OIDs
|
||||
if ( $this_port[$oid] != $port[$oid] ) { // If data has changed, build a query
|
||||
$update .= $separator . "`$oid` = '".$this_port[$oid]."'";
|
||||
$separator = ", ";
|
||||
echo("PAgP ");
|
||||
}
|
||||
}
|
||||
if ($update) {
|
||||
$update_query = "UPDATE `interfaces` SET ";
|
||||
$update_query .= $update;
|
||||
$update_query .= " WHERE `interface_id` = '" . $port['interface_id'] . "'";
|
||||
@mysql_query($update_query);
|
||||
echo("PAgP ");
|
||||
unset($separator); unset($update_query); unset($update);
|
||||
}
|
||||
}
|
||||
}
|
||||
// End Update PAgP
|
||||
|
||||
|
||||
if ($update) { /// Do Updates
|
||||
$update_query = "UPDATE `interfaces` SET ";
|
||||
$update_query .= $update;
|
||||
$update_query .= " WHERE `interface_id` = '" . $port['interface_id'] . "'";
|
||||
#@mysql_query($update_query);
|
||||
#echo("$update_query");
|
||||
if(mysql_affected_rows > '0') { echo("Updated "); }
|
||||
} /// End Updates
|
||||
|
||||
unset($separator); unset($update_query); unset($update);
|
||||
} else {
|
||||
echo("Port Deleted?"); // Port missing from SNMP cache?
|
||||
}
|
||||
echo("\n");
|
||||
}
|
||||
|
||||
unset($array);
|
||||
#unset($array);
|
||||
echo("\n");
|
||||
}
|
||||
|
||||
echo("$i devices polled");
|
||||
|
||||
?>
|
||||
|
||||
|
@@ -76,16 +76,16 @@
|
||||
$woo = "N:".($pktin+0).":".($pktout+0);
|
||||
$ret = rrdtool_update("$pkts_rrdfile", $woo);
|
||||
|
||||
$rates = interface_rates ($rrdfile);
|
||||
# $rates = interface_rates ($rrdfile);
|
||||
|
||||
$pkt_rates = interface_rates ($pkts_rrdfile);
|
||||
# $pkt_rates = interface_rates ($pkts_rrdfile);
|
||||
|
||||
$pkt_rate['in'] = round($pkt_rate['in'] / 8);
|
||||
$pkt_rate['out'] = round($pkt_rate['out'] / 8);
|
||||
|
||||
mysql_query("UPDATE `mac_accounting` SET bps_in = '" . $rates['in'] . "', bps_out = '" . $rates['out'] . "', pps_in = '" . $pkt_rates['in'] . "', pps_out = '" . $pkt_rates['out'] . "' WHERE ma_id= '" . $acc['ma_id'] . "'");
|
||||
# mysql_query("UPDATE `mac_accounting` SET bps_in = '" . $rates['in'] . "', bps_out = '" . $rates['out'] . "', pps_in = '" . $pkt_rates['in'] . "', pps_out = '" . $pkt_rates['out'] . "' WHERE ma_id= '" . $acc['ma_id'] . "'");
|
||||
|
||||
echo(formatRates($rates['in']) . " (" . $pkt_rates['in'] . "pps) in " . formatRates($rates['out']) . " (" . $pkt_rates['out'] . "pps) out \n");
|
||||
# echo(formatRates($rates['in']) . " (" . $pkt_rates['in'] . "pps) in " . formatRates($rates['out']) . " (" . $pkt_rates['out'] . "pps) out \n");
|
||||
|
||||
}
|
||||
?>
|
||||
|
Reference in New Issue
Block a user