Ad Widget

Collapse

Parameters in external check - ignored?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • kormik
    Junior Member
    • Oct 2009
    • 1

    #1

    Parameters in external check - ignored?

    Hi,

    I'm trying to setup an external check that we used to use with Nagios. It requires few parameters, so I configured it as an external check with key script_name[-X parameterX, -Y parameterY, -Z parameterZ]. Unfortunatelly the scripts returns with error - parameter missing. Why is it so? Is there any mistake in what i set up? I tried many variations of the above and it seems like everything in the brackets is just ignored... I use 1.6.6 version of Zabbix.
    Up to this moment I was delighted to see how easy it is to configure Zabbix

    Thank You in advance for any suggestions.
  • richlv
    Senior Member
    Zabbix Certified Trainer
    Zabbix Certified SpecialistZabbix Certified Professional
    • Oct 2005
    • 3112

    #2
    zabbix passes host ip as the first parameter to external tests and item key parameters after that. so $1 would be host ip, $2 and forward would be whatever you passed to the item.
    you can see what zabbix passes by outputting "$@" to a temporary file in the script while testing.
    Zabbix 3.0 Network Monitoring book

    Comment

    • NOB
      Senior Member
      Zabbix Certified Specialist
      • Mar 2007
      • 469

      #3
      Originally posted by richlv
      zabbix passes host ip as the first parameter to external tests and item key parameters after that. so $1 would be host ip, $2 and forward would be whatever you passed to the item.
      you can see what zabbix passes by outputting "$@" to a temporary file in the script while testing.
      As far as I know (in 1.4.x), the contents of parameter 1 depends on the setting
      in the PHP frontend.
      If you configured the host to use IP-address for access, it will be the
      IP address, if you configure the host to use DNS-Name, it will be
      the DNS-Name of the host shown in the frontend.

      Has that changed in 1.6.x ?

      To the original poster: Remove the commas from the parameter list if you don't want to parse the command line.

      Regards

      Norbert.
      Last edited by NOB; 06-10-2009, 14:31. Reason: Added hint for the commas

      Comment

      • richlv
        Senior Member
        Zabbix Certified Trainer
        Zabbix Certified SpecialistZabbix Certified Professional
        • Oct 2005
        • 3112

        #4
        Originally posted by NOB
        As far as I know (in 1.4.x), the contents of parameter 1 depends on the setting
        in the PHP frontend.
        If you configured the host to use IP-address for access, it will be the IP address, if you configure the host to use DNS-Name, it will be the DNS-Name of the host shown in the frontend.

        Has that changed in 1.6.x ?
        good point. no, it has not changed - i'm just always dealing with ip adresses, so i tend to forget about places where hostname can appear instead
        Zabbix 3.0 Network Monitoring book

        Comment

        • psad
          Junior Member
          • Feb 2005
          • 5

          #5
          A pitty, the documentatin in section "11 External checks" does not tell anything about this fact. The example there is wrong: example script will be executed as follows:
          check_oracle.sh "[HOSTIP]" "-h" "192.168.1.4"

          Comment

          • richlv
            Senior Member
            Zabbix Certified Trainer
            Zabbix Certified SpecialistZabbix Certified Professional
            • Oct 2005
            • 3112

            #6
            2.0 + documentation pages updated to reflect the possibility to use dns name from host properties. 1.8 page left as is - 1.8 has a hardcoded first parameter that later versions do not have
            Zabbix 3.0 Network Monitoring book

            Comment

            Working...