bit of restructuring and tiding. all hail bunny.

git-svn-id: http://www.observium.org/svn/observer/trunk@977 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
Adam Amstrong
2010-02-28 22:04:15 +00:00
parent a15e74725b
commit 1e7860e930
18 changed files with 108 additions and 56 deletions
+3 -1
View File
@@ -101,8 +101,10 @@ $config['ignore_mount_network'] = 1; # Ignore network mounted storage
$config['ignore_junos_os_drives'] = array("/on: \/packages/", "/on: \/dev/", "/on: \/proc/", "/on: \/junos^/", "/on: \/junos\/dev/", "/on: \/jail\/dev/", "/^(dev|proc)fs/", "/^\/dev\/md0/"); # Ignore JunOS partitions who are always 100%
$config['ignore_bsd_os_drives'] = array("/^\/dev,/", "/^\/var\/dhcpd\/dev,/", "/UMA/"); # Ignore BSD partitions who are always 100%
# Ports
# Poller/Discovery
$config['enable_ports_etherlike'] = 0; # Enable EtherLike-MIB
$config['enable_ports_junoseatmvc'] = 0; # Enable JunOSe ATM VC Discovery/Poller
?>
-1
View File
@@ -63,7 +63,6 @@
}
echo("\n");
unset($mac);
?>
-1
View File
@@ -141,4 +141,3 @@ unset($peerlist);
echo("\n");
?>
@@ -1,6 +1,9 @@
<?php
echo("MAC Accounting : ");
if($device['os_group'] == "ios") {
echo("Cisco MAC Accounting : ");
$datas = shell_exec($config['snmpbulkwalk'] . " -m CISCO-IP-STAT-MIB -Oqn -".$device['snmpver']." -c ".$device['community']." ".$device['hostname']." cipMacSwitchedBytes");
#echo("$datas\n");
@@ -42,5 +45,9 @@
}
echo("\n");
}
// FIXME - NEEDS TO REMOVE STALE ENTRIES?? :O
?>
+2 -2
View File
@@ -1,11 +1,11 @@
<?php
if($config['enable_pseudowires']) {
if($config['enable_pseudowires'] && $device['os_group'] == "ios") {
unset( $cpw_count );
unset($cpw_exists);
echo("PW : ");
echo("Cisco Pseudowires : ");
$oids = shell_exec($config['snmpwalk'] . " -m CISCO-IETF-PW-MIB -CI -Ln -Osqn -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'] . " cpwVcID");
+4
View File
@@ -1,5 +1,7 @@
<?php
if($device['os_group'] == "ios") {
echo("Cisco VLANs : ");
$vtpversion_cmd = $config['snmpget'] . " -m CISCO-VTP-MIB -Oqv -" . $device['snmpver'] . " -c " . $device['community'] . " ";
@@ -56,3 +58,5 @@
unset($this_vlans);
echo("\n");
}
+6 -1
View File
@@ -1,8 +1,11 @@
<?php
#if($device['os_group'] == "ios")
#{
unset( $vrf_count );
echo("VRF : ");
echo("VRFs : ");
$oid_cmd = $config['snmpwalk'] . " -m MPLS-VPN-MIB -CI -Ln -Osqn -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'] . " mplsVpnVrfRouteDistinguisher";
$oids = shell_exec($oid_cmd);
@@ -78,4 +81,6 @@
echo("\n");
#}
?>
+16 -1
View File
@@ -1,9 +1,24 @@
<?php
function discover_juniAtmVp(&$exists, $interface_id, $vp_id, $vp_descr) {
global $config; global $debug;
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `juniAtmVp` WHERE `interface_id` = '".$interface_id."' AND `vp_id` = '".$vp_id."'"),0) == "0")
{
echo(".");
} else {
$sql = "INSERT INTO `juniAtmVP` (`interface_id`,`vp_id`,`vp_descr`) VALUES ('".$interface_id."','".$vp_id."','".$vp_descr."')";
mysql_query($sql); echo("+"); if($debug) { echo($sql . " - " . mysql_affected_rows() . "inserted "); }
}
$exists[$interface_id][$vp_id] = 1;
}
function discover_link($local_interface_id, $protocol, $remote_interface_id, $remote_hostname, $remote_port, $remote_platform, $remote_version) {
global $config; global $debug; global $link_exists;
if (mysql_result(@mysql_query("SELECT COUNT(*) FROM `links` WHERE `remote_hostname` = '$remote_hostname' AND `local_interface_id` = '$local_interface_id'
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `links` WHERE `remote_hostname` = '$remote_hostname' AND `local_interface_id` = '$local_interface_id'
AND `protocol` = '$protocol' AND `remote_port` = '$remote_port'"),0) == "0")
{
$sql = "INSERT INTO `links` (`local_interface_id`,`protocol`,`remote_interface_id`,`remote_hostname`,`remote_port`,`remote_platform`,`remote_version`)
+50
View File
@@ -0,0 +1,50 @@
<?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");
?>
+1
View File
@@ -17,6 +17,7 @@ include_once($config['install_dir'] . "/includes/billing.php");
include_once($config['install_dir'] . "/includes/cisco-entities.php");
include_once($config['install_dir'] . "/includes/syslog.php");
include_once($config['install_dir'] . "/includes/rewrites.php");
include_once($config['install_dir'] . "/includes/snmp.inc.php");
## CollectD
+2 -2
View File
@@ -56,8 +56,8 @@ $os_text['solaris'] = "Sun Solaris";
$os_text['opensolaris'] = "OpenSolaris";
$os_text['powerconnect'] = "Dell PowerConnect";
$os_text['windows'] = "Microsoft Windows";
$os_text['junos'] = "Juniper JUNOS";
$os_text['junose'] = "Juniper JUNOSe";
$os_text['junos'] = "Juniper JunOS";
$os_text['junose'] = "Juniper JunOSe";
$os_text['procurve'] = "HP ProCurve";
$os_text['speedtouch'] = "Thomson Speedtouch";
$os_text['dell-laser'] = "Dell Laser Printer";