Skip to main content

Read messages in a MQTT topic and create PagerDuty alerts

Project description

mqtt-to-pagerduty

Read from a MQTT topic and generate a alert in PagerDuty.

GitHub Super-Linter

Installation

Direct install

pip install mqtt_to_pagerduty

Docker

docker pull unixorn/mqtt-to-pagerduty

Configuration

mqtt-to-pagerduty looks for a yaml configuration file in ~/.hass-tools/mqtt-to-pagerduty.yaml, or /config/mqtt-to-pagerduty.yaml when run in a container.

Configuration example

pagerduty-api-token: XYZZY
mqtt-server: mqtt.example.com
topic: hass/alerts
default-sender: your_pd_user@example.com
service_id: XYZZY

Tools

mqtt-alerter

Creates an alert message and writes it to a MQTT topic for processing by mqtt-topic-to-pd.

usage: mqtt-alerter [-h] [-d] [-l {DEBUG,INFO,ERROR,WARNING,CRITICAL}] [--settings-file SETTINGS_FILE] [--sender SENDER]
                    [--mqtt-server MQTT_SERVER] --title TITLE --service-id SERVICE_ID [--message MESSAGE] [--topic TOPIC]

Emit messages into a MQTT topic

optional arguments:
  -h, --help            show this help message and exit
  -d, --debug           Debug setting
  -l {DEBUG,INFO,ERROR,WARNING,CRITICAL}, --log-level {DEBUG,INFO,ERROR,WARNING,CRITICAL}
                        set log level
  --settings-file SETTINGS_FILE, --settings SETTINGS_FILE
                        Path to settings file. Settings in the file are overridden by command line options
  --sender SENDER       Email address to send alerts from
  --mqtt-server MQTT_SERVER
                        MQTT Server to use
  --title TITLE         Message title
  --service-id SERVICE_ID
                        PagerDuty service ID to alert
  --message MESSAGE     Message to send
  --topic TOPIC         MQTT topic to write to

mqtt-topic-to-pd

Listens to a MQTT topic and when it sees an alert message, creates a corresponding PagerDuty alert.

usage: mqtt-topic-to-pd [-h] [--api-token API_TOKEN] [-l {DEBUG,INFO,ERROR,WARNING,CRITICAL}] [--settings-file SETTINGS_FILE]
                        [--duration DURATION] [--sender SENDER] [--service-id SERVICE_ID] [--mqtt-server MQTT_SERVER]
                        [--topic TOPIC]

Read an MQTT queue and create PagerDuty alerts

optional arguments:
  -h, --help            show this help message and exit
  --api-token API_TOKEN
                        PagerDuty api token
  -l {DEBUG,INFO,ERROR,WARNING,CRITICAL}, --log-level {DEBUG,INFO,ERROR,WARNING,CRITICAL}
                        set log level
  --settings-file SETTINGS_FILE, --settings SETTINGS_FILE
                        Path to settings file. Settings in the file are overridden by command line options
  --duration DURATION   How long to read the topic, in seconds
  --sender SENDER       Email address to send alerts from
  --service-id SERVICE_ID
                        Service ID to create an alert
  --mqtt-server MQTT_SERVER
                        MQTT server
  --topic TOPIC         MQTT topic to read

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mqtt-to-pagerduty-0.2.1.tar.gz (9.6 kB view details)

Uploaded Source

Built Distribution

mqtt_to_pagerduty-0.2.1-py3-none-any.whl (15.8 kB view details)

Uploaded Python 3

File details

Details for the file mqtt-to-pagerduty-0.2.1.tar.gz.

File metadata

  • Download URL: mqtt-to-pagerduty-0.2.1.tar.gz
  • Upload date:
  • Size: 9.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.12 CPython/3.9.7 Darwin/21.3.0

File hashes

Hashes for mqtt-to-pagerduty-0.2.1.tar.gz
Algorithm Hash digest
SHA256 fc1aac867a7496003d117b167dbf97a54c2467f5aa05d711d7b926bbc5ba23a0
MD5 c1c9d472852bf57d6f4c09c6e70f21b5
BLAKE2b-256 1bd760b02b4bfe265f2b35f783bd81351373674e4539ae240809acfc01c70088

See more details on using hashes here.

File details

Details for the file mqtt_to_pagerduty-0.2.1-py3-none-any.whl.

File metadata

File hashes

Hashes for mqtt_to_pagerduty-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 14471e2517b1166bcf5173aab365e1330c1e3e9087b0fa8cc25ecdfaa3cf642b
MD5 aabd89d74e112215cf68221c56676faa
BLAKE2b-256 597d3268d03872d8745f3cc229f87c3b8195877c5fbcce4f293dffcba6065ecd

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page