Hello,
I need a mysql-select-query to get the current hosts an their related graphs in a list, sorted by the hostname.
Can anybody help me out?
Thanks
[HOWTO] Create a list of all hosts with related graphs?
Moderators: Developers, Moderators
[HOWTO] Create a list of all hosts with related graphs?
Last edited by Chino77 on Wed Aug 11, 2010 2:26 am, edited 1 time in total.
For example:
Be careful with server load for big tables.
EDIT: I made a mistake. Use 'description' or 'hostname' instead of 'host_id' at the last line.
Code: Select all
SELECT * FROM
(
SELECT * FROM
(SELECT id, host_id FROM graph_local) AS g
INNER JOIN
(SELECT local_graph_id, title_cache FROM graph_templates_graph) AS t
ON g.id = t.local_graph_id
) AS gt
INNER JOIN
(SELECT id, description, hostname FROM host) AS h
ON gt.host_id = h.id
ORDER BY host_id;
EDIT: I made a mistake. Use 'description' or 'hostname' instead of 'host_id' at the last line.
Who is online
Users browsing this forum: No registered users and 2 guests