Skip to main content

Thin wrappers around various notification systems

Project description

hns_notification

Thin wrapper around various notification systems.

Notifications available

  1. Opsgenie

Installation

pip install hns-notification

Opsgenie usage

Below code snippet shows how to create alert on opsgenie.

# Your API key
api_key = 'api_key'

# Configure the opsgenie api. This would return you an api client object
api_client = configure(api_key)

# Create the alert, pass the api client and the alert message body. 
# Check https://docs.opsgenie.com/docs/python-sdk-alert#section-create-alert for details on accepted alert body fields.  
alert = create_alert(api_client, {
    'message': 'sample_msg',
    'alias': 'some-alias',
    'responders': [{
                'name': 'SampleTeam',
                'type': 'team'
              }],
    'visible_to': [
      {'name': 'Sample',
       'type': 'team'}],
    'actions': ['Restart', 'AnExampleAction'],
    'tags': ['OverwriteQuietHours'],
    'details': {'key1': 'value1',
             'key2': 'value2'},
    'entity': 'An example entity',
    'priority': 'P3',
    'description': 'Sample of SDK v2'
})

# This returns the opsgenie response object containing the request_id and result of create alert. 
print(alert)

Project details


Release history Release notifications

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for hns-notification, version 19.12
Filename, size File type Python version Upload date Hashes
Filename, size hns_notification-19.12-py3-none-any.whl (3.5 kB) File type Wheel Python version py3 Upload date Hashes View hashes
Filename, size hns-notification-19.12.tar.gz (2.2 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page