Cookbook

Here is a series of applications for CSVM beacons you can apply to your systems immediately:

Server health

Knowing whether your servers are up or down is probably the most basic type of monitoring you can do. Creating and deploying a simple heartbeat

Batch job monitoring

Say our company, WidgetCo, has a process that runs every 8 hours. Normally, it runs without a hitch, but sometimes there are unforeseen errors. A network hiccup, bad data from the source system, etc. This is an ideal application for a CSVM beacon.

The first step is to create a new beacon that we will call using curl:

We’ll need to copy the success and error URLs to include in our script.

So how do we implement this beacon in our job. For this example, we’ll assume it’s a bash script running on some flavor of Linux. To show how you can easily report successes and failures, we’ll write a script that accepts a URL from the user and sets a beacon based on whether it returns valid data or not:

#/usr/bin/env bash

echo -n "Enter a URL:"
read url

if curl $url; then
    echo success
    curl https://csvmonitor.com/api/beacons/org+dcbab014-2f43-4988-8c05-7894d2b6ac28/b24ea41b-0e47-4cb4-8bc7-596062d72412/success?BeaconID=widgetjob
else
    echo failure
    curl https://csvmonitor.com/api/beacons/org+dcbab014-2f43-4988-8c05-7894d2b6ac28/b24ea41b-0e47-4cb4-8bc7-596062d72412/error?BeaconID=widgetjob
fi

Now to test it! First, we’ll try a valid URL:

$ ./batchexample.sh
Enter a URL:https://google.com
<HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8">
<TITLE>301 Moved</TITLE></HEAD><BODY>
<H1>301 Moved</H1>
The document has moved
<A HREF="https://www.google.com/">here</A>.
</BODY></HTML>
success

And sure enough, our beacon shows success:

Now we’ll try a bad URL:

smeans@framework:~/source/csvmonitor.com/design/docs$ ./batchexample.sh
Enter a URL:http://thisis.invalid
curl: (6) Could not resolve host: thisis.invalid
failure

Which shows up in our beacon as a failure:

And that’s it! This technique is really useful for tracking the success/failure of unattended scheduled batch jobs running on cron.