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
- 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
- Download Lamp Zip
- 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)
- Download Lamp Zip
- 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:
- 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
- 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. - 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 | |
connectionTimeout | Connection timeout for request executed across Opsgenie server | No | 50 Sec |
requestTimeout | Total timeout value of the request executed across Opsgenie server. It should be greater than connectionTimeout. | No | 100 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 | No | - |
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 | http |
Lamp Log Configuration
Setting | Description | Mandatory | Default value |
---|---|---|---|
lamp.log.level | Log level | No | warn |
lamp.log.file | Log file's name | No | lamp.log |
Lamp log files can be written custom locations with custom names. And these methods also have an order.(Will be referred as LOGS_DIR in the rest of documentation):
Log directory specification methods
- To specify logs location, Lamp looks for an environment variable: LAMP_LOGS_DIR. If this environment variable is set, it writes logs to the specified path.
- If environment variable is not set, Lamp uses the default <LAMP_HOME>/logs directory.
Log file name specification methods
- If you specify
lamp.log.file=customLogFileName.log1
in lamp configuration file, it will write logs with the given file name. - If you don't specify any log file name in configuration, default log file name will be "lamp.log"
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 = |
--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 |
--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" --recipients [email protected]
With optional parameters:
opsgenie-lamp createAlert --message "appserver1 down" --recipients [email protected] --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" --recipients [email protected]
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 of the alert that will be closed. Either id or alias must be provided |
--alias | Alias of the alert that will be close. Either id or alias must be provided. |
Optional Parameters
Parameter | |
---|---|
--user | Owner of execution |
--note | Additional alert note |
--notify | Comma seperated list of user and groups will be notified. Also special values "all", "recipients" and "owner" is accepted |
--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 of the alert that will be deleted |
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 of the alert that will be retrieved. Either id or alias must be provided |
--alias | Alias of the alert that will be retrieved. Either id or alias must be provided. Alias option can only be used open alert |
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 |
--searchID | id of the saved search to query with |
--searchName | name of the saved search to query with |
--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 |
--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 of the alert that ill be retrieved. Either id or alias must be provided |
--alias | Alias of the alert that will be retrieved. Either id or alias must be provided. Alias option can only be used open alert |
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 |
-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 | Od of the alert that will be retrieved. Either id or alias must be provided |
--alias | Alias of the alert that will be retrieved. Either id or alias must be provided. Alias option can be used open alert |
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
List Alert Recipients Command
Lamp listAlertRecipients command is used to list alert recipients from Opsgenie. listAlertRecipients command takes the following parameters:
Mandatory Parameters
Parameter | |
---|---|
--id | Id of the alert that will be retrieved. Either id or alias must be provided |
--alias | Alias of the alert that will be retrieved. Either id or alias must be provided. Alias option can only be used open alert |
Sample Usage:
opsgenie-lamp listAlertRecipients --id 37d2c2b0-a64f-4dbe-b592-df06e34e7683
Acknowledge Command
Lamp acknowledge command is used to acknowledge alerts in Opsgenie. acknowledge command takes the following parameters:
Mandatory Parameters
Parameter | |
---|---|
--id | Id of the alert that will be acknowledged. Either id or alias must be provided |
--alias | Alias of the alert that will be acknowledged. Either id or alias must be provided. Alias option can only be used open alerts |
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 of the alert that will be unacknowledged. Either id or alias must be provided |
--alias | Alias of the alert that will be unacknowledged. Either id or alias must be provided. Alias option can only be used open alerts |
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 of the alert that will be snoozed. Either id or alias must be provided |
--alias | Alias of the alert that will be snoozed. Either id or alias must be provided. Alias option can only be used open alerts |
--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"
Renotify Command (Deprecated)
Lamp renotify command is used to renotify alert recipients. renotify command takes the following parameters:
Mandatory Parameters
Parameter | |
---|---|
--id | Id of the alert that recipient will be renotified for. Either id or alias must be provided |
--alias | Alias of the alert that recipient will be renotified for. Either id or alias must be provided. Alias option can only be used open alerts |
Optional Parameters
Parameter | |
---|---|
--recipients | The user names of individual users or names of groups that will be renotified for alert. If no recipient specified, all existing alert recipients will be renotified. |
--user | Owner of execution |
--note | Additional alert note |
--source | Source of action |
Sample Usage:
opsgenie-lamp renotify --id 44d2e383-df30-49e1-820e-65e8e6e6387f
opsgenie-lamp renotify --alias appserver3Down --recipients [email protected]
Take Ownership Command (Deprecated)
Lamp takeOwnership command is used to take ownership of alerts in Opsgenie. takeOwnership command takes the following parameters:
Mandatory Parameters
Parameter | |
---|---|
--id | Id of the alert that will be owned. Either id or alias must be provided |
--alias | Alias of the alert that will be owned. Either id or alias must be provided. Alias option can only be used open alerts |
Optional Parameters
Parameter | |
---|---|
--user | Owner of execution |
--note | Additional alert note |
--source | Source of action |
Sample Usage:
opsgenie-lamp takeOwnership --id 44d2e383-df30-49e1-820e-65e8e6e6387f
opsgenie-lamp takeOwnership --apiKey ab5454992-fabb2-4ba2-ad44f-1af65ds8b5c079 --alias appserver3Down
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 of the alert that will be assigned. Either id or alias must be provided |
--alias | Alias of the alert that will be assigned. Either id or alias must be provided. Alias option can only be used open alerts |
--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 [email protected]
opsgenie-lamp assign --apiKey ab5454992-fabb2-4ba2-ad44f-1af65ds8b5c079 --alias appserver3Down --owner [email protected]
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 of the alert that the new team will be added. Either id or alias must be provided |
--alias | Alias of the alert that the new team will be added. Either id or alias must be provided. Alias option can only be used open alerts |
--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 Recipient Command
Lamp addRecipient command is used to add new recipients to alerts in Opsgenie. addRecipient command takes the following parameters:
Mandatory Parameters
Parameter | |
---|---|
--id | Id of the alert that the new recipient will be added. Either id or alias must be provided |
--alias | Alias of the alert that the new recipient will be added. Either id or alias must be provided. Alias option can only be used open alerts |
--recipient | The recipient 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 addRecipient --id 44d2e383-df30-49e1-820e-65e8e6e6387f --recipient [email protected]
opsgenie-lamp addRecipient --apiKey ab5454992-fabb2-4ba2-ad44f-1af65ds8b5c079 --alias appserver3Down --recipient [email protected]
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 of the alert that will be retrieved. Either id or alias must be provided |
--alias | Alias of the alert that will be retrieved. Either id or alias must be provided. Alias option can only be used open alerts |
--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 of the alert that will be retrieved. Either id or alias must be provided |
--alias | Alias of the alert that will be retrieved. Either id or alias must be provided. Alias option can only be used open alerts |
--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 of the alert that will be retrieved. Either id or alias must be provided |
--alias | Alias of the alert that will be retrieved. Either id or alias must be provided. Alias option can only be used open alerts |
--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 of the alert that will be retrieved. Either id or alias must be provided |
--alias | Alias of the alert that will be retrieved. Either id or alias must be provided. Alias option can only be used open alerts |
-D | Additional alert properties. The syntax is -D = |
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 of the alert that will be retrieved. Either id or alias must be provided |
--alias | Alias of the alert that will be retrieved. Either id or alias must be provided. Alias option can only be used open alerts |
--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 of the alert that the action will be executed on. Either id or alias must be provided |
--alias | Alias of the alert that the action will be executed on. Either id or alias must be provided. Alias option can only be used open alerts |
--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 of the alert that the file will be attached. Either id, alias or tinyId must be provided |
--alias | Alias of the alert that the file will be attached. Either id, alias or tinyId must be provided. Alias option can only be used open alerts |
--tinyId | TinyId of the alert that the file will be attached. Either id, alias or tinyId must be provided |
--attachment | Absolute or relative path to the file |
--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 [email protected]
opsgenie-lamp attachFile --tinyId 5 --attachment ~/Desktop/attachment.jpg --user [email protected] --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 of the alert that the file will be attached. Either id, alias or tinyId must be provided |
--alias | Alias of the alert that the file will be attached. Either id, alias or tinyId must be provided. Alias option can only be used open alerts |
--tinyId | TinyId of the alert that the file will be attached. Either id, alias or tinyId must be provided |
--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 of the alert that the file will be attached. Either id, alias or tinyId must be provided |
--alias | Alias of the alert that the file will be attached. Either id, alias or tinyId must be provided. Alias option can only be used open alerts |
--tinyId | TinyId of the alert that the file will be attached. Either id, alias or tinyId must be provided |
--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 of the alert that the file will be attached. Either id, alias or tinyId must be provided |
--alias | Alias of the alert that the file will be attached. Either id, alias or tinyId must be provided. Alias option can only be used open alerts |
--tinyId | TinyId of the alert that the file will be attached. Either id, alias or tinyId must be provided |
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 of the alert that the file will be attached. Either id, alias or tinyId must be provided |
--alias | Alias of the alert that the file will be attached. Either id, alias or tinyId must be provided. Alias option can only be used open alerts |
--tinyId | TinyId of the alert that the file will be attached. Either id, alias or tinyId must be provided |
--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 of the alert that will be retrieved. Either id or alias must be provided |
--alias | Alias of the alert that will be retrieved. Either id or alias must be provided. Alias option can only be used open alerts |
--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. |
--name | Name of the integration/policy that will be enabled. Either id or name must be provided |
Sample Usage
opsgenie-lamp enable --id ab5454992-fabb2-4ba2-ad44f-1af65ds8b5c079
opsgenie-lamp enable --apiKey ab5454992-fabb2-4ba2-ad44f-1af65ds8b5c079 --name "Nagios 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. |
--name | Name of the integration/policy that will be disabled. Either id or name must be provided |
Sample Usage
opsgenie-lamp disable --id ab5454992-fabb2-4ba2-ad44f-1af65ds8b5c079
opsgenie-lamp disable --apiKey ab5454992-fabb2-4ba2-ad44f-1af65ds8b5c079 --name "Nagios 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.
Updated over 5 years ago