Export Contacts and Contact Groups

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
jkinning
Posts: 747
Joined: Wed Oct 09, 2013 2:54 pm

Export Contacts and Contact Groups

Post by jkinning »

Is there an easy way to export Contacts and Contact Groups to a csv file to audit? It would be nice to also include the systems that these contacts and contact groups belong to so you can see everything from a nice spreadsheet. Is any of this easy to do?
kyang

Re: Export Contacts and Contact Groups

Post by kyang »

We don't have a feature to do something like this in XI.

It's not as pretty, but I think grepping for that information in the objects.cache might be something?

Code: Select all

 grep -A 1 "define contact" /usr/local/nagios/var/objects.cache

Code: Select all

grep -A 1 "define contact" /usr/local/nagios/var/objects.cache > /tmp/contact.csv 
Into a csv.

Does this help?
jkinning
Posts: 747
Joined: Wed Oct 09, 2013 2:54 pm

Re: Export Contacts and Contact Groups

Post by jkinning »

This looks like it might work for the contacts. Anyway to get the email or SMS number for each contact? I know I am asking alot. :D
What about for Contact Groups to see what contacts are listed in each group?

Then along hose lines get the contacts or contact groups that are assigned for each host/services. If I can't get this data in a csv file just being able to view this information might be enough.
kyang

Re: Export Contacts and Contact Groups

Post by kyang »

To show the contacts in a contact group, try changing it to 3. This should show the members in a contact_group and it's alias.
You probably see the pattern now. The number adds more lines.

Same thing is to send all this to a csv for example --> > /tmp/contact.csv

For email or SMS, you would have to increase the number, but this will show all of the contact info.

Code: Select all

grep -A 9 "define contact" /usr/local/nagios/var/objects.cache
This shows the output below.

Code: Select all

define contact {
        contact_name    xi_default_contact
        alias   Default Contact
        service_notification_period     xi_timeperiod_none
        host_notification_period        xi_timeperiod_none
        service_notification_options    n
        host_notification_options       n
        service_notification_commands   xi_service_notification_handler
        host_notification_commands      xi_host_notification_handler
        email   root@localhost
Locked