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
Data extraction issues from Maria DB
-
keerthi.seetharaman
- Posts: 92
- Joined: Thu Jan 11, 2018 7:55 am
Data extraction issues from Maria DB
Thanks & Regards,
Keerthi Prashanth Seetharaman
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
The query is a little more complicated than that.
For services it looks like this
for hosts
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=2Code: 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-
keerthi.seetharaman
- Posts: 92
- Joined: Thu Jan 11, 2018 7:55 am
Re: Data extraction issues from Maria DB
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.
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
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
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;-
keerthi.seetharaman
- Posts: 92
- Joined: Thu Jan 11, 2018 7:55 am
Re: Data extraction issues from Maria DB
Thanks its working fine now..
Please close this ticket
Please close this ticket
Thanks & Regards,
Keerthi Prashanth Seetharaman
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
great locking threadkeerthi.seetharaman wrote:Thanks its working fine now..
Please close this ticket