This repository has been archived by the owner on Nov 3, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 327
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #316 from ameihm0912/master
Add a new alert plugin for events from geomodel
- Loading branch information
Showing
1 changed file
with
33 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#!/usr/bin/env python | ||
|
||
# This Source Code Form is subject to the terms of the Mozilla Public | ||
# License, v. 2.0. If a copy of the MPL was not distributed with this | ||
# file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
# Copyright (c) 2015 Mozilla Corporation | ||
# | ||
# Contributors: | ||
# Aaron Meihm <ameihm@mozilla.com> | ||
|
||
from lib.alerttask import AlertTask | ||
import pyes | ||
|
||
class AlertGeomodel(AlertTask): | ||
def main(self): | ||
date_timedelta = dict(minutes=30) | ||
|
||
must = [ | ||
pyes.TermFilter('_type', 'event'), | ||
pyes.TermFilter('category', 'geomodelnotice'), | ||
] | ||
self.filtersManual(date_timedelta, must=must, must_not=[]) | ||
self.searchEventsSimple() | ||
self.walkEvents() | ||
|
||
# Set alert properties | ||
def onEvent(self, event): | ||
category = 'geomodel' | ||
tags = ['geomodel'] | ||
severity = 'NOTICE' | ||
|
||
summary = event['_source']['summary'] | ||
return self.createAlertDict(summary, category, tags, [event], severity) |