mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
junose-atm-vp stuff
git-svn-id: http://www.observium.org/svn/observer/trunk@979 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
@@ -93,7 +93,7 @@ $config['enable_billing'] = 0; # Enable Billing
|
||||
$config['enable_inventory'] = 1; # Enable Inventory
|
||||
$config['enable_etherlike'] = 1; # Enable Etherlike
|
||||
$config['enable_pseudowires'] = 1; # Enable Pseudowires
|
||||
$config['enable_ports_junoseatmvc'] = 0; # Enable JunOSe ATM VC Discovery/Poller
|
||||
$config['enable_ports_junoseatmvp'] = 0; # Enable JunOSe ATM VC Discovery/Poller
|
||||
$config['enable_ports_etherlike'] = 0; # Enable Polling EtherLike-MIB (doubles interface processing time)
|
||||
|
||||
#$config['rancid_configs'] = '/var/lib/rancid/network/configs/';
|
||||
|
||||
@@ -117,3 +117,4 @@ ALTER TABLE `storage` ADD `storage_free` INT NOT NULL AFTER `storage_used`;
|
||||
ALTER TABLE `storage` CHANGE `storage_size` `storage_size` BIGINT NOT NULL ,CHANGE `storage_used` `storage_used` BIGINT NOT NULL ,CHANGE `storage_free` `storage_free` BIGINT NOT NULL;
|
||||
ALTER TABLE `mempools` CHANGE `mempool_used` `mempool_used` BIGINT( 20 ) NOT NULL ,
|
||||
CHANGE `mempool_free` `mempool_free` BIGINT( 20 ) NOT NULL ,CHANGE `mempool_total` `mempool_total` BIGINT( 20 ) NOT NULL ,CHANGE `mempool_largestfree` `mempool_largestfree` BIGINT( 20 ) NULL DEFAULT NULL ,CHANGE `mempool_lowestfree` `mempool_lowestfree` BIGINT( 20 ) NULL DEFAULT NULL;
|
||||
CREATE TABLE IF NOT EXISTS `juniAtmVp` ( `juniAtmVp_id` int(11) NOT NULL, `interface_id` int(11) NOT NULL, `vp_id` int(11) NOT NULL, `vp_descr` varchar(32) NOT NULL) ENGINE=MyISAM DEFAULT CHARSET=latin1;
|
||||
|
||||
@@ -100,7 +100,7 @@ while ($device = mysql_fetch_array($device_query))
|
||||
include("includes/discovery/hr-device.inc.php");
|
||||
include("includes/discovery/discovery-protocols.inc.php");
|
||||
include("includes/discovery/arp-table.inc.php");
|
||||
include("includes/discovery/junose-atm-vc.inc.php");
|
||||
include("includes/discovery/junose-atm-vp.inc.php");
|
||||
include("includes/discovery/bgp-peers.inc.php");
|
||||
include("includes/discovery/q-bridge-mib.inc.php");
|
||||
|
||||
|
||||
@@ -104,7 +104,7 @@ $config['ignore_bsd_os_drives'] = array("/^\/dev,/", "/^\/var\/dhcpd\/dev,/",
|
||||
# Poller/Discovery
|
||||
|
||||
$config['enable_ports_etherlike'] = 0; # Enable EtherLike-MIB
|
||||
$config['enable_ports_junoseatmvc'] = 0; # Enable JunOSe ATM VC Discovery/Poller
|
||||
$config['enable_ports_junoseatmvp'] = 0; # Enable JunOSe ATM VC Discovery/Poller
|
||||
|
||||
# LDAP Authentication
|
||||
|
||||
|
||||
@@ -1,50 +0,0 @@
|
||||
<?php
|
||||
|
||||
|
||||
### We're discovering this MIB
|
||||
# snmpwalk -v2c -c <community> <hostname> -M mibs/junose/ -m Juniper-UNI-ATM-MIB juniAtmVpStatsEntry
|
||||
|
||||
## JunOSe ATM VCs
|
||||
if($device['os'] == "junose" && $config['enable_ports_junoseatmvc'])
|
||||
{
|
||||
echo("JunOSe ATM VCs : ");
|
||||
$vc_array = snmpwalk_cache_multi_oid($device, "juniAtmVpStatsInCells", $vc_array, "Juniper-UNI-ATM-MIB" , "+".$config['install_dir']."/mibs/junose");
|
||||
$valid_vc = array();
|
||||
if($debug) { print_r($vc_array); }
|
||||
|
||||
if(is_array($vc_array[$device['device_id']])) {
|
||||
foreach($vc_array[$device['device_id']] as $index => $entry) {
|
||||
|
||||
list($interface_id,$vp_id)= explode('.', $index);
|
||||
|
||||
if(is_numeric($interface_id) && is_numeric($vp_id)) {
|
||||
discover_juniAtmVp($valid_vc, $interface_id, $vp_id, NULL);
|
||||
}
|
||||
} ## End Foreach
|
||||
} ## End if array
|
||||
} ## End JUNOS vc
|
||||
|
||||
unset ($vc_array);
|
||||
|
||||
### Remove ATM VCs which weren't redetected here
|
||||
|
||||
$sql = "SELECT * FROM `ports` AS P, `juniAtmVp` AS J WHERE P.`device_id` = '".$device['device_id']."' AND J.interface_id = P.interface_id";
|
||||
$query = mysql_query($sql);
|
||||
|
||||
if($debug) { print_r ($valid_vc); }
|
||||
|
||||
while ($test = mysql_fetch_array($query)) {
|
||||
$interface_id = $test['interface_id'];
|
||||
$vc_id = $test['vc_id'];
|
||||
if($debug) { echo($interface_id . " -> " . $vc_id . "\n"); }
|
||||
if(!$valid_vc[$interface_id][$vc_id]) {
|
||||
echo("-");
|
||||
mysql_query("DELETE FROM `juniAtmVp` WHERE `juniAtmVp` = '" . $test['juniAtmVp'] . "'");
|
||||
}
|
||||
unset($interface_id); unset($vc_id);
|
||||
}
|
||||
|
||||
unset($valid_vc);
|
||||
echo("\n");
|
||||
|
||||
?>
|
||||
51
includes/discovery/junose-atm-vp.inc.php
Executable file
51
includes/discovery/junose-atm-vp.inc.php
Executable file
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
|
||||
### We're discovering this MIB
|
||||
# snmpwalk -v2c -c <community> <hostname> -M mibs/junose/ -m Juniper-UNI-ATM-MIB juniAtmVpStatsEntry
|
||||
|
||||
## JunOSe ATM vps
|
||||
if($device['os'] == "junose" && $config['enable_ports_junoseatmvp'])
|
||||
{
|
||||
echo("JunOSe ATM vps : ");
|
||||
$vp_array = snmpwalk_cache_multi_oid($device, "juniAtmVpStatsInCells", $vp_array, "Juniper-UNI-ATM-MIB" , "+".$config['install_dir']."/mibs/junose");
|
||||
$valid_vp = array();
|
||||
if($debug) { print_r($vp_array); }
|
||||
|
||||
if(is_array($vp_array[$device['device_id']])) {
|
||||
foreach($vp_array[$device['device_id']] as $index => $entry) {
|
||||
|
||||
list($interface_id,$vp_id)= explode('.', $index);
|
||||
|
||||
if(is_numeric($interface_id) && is_numeric($vp_id)) {
|
||||
discover_juniAtmvp($valid_vp, $interface_id, $vp_id, NULL);
|
||||
}
|
||||
} ## End Foreach
|
||||
} ## End if array
|
||||
|
||||
unset ($vp_array);
|
||||
|
||||
### Remove ATM vps which weren't redetected here
|
||||
|
||||
$sql = "SELECT * FROM `ports` AS P, `juniAtmVp` AS J WHERE P.`device_id` = '".$device['device_id']."' AND J.interface_id = P.interface_id";
|
||||
$query = mysql_query($sql);
|
||||
|
||||
if($debug) { print_r ($valid_vp); }
|
||||
|
||||
while ($test = mysql_fetch_array($query)) {
|
||||
$interface_id = $test['interface_id'];
|
||||
$vp_id = $test['vp_id'];
|
||||
if($debug) { echo($interface_id . " -> " . $vp_id . "\n"); }
|
||||
if(!$valid_vp[$interface_id][$vp_id]) {
|
||||
echo("-");
|
||||
mysql_query("DELETE FROM `juniAtmvp` WHERE `juniAtmVp` = '" . $test['juniAtmvp'] . "'");
|
||||
}
|
||||
unset($interface_id); unset($vp_id);
|
||||
}
|
||||
|
||||
unset($valid_vp);
|
||||
echo("\n");
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user