From c43a8d6959147b7de5852a54fe293a10795cae96 Mon Sep 17 00:00:00 2001 From: Zhuravlev Sergey <4orbit@gmail.com> Date: Mon, 8 Sep 2014 20:09:39 +0400 Subject: [PATCH] added the ability to hide the whole queue If the queue is hidden, it does not appear by yourself and do not display it agetny. This is good when on the same server several different queues for different purposes. It is necessary if the configuration is multi-tenant, and each tenant their queues. --- README.md | 1 + queuemon.py | 13 +++++++++++++ 2 files changed, 14 insertions(+) diff --git a/README.md b/README.md index 45cdbd5..bb945e4 100644 --- a/README.md +++ b/README.md @@ -22,6 +22,7 @@ Please adapt these three settings to your environment: * `domain` in `backends.py` should be the domain part of the queues/agents you want to display * `URI` in `queuemon.py` to access `mod_xml_rpc` * `hide_agents` can contain agents that should never be shown +* `hide_queues` can contain queues that should never be shown and it's agent too ## ToDo diff --git a/queuemon.py b/queuemon.py index 45731cb..beea234 100755 --- a/queuemon.py +++ b/queuemon.py @@ -25,12 +25,17 @@ from time import strftime from datetime import datetime import time +import re from backends import CallcenterStatusBackend app = Flask(__name__) backend = CallcenterStatusBackend +hide_queues = ( + 'somequeue@mydomain.example.com', + ) + hide_agents = ( 'someagent@mydomain.example.com', ) @@ -88,6 +93,11 @@ def status(): def status_content(): fs = backend(URI) agents = fs.get_agents() + for b in hide_queues: + b = re.sub('^.*@',"", b) + for a in agents.keys(): + if b in a: + del agents[a] for a in agents.keys(): if a in hide_agents: del agents[a] @@ -96,6 +106,9 @@ def status_content(): 'free': len([a['name'] for a in agents.itervalues() if a['status'] != 'Logged Out' and a.get('callstate') is None]) } queues = fs.get_queues() + for a in queues.keys(): + if a in hide_queues: + del queues[a] clock = strftime('%H:%M') if request.args.get('showclock') and request.args['showclock'] != 0 else None return render_template('status_content.html', agents=agents, agent_stats=agent_stats, queues=queues, clock=clock)