Skip to content

A script to check if my servers are up and running and then sends email and text notifications if the server is offline. The script runs on my Raspberry Pi Zero W as a cron job running every hour.

License

Notifications You must be signed in to change notification settings

JDSanti/Server_Checker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Contributors Forks Stargazers Issues MIT License LinkedIn


Logo

Server Checker

Server checker script
Explore the docs »

· Report Bug · Request Feature ·

Table of Contents
  1. About The Project
  2. Getting Started
  3. Usage
  4. Roadmap
  5. Contributing
  6. License
  7. Contact
  8. Acknowledgments

About The Project

Product  Screen Shot Email Name Screen Shot Text  Screen Shot

Built With

Getting Started

Prerequisites

  1. Sign up for (or log in to) your Twilio account (https://www.twilio.com/try-twilio)

  2. Get a phone number with SMS (and MMS) capabilities from Twilio

  3. Get your Twilio account SID and Auth Token

  4. Use your own Gmail account or create a new one for the usage of this script

Installation

  1. If using a Rapsberry Pi, make sure to install your flavor of OS and run its appropriate updates, also make sure that python is installed and updated
python -V 
  1. Install required packages:
  • Twilio
    pip3 install twilio 
  • Yagmail
    pip3 install yagmail 
  1. Send an SMS message in Python via the REST API to make sure your account is properly setup https://www.twilio.com/docs/sms/tutorials/how-to-send-sms-messages-python#send-an-sms-message-in-python-via-the-rest-api

  2. Test sending email with simple one liner:

yagmail.SMTP('mygmailusername').send('to@someone.com', 'subject', 'This is the body')

Documentation

For additonal help please refer to libraries documentation below:

Usage

  1. Clone the repo
    git clone https://github.com/JDSanti/Server_Checker.git
  2. Setup your own email and password on script by replacing "email" and "password" with your own **NOTE: This method is not recommended, since you would be storing the full credentials to your account in your script in plain text. I did it for simplicity purposes but please refer to https://yagmail.readthedocs.io/en/latest/setup.html#configuring-credentials for proper storage of passwords.
    yag = yagmail.SMTP('email', 'password')
  3. Setup your own phone numbers on script by replacing "from" and "to" variables with your own
     from_='+15555555555',
             to='+15555555555'
         )
  4. Replace "server.com" with the domain of the web server you want to test. It can test multiple servers ["server.com","server2.com"]
    servers_to_check=["server.com"]
  5. Run script
    python3 server.py
  6. Setup as cron job

(back to top)

Roadmap

  • Implement texting ability
  • Implement email ability
  • Setup as cron job on Pi Zero

See the open issues for a full list of proposed features (and known issues).

(back to top)

Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

(back to top)

License

Distributed under the MIT License. See LICENSE.txt for more information.

(back to top)

Contact

Jose Santiago - @Capt_Santiago - jduhamel.santiago@outlook.com

Project Link: https://github.com/JDSanti/Server_Checker

(back to top)

Acknowledgments

(back to top)

About

A script to check if my servers are up and running and then sends email and text notifications if the server is offline. The script runs on my Raspberry Pi Zero W as a cron job running every hour.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages