aboutsummaryrefslogtreecommitdiffstats
path: root/metrics.py
diff options
context:
space:
mode:
authornico <nico@magicbroccoli.de>2020-06-26 00:58:06 +0200
committernico <nico@magicbroccoli.de>2020-06-26 00:58:06 +0200
commit907d3bdb6171997469b18f32c091885639e3444b (patch)
treea01f9cffd3cc4f7918a5a8f9e26acb4e0905f678 /metrics.py
parent7296375924350e1e7794cae3f0bf3469a0c01933 (diff)
properly implement more values
* fix the bad job with commit bf05b826 + proper guidance methods complete with a proper name
Diffstat (limited to 'metrics.py')
-rwxr-xr-xmetrics.py18
1 files changed, 16 insertions, 2 deletions
diff --git a/metrics.py b/metrics.py
index 89bf4d0..18d2eeb 100755
--- a/metrics.py
+++ b/metrics.py
@@ -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(),