diff options
-rwxr-xr-x | metrics.py | 18 |
1 files changed, 16 insertions, 2 deletions
@@ -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(), |