An open API service indexing awesome lists of open source software.

https://github.com/2boom-ua/check_services

Script monitors the status of systemd services on a Linux machine. It checks the services managed by systemd, sending notifications through various messaging services when changes occur. Support Telegram, Discord, Gotify, Ntfy, Slack, Pushbullet, Pushover, Rocket.chat, Matrix, Mattermost, Pumble, Flock, Zulip, Apprise, Webntfy, Custom
https://github.com/2boom-ua/check_services

apprise discord flock gotify linux-service mattermost ntfy pumble push-notifications pushbullet pushover python rocketchat self-hosted slack telegram webntfy zulip

Last synced: about 1 month ago
JSON representation

Script monitors the status of systemd services on a Linux machine. It checks the services managed by systemd, sending notifications through various messaging services when changes occur. Support Telegram, Discord, Gotify, Ntfy, Slack, Pushbullet, Pushover, Rocket.chat, Matrix, Mattermost, Pumble, Flock, Zulip, Apprise, Webntfy, Custom

Awesome Lists containing this project

README

          

## Service Monitoring



### Overview

This Python script monitors the status of system services on a Linux machine. It checks the services managed by `systemd`, forwarding notifications through various messaging services when the crevice status changes detected.

### Features

- **Service Status Monitoring:** Regularly checks if specified services are active or inactive.
- **Real-time notifications with support for multiple accounts** via:
- Telegram, Discord, Slack, Gotify, Ntfy, Pushbullet, Pushover, Rocket.chat
- Matrix, Mattermost, Floc, Pumble, Zulip, Apprise, Webntfy, Custom webhook
- **Configuration:** Easily configurable through JSON files for notification settings.
- **Polling Period:** Adjustable polling interval to check service status.

### View
https://your_domain_name or http://server_ip:5152

### Requirements
- Python 3.x
- Dependencies: `requests`, `schedule`

### Config Notification
Easily configure your settings with the [Multi-Platform Notification JSON Creator.](https://github.com/2boom-ua/mpn_json)

### Edit config.json:
You can use any name and any number of records for each messaging platform configuration, and you can also mix platforms as needed. The number of message platform configurations is unlimited.

[Configuration examples for Telegram, Discord, Matrix, Apprise, Pumble, Mattermost, Discord, Ntfy, Gotify, Zulip, Flock, Slack, Rocket.Chat, Pushover, Pushbullet, Webntfy](docs/json_message_config.md)
```
"CUSTOM_NAME": {
"ENABLED": false,
"WEBHOOK_URL": [
"first url",
"second url",
"...."
],
"HEADER": [
{first JSON structure},
{second JSON structure},
{....}
],
"PAYLOAD": [
{first JSON structure},
{second JSON structure},
{....}
],
"FORMAT_MESSAGE": [
"markdown",
"html",
"...."
]
},
```
| Item | Required | Description |
|------------|------------|------------|
| ENABLED | true/false | Enable or disable Custom notifications |
| WEBHOOK_URL | url | The URL of your Custom webhook |
| HEADER | JSON structure | HTTP headers for each webhook request. This varies per service and may include fields like {"Content-Type": "application/json"}. |
| PAYLOAD | JSON structure | The JSON payload structure for each service, which usually includes message content and format. Like as {"body": "message", "type": "info", "format": "markdown"}|
| FORMAT_MESSAGE | markdown,
html,
text,
simplified | Specifies the message format used by each service, such as markdown, html, or other text formatting.|

- **markdown** - a text-based format with lightweight syntax for basic styling (Pumble, Mattermost, Discord, Ntfy, Gotify),
- **simplified** - simplified standard Markdown (Telegram, Zulip, Flock, Slack, RocketChat).
- **html** - a web-based format using tags for advanced text styling,
- **text** - raw text without any styling or formatting.

```
"STARTUP_MESSAGE": true,
"DEFAULT_DOT_STYLE": true,
"NOTIFY_ENABLED": true
```

| Item | Required | Description |
|------------|------------|------------|
| STARTUP_MESSAGE | true/false | On/Off startup message. |
| DEFAULT_DOT_STYLE | true/false | Round/Square dots. |
| NOTIFY_ENABLED | true/false | On/Off notification via messaging platforms. |

### Clone the repository:
```
git clone https://github.com/2boom-ua/check_services.git
cd check_services
```
### Install required Python packages:
```
pip install -r requirements.txt
```
### Dowload and edit config.json
```bash
curl -L -o ./config.json https://raw.githubusercontent.com/2boom-ua/check_services/main/config.json
```

### Running as a Linux Service
You can set this script to run as a Linux service for continuous monitoring.

Create a systemd service file:
```
nano /etc/systemd/system/check_services.service
```
Add the following content:
```
[Unit]
Description=Services State Change Monitor
After=multi-user.target

[Service]
Type=simple
Restart=always
ExecStartPre=/bin/sleep 30
ExecStart=/usr/bin/python3 /opt/check_services/check_services.py

[Install]
WantedBy=multi-user.target
```
```
systemctl daemon-reload
```
```
systemctl enable check_services.service
```
```
systemctl start check_services.service
```
### License

This project is licensed under the MIT License - see the [MIT License](https://opensource.org/licenses/MIT) for details.

### Author

- **2boom** - [GitHub](https://github.com/2boom-ua)