Peek Inside

Cron Monitoring allows you to monitor your periodic tasks and get notified when they fail to call home.

View all of your Cron Monitor Tasks

You can view all your Cron Monitor Tasks on the one screen along with the task's Name, Callback URL, Last Completed Date and if it appears on your Public Status Page.

Adding a new Cron Monitor Task

Click on 'Add a cron' to get started. Choose the Expected Period & Grace Period. That is how often the task will run and how much time you will allow the task to overrun before being notified.

View your Cron Monitoring Logs

Click on 'View' to view your Cron Monitoring Logs. Benchmark their performance against their expected schedule and identify problematic processes early.

Basic Usage

Setup your first Cron Monitoring Task

  1. Create a new Cron Monitor Task and recieve a unique Callback URL.
  2. Make a HTTP GET request to the callback URL from your Cron Job, background process or scheduled task.
  3. If the Callback URL is not requested before the Expected Period + Grace Period lapses, you'll get notified.

Request the Callback URL from your Cron Job

The simplest way to use Cron Monitoring is to append the Callback URL to your crontab command (see example below). If the cron job completes succesfully it will request the Callback URL. Please see other code examples below for basic usage.

curl https://snja.io/your-unique-token
wget https://snja.io/your-unique-token
0 * * * * /mysqlbackup.sh && curl https://snja.io/your-unique-token > /dev/null
var https = require('https');
https.get("https://snja.io/your-unique-token");
file_get_contents("https://snja.io/your-unique-token");
import requests
requests.get("https://snja.io/your-unique-token")

Response

Example of a successful response.

{
    "response": {
        "error": 0,
        "message": "Recorded successfully"
    }
}

API Guide

Cron Start

/start

Call the /start endpoint when your Cron Job starts to run.

Cron Complete

/complete

Call the /complete endpoint when your Cron Job finishes.

Note: Requests made to your Callback URL that don't specifiy an endpoint are treated as /complete requests.

Cron Error

/error

Call the /error endpoint to manually report that the Cron Job has failed.

Examples

curl https://snja.io/your-unique-token/start
curl https://snja.io/your-unique-token/complete
curl https://snja.io/your-unique-token/error
wget https://snja.io/your-unique-token/start
wget https://snja.io/your-unique-token/complete
wget https://snja.io/your-unique-token/error
0 * * * * /mysqlbackup.sh || curl https://snja.io/your-unique-token/error > /dev/null
var https = require('https');
https.get("https://snja.io/your-unique-token/start");

/* Your application logic */

https.get("https://snja.io/your-unique-token/complete");
file_get_contents("https://snja.io/your-unique-token/start");

/* Your application logic */

file_get_contents("https://snja.io/your-unique-token/complete");
import requests
requests.get("https://snja.io/your-unique-token/start")

# Your application logic

requests.get("https://snja.io/your-unique-token/complete")

API Overview

Authentication

You'll need to authenticate using your API Key.

There are two ways to authenticate:

Request Headers:

$ curl -H "X-Api-Id: <API_KEY_ID>" -H "X-Api-Secret: <API_SECRET>" 'https://snja.io'

URL Parameters:

$ curl 'https://snja.io/foo?_id=<API_KEY_ID>&_secret=<API_SECRET>'

API Keys

API Keys can be created and managed in the API Keys section.

  1. Go to the API Keys section.
  2. Click on the button 'Generate API Key'.
  3. A new key will be genereated for use with the API.

Rate Limits

API Keys are rate limited to ensure fair delivery of services. You can view the current Rate Limit and Remaining Requests in the returned Response Headers from the API. Below is a description of the Response Headers.

Header Description
X-RateLimit-Limit The maximum number of requests per time window.
X-RateLimit-Remaining The number of requests remaining before reset.
X-RateLimit-Reset The time at which the current rate limit window resets in UTC Epoch seconds.

Error Codes

The following HTTP response codes are used.

Code Message Description
200 OK The request has succeeded.
400 Bad Request The request could not be understood by the server due to malformed syntax.
401 Unauthorised This indicates that you have not passed a valid API key, the key has expired, or the Authorization header is not formatted correctly.
404 Not Found The server has not found anything matching the Request-URI.
405 Method Not Allowed This indicates that the request method is known by the server but has been disabled and cannot be used.
429 Too Many Requests We have recieved too many requests from your API Key in a given amount of time. Wait a while and try again.

More Products

Device Shots

Easily mock-up your app screenshots onto different devices for marketing

Ring the Bell

Login on a TV or Pi and ring an audible bell every time the team makes a sale

NPS Feedback

Your Net Promoter Score measures brand loyalty and forecasts business growth

Uptime Pings

Get notified instantly when your website is down and not responding to requests

Cron Monitoring

Get notified when your cron jobs fail or benchmark their performance

Status Page

Keep your customers informed during scheduled or unplanned outages

GEOIP to Country

Lookup Country, Language & Currency Information from an IP address

DNS Watcher

Track DNS changes on your domains & get notified of expiring certificates

Competitor Monitor

Monitor your competitors' websites and get notified when they change

Builder API

Cross-platform Hybrid App build service for Cordova, React Native & Flutter

Ninjalytics

Generate swimlane charts of your customer's journey through your product

Request Bins

Capture & inspect HTTP requests. Replay the request to your local machine