Skip to content

cyberomanov/status-ping

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

60 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PING

this system will alert you with telegram about offline servers.
donations are welcome, if you find this tool helpful.

Contents

  1. Screenshots
  2. Installation
  3. Update

Screenshots

image

image

Installation

  1. Create telegram bot via @BotFather, customize it and get bot_API_token (how_to).
  2. Create at least 1 chat: alarm. Customize it, add your bot into this chat and get chat_ID (how_to).
  3. Connect to your server where you plan to install ping-system.
  4. 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
  1. Clone this repository:
cd ~/ && \
git clone https://github.com/cyberomanov/status-ping.git ping && \
cd ~/ping/
  1. Install requirements:
pip3 install -r ~/ping/requirements.txt
  1. Edit config.yaml:

recommend to set 1 offline/non-pingable server to check your alarms via telegram.

nano ~/ping/config.yaml
  1. Run the ping.py to check you config settings:
python3 ping.py
  1. 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


Update

  1. backup your config:
cp ~/ping/config.yaml ~/config_temp.yaml
  1. pull changes from the repository:
cd ~/ping/ && \
git fetch && \
git reset --hard && \
git pull
  1. print a new default config:
cat ~/ping/config.yaml
  1. 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
  1. Install requirements:
pip3 install -r ~/ping/requirements.txt
  1. Run the ping.py to check you config settings:
python3 ping.py

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages