File: dstat_sendmail.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 (20 lines) | stat: -rwxr-xr-x 560 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
### Author: Dag Wieers <dag@wieers.com>

### FIXME: Should read /var/log/mail/statistics or /etc/mail/statistics (format ?)

class dstat_plugin(dstat):
    def __init__(self):
        self.name = 'sendmail'
        self.vars = ('queue',)
        self.type = 'd'
        self.width = 4
        self.scale = 100

    def check(self):
        if not os.access('/var/spool/mqueue', os.R_OK):
            raise Exception('Cannot access sendmail queue')

    def extract(self):
        self.val['queue'] = len(glob.glob('/var/spool/mqueue/qf*'))

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