Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dr-prodigy/checkalive
Quick & dirty HTTP/HTTPS monitoring script
https://github.com/dr-prodigy/checkalive
Last synced: 1 day ago
JSON representation
Quick & dirty HTTP/HTTPS monitoring script
- Host: GitHub
- URL: https://github.com/dr-prodigy/checkalive
- Owner: dr-prodigy
- Created: 2023-07-27T15:05:34.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-10-05T15:13:54.000Z (about 1 year ago)
- Last Synced: 2023-10-06T15:28:43.367Z (about 1 year ago)
- Language: Shell
- Size: 13.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# checkalive
### Quick & dirty HTTP/HTTPS monitoring scriptThis quick bash script allows for a very basic http/https monitoring service, using HTTP response status codes returned by the requested webserver (**HTTP200 = OK**).
It is meant to be scheduled at recurring times (eg: every 5 minutes) using cron or similar services.
Alerts will be sent on a Telegram chat every time the status changes (OK -> Error -> OK ..) or, when in error, repeatedly, according to ``ERR_REPEAT_SECS`` variable, which can be customized into the script (default = every 4 hours).
Alerts are delivered using *Telegram.sh* (https://github.com/fabianonline/telegram.sh), which is automatically installed upon first run (installation directory can also be customized via ``TELEGRAM_SH_DIR`` variable).
Please refer to the relevant documentation on how to set up your bot, token and chat ID.
#### Syntax
```$ ./checkalive [URL to be checked] [Telegram token] [Telegram chat ID]```The command requires 3 parameters:
- ``CHECK_URL``: Domain/URL (including protocol) to be checked
- ``TELEGRAM_TOKEN``: Telegram token
- ``TELEGRAM_CHAT``: Telegram chat IDwhich can be provided as commandline params, or as environment variables (``export [VAR]=[value] ...``) or even set in the script itself
(in the last 2 cases, command will run without any params).
Example of crontab scheduling (monitor every 5 mins):
```
# Example of job definition:
# .---------------- minute (0 - 59)
# | .------------- hour (0 - 23)
# | | .---------- day of month (1 - 31)
# | | | .------- month (1 - 12) OR jan,feb,mar,apr ...
# | | | | .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat
# | | | | |
# * * * * * user-name command to be executed*/5 * * * * user /home/user/checkalive/checkalive http://mydomain.com 0000000000:xxxxxxxx-xxxxxx-xxxxxxxxxxxxxxxxxx 123456789
```