Scan All the Things using OpenNMS and Perl, Part 0

I’m slightly irked that OpenNMS’s discovery daemon relies on ping replies to determine what node to stop and scan deeper. One way to explicitly scan an interface is to use the tool provided by OpenNMS.

So, I scripted the automated scan of each IP address on my subnet:

#! /usr/bin/perl -w
use strict;
foreach ( (1 .. 254) ) {
        my @ipaddy = ('/opt/opennms/bin/','', '--interface', "192.168.168.$_" );
        system (@ipaddy);

However, even non responsive IP addresses end up in my items list in OpenNMS now. I’m still an OpenNMS noob, so I’m looking for something that I know I must be missing.

My ultimate goal is to scan the network several times a day looking for new devices that might not be responsive to ICMP echo requests. If I have to automate the deletion of empty items, I’ll do it. Don’t make me go all DBD::Pg up in this house!!

Actually, I think the answer likes in a concept in OpenNMS called “provisioning.” Maybe.


  1. David Mackintosh (@xdroop)

    September 26, 2012 at 9:06 am

    A couple of tricks I’ve used in similar (not OpenNMS) contexts:

    – on the local link, arping will almost always return a mac address for anything on the network, even if it won’t respond to ping packets; and
    – if you have a snmp-queryable router, you can probably ask the router brain what IPs (and mac addresses) it knows about in its forwarding and arp tables, respectively.

    Generally I use arpwatch to watch the local link and send me messages when things come or change. It is primitive, but it generally works.


    • Wesley David

      September 26, 2012 at 9:10 am

      Last night as I was considering this issue, the most elegant thing I could hope for was querying SNMP switches for all known active devices, where “active” is some amount of time since the last communication was seen from it. I’m not sure of OpenNMS can do that, but it seems hopeful. If not, I’m sure it can be hacked together.

      Off to research arpwatch…


  2. Jeremy L. Gaddis

    October 3, 2012 at 4:39 am

    BASH one-liner:

    $ for OCTET in `seq 1 254` ; do /opt/opennms/bin/ –interface 192.168.168.$OCTET ; done


Leave a Reply

Follow TheNubbyAdmin!

follow us in feedly

Raw RSS Feed:

Contact Me!

Want to hire me as a consultant? Have a job you think I might be interested in? Drop me a line:

Contact Me!

Subscribe via Email

Your email address is handled by Google FeedBurner and never spammed!

The Nubby Archives

Circle Me on Google+!

Photos from Flickr

Me on StackExchange

The IT Crowd Strava Group

%d bloggers like this: