properly implement more values

* fix the bad job with commit bf05b826
+ proper guidance methods complete with a proper name
This commit is contained in:
nico 2020-06-26 00:58:06 +02:00
parent 7296375924
commit 907d3bdb61
Signed by: mightyBroccoli
GPG Key ID: EA7C31AAB1BDC1A2
1 changed files with 16 additions and 2 deletions

View File

@ -82,6 +82,10 @@ class EjabberdMetrics(EjabberdApiCalls):
self._s2s_in = self.fetch_s2s_in()
self._s2s_out = self.fetch_s2s_out()
# misc
self._uptime = self.fetch_uptime()
self._processes = self.fetch_processes()
def get_online_by(self, by="node", parse=None, vhost=None, node=None):
parser = parse or (lambda a: a)
if not hasattr(self, "_onlineuser"):
@ -177,6 +181,16 @@ class EjabberdMetrics(EjabberdApiCalls):
self._s2s_out = self.fetch_s2s_out()
return self._s2s_out
def get_uptime(self):
if not hasattr(self, "_uptime"):
self._uptime = self.fetch_uptime()
return self._uptime
def get_processes(self):
if not hasattr(self, '_processes'):
self._processes = self.fetch_processes()
return self._processes
def get_vhost_metrics(self, vhost):
data = {
"registered": self.get_registered(vhost),
@ -212,8 +226,8 @@ class EjabberdMetrics(EjabberdApiCalls):
"muc": self.get_muc(),
"s2s_in": self.get_s2s_in(),
"s2s_out": self.get_s2s_out(),
"uptime": self.fetch_uptime(),
"processes": self.fetch_processes(),
"uptime": self.get_uptime(),
"processes": self.get_processes(),
"online_by_status": self.get_online_by_status(),
"online_by_client": self.get_online_by_client(),
"online_by_ipversion": self.get_online_by_ipversion(),