Ad Widget

Collapse

SMS -> Don't get mad, get help (erm, even)

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • DiedX
    Senior Member
    • Oct 2004
    • 106

    #1

    SMS -> Don't get mad, get help (erm, even)

    Ok,

    I've come very far with Zabbix at this moment, and we are planning to move from Nagios to Zabbix.

    This leaves one point to be fixed at the moment, and that is sending SMS.

    I work with TrueSenses. They have a perfect cURL (HTTPS) interface, which just works.
    With cURL I've made the following script:

    /home/zabbix/bin/sms/sendsms.sh:
    ===
    #!/bin/sh

    curl -d "ACCOUNT=DEV&PASSWORD=NO&NUMBER=00316&MESSAGE=$1&O RIGIN=DiedX.NL&CMD=SENDMESSAGE" https://secure.simmcomm.ch/cgi-bin/smsgateway.cgi
    ===

    This works with 1 variable: text.

    However, the logfiles show the error allready:

    ===
    011578:20041008:190825 Error executing [/home/zabbix/bin///home/zabbix/bin/sms/s
    endsms.sh test] []
    ===

    The config has the following line:

    /home/zabbix/bin/sms/sendsms.sh test

    aargh!

    What to do?!
    https://www.diederik.nl
  • Alexei
    Founder, CEO
    Zabbix Certified Trainer
    Zabbix Certified SpecialistZabbix Certified Professional
    • Sep 2004
    • 5654

    #2
    Incorrect config

    Do the following:

    Set up parameter AlertScriptsPath in zabbix_suckerd.conf. It your case it has to be set to /home/zabbix/bin/sms

    In Media Type definition, use short name of the script, i.e. sendsms.sh

    I hope this helps.
    Alexei Vladishev
    Creator of Zabbix, Product manager
    New York | Tokyo | Riga
    My Twitter

    Comment

    • DiedX
      Senior Member
      • Oct 2004
      • 106

      #3
      Alexei,

      Thanks for the very swift reply!

      Originally posted by Alexei
      Do the following:

      Set up parameter AlertScriptsPath in zabbix_suckerd.conf. It your case it has to be set to /home/zabbix/bin/sms

      In Media Type definition, use short name of the script, i.e. sendsms.sh

      I hope this helps.
      Ok, learned something again

      However, it is not THE solution. The logfile now gives:

      018364:20041008:203327 Error executing [/home/zabbix/bin//sendsms.sh test] []
      018410:20041008:203357 Error executing [/home/zabbix/bin//sendsms.sh test] []
      018478:20041008:203457 Error executing [/home/zabbix/bin//sendsms.sh test] []
      018584:20041008:203527 Error executing [/home/zabbix/bin//sendsms.sh test] []


      For completeness, the complete zabbix_suckerd:


      # This is config file for zabbix_suckerd
      # To get more information about Zabbix,
      # go http://zabbix.sourceforge.net

      ############ GENERAL PARAMETERS #################

      # Number of pre-forked instances of zabbix_suckerd
      # Default value is 5
      # This parameter must be between 5 and 255
      StartSuckers=5

      # How often Zabbix will perform housekeeping procedure
      # (in hours)
      # Default value is 1 hour
      # Housekeeping is removing unnecessary information from
      # tables history, laert, and alarms
      # This parameter must be between 1 and 24

      HousekeepingFrequency=1

      # How often Zabbix will try to send unsent alerts
      # (in seconds)
      # Default value is 30 seconds
      SenderFrequency=30

      # Uncomment this line to disable housekeeping procedure

      #DisableHousekeeping=1

      # Specifies debug level
      # 0 - debug is not created
      # 1 - critical information
      # 2 - error information
      # 3 - warnings (default)
      # 4 - for debugging (produces lots of information)

      DebugLevel=3

      # Specifies how long we wait for agent (in sec)
      # Must be between 1 and 30
      Timeout=5

      # Name of PID file

      PidFile=/var/tmp/zabbix_suckerd.pid

      # Name of log file
      # If not set, syslog is used

      LogFile=/tmp/zabbix_suckerd.log

      #Location for custom alert scripts
      AlertScriptsPath=/home/zabbix/bin

      #Location of 'fping. Default is /usr/sbin/fping
      FpingLocation=/usr/sbin/fping

      # Frequency of ICMP pings. Defauls is 30 second.
      PingerFrequency=30

      # Database host name
      # Default is localhost

      DBHost=localhost

      # Database name

      DBName=zabbix

      # Database user

      DBUser=zabbix

      # Database password
      # Comment this line if no password used

      DBPassword=WORKS

      # Connect to MySQL using Unix socket?

      DBSocket=/var/run/mysqld/mysqld.sock

      # Experimental options. Use with care !

      # Get rid of sockets in TIME_WAIT state
      # This will set socket option SO_LINGER
      NoTimeWait=1


      I'm looking for rights, but I guess that the logging says it isn't my evening tonight
      https://www.diederik.nl

      Comment

      • Alexei
        Founder, CEO
        Zabbix Certified Trainer
        Zabbix Certified SpecialistZabbix Certified Professional
        • Sep 2004
        • 5654

        #4
        Hmm... What is the test after sendsms.sh? You have to specify script name, without any command line parameters.

        By the way, have you checked permissions of the script?
        Alexei Vladishev
        Creator of Zabbix, Product manager
        New York | Tokyo | Riga
        My Twitter

        Comment

        • DiedX
          Senior Member
          • Oct 2004
          • 106

          #5
          Ok, I removed test.

          The main problem is that the init.d scripts didn't funtion well. The process was said to exit, but they were still there, using the old directives

          ATM: I'm recieving my first SMS'es. Now the next part: the parameters
          Can you use help on the manual?
          https://www.diederik.nl

          Comment

          • Alexei
            Founder, CEO
            Zabbix Certified Trainer
            Zabbix Certified SpecialistZabbix Certified Professional
            • Sep 2004
            • 5654

            #6
            ZABBIX passes Recipient, Subject and Message as first, second and third command line parameter respectively.

            You may use $1,$2,$3 in your shell script.
            Alexei Vladishev
            Creator of Zabbix, Product manager
            New York | Tokyo | Riga
            My Twitter

            Comment

            • DiedX
              Senior Member
              • Oct 2004
              • 106

              #7
              Ok,

              To resume:

              the problem was the AlertScriptsPath in zabbix_suckerd.conf. I had a trailing / after AlertScriptsPath.

              The problem was fixed by Alexei very swift (thanks again!), but the start-stop script was not running well, leaving suckerd on. (Which had it's old config).
              After stopping via start-stop scripts, and killall suckerd, the configuration was being re-read. This solved the problem.

              For your idea: the manual is 100% correct

              Case closed
              https://www.diederik.nl

              Comment

              • Alexei
                Founder, CEO
                Zabbix Certified Trainer
                Zabbix Certified SpecialistZabbix Certified Professional
                • Sep 2004
                • 5654

                #8
                Good

                I like it!
                Alexei Vladishev
                Creator of Zabbix, Product manager
                New York | Tokyo | Riga
                My Twitter

                Comment

                Working...