Skip to content

Telegram Server Status will send you alerts if a device (server, POS terminal, workstation, etc) is offline.

License

Notifications You must be signed in to change notification settings

rileyhutton/TS2

Repository files navigation

Telegram Server Status (TS2)

Recieve alerts via telegram if a device (server, POS terminal, workstation, etc) is offline. I threw this together in an evening so it's not pretty but works great.

What does it do?

  • Pings a list of ip addresses you define at regular intervals (default 1 min)
  • Sends all users a telegram message if a device does not respond (or set a number of times for a ping to fail before alerting you)
  • Sends a list of all devices and their statuses on-demand (by sending /status)

    Instructions

  • Clone the github respository, and install dependencies

    pip3 install ping3
    pip3 install requests

  • Create a telegram bot. Assuming you have a telegram, send /newbot to @BotFather, and give it a name and username. Copy the API key given in the response into telegram-api-key.txt. Keep this key secret!
  • Send a messagse (eg. /start)to your newly created bot so that it is able to reply to your messages.
  • Add your Telegram user ID to message-recipients.csv file. You can find this by sending /start to @JsonDumpBot and looking at the first field labelled "id". (Not "message_id" or "update_id"!)
  • Add the clients you would like to monitor to the clients.csv file. You should type the name you would like it to be known by, then the ip address or url. Create a new line for each client. Eg:
    Router, 192.168.0.1
    Web Server, example.com
    Smart Home Device, 192.168.0.2
    Twitter, twitter.com
    
  • Run server.py with python3!

    To run this on startup:

  • On Windows: Add a shortcut to server.py to your startup folder
  • On Linux: Add lines to your rc.local file which cd to the directory of server.py and run python3 server.py

    Limitations

  • Performance with many recipients not tested - let me know if you have any success with this. No reason it shouldn't work
  • All clients must be on the same network/VPN or be exposed to the internet if not on the same LAN.

    Troubleshooting

  • If dependancies cannnot be found when running from rc.local, try re-installing them with sudo using sudo pip3 install ping3 && sudo pip3 install request
  • If no pings can get through despite devices being online, run the file with sudo (Linux) or as administrator (Windows)

    Thanks!

    If you'd like to send me an anonymous message, go here :)
  • About

    Telegram Server Status will send you alerts if a device (server, POS terminal, workstation, etc) is offline.

    Resources

    License

    Stars

    Watchers

    Forks

    Releases

    No releases published

    Packages

    No packages published

    Languages