Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/charleszlu/murmur-info.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCharles Lu <charles@Mumbletest.charleslu.net>2014-08-12 15:57:31 +0400
committerCharles Lu <charles@Mumbletest.charleslu.net>2014-08-12 15:57:31 +0400
commit99e3642dc3b6b0056e20cdb4a3c11a1f10b37e0f (patch)
tree4185e5e95f34fe629edc52bb71022e9ed08a5c01
parent9ddf80ad9fa4cf74c957d4c30d94d40822c59e60 (diff)
Adjusted exluded user logic to work better with not authenticated users.
Now ignores excluded users when counting not authenticated users
-rwxr-xr-xmurmur-munin.py14
1 files changed, 9 insertions, 5 deletions
diff --git a/murmur-munin.py b/murmur-munin.py
index 23ef51d..56509bf 100755
--- a/murmur-munin.py
+++ b/murmur-munin.py
@@ -134,18 +134,22 @@ except Murmur.InvalidSecretException:
sys.exit(1)
#count users
-usersnotauth=0
users=server.getUsers()
-for key in users.keys():
- if (users[key].userid == -1):
- usersnotauth+=1
#count the number of users to exclude
+#also count not authenticated users (who are not excluded)
excludedusers=0
+usersnotauth=0
+notexludedflag=0
for key in users.keys():
for name_keyword in exclude_keywords:
if (name_keyword in users[key].name):
excludedusers+=1
+ else:
+ notexludedflag=1
+ if (users[key].userid == -1 and notexludedflag):
+ usersnotauth+=1
+ notexludedflag=0
# more argument parsing for individual stats
if (sys.argv[1:]):
@@ -166,7 +170,7 @@ if (sys.argv[1:]):
ice.shutdown()
sys.exit(0)
elif (sys.argv[1] == "usersnotauth"):
- print "usersnotauth.value %i" % (usersnotauth-excludedusers)
+ print "usersnotauth.value %i" % (usersnotauth)
ice.shutdown()
sys.exit(0)
elif (sys.argv[1] == "state"):