Reviewed-on: #23ping4
commit
6e39e473d2
|
@ -6,6 +6,12 @@ All notable changes to this project will be documented in this file.
|
||||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
||||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
|
## [3.2.0] - 2025-04-10
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- Operating system: periodically ping ogcore
|
||||||
|
|
||||||
## [3.1.0] - 2025-04-07
|
## [3.1.0] - 2025-04-07
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
|
@ -30,7 +30,6 @@
|
||||||
@author: Ramón M. Gómez, ramongomez at us dot es
|
@author: Ramón M. Gómez, ramongomez at us dot es
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
import base64
|
import base64
|
||||||
import os
|
import os
|
||||||
import random
|
import random
|
||||||
|
@ -102,6 +101,20 @@ class OpenGnSysWorker(ServerWorker):
|
||||||
exec_level = None # Execution level (permitted operations)
|
exec_level = None # Execution level (permitted operations)
|
||||||
jobmgr = JobMgr()
|
jobmgr = JobMgr()
|
||||||
|
|
||||||
|
## pings ogcore
|
||||||
|
def mon (self):
|
||||||
|
n = 0
|
||||||
|
while True:
|
||||||
|
time.sleep (1)
|
||||||
|
n += 1
|
||||||
|
if not n % 10:
|
||||||
|
body = {
|
||||||
|
"iph": self.interface.ip,
|
||||||
|
"timestamp": int (time.time()),
|
||||||
|
}
|
||||||
|
logger.debug (f'about to send ping ({body})')
|
||||||
|
self.REST.sendMessage ('clients/status/webhook', body)
|
||||||
|
|
||||||
def onActivation(self):
|
def onActivation(self):
|
||||||
"""
|
"""
|
||||||
Sends OGAgent activation notification to OpenGnsys server
|
Sends OGAgent activation notification to OpenGnsys server
|
||||||
|
@ -189,6 +202,8 @@ class OpenGnSysWorker(ServerWorker):
|
||||||
if os.path.isfile(new_hosts_file):
|
if os.path.isfile(new_hosts_file):
|
||||||
shutil.copyfile(new_hosts_file, hosts_file)
|
shutil.copyfile(new_hosts_file, hosts_file)
|
||||||
|
|
||||||
|
threading.Thread (name='monitoring_thread', target=self.mon, daemon=True).start()
|
||||||
|
|
||||||
logger.debug ('onActivation ok')
|
logger.debug ('onActivation ok')
|
||||||
|
|
||||||
def onDeactivation(self):
|
def onDeactivation(self):
|
||||||
|
|
|
@ -241,12 +241,8 @@ class ogLiveWorker(ServerWorker):
|
||||||
n += 1
|
n += 1
|
||||||
if not n % 10:
|
if not n % 10:
|
||||||
body = {
|
body = {
|
||||||
"iph": self.IPlocal,
|
'iph': self.IPlocal,
|
||||||
"ido": self.idordenador,
|
'timestamp': int (time.time()),
|
||||||
"npc": self.nombreordenador,
|
|
||||||
"idc": self.idcentro,
|
|
||||||
"ida": self.idaula,
|
|
||||||
"timestamp": int (time.time()),
|
|
||||||
}
|
}
|
||||||
logger.debug (f'about to send ping ({body})')
|
logger.debug (f'about to send ping ({body})')
|
||||||
self.REST.sendMessage ('clients/status/webhook', body)
|
self.REST.sendMessage ('clients/status/webhook', body)
|
||||||
|
|
Loading…
Reference in New Issue