Skip to content

Commit 7a88e28

Browse files
committed
add node ip address to status if node is remote
1 parent b764a2e commit 7a88e28

File tree

5 files changed

+17
-9
lines changed

5 files changed

+17
-9
lines changed

modules/alert_bot.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ def init(self):
142142
from modules.validator import ValidatorModule
143143
self.validator_module = ValidatorModule(self.ton, self.local)
144144
self.hostname = get_hostname()
145-
self.ip = self.ton.get_validator_engine_ip()
145+
self.ip = self.ton.get_node_ip()
146146
self.set_global_vars()
147147
self.inited = True
148148

mytoncore/mytoncore.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3819,13 +3819,16 @@ def GetNetworkName(self):
38193819
return "unknown"
38203820
#end define
38213821

3822-
def get_validator_engine_ip(self):
3822+
def get_node_ip(self):
38233823
try:
38243824
config = self.GetValidatorConfig()
38253825
return int2ip(config['addrs'][0]['ip'])
38263826
except:
38273827
return None
38283828

3829+
def get_validator_engine_ip(self):
3830+
return self.validatorConsole.addr.split(':')[0]
3831+
38293832
def GetFunctionBuffer(self, name, timeout=10):
38303833
timestamp = get_timestamp()
38313834
buff = self.local.buffer.get(name)

mytonctrl/mytonctrl.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -762,6 +762,11 @@ def PrintLocalStatus(local, ton, adnlAddr, validatorIndex, validatorEfficiency,
762762
validatorVersion_text = local.translate("local_status_version_validator").format(validatorGitHash_text, validatorGitBranch_text)
763763

764764
color_print(local.translate("local_status_head"))
765+
node_ip = ton.get_validator_engine_ip()
766+
is_node_remote = node_ip != '127.0.0.1'
767+
if is_node_remote:
768+
nodeIpAddr_text = local.translate("node_ip_address").format(node_ip)
769+
color_print(nodeIpAddr_text)
765770
if ton.using_validator():
766771
print(validatorIndex_text)
767772
# print(validatorEfficiency_text)
@@ -776,7 +781,8 @@ def PrintLocalStatus(local, ton, adnlAddr, validatorIndex, validatorEfficiency,
776781

777782
print(disksLoad_text)
778783
print(mytoncoreStatus_text)
779-
print(validatorStatus_text)
784+
if not is_node_remote:
785+
print(validatorStatus_text)
780786
print(validator_out_of_sync_text)
781787
print(validator_out_of_ser_text)
782788
print(dbStatus_text)

mytonctrl/resources/translate.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,11 @@
249249
"ru": "{cyan}===[ Статус ноды ]==={endc}",
250250
"zh_TW": "{cyan}===[ 节点狀態 ]==={endc}"
251251
},
252+
"node_ip_address": {
253+
"en": "Node IP address: {{bold}}{0}{{endc}}",
254+
"ru": "IP адрес Ноды: {{bold}}{0}{{endc}}",
255+
"zh_TW": "節點 IP 地址: {{bold}}{0}{{endc}}"
256+
},
252257
"local_status_validator_index": {
253258
"en": "Validator index: {0}",
254259
"ru": "Индекс валидатора: {0}",

mytoninstaller/mytoninstaller.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -302,12 +302,6 @@ def General(local, console):
302302
#end define
303303

304304

305-
"""
306-
Node server: Mtc is being installed and configures node, creates backup but does not create mytoncore service.
307-
Mtc server: TON bins and Mtc are being installed, restores keys and mytoncore db from backup (in case validator on Node server was installed before), creates mytoncore service.
308-
"""
309-
310-
311305
###
312306
### Start of the program
313307
###

0 commit comments

Comments
 (0)