Integration of Alertmanager with SMS Drivers and Telegram as a Receiver In Automation Suite

How to integrate Alertmanager with Sachet SMS drivers and use Telegram as a receiver?

Issue Description:

Users within a Rancher environment may want to configure the SMS receiver in the Alert Manager to receive SMS notifications for any alerts triggered by their Automation Suite resources. The following example uses telegram as the sms provider for the rancher-sachet sms driver. Reference the sachet's example config.yaml for other provider configurations.


Resolution:

Step One: Install the sanchet sms drivers for Rancher

  1. Navigate to the UiPath Installer Directory:
cd /opt/UiPathAutomationSuite/Installer

  1. Make a directory named 'rancher-charts':
mkdir rancher-charts
  1. Clone the Rancher charts repository
git clone https://github.com/rancher/charts.git rancher-charts/
  1. Modify the rancher-sachet chart values.yaml file:
    1. Open the values.yaml file in your preferred text editor. In this example we will use vi
vi ./rancher-charts/packages/rancher-alerting/rancher-sachet/charts/values.yaml
  1. Locate the sachet section and replace it with the following template below, filling in the values for your token, receiver name and chat id accordingly.
sachet:
  providers:
    telegram:
      #telegram bot token
      token: "6623715986:AAFHfxVnuu2jl2trkAZ4SZe4sXgeNlc7v-w"t
  receivers:
      #receiver name created in AlertManager
    - name: "telegram-receiver"
      provider: "telegram"   
    to:
#the chat id
    - "6538647433"
      text: '{{ .GroupLabels.alertname }} @ {{ .Labels.instance }}: {{ .Status | toUpper }}'

image.png

  1. Install the rancher-sanchet helm chart:
./bin/helm install -n cattle-monitoring-system rancher-alerting-drivers-sachet ./rancher-charts/packages/rancher-alerting/rancher-sachet/charts/

image.png

*** Reference https://github.com/messagebird/sachet/blob/master/examples/config.yaml



Step Two: Configure the Alert Manager Receiver
Method One: Using the AlertManagerConfig

  1. Log in to your Rancher UI and navigate to 'Monitoring > Alerting > AlertmanagerConfigs' and click the 'Create' button

image.png

  1. Click the 'Edit as YAML' button at the. bottom of the screen

image.png

  1. Using the template below, provide the values for the following fields: token, receiver's name, and to.

image.png


Example Alertmanager Configuration:
** Ensure that the receiver's name in Alertmanager matches exactly with what's defined in Sachet's configuration.

apiVersion: monitoring.coreos.com/v1alpha1
kind: AlertmanagerConfig
metadata:
  annotations:
    field.cattle.io/description: asd
  creationTimestamp: "2023-10-08T16:33:14Z"
  generation: 8
  managedFields:
  - apiVersion: monitoring.coreos.com/v1alpha1
    fieldsType: FieldsV1
    fieldsV1:
      f:metadata:
        f:annotations:
          .: {}
          f:field.cattle.io/description: {}
      f:spec:
        .: {}
        f:receivers: {}
        f:route:
          .: {}
          f:continue: {}
          f:matchers: {}
          f:receiver: {}
    manager: rancher
    operation: Update
    time: "2023-10-09T01:24:07Z"
  name: alerts
  namespace: cattle-monitoring-system
  resourceVersion: "4028430"
  uid: a83ef54c-5f6f-4a1e-be35-8b905769590a
spec:
  receivers:
  #ENSURE NAME MATCHES RANCHER-SACHET CHART VALUE.YAML
  - name: telegram-receiver
  route:
    continue: true
    matchers:
    - name: severity
      value: warning|critical
  #ENSURE NAME MATCHES RANCHER-SACHET CHART VALUE.YAML 
    receiver: telegram-receiver


image.png


Method Two: Using 'Routes and Receivers'

  1. Log in to your Rancher UI and navigate to 'Monitoring > Alerting > AlertmanagerConfigs' and click the 'Create' button

image.png

  1. Under the Alertmanager tab, click "Add Receiver."
  2. Name your receiver, for example, “ms-teams,” and select “webhook” as the type.

image.png

image.png

image.png


image.png

image.png

image.png


Verify that the Helm release is installed:

  1. helm list -n cattle-monitoring-system

  1. c. Go to “Tools” > “Alerting,” and enable alerting if it is not already enabled.