Created
February 6, 2011 23:17
-
-
Save tomoconnor/813813 to your computer and use it in GitHub Desktop.
Very simple example munin plugin
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import os | |
from munin import MuninPlugin | |
class TmpFileCount(MuninPlugin): | |
title = "Number of Files in /tmp" | |
args = "--base 1000 -l 0" | |
vlabel = "files" | |
scaled = False | |
category = "system" | |
@property | |
def fields(self): | |
warning = os.environ.get('files_warn', 10) | |
critical = os.environ.get('files_crit', 120) | |
return [("files", dict( | |
label = "files", | |
info = 'The number of files in /tmp', | |
type = "GAUGE", | |
min = "0", | |
warning = str(warning), | |
critical = str(critical)))] | |
def execute(self): | |
dircount = len(os.listdir("/tmp")) | |
print "files.value %s" % dircount | |
if __name__ == "__main__": | |
TmpFileCount().run() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment