2010-03-01 01:51:19 +00:00
< ? php
2011-03-15 11:24:35 +00:00
# We're discovering this MIB
2010-03-01 01:51:19 +00:00
# snmpwalk -v2c -c <community> <hostname> -M mibs/junose/ -m Juniper-UNI-ATM-MIB juniAtmVpStatsEntry
## JunOSe ATM vps
2011-03-15 11:24:35 +00:00
if ( $device [ 'os' ] == " junose " && $config [ 'enable_ports_junoseatmvp' ])
2010-03-01 01:51:19 +00:00
{
echo ( " JunOSe ATM vps : " );
2010-07-31 19:12:40 +00:00
$vp_array = snmpwalk_cache_multi_oid ( $device , " juniAtmVpStatsInCells " , $vp_array , " Juniper-UNI-ATM-MIB " , $config [ 'install_dir' ] . " /mibs/junose " );
2010-03-01 01:51:19 +00:00
$valid_vp = array ();
2011-03-15 11:24:35 +00:00
if ( $debug ) { print_r ( $vp_array ); }
2010-03-01 01:51:19 +00:00
2011-03-15 11:24:35 +00:00
if ( is_array ( $vp_array ))
{
foreach ( $vp_array as $index => $entry )
{
list ( $ifIndex , $vp_id ) = explode ( '.' , $index );
2010-03-01 02:42:30 +00:00
2011-03-15 11:24:35 +00:00
$interface_id = mysql_result ( mysql_query ( " SELECT `interface_id` FROM `ports` WHERE `device_id` = ' " . $device [ 'device_id' ] . " ' AND `ifIndex` = ' " . $ifIndex . " ' " ), 0 );
2010-03-01 01:51:19 +00:00
2011-03-15 11:24:35 +00:00
if ( is_numeric ( $interface_id ) && is_numeric ( $vp_id ))
{
discover_juniAtmvp ( $valid_vp , $interface_id , $vp_id , NULL );
}
2010-03-01 01:51:19 +00:00
} ## End Foreach
} ## End if array
unset ( $vp_array );
2011-03-15 11:24:35 +00:00
## Remove ATM vps which weren't redetected here
2010-03-01 01:51:19 +00:00
$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 );
2011-03-15 11:24:35 +00:00
if ( $debug ) { print_r ( $valid_vp ); }
2010-03-01 01:51:19 +00:00
2011-03-15 11:24:35 +00:00
while ( $test = mysql_fetch_array ( $query ))
{
2010-03-01 01:51:19 +00:00
$interface_id = $test [ 'interface_id' ];
$vp_id = $test [ 'vp_id' ];
2011-03-15 11:24:35 +00:00
if ( $debug ) { echo ( $interface_id . " -> " . $vp_id . " \n " ); }
if ( ! $valid_vp [ $interface_id ][ $vp_id ])
{
2010-03-01 01:51:19 +00:00
echo ( " - " );
mysql_query ( " DELETE FROM `juniAtmvp` WHERE `juniAtmVp` = ' " . $test [ 'juniAtmvp' ] . " ' " );
}
2011-03-16 17:53:20 +00:00
2010-03-01 01:51:19 +00:00
unset ( $interface_id ); unset ( $vp_id );
}
unset ( $valid_vp );
echo ( " \n " );
}
2011-03-15 11:24:35 +00:00
?>