Lamp: Incident commands

This commands allows you to create, update and delete incident using Lamp command line

Create Incident command

Lamp createIncident command is used to create incidents in OpsGenie. createIncident command takes the following parameters:

Mandatory Parameters

Parameter
messageIncident text limited to 130 characters

Optional Parameters

Parameter
--descriptionIncident text in long form. Unlike the message field, not limited to 130 characters.
--typeType of responders which need to be added to the incident . Values : user , team`
--responderResponder identifiers in the same order as type.
--tagsA comma separated list of labels attached to the incident.
--detailKeysDetails are stored in Key/Value pair. List of comma separated keys in Details
--detailValuesList of comma separated corresponding values to the keys specified in detailKeys
--priorityThe priority of alert. Values: P1, P2, P3, P4, P5 default is P3
--noteAdditional incident note
--serviceIdService Id of associated service
--statusPageEntityTitleTitle of Status Entity Page
--statusPageEntityDescriptionDescription of Status Entity page

Sample Usage:

With mandatory parameters:

opsgenie-lamp createIncident --message "Incident 3"

With optional parameters:

opsgenie-lamp createIncident --message "Incident 3" --description "This is a test Incident" --type "team" --responder "Team 2" --tags "service" --detailKeys "key1,key2" --detailValues "value5,value6" --priority "P3" --note "This is a note 2" --serviceId "test" --statusPageEntityTitle "Title1" --statusPageEntityDescription "Desc1"

Get Incident command

Lamp getIncident command is used to get an incident from OpsGenie with unique identifier . getIncident command takes the following parameters:

Mandatory Parameters

Parameter
--identifierId of the Incident whose information we want to get
--identifierTypeType of identifier used to identify incident tiny, id default is id

With mandatory parameters:

./opsgenie-lamp getIncident --identifier "3" --identifierType "tiny"

Get Incident List command

Lamp getIncidentList command fetches list of all incidents in OpsGenie. getIncidentList command takes the following parameters:

Mandatory Parameters

Parameter
queryQuery to fetch incidents required. Example:- status: open

Optional Parameters

Parameter
--limitPage size. Default is 20. Max value for this parameter is 100.
--sortFieldcreatedAt, tinyId, message, status, isSeen, owner default is createdAt
--offsetStart index of the result set (to apply pagination). Minimum value (and also default value) is 0
--orderasc/desc, default: desc

Sample Usage:

With mandatory parameters:

opsgenie-lamp getIncidentList --query "status: open"

With optional parameters:

./opsgenie-lamp getIncidentList --limit "1" --sortField "createdAt" --offset "0" --order "desc"  --query "status: open"

Add Note to Incident command

Lamp addNoteToIncident command is used to add a note incident from OpsGenie with unique identifier . addNoteToIncident command takes the following parameters:

Mandatory Parameters

Parameter
--identifierId of the Incident to which note needs to be added
--identifierTypeType of identifier used to identify incident tiny, id default is id
--noteNote which needs to be added

With mandatory parameters:

./opsgenie-lamp addNoteToIncident --identifier "3" --identifierType "tiny" --note "Test Note will be added right now"

Add Incident Tags command

Lamp addIncidentTags command add tags to incidents in OpsGenie. addIncidentTags command takes the following parameters:

Mandatory Parameters

Parameter
--identifierId of the Incident to which tags needs to be added
--identifierTypeType of identifier used to identify incident tiny, id default is id
--tagsA comma separated list of labels that needs to added to the incident.

Optional Parameters

Parameter
--noteNote which needs to be added

Sample Usage:

With mandatory parameters:

./opsgenie-lamp addIncidentTags --identifier "3" --identifierType "tiny" --tags "rocking"

With optional parameters:

./opsgenie-lamp addIncidentTags --identifier "3" --identifierType "tiny" --note "Adding tags"  --tags "downtime,failing"

Remove Incident Tags command

Lamp removeIncidentTags command remove tags from incidents in OpsGenie. removeIncidentTags command takes the following parameters:

Mandatory Parameters

Parameter
--identifierId of the Incident to which tags needs to be removed
--identifierTypeType of identifier used to identify incident tiny, id default is id
--tagsA comma separated list of labels that needs toremoved to the incident.

Optional Parameters

Parameter
--noteNote which needs to be added

Sample Usage:

With mandatory parameters:

./opsgenie-lamp removeIncidentTags --identifier "3" --identifierType "tiny" --tags "rocking"

With optional parameters:

./opsgenie-lamp removeIncidentTags --identifier "3" --identifierType "tiny" --note "Removing tags"  --tags "downtime,failing"

Add Incident Details command

Lamp addIncidentDetails command add details to incidents in OpsGenie. addIncidentDetails command takes the following parameters:

Mandatory Parameters

Parameter
--identifierId of the Incident to which details needs to be added
--identifierTypeType of identifier used to identify incident tiny, id default is id
--detailKeysDetails are stored in Key/Value pair. List of comma separated keys in Details
--detailValuesList of comma separated corresponding values to the keys specified in detailKeys

Optional Parameters

Parameter
--noteNote which needs to be added

Sample Usage:

With mandatory parameters:

./opsgenie-lamp addIncidentDetails --identifier "3" --identifierType "tiny"  --detailKeys "key5,key6" --detailValues "value9,value10"

With optional parameters:

./opsgenie-lamp addIncidentDetails --identifier "3" --identifierType "tiny" --note "Adding Details"  --detailKeys "key5,key6" --detailValues "value9,value10"

Remove Incident Details command

Lamp removeIncidentDetails command remove details from incidents in OpsGenie. removeIncidentDetails command takes the following parameters:

Mandatory Parameters

Parameter
--identifierId of the Incident to which details needs to be removed
--identifierTypeType of identifier used to identify incident tiny, id default is id
--tagsDetails are stored in Key/Value pair. List of comma separated keys in Details which needs to removed.

Optional Parameters

Parameter
--noteNote which needs to be added

Sample Usage:

With mandatory parameters:

./opsgenie-lamp removeIncidentDetails --identifier "3" --identifierType "tiny" --keys "key5"

With optional parameters:

./opsgenie-lamp removeIncidentDetails --identifier "3" --identifierType "tiny" --note "Adding Details"  --keys "key5"

Update Priority command

Lamp updateIncidentPriority command is used to update priority of an incident in OpsGenie with unique identifier . updateIncidentPriority command takes the following parameters:

Mandatory Parameters

Parameter
--identifierId of the Incident whose priority we want to update
--identifierTypeType of identifier used to identify incident tiny, id default is id
--priorityThe priority of alert. Values: P1, P2, P3, P4, P5 default is P3

With mandatory parameters:

./opsgenie-lamp updateIncidentPriority --identifier "3" --identifierType "tiny" --priority "P4"

Update Incident Message command

Lamp updateIncidentMessage command is used to update message of an incident in OpsGenie with unique identifier . updateIncidentMessage command takes the following parameters:

Mandatory Parameters

Parameter
--identifierId of the Incident whose message we want to update
--identifierTypeType of identifier used to identify incident tiny, id default is id
--messageIncident text limited to 130 characters

With mandatory parameters:

./opsgenie-lamp updateIncidentMessage --identifier "3" --identifierType "tiny" --message "updated Incident 3"

Update Incident Description command

Lamp updateIncidentDescription command is used to update description of an incident in OpsGenie with unique identifier . getIncident command takes the following parameters:

Mandatory Parameters

Parameter
--identifierId of the Incident whose description needs to be updated
--identifierTypeType of identifier used to identify incident tiny, id default is id
--descriptionIncident text in long form. Unlike the message field, not limited to 130 characters.

With mandatory parameters:

./opsgenie-lamp updateIncidentDescription --identifier "3" --identifierType "tiny"  --description "Updated Description"

Close Incident command

Lamp closeIncident command is used to close incident from OpsGenie with unique identifier . closeIncident command takes the following parameters:

Mandatory Parameters

Parameter
--identifierId of the Incident to which needs to be closed
--identifierTypeType of identifier used to identify incident tiny, id default is id
--noteNote which needs to be added

With mandatory parameters:

./opsgenie-lamp closeIncident --identifier "3" --identifierType "tiny" --note "Clsoing incident"

Delete Incident command

Lamp deleteIncident command is used to delete an incident from OpsGenie with unique identifier . deleteIncident command takes the following parameters:

Mandatory Parameters

Parameter
--identifierId of the Incident which needs to be deleted
--identifierTypeType of identifier used to identify incident tiny, id default is id

With mandatory parameters:

./opsgenie-lamp deleteIncident --identifier "3" --identifierType "tiny"

Add Incident Responders command

Lamp addIncidentResponders command adds responders to an incident in OpsGenie. addIncidentResponders command takes the following parameters:

Mandatory Parameters

Parameter
--identifierId of the Incident to which responders needs to be added
--identifierTypeType of identifier used to identify incident tiny, id default is id
--typeType of responders which need to be added to the incident . Values : user , team`
--responderA comma separated list of labels attached to the incident.

Optional Parameters

Parameter
--noteNote which needs to be added

Sample Usage:

With mandatory parameters:

./opsgenie-lamp addIncidentResponders --identifier "3" --identifierType "tiny" --type "team" --responder "Team 2"

With optional parameters:

./opsgenie-lamp addIncidentResponders --identifier "3" --identifierType "tiny" --note "Adding Team 2 as Responder" --type "team" --responder "Team 2"