am2pb

package module
v0.0.0-...-d44ef44 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 14, 2025 License: MIT Imports: 7 Imported by: 0

README

am2pb - Alertmanager to Pushbullet

Docker Repository on Quay

A simple service that listens for alerts from Alertmanager via the webhook receiver, and forwards them to Pushbullet.

This project was created to help me learn Go, do not use in production.

Usage

Grab a token from your Pushbullet account.

Docker/Podman

Start the server:

$ podman run --rm \
    -e BEARER_TOKEN=<pushbullet api key> \
    -p 5000:5000 \
    quay.io/carobb/am2pb

Configure Alertmanager to use a webhook endpoint and ensure the URL points to the exposed service from the previous step:

- name: "pb-receiver"
  webhook_configs:
  - url: http://127.0.0.1:5000/

Kubernetes

Update secret.yaml with your Pushbullet token. A sample Deployment and Service are included.

$ kubectl apply -k deploy -n <namespace>

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func StartServer

func StartServer(bearerToken string)

Types

type Alert

type Alert struct {
	Status       string            `json:"status"`
	Labels       map[string]string `json:"labels"`
	Annotations  map[string]string `json:"annotations"`
	StartsAt     string            `json:"startsAt"`
	EndsAt       string            `json:"endsAt"`
	GeneratorURL string            `json:"generatorURL"`

} // Alert represents a single alert from Alertmanager

Alertmanager - https://prometheus.io/docs/alerting/latest/configuration/#webhook_config

type AlertmanagerWebhook

type AlertmanagerWebhook struct {
	Status            string   `json:"status"`
	Version           string   `json:"version"`
	GroupKey          string   `json:"groupKey"`
	Receiver          string   `json:"receiver"`
	GroupLabels       struct{} `json:"groupLabels"`
	CommonLabels      struct{} `json:"commonLabels"`
	CommonAnnotations struct{} `json:"commonAnnotations"`
	ExternalURL       string   `json:"externalURL"`
	Alerts            []Alert  `json:"alerts"`

} // AlertmanagerWebhook represents the structure of an Alertmanager webhook payload

type PushbulletNote

type PushbulletNote struct {
	Body  string `json:"body"`
	Title string `json:"title"`
	Type  string `json:"type"`
}

Pushbullet note - https://docs.pushbullet.com/#parameters-for-different-types-of-pushes

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL