Ad Widget

Collapse

Monitoring for agent.hostname not matching HOST.NAME ?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • djp210
    Junior Member
    • Aug 2016
    • 15

    #1

    Monitoring for agent.hostname not matching HOST.NAME ?

    This seems like it should be a pretty simple thing, but I can't figure out how to successfully configure a trigger that would fire if HOST.NAME (which is the name listed in Zabbix) does not match agent.hostname (which is returned by the Zabbix agent).

    The goal is to try and find hosts that are configured with the wrong IP address. For example, if SERVERA has an IP address of 192.168.1.19 and SERVERB has an IP address of 192.168.1.100 and both have Zabbix agents installed, Zabbix will happily accept the same IP address for both hosts, meaning the data for one of them is really the data for the the other one.

    I've tried things like this with no luck:

    {App Zabbix Agent:agent.hostname.str({HOST.NAME},#1)}=1

    (Because agent.hostname and HOST.NAME are, of course, strings, doing a comparison doesn't seem to be very easy.)

    Any ideas? We're running Zabbix 3.0.

    Thanks.
    Last edited by djp210; 08-05-2017, 14:23.
  • david.forget
    Junior Member
    • Feb 2019
    • 1

    #2
    I have the same question. The only solution I found yet is to create a custom script or run a linux command (not allowed in my case).

    djp210 have you found a solution?

    Thanks

    Comment

    • kloczek
      Senior Member
      • Jun 2006
      • 1771

      #3
      agent.hostname[] key returns what is in zabbix agent configuration in Hostname parameter. By default zabbix_agentd.conf::Hostname returns other agent configuration parameter which is HostnameItem which by default returns system.hostname[] agent key. On Linux for example this key returns what uname() syscal (or hostname command) returns.
      {HOST.NAME} is the name under which host is registered in the zabbix database.
      Those two thing does not need to match or be the same. In the zabbix you can register host under name which is not RFC 952 compliant.
      For example OOTB zabbix after fresh installation has one dummy host (host with 127.0.0,1/localhost in interface) named "Zabbix server". Such name has nothing to do with any real host name used by zabbix monitoring stack.
      Such trigger like above should be used only in case that when it is important to have host registered in the zabbix under exactly the same name as hostname command returns on the monitored system.
      http://uk.linkedin.com/pub/tomasz-k%...zko/6/940/430/
      https://kloczek.wordpress.com/
      zapish - Zabbix API SHell binding https://github.com/kloczek/zapish
      My zabbix templates https://github.com/kloczek/zabbix-templates

      Comment

      • Inglebard
        Junior Member
        • Sep 2014
        • 9

        #4
        Hi, I am also interested in a way to compare {HOSTNAME} and agent.hostname. I have multiple zabbix host running on the same IP but on different port. Sometimes, we make mistakes and the data in zabbix server do not correspond to the right agent.

        Comment

        • manuelpinot
          Junior Member
          • Dec 2019
          • 2

          #5
          You can use Ansible




          Comment

          • Semiadmin
            Senior Member
            • Oct 2014
            • 1625

            #6
            As a workaround:
            change the type of a single item in a template (agent.version or agent.hostname, for example) to Zabbix agent (active) and create a trigger with nodata. If agent.hostname doesn't match {HOST.HOST} this active check would return nothing and trigger would fire.

            Comment

            • Inglebard
              Junior Member
              • Sep 2014
              • 9

              #7
              Originally posted by Semiadmin
              As a workaround:
              change the type of a single item in a template (agent.version or agent.hostname, for example) to Zabbix agent (active) and create a trigger with nodata. If agent.hostname doesn't match {HOST.HOST} this active check would return nothing and trigger would fire.
              Hi, Thanks.
              Nice Workaround. It will also trigger if the host is offline but whatever.
              Hope one day it will exist an official solution.

              Comment

              • HLS88
                Junior Member
                • May 2021
                • 3

                #8
                Hi,

                is there any solution to compare the {HOST.NAME} with for example the agent.hostname?

                My goal is to finde hosts where the {HOST.NAME} is not equal to the agent.hostname.

                Comment

                Working...