diff --git a/modules/alert_bot.py b/modules/alert_bot.py index e702846d..2ebf4034 100644 --- a/modules/alert_bot.py +++ b/modules/alert_bot.py @@ -83,6 +83,7 @@ def __init__(self, ton, local, *args, **kwargs): self.validator_module = None self.inited = False self.hostname = None + self.ip = None self.token = None self.chat_id = None self.last_db_check = 0 @@ -113,6 +114,7 @@ def send_alert(self, alert_name: str, *args, **kwargs): ❗️ MyTonCtrl Alert {alert_name} ❗️ Hostname: {self.hostname} +Node IP: {self.ip} Time: {time_} ({int(time.time())}) Severity: {alert.severity} @@ -140,6 +142,7 @@ def init(self): from modules.validator import ValidatorModule self.validator_module = ValidatorModule(self.ton, self.local) self.hostname = get_hostname() + self.ip = self.ton.get_validator_engine_ip() self.set_global_vars() self.inited = True @@ -206,6 +209,9 @@ def check_db_usage(self): def check_validator_wallet_balance(self): if not self.ton.using_validator(): return + validator_status = self.ton.GetValidatorStatus() + if not validator_status.is_working or validator_status.out_of_sync >= 20: + return validator_wallet = self.ton.GetValidatorWallet() validator_account = self.ton.GetAccount(validator_wallet.addrB64) if validator_account.balance < 10: diff --git a/mytoncore/mytoncore.py b/mytoncore/mytoncore.py index 757660ce..95b9851d 100644 --- a/mytoncore/mytoncore.py +++ b/mytoncore/mytoncore.py @@ -30,7 +30,7 @@ get_timestamp, timestamp2datetime, dec2hex, - Dict + Dict, int2ip ) @@ -3793,6 +3793,13 @@ def GetNetworkName(self): return "unknown" #end define + def get_validator_engine_ip(self): + try: + config = self.GetValidatorConfig() + return int2ip(config['addrs'][0]['ip']) + except: + return None + def GetFunctionBuffer(self, name, timeout=10): timestamp = get_timestamp() buff = self.local.buffer.get(name)