Ad Widget

Collapse

zabbix and sms [no modem]

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ipirva
    Junior Member
    • Jul 2006
    • 5

    #1

    zabbix and sms [no modem]

    I would like to reopen the subject. I use Zabbix 1.1.1
    I saw the possibility to use smssend + clickatell ans I did try smssend clickatell -install but did not work, it tried to connect to planet-d.net:80, but all the tries were looping.
    I tried to use Media type Script with the PHP clickatell SMS class from http://sourceforge.net/projects/sms-api/ as following:
    - I defined Media Type Script - > send_sms.sh

    #!/bin/bash
    /usr/bin/php -f /home/zabbix/bin/send_sms_php.php $1 $2 $3

    - I defined Configurations -> Users -> Media (Send To: +phonenumberwithcountrycode)

    send_sms_php.php

    #!/usr/bin/php
    <?php
    require_once ("/home/zabbix/bin/sms_api.php"); -- this is from sourceforge
    $mysms = new sms();
    echo $mysms->session;
    echo $mysms->getbalance();
    $tel=$argv[1];
    $sub=$argv[2];
    $mess=$argv[3];
    $mysms->send ($tel,$sub,$mess);
    ?>

    But it didn't work, although Monitoring -> Actions said "Sent"

    I did succed to send SMS directly from console using the above scripts as:
    ./send_sms.sh phonenumber subject message

    I would appreciate any help,
    Thank you.
    Last edited by ipirva; 04-08-2006, 19:26. Reason: review
  • ipirva
    Junior Member
    • Jul 2006
    • 5

    #2
    give up

    I won't give up, I am not going to buy a GSM

    Comment

    • ddrager
      Junior Member
      • Aug 2006
      • 13

      #3
      I like you am trying the clickatell script. However, I found the files I needed to install it (thank you, google cache!!!). PM me if you'd like more details.

      I have the script working from command line, it is pretty straightforward:

      Code:
      [zabbix@web bin]$ /home/zabbix/bin//sms.sh 1XXXXXXXXXX testing testing
      val:10
      val:10
      Result : message sent
      [zabbix@web bin]$
      I receive the message fine on my cell. Notice I am running under the zabbix user and I am able to access the script fine. I have it set to 777 for now, just for testing.

      However, the message from zabbix is never sent. I receive this message in the debug log:

      Code:
      007415:20061013:100445 In execute_action()
      007415:20061013:100445 Before execl([/home/zabbix/bin/],[sms.sh])
      008378:20061013:100445 Before executing [/home/zabbix/bin//sms.sh] [Permission denied]
      007415:20061013:100445 End of execute_action()
      007415:20061013:100445 Alert ID [2270] was sent successfully
      Now sure on that one. Permissions seem to be set up correctly and working. I could not find any info on how zabbix_server executes the script to see if there is a pre-requisite to executing this script.

      In case you need it, here is the source for sms.sh:

      Code:
      #!/bin/bash
      smssend clickatell.sms USER PASS APIID ZABBIX $1 "$2\0A\0A$3"
      Any insight would be appreciated!
      Last edited by ddrager; 13-10-2006, 17:08.

      Comment

      • ddrager
        Junior Member
        • Aug 2006
        • 13

        #4
        Problem solved.... In my sms.sh script I simply had "smssend" - I needed the full path to fix the issue. Now it works great!!!

        Comment

        Working...