Ad Widget

Collapse

Using default Macro in items keys

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Frogg
    Junior Member
    • Mar 2020
    • 18

    #1

    Using default Macro in items keys

    Hi,

    in the doc there is the default macros available : https://www.zabbix.com/documentation...ed_by_location

    Why can't i call them in items key like :

    Code:
    icmpping[{HOST.NAME}]
    i tryied {HOST.NAME} / {HOST.DNS} / {HOSTNAME}
    deseperatly i even tried {$HOSTNAME} / {$HOST.NAME}
    and even

    Code:
     icmpping[{HOST.NAME},,,,]
    Without success

    each time i get the error

    Cannot send ICMP ping packets to this host

    any idea and what going on ?

    By the way if i set the hostname directly instead of the macro in the command it works

    Thanks.
  • dimir
    Zabbix developer
    • Apr 2011
    • 1080

    #2
    The macro {HOST.HOST} returns the name of your host, configured in Zabbix frontend. Are you sure you named it by real host name that is pingable on your network?

    Comment

    • Frogg
      Junior Member
      • Mar 2020
      • 18

      #3
      Thank for the reply,

      i just tried it, same result:
      "icmpping[{HOST.HOST}]" became not supported: Cannot send ICMP ping packets to this host.

      If i use the host string name like icmpping[hostname] with hostname the computer name it works.

      Exemples:

      Ping in ssh (OK) :
      Code:
      ping frogg.home
      PING frogg.home (192.168.0.50) 56(84) bytes of data.
      64 bytes from frogg.home (192.168.0.50): icmp_seq=1 ttl=128 time=2.60 ms
      64 bytes from frogg.home (192.168.0.50): icmp_seq=2 ttl=128 time=2.76 ms
      64 bytes from frogg.home (192.168.0.50): icmp_seq=3 ttl=128 time=2.53 ms
      64 bytes from frogg.home (192.168.0.50): icmp_seq=4 ttl=128 time=2.76 ms
      64 bytes from frogg.home (192.168.0.50): icmp_seq=5 ttl=128 time=2.15 ms
      With name as string (OK):
      Code:
      icmpping[frogg.home]
      With name as macro (KO):
      Code:
      [B]"icmpping[{HOST.HOST}]" became not supported: Cannot send ICMP ping packets to this host.[/B]

      By the way i have the same trouble when i try to assign default macro in the template like (KO)
      Macro Value
      {$SSL.DNS} {HOST.DNS}
      If i use {HOST.DNS} directly in external script all is ok (OK)


      Version:
      i am using Zabbix 4.4.6 btw.
      Last edited by Frogg; 11-03-2020, 19:43.

      Comment

      • dimir
        Zabbix developer
        • Apr 2011
        • 1080

        #4
        {HOST.HOST} is translated to the name of the host, see picture:
        Click image for larger version  Name:	host-host-macro.png Views:	0 Size:	37.2 KB ID:	397431

        Yeah, and this:
        Macro Value
        {$SSL.DNS} {HOST.DNS}
        won't work because macros are not supported in macro values.
        Last edited by dimir; 12-03-2020, 09:57.

        Comment

        • Frogg
          Junior Member
          • Mar 2020
          • 18

          #5
          Thanks for the answer,

          What about simple check items ? like
          Code:
            
           icmpping[{HOST.HOST}]
          i get
          "icmpping[{HOST.HOST}]" became not supported: Cannot send ICMP ping packets to this host.
          This is the problem i get.

          {HOST.HOST} (even other internal macros) is (are) working well in title, map, external script ... i didn't find trouble atm with it.

          Thanks.
          Last edited by Frogg; 12-03-2020, 12:41.

          Comment

          • dimir
            Zabbix developer
            • Apr 2011
            • 1080

            #6
            Could you show the screenshot of your item configuration (Configuration -> Hosts -> click your host -> Items -> click your item). The screen shot of whole page.

            Comment

            • Frogg
              Junior Member
              • Mar 2020
              • 18

              #7
              Thanks again for your answser.


              I would like to tell what happened but i cant.

              Today i got a big network trouble (almost all my newtork went down/up for 10 min alternativelly), lot of thing was no more working. I even had to reboot the zabbix server.


              What i know it is that now the script is working... i didn't modified anything. (maybe the reboot solved it, i dunno ?)

              Click image for larger version  Name:	ping_ok.png Views:	0 Size:	8.2 KB ID:	397501

              I dont understand what happened, and i am sorry to bothered you with this, as all is working as it should...
              I swear i didnt change the configuration after the trouble i get.

              I am really sorry about it.





              Last edited by Frogg; 12-03-2020, 17:02.

              Comment

              • dimir
                Zabbix developer
                • Apr 2011
                • 1080

                #8
                No problem at all! I'm glad it's working for you. Looks like your host has correct name. The only thing I can think of - server configuration cache reload that by default happens every minute, but perhaps you have modified this value (CacheUpdateFrequency=60 in zabbix server config file).

                Comment

                Working...