Ad Widget

Collapse

Help wanted running script to create new Item with External check Zabbix 3.4.7

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Robbert256
    Junior Member
    • Aug 2018
    • 3

    #1

    Help wanted running script to create new Item with External check Zabbix 3.4.7

    Hi,
    I am quit new to zabbix. Now running version 3.4.7.
    I want to create an item to monitor an host using a external script. I loaded a script called timediff.sh in /usr/lib/zabbix/externalscripts/ with execute permissions for zabbix. This script needs 1 parameter $1 that defines the hostname or host IP address.
    In the documentation for older zabbix versions , there is a reference to the use of external scripts. In there it states that zabbix will add the hostname or host ip as $1 when a script is called. I defined the script in the External Check item as:
    timediff.sh[]
    I can see in zabbix 3.4.7 that the script is executed but without the $1 parameter or $1 is in the wrong format to be accepted. For the script to run properly I need to exec timed.sh <ip or hostname> eg timed.sh 10.1.0.34

    Can anybody point me in where to find the right documentation to do this or help me out ?

    Thanks,

    Rob.
  • Linwood
    Senior Member
    • Dec 2013
    • 398

    #2
    I wasn't aware it would add anything dynamically, try using timediff.sh[{$HOST.CONN}] if you want the IP or DNS (as specified in the interface), and timediff.sh[$HOST.HOST}] if you want the actual host name (not dns), or you can get both (you might need both if you are using a zabbix send to return a value, as that requires a host name, whereas a lot of things require the connection info.

    Comment

    • Robbert256
      Junior Member
      • Aug 2018
      • 3

      #3
      Thanks. timediff.sh[{$HOST.CONN}] solved my problem.

      Comment

      • Robbert256
        Junior Member
        • Aug 2018
        • 3

        #4
        Hi I need to correct myself. There is usefull info on https://www.zabbix.com/documentation...types/external and in the apendix a reference to the MACRO's that can be used.

        The correct syntax that works is timediff.sh[{HOST.CONN}] so without the $

        Comment

        • Hernandes Martins
          Senior Member
          Zabbix Certified SpecialistZabbix Certified Professional
          • Apr 2011
          • 900

          #5
          Hi man ,

          Great job

          Regards
          __

          Att.
          Hernandes Martins - Zabbix Trainer

          Zabbix Brazil Partner - www.luniobr.com

          Zabbix Brazil Community - www.zabbixbrasil.org

          Blog: hernandesmartins.blogspot.com.br

          Skype: hernandss
          Telegram: @MrHernandes

          Español
          Facebook: facebook.com/groups/zabbixlatam
          Telegram: https://t.me/ZabbixEspañol

          Português
          Facebook: facebook.com/groups/zabbixbrasil/
          Telegram: https://t.me/ZabbixBrasil

          Comment

          Working...