Ad Widget

Collapse

SMS script doesn't send SMSes on alert

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • alfredballe
    Junior Member
    • Jun 2018
    • 3

    #1

    SMS script doesn't send SMSes on alert

    I've got a script for sending SMSes with Nexmo.com, called sms.sh.

    This is my zabbix_server.conf parameter:
    AlertScriptsPath=/usr/lib/zabbix/alertscripts

    This is my /usr/lib/zabbix/alertscripts/sms.sh:

    #!/usr/bin/env bash

    /usr/bin/curl -X POST https://rest.nexmo.com/sms/json \
    -d api_key=$1 \
    -d api_secret=$2 \
    -d to=$3 \
    -d from=$4 \
    --data-urlencode "text=$5"

    This script works when manually calling it.

    I've done ​​​​​​​chown root:zabbix sms.sh and ​​​​​​​chmod 750 sms.sh on sms.sh.

    In Zabbix Dashboard I've updated the SMS Media Type to type "Script" with script name "​​​​​​​/usr/lib/zabbix/alertscripts/sms.sh" (also tried simply sms.sh), and have the 5 parameters.
    Also added the Media Type to my user.

    But... No SMSes are send on alerts.

    I've run:
    grep -r -i "sms" *
    in /var/log/zabbix, but there aren't found anything.

    ​​​​​​​What to do?
  • kernbug
    Senior Member
    • Feb 2013
    • 330

    #2
    Originally posted by alfredballe
    This script works when manually calling it.
    What to do?
    Is this script executed from the zabbix account?
    Code:
    ### example
    ​​​​​​​sudo -H -u zabbix bash -c 'echo "I am $USER, with uid $UID"'

    Comment

    • alfredballe
      Junior Member
      • Jun 2018
      • 3

      #3
      It is executable from the zabbix user. Just tested with
      sudo -H -u zabbix ./sms.sh

      That works.
      Last edited by alfredballe; 28-06-2018, 14:55.

      Comment

      Working...