For example to list all hostid's which have the item key
agent.version I use:
select hostid from items where key_ = 'agent.version';
Result:
+--------+
| hostid |
+--------+
| 10050 |
| 10074 |
| 10075 |
| 10076 |
| 10077 |
| 10078 |
| 10079 |
| 10081 |
| 10084 |
| 10370 |
+--------+
But this will show the numeric host values. I would like to see the host names. To do that I can use:
select host from hosts where hostid in (select hostid from items where key_ = 'agent.version');
Result:
+---------------------------+
| host |
+---------------------------+
| stretch.arm |
| Template App Zabbix Agent |
| Template OS AIX |
| Template OS FreeBSD |
| Template OS HP-UX |
| Template OS Mac OS X |
| Template OS OpenBSD |
| Template OS Solaris |
| Template OS Windows |
| Zabbix server |
+---------------------------+
Turns out that this will also show all the templates which have this item key
agent.version. How to exclude the templates?
select host from hosts where hostid in (select hostid from items where key_ = 'agent.version') and status != '3';
Result:
+---------------+
| host |
+---------------+
| Zabbix server |
| stretch.arm |
+---------------+
No comments:
Post a Comment