Export Service Detail to .csv

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
SavaSC
Posts: 238
Joined: Wed Feb 23, 2011 4:49 pm

Export Service Detail to .csv

Post by SavaSC »

Hello,

I need to get a dump of all of our Hosts and their related services for a VP. Pretty much what the Service Detail shows. How do I get a dump of this out to an Excel file?

Thanks!
gormank
Posts: 1114
Joined: Tue Dec 02, 2014 12:00 pm

Re: Export Service Detail to .csv

Post by gormank »

I asked a similar question not too long ago and was pointed toward the JSON API, but I wound up not using it. It would produce JSON obviously, but there may be converters.
I can dig up the SQL to output the data, but it may take some postprocessing to reliably get CSV. If you wan to know about the DB and table relations, look for the doc "NDOUtils Database Model."

# mysql -B -pnagiosxi nagios
mysql> select name1 Hostname, current_state State, name2 'Service Name', output Output from nagios_objects, nagios_servicestatus where object_id = service_object_id and is_active = 1 order by name1, name2;

That gives tab delimited text, and you'd want to search and replace commas w/ something else, then replace tabs w/ commas. Both are easy to do w/ sed.

To run more interactively, use:

# mysql -t -pnagiosxi nagios
Last edited by gormank on Mon Feb 15, 2016 1:29 pm, edited 3 times in total.
User avatar
WillemDH
Posts: 2320
Joined: Wed Mar 20, 2013 5:49 am
Location: Ghent
Contact:

Re: Export Service Detail to .csv

Post by WillemDH »

With Powershell you can very easily query the services with the JSON API, convert the JSON to a custom Powershell object and then pipe to Excel with this Powershell module: https://github.com/RamblingCookieMonster/PSExcel
Nagios XI 5.8.1
https://outsideit.net
SavaSC
Posts: 238
Joined: Wed Feb 23, 2011 4:49 pm

Re: Export Service Detail to .csv

Post by SavaSC »

Thank you for the information.
User avatar
hsmith
Agent Smith
Posts: 3539
Joined: Thu Jul 30, 2015 11:09 am
Location: 127.0.0.1
Contact:

Re: Export Service Detail to .csv

Post by hsmith »

Can you show me an example of what you would like the output to look like? I could put in a feature request, but would like to know exactly what you're looking for. Perhaps upload a mockup.
Former Nagios Employee.
me.
SavaSC
Posts: 238
Joined: Wed Feb 23, 2011 4:49 pm

Re: Export Service Detail to .csv

Post by SavaSC »

hsmith wrote:Can you show me an example of what you would like the output to look like? I could put in a feature request, but would like to know exactly what you're looking for. Perhaps upload a mockup.
Sure. I just went through and did it by hand (Took a couple of hours, but got the job done). Here is an abbreviated version of what I made.
You do not have the required permissions to view the files attached to this post.
User avatar
hsmith
Agent Smith
Posts: 3539
Joined: Thu Jul 30, 2015 11:09 am
Location: 127.0.0.1
Contact:

Re: Export Service Detail to .csv

Post by hsmith »

This seems like a reasonable request. I'll put in a FR for you.
Former Nagios Employee.
me.
User avatar
hsmith
Agent Smith
Posts: 3539
Joined: Thu Jul 30, 2015 11:09 am
Location: 127.0.0.1
Contact:

Re: Export Service Detail to .csv

Post by hsmith »

FR 7785 submitted.
Former Nagios Employee.
me.
SavaSC
Posts: 238
Joined: Wed Feb 23, 2011 4:49 pm

Re: Export Service Detail to .csv

Post by SavaSC »

hsmith wrote:FR 7785 submitted.
Thank you!
User avatar
hsmith
Agent Smith
Posts: 3539
Joined: Thu Jul 30, 2015 11:09 am
Location: 127.0.0.1
Contact:

Re: Export Service Detail to .csv

Post by hsmith »

I'll leave this topic open so you check on it at a later date.
Former Nagios Employee.
me.
Locked