Ad Widget

Collapse

Sms alert using http api

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Balaraju
    Member
    • Jun 2016
    • 40

    #1

    Sms alert using http api

    Hi team,

    i am very new to zabbix. i want to configure sms alert using http API. I have tried the below script but i am not getting proper reply. In body i am not getting proper details. Can anybody help on below script.


    #!/bin/bash
    to=$1
    subject=$2
    body=`echo "Hostname: {HOST.NAME}, Trigger severity: {TRIGGER.SEFERITY}, {ITEM.NAME}: {ITEM.VALUE}"`
    textconvert=$(echo "$2 $body" | tr -s " " "+")
  • Balaraju
    Member
    • Jun 2016
    • 40

    #2
    Sms alert using http api

    Hi team,

    Can any body help on sms alert.

    Comment

    • davidlime
      Junior Member
      • Dec 2022
      • 1

      #3
      Sending SMS messages using an HTTP API involves making an HTTP request to a server with the necessary information to send the message. The server will then send the message through the SMS gateway to the designated recipient.

      To send an SMS message using an HTTP API, you will need to:
      1. Obtain an API key or access token from the SMS provider. This will be used to authenticate your request to the server.
      2. Construct the HTTP request to the server with the necessary parameters. These may include the recipient's phone number, the message text, and any other relevant information.
      3. Send the HTTP request to the server using a programming language or tool of your choice. This could be done using a library like requests in Python or by manually constructing the request using a tool like curl.
      4. Handle the response from the server. This may include checking for any errors or verifying that the message was sent successfully.

      Here is an example of how you might use the Python requests library to send an SMS message using an HTTP API:

      Code:
      import requests
      
      # Set the API endpoint URL and the necessary parameters
      api_url = "https://api.example.com/send_sms"
      params = {
          "to": "+1234567890",
          "text": "Hello, this is a test message!",
          "api_key": "your_api_key_here"
      }
      
      # Make the request to the server
      response = requests.post(api_url, params=params)
      
      # Check the status code of the response
      if response.status_code == 200:
          print("Message sent successfully!")
      else:
          print("Error sending message:", response.text)
      ​

      Keep in mind that the specific steps and parameters required to send an SMS message using an HTTP API will depend on the SMS provider you are using. Be sure to consult their documentation for more information.

      Source: https://smsala.com/bulk-sms-uk/

      Comment

      • Yafimm
        Junior Member
        • May 2022
        • 9

        #4
        To configure Zabbix to send SMS alerts using an HTTP API, you will need to set up an SMS gateway that supports HTTP API integration. There are many SMS gateways available that support HTTP API integration and the specific steps for setting up SMS alerts will depend on the SMS gateway you choose.

        Here are the general steps you can follow to set up SMS alerts using an HTTP API in Zabbix:
        1. Choose an SMS gateway that supports HTTP API integration and sign up for an account.
        2. Obtain the necessary credentials, such as an API key or username and password, from the SMS gateway.
        3. In the Zabbix web interface, go to Administration > Media Types and click "Create media type".
        4. Select "Script" as the Type, enter a name for the media type (e.g. "SMS via HTTP API"), and enter the script that will be used to send the SMS message through the HTTP API. The script will typically include the necessary API calls and authentication information. Consult the documentation for your SMS gateway for more information on the specific API calls and parameters that are required.
        5. Save the media type and then go to Administration > Users and select the user for whom you want to configure SMS alerts.
        6. Click on the "Media" tab and add a new media with the "SMS via HTTP API" media type you just created.
        7. Specify the phone number to which the SMS alerts should be sent, and enter the necessary parameters (e.g. API key, username and password) in the "Send to" field.
        8. Save the changes and then go to Configuration > Actions and create a new action or edit an existing one.
        9. In the "Send to" field, select the "SMS via HTTP API" media type you created earlier, and specify the conditions under which the action should be triggered.
        10. Save the action and test it to ensure that SMS alerts are being sent correctly.

        Note that the specific steps and details may vary depending on the SMS gateway you are using and the version of Zabbix you are running. Consult the documentation for your SMS gateway and Zabbix for more information.

        Comment

        • rons4
          Junior Member
          • Jan 2020
          • 15

          #5
          Alternatively you also might want to use the ready-made integration with SIGNL4 (https://www.zabbix.com/integrations/signl4) which also offers SMS and voice-call alerting if needed.

          Comment

          Working...