Ad Widget

Collapse

Media type script URL SMS Sending

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • chrisg
    Junior Member
    • Aug 2015
    • 2

    #1

    Media type script URL SMS Sending

    Hallo Forum,
    I am running a Ubuntu 14.04.2 lts with zabbix 2.2.9 install from packages and am attempting to get a custom media type script to work. In the zabbix logs I have not found anything as well as the system logs. But I am also not the linux guru.
    This script (lcsmssend.sh) should call a internal url with wget in the zabbix web under monitoring events in the alerting and in the events it shows the status as sent however it is not. I can run the script from the terminal and it works running as a normal user no sudo. Have not figured out how to run it as the user zabbix, however the permissions group and owner are set to zabbix.
    #!/bin/bash
    #SMS with Lancom 1781
    to=$1
    subject=$2
    body=$3
    wget "http://username:[email protected]/sms/?<Param1>=<Value1>&.&oldauth&DestinationAddress=$1 &Content=$1%$2%$3%20Nachricht%2E"
    #
    Thanks in advance
    Chris
  • jamesNJ
    Senior Member
    • Jun 2015
    • 103

    #2
    You can set a password for the user 'zabbix', log in as root and then su - zabbix, and test your script directly as zabbix user account.

    Make sure in your action command that you specify the full path to the script. It may also help to code into the script something that dumps the environment and arguments passed to a file for review.

    Take note that if you invoke a script that contains entries (like subject) which contain spaces, these could be interpreted as separate arguments. Passing a single argument that includes multiple entries may need to be single or double quoted so that the shell knows the whole string is a single argument.

    Example:
    /home/zabbix/lcsmssend.sh "[email protected]" "subject with spaces" "body with multiple spaces"

    Comment

    • chrisg
      Junior Member
      • Aug 2015
      • 2

      #3
      Hello James,
      Thanks for the tips, yes I think the spaces are the reason that the Router is not sending the sms / text message. I managed to get it sending a message of “problem” or “ok” but parsing the hostname or the send to address seems to be keeping the message from sending.

      Comment

      Working...