One Unified Global Perspective
Communications with a Global Perspective
Home
Intro
Contact Us
Voice over IP
PBX Solutions
Services
Support
Glossary
Open Source
Blog
Forum

WebMail





2007 May 05 - Sat

Post Processing NMAP2Nagios Output

nmap2nagios is a module available from Nagios ExchangeK (I seem to recall). From an nmap based network scan, it generates information useful for import into Nagios. I needed to muck with the output somewhat in order to remove redundant references and other stuff. I'm sure there is a better way to do this, but this what I ended up with. If nothing else, it was a good introduction to the command line edit utility 'sed'.

On the network I was processing, device names had 'ilo' in them. I needed to remove them from the listing. I edited nmap2nagios.pl and did the following:

#!/usr/bin/perl -w

#line 126
my $n = $host_ref->{'host_name'};
print '** name ' . $n;
print ' done' . "\n";
next if ($n =~ /^ilo/);

I took a bunch of stuff out of nmap2nagios.conf.

I created a file called 'scanlo.sed' with the following content to remove references to printer and altiris stuff:

/portid="443/ {s/name="http"/name="https"/}
/portid="280/ {s/name="http"/name="hpweb1"/}
/portid="631/ {s/name="http"/name="hpweb2"/}
/portid="902/ {s/name="ftp"/name="altirisftp1"/}
/portid="912/ {s/name="ftp"/name="altirisftp2"/}

I then ran the following sequence of commands. nmap does the network scan with the given segment. Some inline editing is performed with sed. nmap2nagios creates another file, which is then copied to the nagios etc directory.

nmap -A -sV -p1-1024 -O -oA scanlo -v 10.1.1.0/24 sed -f scanlo.sed scanlo.xml > scanlo1.xml /usr/src/nmap2nagios-0.1.2/nmap2nagios.pl -i -v -r scanlo1.xml -o sh1.cfg sed 's/^>//' sh1.cfg > sh2.cfg cp sh2.cfg /usr/local/nagios/etc/

For checking ssh services, the following needs to be inserted into checkcommands.cfg:

# 'check_ssh' command definition
define command{
        command_name    check_ssh
        command_line    $USER1$/check_ssh  $HOSTADDRESS$
        }

[/OpenSource/Debian/Monitoring] permanent link



Blog Content ©2008
Ray Burkholder
All Rights Reserved
ray@oneunified.net
(441) 505 7293
Available for Contract Work
Resume

RSS: Click to see the XML version of this web page.

View Ray 
Burkholder's profile on LinkedIn
technorati
Add to Technorati Favorites



May
Su Mo Tu We Th Fr Sa
    5
   


Main Links:
Monitoring Server
SSH Tools
QuantDeveloper Code

Special Links:
Frink

Blog Links:
Sergey Solyanik
Marc Andreessen
HotGigs
Micro Persuasion
... Reasonable ...
Chris Donnan
BeyondVC
lifehacker
Trader Mike
Ticker Sense
HeadRush
TraderFeed
Stock Bandit
The Daily WTF
Guy Kawaski
J. Brant Arseneau
Steve Pavlina
Matt Cutts
Kevin Scaldeferri
Joel On Software
Quant Recruiter
Blosxom User Group
Wesner Moise
Julian Dunn
Steve Yegge

2007
Months
May




Mason HQ

Disclaimer: This site may include market analysis. All ideas, opinions, and/or forecasts, expressed or implied herein, are for informational purposes only and should not be construed as a recommendation to invest, trade, and/or speculate in the markets. Any investments, trades, and/or speculations made in light of the ideas, opinions, and/or forecasts, expressed or implied herein, are committed at your own risk, financial or otherwise.