Discovery
Subscribe

From OpenNMS

Jump to: navigation, search

Discovery Configuration Details

The global discovery attributes are:

threads 
This is the number of threads that will be used for discovery. By default this is set to 1.
packets-per-second 
This is the number of ICMP packets that will be generated each second. The default is 1. Note that there is a relationship between the packets-per-second and the number of threads. If your network has an average latency of 500ms, then setting packets-per-second to 2 would double the speed at which NewSuspect messages were created. But if there is only one thread available, setting this number to 3 would have little effect - the single thread would be processing as many packets as it could as fast as it could.
initial-sleep-time 
This is the time, in milliseconds, before the discovery process will commence after OpenNMS is started (by default 5 minutes). This delay is put in place to allow the product to fully start before generating new events.
restart-sleep-time 
Once the discovery process has completed, this is the time, in milliseconds, before it will start again. By default, the process will repeat 24 hours after the last discovery run has completed.
timeout 
this is the amount of time, in milliseconds, that the discovery process will wait for a response from a given IP address before deciding that there is nothing there. This can be overridden later in the file.
retries 
this is the number of attempts that will be made to query a given IP address before deciding that there is nothing there. This can be overridden later in the file.

Once the defaults are in place (defaults meaning the global values that will be used if they are not overridden in the tags below), the only thing left to tell the discovery process is which IP addresses to try. This is controlled by four different tags:

specific 
specify a IP address to be discovered. Multiple specific tags can be used.
<specific>ip-address</specific>

Where ip-address is the address you want discovered. Note the lack of spaces between the tags.

include-range 
Specify a range of IP addresses to be discovered. Multiple include-range tags can be used.
<include-range>
  <begin>start-ip-address</begin>
  <end>end-ip-address</end>
</include-range>

Where start-ip-address is the beginning of a range to be scanned and end-ip-address is the end of that range.

exclude-range 
Specify a range of IP address to be excluded from discovery.
<exclude-range>
  <begin>start-ip-address</begin>
  <end>end-ip-address</end>
</exclude-range>

Where start-ip-address is the beginning of a range to be excluded and end-ip-address is the end of that range. Note that the exclude-range tag will only override addresses in an include-range. It will not override specific IP addresses or addresses included in a file. There is no "specific" version of the exclude tag - if you want to exclude a specific IP address use an exclude-range where the beginning and ending IP addresses are the same.

include-url 
Specify a file containing IP addresses to be included in discovery.
<include-url>file:filename</include-url>

Where filename is the full path to a text file listing IP addresses, one to a line. Comments can be imbedded in this file. Any line that begins with a "#" character will be ignored, as will the remainder of any line that includes a space followed by "#".

All tags are optional and unbounded (you can have as many as you wish).

Another Way to Discover Interfaces

Now that the discovery configuration file has been explained, there are two short-comings that need to be pointed out. First, any changes to this file, like most of the configuration files within OpenNMS, requires that OpenNMS be restarted. Second, what if you want to discover a service, such as a web server, on a device you cannot ping?

Remember that all the discover process does is generate a newSuspect event. Included in the /opt/OpenNMS/bin directory is a Perl script called send-event.pl. You can use this script to generate an internal NewSuspect event - bypassing the discovery process altogether. Combined with a script, you could generate any number of NewSuspect events (just make sure that the IP address really does have some services that can be monitored by OpenNMS. Otherwise, you will have an interface in the system with no services associated with it).

The format of the send-event.pl is as follows:

/opt/opennms/bin/send-event.pl --interface ip-address uei.opennms.org/internal/discovery/newSuspect


Replace ip-address with the address you want discovered.

For csv with FQDN as hosts location

cat fqdnlist.csv | awk -F "," '{print "host " $1}' | sh |awk '{print "./send-event.pl --interface " $4 " uei.opennms.org/internal/discovery/newSuspect"}'

For csv file with IP for host location

cat ipaddresss.csv |gawk -F "," '{print "host " $1 }' |sh |gawk '{print "./send-event.pl --interface " $1 " uei.opennms.org/internal/discovery/newSuspect"}'

note: use same format as exported assets.

Depending on what Perl modules you have installed, you may get an error running this script (such as a complaint about Getopt::Mixed). To automatically add the necessary modules, try:

perl -MCPAN -e 'install mod_name'

Replace mod_name with the name of the missing module.

Or, if you hate use CPAN (there is some problems, the CPAN can cose to lib's), you can just use rpm pakage


wget ftp://ftp.debian.nl/disk1/redhat-contrib/libc5/i386/Getopt-Mixed.pm-1.008-4.i386.rpm

rpm -Uv Getopt-Mixed.pm-1.008-4.i386.rpm 

(END)

Logs

You can watch the discovery process by examining the discovery.log file in the /opt/opennms/logs/daemon directory.

Copyright

Content is available under a Creative Commons Attribution-NonCommercial-ShareAlike2.5 License.