A command line tool for interacting with Opsgenie.
Download the latest opsgenie
executable and put it in your path.
Set your Opsgenie API key:
export OPSGENIE_API_KEY=<api-key>
To get help:
opsgenie --help
Run command like this one to get all open alerts:
opsgenie alerts
To search alerts:
opsgenie alerts --query=oomkill
To list integrations:
opsgenie integrations
To list integrations filtered by regex:
opsgenie integrations --reg=<integration-regex>
To disable an integration:
opsgenie integrations disable --id=<integration-id>
To enable an integration:
opsgenie integrations enable --id=<integration-id>
You can enable or disable integrations by name or regular expression using the --name=<integration-name>
and --reg=<integration-regex>
arguments.
The --reg
argument allows bulk enable/disable of integrations, like this:
opsgenie integrations disable --reg=-core-prod-
Use the --dry-run
argument to see what changes would be applied without actually changing them.
jq is a command line tool for working with JSON data: https://stedolan.github.io/jq/
Using jq to extract a list of integration names:
opsgenie integrations | jq ".[] | .name"
Getting integration names as a JSON list:
opsgenie integrations | jq "[.[] | .name]"
Have Node.js v12.16.3 installed. Nexe (the bundler) doesn't yet work with Node.js 14.
Use NVM to ensure you have the right version of Node.js installed.
export OPSGENIE_API_KEY=<api-key>
npx ts-node src/index.ts alerts
Use the debug argument to get debug logging:
npx ts-node src/index.ts alerts --debug
Using a search query for alerts:
npx ts-node src/index.ts alerts --query=oomkill
Listing integrations:
npx ts-node src/index.ts integrations
Enable an integration:
npx ts-node src/index.ts integrations enable --id=<integration-id>
Disable an integration:
npx ts-node src/index.ts integrations disable --id=<integration-id>
Enable an integration ny name:
npx ts-node src/index.ts integrations enable --name="rds-core-test"
Disable an integration by name
npx ts-node src/index.ts integrations disable --name="rds-core-test"
MacOS:
npm run build-mac
Windows:
npm run build-win
Linux:
npm run build-linux
Now upload the executables to GitHub releases.