mirceaulinic / alerta-blackout-regex

Alerta plugin to enhance the blackout management
Apache License 2.0
6 stars 4 forks source link

when enabled NO alerts at all #12

Closed vj6 closed 1 year ago

vj6 commented 3 years ago

I've plugin installed in alerta vene in docker container.

RUN python3 -m venv /venv && \
    /venv/bin/pip install --no-cache-dir alerta-blackout-regex

can see it's installed

alerta@alerta-6c7f6d5996-qlptf:/$ /venv/bin/pip freeze | grep reg
alerta-blackout-regex==2.0.0
alerta@alerta-6c7f6d5996-qlptf:/venv$ ls /venv/lib/python3.7/site-packages/blackout_regex.py
/venv/lib/python3.7/site-packages/blackout_regex.py

I can see it can also import requires things.

alerta@alerta-6c7f6d5996-qlptf:/venv/lib/python3.7/site-packages$ python3
Python 3.7.9 (default, Dec 18 2020, 05:32:43) 
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> import re
>>> import json
>>> import time
>>> import shutil
>>> import logging
>>> import tempfile
>>> 
>>> from alertaclient.api import Client
>>> from alerta.plugins import PluginBase
>>> from alertaclient.models.blackout import Blackout
>>> log = logging.getLogger('alerta.plugins.blackout_regex')
>>> 
>>> CACHE_ENABLED = os.getenv('ALERTA_BLACKOUT_CACHE_ENABLED', True)
>>> CACHE_FILE = os.getenv('ALERTA_BLACKOUT_CACHE_FILE', '/var/cache/alerta/blackout_regex')
>>> CACHE_TIME = os.getenv('ALERTA_BLACKOUT_CACHE_TIME', 60)  # seconds
>>> 
>>> client = Client()
>>> print(client)
<alertaclient.api.Client object at 0x7f90b9c01410>

However, when this plugin is enabled, I'm not seeing any alerts at all (pls not there is no blackout enable for any alert at all).

alerta@alerta-6c7f6d5996-qlptf:/venv/lib/python3.7/site-packages$ env | grep -i plug
PLUGINS=reject,heartbeat,blackout_regex,slack

Can you pls help with the right way to enable and configure this, am I doing something differently?

vj6 commented 3 years ago

@mirceaulinic can you pls have a look, when you get a chance?

mirceaulinic commented 3 years ago

Hey @vj-gsr, I've just released 2.0.2 which may be helpful for your use-case. Also, I'd probably recommend enabling the native blackout plugin too, just before this one, i.e., PLUGINS=reject,heartbeat,blackout,blackout_regex,slack. Could you confirm this helps?

vj6 commented 3 years ago

@mirceaulinic thanks for the update, I've updated the plugin to 2.0.2 and PLUGINS=reject,heartbeat,blackout,blackout_regex,slack now even if I put blackout I still see alerts.

just so that I'm doing it right, I've k8s workload name "vjtest1-69cb5bccd-rqscq" for this if I put regex blackout like *.vj.* or *vjtest* on resource, I still see the active alert and it notifies on slack (nothing in blackout)

Pls let me know if you need any details to debug? version details for reference.

+ echo '# Checking versions.'
Alerta Server 8.5.0
Alerta Client 8.5.0
Alerta WebUI 8.5.0
+ echo Alerta Server 8.5.0
+ echo Alerta Client 8.5.0
+ echo Alerta WebUI 8.5.0
+ nginx -v
nginx version: nginx/1.20.0
++ uwsgi --version
uwsgi 2.0.19.1
+ echo uwsgi 2.0.19.1
+ mongo --version
+ grep MongoDB
MongoDB shell version v4.2.13
+ psql --version
psql (PostgreSQL) 11.11 (Debian 11.11-0+deb10u1)
+ python3 --version
Python 3.7.10
+ /venv/bin/pip list
Package                  Version
------------------------ -----------
aiohttp                  3.7.4.post0
alerta                   8.5.0
alerta-alertops          1.0.0.1
alerta-amqp              5.4.1
alerta-blackout-regex    2.0.2
alerta-cachet            5.0.1
alerta-ding              0.0.1
alerta-enhance           5.3.3
alerta-geoip             5.4.0
alerta-influxdb          5.4.3
alerta-logger            5.3.2
alerta-logstash          5.3.3
alerta-mattermost        1.1.3
alerta-msteams           5.2.1
alerta-normalise         5.3.1
alerta-op5               5.0.2
alerta-opsgenie          5.0.3
alerta-pagerduty         5.3.1
alerta-prometheus        5.4.0
alerta-pubsub            5.2.2
alerta-pushover          5.3.2
alerta-rocketchat        5.0.0
alerta-server            8.5.0
alerta-slack             5.5.2
alerta-sns               5.3.1
alerta-telegram          5.1.3
alerta-twilio            5.4.0
alerta-zabbix            5.1.2
amqp                     5.0.6
async-timeout            3.0.1
attrs                    20.3.0
bcrypt                   3.2.0
blinker                  1.4
boto                     2.49.0
Brotli                   1.0.9
cachetools               4.2.1
certifi                  2020.12.5
cffi                     1.14.5
chardet                  4.0.0
click                    7.1.2
cryptography             3.4.6
decorator                5.0.7
defusedxml               0.7.1
elementpath              2.2.1
Flask                    1.1.2
Flask-Compress           1.9.0
Flask-Cors               3.0.10
google-api-core          1.26.3
google-auth              1.29.0
google-cloud-pubsub      2.4.1
googleapis-common-protos 1.53.0
grpc-google-iam-v1       0.12.3
grpcio                   1.30.0
httplib2                 0.19.1
idna                     2.10
importlib-metadata       4.0.1
importlib-resources      5.1.2
influxdb                 5.3.1
itsdangerous             1.1.0
Jinja2                   2.11.3
kombu                    5.0.2
libcst                   0.3.18
lxml                     4.6.3
MarkupSafe               1.1.1
matterhook               0.2
mohawk                   1.1.0
msgpack                  1.0.2
multidict                5.1.0
mypy-extensions          0.4.3
oauth2client             4.1.3
op5lib                   1.0
packaging                20.9
pbr                      5.5.1
pip                      20.1.1
proto-plus               1.18.1
protobuf                 3.15.8
psycopg2                 2.8.6
pyasn1                   0.4.8
pyasn1-modules           0.2.8
pycparser                2.20
PyJWT                    2.0.1
pymongo                  3.11.3
pymsteams                0.1.14
pyOpenSSL                20.0.1
pyparsing                2.4.7
pysaml2                  6.5.1
python-cachetclient      0.2.5
python-dateutil          2.8.1
python-ldap              3.3.1
pytz                     2021.1
PyYAML                   5.4.1
pyzabbix                 0.8.2
requests                 2.25.1
requests-hawk            1.1.0
rsa                      4.7.2
sentry-sdk               0.19.4
setuptools               56.0.0
six                      1.15.0
tabulate                 0.8.9
telepot                  12.7
termcolor                1.1.0
twilio                   6.50.1
typing-extensions        3.7.4.3
typing-inspect           0.6.0
urllib3                  1.26.4
uWSGI                    2.0.19.1
vine                     5.0.0
Werkzeug                 1.0.1
xmlschema                1.6.1
yarl                     1.6.3
zipp                     3.4.1
mirceaulinic commented 2 years ago

Hey @vj6 - would you mind trying again with version 3.0.0?