Skip to content
This repository has been archived by the owner on Nov 3, 2021. It is now read-only.

Commit

Permalink
Merge pull request #316 from ameihm0912/master
Browse files Browse the repository at this point in the history
Add a new alert plugin for events from geomodel
  • Loading branch information
jeffbryner committed Nov 24, 2015
2 parents 0021e78 + b823fb9 commit d5cbea7
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions alerts/geomodel.py
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)

0 comments on commit d5cbea7

Please sign in to comment.