summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrédéric Péters <fpeters@entrouvert.com>2021-05-27 07:05:49 (GMT)
committerFrédéric Péters <fpeters@entrouvert.com>2021-05-27 07:05:49 (GMT)
commit18002c532faf913b854d79e3e492d96ba8800464 (patch)
tree961acd93e0759b6b6901ad258b6834f034c76f2e
parentaf4a5292d86ab7f44dfb83e3e9a27da0d8aeda57 (diff)
downloadmisc-fred-18002c532faf913b854d79e3e492d96ba8800464.zip
misc-fred-18002c532faf913b854d79e3e492d96ba8800464.tar.gz
misc-fred-18002c532faf913b854d79e3e492d96ba8800464.tar.bz2
munin: update for new tenants/ subdirectory
-rwxr-xr-xmunin/publik_count7
-rwxr-xr-xmunin/publik_count_5
-rwxr-xr-xmunin/publik_recent_count5
3 files changed, 12 insertions, 5 deletions
diff --git a/munin/publik_count b/munin/publik_count
index 1b65e79..6f61867 100755
--- a/munin/publik_count
+++ b/munin/publik_count
@@ -1,8 +1,11 @@
#! /usr/bin/env python
+#%# family=auto
+#%# capabilities=autoconf
import cPickle
import os
import psycopg2
+import itertools
import sys
base_dir = None
@@ -27,8 +30,8 @@ count.label Count
total = 0
-for tenant in os.listdir(base_dir):
- if tenant in ('collectstatic', 'scripts', 'skeletons', 'spooler'):
+for tenant in itertools.chain(os.listdir(base_dir), os.listdir(os.path.join(base_dir, 'tenants')):
+ if tenant in ('collectstatic', 'scripts', 'skeletons', 'spooler', 'tenants'):
continue
if tenant.endswith('.invalid'):
continue
diff --git a/munin/publik_count_ b/munin/publik_count_
index 9d0e918..37679a9 100755
--- a/munin/publik_count_
+++ b/munin/publik_count_
@@ -1,6 +1,9 @@
#! /usr/bin/env python
+#%# family=auto
+#%# capabilities=autoconf
import cPickle
+import itertools
import os
import psycopg2
import sys
@@ -29,7 +32,7 @@ total_logged_user_count.label Front by logged user
''' % tenant
sys.exit(0)
-for tenant_dir in os.listdir(base_dir):
+for tenant_dir in itertools.chain(os.listdir(base_dir), os.listdir(os.path.join(base_dir, 'tenants'))):
if tenant_dir != tenant:
continue
cfg = cPickle.load(open(os.path.join(base_dir, tenant, 'config.pck')))
diff --git a/munin/publik_recent_count b/munin/publik_recent_count
index 51bc78f..52c0361 100755
--- a/munin/publik_recent_count
+++ b/munin/publik_recent_count
@@ -3,6 +3,7 @@
#%# capabilities=autoconf
import pickle
+import itertools
import datetime
import os
import psycopg2
@@ -38,8 +39,8 @@ time_5m = datetime.datetime.now() - datetime.timedelta(minutes=5)
time_1h = datetime.datetime.now() - datetime.timedelta(hours=1)
time_1d = datetime.datetime.now() - datetime.timedelta(days=1)
-for tenant in os.listdir(base_dir):
- if tenant in ('collectstatic', 'scripts', 'skeletons', 'spooler'):
+for tenant in itertools.chain(os.listdir(base_dir), os.listdir(os.path.join(base_dir, 'tenants'))):
+ if tenant in ('collectstatic', 'scripts', 'skeletons', 'spooler', 'tenants'):
continue
if tenant.endswith('.invalid'):
continue