Skip to content
Snippets Groups Projects
Commit 39067998 authored by void's avatar void
Browse files

telegram template und testscript

parent f120037a
No related branches found
No related tags found
No related merge requests found
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
with_items: with_items:
- { path: /srv/alerta/alerta_secret_key, length: 24 } - { path: /srv/alerta/alerta_secret_key, length: 24 }
- { path: /srv/alerta/alerta_oauth_client_secret, length: -1 } - { path: /srv/alerta/alerta_oauth_client_secret, length: -1 }
- { path: /srv/alerta/alerta_token, length: -1 }
- { path: /srv/alerta/telegram_token, length: -1 } - { path: /srv/alerta/telegram_token, length: -1 }
- { path: /srv/alerta/telegram_chatid, length: -1 } - { path: /srv/alerta/telegram_chatid, length: -1 }
...@@ -25,8 +26,19 @@ ...@@ -25,8 +26,19 @@
- docker-compose.yml - docker-compose.yml
- alertad.conf - alertad.conf
- config.js - config.js
- telegram.txt
notify: restart alerta docker notify: restart alerta docker
- name: Script-Dateien erstellen
template:
src: "{{ item }}"
dest: "/srv/alerta/{{ item }}"
mode: "o+rwx"
with_items:
- testalert.sh
- name: start alerta docker - name: start alerta docker
docker_service: docker_service:
project_src: /srv/alerta/ project_src: /srv/alerta/
......
...@@ -22,7 +22,4 @@ CUSTOMER_VIEWS = False ...@@ -22,7 +22,4 @@ CUSTOMER_VIEWS = False
TELEGRAM_TOKEN = '{{ telegram_token }}' TELEGRAM_TOKEN = '{{ telegram_token }}'
TELEGRAM_CHAT_ID = '{{ telegram_chatid }}' TELEGRAM_CHAT_ID = '{{ telegram_chatid }}'
TELEGRAM_WEBHOOK_URL = 'https://alerta.warpzone.ms/api/webhooks/telegram' TELEGRAM_TEMPLATE = "/app/telegram.txt"
...@@ -12,6 +12,7 @@ services: ...@@ -12,6 +12,7 @@ services:
- 0.0.0.0:42008:8080 - 0.0.0.0:42008:8080
volumes: volumes:
- /srv/alerta/alertad.conf:/app/alertad.conf - /srv/alerta/alertad.conf:/app/alertad.conf
- /srv/alerta/telegram.txt:/app/telegram.txt
- /srv/alerta/config.js:/web/config.js - /srv/alerta/config.js:/web/config.js
depends_on: depends_on:
- db - db
......
{% raw %}
{% if customer %}Customer: `{{customer}}` {% endif %}
*[{{ status.capitalize() }}] {{ environment }} {{ severity.capitalize() }}*
aa{{ event | replace("_","\_") }} {{ resource.capitalize() }}
```
{{ text }}
```
https://alerta.warpzone.ms/#/alert/{{ id }}
{% endraw %}
\ No newline at end of file
#!/bin/sh
curl -XPOST https://alerta.warpzone.ms/api/alert \
-H 'Authorization: Key {{alerta_token}}' \
-H 'Content-type: application/json' \
-d '{
"attributes": {
"region": "EU"
},
"correlate": [
"HttpServerError",
"HttpServerOK"
],
"environment": "warpzone",
"event": "HttpServerError",
"group": "Web",
"origin": "curl",
"resource": "web01",
"service": [
"example.com"
],
"severity": "major",
"tags": [
"dc1"
],
"text": "Site is down.",
"type": "exceptionAlert",
"value": "Bad Gateway (501)"
}'
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment