Ad Widget

Collapse

Zabbix Extrenal Scripts

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • spage
    Junior Member
    • Jul 2007
    • 3

    #1

    Zabbix Extrenal Scripts

    Hi

    When i define an External Script using the PHP Front end it will not except script('value') It will only except script['value'] Which Returns "External check [script['value']] is not supported"

    I've update the frontends/php/includes/defines.inc.php

    --- defines.inc.php 2007-06-29 17:50:28.000000000 -0300
    +++ /var/www/html/zabbix/include/defines.inc.php 2007-07-06 11:11:16.000000000 -0300
    @@ -388,7 +388,7 @@
    define('ZBX_EREG_DNS_FORMAT', '([0-9a-zA-Z\_\.\$[.-.]]+)');
    define('ZBX_EREG_HOST_FORMAT', ZBX_EREG_INTERNAL_NAMES);
    define('ZBX_EREG_NODE_FORMAT', ZBX_EREG_INTERNAL_NAMES);
    - define('ZBX_EREG_ITEM_KEY_FORMAT', '('.ZBX_EREG_INTERNAL_NAMES.'(\['.ZBX_EREG_PARAMS.'\]){0,1})');
    + define('ZBX_EREG_ITEM_KEY_FORMAT', '('.ZBX_EREG_INTERNAL_NAMES.'(\('.ZBX_EREG_PARAMS. '\)){0,1})');
    define('ZBX_KEY_ID', 1);
    define('ZBX_KEY_NAME_ID', 2);
    define('ZBX_KEY_PARAM_ID', 4);
  • Alexei
    Founder, CEO
    Zabbix Certified Trainer
    Zabbix Certified SpecialistZabbix Certified Professional
    • Sep 2004
    • 5654

    #2
    FYI Syntax of external checks was changed in pre 1.4.2:

    script[arguments]

    Both frontend and server side were updated.
    Alexei Vladishev
    Creator of Zabbix, Product manager
    New York | Tokyo | Riga
    My Twitter

    Comment

    • serpentboy
      Junior Member
      • Sep 2008
      • 3

      #3
      Hi,

      Im getting issues when using external scripts. here are the details:

      Value on the item:

      test.sh [-h 127.0.0.1]

      basically the script only does counting of messages inside the mail queue.

      the file is located inside /etc/zabbix/externalscript/ which the owner from zabbix folder down is user zabbix and group zabbix. permission is set to 755

      here is what i see on the log:

      28238:20090703:121342 In get_value_external([test.sh [-h 127.0.0.1]])
      28238:20090703:121342 External check [test.sh [-h 127.0.0.1]] is not supported
      28238:20090703:121343 In get_value_external([test.sh [-h 127.0.0.1]])
      28238:20090703:121343 External check [test.sh [-h 127.0.0.1]] is not supported
      28238:20090703:121344 In get_value_external([test.sh [-h 127.0.0.1]])
      28238:20090703:121344 External check [test.sh [-h 127.0.0.1]] is not supported
      28238:20090703:121345 In get_value_external([test.sh [-h 127.0.0.1]])
      28238:20090703:121345 External check [test.sh [-h 127.0.0.1]] is not supported
      28238:20090703:121346 In get_value_external([test.sh [-h 127.0.0.1]])
      28238:20090703:121346 External check [test.sh [-h 127.0.0.1]] is not supported
      28238:20090703:121347 In get_value_external([test.sh [-h 127.0.0.1]])
      28238:20090703:121347 External check [test.sh [-h 127.0.0.1]] is not supported
      28238:20090703:121348 In get_value_external([test.sh [-h 127.0.0.1]])
      28238:20090703:121348 External check [test.sh [-h 127.0.0.1]] is not supported
      28238:20090703:121349 In get_value_external([test.sh [-h 127.0.0.1]])
      28238:20090703:121349 External check [test.sh [-h 127.0.0.1]] is not supported
      28238:20090703:121350 In get_value_external([test.sh [-h 127.0.0.1]])
      28238:20090703:121350 External check [test.sh [-h 127.0.0.1]] is not supported
      28238:20090703:121351 In get_value_external([test.sh [-h 127.0.0.1]])
      28238:20090703:121351 External check [test.sh [-h 127.0.0.1]] is not supported
      28238:20090703:121352 In get_value_external([test.sh [-h 127.0.0.1]])
      28238:20090703:121352 External check [test.sh [-h 127.0.0.1]] is not supported
      28238:20090703:121354 In get_value_external([test.sh [-h 127.0.0.1]])
      28238:20090703:121354 External check [test.sh [-h 127.0.0.1]] is not supported
      28238:20090703:121355 In get_value_external([test.sh [-h 127.0.0.1]])
      28238:20090703:121355 External check [test.sh [-h 127.0.0.1]] is not supported
      28238:20090703:121356 In get_value_external([test.sh [-h 127.0.0.1]])
      28238:20090703:121356 External check [test.sh [-h 127.0.0.1]] is not supported
      28238:20090703:121357 In get_value_external([test.sh [-h 127.0.0.1]])
      28238:20090703:121357 External check [test.sh [-h 127.0.0.1]] is not supported
      28238:20090703:121358 In get_value_external([test.sh [-h 127.0.0.1]])
      28238:20090703:121358 External check [test.sh [-h 127.0.0.1]] is not supported
      28238:20090703:121359 In get_value_external([test.sh [-h 127.0.0.1]])
      28238:20090703:121359 External check [test.sh [-h 127.0.0.1]] is not supported
      28238:20090703:121400 In get_value_external([test.sh [-h 127.0.0.1]])
      28238:20090703:121400 External check [test.sh [-h 127.0.0.1]] is not supported
      28238:20090703:121401 In get_value_external([test.sh [-h 127.0.0.1]])
      28238:20090703:121401 External check [test.sh [-h 127.0.0.1]] is not supported
      28238:20090703:121402 In get_value_external([test.sh [-h 127.0.0.1]])
      28238:20090703:121402 External check [test.sh [-h 127.0.0.1]] is not supported
      28238:20090703:121403 In get_value_external([test.sh [-h 127.0.0.1]])
      28238:20090703:121403 External check [test.sh [-h 127.0.0.1]] is not supported
      28238:20090703:121404 In get_value_external([test.sh [-h 127.0.0.1]])
      28238:20090703:121404 External check [test.sh [-h 127.0.0.1]] is not supported


      hope you can assist me on this issue.

      thank you.

      Comment

      • Calimero
        Senior Member
        • Nov 2006
        • 481

        #4
        Did you set 'ExternalScripts=/etc/zabbix/externalscripts' in zabbix_server.conf ?

        If you "su - zabbix" can you run the script ?

        Does it output return value on stdout as
        value\n
        ?

        Item should be named scriptname.sh[args...] (no space).

        Comment

        • Silvery
          Junior Member
          Zabbix Certified Specialist
          • Oct 2008
          • 28

          #5
          You cannot use it like this: test.sh [-h 127.0.0.1]

          The script awaits a list of parameters between the squared brackets, separated by spaces. The option -h is something you have to set inside of your script.

          So for test.sh[127.0.0.1] your script should look like this:

          #!/bin/bash

          HOST="$1" -->The Host, where you link this script is always $1
          VARIABLE="$2" -->In your case: $2 = 127.0.0.1

          `bash-command -h $VARIABLE`
          Last edited by Silvery; 09-07-2009, 13:11.

          Comment

          • serpentboy
            Junior Member
            • Sep 2008
            • 3

            #6
            Originally posted by Silvery
            You cannot use it like this: test.sh [-h 127.0.0.1]

            The script awaits a list of parameters between the squared brackets, separated by spaces. The option -h is something you have to set inside of your script.

            So for test.sh[127.0.0.1] your script should look like this:
            I see. Can I use the test.sh without [127.0.0.1] ? all i want is to run the script.

            Comment

            • Silvery
              Junior Member
              Zabbix Certified Specialist
              • Oct 2008
              • 28

              #7
              Sure, if you want to use the parameter 127.0.0.1 by default you can use it in your script like this:

              `bash-command -h 127.0.0.1`

              then you can call the script without any parameters: test.sh[]

              But I don't know if 127.0.0.1 will work. Why don't you use the public IP address of the host in place of the loopback IP address?

              Comment

              • tetros
                Junior Member
                • Jun 2009
                • 3

                #8
                problem external script

                s'il vous plait quelqu'un à une solution pour ce que je trouve dans zabbix_server.log



                sh: /etc/zabbix/local_scripts//pcheck.dbconsole: No such file or directory
                4335:20090709:144050 Item [Eclipsecheck.dbconsole[]] error: Script /etc/zabbix/local_scripts//pcheck.dbconsole returned nothing.
                4340:20090709:144056 Item [Eclipse:kernel.maxproc] error: Not supported by ZABBIX agent
                4340:20090709:144056 Item [Eclipse:sensor[temp3]] error: Not supported by ZABBIX agent
                4340:20090709:144056 Item [Eclipse:system.cpu.util[,wait,avg1]] error: Not supported by ZABBIX agent
                4340:20090709:144056 Item [Eclipse:vfs.file.size[/var/log/syslog]] error: Not supported by ZABBIX agent
                4363:20090709:144128 Item [ZABBIX Server:agent.ping] error: Get value from agent failed: Cannot connect to [10.1.10.222:10050] [Connection refused]
                sh: /etc/zabbix/local_scripts//pcheck.dbconsole: No such file or directory
                4335:20090709:144130 Item [Eclipsecheck.dbconsole[]] error: Script /etc/zabbix/local_scripts//pcheck.dbconsole returned nothing.
                4335:20090709:144130 Parameter [pcheck.dbconsole[]] is not supported by agent on host [Eclipse] Old status [0]

                Comment

                • serpentboy
                  Junior Member
                  • Sep 2008
                  • 3

                  #9
                  Originally posted by Silvery
                  Sure, if you want to use the parameter 127.0.0.1 by default you can use it in your script like this:

                  `bash-command -h 127.0.0.1`

                  then you can call the script without any parameters: test.sh[]

                  But I don't know if 127.0.0.1 will work. Why don't you use the public IP address of the host in place of the loopback IP address?
                  Hi,

                  I tried removing entries inside [] but im still getting the same error:

                  2209:20090715:075858 External check [zabbix-test-dig.sh[]] is not supported
                  2209:20090715:075859 In get_value_external([zabbix-test-dig.sh[]])
                  2209:20090715:075859 External check [zabbix-test-dig.sh[]] is not supported
                  2209:20090715:075900 In get_value_external([zabbix-test-dig.sh[]])
                  2209:20090715:075900 External check [zabbix-test-dig.sh[]] is not supported
                  2209:20090715:075901 In get_value_external([zabbix-test-dig.sh[]])
                  2209:20090715:075901 External check [zabbix-test-dig.sh[]] is not supported
                  2209:20090715:075902 In get_value_external([zabbix-test-dig.sh[]])
                  2209:20090715:075902 External check [zabbix-test-dig.sh[]] is not supported
                  2209:20090715:075903 In get_value_external([zabbix-test-dig.sh[]])
                  2209:20090715:075903 External check [zabbix-test-dig.sh[]] is not supported
                  2209:20090715:075904 In get_value_external([zabbix-test-dig.sh[]])
                  2209:20090715:075904 External check [zabbix-test-dig.sh[]] is not supported
                  2209:20090715:075905 In get_value_external([zabbix-test-dig.sh[]])
                  2209:20090715:075905 External check [zabbix-test-dig.sh[]] is not supported
                  2209:20090715:075906 In get_value_external([zabbix-test-dig.sh[]])
                  2209:20090715:075906 External check [zabbix-test-dig.sh[]] is not supported
                  2209:20090715:075907 In get_value_external([zabbix-test-dig.sh[]])
                  2209:20090715:075907 External check [zabbix-test-dig.sh[]] is not supported
                  2209:20090715:075909 In get_value_external([zabbix-test-dig.sh[]])
                  2209:20090715:075909 External check [zabbix-test-dig.sh[]] is not supported
                  2209:20090715:075911 In get_value_external([zabbix-test-dig.sh[]])
                  2209:20090715:075911 External check [zabbix-test-dig.sh[]] is not supported
                  2209:20090715:075913 In get_value_external([zabbix-test-dig.sh[]])
                  2209:20090715:075913 External check [zabbix-test-dig.sh[]] is not supported
                  2209:20090715:075914 In get_value_external([zabbix-test-dig.sh[]])
                  2209:20090715:075914 External check [zabbix-test-dig.sh[]] is not supported
                  2209:20090715:075915 In get_value_external([zabbix-test-dig.sh[]])
                  2209:20090715:075915 External check [zabbix-test-dig.sh[]] is not supported
                  2209:20090715:075916 In get_value_external([zabbix-test-dig.sh[]])
                  2209:20090715:075916 External check [zabbix-test-dig.sh[]] is not supported
                  2209:20090715:075917 In get_value_external([zabbix-test-dig.sh[]])
                  2209:20090715:075917 External check [zabbix-test-dig.sh[]] is not supported

                  The new shell script will return the value 0 if its successful and 1 if it fails. All I want to happen is to zabbix execute the script, get the value (0 or 1) and put that value on a graph or alert. I tried manually executing the shell script as user zabbix inside externalscripts directory and it works fine. Not sure what to do next here. Additional suggestions are much appreciated.

                  Thank you.

                  Comment

                  Working...