Answer the question
In order to leave comments, you need to log in
Is there a rule somewhere for elastalert to monitor postgres?
Good day! Tell me if it is possible to make a request to postgres with tlastalert, something like SELECT * FROM table LIMIT 1 to know if the database is alive, maybe someone has a rule, thanks in advance!
Answer the question
In order to leave comments, you need to log in
The problem was that the flatline type rules are triggered when the threshold value is passed. That is, if at the time of adding or updating the elastalert rule, the number of documents was already below the threshold parameter, then the alert will not be sent.
Working example below
es_host: <ELASTIC HOST>
es_port: 9200
# es_username: elastic
# es_password: changeme
name: ":warning:WARNING : POSTGRES probably unavailable:warning:"
description: "postgres probably unavailable"
severity: "warning"
index: app-prod-metrics*
filter:
- query:
query_string:
query: "postgresql.activity.query: \"SELECT * FROM pg_stat_database\""
type: flatline
threshold: 4
timeframe:
minutes: 1
realert:
seconds: 10
query_key: postgresql.activity.query
alert:
- "telegram"
alert_text: "
Too few metrics from\n
*Postgres on Host* : host name\n
*ElastAlert Node* : alert host name"
alert_text_type: alert_text_only
telegram_bot_token: <TOKEN>
telegram_room_id: "@<CHAT_ID>"
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question