Skip to content

Commit

Permalink
Merge pull request #15 from nixwiz/updates
Browse files Browse the repository at this point in the history
Handler updates
  • Loading branch information
Todd Campbell authored Jan 27, 2021
2 parents 804a24f + 73208ff commit e8ee591
Show file tree
Hide file tree
Showing 21 changed files with 252 additions and 162 deletions.
16 changes: 16 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Go Lint

on: [push, pull_request]

jobs:
test:
name: Lint
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Run golangci-lint
uses: actions-contrib/golangci-lint@v1
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,15 @@ Versioning](http://semver.org/spec/v2.0.0.html).

## Unreleased

### Changed
- Changed tags from hard-coded list to templates settable via argument
- Moved test files into tests directory to clean up top level directory
- Updated all modules with 'go get -u' and 'go mod tidy'
- README updates and cleanup

### Added
- Lint GitHub Action

## [0.8.0] - 2020-12-01

### Changed
Expand Down
45 changes: 25 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,16 @@

## Table of Contents
- [Overview](#overview)
- [Files](#files)
- [Usage examples](#usage-examples)
- [Help output](#help-output)
- [Templates](#templates)
- [To use Opsgenie Priority](#to-use-opsgenie-priority)
- [To use alert actions](#to-use-alert-actions)
- [Configuration](#configuration)
- [Asset registration](#asset-registration)
- [Handler definition](#handler-definition)
- [Environment Variables](#environment-variables)
- [Argument Annotations](#argument-annotations)
- [Environment variables](#environment-variables)
- [Argument annotations](#argument-annotations)
- [Proxy support](#proxy-support)
- [Installation from source](#installation-from-source)
- [Contributing](#contributing)
Expand All @@ -24,13 +27,13 @@ The Sensu Go OpsGenie Handler is a [Sensu Event Handler][3] which manages
[OpsGenie][2] incidents, for alerting operators. With this handler,
[Sensu][1] can trigger OpsGenie incidents.

This handler was inspired by [pagerduty plugin][6].
To configure OpsGenie Sensu Integration follow these first part in [OpsGenie Docs][5].

## Files
This handler was inspired by [pagerduty plugin][6].

N/A
## Usage examples

## Usage Examples
### Help output

Help:
```
Expand Down Expand Up @@ -58,31 +61,36 @@ Flags:
-F, --fullDetails Include the more details to send to OpsGenie like proxy_entity_name, occurrences and agent details arch and os
-w, --withAnnotations Include the event.metadata.Annotations in details to send to OpsGenie
-W, --withLabels Include the event.metadata.Labels in details to send to OpsGenie
-T, --tagTemplate strings The template to assign for the incident in OpsGenie (default [{{.Entity.Name}},{{.Check.Name}},{{.Entity.Namespace}},{{.Entity.EntityClass}}])
-s, --sensuDashboard string The OpsGenie Handler will use it to create a source Sensu Dashboard URL. Use OPSGENIE_SENSU_DASHBOARD. Example: http://sensu-dashboard.example.local/c/~/n
-h, --help help for sensu-opsgenie-handler
Use "sensu-opsgenie-handler [command] --help" for more information about a command.
```

To configure OpsGenie Sensu Integration follow these first part in [OpsGenie Docs][5].
### Templates

#### To use Opsgenie Priority
This handler provides options for using templates to populate various fields in the OpsGenie
alert with values provided in the Sensu event. More information on template syntax and format
can be found in [the documentation][12]


### To use Opsgenie Priority

Use the `--priority` command-line option to specify a default priority and then use check and/or
entity annotations to override the default on a per-check or per-entity basis. See
[Argument Annotations](#argument-annotations) for more information.

#### To use alert actions
### To use alert actions

Use the `--actions` command-line option to specify alert actions to be triggered by an event. The
argument for this option is a comma separated list of actions. Use check and/or entity annotations
to set this option on a per-check or per-entity basis. See [Argument Annotations](#argument-annotations)
for more information.

## Configuration
### Sensu Go
#### Asset registration
### Asset registration

[Sensu Assets][7] are the best way to make use of this plugin. If you're not using an asset, please
consider doing so! If you're using sensuctl 5.13 with Sensu Backend 5.13 or later, you can use the
Expand All @@ -95,7 +103,7 @@ sensuctl asset add nixwiz/sensu-opsgenie-handler
If you're using an earlier version of sensuctl, you can find the asset on the [Bonsai Asset Index][8].


#### Handler definition
### Handler definition

```yml
type: Handler
Expand All @@ -119,7 +127,7 @@ spec:
secret: opgsgenie_authtoken
```
### Environment Variables
### Environment variables
Most arguments for this handler are available to be set via environment variables. However, any
arguments specified directly on the command line override the corresponding environment variable.
Expand Down Expand Up @@ -154,7 +162,7 @@ spec:
id: OPSGENIE_AUTHTOKEN
```
### Argument Annotations
### Argument annotations
All arguments for this handler are tunable on a per entity or check basis based on annotations. The
annotations keyspace for this handler is `sensu.io/plugins/sensu-opsgenie-handler/config`.
Expand All @@ -172,17 +180,13 @@ metadata:
[...]
```

### Proxy Support
### Proxy support

This handler supports the use of the environment variables HTTP_PROXY,
HTTPS_PROXY, and NO_PROXY (or the lowercase versions thereof). HTTPS_PROXY takes
precedence over HTTP_PROXY for https requests. The environment values may be
either a complete URL or a "host[:port]", in which case the "http" scheme is assumed.

### Sensu Core

See [this plugin][9]

## Installation from source

Download the latest version of the sensu-opsgenie-handler from [releases][4],
Expand All @@ -208,3 +212,4 @@ See https://github.com/sensu/sensu-go/blob/master/CONTRIBUTING.md
[9]: https://github.com/sensu-plugins/sensu-plugins-opsgenie
[10]: https://docs.sensu.io/sensu-go/latest/guides/secrets-management/
[11]: https://docs.sensu.io/sensu-go/latest/guides/secrets-management/#use-env-for-secrets-management
[12]: https://docs.sensu.io/sensu-go/latest/observability-pipeline/observe-process/handler-templates/
27 changes: 16 additions & 11 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,32 @@ go 1.14
require (
github.com/coreos/etcd v3.3.25+incompatible // indirect
github.com/fsnotify/fsnotify v1.4.9 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/protobuf v1.4.3 // indirect
github.com/google/uuid v1.2.0 // indirect
github.com/hashicorp/go-retryablehttp v0.6.8 // indirect
github.com/json-iterator/go v1.1.10 // indirect
github.com/magiconair/properties v1.8.4 // indirect
github.com/mitchellh/mapstructure v1.3.3 // indirect
github.com/opsgenie/opsgenie-go-sdk v0.0.0-20181102130742-d57b8391ca90
github.com/opsgenie/opsgenie-go-sdk-v2 v1.2.2
github.com/mitchellh/mapstructure v1.4.1 // indirect
github.com/opsgenie/opsgenie-go-sdk-v2 v1.2.6
github.com/pelletier/go-toml v1.8.1 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/robertkrimen/otto v0.0.0-20200922221731-ef014fd054ac // indirect
github.com/sensu-community/sensu-plugin-sdk v0.11.0
github.com/sensu/sensu-go/types v0.3.0
github.com/sensu/sensu-go/api/core/v2 v2.6.0 // indirect
github.com/sensu/sensu-go/types v0.4.0
github.com/sirupsen/logrus v1.7.0 // indirect
github.com/spf13/afero v1.4.1 // indirect
github.com/spf13/afero v1.5.1 // indirect
github.com/spf13/cast v1.3.1 // indirect
github.com/spf13/cobra v1.1.0 // indirect
github.com/spf13/cobra v1.1.1 // indirect
github.com/spf13/jwalterweatherman v1.1.0 // indirect
github.com/spf13/viper v1.7.1 // indirect
github.com/stretchr/testify v1.6.0
golang.org/x/net v0.0.0-20201010224723-4f7140c49acb // indirect
golang.org/x/sys v0.0.0-20201015000850-e3ed0017c211 // indirect
google.golang.org/genproto v0.0.0-20201015140912-32ed001d685c // indirect
google.golang.org/grpc v1.33.0 // indirect
google.golang.org/protobuf v1.25.0 // indirect
golang.org/x/net v0.0.0-20210119194325-5f4716e94777 // indirect
golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c // indirect
golang.org/x/text v0.3.5 // indirect
google.golang.org/genproto v0.0.0-20210126160654-44e461bb6506 // indirect
google.golang.org/grpc v1.35.0 // indirect
gopkg.in/ini.v1 v1.62.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
)
Loading

0 comments on commit e8ee591

Please sign in to comment.