Data extraction issues from Maria DB

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
keerthi.seetharaman
Posts: 92
Joined: Thu Jan 11, 2018 7:55 am

Data extraction issues from Maria DB

Post by keerthi.seetharaman »

Hello Team,

We are trying to extract the data of hosts and services checks configured on Nagios XI via the below command from Maria DB. We are only finding the output as alias name rather than host name.

MariaDB [nagios]> SELECT h.display_name, s.display_name from nagios_hosts h, nagios_services s where h.host_object_id = s.host_object_id INTO OUTFILE '/home/skeerthi/host.csv' FIELDS TERMINATED BY '|';

Can you please suggest what needs to be done.

Regards,
Keerthi Prashanth S
Thanks & Regards,
Keerthi Prashanth Seetharaman
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Data extraction issues from Maria DB

Post by scottwilkerson »

The query is a little more complicated than that.

For services it looks like this

Code: Select all

SELECT o.name1 hostname, o.name2 servicename FROM nagios_objects o LEFT JOIN nagios_services s ON o.object_id = s.service_object_id WHERE is_active=1 and objecttype_id=2
for hosts

Code: Select all

SELECT o.name1 hostname FROM nagios_objects o LEFT JOIN nagios_hosts s ON o.object_id = s.host_object_id WHERE is_active=1 and objecttype_id=1
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
keerthi.seetharaman
Posts: 92
Joined: Thu Jan 11, 2018 7:55 am

Re: Data extraction issues from Maria DB

Post by keerthi.seetharaman »

Thanks for your quick reply.

But is it possible to merge both the host and service commands into a single command from where i can get the output in a single file.

For example:-

Server abc :- linux -prod - CPU
linux -prod - memory

etc.
Thanks & Regards,
Keerthi Prashanth Seetharaman
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Data extraction issues from Maria DB

Post by scottwilkerson »

you could do something like this

Code: Select all

SELECT o.name1 hostname, o.name2 servicename 
FROM nagios_objects o 
LEFT JOIN nagios_services s ON o.object_id = s.service_object_id 
WHERE is_active=1 and objecttype_id IN (1,2)
ORDER BY hostname, servicename;
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
keerthi.seetharaman
Posts: 92
Joined: Thu Jan 11, 2018 7:55 am

Re: Data extraction issues from Maria DB

Post by keerthi.seetharaman »

Thanks its working fine now..

Please close this ticket
Thanks & Regards,
Keerthi Prashanth Seetharaman
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Data extraction issues from Maria DB

Post by scottwilkerson »

keerthi.seetharaman wrote:Thanks its working fine now..

Please close this ticket
great locking thread
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
Locked