Skip to content
This repository was archived by the owner on Jul 19, 2022. It is now read-only.

Commit 052cc1c

Browse files
committed
fix new flags
1 parent 3999154 commit 052cc1c

File tree

4 files changed

+6
-5
lines changed

4 files changed

+6
-5
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ Versioning](http://semver.org/spec/v2.0.0.html).
1313

1414
### Changed
1515
- Update Readme
16+
- Both flags `--heartbeat` and `--remediation-events` discard any event with status `!= 0`.
1617

1718
## [1.0.3] - 2021-04-01
1819
### Added

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ More ideas about remediation try this [plugin][12].
271271

272272
### Option keepalived handler
273273

274-
This option enable opsgenie plugin to send heatbeat pings instead creating new alerts. This options could fit in keepalive for important network assets or important integrations (like [alert manager plugin][14]).
274+
This option enable opsgenie plugin to send heatbeat pings instead creating new alerts. This options could fit in keepalive for important network assets or important integrations (like [alert manager plugin][14]). If this check fails, and this plugin receives an event with status `!= 0` it discard this event. Opsgenie will alert you using heartbeat configuration.
275275

276276
Flags `--heartbeat` and `--hearbeat-map` can map a entity/check to a [heartbeat][13] in opsgenie.
277277

main.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -470,7 +470,7 @@ func executeHandler(event *types.Event) error {
470470
return fmt.Errorf("failed to create opsgenie client: %s", err)
471471
}
472472
// always create an alert in opsgenie if status != 0
473-
if event.Check.Status != 0 {
473+
if event.Check.Status != 0 && !plugin.RemediationEvents && !plugin.HeartbeatEvents {
474474
return createIncident(alertClient, event)
475475
}
476476

tests/test.all.events.sh

+3-3
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ event_with_opsgenie_priority.check
66
event_with_opsgenie_priority"
77

88
echo "Test open a incident with status 0"
9-
cat event.resolved.json | ./sensu-opsgenie-handler
9+
cat event.resolved.json | ./../sensu-opsgenie-handler
1010

1111

1212
for event in $list ;
1313
do
1414
echo "${event} With default region"
15-
cat ${event}.json | ./sensu-opsgenie-handler
15+
cat ${event}.json | ./../sensu-opsgenie-handler
1616
sleep 5
17-
cat ${event}.resolved.json | ./sensu-opsgenie-handler
17+
cat ${event}.resolved.json | ./../sensu-opsgenie-handler
1818
done

0 commit comments

Comments
 (0)