Simple HTTP-based server status check tool with email/SMS alerts.
- Manage multiple monitorings (URLs to check)
- Check the network connection as well as 4XX and 5XX HTTP errors
- Simple visualization of each monitorings status (down, up, unknown) with their respective down reason
- RSS feed of the monitorings status (public monitorings only)
- Responsive (can be used on mobile devices)
- Ability to configure, for each monitorings:
- HTTP method to use, connection timeout and if the HTTPS certificate have to be verified
- Availability (enabled or disabled)
- Public visibility
- Check interval
- (Optional) Email recipients and/or mobile phone numbers who will receive the status alerts
- (Optional) A Python Regex to perform a HTTP response body-based check
- (Optional) Custom HTTP headers to send
- Internationalized & localized in 2 languages:
- English (
en
) - French (
fr
)
- English (
- Should work on any Python 3.x version. Feel free to test with another Python version and give me feedback
- A uWSGI-capable web server (optional, but recommended)
- (Optional) A SMTP server to send email alerts
- (Optional) A Twilio account to send SMS alerts
- Clone this repo somewhere
pip install -r requirements.txt
pybabel compile -d translations
export FLASK_APP=serverpatrol.py
(Windows users:set FLASK_APP=serverpatrol.py
)flask create_database
(WARNING: don't re-run this command unless you want to start from scratch, it will wipe out all the Server Patrol's data)- Create the scheduled task that will run the script who will perform the checks every minutes (only for active monitorings that are due):
On a Linux-based OS, create this Cron entry:
* * * * * cd /path/to/server-patrol && export FLASK_APP=serverpatrol.py && flask check >/dev/null 2>&1
On Windows, create this scheduled task using the command line:
schtasks /create /tn "Server Patrol" /tr "cd C:\path\to\server-patrol && set FLASK_APP=serverpatrol.py && flask check" /sc MINUTE
Don't forget to add a command to activate your virtualenv if you're using one.
Copy the config.example.py
file to config.py
and fill in the configuration parameters.
Available configuration parameters are:
SECRET_KEY
Set this to a complex random value
More informations about Flask config values can be found here.
TITLE
If set to a string, will be used to replace the default app title (which is "Server Patrol")USERS
The credentials required to access the app. You can specify multiple ones. It is highly recommended to serve Server Patrol through HTTPS because it uses HTTP basic authSERVER_NAME
The IP or hostname where Server Patrol will be availableFORCE_LANGUAGE
Force the lang to be one of the supported ones (defaults toNone
: auto-detection from theAccept-Language
HTTP header). See in the features section above for a list of available lang keysDEFAULT_LANGUAGE
Default language if it cannot be determined automatically. Not taken into account ifFORCE_LANGUAGE
is defined. See in the features section above for a list of available lang keys
SMTP-related parameters to send email alerts:
ENABLE_EMAIL_ALERTS
Wheter to enable the email feature or not. IfTrue
, fill in the configuration parameters belowMAIL_SERVER
The SMTP server name / IP to use to send email alertsMAIL_PORT
The SMTP server portMAIL_USE_TLS
Use TLS when connecting to the SMTP server?MAIL_USE_SSL
Use SSL when connecting to the SMTP server?MAIL_USERNAME
Username to use to connect to the SMTP serverMAIL_PASSWORD
Password to use to connect to the SMTP serverMAIL_DEFAULT_SENDER
A Python tuple to define the identity of the Server Patrol's mail sender
More configuration parameters can be added about SMTP configuration, see here.
Twilio-related parameters to send SMS alerts:
ENABLE_SMS_ALERTS
Wheter to enable the SMS feature or not. IfTrue
, fill in the configuration parameters belowTWILIO_ACCOUNT_SID
andTWILIO_AUTH_TOKEN
are your Twilio credentialsTWILIO_SENDER_PHONE_NUMBER
The Twilio phone number that will send the SMS
I'll let you search yourself about how to configure a web server along uWSGI.
As you can see, Server Patrol is split in two pieces:
- A Flask command (
flask check
) to run the checks (runflask check --help
for the full list of arguments) - A Flask web app (the Server Patrol GUI) itself
You can run the web app:
- Standalone
Run the internal web server, which will be accessible at http://localhost:8080
:
python local.py
Edit this file and change the interface/port as needed.
- uWSGI
The uWSGI file you'll have to set in your uWSGI configuration is uwsgi.py
. The callable is app
.
- Others
You'll probably have to hack with this application to make it work with one of the solutions described here. Send me a pull request if you make it work.
This project is built on Flask (Python) for the backend which is using a small SQLite
database to persist data. HTTP requests are used to check the configured monitorings via
the flask check
command.
If you have questions or problems, you can submit an issue.
You can also submit pull requests. It's open-source man!