Export hosts and ip's

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
User avatar
WillemDH
Posts: 2320
Joined: Wed Mar 20, 2013 5:49 am
Location: Ghent
Contact:

Export hosts and ip's

Post by WillemDH »

Hello,

Is there an easy way to export all hosts adn their ip address to Excel or csv so it can be used (after adding a coma) for the cloning wizard?
Nagios XI 5.8.1
https://outsideit.net
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Export hosts and ip's

Post by scottwilkerson »

I'm a little confused, the cloning wizard is for adding NEW hosts, where do you want to export the addresses and IP's from?

I'm assuming you don't want to export them from Nagios XI as they are already in the system. Please correct me if I am wrong.
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
User avatar
WillemDH
Posts: 2320
Joined: Wed Mar 20, 2013 5:49 am
Location: Ghent
Contact:

Re: Export hosts and ip's

Post by WillemDH »

Well, as we are in a rapidly growing environment, there is every week some new service we want to add to our existing servers. I noticed that when you use the cloning wizard this seems to work when you only select the new service you want to add and then select your existing host, Nagios adds the new service to the existing hosts. Is there a faster way to add a new service to all or a subpart of all hosts?
As using my method requires me to have an up to date list of all hosts and their ip, this would be very useful to export somehow..
Nagios XI 5.8.1
https://outsideit.net
yancy
Posts: 523
Joined: Thu Oct 06, 2011 10:12 am

Re: Export hosts and ip's

Post by yancy »

WillemDH,

Have you looked at an architecture like NRDS? NRDS allows you to define services and checks in a centrally stored config, which then gets scoped up by all hosts. This makes it easy to add a single service to a config and then all hosts would use that new service definition.

http://assets.nagios.com/downloads/nagi ... h_NRDS.pdf


-Yancy
User avatar
WillemDH
Posts: 2320
Joined: Wed Mar 20, 2013 5:49 am
Location: Ghent
Contact:

Re: Export hosts and ip's

Post by WillemDH »

No, I didn't look at NRDS yet. I'll look into it tomorrow. Thanks for letting me know. I've been using the clone wizard untill now add services to hosts. I'll let you know of I get the NRDS working.

Just a questions, is it ok for me to use the bulk cloning wizard or is there any reason I should not use to add services to existing hosts.
Nagios XI 5.8.1
https://outsideit.net
User avatar
WillemDH
Posts: 2320
Joined: Wed Mar 20, 2013 5:49 am
Location: Ghent
Contact:

Re: Export hosts and ip's

Post by WillemDH »

Ok, I just had a look at http://library.nagios.com/library/produ ... s-tutorial
and I'm not sure how I should start using this.
Our environment is 99 % Windows and we got several very specific checks running both local and remote with nrpe and nsca. I really like the latest version of the NSCP agent.
Are you sure I should use NRDS? We have so many servers all with different needs etc. it seems like a lot of work.. The bulk host cloning wizard is next next finish and all servers I paste into the textbox get their new service..

As I asked in my previous psot, is there any reason not to do it like I've explained above?
Nagios XI 5.8.1
https://outsideit.net
yancy
Posts: 523
Joined: Thu Oct 06, 2011 10:12 am

Re: Export hosts and ip's

Post by yancy »

You should also be able to add using the bulk host import

1) add new service to an existing host

2) add all IP addresses of existing hosts to the bulk host import wizard and use template host from step 1

This should add the templated services to all the hosts without overwriting existing services I believe. I would however test with using the bulk host wizard with a single host first.

-Yancy
User avatar
WillemDH
Posts: 2320
Joined: Wed Mar 20, 2013 5:49 am
Location: Ghent
Contact:

Re: Export hosts and ip's

Post by WillemDH »

Yancy,

I have been testing this over the last week and can confirm the described method is working fine to add services to existing hosts.

Coming back to my original question, can you understand when using my method it would be very handy to be able to export for example all host and ip's of a hostgroup? is there already a feature to export hosts and their ip to a csv? Should I make a feature request for this? :)

Grtz
Nagios XI 5.8.1
https://outsideit.net
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Export hosts and ip's

Post by scottwilkerson »

You can get this info in XML format from the Admin -> Manage Components -> Backend API URL
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
User avatar
WillemDH
Posts: 2320
Joined: Wed Mar 20, 2013 5:49 am
Location: Ghent
Contact:

Re: Export hosts and ip's

Post by WillemDH »

Scot! This was exactly what I was looking for! Really! Imported the xml into Excel and this is some wonderful information to play with.. :)
It also answers some other question I had about exporting hostgroup members etc!

It also opens the door for some new questions ( :oops: ) => Is it somehow possible to edit this xml file directly? Or edit it and then import it to Nagios?

I'm asking this as it would be superb if we could compare this with our server database and add hosts to hostgroup based on our internal server database. Making something like this happen would result in an always up to date hostgroup configuration.. As now when a server moves to another datacenter, we have to update the internal server database and then change the hostgroup in Nagios too..
Nagios XI 5.8.1
https://outsideit.net
Locked