Skip to content

Commit

Permalink
implement send_notifcation() for node monitor tracker
Browse files Browse the repository at this point in the history
  • Loading branch information
louisevelayo committed Nov 16, 2023
1 parent 86352c0 commit 7fca29a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
2 changes: 2 additions & 0 deletions node_monitor/load_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
DB_NAME = os.environ.get('DB_NAME', '')
DB_PORT = os.environ.get('DB_PORT', '')
FEEDBACK_FORM_URL = os.environ.get('FEEDBACK_FORM_URL', '')
NODE_MONITOR_URL = os.environ.get('NODE_MONITOR_URL', '')
EMAIL_ADMINS_LIST = os.environ.get('EMAIL_ADMINS_LIST', '')


## Pre-flight check
Expand Down
15 changes: 10 additions & 5 deletions node_monitor_tracker/node_monitor_tracker.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
from typing import List
from node_monitor.bot_email import EmailBot

class NodeMonitorTracker:
def __init__(self, slack_token: str) -> None:
raise NotImplementedError
def __init__(self, email_bot: EmailBot, recipients: List[str]) -> None:
self.email_bot = email_bot
self.recipients = recipients

def send_notification() -> None:
raise NotImplementedError
def send_notification(self) -> None:
subject = "🚨 Node Monitor is Down 🚨"
body = "Node Monitor is down. Restart required immediately!"
self.email_bot.send_emails(self.recipients, subject, body)

def check_server_status() -> bool:
def check_server_status(self) -> bool:
raise NotImplementedError


0 comments on commit 7fca29a

Please sign in to comment.