paint-brush
Free Monitoring of Processes and Servers in 3 Easy Stepsby@ariedebok
148 reads

Free Monitoring of Processes and Servers in 3 Easy Steps

by Arie Roos
Arie Roos HackerNoon profile picture

Arie Roos

@ariedebok

Senior Software Developer, currently in fintech.

November 15th, 2020
Read on Terminal Reader
Read this story in a terminal
Print this story
Read this story w/o Javascript
Read this story w/o Javascript
tldt arrow

Too Long; Didn't Read

Heartbeat.sh provides one of the simplest ways to monitor servers and processes for free. If I want to monitor a service, I can monitor it by sending an HTTP POST request to my heartbeat.sh server. Using the server is as simple as sending a heartbeat with a post request tohttps://://://{my-subdomain}.heartbeat-name} The author is the developer who built the free monitoring tool. He uses it for some of his hobby projects and even at work.
featured image - Free Monitoring of Processes and Servers in 3 Easy Steps
Arie Roos HackerNoon profile picture
Arie Roos

Arie Roos

@ariedebok

Senior Software Developer, currently in fintech.

About @ariedebok
LEARN MORE ABOUT @ARIEDEBOK'S
EXPERTISE AND PLACE ON THE INTERNET.

Heartbeat.sh provides one of the simplest ways to monitor your servers and processes for free. If I want to monitor a service, I can monitor it by simply sending an HTTP POST request to my heartbeat.sh server, and voila, my service is being monitored! I will show you how to this in three easy steps.

(Disclaimer: The author is the developer who built heartbeat.sh)

Step 1: Create your server

This is as simple as it gets. Just go to heartbeat.sh, enter a name for your server an click on the big Create Server button! Heartbeat.sh will then create a server for you, with your server name as a subdomain, and redirect you to your new dashboard.

For example. Say I wanted to create a monitoring server named
hn-example. I simply go to the heartbeat.sh home page, enter hn-example in the text box and click on create-server.

image

Heartbeat.sh then automatically redirects me to

hn-example.heartbeat.sh
which is the dashboard for my new monitoring server.

image

Step 2: Start sending heartbeats

Now that I have a monitoring server, I better start using it. Using the server is as simple as sending a heartbeat with a post request to

https://{my-subdomain}.heartbeat.sh/beat/{heartbeat-name}
.

I will use

curl
as an example, but that's not the only way. You can use any tool capable of sending http requests, like
axios
for JavaScript or
requests
for Python. Heartbeat.sh also has open source JavaScript and Python libraries available on their github profile.

❯ curl -X POST 'https://hn-example.heartbeat.sh/beat/example'

The server then replied with this JSON object:

{
    "Name": "example",
    "Warning": 60,
    "Error": 300,
    "Age": 0,
    "Status": "OK",
    "LastBeat": "2020-11-13T08:12:56.447936897Z"
}

The

Warning
and
Error
fields mean that my heartbeat will go into Warning status after 60 seconds after the last POST request, and into Error status after 300 seconds (5 minutes). If I want to make the timeouts 90 seconds and 1 hour respectively, I can just add that to the request query string:

❯ curl -X POST 'https://hn-example.heartbeat.sh/beat/example?warning=1m30&error=1h'

To which the server replies with:

{
    "Name": "example",
    "Warning": 90,
    "Error": 3600,
    "Age": 0,
    "Status": "OK",
    "LastBeat": "2020-11-13T08:23:02.738496856Z"
}

Every POST request will update the heartbeat. If I have a script that must run every day, I can send a heartbeat at the end of the script with a warning and error timeout of 1 day each. The heartbeat will then timeout if my script missed a day.

Step 3: Check your heartbeats

My dashboard shows my heartbeats and their statuses. It automatically refreshes every minute, so I can display it on a screen where the color changes will quickly tell me if there is a problem.

image

I can also get my heartbeat statuses programmatically by simply sending a GET request:

❯ curl -X GET 'https://hn-example.heartbeat.sh/beat/example'
{
    "Name": "example",
    "Warning": 90,
    "Error": 3600,
    "Age": 527,
    "Status": "WARNING",
    "LastBeat": "2020-11-13T08:23:02Z"
}

Or to get a list of all my beats:

curl -X GET 'https://hn-example.heartbeat.sh/heartbeats'
{
    "Heartbeats": [
        {
            "Name": "example",
            "Warning": 90,
            "Error": 3600,
            "Age": 669,
            "Status": "WARNING",
            "LastBeat": "2020-11-13T08:23:02Z"
        }
    ]
}

This is the simplest monitoring set-up I know of. I use it for some of my hobby projects and even at work. Heartbeat.sh made it very easy for me to automate my daily checks. Now I spend less time baby sitting my projects and more time improving them.

(Disclaimer: The author is the developer who built heartbeat.sh)

L O A D I N G
. . . comments & more!

About Author

Arie Roos HackerNoon profile picture
Arie Roos@ariedebok
Senior Software Developer, currently in fintech.

TOPICS

THIS ARTICLE WAS FEATURED IN...

Permanent on Arweave
Read on Terminal Reader
Read this story in a terminal
 Terminal
Read this story w/o Javascript
Read this story w/o Javascript
 Lite
Coinerblog
X REMOVE AD