Giter VIP home page Giter VIP logo

siteping's Introduction

siteping

Siteping is a tiny bash script for monitoring hosts, it notifies you when a host is unavailable. The notification is using the Telegram-Bot API. Before you can use it, create your personal Telegam-Bot token.

More information: https://core.telegram.org/bots

Installation

  1. Install it on your Raspberry PI or your preferred Linux operating system.
  2. Copy the scripts into YOUR_HOME_DIR (or elsewhere) be sure that the directory is writable.
  3. Grant execution rights to both scripts
   sudo chmod 755 siteping.sh
   sudo chmod 755 tpush.sh
  1. Edit tpush.sh and replace YOUR_TOKEN with your Telegram-Bot token and the chatId with your chatId.
    a) to get the chatId create a group and add the Telegram-BOT to your group
    b) post a message in your group
    c) open https://api.telegram.org/bot<YOUR_TOKEN>/getUpdates in a browser
    d) copy the chat:id from the json respons.
    If you get an empty result, add the bot again to the group.

  2. Edit siteping.sh and add new host names or change the existing host names for your needs. Don't remove the default counter value 1 at the end of each host name. If you do not want to receive a notification every hour, change the default counter value to 5

  3. Add siteping.sh as cronjob to run as background process. Edit the crontab

   sudo crontab -e
  1. Add these lines and save your crontab
   @reboot /YOUR_HOME_DIR/siteping.sh &
   0 * * * *  /YOUR_HOME_DIR/siteping.sh &
  1. Test the notification script, go to your home dir an run the tpush.sh script
   cd /YOUR_HOME_DIR
   ./tpush.sh "hello world"
  1. If your Telegram app does not receive your message, check the above steps again.

Default setting of siteping.sh

count=5       (Sends a notification every 60 seconds 5 times when a host is down or unavailable.)
interval=60   (Checks the host list every 60 seconds) 
timeout=1     (ping timeout 1 second)

Windows version

  1. copy siteping.js and tpush.bat to YOUR_HOME_DIR
  2. Edit tpush.bat and replace YOUR_TOKEN with your Telegram-Bot token and the YOUR_CHAT_ID with your chatId.
  3. Edit siteping.js as described above
  4. Open Command prompt WinKey+R type cmd and click OK
  5. From the windows command line go to YOUR_HOME_DIR and run siteping, e.g.:
   cd c:\users\<YOUR_USERNAME>\Documents\
   cscript /nologo siteping.js

siteping's People

Contributors

seizu avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

siteping's Issues

send message if status changed

i tested your script ,great work , just one problem , telegram message has all ips status in every message, while i need message for ip that has status changed only.Can you guide how to accomplish that?Thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.