File: test.py

package info (click to toggle)
munin 2.0.76-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 7,064 kB
  • sloc: perl: 11,684; java: 1,924; sh: 1,632; makefile: 636; javascript: 365; python: 267
file content (41 lines) | stat: -rwxr-xr-x 696 bytes parent folder | download | duplicates (6)
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
#!/usr/bin/env python

"""
Makes it easy to create munin plugins...

    http://munin-monitoring.org/wiki/protocol-config

Morten Siebuhr
sbhr@sbhr.dk
12/12 2008
"""

from munin import Plugin

p = Plugin("Approx cache", "files", "Approx")
p.info = "Shows how many files the Approx cache stores, split by file-type."


def test(data_source):
    if data_source == 'deb':
        return 42
    return 24


# Set up graph
p['deb'].label = "deb files"
p['deb'].value = test
p['deb'].info = "Number of .deb-files."
p['tar.gz'].label = "tar.gz files"
p['tar.gz'].value = test
# p['gzip'].value = 123

# Run
print("AUTOCONFIG")
p.run("autoconf")

print("CONFIG")
p.run("config")

print("PLAIN")
p.run()