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 import logging
from alerta.plugins import PluginBase from alerta.plugins import PluginBase
...@@ -14,6 +15,10 @@ class Elastalert(PluginBase): ...@@ -14,6 +15,10 @@ class Elastalert(PluginBase):
super().__init__() super().__init__()
def pre_receive(self, alert, **kwargs): 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 return alert
def post_receive(self, alert, **kwargs): def post_receive(self, alert, **kwargs):
......
...@@ -12,8 +12,10 @@ setup( ...@@ -12,8 +12,10 @@ setup(
author='Jürgen Haas', author='Jürgen Haas',
author_email='juergen.haas@lakedrops.com', author_email='juergen.haas@lakedrops.com',
packages=find_packages(), packages=find_packages(),
py_modules=[], py_modules=['alerta_elastalert'],
install_requires=[], install_requires=[
'requests'
],
include_package_data=True, include_package_data=True,
zip_safe=True, zip_safe=True,
entry_points={ entry_points={
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment