Skip to content

kumarappan-arumugam/opsgenie-py

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

OpsGenie Python SDK

Inspired by opsgenie

Aim and Scope

OpsGenie Python SDK aims to access OpsGenie Web API through HTTP calls from a client application in Python language.

OpsGenie Python SDK covers:

Pre-requisites

  • The API is specifically built for Python 2.7 but can also be used with other Python versions.
  • Before you begin, you need to sign up OpsGenie if you don't have a valid account yet. Create an API Integration and get your API key.

Installation

To download all packages in the repo with their dependencies, simply execute

pip install https://github.com/kumarappan-arumugam/opsgenie-py/archive/master.zip

Getting Started

One can start using OpsGenie Python SDK by initializing client and making a request. Example shown below demonstrates how to initialize our client and make a create alert request.


from opsgenie import OpsGenie
from opsgenie import Configuration
from opsgenie import CreateAlertRequest

config = Configuration(apikey="YOUR_API_KEY", endpoint="OPTIONAL") # default endpoint is api.opsgenie.com
client = OpsGenie(config)
alert_request = CreateAlertRequest(
			        message = "An example alert message",
			        alias = "",
			        description = "Every alert needs a description",
			        responders = [
				        {"name":"Example", "type":"team"},
				        {"username":"example@example.com", "type":"user"},
				        {"name":"Example Escalation", "type":"escalation"},
				        {"name":"Example Schedule", "type":"schedule"}
				    ],
			        visibleTo = [
				        {"name":"Example","type":"team"},
				        {"username":"example@example.com","type":"user"}
				    ],
			        actions = ["Restart", "AnExampleAction"],
			        tags = ["Example","Environment"],
			        details = {"key1":"value1","key2":"value2"},
			        entity = "An example entity",
			        priority = "P1"
                )
client.alert.create_alert(alert_request)

Importance of Alias

Alert De-Duplication

The Web API

Please follow the links below for more information and details about the Web API.

Bug Reporting and Feature Requests

If you like to report a bug, or a feature request; please create a github issue.