Page 1 of 1

Host List with IP Address

Posted: Tue Dec 14, 2021 7:40 am
by s.diwakar1
Hi All,

Hope you are doing well!!!

I want to export a list from Nagios Core with below details:

1. All Host Names with their IP Addresses and Alias.
2. List of services being monitored on All Hosts.

Re: Host List with IP Address

Posted: Wed Dec 15, 2021 2:16 pm
by gormank
This isn't pretty but it might be usable...
A list of address/host pairs is simple, but getting services and hosts gets a bit tricky if hostgroups are used.

grep address /usr/local/nagios/etc/hosts/* | tr / " " | awk '{print $NF " " $6}' | sed s/.cfg://g
egrep 'alias|address' /usr/local/nagios/etc/hosts/* | tr / " " | awk '{print $NF " " $6}' | sed s/.cfg://g
egrep 'hostgroup_name|host_name' /usr/local/nagios/etc/services/*

Re: Host List with IP Address

Posted: Fri Dec 17, 2021 7:17 am
by s.diwakar1
Hi Gormank,

It's working fine. Can we also export it in file like excel, csv etc?