aboutsummaryrefslogtreecommitdiffstats
path: root/metrics.py
diff options
context:
space:
mode:
authorgenofire <geno+dev@fireorbit.de>2020-06-10 12:48:18 +0200
committergenofire <geno+dev@fireorbit.de>2020-06-10 12:50:35 +0200
commitdd30520c628e175761930b111e31020db8cfcb36 (patch)
treebc677bc29e3d6521af1b221464972a2238a8ef71 /metrics.py
parent6bb4308de23065f824d14a20455192001c82794e (diff)
improve control.py
Diffstat (limited to 'metrics.py')
-rwxr-xr-xmetrics.py24
1 files changed, 6 insertions, 18 deletions
diff --git a/metrics.py b/metrics.py
index 5fd5320..c21511b 100755
--- a/metrics.py
+++ b/metrics.py
@@ -53,18 +53,6 @@ class EjabberdMetrics(EjabberdCtl):
return 4
return addr.version
- def fetch_muc(self, vhost=None):
- host = "global"
- if vhost is not None:
- if self.verstring.major >= 19:
- host = '.'.join([self.muc_host, vhost])
- else:
- host = vhost
- result = self.cmd("muc_online_rooms", {"host": host})
- if "rooms" in result:
- return len(result["rooms"])
- return len(result)
-
def update(self):
# nodes
self._nodes = self.fetch_nodes()
@@ -75,17 +63,17 @@ class EjabberdMetrics(EjabberdCtl):
# registered
if not hasattr(self, "_registered"):
self._registered = {}
- self._registered[None] = self.fetch_registered()
+ self._registered[None] = self.fetch_registered_count()
# muc
if not hasattr(self, "_muc"):
self._muc = {}
- self._muc[None] = self.fetch_muc()
+ self._muc[None] = self.fetch_muc_count()
# registered + muc
for vhost in self._vhosts:
- self._registered[vhost] = self.fetch_registered(vhost)
- self._muc[vhost] = self.fetch_muc(vhost)
+ self._registered[vhost] = self.fetch_registered_count(vhost)
+ self._muc[vhost] = self.fetch_muc_count(vhost)
# online user
self._onlineuser = self.fetch_onlineuser()
@@ -164,14 +152,14 @@ class EjabberdMetrics(EjabberdCtl):
if not hasattr(self, "_registered"):
self._registered = {}
if vhost not in self._registered:
- self._registered[vhost] = self.fetch_registered(vhost)
+ self._registered[vhost] = self.fetch_registered_count(vhost)
return self._registered[vhost]
def get_muc(self, vhost=None):
if not hasattr(self, "_muc"):
self._muc = {}
if vhost not in self._muc:
- self._muc[vhost] = self.fetch_muc(vhost)
+ self._muc[vhost] = self.fetch_muc_count(vhost)
return self._muc[vhost]
def get_vhosts(self):