Pinging with Cisco
Using ICMP messages (also know as "pinging") to determine if a host is up is a common and simple network monitoring technique. Pinging a small number of hosts is not that challenging. But if you have many hosts that are distributed all over the place, things could get ugly.
If the polling interval used is short enough, you could run into the problem where the nth poll hasn't finished before the nth+1 poll begins. Another problem could be that the machine you want to ping from doesn't have proper routing to the host or hosts you want to monitor.
Cisco routers and some switches support the Cisco ping MIB (download from ftp://ftp.cisco.com/pub/mibs/v2/CISCO-PING-MIB.my). Basically, this feature allows you to have routers perform ICMP operations on your behalf. In effect, you can have a distributed ping system.
In this script,[*] we'll use SNMP to configure a Cisco router to perform pings on our behalf:
#!/usr/bin/perl use SNMP; # # This script was adapted from the one that comes with Net-SNMP # my %ipsToPing = ( "192.168.0.48" => 333, ); my $router = "192.168.0.130"; my $community = "public"; my $version = 1; my $sess = new SNMP::Session (DestHost => $router, Community => $community, Retries => 1, Version => $version); my $ciscoPingEntry = ".1.3.6.1.4.1.9.9.16.1.1.1"; my $ciscoPingEntryStatus = "$ciscoPingEntry.16"; my $ciscoPingEntryOwner = "$ciscoPingEntry.15"; my $ciscoPingProtocol = "$ciscoPingEntry.2"; my $ciscoPingPacketCount = "$ciscoPingEntry.4"; my $ciscoPingPacketSize ...
Get Essential SNMP, 2nd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.