Ad Widget

Collapse

External Check problem

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • gazzerh
    Member
    • Jun 2006
    • 36

    #1

    External Check problem

    I don't know if i'm doing anything wrong but I have a script that is called that uses a hostname as a parameter. The script then adds builds the URL. It then uses lynx to call this URL, then dump to stdout, grepped, awked which returns a integer.

    I am creating the item with this: script.sh(www.somehost.com)

    It doesn't work though. I look at the server log file on my zabbix server and it's using the hostname the item is assigned to as the parameter so my script is calling: http://zabbixhostname/something/somepage.aspx instead of:


    If I just add the hostname into the script and call it within zabbix without a parameter: script.sh() it works fine. It just doesn't work when I use a parameter.

    Garry
  • Alexei
    Founder, CEO
    Zabbix Certified Trainer
    Zabbix Certified SpecialistZabbix Certified Professional
    • Sep 2004
    • 5654

    #2
    It does work! I created a small script which prints second command line parameter (first is a host name) and it works perfectly. I cannot confirm your report.
    Alexei Vladishev
    Creator of Zabbix, Product manager
    New York | Tokyo | Riga
    My Twitter

    Comment

    • gazzerh
      Member
      • Jun 2006
      • 36

      #3
      What is the hostname you're using? When I do mine the hostname the trigger is associated to is:
      "machine1"

      The actual external check i'm doing is:
      script.sh(www.somewebsite.com)

      However - in /tmp/zabbix_server.log i'm seeing this:
      Looking up machine1
      Making HTTP connection to machine1
      Sending HTTP request.
      HTTP request sent; waiting for response.
      Alert!: Access without authorization denied -- retrying

      lynx: Can't access startfile http://machine1/TestPages/page.aspx

      It's trying to connect to machine1 and not www.somewebsite.com so it's passing the wrong parameter to my script.

      Comment

      • Alexei
        Founder, CEO
        Zabbix Certified Trainer
        Zabbix Certified SpecialistZabbix Certified Professional
        • Sep 2004
        • 5654

        #4
        Originally posted by gazzerh
        It's trying to connect to machine1 and not www.somewebsite.com so it's passing the wrong parameter to my script.
        This is because the first parameter is ALWAYS item hostname. The www.somewebsite.com will be passed as a second parameter.
        Alexei Vladishev
        Creator of Zabbix, Product manager
        New York | Tokyo | Riga
        My Twitter

        Comment

        • gazzerh
          Member
          • Jun 2006
          • 36

          #5
          OK. I've looked more at your reply and I noted that said the first parameter is the hostname so I thought this may be the way external checks work and hostname is always sent in $1 regardless of the parameters you put in the check. So i then modified my script to read in the second parameter sent to it.

          It now works - yay.

          The documentation (which is where I looked to configure this external check) doesn't mention that zabbix sends the hostname as the first parameter regardless of the list of parameters you place within the parenthesis.

          Garry

          Comment

          • Alexei
            Founder, CEO
            Zabbix Certified Trainer
            Zabbix Certified SpecialistZabbix Certified Professional
            • Sep 2004
            • 5654

            #6
            Originally posted by gazzerh
            The documentation (which is where I looked to configure this external check) doesn't mention that zabbix sends the hostname as the first parameter regardless of the list of parameters you place within the parenthesis.
            I amended the documentation when I saw you post. It will be in the manual released with 1.4.1
            Alexei Vladishev
            Creator of Zabbix, Product manager
            New York | Tokyo | Riga
            My Twitter

            Comment

            • gazzerh
              Member
              • Jun 2006
              • 36

              #7
              Thanks Alexei. I look forward to the new release.

              Comment

              Working...