Ad Widget

Collapse

zabbix 3.2 send sms script can not use

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • lee62817
    Junior Member
    • Mar 2016
    • 4

    #1

    zabbix 3.2 send sms script can not use

    my ISP sms php script name is send_text.php


    PHP Code:
    <?php



    include "sms2.inc";

    error_reporting (E_ALL);

    echo 
    "<h2> test </h2>\n";

    /* Socket to Air Server IP ,Port */
    $server_ip '202.39.54.130';
    $server_port 8000;
    $TimeOut=10;

    $user_acc  "acc";
    $user_pwd  "pwd";
    $mobile_number"myphone";
    $message"";



    $mysms = new sms2();
    $ret_code $mysms->create_conn($server_ip$server_port$TimeOut$user_acc$user_pwd);
    $ret_msg $mysms->get_ret_msg();

    if(
    $ret_code==0){ 
          echo 
    "ok\"."<br>\n";
          
          
    $ret_code = $mysms->send_text($mobile_number$message);
          
    $ret_msg = $mysms->get_ret_msg();
          if(
    $ret_code==0){
               echo "
    ok\"."<br>";
             echo "
    ret_code=".$ret_code."<br>\n";
             echo "
    ret_msg=".$ret_msg."<br>\n";
          }else{
               echo "
    error"."<br>\n";
             echo "
    ret_code=".$ret_code."<br>\n";
             echo "
    ret_msg=".$ret_msg."<br>\n";
          }
    } else {  
          echo "
    error"."<br>\n";
          echo "
    ret_code=".$ret_code."<br>\n";
          echo "
    ret_msg=".$ret_msg."<br>\n";
    }


    $mysms->close_conn();
    ?>
    my phone is 0963XXXXXX
    i setup media type ;user's media....
    but can not send sms to my phone
    pls help me to fix ,tks





  • vso
    Zabbix developer
    • Aug 2016
    • 190

    #2
    Have you tried to invoke script using a command line ? Does it work ?

    Comment

    • lee62817
      Junior Member
      • Mar 2016
      • 4

      #3
      Originally posted by vso
      Have you tried to invoke script using a command line ? Does it work ?
      i use command line can send sms to my phone
      but zabbix can not send sms to my phone

      Comment

      • vso
        Zabbix developer
        • Aug 2016
        • 190

        #4
        Originally posted by lee62817
        i use command line can send sms to my phone
        but zabbix can not send sms to my phone
        Is your script located in the directory defined in the Zabbix server configuration file AlertScriptsPath variable ?

        Comment

        • Atsushi
          Senior Member
          • Aug 2013
          • 2028

          #5
          I think that it is necessary to start PHP script using php command.

          ex.
          Code:
          $ php send_text.php
          Try to call it from a script that can be executed directly from a shell such as a shell script.

          Comment

          • lee62817
            Junior Member
            • Mar 2016
            • 4

            #6
            i can see action log ,but still not send to my phone

            [/URL]

            Comment

            • nobodysu
              Member
              • Sep 2016
              • 84

              #7
              Probably the same problem:

              Comment

              • lee62817
                Junior Member
                • Mar 2016
                • 4

                #8
                I set PATH run again but still only sned to mail ;not sned to my phone!

                how can i find error at log?

                Comment

                • vso
                  Zabbix developer
                  • Aug 2016
                  • 190

                  #9
                  Originally posted by lee62817
                  I set PATH run again but still only sned to mail ;not sned to my phone!

                  how can i find error at log?
                  If you try some small shell script that would just write to file does it work ? Or only your script does not work ? Please try. If simple script works then insert your script invocation script that zabbix can launch

                  Also please see documentation https://www.zabbix.com/documentation...s/media/script

                  It has example script that you can use and integrate your script inside it as in example
                  Last edited by vso; 17-02-2017, 21:48.

                  Comment

                  Working...