Back to index

munin  2.0.1
test.py
Go to the documentation of this file.
00001 #!/usr/bin/env python
00002 
00003 """
00004 Makes it easy to create munin plugins...
00005 
00006     http://munin-monitoring.org/wiki/protocol-config
00007 
00008 Morten Siebuhr
00009 sbhr@sbhr.dk
00010 12/12 2008
00011 """
00012 
00013 from munin import Plugin
00014 
00015 p = Plugin("Approx cache", "files", "Approx")
00016 p.info = "Shows how many files the Approx cache stores, split by file-type."
00017 
00018 def test(data_source):
00019     if data_source == 'deb':
00020         return 42
00021     return 24
00022 
00023 # Set up graph
00024 p['deb'].label = "deb files"
00025 p['deb'].value = test
00026 p['deb'].info = "Number of .deb-files."
00027 p['tar.gz'].label = "tar.gz files"
00028 p['tar.gz'].value = test
00029 #p['gzip'].value = 123
00030 
00031 # Run
00032 print "AUTOCONFIG"
00033 p.run("autoconf")
00034 
00035 print "CONFIG"
00036 p.run("config")
00037 
00038 print "PLAIN"
00039 p.run()