Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/2boom-ua/ip_check
This script monitors the system's external and internal IP addresses and sends notifications to various messaging platforms (e.g., Telegram, Discord, Gotify, Ntfy, Slack, Pushbullet, Pushover, Rocket.chat, Matrix, Mattermost, Pumble, Flock, Zulip, Apprise, Custom) when the external IP changes. Configuration settings from a config.json
https://github.com/2boom-ua/ip_check
apprise discord flock gotify matrix mattermost notifications ntfy pumble pushbullet pushover python self-hosted slack telegram zulip
Last synced: 7 days ago
JSON representation
This script monitors the system's external and internal IP addresses and sends notifications to various messaging platforms (e.g., Telegram, Discord, Gotify, Ntfy, Slack, Pushbullet, Pushover, Rocket.chat, Matrix, Mattermost, Pumble, Flock, Zulip, Apprise, Custom) when the external IP changes. Configuration settings from a config.json
- Host: GitHub
- URL: https://github.com/2boom-ua/ip_check
- Owner: 2boom-ua
- Created: 2024-10-05T06:02:02.000Z (about 1 month ago)
- Default Branch: main
- Last Pushed: 2024-10-24T08:17:44.000Z (15 days ago)
- Last Synced: 2024-10-25T04:46:35.829Z (14 days ago)
- Topics: apprise, discord, flock, gotify, matrix, mattermost, notifications, ntfy, pumble, pushbullet, pushover, python, self-hosted, slack, telegram, zulip
- Language: Python
- Homepage:
- Size: 107 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# ip_check
### Overview
This script monitors the system's external IP and internal IP addresses and sends notifications to various messaging platforms (e.g., Telegram, Discord, Gotify, Ntfy, Slack, Pushbullet, Pushover, Rocket.chat, Matrix, Mattermost, Pumble, Flock, Zulip, Apprise, Custom webhook) when the external IP changes. It reads configuration settings from a config.json file, including polling intervals and service tokens. The IP is checked periodically, and if a change is detected, an alert shall be sent via the configured messaging services.### 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
- Zulip
- Pumble
- Flock
- Apprise
- Custom webhook
- **Configuration:** Easily configurable through JSON files for notification settings and excluded services.
- **Polling Period:** Adjustable polling interval to check service status.### Requirements
- Python 3.x
- Docker installed and running
- Dependencies: `requests`, `schedule`### Clone the repository:
```
git clone https://github.com/2boom-ua/ip_check.git
cd check_services
```
### Install required Python packages:
```
pip install -r requirements.txt
```### Edit config.json:
A **config.json** file in the same directory as the script, and include your API tokens and configuration settings.
```
{
"TELEGRAM": {
"ENABLED": false,
"TOKENS": [
"first tocken",
"second tocken",
"...."
],
"CHAT_IDS": [
"first chat_id",
"second chat_id",
"...."
]
},
"DISCORD": {
"ENABLED": false,
"WEBHOOK_URLS": [
"first url",
"second url",
"...."
]
},
"SLACK": {
"ENABLED": false,
"WEBHOOK_URLS": [
"first url",
"second url",
"...."
]
},
"GOTIFY": {
"ENABLED": false,
"TOKENS": [
"first tocken",
"second tocken",
"...."
],
"CHAT_URLS": [
"first server_url",
"second server_url",
"...."
]
},
"NTFY": {
"ENABLED": false,
"WEBHOOK_URLS": [
"first url",
"second url",
"...."
]
},
"PUSHBULLET": {
"ENABLED": false,
"TOKENS": [
"first tocken",
"second tocken",
"...."
]
},
"PUSHOVER": {
"ENABLED": false,
"TOKENS": [
"first tocken",
"second tocken",
"...."
],
"USER_KEYS": [
"first user_key",
"second user_key",
"...."
]
},
"MATRIX": {
"ENABLED": false,
"TOKENS": [
"first tocken",
"second tocken",
"...."
],
"SERVER_URLS": [
"first server_url",
"second server_url",
"...."
],
"ROOM_IDS": [
"!first room_id",
"!second room_id",
"...."
]
},
"MATTERMOST": {
"ENABLED": false,
"WEBHOOK_URLS": [
"first url",
"second url",
"...."
]
},
"ROCKET": {
"ENABLED": false,
"TOKENS": [
"first tocken",
"second tocken",
"...."
],
"USER_IDS": [
"first user_id",
"second user_id",
"...."
],
"SERVER_URLS": [
"first server_url",
"second server_url",
"...."
],
"CHANNEL_IDS": [
"#first channel",
"#second channel",
"...."
]
},
"FLOCK": {
"ENABLED": false,
"WEBHOOK_URLS": [
"first url",
"second url",
"...."
]
},
"PUMBLE": {
"ENABLED": false,
"WEBHOOK_URLS": [
"first url",
"second url",
"...."
]
},
"ZULIP": {
"ENABLED": false,
"WEBHOOK_URLS": [
"first url",
"second url",
"...."
]
},
"APPRISE": {
"ENABLED": false,
"WEBHOOK_URLS": [
"first url",
"second url",
"...."
],
"FORMATS": [
"markdown"
]
},
"CUSTOM": {
"ENABLED": false,
"WEBHOOK_URLS": [
"first url",
"second url",
"...."
]
"CONTENT_NAMES": [
"text",
"body",
"...."
],
"FORMATS": [
"asterisk",
"markdown"
]
},
"DEFAULT_DOT_STYLE": true,
"MIN_REPEAT": 15
}
```
| Item | Required | Description |
|------------|------------|------------|
| **TELEGRAM** | | |
| ENABLED | true/false | Enable or disable Telegram notifications |
| TOKENS | String | The token of your Telegram bot |
| CHAT_IDS | String | The ID of the Telegram chat where notifications will be sent |
||||
| **DISCORD** | | |
| ENABLED | true/false | Enable or disable Discord notifications |
| WEBHOOK_URLS | url | The URL of your Discord webhook |
||||
| **SLACK** | | |
| ENABLED | true/false | Enable or disable Slack notifications |
| WEBHOOK_URLS | url | The URL of your Slack webhook |
||||
| **GOTIFY** | | |
| ENABLED | true/false | Enable or disable Gotify notifications |
| SERVER_URLS | url | The URL of your Gotify server |
| TOKENS | String | The token for your Gotify application |
||||
| **NTFY** | | |
| ENABLED | true/false | Enable or disable Ntfy notifications |
| WEBHOOK_URLS | url | The URL of your self-hosted Ntfy server (or use https://ntfy.sh) |
||||
| **PUSHBULLET** | | |
| ENABLED | true/false | Enable or disable Pushbullet notifications |
| TOKENS | String | The token for your Pushbullet application |
||||
| **PUSHOVER** | | |
| ENABLED | true/false | Enable or disable Pushover notifications |
| TOKENS | String | The token for your Pushover application |
| USER_KEYS | String | The user key for your Pushover application |
||||
| **MATRIX** | | |
| ENABLED | true/false | Enable or disable Matrix notifications |
| TOKENS | String | The token for your Matrix application |
| SERVER_URLS | url | The URL of your Matrix server (or use https://matrix.org) |
||||
| **MATTERMOST** | | |
| ENABLED | true/false | Enable or disable Mattermost notifications |
| WEBHOOK_URLS | url | The URL of your Mattermost webhook |
||||
| **ROCKET** | | |
| ENABLED | true/false | Enable or disable Rocket.Chat notifications |
| SERVER_URLS | url | The URL of your Rocket.Chat server |
| TOKENS | String | The token for your Rocket.Chat application |
| CHANNEL_IDS | String | The ID of the Rocket.Chat channel where notifications will be sent |
||||
| **PUMBLE** | | |
| ENABLED | true/false | Enable or disable Pumble notifications |
| WEBHOOK_URLS | url | The URL of your Pumble webhook |
||||
| **ZULIP** | | |
| ENABLED | true/false | Enable or disable Zulip notifications |
| WEBHOOK_URLS | url | The URL of your Zulip webhook |
||||
| **FLOCK** | | |
| ENABLED | true/false | Enable or disable Flock notifications |
| WEBHOOK_URLS | url | The URL of your Flock webhook |
||||
| **APPRISE** | | |
| ENABLED | true/false | Enable or disable Apprise notifications |
| WEBHOOK_URLS | url | The URL of your Apprise webhook |
| FORMATS | markdown,
html,
text,
asterisk | The format(s) to be used for the notification (e.g., markdown/html/text/asterisk) |
||||
| **CUSTOM** | | |
| ENABLED | true/false | Enable or disable Custom notifications |
| WEBHOOK_URLS | url | The URL of your Custom webhook |
| FORMATS | markdown,
html,
text,
asterisk | The format(s) to be used for the notification (e.g., markdown/html/text/asterisk) |
| CONTENT_NAMES | text,
body,
content,
message | json = {"text/body/content/message": out_message} |- **markdown** - a simple text-based format with lightweight syntax for basic styling (Pumble, Mattermost, Discord, Ntfy, Gotify),
- **html** - a web-based format using tags for advanced text styling,
- **text** - raw text without any styling or formatting.
- **asterisk** - non-standard Markdown (Telegram, Zulip, Flock, Slack, RocketChat).| Item | Required | Description |
|------------|------------|------------|
| DEFAULT_DOT_STYLE | true/false | Round/Square dots. |
| MIN_REPEAT | 15 | Set the poll period in minutes. Minimum is 1 minute. |## 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/ip_check.service
```
Add the following content:
```
[Unit]
Description=check external ip changes
After=multi-user.target[Service]
Type=simple
Restart=always
ExecStart=/usr/bin/python3 /opt/ip_check/ip_check.py[Install]
WantedBy=multi-user.target
```
```
systemctl daemon-reload
```
```
systemctl enable ip_check.service
```
```
systemctl start ip_check.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)