metaljerk / website_pinger

Pings a website to check if it is alive, failing which send an email

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Website Pinger

GitHub issues GitHub forks GitHub stars

Ping a server checking that it is alive. If it is not, then sends an email notifying the server is down.

Would recommend using this along with a cron job which would periodically run the script.

Requirements

  • Python 3

Usage

website_pinger.sh server_address [options]

  -c, --config-file Path to the config file.
  -f, --mail-from   Email from address
  -t, --mail-to     Email to address
  -i, --host        Email host
  -j, --port        Email port
  -u, --user        Email user
  -p, --password    Email password
  -s, --subject     Subject
  -a, --msg-prefix  Text to the added to the beginning of the email body.
  -z, --msg-suffix  Text to be added to the end of the email body.

Any parameters defined in the config file will be overwritten by any of the other optional arguments.

The config file should be a JSON file. Example is below. Do note, that not all keys need to be defined, some can be provided via the other arguments.

{
  "HOST": "smtp.host",
  "PORT": 587,
  "USER": "username",
  "PASSWORD": "password",
  "TO": "email@email.com",
  "FROM": "email@email.com"
}

Not all keys need to exist in the the config, those which are not in the config must be at least provided as arguments when calling the script.

About

Pings a website to check if it is alive, failing which send an email

License:MIT License


Languages

Language:Python 96.9%Language:Shell 3.1%