/usr/share/mailping/munin-plugins/mailping-latency is in mailping 0.0.4-3.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 | #!/usr/bin/python
"""
Munin plugin to graph latency of mail deliveries
"""
__copyright__ = "Copyright (C) 2004  Tommi Virtanen"
__license__ = """
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.
    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.
    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
"""
import sys, os, time
def config():
    from MailPing import config
    print 'graph_title Mailping latency'
    print 'graph_vlabel seconds'
    configdir = config.getConfigDir()
    circuits = os.listdir(configdir)
    if not circuits:
        print 'graph no'
    else:
        for dirname in circuits:
            name = dirname
            path = os.path.join(configdir, dirname)
            print '%s.label %s' % (name, dirname)
            print '%s.min 0' % name
            try:
                print '%s.warning %f' % (name, config.getTime(path, 'warnlatency'))
            except config.NoSuchConfigItem:
                pass
            try:
                print '%s.critical %f' % (name, config.getTime(path, 'faillatency'))
            except config.NoSuchConfigItem:
                pass
def dump():
    from MailPing import fileutil, config
    configdir = config.getConfigDir()
    statedir = config.getStateDir()
    for dirname in os.listdir(configdir):
        if os.path.isdir(os.path.join(statedir, 'state', dirname)):
            name = dirname
            latency = fileutil.getTime(os.path.join(statedir, 'state', dirname, 'latency'))
            if latency >= 0:
                print '%s.value %f' % (name, latency)
if __name__ == '__main__':
    if len(sys.argv[1:]) == 1 and sys.argv[1] == 'config':
        config()
    elif len(sys.argv[1:]) == 1 and sys.argv[1] == '':
        dump()
    else:
        print >>sys.stderr, "%(progname)s: usage: %(progname)s [config|'']" \
              % { 'progname': os.path.basename(sys.argv[0]),
                  }
        sys.exit(1)
 |