prometheus/mailbox: do not atempt to open directories

This commit is contained in:
Christophe Siraut 2020-11-16 16:45:15 +01:00
parent b0c126b0df
commit 1708972dba
1 changed files with 4 additions and 3 deletions

View File

@ -129,9 +129,10 @@ def packages(ctn):
def mailboxes(ctn):
boxes = glob.glob("/var/spool/mail/*")
for m in boxes:
n = m.split("/")[-1]
c = len(mailbox.mbox(m))
eo_mailboxes.labels(ctn, n).set(c)
if os.path.isfile(m):
n = m.split("/")[-1]
c = len(mailbox.mbox(m))
eo_mailboxes.labels(ctn, n).set(c)
def postgresql(ctn):