From a18479bd7009a6b522ee8227d56dbb10165986dc Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Thu, 7 Jul 2016 18:48:58 +0200 Subject: mod_c2s, mod_s2s: Bootstrap connection count statistic on module load --- plugins/mod_c2s.lua | 10 ++++++++++ plugins/mod_s2s/mod_s2s.lua | 10 ++++++++++ 2 files changed, 20 insertions(+) (limited to 'plugins') diff --git a/plugins/mod_c2s.lua b/plugins/mod_c2s.lua index 2829d5fd..e69bf461 100644 --- a/plugins/mod_c2s.lua +++ b/plugins/mod_c2s.lua @@ -36,6 +36,16 @@ local hosts = prosody.hosts; local stream_callbacks = { default_ns = "jabber:client" }; local listener = {}; +do + -- Connection counter resets to 0 on load and reload + -- Bump it up to current value + local count = 0; + for _ in pairs(sessions) do + count = count + 1; + end + measure_connections(count); +end + --- Stream events handlers local stream_xmlns_attr = {xmlns='urn:ietf:params:xml:ns:xmpp-streams'}; diff --git a/plugins/mod_s2s/mod_s2s.lua b/plugins/mod_s2s/mod_s2s.lua index f05e2a95..ea186cf0 100644 --- a/plugins/mod_s2s/mod_s2s.lua +++ b/plugins/mod_s2s/mod_s2s.lua @@ -43,6 +43,16 @@ local sessions = module:shared("sessions"); local log = module._log; +do + -- Connection counter resets to 0 on load and reload + -- Bump it up to current value + local count = 0; + for _ in pairs(sessions) do + count = count + 1; + end + measure_connections(count); +end + --- Handle stanzas to remote domains local bouncy_stanzas = { message = true, presence = true, iq = true }; -- cgit v1.2.3