Ad Widget

Collapse

Clickatell, Zabbix and Media Type

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ittec
    Member
    • Mar 2008
    • 73

    #1

    Clickatell, Zabbix and Media Type

    Hi again

    one of my last adventures with Zabbix is the alerts by SMS. I know there are some info on forum and wiki. I have tested all ways. Only script that worked for my was using smssend binary and Clickatell SMS Gateway service.

    I can tell that my service is working currently, almost, when I have executed it on console.

    But...unfortuneatly for me, don't work when Zabbix call script. I have followed the steps to make a script:

    1. On zabbix_server.conf I have:

    Code:
    # Location for custom alert scripts
    AlertScriptsPath=/home/zabbix/bin
    2. I have created the script:

    Code:
    -bash-3.2# ls -ls /home/zabbix/bin/
    total 28
    4 -rwxrwxrwx 1 zabbix zabbix 484 Jun  4 15:55 sms.sh
    3. cat /home/zabbix/bin/sms.sh

    Code:
    #!/bin/bash
    # Script to send SMS messages from Zabbix
    # $1 is the phone number, $2 is the subject and $3 is the message
    # \0A is a hexadecimal code that gives a CR to your cell phone message
    
    /usr/local/bin/smssend clickatell.sms USER PASSWORD API_ID API_NAME $1 "$2\0A\0A$3"
    4. I have created a new Media Type and the action on one host, when a trigger has a problem, action send a message to Admin. One is the SMS. ... but

    5. On Zabbix_server.log I have noticed the next error:
    Code:
    5548:20090604:165807 Error executing [/home/zabbix/bin/sms.sh] [Permission denied]
    6. /home/zabbix/bin is owned by zabbix user and has 777 on every level....

    7. When I run script on console, it works! So I have to get Zabbix run sms.sh without no errors to get sms send to users.

    One more time, every help will be great
    Thanks!

    PS:

    8. I check the script on other way and it also works

    -bash-3.2# sms.sh NUMBER_OF_CELL hello hello
    Last edited by ittec; 04-06-2009, 17:28.
  • Calimero
    Senior Member
    • Nov 2006
    • 481

    #2
    Originally posted by ittec
    7. When I run script on console, it works! So I have to get Zabbix run sms.sh without no errors to get sms send to users.
    Did you run it as zabbix (su - zabbix ; ~/bin/sms.sh) ?

    Comment

    • ittec
      Member
      • Mar 2008
      • 73

      #3
      Interesting

      Hi Calimero

      maybe I have forgot something because when I test your suggest:

      Code:
      -bash-3.2# su - zabbix
      su: warning: cannot change directory to /home/zabbix: Permission denied
      -bash: /home/zabbix/.bash_profile: Permission denied
      Im not sure but it not seems to be the perfect message

      Zabbix user:

      cat /etc/passwd
      zabbix:x:500:500::/home/zabbix:/bin/bash
      Home Zabbix user:

      -bash-3.2$ ls -ls /home/
      total 4
      4 drw-rw-rw- 3 zabbix zabbix 4096 Mar 13 12:09 zabbix
      Is it right?
      Last edited by ittec; 04-06-2009, 17:25.

      Comment

      • Calimero
        Senior Member
        • Nov 2006
        • 481

        #4
        chown -R zabbix:zabbix /home/zabbix
        chmod 0755 /home/zabbix /home/zabbix/bin /home/zabbix/bin/sms.php

        Comment

        • ittec
          Member
          • Mar 2008
          • 73

          #5
          Thanks!

          Thanks Calimero

          the problem was in permissions on /home/zabbix/bin

          Last week finally I got SMS messages from Zabbix

          Best regards,

          Ittec

          Comment

          Working...