-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: Update README and documentation
- Loading branch information
1 parent
45324b0
commit 1719aea
Showing
2 changed files
with
191 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,88 @@ | ||
# cachethq-prometheus | ||
CachetHQ Prometheus webhooks | ||
|
||
<h1 align="center">Prometheus-CachetHQ</h1> | ||
|
||
[![CircleCI](https://circleci.com/gh/oxyno-zeta/prometheus-cachethq/tree/master.svg?style=svg)](https://circleci.com/gh/oxyno-zeta/prometheus-cachethq/tree/master) [![Go Report Card](https://goreportcard.com/badge/github.com/oxyno-zeta/prometheus-cachethq)](https://goreportcard.com/report/github.com/oxyno-zeta/prometheus-cachethq) [![GolangCI](https://golangci.com/badges/github.com/oxyno-zeta/prometheus-cachethq.svg)](https://golangci.com) [![Coverage Status](https://coveralls.io/repos/github/oxyno-zeta/prometheus-cachethq/badge.svg?branch=master)](https://coveralls.io/github/oxyno-zeta/prometheus-cachethq?branch=master) ![Docker Pulls](https://img.shields.io/docker/pulls/oxynozeta/prometheus-cachethq.svg) [![GitHub license](https://img.shields.io/github/license/oxyno-zeta/prometheus-cachethq)](https://github.com/oxyno-zeta/prometheus-cachethq/blob/master/LICENSE) ![GitHub release (latest by date)](https://img.shields.io/github/v/release/oxyno-zeta/prometheus-cachethq) | ||
|
||
Prometheus alerts to CachetHQ | ||
|
||
- [Features](#features) | ||
- [Configuration](#configuration) | ||
- [Setup](#setup) | ||
- [Prometheus Alertmanager](#prometheus-alertmanager) | ||
- [Deploy](#deploy) | ||
- [Configuration](#configuration-1) | ||
- [Kubernetes - Helm](#kubernetes---helm) | ||
- [Docker](#docker) | ||
- [Thanks](#thanks) | ||
- [Author](#author) | ||
- [License](#license) | ||
|
||
## Features | ||
|
||
- Filter Prometheus alerts by name or labels | ||
- Change CachetHQ component status | ||
- Allow to create incident for component | ||
- Manage resolved alert for component or incident | ||
|
||
## Configuration | ||
|
||
See here: [Configuration](./docs/configuration.md) | ||
|
||
## Setup | ||
|
||
### Prometheus Alertmanager | ||
|
||
Just put a new receiver in your alertmanager configuration: | ||
|
||
```yaml | ||
route: | ||
... | ||
receivers: | ||
- name: cachethq-receiver | ||
webhook_configs: | ||
- url: http://prometheus-cachet-domain:8080/prometheus/wehbook | ||
send_resolved: true | ||
``` | ||
|
||
Add also a new route to send alert to prometheus-cachethq: | ||
|
||
```yaml | ||
route: | ||
... | ||
routes: | ||
- receiver: cachethq-receiver | ||
continue: true | ||
# match: ... | ||
``` | ||
|
||
### Deploy | ||
|
||
#### Configuration | ||
|
||
See configuration values [here](./docs/configuration.md) | ||
|
||
#### Kubernetes - Helm | ||
|
||
TODO | ||
|
||
#### Docker | ||
|
||
First, write the configuration file in a config folder. That one will be mounted. | ||
|
||
Run this command: | ||
|
||
```shell | ||
docker run -d --name prometheus-cachethq -p 8080:8080 -p 9090:9090 -v $PWD/config:/config oxynozeta/prometheus-cachethq | ||
``` | ||
|
||
## Thanks | ||
|
||
- My wife BH to support me doing this | ||
|
||
## Author | ||
|
||
- Oxyno-zeta (Havrileck Alexandre) | ||
|
||
## License | ||
|
||
Apache 2.0 (See in LICENSE) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
# Configuration | ||
|
||
The configuration must be set in a YAML file located in `conf/` folder from the current working directory. The file name is `config.yaml`. | ||
The full path is `conf/config.yaml`. | ||
|
||
You can see a full example in the [Example section](#example) | ||
|
||
## Main structure | ||
|
||
| Key | Type | Required | Default | Description | | ||
| ------- | --------------------------------------------- | -------- | ------- | ----------------------- | | ||
| log | [LogConfiguration](#logconfiguration) | No | None | Log configurations | | ||
| server | [ServerConfiguration](#serverconfiguration) | No | None | Server configurations | | ||
| cachet | [CachetConfiguration](#cachetconfiguration) | Yes | None | CachetHQ configurations | | ||
| targets | [[TargetConfiguration]](#targetconfiguration) | Yes | None | Targets configurations | | ||
|
||
## LogConfiguration | ||
|
||
| Key | Type | Required | Default | Description | | ||
| ------ | ------ | -------- | ------- | --------------------------------------------------- | | ||
| level | String | No | `info` | Log level | | ||
| format | String | No | `json` | Log format (available values are: `json` or `text`) | | ||
|
||
## ServerConfiguration | ||
|
||
| Key | Type | Required | Default | Description | | ||
| ---------- | ------- | -------- | ------- | -------------- | | ||
| listenAddr | String | No | "" | Listen Address | | ||
| port | Integer | No | `8080` | Listening Port | | ||
|
||
## CachetConfiguration | ||
|
||
| Key | Type | Required | Default | Description | | ||
| ------ | ------ | -------- | ------- | ---------------- | | ||
| url | String | Yes | None | CachetHQ URL | | ||
| apiKey | String | Yes | None | CachetHQ API Key | | ||
|
||
## TargetConfiguration | ||
|
||
| Key | Type | Required | Default | Description | | ||
| --------- | ------------------------------------------------------------- | -------- | ------- | ------------------------------ | | ||
| component | [TargetComponentConfiguration](#targetcomponentconfiguration) | Yes | None | Target component for CachetHQ | | ||
| alerts | [[TargetAlertConfiguration]](#targetalertconfiguration) | Yes | None | Target prometheus alert filter | | ||
| incident | [TargetIncidentConfiguration](#targetincidentconfiguration) | No | None | Target incident for CachetHQ | | ||
|
||
## TargetComponentConfiguration | ||
|
||
| Key | Type | Required | Default | Description | | ||
| ------ | ------ | -------- | ------- | ------------------------------------------------------------------------------------------- | | ||
| name | String | Yes | None | CachetHQ Component name | | ||
| status | String | Yes | None | CachetHQ Component status (OPERATIONAL, PERFORMANCE_ISSUES, PARTIAL_OUTAGE or MAJOR_OUTAGE) | | ||
|
||
## TargetAlertConfiguration | ||
|
||
| Key | Type | Required | Default | Description | | ||
| ------ | ----------------- | ---------------------------------- | ------- | ----------------------- | | ||
| name | String | Required if labels are not present | "" | Prometheus Alert name | | ||
| labels | Map[String]String | Required if name isn't present | None | Prometheus Alert labels | | ||
|
||
## TargetIncidentConfiguration | ||
|
||
| Key | Type | Required | Default | Description | | ||
| ------- | ------ | -------- | ------- | ----------------------------------------------------------------------- | | ||
| name | String | Yes | None | CachetHQ Incident name | | ||
| content | String | Yes | None | CachetHQ Incident content | | ||
| status | String | Yes | None | CachetHQ Incident status (INVESTIGATING, IDENTIFIED, WATCHING or FIXED) | | ||
| public | Bool | No | `false` | CachetHQ Incident must be public | | ||
|
||
## Example | ||
|
||
```yaml | ||
# Log configuration | ||
log: | ||
# Log level | ||
level: info | ||
# Log format | ||
format: text | ||
|
||
# Server configurations | ||
# server: | ||
# listenAddr: "" | ||
# port: 8080 | ||
|
||
# Cachet configuration | ||
cachet: | ||
url: http://localhost | ||
apiKey: API_KEY | ||
|
||
# Targets | ||
targets: | ||
- component: | ||
name: COMPONENT_NAME | ||
status: PARTIAL_OUTAGE | ||
alerts: | ||
- name: SERVICE_OFFLINE | ||
# - labels: | ||
# label1: value1 | ||
# incident: | ||
# name: "" | ||
# content: "" | ||
# status: INVESTIGATING | ||
# public: true | ||
``` |