Find Zabbix Agent version easily across all hosts

I recently completed the Server upgrade from Zabbix 1.8 to 2.0.  To take full advantage of 2.0 I needed to also upgrade all of my host’s Zabbix agents to 2.0.

I have 450+ hosts in my Zabbix environment so manually upgrading all of them is not an option.  I wrote up a few scripts and found some good posts to help me automate this process, which I will write about soon, but one thing that helped a lot was to be able to quickly see which hosts were on what version of the Zabbix agent.

I couldn’t easily find a way to do this in the Zabbix dashboard so I figured I would just grab this info out of the database.  Turns out it is a pretty simple MySQL query to list all of the hostnames and what version of the software they were running.  I modified this query a bit so I could then feed it into my scripts and target exactly the hosts that needed to be upgraded.

Today it’s yours… Have fun

select hosts.host, items.lastvalue from hosts join items on hosts.hostid=items.hostid where items.name like '%zabbix_agent%' and items.lastvalue like '1.8%';

4 Comments on “Find Zabbix Agent version easily across all hosts”

  1. Vitali says:

    For zabbix v 2.2.x

    SELECT DISTINCT hosts.host, history_str.value
    FROM HOSTS
    JOIN items ON hosts.hostid=items.hostid
    JOIN history_str ON items.itemid=history_str.itemid WHERE items.name LIKE ‘%Version of zabbix_agent%’
    ORDER BY hosts.host,history_str.value;

    • Vitali says:

      ELECT DISTINCT hosts.host, history_str.value
      FROM HOSTS
      JOIN items ON hosts.hostid=items.hostid
      JOIN history_str ON items.itemid=history_str.itemid WHERE items.name LIKE ‘%Version of zabbix_agent%’
      ORDER BY hosts.host,history_str.value;

  2. Boris says:

    For 2.4:

    select distinct host, value from hosts join items on hosts.hostid=items.hostid JOIN history_str ON items.itemid=history_str.itemid where items.name like ‘%zabbix_agent%’ and value like “%.%”;


Leave a reply to Chris Cancel reply