https://github.com/roaldnefs/deucalion
A tool for querying a Prometheus instance for alerts and run commands based on the result.
https://github.com/roaldnefs/deucalion
prometheus
Last synced: about 1 month ago
JSON representation
A tool for querying a Prometheus instance for alerts and run commands based on the result.
- Host: GitHub
- URL: https://github.com/roaldnefs/deucalion
- Owner: roaldnefs
- License: gpl-3.0
- Created: 2019-03-24T20:04:26.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2020-05-06T17:56:21.000Z (about 5 years ago)
- Last Synced: 2025-02-15T01:28:30.362Z (3 months ago)
- Topics: prometheus
- Language: Go
- Homepage:
- Size: 1.57 MB
- Stars: 3
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://travis-ci.org/roaldnefs/deucalion)
[](https://godoc.org/github.com/roaldnefs/deucalion)
[](https://github.com/roaldnefs/deucalion/releases)
[](https://github.com/roaldnefs/deucalion/blob/master/LICENSE)Named after the son of Prometheus. A tool for querying a Prometheus instance for alerts and run commands based on the result.
* [Installation](README.md#installation)
* [Binaries](README.md#binaries)
* [Via Go](README.md#via-go)
* [Usage](README.md#usage)
* [Configuration](README.md#configuration)
* [Scheduled run](README.md#scheduled-run)
* [Prerequisites](README.md#prerequisites)## Installation
### Binaries
For installation instructions from binaries please visit the [Releases Page](https://github.com/roaldnefs/deucalion/releases).
### Via Go
```console
$ go get github.com/roaldnefs/deucalion
```## Usage
```console
$ deucalion -h
A tool for querying a Prometheus instance for alerts and run commands based on the result.Usage:
deucalion [flags]Flags:
--config string config file (default is $HOME/.deucalion.yaml)
-d, --debug enable debug logging
-f, --firing string command to execute when alerts are firing
-h, --help help for deucalion
--severity string the severity label
-s, --silent string command to execute when alerts aren't firing
-u, --url string Promtheus URL (default "http://localhost:9090/")
-w, --warning string command to execute when alerts are firing and below specified severity
```## Configuration
The configuration file (`--config`) is written as follows:
```yaml
---
url:
firing:
warning:
silent:
severity:
```## Examples
Examples can be found in the `examples` directory. Having a very basic deucalion.yaml file, which should be placed in `$HOME/.deucalion.yaml`, and a `mousitoring.sh` script that can change the colours of Steelseries rival mice.
## Scheduled run
We recommend running the service and timer as your own user, and therefore suggest you run them in systemd user mode. To achieve this, please do the following:
### Prerequisites
```console
mkdir -p ~/.local/share/systemd/user
```Create the required files:
`~/.local/share/systemd/user/deucalion.service`:```console
[Unit]
Description=Deucalion run
After=syslog.target network-online.target
Wants=network-online.target[Service]
Type=simple
ExecStart=/usr/local/bin/deucalion
Restart=always
RestartSec=10[Install]
WantedBy=multi-user.target
````~/.local/share/systemd/user/deucalion.timer`:
```console
[Unit]
Description=Run Deucalion every minute[Timer]
Persistent=false
OnBootSec=80
OnCalendar=minutely
Unit=deucalion.service[Install]
WantedBy=timers.target
```This requires you have `deucalion` installed in `/usr/local/bin/deucalion`. But obviously, feel free to change the path. The timer will run the command every minute, using the user given in the commands below.
To enable and start the timer, please run the following commands:
```console
systemctl --user daemon-reload
systemctl --user enable --now deucalion.timer
```Check if the timer has been loaded properly:
```console
systemctl --user list-timers --all
```