Host List with IP Address

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
s.diwakar1
Posts: 44
Joined: Thu Feb 27, 2020 9:45 am

Host List with IP Address

Post 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.
Thanks & Regards,
Diwakar Sharma
gormank
Posts: 1114
Joined: Tue Dec 02, 2014 12:00 pm

Re: Host List with IP Address

Post 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/*
s.diwakar1
Posts: 44
Joined: Thu Feb 27, 2020 9:45 am

Re: Host List with IP Address

Post by s.diwakar1 »

Hi Gormank,

It's working fine. Can we also export it in file like excel, csv etc?
Thanks & Regards,
Diwakar Sharma
Locked