this system will alert you with telegram about offline servers.
donations are welcome, if you find this tool helpful.
- Create telegram bot via
@BotFather
, customize it and getbot_API_token
(how_to). - Create at least 1 chat:
alarm
. Customize it, add your bot into this chat and getchat_ID
(how_to). - Connect to your server where you plan to install ping-system.
- Install
python3.10
or newer:
# one-line-command
sudo apt-get update && \
sudo apt-get upgrade -y && \
sudo apt install software-properties-common tmux curl git -y && \
sudo add-apt-repository ppa:deadsnakes/ppa && \
sudo apt-get install python3.10 python3-pip -y && \
sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.8 1; \
sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.10 2; \
sudo update-alternatives --config python3 && \
sudo apt-get install python3-distutils && \
sudo apt-get install python3-apt && \
sudo apt install python3.10-distutils -y && \
curl -sS https://bootstrap.pypa.io/get-pip.py | python3.10 && \
sudo apt-get install python3.10-dev -y && \
pip3 install --ignore-installed PyYAML && \
python3 -V
>>> Python 3.10.9
- Clone this repository:
cd ~/ && \
git clone https://github.com/cyberomanov/status-ping.git ping && \
cd ~/ping/
- Install requirements:
pip3 install -r ~/ping/requirements.txt
- Edit
config.yaml
:
recommend to set 1 offline/non-pingable server to check your alarms via telegram.
nano ~/ping/config.yaml
- Run the
ping.py
to check you config settings:
python3 ping.py
- If all seems okay, then edit your crontab with
crontab -e
:
ping 10 servers takes about 2 minutes with 1 cpu x 1 ram vps.
so you have to edit your crontab rules with this knowledge.
# ping
*/5 * * * * cd /root/ping/ && /usr/bin/python3 ping.py
check your logs in 5-10-15 minutes here:
~/ping/log/ping.log
- backup your config:
cp ~/ping/config.yaml ~/config_temp.yaml
- pull changes from the repository:
cd ~/ping/ && \
git fetch && \
git reset --hard && \
git pull
- print a new default config:
cat ~/ping/config.yaml
- restore your previous config, ONLY if there is no breaking changes, else edit the new file:
nano ~/ping/config.yaml
OR
mv ~/config_temp.yaml ~/ping/config.yaml
- Install requirements:
pip3 install -r ~/ping/requirements.txt
- Run the
ping.py
to check you config settings:
python3 ping.py