Ground Work Open Source
image_pdfimage_print

Today I found myself in need of exporting hostnames and IPs from a Nagios monitoring server, specifically GroundWork Monitor (GWOS).

Bash is our friend, and with a series of “sed” commands, we can bring home a well-formatted output:

grep 'host_name\|address' hosts.cfg |sed -e 's/\t//g' -e 's/host_name/host_namex: /g' -e 's/ddress/ddress: /g'|sed -e :a -e '$!N;s/\n[^host]/ a/;ta' -e 'P;D'

 

Categories:

No responses yet

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Recent posts