Ad Widget

Collapse

UserParameter and php

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • abille
    Junior Member
    • Feb 2007
    • 9

    #1

    UserParameter and php

    hi,
    i configured zabbix_agentd.conf to extend agent possibilities for my system.

    i made a /shell/php script toto.sh:
    --------------------------
    #!/usr/bin/php -q
    <?
    echo "1";
    ?>
    ---------------------------
    in zabbix_agentd.conf:
    UserParameter=toto.test,/zabbix/toto.sh

    and i get a timeout in the log file when the script is called.

    all runs ok if i run zabbix_agentd -t toto.test
    still ok if i call the script as user zabbix from command line

    i tried to set UserParameter=toto.test,php /zabbix/toto.php
    and toto.php :
    ------------
    <?echo "1";?>
    ------------

    i even tried to call php from the script toto.sh :
    /usr/bin/php -q /zabbix/toto.php

    but still the same problem

    it only works when toto.sh is a real shell, not using php


    is there anything i can do ?
  • abille
    Junior Member
    • Feb 2007
    • 9

    #2
    UserParameter and PHP

    i omitted to say that i use zabbix 1.1.2

    Comment

    • James Wells
      Senior Member
      • Jun 2005
      • 664

      #3
      Greetings,

      Right off the bat, I would suggest trying to run the script as the Zabbix Agent user to see if it runs correctly or not. Also, increase the timeout on the Zabbix Server configuration.

      Please note that if the scrupt takes more than about 5 seconds it is better to do it as a cron job, writing the results to a file that Zabbix Agent will read, or having the cron job call zabbix_sender to post the data to the Zabbix Server.
      Unofficial Zabbix Developer

      Comment

      • abille
        Junior Member
        • Feb 2007
        • 9

        #4
        UserParameter and PHP

        hi,
        thanks for your answer but this have already been tested
        and all works fine.

        doing an echo "1"; doesn't take so much time.

        answer is immediate when running as user zabbix or testing with zabbix_agentd -t toto.test

        Comment

        • abille
          Junior Member
          • Feb 2007
          • 9

          #5
          UserParameter and PHP

          Hi all,
          No more suggestions for this problem ?
          nobody uses php scripts to extend zabbix ?

          any suggestions are welcome...
          thanks

          Comment

          • steff
            Junior Member
            • Jul 2006
            • 19

            #6
            have you tried :

            UserParameter=toto.test,/usr/bin/php /zabbix/toto.php

            ( rename it to .php )

            Comment

            • abille
              Junior Member
              • Feb 2007
              • 9

              #7
              UserParameter and PHP

              yes, i tried, but does not work

              Comment

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

                #8
                Try echo "1\n";. Not sure about 1.1.2 but it made difference in some old releases.
                Alexei Vladishev
                Creator of Zabbix, Product manager
                New York | Tokyo | Riga
                My Twitter

                Comment

                • abille
                  Junior Member
                  • Feb 2007
                  • 9

                  #9
                  UserParameter and PHP

                  i tried but same problem

                  Comment

                  • abille
                    Junior Member
                    • Feb 2007
                    • 9

                    #10
                    UserParameter and PHP

                    I tried on another system, and it works.
                    so, it's probably a specific problem on this server (RHEL3 PPC) .
                    i'll investigate and inform the forum when i find a solution.

                    thanks anyway for all answers

                    Comment

                    • abille
                      Junior Member
                      • Feb 2007
                      • 9

                      #11
                      UserParameter and PHP

                      Ok, it works
                      it was a problem with the php exe.
                      php was compiled as cgi and cli and the cgi exe does not work but
                      the cli exe works.

                      so it was a specific problem, not a zabbix issue.

                      thanks for all help

                      Comment

                      Working...