You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Issue Summary
Need to create a plugin which adds an attribute to alert received from heartbeat . Main goal is blackout using that attribute instead of creating blackout for everyday . That plugin will add this attribute value true/false as per requirement
Environment
OS: Centos
For self-hosted, WSGI environment: uwsgi
Database: MongoDB
Server config:
Auth enabled? No
Created a env using miniconda3
Located the plugins folder
create a sample file say holidaybalckout.py there
`import logging
from alerta.plugins import PluginBase
LOG = logging.getLogger('alerta.plugins')
class HolidayBlackoutReceiver(PluginBase):
def pre_receive(self, alert, **kwargs):
LOG.info('Enhancing alert...')
day_of_week = alert.create_time.strftime('%a')
hour_of_day = alert.create_time.hour
if day_of_week in ['Sat', 'Sun'] or 8 > hour_of_day > 18:
alert.attributes['isOutOfHours'] = True
else:
alert.attributes['isOutOfHours'] = False
return alert
Added this file name in configuration file and then restarted uwsgi
Expecting to have an attribute in alert either true/false but nothing was there
Could you please help me with that and how can we have regex for blackout or can we define blackouts on based of attributes ?
The text was updated successfully, but these errors were encountered:
Issue Summary
Need to create a plugin which adds an attribute to alert received from heartbeat . Main goal is blackout using that attribute instead of creating blackout for everyday . That plugin will add this attribute value true/false as per requirement
Environment
OS: Centos
For self-hosted, WSGI environment: uwsgi
Database: MongoDB
Server config:
Auth enabled? No
Created a env using miniconda3
Located the plugins folder
create a sample file say holidaybalckout.py there
`import logging
from alerta.plugins import PluginBase
LOG = logging.getLogger('alerta.plugins')
class HolidayBlackoutReceiver(PluginBase):
def pre_receive(self, alert, **kwargs):
def post_receive(self, alert, **kwargs):
return
def status_change(self, alert, status, text, **kwargs):
return
def take_action(self, alert, action, text, **kwargs):
raise NotImplementedError
def delete(self, alert, **kwargs) -> bool:
raise NotImplementedError`
Added this file name in configuration file and then restarted uwsgi
Expecting to have an attribute in alert either true/false but nothing was there
Could you please help me with that and how can we have regex for blackout or can we define blackouts on based of attributes ?
The text was updated successfully, but these errors were encountered: