A Simple Health Check Tool
CloudFlare provides Health Checks but you have to be on a paid plan. Vultr provides Free-Tier VPS (512 MB, 1 Core, 10 GB SSD, 2 TB Bandwidth).
This lightweight VPS does not have much RAM - so it cannot run heavy applications, but this (health check) tool should be a good use case for it.
Most code at the "init commit" is done by ChatGPT. Thank you!
No docker - as you probably can't run docker on it. You can either run it in screen
or pm2
(install via npm install pm2 -g
) so that it will stay in background.
Change config.json.sample
to config.json
and modify the content necessary - which should be pretty straightforward. If expectedContent
is empty, this check will be ignored.
Run npm install
to install the missing dependencies.
Here is a sample JSON config:
{
"urls": [
{
"name": "Example Website",
"url": "https://example.com",
"interval": 60,
"expectedStatusCode": 200,
"expectedContent": "Example Domain",
"ignore_period": 1800
},
{
"name": "Google",
"url": "https://www.google.com",
"interval": 30,
"expectedStatusCode": 200,
"expectedContent": "Google",
"ignore_period": 1800
}
],
"email": {
"service": "Gmail",
"auth": {
"user": "your gmail account",
"pass": "your gmail temp app password"
},
"destination": "email address that you wish to receive the notification",
"interval": 3,
"enabled": true
}
}
The ignore_period
for each url specifies the period that no two notifications will be handled. The email.enabled
when set to false, will print to console instead of sending emails. The emails will be sent one per interval
seconds.
Simply Run node health-checks.js
,
Example:
In case of failures:
You should get an email, if configured correctedly.
Configure a max email per period (PR welcome)
If you find this useful, why not buy me a coffee? Thanks!