mysql>Select A.host_object_id,a.display_name,a.address,b.hostgroup_id,b.alias from nagios_hosts a,nagios_hostgroups b , Nagios_hostgroup_members C where c.host_object_id=a.host_object_id and c.hostgroup_id=b.hostgroup_id order by b.hostgroup_id;
+----------------+--------------+----------------+--------------+--------------------------+
| host_object_id | Display_name | Address | hostgroup_id | Alias |
+----------------+--------------+----------------+--------------+--------------------------+
| 1 | localhost | 127.0.0.1 | 246 | All Servers |
| 2 | Nagios-host | 192.168.21.103 | 246 | All Servers |
| 223 | Zcliushh | 192.168.21.109 | 246 | All Servers |
| 1 | localhost | 127.0.0.1 | 247 | Debian Gnu/linux Servers |
| 1 | localhost | 127.0.0.1 | 248 | HTTP Servers |
| 2 | Nagios-host | 192.168.21.103 | 249 | SA Servers |
| 1 | localhost | 127.0.0.1 | 250 | SSH Servers |
+----------------+--------------+----------------+--------------+--------------------------+
7 Rows in Set (0.00 sec)
Mysql>SELECT * fromnagios_hostgroups;
+--------------+-------------+-------------+---------------------+--------------------------+
|hostgroup_id| instance_id | Config_type | hostgroup_object_id |alias|
+--------------+-------------+-------------+---------------------+--------------------------+
| 246 | 1 | 1 | 211 | All Servers |
| 247 | 1 | 1 | 212 | Debian Gnu/linux Servers |
| 248 | 1 | 1 | 213 | HTTP Servers |
| 249 | 1 | 1 | 214 | SA Servers |
| 250 | 1 | 1 | 215 | SSH Servers |
+--------------+-------------+-------------+---------------------+--------------------------+
5 rows in Set (0.00 sec)
Mysql> SELECT * FROMnagios_hostgroup_members;
+---------------------+-------------+--------------+----------------+
| hostgroup_member_id | instance_id |hostgroup_id|host_object_id|
+---------------------+-------------+--------------+----------------+
| 311 | 1 | 246 | 1 |
| 312 | 1 | 246 | 2 |
| 313 | 1 | 246 | 223 |
| 314 | 1 | 247 | 1 |
| 315 | 1 | 248 | 1 |
| 316 | 1 | 249 | 2 |
| 317 | 1 | 250 | 1 |
+---------------------+-------------+--------------+----------------+
7 Rows in Set (0.00 sec)
Mysql> SELECT * from nagios_hosts;
| host_object_id | Alias | Display_name | Address |