Using CronitorCLI

CronitorCLI is the recommended companion application to our monitoring service.  Run it on your workstation and deploy it to your server for powerful features, including:

Import and sync all of your cron jobs
Complete your integration in minutes with cronitor discover and sync schedule changes to Cronitor automatically.

Easier integration with Cronitor
Run and monitor any command with exec and use ping to send telemetry pings more reliably than curl.

Power tools for your cron jobs
Use list and select to view and run any cron job on your system. Use shell to test running a command like cron does.

Installation

CronitorCLI is packaged as a single executable for Linux, MacOS and Windows. There is no installation program, all you need to do is download and decompress the app into a location of your choice for easy system-wide use.

Choosing an installation location
The easiest way to integrate and use CronitorCLI is to install the binary system-wide in /usr/local/bin. If you choose an alternate install location (e.g. your home directory) you will need to remember and use its full path when running commands.

Downloading and installing
Paste each instruction into a terminal and execute. Because /usr/local/bin is a privileged directory you will require sudo or root access for that step.  By default the CronitorCLI config file is stored in /etc/cronitor and you will also need sudo access to create and write this file.

curl -sOL https://cronitor.io/dl/cronitor-stable-linux-amd64.tgz
sudo tar xvf cronitor-stable-linux-amd64.tgz -C /usr/local/bin/
sudo cronitor configure --api-key <API-KEY>

Testing your installation
To verify your installation, run cronitor from your terminal.  A usage block will be printed to your screen.

Choosing an installation location
The easiest way to integrate and use CronitorCLI is to install the binary system-wide in /usr/local/bin. If you choose an alternate install location (e.g. your home directory) you will need to remember and use its full path when running commands.

Downloading and installing
Paste each instruction into a terminal and execute. Because /usr/local/bin is a privileged directory you will require sudo or root access for that step.  By default the CronitorCLI config file is stored in /etc/cronitor and you will also need sudo access to create and write this file.

curl -sOL https://cronitor.io/dl/cronitor-stable-darwin-amd64.zip
sudo unzip cronitor-stable-darwin-amd64.zip -d /usr/local/bin/
sudo cronitor configure --api-key <API-KEY>

Testing your installation
To verify your installation, run cronitor from your terminal.  A usage block will be printed to your screen.

  1. Download application: https://cronitor.io/dl/cronitor-stable-windows-amd64.zip
  2. Unzip and move the executable to %ProgramFiles%\ for system-wide use
  3. Run %ProgramFiles%\cronitor.exe configure --api-key <API-KEY> from PowerShell or cmd.

Testing your installation
To verify your installation, run %ProgramFiles%\cronitor.exe from powershell.  A usage block will be printed to your screen.

Usage

$ cronitor
CronitorCLI version 22.0

Command line tools for Cronitor.io. See https://cronitor.io/docs/using-cronitor-cli for details.

Usage:
  cronitor [command]

Available Commands:
  activity    View monitor activity
  configure   Save configuration variables to the config file
  discover    Attach monitoring to new cron jobs and watch for schedule updates
  exec        Execute a command with monitoring
  help        Help about any command
  list        Search for and list all cron jobs
  ping        Send a single ping to the selected monitoring endpoint
  select      Select a cron job to run interactively
  shell       Run commands from a cron-like shell
  status      View monitor status
  update      Update to the latest version

Flags:
  -k, --api-key string        Cronitor API Key
  -c, --config string         Config file
  -h, --help                  Help for cronitor
  -n, --hostname string       A unique identifier for this host (default: system hostname)
  -l, --log string            Write debug logs to supplied file
  -p, --ping-api-key string   Ping API Key
  -v, --verbose               Verbose output

Use "cronitor [command] --help" for more information about a command.

Running CronitorCLI on your server

If you're using Cronitor to monitor traditional cron jobs, cronitor discover is the easiest way to create monitors and keep their schedule in sync with your server. If you're monitoring Windows scheduled tasks, scripts, daemons, ETL processes or almost anything else, using CronitorCLI for cronitor exec and cronitor ping will send telemetry pings more reliably than simply using Curl.

  • Required configuration can be provided as environment variables or from a json file. See Configuration later in this document for details.
  • Update easily to the latest version with a simple cronitor update command.
  • Install CronitorCLI in a system-wide location to more easily monitor tasks running as different users.

Running CronitorCLI on your local machine

Running CronitorCLI on your local machine enables quick commandline access to your Cronitor account.

  • Use cronitor status to view your current Cronitor dashboard details from your terminal
  • View and query monitor activity using cronitor activity. Use the optional --before [timestamp] param to paginate results.
  • Like server deployment, update easily to the latest version with a simple cronitor updatecommand.

Configuration

Configuration variables like api key and current server hostname can be provided as runtime arguments or environment variables. Alternatively, the configure command can be used to save configuration variables to a file.

Name Argument Variable name
Monitor API Key -k, --api-key [key] CRONITOR_API_KEY
Ping API Key -p, --ping-api-key [key] CRONITOR_PING_API_KEY
Current server name -n, --hostname [name] CRONITOR_HOSTNAME
Log Cronitor activity --log [path] CRONITOR_LOG
Exclude from name -e, --exclude-from-name [substring] CRONITOR_EXCLUDE_TEXT
Config file to use -c, --config [path to file] CRONITOR_CONFIG

Platform Default config file location
Linux /etc/cronitor/cronitor.json
MacOS /etc/cronitor/cronitor.json
Windows %SystemDrive%\ProgramData\Cronitor\cronitor.json