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'
No responses yet