alertmanagermeshtastic


Namealertmanagermeshtastic JSON
Version 2023.8.3.3 PyPI version JSON
download
home_pagehttps://github.com/Apfelwurm/alertmanagermeshtastic
SummaryA proxy to forward messages received via HTTP to MESHTASTIC
upload_time2023-08-03 19:17:54
maintainer
docs_urlNone
authorAlexander Volz
requires_python>=3.7
licenseMIT
keywords meshtastic webhook
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Alertmanager webhook for meshtastic

[![linux/amd64](https://github.com/Apfelwurm/alertmanagermeshtastic/actions/workflows/build-linux-image.yml/badge.svg)](https://github.com/Apfelwurm/alertmanagermeshtastic/actions/workflows/build-linux-image.yml)
[![dockerhub](https://img.shields.io/badge/dockerhub-images-important.svg?logo=Docker)](https://hub.docker.com/r/apfelwurm/alertmanagermeshtastic)
[![github](https://img.shields.io/badge/github-repository-important.svg?logo=Github)](https://github.com/Apfelwurm/alertmanagermeshtastic)
[![pypi](https://img.shields.io/badge/pypi-package-important.svg?logo=Pypi)](https://pypi.org/project/alertmanagermeshtastic)


This little Adapter receives alertmanager webhooks and sends the notifications via a over serial attached Meshtastic device to the specified nodeID.

> **Warning**
> Caution: The Tests that are provided for the code in this repository are not currently updated! Also this is a quickly hacked together peace of software, that has not built any security in it at the moment. Also the way that the ack is checked is not optimal, so messages tend to take longer to get to the device, but are delivered for sure(maybe multiple times). If you have the skill and the time to contribute in any way, take a look at the [Contribution section](#contribution)

## Credits
This is based on the work of https://github.com/homeworkprod/weitersager
Thanks to [GUVWAF](https://github.com/GUVWAF) for the support and thanks to the whole meshtastic team for this awsome software!

##  Alertmanager configuration example

```
	receivers:
	- name: 'meshtastic-webhook'
	  webhook_configs:
	  - url: http://alertmanager-meshtastic:9119/alert
	    send_resolved: true
```

## config.toml example

This is an example config, that shows all of the config options.

```
log_level = "debug"

[http]
host = "0.0.0.0"
port = 9119

[meshtastic.connection]
tty = "/tmp/vcom0"
nodeid = 631724152
maxsendingattempts = 30
timeout = 60
```


##  docker compose service example - Hardware Serial (default)

To integrate this bridge into your composed prometheus/alertmanager cluster, this is a good startingpoint.

```
    alertmanagermeshtastic:
      image: apfelwurm/alertmanagermeshtastic
      ports:
        - 9119:9119
      devices:
        -/dev/ttyACM0
      volumes:
        - ./alertmanager-meshtastic/config.toml:/app/config.toml
      restart: always
```

##  docker compose service example - Virtual Serial

To integrate this bridge into your composed prometheus/alertmanager cluster, this is a good startingpoint.
If you plan to use a virtual serial port that is provided with socat you have to use the socat connector in this container or run your alertmanagermeshtastic instance on the terminating linux machine, because the reconnecting is not working if you either mount it as volume or as a device.

```
    alertmanagermeshtastic:
      image: apfelwurm/alertmanagermeshtastic
      ports:
        - 9119:9119
      environment:
        - SOCAT_ENABLE=TRUE
        - SOCAT_CONNECTION=tcp:192.168.178.46:5000
      volumes:
        - ./alertmanager-meshtastic/config.toml:/app/config.toml
      restart: always
```

Note: If you set SOCAT_ENABLE to TRUE, the tty option from [meshtastic.connection] in config.toml will be overwritten with /tmp/vcom0 as thats the virtual serial port.

##  Running on docker example - Hardware Serial (default)

```
    docker run -d --name alertmanagermeshtastic \
		--device=/dev/ttyACM0 \
		-v ./alertmanager-meshtastic/config.toml:/app/config.toml \
    -p 9119:9119 apfelwurm/alertmanagermeshtastic:latest
```

##  Running on docker example - Virtual Serial

If you plan to use a virtual serial port that is provided with socat you have to use the socat connector in this container or run your alertmanagermeshtastic instance on the terminating linux machine, because the reconnecting is not working if you either mount it as volume or as a device.

```
    docker run -d --name alertmanagermeshtastic \
		--env SOCAT_ENABLE=TRUE --env SOCAT_CONNECTION=tcp:192.168.178.46:5000 \
		-v ./alertmanager-meshtastic/config.toml:/app/config.toml \
    -p 9119:9119 apfelwurm/alertmanagermeshtastic:latest
```
Note: If you set SOCAT_ENABLE to TRUE, the tty option from [meshtastic.connection] in config.toml will be overwritten with /tmp/vcom0 as thats the virtual serial port.

## Contribution

This is currently a minimal implementation that supports only a single node as a receiver. If you need additional features, you are welcome to open an issue, or even better, submit a pull request. You can also take a look on the opened Issues, where i have opened some for planned features and work on them if you want. I would appreciate any help.


## Example to test

You can use the test.sh or the test single.sh or the following curl command to test alertmanager-meshtastic
```
	curl -XPOST --data '{"status":"resolved","groupLabels":{"alertname":"instance_down"},"commonAnnotations":{"description":"i-0d7188fkl90bac100 of job ec2-sp-node_exporter has been down for more than 2 minutes.","summary":"Instance i-0d7188fkl90bac100 down"},"alerts":[{"status":"resolved","labels":{"name":"olokinho01-prod","instance":"i-0d7188fkl90bac100","job":"ec2-sp-node_exporter","alertname":"instance_down","os":"linux","severity":"page"},"endsAt":"2019-07-01T16:16:19.376244942-03:00","generatorURL":"http://pmts.io:9090","startsAt":"2019-07-01T16:02:19.376245319-03:00","annotations":{"description":"i-0d7188fkl90bac100 of job ec2-sp-node_exporter has been down for more than 2 minutes.","summary":"Instance i-0d7188fkl90bac100 down"}}],"version":"4","receiver":"infra-alert","externalURL":"http://alm.io:9093","commonLabels":{"name":"olokinho01-prod","instance":"i-0d7188fkl90bac100","job":"ec2-sp-node_exporter","alertname":"instance_down","os":"linux","severity":"page"}}' http://alertmanager-meshtastic:9119/alert
```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/Apfelwurm/alertmanagermeshtastic",
    "name": "alertmanagermeshtastic",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": "",
    "keywords": "meshtastic,webhook",
    "author": "Alexander Volz",
    "author_email": "github@volzit.de",
    "download_url": "https://files.pythonhosted.org/packages/5f/5f/569a4ca5f621499848aa0a3584c661d65fed44a1f8420356d8e12b1190a6/alertmanagermeshtastic-2023.8.3.3.tar.gz",
    "platform": "any",
    "description": "# Alertmanager webhook for meshtastic\n\n[![linux/amd64](https://github.com/Apfelwurm/alertmanagermeshtastic/actions/workflows/build-linux-image.yml/badge.svg)](https://github.com/Apfelwurm/alertmanagermeshtastic/actions/workflows/build-linux-image.yml)\n[![dockerhub](https://img.shields.io/badge/dockerhub-images-important.svg?logo=Docker)](https://hub.docker.com/r/apfelwurm/alertmanagermeshtastic)\n[![github](https://img.shields.io/badge/github-repository-important.svg?logo=Github)](https://github.com/Apfelwurm/alertmanagermeshtastic)\n[![pypi](https://img.shields.io/badge/pypi-package-important.svg?logo=Pypi)](https://pypi.org/project/alertmanagermeshtastic)\n\n\nThis little Adapter receives alertmanager webhooks and sends the notifications via a over serial attached Meshtastic device to the specified nodeID.\n\n> **Warning**\n> Caution: The Tests that are provided for the code in this repository are not currently updated! Also this is a quickly hacked together peace of software, that has not built any security in it at the moment. Also the way that the ack is checked is not optimal, so messages tend to take longer to get to the device, but are delivered for sure(maybe multiple times). If you have the skill and the time to contribute in any way, take a look at the [Contribution section](#contribution)\n\n## Credits\nThis is based on the work of https://github.com/homeworkprod/weitersager\nThanks to [GUVWAF](https://github.com/GUVWAF) for the support and thanks to the whole meshtastic team for this awsome software!\n\n##  Alertmanager configuration example\n\n```\n\treceivers:\n\t- name: 'meshtastic-webhook'\n\t  webhook_configs:\n\t  - url: http://alertmanager-meshtastic:9119/alert\n\t    send_resolved: true\n```\n\n## config.toml example\n\nThis is an example config, that shows all of the config options.\n\n```\nlog_level = \"debug\"\n\n[http]\nhost = \"0.0.0.0\"\nport = 9119\n\n[meshtastic.connection]\ntty = \"/tmp/vcom0\"\nnodeid = 631724152\nmaxsendingattempts = 30\ntimeout = 60\n```\n\n\n##  docker compose service example - Hardware Serial (default)\n\nTo integrate this bridge into your composed prometheus/alertmanager cluster, this is a good startingpoint.\n\n```\n    alertmanagermeshtastic:\n      image: apfelwurm/alertmanagermeshtastic\n      ports:\n        - 9119:9119\n      devices:\n        -/dev/ttyACM0\n      volumes:\n        - ./alertmanager-meshtastic/config.toml:/app/config.toml\n      restart: always\n```\n\n##  docker compose service example - Virtual Serial\n\nTo integrate this bridge into your composed prometheus/alertmanager cluster, this is a good startingpoint.\nIf you plan to use a virtual serial port that is provided with socat you have to use the socat connector in this container or run your alertmanagermeshtastic instance on the terminating linux machine, because the reconnecting is not working if you either mount it as volume or as a device.\n\n```\n    alertmanagermeshtastic:\n      image: apfelwurm/alertmanagermeshtastic\n      ports:\n        - 9119:9119\n      environment:\n        - SOCAT_ENABLE=TRUE\n        - SOCAT_CONNECTION=tcp:192.168.178.46:5000\n      volumes:\n        - ./alertmanager-meshtastic/config.toml:/app/config.toml\n      restart: always\n```\n\nNote: If you set SOCAT_ENABLE to TRUE, the tty option from [meshtastic.connection] in config.toml will be overwritten with /tmp/vcom0 as thats the virtual serial port.\n\n##  Running on docker example - Hardware Serial (default)\n\n```\n    docker run -d --name alertmanagermeshtastic \\\n\t\t--device=/dev/ttyACM0 \\\n\t\t-v ./alertmanager-meshtastic/config.toml:/app/config.toml \\\n    -p 9119:9119 apfelwurm/alertmanagermeshtastic:latest\n```\n\n##  Running on docker example - Virtual Serial\n\nIf you plan to use a virtual serial port that is provided with socat you have to use the socat connector in this container or run your alertmanagermeshtastic instance on the terminating linux machine, because the reconnecting is not working if you either mount it as volume or as a device.\n\n```\n    docker run -d --name alertmanagermeshtastic \\\n\t\t--env SOCAT_ENABLE=TRUE --env SOCAT_CONNECTION=tcp:192.168.178.46:5000 \\\n\t\t-v ./alertmanager-meshtastic/config.toml:/app/config.toml \\\n    -p 9119:9119 apfelwurm/alertmanagermeshtastic:latest\n```\nNote: If you set SOCAT_ENABLE to TRUE, the tty option from [meshtastic.connection] in config.toml will be overwritten with /tmp/vcom0 as thats the virtual serial port.\n\n## Contribution\n\nThis is currently a minimal implementation that supports only a single node as a receiver. If you need additional features, you are welcome to open an issue, or even better, submit a pull request. You can also take a look on the opened Issues, where i have opened some for planned features and work on them if you want. I would appreciate any help.\n\n\n## Example to test\n\nYou can use the test.sh or the test single.sh or the following curl command to test alertmanager-meshtastic\n```\n\tcurl -XPOST --data '{\"status\":\"resolved\",\"groupLabels\":{\"alertname\":\"instance_down\"},\"commonAnnotations\":{\"description\":\"i-0d7188fkl90bac100 of job ec2-sp-node_exporter has been down for more than 2 minutes.\",\"summary\":\"Instance i-0d7188fkl90bac100 down\"},\"alerts\":[{\"status\":\"resolved\",\"labels\":{\"name\":\"olokinho01-prod\",\"instance\":\"i-0d7188fkl90bac100\",\"job\":\"ec2-sp-node_exporter\",\"alertname\":\"instance_down\",\"os\":\"linux\",\"severity\":\"page\"},\"endsAt\":\"2019-07-01T16:16:19.376244942-03:00\",\"generatorURL\":\"http://pmts.io:9090\",\"startsAt\":\"2019-07-01T16:02:19.376245319-03:00\",\"annotations\":{\"description\":\"i-0d7188fkl90bac100 of job ec2-sp-node_exporter has been down for more than 2 minutes.\",\"summary\":\"Instance i-0d7188fkl90bac100 down\"}}],\"version\":\"4\",\"receiver\":\"infra-alert\",\"externalURL\":\"http://alm.io:9093\",\"commonLabels\":{\"name\":\"olokinho01-prod\",\"instance\":\"i-0d7188fkl90bac100\",\"job\":\"ec2-sp-node_exporter\",\"alertname\":\"instance_down\",\"os\":\"linux\",\"severity\":\"page\"}}' http://alertmanager-meshtastic:9119/alert\n```\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A proxy to forward messages received via HTTP to MESHTASTIC",
    "version": "2023.8.3.3",
    "project_urls": {
        "Changelog": "https://github.com/Apfelwurm/alertmanagermeshtastic/releases",
        "Homepage": "https://github.com/Apfelwurm/alertmanagermeshtastic",
        "Source code": "https://github.com/Apfelwurm/alertmanagermeshtastic"
    },
    "split_keywords": [
        "meshtastic",
        "webhook"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "15018f0dcae6c612693c43845d269622a9d6be8bfe672912be2850e9be506d10",
                "md5": "1952159d0d4e65650e532757fd42e831",
                "sha256": "6a60d42847a71bad90e8e9ac7e218d7fdf3b7143778c2448cecde7403b23280f"
            },
            "downloads": -1,
            "filename": "alertmanagermeshtastic-2023.8.3.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "1952159d0d4e65650e532757fd42e831",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 14125,
            "upload_time": "2023-08-03T19:17:53",
            "upload_time_iso_8601": "2023-08-03T19:17:53.319181Z",
            "url": "https://files.pythonhosted.org/packages/15/01/8f0dcae6c612693c43845d269622a9d6be8bfe672912be2850e9be506d10/alertmanagermeshtastic-2023.8.3.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "5f5f569a4ca5f621499848aa0a3584c661d65fed44a1f8420356d8e12b1190a6",
                "md5": "f163f2a7e3c8bb91a193284df19255a6",
                "sha256": "b3df559efabe8e7f151dc8b6bfdcf2db382d5296510463828d0497c33faedd18"
            },
            "downloads": -1,
            "filename": "alertmanagermeshtastic-2023.8.3.3.tar.gz",
            "has_sig": false,
            "md5_digest": "f163f2a7e3c8bb91a193284df19255a6",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 16709,
            "upload_time": "2023-08-03T19:17:54",
            "upload_time_iso_8601": "2023-08-03T19:17:54.839554Z",
            "url": "https://files.pythonhosted.org/packages/5f/5f/569a4ca5f621499848aa0a3584c661d65fed44a1f8420356d8e12b1190a6/alertmanagermeshtastic-2023.8.3.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-08-03 19:17:54",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "Apfelwurm",
    "github_project": "alertmanagermeshtastic",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [],
    "lcname": "alertmanagermeshtastic"
}
        
Elapsed time: 0.12029s