media wiki and servers
One thing I hate is having to do something over and over again and usually my laziness gets me into doing more work up front. This afternoons project was getting my server scan to post to our wiki. Cron’d to run once a week is a nmap scan of my servers (replace your ip set for 1.2.3.4 of course)
/usr/bin/nmap -sP -oG /usr/local/perlib/sysadmin/servers.txt 1.2.3.4/24
This puts out a nicely formatted list from nmap to servers.txt. From there I wrote a piece to reformat that list into some nice MediaWiki tables and print the output. One set is IPs to Hostnames and another is Hostnames to IPs and the final table is something I slapped together so if I want I can copy and paste from the wiki page to a hosts file to resolve most of the internal IPs. Todays task was to simply add on something to push it up to our MediaWiki automatically and I first looked at the module MediaWiki but decided CMS::MediaWiki was easier and put it in there. The code can be seen here: