Skip to content
Snippets Groups Projects
Commit 4ce2e441 authored by jurgenhaas's avatar jurgenhaas
Browse files

Close elastalert alerts if they contain "new_value=up"

parent 9dde0ac5
No related branches found
No related tags found
No related merge requests found
import json
import logging
from alerta.plugins import PluginBase
......@@ -14,6 +15,10 @@ class Elastalert(PluginBase):
super().__init__()
def pre_receive(self, alert, **kwargs):
if alert.service.pop() == 'elastalert':
if alert.raw_data.find('\nnew_value: [\n \"up\"\n]') > 0:
alert.severity = 'normal'
alert.status = 'closed'
return alert
def post_receive(self, alert, **kwargs):
......
......@@ -12,8 +12,10 @@ setup(
author='Jürgen Haas',
author_email='juergen.haas@lakedrops.com',
packages=find_packages(),
py_modules=[],
install_requires=[],
py_modules=['alerta_elastalert'],
install_requires=[
'requests'
],
include_package_data=True,
zip_safe=True,
entry_points={
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment