What's new in Oh Dear CLI 2

8th Dec 2020 (updated 22nd Jan 2021)

Oh Dear CLI is a command-line tool for the Oh Dear application monitoring service, written with Laravel Zero.

You can take a look at the nunomaduro/ohdear-cli repository for the source code of the application.

Version 2 is a full rewrite using Laravel Zero 8, with all new commands. Previously the Oh Dear CLI only had a single ohdear:forge-sync command, it now has over 10 commands for managing the Oh Dear API.

First you'll need to install the CLI via Composer using:

$ composer require nunomaduro/ohdear-cli

Once installed, set your API key in the OHDEAR_API_TOKEN environment variable. You can generate an API key from the API access page.

New commands

Account

  • Display details about the currently authenticated user

    $ ohdear-cli me
    

Sites

  • Add a new site to Oh Dear

    $ ohdear-cli sites:add [https://example.com]
    
  • Display a list of sites and their current status

    $ ohdear-cli sites:list
    
  • Display details about a specific site

    $ ohdear-cli sites:show [site-id]
    

Status pages

  • Display a list of status pages and their current status

    $ ohdear-cli status-pages:list
    
  • Display details about a specific status page

    $ ohdear-cli status-pages:show [status-page-id]
    

Performance

  • Display performance details for a specific site

    $ ohdear-cli performance:show [site-id]
    

Maintenance periods

  • Display maintenance periods for a specific site

    You can use --timeframe=[1h|1m] to set the timeframe that records are aggregated to (1m is every minute, and 1h is every hour).

    $ ohdear-cli maintenance-period:show [site-id] [--limit=5] [--timeframe=1h]
    
  • Start a new maintenance period for a site

    $ ohdear-cli maintenance-period:start [site-id] [seconds]
    
  • Add a new maintenance period for a site

    $ ohdear-cli maintenance-period:add [site-id] [start-date] [end-date]
    
  • Delete a maintenance period

    $ ohdear-cli maintenance-period:delete [id]
    
  • Stop the currently active maintenance period for a site

    $ ohdear-cli maintenance-period:stop [site-id]
    

Mixed content

  • Display mixed content for a specific site

    $ ohdear-cli mixed-content:show [site-id]
    

Broken links

  • Display broken links for a specific site (since v2.1.0)

    $ ohdear-cli broken-link:show [site-id]
    

Certificate health

  • Display certificate health for a specific site (since v2.2.0)

    You can use --checks to display a list of the checks that were performed, as well as their status.
    You can use --issuers to display a list of the certificate chain issuers.

    $ ohdear-cli certificate-health:show [site-id] [--checks] [--issuers]
    

Checks

  • Display checks for a specific site (since v2.3.0)

    $ ohdear-cli check:show [site-id]
    
  • Enable a specific check (since v2.3.0)

    $ ohdear-cli check:enable [id]
    
  • Disable a specific check (since v2.3.0)

    $ ohdear-cli check:disable [id]
    
  • Request a new run for a specific check (since v2.3.0)

    $ ohdear-cli check:request-run [id]
    

Uptime

  • Display uptime for a specific site (since v2.4.0)

    You can use --limit=[int] to set the maximum number of downtime records that are returned.
    You can use --timeframe=[hour|day|month] to set the timeframe that records are aggregated to.

    $ ohdear-cli uptime:show [site-id] [start-date?] [end-date?] [--limit=10] [--timeframe=hour]
    

Downtime

  • Display the downtime for a specific site (since v2.4.0)

    You can use --limit=[int] to set the maximum number of downtime records that are returned.

    $ ohdear-cli downtime:show [site-id] [start-date?] [end-date?] [--limit=10]
    

Cron Checks

  • Display the cron checks for a specific site (since v2.5.0)

    $ ohdear-cli cron-check:show [site-id]
    
  • Add a cron check for a specific site (since v2.6.0)

    You can use --grace-time to specify the grace time that will be allowed for your cron check. This is useful to manage any long-running tasks.
    You can use --description to set the description that will be shown in the Oh Dear dashboard.
    You can use --timezone to set a custom server timezone when adding a cron check using an expression (defaults to UTC).

    $ ohdear-cli cron-check:add [site-id] [name] [expression-or-frequency]
    
  • Delete a cron check (since v2.6.0)

    $ ohdear-cli cron-check:delete [id]