My discord bot for monitoring my server stats
- Python 100%
| .example.env | ||
| .gitignore | ||
| LICENSE | ||
| main.py | ||
| README.md | ||
| requirements.txt | ||
Monitoring bot
The bot I use for monitoring my server. Can send you warnings if certain thresholds (ram/cpu usage, cpu temp, ...) are exceeded. You can also request a report with !report.
Setup
cp .example.env .env
Then, paste your bot token into .env.
To install the dependencies, create a venv if you want to
On Linux:
python3 -m venv .venv
source .venv/bin/activate
On Windows or Mac, ask ChatGPT xD.
Then, install dependencies:
pip install -r requirements.txt
Finally, run the bot:
python main.py
To set up a systemd service for the bot so it will auto-start every time you boot your server,
create a file /etc/systemd/system/monitor.service" or monitoring-bot.service` or whatever.
Put something like this in the file (replace relevant fields):
[Unit]
Description=Discord System Monitor Bot
After=network.target
[Service]
Type=simple
WorkingDirectory=/home/username/monitoring_bot
ExecStart=/home/username/monitoring_bot/.venv/bin/python /home/username/monitoring_bot/main.py
Restart=always
User=username
[Install]
WantedBy=multi-user.target
And run this (replace monitor with what you called the .service file):
sudo systemctl daemon-reload # to load the changes
sudo systemctl start monitor # to start it immediately
sudo systemctl enable monitor # to launch it every time your server boots
Usage
Look at the code, it's pretty simple.