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
- Navigate to the UiPath Installer Directory:
cd /opt/UiPathAutomationSuite/Installer
- Make a directory named 'rancher-charts':
mkdir rancher-charts
- Clone the Rancher charts repository
git clone https://github.com/rancher/charts.git rancher-charts/
- Modify the rancher-sachet chart values.yaml file:
- 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
- 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 }}'
- 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/
*** Reference https://github.com/messagebird/sachet/blob/master/examples/config.yaml
Step Two: Configure the Alert Manager Receiver
Method One: Using the AlertManagerConfig
- Log in to your Rancher UI and navigate to 'Monitoring > Alerting > AlertmanagerConfigs' and click the 'Create' button
- Click the 'Edit as YAML' button at the. bottom of the screen
- Using the template below, provide the values for the following fields: token, receiver's name, and to.
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
Method Two: Using 'Routes and Receivers'
- Log in to your Rancher UI and navigate to 'Monitoring > Alerting > AlertmanagerConfigs' and click the 'Create' button
- Under the Alertmanager tab, click "Add Receiver."
- Name your receiver, for example, “ms-teams,” and select “webhook” as the type.
Verify that the Helm release is installed:
- helm list -n cattle-monitoring-system
- c. Go to “Tools” > “Alerting,” and enable alerting if it is not already enabled.