Had a business unit request a CSV export of all of our hosts, their respective services as well as the command arguments in MySQL. The query works well and looks like this:
Code: Select all
select a.alias, b.display_name, b.check_command_args from nagios.nagios_hosts a, nagios.nagios_services b where ((a.host_object_id = b.host_object_id)) order by a.alias INTO OUTFILE "/tmp/hosts_n_services.csv" fields terminated by ',' enclosed by '"' lines terminated by '\n';
I just got another request to add the host group that each host is assigned to this query - after poking around for a bit, I'm not seeing an easy way to include that. Is there any MySQL gurus who could give me an assist on this query?