Honeybadger on the Command Line

The honeybadger gem includes a Command Line Interface (CLI) that can be used for a variety of activities from installing Honeybadger in a new project to reporting failed cron jobs.

For a full overview of the CLI and the commands it provides, see the CLI reference.

In this chapter we're going to discuss some of the interesting ways to use the CLI in your Ruby project.

Cron/Command Line Monitoring

honeybadger exec can be used from the command line/terminal to monitor failed commands. To use it, prefix any normal command with honeybadger exec (much like bundle exec):

$ honeybadger exec my-command --my-flag

If the command executes successfully, honeybadger exits with code 0. It prints any output from the command by default. To use with cron's automatic email feature, use the --quiet flag, which will suppress all standard output from the origin command unless the command fails and the Honeybadger notification fails, in which case it will dump the output so that cron can send a backup email notification.

To learn more, run honeybadger help exec.

Notify from the Command Line

To send a Honeybadger notification from the command line/terminal, use honeybadger notify:

$ honeybadger notify --message "This is an error from the command line"

To learn more, run honeybadger help notify.