Ad Widget

Collapse

Zabbix External Check does not like Numbers

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Dave.Klotz
    Junior Member
    • Oct 2014
    • 2

    #1

    Zabbix External Check does not like Numbers

    Hi,

    I created an external check, and chmodded the directory to ensure zabbix has access to the script:
    -rwxr-xr-x. 1 zabbix zabbix 82 Oct 1 09:50 check_login.sh

    shell script is essentially a wrapper for phpunit test, which outputs a decimal number which represents the time it takes the test to run.

    When I originally ran it, I was able to capture the output of the phpunit test as well, and got in my "History" for the zabbix check:
    /** inside the history of the check as a "log" element
    PHPUnit 4.0.17 by Sebastian Bergmann. You have installed PHPUnit via PEAR. This installation method is no longer supported and http://pear.phpunit.de/ will be shut down no later than December, 31 2014. Please read http://phpunit.de/manual/current/en/installation.html and learn how to use PHPUnit from a PHAR or install it via Composer.

    **/

    so I know the permissions are OK for zabbix user.

    However, when I add in the echo from php for in example: "Seconds: 6.7491" then grep for the line and remove the "seconds" it does not display this number in the history. if I run this script, it displays this number properly in the shell.

    using sudo -u zabbix the number is displayed as well.

    This leads me to believe I need to format this number somehow differently

    is there some formatting I need to place around numbers so that zabbix can read them? I didn't see anything in the manual.
  • Dave.Klotz
    Junior Member
    • Oct 2014
    • 2

    #2
    Figured it out.

    If you have a script which calls another script, in my case a BASH script that runs a phpunit script, you must specify the absolute path for the script in your BASH script; in my case:

    #!/bin/bash
    phpunit /usr/lib/zabbix/externalscripts/ThisIsATest.php



    where the phpunit is actually a selenium test which outputs time in seconds it took to run.

    Comment

    Working...