Ad Widget

Collapse

How to check agents version

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ruitika
    Junior Member
    • Jan 2024
    • 1

    #1

    How to check agents version

    Hello Everyone.

    How i can get a list of all agents and their versions?
    I upgrade zabbix to 6.4 and want check agents in hosts, but if possible get that information at one time, instead go one by one host.

    thanks in advance for any help
  • cyber
    Senior Member
    Zabbix Certified SpecialistZabbix Certified Professional
    • Dec 2006
    • 4807

    #2
    agent.version
    ​Keep it in some default template, what you install on all hosts, let it populate a field in host inventory and you will always have that information at hand... even if you really need it rarely...

    Comment

    • santosra02
      Junior Member
      • May 2023
      • 21

      #3
      Hi,

      In my case, when a need this kind of information I run the following script taking advantage of Zabbix API:

      from pyzabbix import ZabbixAPI

      zapi = ZabbixAPI("http://XX.XX.XX.XX/zabbix/api_jsonrpc.php")
      # You can also authenticate using an API token instead of user/pass with Zabbix >= 5.4
      zapi.login(api_token='PUT_YOUR_TOKEN_HERE')
      print("Connected to Zabbix API Version %s" % zapi.api_version())

      # Get all hosts with Zabbix agent
      hosts = zapi.host.get(output=['hostid', 'host', 'name'], selectInterfaces=['ip'], filter={'status': 0})

      # Iterate through the hosts and get the Zabbix agent version
      for host in hosts:
      host_id = host['hostid']
      host_name = host['name']
      host_ip = host['interfaces'][0]['ip']

      # Define the filter to match the agent.version item
      item_filter = {
      'key_': 'agent.version',
      }

      # Get the Zabbix agent version for the host with the specified filter
      items = zapi.item.get(output=['lastvalue'], hostids=host_id, filter=item_filter)

      if items:
      agent_version = items[0]['lastvalue']
      if agent_version != '':
      print(f"Host: {host_name} ({host_ip}) - Agent Version: {agent_version}")
      else:
      print(f"Host: {host_name} ({host_ip}) - Agent Version: No data available")
      else:
      print(f"Host: {host_name} ({host_ip}) - Agent Version: Not found")

      Comment

      • Tristis Oris
        Member
        • Sep 2015
        • 66

        #4
        Since it already available at buildin templates for linux, windows, easy to get info at Latest data for all hosts: "Version of Zabbix agent running"

        Comment

        • Vermizz
          Member
          • Oct 2022
          • 33

          #5
          Hello,
          you can use my python script to report information about zabbix agent.
          Repo for my zabbix templates and reports. Contribute to Vermiz/Zabbix development by creating an account on GitHub.

          Comment

          Working...