Lamp: Command Line

Lamp is a Go based command line utility to interact with Opsgenie service. It provides capabilities to create and close alerts, attach files, etc.

Lamp is used to integrate any management tool that can execute a shell script with Opsgenie. Lamp interacts with the Opsgenie service through the RESTful Web API.

Lamp has a built in contextual help system for obtaining information on available commands, and available options for their use. If you invoke lamp with the --help option, you will see the available list of commands. If you invoke lamp with the --help option with a specific command, you will see the options for that command.

For ease of use apiKey should be set in conf file that lamp will use, for some flexible use cases --apiKey parameter can also be used when executing lamp commands.

To migrate your Java based Lamp to Go Based Lamp you can refer to Migration Guide

Installation

Prerequisites:

  • Opsgenie account: If you don't already have one create an Opsgenie account
  • If you're downloading from source, Opsgenie Lamp requires Go version 1.4.1 or above. Golang can be downloaded from here. One should make sure the GOPATH and GOROOT variables are set accordingly.

OpsGenie Lamp is a Go-based command line utility and can be obtained in two ways:

Downloading with go get

  1. Lamp can be installed via the command: go get github.com/opsgenie/opsgenie-lamp/...

The go get command will produce an executable named "opsgenie-lamp", hence you should use "opsgenie-lamp" instead of "lamp" like following:

opsgenie-lamp createAlert --message "host down"

Downloading Lamp Zip

  1. Download Lamp Zip
  2. Unzip lamp zip file which contains Lamp package into a directory.
    • For Windows use lamp.exe
    • For Linux use lamp

Downloading Lamp Zip (For Mac)

  1. Download Lamp Zip
  2. Unzip opsgenie-lamp zip file which contains Lamp package into a directory.

*Internet Requirement : By default Lamp requires internet connection to reach Opsgenie.
If Lamp host server does not have internet connection you can configure Lamp Proxy settings, see below.
Marid can also be used as a proxy for Lamp.

Configuration

Application Configuration

Lamp is able to use configuration files in different locations. There are several ways to do it, and methods have an order:

  1. If you want to use a configuration file located in a custom location, you can define it in your commands.If Lamp command contains --config parameter, it uses the given file as configuration.
opsgenie-lamp createAlert --message "host down" --config /opt/conf/myConfigurationFile.conf
  1. If there is no --config parameter defined, Lamp looks for an Environment variable: LAMP_CONF_PATH. If this environment variable is set, lamp uses the given file as configuration.
  2. If none of the methods given above works, Lamp uses the default <LAMP_HOME>/conf/lamp.conf file as configuration

The following are the common configuration settings for Lamp:

Lamp Configuration Settings

Setting
Description
Mandatory
Default Value

apiKey

API key used for authenticating API requests.
API key can be obtained by adding an API Integration.

  • Optionally --apiKey parameter can also be set when executing lamp commands, in this case the apiKey in the configuration file will not be used.

No

-

user

Default owner of the execution. If user is not specified for Lamp action this value will be used.

No

requestTimeout

Total timeout value of the request executed across Opsgenie server. Unit: second

No

30 Sec

Lamp Proxy Configuration Settings

In order to use Lamp on systems that are behind firewalls do not have direct access to the Internet, you need to configure Lamp proxy settings to interact with Opsgenie web services API, create alerts, etc. Marid Overview can also be used as a proxy for Lamp.

Setting
Description
Mandatory
Default Value

proxyHost

Proxy host

Yes

-

proxyPort

Proxy port

No

-

proxyUsername

Proxy authentication username

No

-

proxyPassword

Proxy authentication password

No

-

proxyProtocol

Proxy connection protocol. It may be one of http depending on your proxy servers.

No

https

Create Alert Command

Lamp createAlert command is used to create alerts in OpsGenie. createAlert command takes the following parameters:

Mandatory Parameters

Parameter

--message

Alert text limited to 130 characters

Optional Parameters

Parameter

--alias

A user defined identifier for the alert and there can be only one alert with open status with the same alias. Provides ability to assign a known id and later use this id to perform additional actions such as log, close, attach for the same alert.

--actions

A comma separated list of actions that can be executed. Custom actions can be defined to enable users to execute actions for each alert. All action executions will be posted to Outgoing Integrations like Webhook, Marid, Slack, HipChat etc

--source

Field to specify source of alert. By default, it will be assigned to IP address of incoming request

--tags

A comma separated list of labels attached to the alert.

--description

Alert text in long form. Unlike the message field, not limited to 130 characters.

-D

Additional alert properties. The syntax is -D <property name>=<property value>

--entity

The entity the alert is related to.

--priority

The priority of alert. Values: P1, P2, P3, P4, P5 default is P3

--user

Owner of execution

--note

Additional alert note

--teams

A comma separated list of teams for setting responders

--users

A comma separated list of users for setting responders

--escalations

A comma separated list of escalations for setting responders

--schedules

A comma separated list of schedules for setting responders

--apiKey

API key used for authenticating API requests * If not given the api key in the conf file will be used
Optional API key is valid for all Lamp commands

--configFile

Location of a custom configuration file

-v

Execute commands in verbose mode.

Sample Usage:

With mandatory parameters:

opsgenie-lamp createAlert --message "appserver1 down" 

With optional parameters:

opsgenie-lamp createAlert --message "appserver1 down  --description "appserver1 is not responding to requests and reported as down by the monitoring tools"  --tags "operations, servers" --actions "stop, restart" -D severity=critical

With optional apiKey parameter :

opsgenie-lamp createAlert --apiKey ab5454992-fabb2-4ba2-ad44f-1af65ds8b5c079 --message "appserver1 down"

With optional config and verbose parameter:

opsgenie-lamp createAlert -v --message "appserver1 down" --config "/opt/conf/myConfigurationFile.conf"

Close Alert Command

Lamp closeAlert command is close open alerts in OpsGenie. closeAlert command takes the following parameters:

Mandatory Parameters

Parameter

--id

Id value of the alert that will be closed. Id, tiny Id or alias must be provided.

--identifier

Identifier type of the given id with '--id' flag, can be 'id', 'tiny' or 'alias'.

Optional Parameters

Parameter

--user

Owner of execution

--note

Additional alert note

--source

Source of action

Sample Usage:

opsgenie-lamp closeAlert --id 44d2e383-df30-49e1-820e-65e8e6e6387f 
opsgenie-lamp closeAlert --apiKey ab5454992-fabb2-4ba2-ad44f-1af65ds8b5c079 --alias appserver3Down

Delete Alert Command

Lamp deleteAlert command is delete alerts in Opsgenie. deleteAlert command takes the following parameters:

Mandatory Parameters

Parameter

--id

Id value of the alert that will be closed. Id, tiny Id or alias must be provided.

--identifier

Identifier type of the given id with '--id' flag, can be 'id', 'tiny' or 'alias'. Default value is id.

Optional Parameters

Parameter

--user

Owner of execution

--source

Source of action

Sample Usage:

opsgenie-lamp deleteAlert --id 44d2e383-df30-49e1-820e-65e8e6e6387f 

Get Alert Command

Lamp getAlert command is used to get alerts details from OpsGenie. getAlert command takes the following parameters:

Mandatory Parameters

Parameter

--id

Id value of the alert that will be closed. Id, tiny Id or alias must be provided.

--identifier

Identifier type of the given id with '--id' flag, can be 'id', 'tiny' or 'alias'. Default value is id.

Optional Parameters

Parameter

--output-format

Retrieved alert can be printed as JSON or YAML format. Default value is json

--pretty

Boolean flag to print retrieved alert as pretty json

Sample Usage:

opsgenie-lamp getAlert --id 44d2e383-df30-49e1-820e-65e8e6e6387f
opsgenie-lamp getAlert --alias appserver3Down
opsgenie-lamp getAlert --id 44d2e383-df30-49e1-820e-65e8e6e6387f --output-format yaml
opsgenie-lamp getAlert --id 44d2e383-df30-49e1-820e-65e8e6e6387f --pretty

List Alerts Command

Lamp listAlerts command is used to list alerts details from Opsgenie. listAlerts command takes the following parameters:

Optional Parameters

Parameter
Description

--query

Search query to apply while filtering the alerts. Details

--limit

Page size. Default is 20. Max value for this parameter is 100.

--sortBy

createdAt, updatedAt, default is createdAt

--offset

Start index of the result set (to apply pagination). Minimum value (and also default value) is 0

--order

asc/desc, default: desc

--searchIdentifier

Identifier of the saved search query to apply while filtering the alerts

--searchIdentifierType

Identifier type of the value at searchIdentifier, which can be id or name. Default value is id. If searchIdentifier is not provided, this value is ignored.

--output-format

Retrieved alerts can be printed as JSON and YAML format. Default value is json.

--pretty

Boolean flag to print retrieved alert as pretty json.

Sample Usage:

opsgenie-lamp listAlerts 
opsgenie-lamp listAlerts --query "status: open AND teams = 'devops'"
opsgenie-lamp listAlerts --query "tag: (graylog AND dynamodb)" --output-format yaml
opsgenie-lamp listAlerts --limit 5 --pretty

Count Alerts Command

Lamp countAlerts command is used to count the number of alerts at Opsgenie. countAlerts command takes the following parameters:

Optional Parameters

Parameter

--query

Search query to apply while filtering the alerts. Details

--limit

Page size. Default is 20. Max value for this parameter is 100.

Sample Usage:

opsgenie-lamp countAlerts --query "status: open"
opsgenie-lamp countAlerts --query "teams = 'devops'"
opsgenie-lamp countAlerts --query "tag: (graylog AND dynamodb)" --output-format yaml

List Alert Logs Command

Lamp listAlertLogs command is used to list alert logs from Opsgenie. listAlertLogs command takes the following parameters:

Mandatory Parameters

Parameter

--id

Id value of the alert that will be closed. Id, tiny Id or alias must be provided.

--identifier

Identifier type of the given id with '--id' flag, can be 'id', 'tiny' or 'alias'. Default value is id.

Optional Parameters

Parameter

--limit

Page size. Default is 20. Max value for this parameter is 100

--offset

starting value of the offset property

--order

asc/desc, default: desc

--direction

Page direction to apply for the given offset. Possible values are next and prev. Default value is next.

-output-format

Retrieved alerts can be printed as JSON and YAML format. Default value is json

--pretty

Boolean flag to print retrieved alert as pretty json

Sample usage:

opsgenie-lamp listAlertLogs --id 37d2c2b0-a64f-4dbe-b592-df06e34e7683
opsgenie-lamp listAlertLogs --id 37d2c2b0-a64f-4dbe-b592-df06e34e7683 --limit 5 --pretty
opsgenie-lamp listAlertLogs --id 37d2c2b0-a64f-4dbe-b592-df06e34e7683 --order asc

List Alert Notes Command

Lamp listAlertNotes command is used to list alert notes from Opsgenie. listAlertNotes command takes the following parameters:

Mandatory Parameters

Parameter

--id

Id value of the alert that will be closed. Id, tiny Id or alias must be provided.

--identifier

Identifier type of the given id with '--id' flag, can be 'id', 'tiny' or 'alias'. Default value is id.

Optional Parameters

Parameter

--limit

Page size. Default is 20. Max value for this parameter is 100.

--order

asc/desc, default: desc

--offset

Starting value of the offset property.

--direction

Page direction to apply for the given offset. Possible values are next and prev. Default value is next

--output-format

Retrieved alerts can be printed as JSON and YAML format. Default value is json.

--pretty

Boolean flag to print retrieved alert as pretty json.

Sample Usage:

opsgenie-lamp listAlertNotes --id 37d2c2b0-a64f-4dbe-b592-df06e34e7683 
opsgenie-lamp listAlertNotes --id 37d2c2b0-a64f-4dbe-b592-df06e34e7683 --limit 5 --pretty
opsgenie-lamp listAlertNotes --id 37d2c2b0-a64f-4dbe-b592-df06e34e7683 --order asc

Acknowledge Command

Lamp acknowledge command is used to acknowledge alerts in Opsgenie. acknowledge command takes the following parameters:

Mandatory Parameters

Parameter

--id

Id value of the alert that will be closed. Id, tiny Id or alias must be provided.

--identifier

Identifier type of the given id with '--id' flag, can be 'id', 'tiny' or 'alias'. Default value is id.

Optional Parameters

Parameter

--user

Owner of execution

--note

Additional alert note

--source

Source of action

Sample Usage:

opsgenie-lamp acknowledge --id 44d2e383-df30-49e1-820e-65e8e6e6387f 
opsgenie-lamp acknowledge --apiKey ab5454992-fabb2-4ba2-ad44f-1af65ds8b5c079 --alias appserver3Down

Unacknowledge Command

Lamp unacknowledge command is used to unacknowledge alerts in Opsgenie. unacknowledge command takes the following parameters:

Mandatory Parameters

Parameter

--id

Id value of the alert that will be closed. Id, tiny Id or alias must be provided.

--identifier

Identifier type of the given id with '--id' flag, can be 'id', 'tiny' or 'alias'. Default value is id.

Optional Parameters

Parameter

--user

Owner of execution

--note

Additional alert note

--source

Source of action

Sample Usage:

opsgenie-lamp unacknowledge --id 44d2e383-df30-49e1-820e-65e8e6e6387f 
opsgenie-lamp unacknowledge --apiKey ab5454992-fabb2-4ba2-ad44f-1af65ds8b5c079 --alias appserver3Down

Snooze Command

Lamp snooze command is used to snooze alert at Opsgenie. snooze command takes the following parameters:

Mandatory Parameters

Parameter

--id

Id value of the alert that will be closed. Id, tiny Id or alias must be provided.

--identifier

Identifier type of the given id with '--id' flag, can be 'id', 'tiny' or 'alias'. Default value is id.

--endDate

The date in ISO8601 format snooze will end. (e.g. 2017-06-13T16:54:42Z)

Optional Parameters

Parameter

--user

Owner of execution

--note

Additional alert note

--source

Source of action

Sample Usage:

opsgenie-lamp snooze --id 44d2e383-df30-49e1-820e-65e8e6e6387f --endDate "2017-06-13T16:54:42Z"

Assign Command

Lamp assign command is used to assign the ownership of alerts in Opsgenie. assign command takes the following parameters:

Mandatory Parameters

Parameter

--id

Id value of the alert that will be closed. Id, tiny Id or alias must be provided.

--identifier

Identifier type of the given id with '--id' flag, can be 'id', 'tiny' or 'alias'. Default value is id.

--owner

The users who will be the owner of the alert after the execution.

Optional Parameters

Parameter

--user

Owner of execution

--note

Additional alert note

--source

Source of action

Sample Usage:

opsgenie-lamp assign --id 44d2e383-df30-49e1-820e-65e8e6e6387f --owner john.smith@acme.com
opsgenie-lamp assign --apiKey ab5454992-fabb2-4ba2-ad44f-1af65ds8b5c079 --alias appserver3Down --owner john.smith@acme.com

Add Team Command

Lamp addTeam command is used to add new teams to alerts in Opsgenie. addRecipient command takes the following parameters:

Mandatory Parameters

Parameter

--id

Id value of the alert that will be closed. Id, tiny Id or alias must be provided.

--identifier

Identifier type of the given id with '--id' flag, can be 'id', 'tiny' or 'alias'. Default value is id.

--team

The team that will be added to the alert.

Optional Parameters

Parameter

--user

Owner of execution

--note

Additional alert note

--source

Source of action

Sample Usage:

opsgenie-lamp addTeam --id 44d2e383-df30-49e1-820e-65e8e6e6387f --team operations
opsgenie-lamp addTeam --apiKey ab5454992-fabb2-4ba2-ad44f-1af65ds8b5c079 --alias appserver3Down --team operations

Add Responder Command

Lamp addResponder command is used to add new responders to alerts in Opsgenie. addResponder command takes the following parameters:

Mandatory Parameters

Parameter

--id

Id value of the alert that will be closed. Id, tiny Id or alias must be provided.

--identifier

Identifier type of the given id with '--id' flag, can be 'id', 'tiny' or 'alias'. Default value is id.

--responder

The responder that will be added to the alert.

--type

The responder type that which is provided at responder which can be team, user, escalation or schedule.

Optional Parameters

Parameter

--user

Owner of execution

--note

Additional alert note

--source

Source of action

Sample Usage:

opsgenie-lamp addResponder --id 44d2e383-df30-49e1-820e-65e8e6e6387f --recipient john.smith@acme.com --type user
opsgenie-lamp addRecipient --apiKey ab5454992-fabb2-4ba2-ad44f-1af65ds8b5c079 --alias appserver3Down --recipient john.smith@acme.com --type user

Add Note Command

Lamp addNote command is used to add notes to alerts in Opsgenie. addNote command takes the following parameters:

Mandatory Parameters

Parameter

--id

Id value of the alert that will be closed. Id, tiny Id or alias must be provided.

--identifier

Identifier type of the given id with '--id' flag, can be 'id', 'tiny' or 'alias'. Default value is id.

--note

Note text

Optional Parameters

Parameter

--user

Owner of execution

--source

Source of action

Sample Usage:

opsgenie-lamp addNote --id 44d2e383-df30-49e1-820e-65e8e6e6387f --note "I'll work on this"
opsgenie-lamp addNote --apiKey ab5454992-fabb2-4ba2-ad44f-1af65ds8b5c079 --alias appserver3Down --note "I'll work on this"

Add Tags Command

Lamp addTags command is used to add tags to alerts in Opsgenie. addTags command takes the following parameters:

Mandatory Parameters

Parameter

--id

Id value of the alert that will be closed. Id, tiny Id or alias must be provided.

--identifier

Identifier type of the given id with '--id' flag, can be 'id', 'tiny' or 'alias'. Default value is id.

--tags

A comma separated list of labels attached to the alert.

Optional Parameters

Parameter

--user

Owner of execution

--source

Source of action

--note

Additional alert note

Sample Usage:

opsgenie-lamp addTags --id 44d2e383-df30-49e1-820e-65e8e6e6387f --tags "tag1, tag2"
opsgenie-lamp addTags --apiKey ab5454992-fabb2-4ba2-ad44f-1af65ds8b5c079 --alias appserver3Down --tags "tag1, tag2"

Remove Tags Command

Lamp removeTags command is used to remove tags from alerts in Opsgenie. removeTags command takes the following parameters:

Mandatory Parameters

Parameter

--id

Id value of the alert that will be closed. Id, tiny Id or alias must be provided.

--identifier

Identifier type of the given id with '--id' flag, can be 'id', 'tiny' or 'alias'. Default value is id.

--tags

A comma separated list of labels attached to the alert.

Optional Parameters

Parameter

--user

Owner of execution

--source

Source of action

--note

Additional alert note

Sample Usage

opsgenie-lamp removeTags --id 44d2e383-df30-49e1-820e-65e8e6e6387f --tags "tag1, tag2"
opsgenie-lamp removeTags --apiKey ab5454992-fabb2-4ba2-ad44f-1af65ds8b5c079 --alias appserver3Down --tags "tag1, tag2"

Add Details Command

Lamp addDetails command is used to add details to alerts in Opsgenie. addDetails command takes the following parameters:

Mandatory Parameters

Parameter

--id

Id value of the alert that will be closed. Id, tiny Id or alias must be provided.

--identifier

Identifier type of the given id with '--id' flag, can be 'id', 'tiny' or 'alias'. Default value is id.

-D

Additional alert properties. The syntax is -D <property name>=<property value>

Optional Parameters

Parameter

--user

Owner of execution

--source

Source of action

--note

Additional alert note

Sample Usage:

opsgenie-lamp addDetails --id 44d2e383-df30-49e1-820e-65e8e6e6387f -D severity=critical

Remove Details Command

Lamp removeDetails command is used to remove details from alerts in Opsgenie. removeDetails command takes the following parameters:

Mandatory Parameters

Parameter

--id

Id value of the alert that will be closed. Id, tiny Id or alias must be provided.

--identifier

Identifier type of the given id with '--id' flag, can be 'id', 'tiny' or 'alias'. Default value is id.

--keys

A comma separated list of detail keys attached to the alert.

Optional Parameters

Parameter

--user

Owner of execution

--source

Source of action

--note

Additional alert note

Usage:

opsgenie-lamp removeDetails --id 44d2e383-df30-49e1-820e-65e8e6e6387f --keys severity

Execute Alert Action Command

Lamp executeAction command is used to execute custom actions on alerts in Opsgenie. executeAction command takes the following parameters:

Mandatory Parameters

Parameter

--id

Id value of the alert that will be closed. Id, tiny Id or alias must be provided.

--identifier

Identifier type of the given id with '--id' flag, can be 'id', 'tiny' or 'alias'. Default value is id.

--action

Action to execute

Optional Parameters

Parameter

--user

Owner of execution

--note

Additional alert note

--source

Source of action

Sample Usage:

opsgenie-lamp executeAction --id 44d2e383-df30-49e1-820e-65e8e6e6387f --action restartEntity
opsgenie-lamp executeAction --apiKey ab5454992-fabb2-4ba2-ad44f-1af65ds8b5c079 --alias appserver3Down --action restartEntity

Attach File Command

Lamp attachFile command is used to attach file to alerts in Opsgenie. attachFile command takes the following parameters:

Mandatory Parameters:

Parameter
Description

--id

Id value of the alert that will be closed. Id, tiny Id or alias must be provided.

--identifier

Identifier type of the given id with '--id' flag, can be 'id', 'tiny' or 'alias'. Default value is id.

--filePath

Absolute or relative path to the file

--fileName

File name

--indexFile

Name of html file which will be shown when attachment clicked on UI.

If it is not specified, following rules will be applied by order to determine index file name

  1. if it is not a zip file, it will be assigned to attachment file name
  2. If it is a zip file, it will be assigned to
    1. HTML file whose name equals attachment file name
    2. index.htm or index.html file
    3. the first HTML file found in the ZIP
    4. If no HTML file exists, it will be assigned to attachment zip file name and zip file will be downloaded from Opsgenie web site directly when clicked on attachment.

Optional Parameters

Parameter

--user

Default owner of the execution. If user is not specified, the system becomes owner of the execution.

Sample Usage:

opsgenie-lamp attachFile --tinyId 5 --attachment ~/Desktop/attachment.jpg --user user@opsgenie.com
opsgenie-lamp attachFile --tinyId 5 --attachment ~/Desktop/attachment.jpg --user user@opsgenie.com --apiKey 123

Sample Response

Result : Attachment [attachment.jpg] successfully added to alert [c8daa4c3-951d-40ee-9711-bd332040c207].

Get Attachment File Command

Lamp getAttachment command is used to get a download url for file that was attached to an alert in Opsgenie. getAttachment command takes the following parameters:

Mandatory Parameters:

Parameter
Description

--id

Id value of the alert that will be closed. Id, tiny Id or alias must be provided.

--identifier

Identifier type of the given id with '--id' flag, can be 'id', 'tiny' or 'alias'. Default value is id.

--attachmentId

Identifier of the alert attachment

**Sample Usage

opsgenie-lamp getAttachment --tinyId 5 --attachmentId 1503330358392000143 --apiKey 123

Sample Response

Download Link: 
{download link here}

Download Attachment File Command

Lamp downloadAttachment command is used to download attachment file that was attached to an alert to the specified path. downloadAttachment command takes the following parameters:

Mandatory Parameters:

Parameter
Description

--id

Id value of the alert that will be closed. Id, tiny Id or alias must be provided.

--identifier

Identifier type of the given id with '--id' flag, can be 'id', 'tiny' or 'alias'. Default value is id.

--attachmentId

Identifier of the alert attachment

--destinationPath

Path that file will be downloaded to

Sample Usage

opsgenie-lamp downloadAttachment --tinyId 5 --attachmentId 1503330358392000143 --apiKey 123 --destinationPath ~/Desktop/newfolder

List Alert Attachments Command

Lamp listAttachments command is used to list meta informations of attachments that were attached to an alert in Opsgenie. listAttachments command takes the following parameters:

Mandatory Parameters:

Parameter
Description

--id

Id value of the alert that will be closed. Id, tiny Id or alias must be provided.

--identifier

Identifier type of the given id with '--id' flag, can be 'id', 'tiny' or 'alias'. Default value is id.

Sample Usage

opsgenie-lamp listAttachments --tinyId 5 --apiKey 123

Sample Response

[
  {
    "name": "wl2.jpg",
    "id": 1503330358392000300
  },
  {
    "name": "wl2.jpg",
    "id": 1503388343129020000
  },
  {
    "name": "wl2.jpg",
    "id": 1503389457245022000
  },
  {
    "name": "wl2.jpg",
    "id": 1503389932719013600
  },
  {
    "name": "wl2.jpg",
    "id": 1503390131492009700
  }
]

Delete Attachment Command

Lamp deleteAttachment command is used to delete an attachment file that was attached to an alert in Opsgenie. deleteAttachment command takes the following parameters:

Mandatory Parameters:

Parameter
Description

--id

Id value of the alert that will be closed. Id, tiny Id or alias must be provided.

--identifier

Identifier type of the given id with '--id' flag, can be 'id', 'tiny' or 'alias'. Default value is id.

--attachmentId

Identifier of the attachment

Sample Usage

opsgenie-lamp deleteAttachment --tinyId 5 --apiKey 123 --attachmentId 1503330358392000143

Sample Response

RequestID: 46d41737-5e29-4e99-a12b-0958bb467e26
Result: Deleted

Escalate To Next Command

Lamp escalateToNext command is used to immediately process the next available rule in the specified escalation in Opsgenie. escalateToNext command takes the following parameters:

Mandatory Parameters

Parameter
Description

--id

Id value of the alert that will be closed. Id, tiny Id or alias must be provided.

--identifier

Identifier type of the given id with '--id' flag, can be 'id', 'tiny' or 'alias'. Default value is id.

--escalationId

Id of the escalation that will be escalated to the next level.

--escalationName

Name of the escalation that will be escalated to the next level.

Optional Parameters

Parameter
Description

--user

Owner of execution

--source

Source of action

--note

Additional alert note

Sample Usage:

opsgenie-lamp escalateToNext --id 44d2e383-df30-49e1-820e-65e8e6e6387f --escalationName escalation_name

Heartbeat Command

Lamp heartbeat command is used send periodic heartbeat messages to Opsgenie. The heartbeat should be added to Opsgenie before sending a heartbeat, If a heartbeat with 10 minutes interval is added and Opsgenie does not get a heartbeat message within 10 minutes, Opsgenie creates an alert to notify the specified people. heartbeat command takes the following parameters.

For more information please refer to Heartbeat Monitoring and Heartbeats API

Mandatory Parameters

Parameter
Description

--name

Name of the heartbeat on Opsgenie

Sample Usage:

opsgenie-lamp heartbeat --name ServerX

Enable Command

Lamp enable command is used to enable integrations and policies. enable command takes the following parameters.

Mandatory Parameters

Parameter
Description

--id

Id of the integration/policy that will be enabled. Either id or name must be provided

--type

Type of the entity that will be enabled. It must be integration or policy.

--policyType

Policy type should be one of alert or notification.

--teamId

Team Id for policies which are created on a team.

Sample Usage

opsgenie-lamp enable --id ab5454992-fabb2-4ba2-ad44f-1af65ds8b5c079 --type policy --teamId 0216a8a8-caa9-4ff3-9dc3-428d3c6c16aa --policyType alert
opsgenie-lamp enable --apiKey ab5454992-fabb2-4ba2-ad44f-1af65ds8b5c079 --id dc4488e2-58cc-4bae-ac37-32612fefb09b --type integration

Disable Command

Lamp disable command is used to disable integrations and policies. disable command takes the following parameters.

Mandatory Parameters

Parameter
Description

--id

Id of the integration/policy that will be disabled. Either id or name must be provided

--type

Type of the entity that will be disabled. It must be integration or policy.

--policyType

Policy type should be one of alert or notification.

--teamId

Team Id for policies which are created on a team

Sample Usage

opsgenie-lamp disable --id ab5454992-fabb2-4ba2-ad44f-1af65ds8b5c079 --type policy --teamId 0216a8a8-caa9-4ff3-9dc3-428d3c6c16aa --policyType alert
opsgenie-lamp disable --apiKey ab5454992-fabb2-4ba2-ad44f-1af65ds8b5c079 --id dc4488e2-58cc-4bae-ac37-32612fefb09b --type integration

Export Users Command

Lamp exportUsers command is used to export users to a csv file. exportUsers command takes the following parameters:

Optional Parameters

Parameter
Description

--destinationPath

Path that file will be downloaded to

--query

Search query to apply while filtering the users. Details

Sample Usage

opsgenie-lamp exportUsers --destinationPath ~/Desktop/ --query "role:Owner"
opsgenie-lamp exportUsers --apiKey ab5454992-fabb2-4ba2-ad44f-1af65ds8b5c079

Download Logs Command

Lamp downloadLogs command is used to download Opsgenie logs in a time period. downloadLogs command takes the following parameters:

Parameter
Description

-start

Download log files starting from this date. which should be in format as: YYYY-MM-DD-HH-mm-ss, i.e. 2018-10-26-15-30-00

-end

Download log files until this date. which should be in format as: YYYY-MM-DD-HH-mm-ss, i.e. 2018-10-26-15-30-00 (Optional) if not exist it will be set as now.

-path

Download path. (Optional) If not exist, Lamp will use the current directory.

Sample usage

opsgenie-lamp downloadLogs -start "2018-10-24-07-30-00" -end "2018-10-31-11-53-51" -path "/tmp/opsgenie-logs" -v

Version Command

It prompts the current Lamp Version

Sample Usage

opsgenie-lamp --version

Source

The source code is available at GitHub.

Lamp: Command Line


Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.