#!/usr/bin/perl -w #=============================================================================== # # FILE: ping_mib.pl # # USAGE: ./ping_mib.pl # # SYNOPSIS: If not present sets up DISMAN-PING MIB (RFC 2925) probes # from source to all targets in hash. # DESCRIPTION: # AUTHOR: Simon Mullis (simon.mullis@equinoxsolutions.com) # OPTIONS: # REQUIREMENTS: Net::SNMP and well, Perl! # NOTES: --- # VERSION: 0.8 # CREATED: Aug 20 2004 12:25:43 GMTDT # REVISION: $Revision$ #=============================================================================== # # Set up pragmas use strict; # Set up external modules use Net::SNMP; # Set up all of the variables my ( $short_origin, $short_target, $origin_ip, $target_ip, $community ) = (); my %global_targets = (); $short_origin = $ARGV[0]; # Set up the community - make sure you've enabled the relevant RW OID trees on the Juniper in question: # $community = 'CHANGE_ME'; # A list of source / target definitions %global_targets = ( juni1 => 'ip address 1', juni2 => 'ip address 2', juni3 => 'ip address 3', juni4 => 'ip address 4', ); sub usage { print "Usage: "; print "./ping_mib.pl \n"; print "Please enter two of the following as origin and target:\n"; foreach my $short_target (sort(keys(%global_targets))) { print "$short_target "; } } # Check the command line arguments. if ($#ARGV != 2) { &usage; exit 0; } my $global_targets; if ( exists( $global_targets{$short_origin} ) ) { $origin_ip = $global_targets{$short_origin}; } else { print "Please check $short_origin"; } if ( exists( $global_targets{$short_target} ) ) { $target_ip = $global_targets{$short_target}; } else { print "Please check $short_target"; }