aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornico <nico@magicbroccoli.de>2020-06-17 00:41:59 +0200
committernico <nico@magicbroccoli.de>2020-06-25 00:20:47 +0200
commitbf05b826a110609d6317184cbdbc519b55b51c85 (patch)
treee7455a66289ae9250db331bb1ef10fd1a68b885b
parent87dc79a2f7b7195a98e8cbadeb0e04b1b1c7a6bb (diff)
add more global values
* organize global values + add global uptime value + add global processes count value
-rw-r--r--calls.py10
-rwxr-xr-xmetrics.py8
2 files changed, 15 insertions, 3 deletions
diff --git a/calls.py b/calls.py
index bd6bd0a..83b3fe3 100644
--- a/calls.py
+++ b/calls.py
@@ -75,6 +75,16 @@ class EjabberdApiCalls(EjabberdApi):
return result
return result["s2s_outgoing"]
+ def fetch_uptime(self):
+ result = self.cmd("stats", {"name": "uptimeseconds"})
+ if "stat" in result:
+ return result["stat"]
+
+ def fetch_processes(self):
+ result = self.cmd("stats", {"name": "processes"})
+ if "stat" in result:
+ return result["stat"]
+
def fetch_registered_count(self, vhost=None):
if vhost is None:
result = self.cmd("stats", {"name": "registeredusers"})
diff --git a/metrics.py b/metrics.py
index bd8a3ea..8b25db5 100755
--- a/metrics.py
+++ b/metrics.py
@@ -210,6 +210,10 @@ class EjabberdMetrics(EjabberdApiCalls):
data = {
"registered": self.get_registered(),
"muc": self.get_muc(),
+ "s2s_in": self.get_s2s_in(),
+ "s2s_out": self.get_s2s_out(),
+ "uptime": self.fetch_uptime(),
+ "processes": self.fetch_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(),
@@ -229,9 +233,7 @@ class EjabberdMetrics(EjabberdApiCalls):
data["online_client_by_ipversion"] = self.get_online_client_by_ipversion()
data["nodes"] = nodes
-
- data["s2s_in"] = self.get_s2s_in()
- data["s2s_out"] = self.get_s2s_out()
+
return data