File: dstat_qmail.py

package info (click to toggle)
dstat 0.7.4-6.1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye
  • size: 1,608 kB
  • sloc: python: 5,964; makefile: 70; sh: 3
file content (24 lines) | stat: -rw-r--r-- 656 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
### Author: Tom Van Looy <tom$ctors,net>

class dstat_plugin(dstat):
    """
    port of qmail_qstat to dstat
    """
    def __init__(self):
        self.name = 'qmail'
        self.nick = ('in_queue', 'not_prep')
        self.vars = ('mess', 'todo')
        self.type = 'd'
        self.width = 4
        self.scale = 100

    def check(self):
        for item in self.vars:
            if not os.access('/var/qmail/queue/'+item, os.R_OK):
                raise Exception('Cannot access qmail queues')

    def extract(self):
        for item in self.vars:
            self.val[item] = len(glob.glob('/var/qmail/queue/'+item+'/*/*'))

# vim:ts=4:sw=4:et