Page 2 of 2 FirstFirst 12
Results 11 to 16 of 16

Thread: sms with gammu

  1. #11
    Junior Member
    Join Date
    Apr 2012
    Posts
    18

    Re: sms with gammu

    [quote author=Seb-Solon link=topic=768.msg4376#msg4376 date=1361528689]
    I suggest you to try to launch manually your script and see what happens. We have to find where is the issue in the check -> alert -> notification -> send sms process.
    [/quote]
    I've already launched the script manually:
    /usr/bin/printf "%b" "****Nagios****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTALIAS$\nState: $HOSTSTATE$ FOR $HOSTDURATION$" | /usr/bin/gammu --sendsms TEXT (my phonenumber)

    I receive the sms like this:
    ****Nagios****

    Notification Type: $
    Host: $
    State: $ FOR $

    Permissions of the /usr/bin/gammu
    -rwxr-xr-x 1 root root 335408 Jul 12 2010 /usr/bin/gammu

  2. #12
    Junior Member
    Join Date
    Apr 2012
    Posts
    18

    Re: sms with gammu

    Still no solution for this :-\

  3. #13
    Administrator
    Join Date
    Jun 2011
    Posts
    216

    Re: sms with gammu

    Well, I can give a try to reproduce but I need your cfg files. Did you try to replace your sms script by something else. In order to be sure that the sms script the "issue"

  4. #14
    Junior Member
    Join Date
    Apr 2012
    Posts
    18

    Re: sms with gammu

    commands.cfg:

    define command{
    command_name host-notify-by-sms
    command_line /usr/bin/printf "%b" "NAGIOS / Host: "$HOSTNAME$" / State: $HOSTSTATE$ / Info:$HOSTOUTPUT$ / Date:$SHORTDATETIME$" | /usr/bin/gammu --sendsms TEXT $CONTACTPAGER$
    }

    define command{
    command_name notify-by-sms
    command_line /usr/bin/printf "%b" "NAGIOS / Host: "$HOSTALIAS$" / State: $SERVICESTATE$ / Info:$SERVICEOUTPUT$ / Date:$SHORTDATETIME$" | /usr/bin/gammu --sendsms TEXT $CONTACTPAGER$
    }


    We use templates to easily add a notify to a contact - templates.cfg:

    define contact{
    name generic-sms ; The name of this contact template
    service_notification_period 24x7 ; service notifications can be sent anytime
    host_notification_period 24x7 ; host notifications can be sent anytime
    service_notification_options c,w,r,u,f
    host_notification_options d,u,r,f,s ; send notifications for all host states, flapping events, and scheduled downtime events
    service_notification_commands notify-by-sms ; send service notifications via sms
    host_notification_commands host-notify-by-sms ; send host notifications via sms
    register 0 ; DONT REGISTER THIS DEFINITION - ITS NOT A REAL CONTACT, JUST A TEMPLATE!
    host_notifications_enabled 1
    service_notifications_enabled 1
    _SNMPPASS password
    host_notification_period 24x7
    service_notification_period 24x7
    pager +3247*******
    }


    in the folder contacts: usersms.cfg

    define contact{
    use generic-sms
    contact_name usersms
    alias (name)
    email *****@someemailaddress.com
    password TestUI
    pager +32473******
    }

  5. #15
    Administrator
    Join Date
    Jun 2011
    Posts
    216

    Re: sms with gammu

    Hi !

    I paste your cfg files into mine execpts for the usersms.cfg (i paste in etc/contacts.cfg) and I create my own /usr/bin/gammu

    Here is the code :

    Code:
    #!/bin/bash
    
    read TEXT
    mkdir /tmp/gammu_test_$(date +%s)
    
    eval "echo TEXT=$TEXT >> /tmp/gammu_test_$(date +%s).txt"
    eval "echo $* >> /tmp/gammu_test_$(date +%s).txt"
    
    exit 0

    root@ShinkenVM:/usr/local/shinken/etc# cat /tmp/gammu_test_1364468848.txt
    TEXT=NAGIOS / Host: fake_host / State: CRITICAL / Info:the INTERNET IZ DOWN / Date:28-03-2013 12:07:26
    --sendsms TEXT 3247*******,32473******
    If you look closely there is no '+' sign ate the begining. The '+' is interpreted by Shinken as "add this value to the parameter previously declared if it exist". Gammu wil get the "3247*******,32473******" as phone number and won't be able to send a sms

    Can you try with the 0032 insteand of +32 ?

  6. #16
    Junior Member
    Join Date
    Apr 2012
    Posts
    18

    Re: sms with gammu

    Tried to change it to 0032 for receiving sms messages. But still nothing. When i've tried it manually with the script i received an error message. "Unknown error"

    Afterwards when i just do it with the 047***** format it worked

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •