def __init__(self, argv=(), env=None, debug=False): """Populate Munin Plugin with MuninGraph instances. @param argv: List of command line arguments. @param env: Dictionary of environment variables. @param debug: Print debugging messages if True. (Default: False) """ MuninPlugin.__init__(self, argv, env, debug) self.envRegisterFilter('fspaths', '^[\w\-\/]+$') self.envRegisterFilter('fstypes', '^\w+$') self._category = 'Disk Usage' self._statsSpace = None self._statsInode = None self._info = FilesystemInfo() self._fslist = [ fs for fs in self._info.getFSlist() if (self.fsPathEnabled(fs) and self.fsTypeEnabled(self._info.getFStype(fs))) ] self._fslist.sort() name = 'diskspace' if self.graphEnabled(name): self._statsSpace = self._info.getSpaceUse() graph = MuninGraph('Disk Space Usage (%)', self._category, info='Disk space usage of filesystems.', args='--base 1000 --lower-limit 0', printf='%6.1lf', autoFixNames=True) for fspath in self._fslist: if self._statsSpace.has_key(fspath): graph.addField(fspath, fixLabel(fspath, maxLabelLenGraphSimple, delim='/', repl='..', truncend=False), draw='LINE2', type='GAUGE', info="Disk space usage for: %s" % fspath) self.appendGraph(name, graph) name = 'diskinode' if self.graphEnabled(name): self._statsInode = self._info.getInodeUse() graph = MuninGraph('Inode Usage (%)', self._category, info='Inode usage of filesystems.', args='--base 1000 --lower-limit 0', printf='%6.1lf', autoFixNames=True) for fspath in self._fslist: if self._statsInode.has_key(fspath): graph.addField(fspath, fixLabel(fspath, maxLabelLenGraphSimple, delim='/', repl='..', truncend=False), draw='LINE2', type='GAUGE', info="Inode usage for: %s" % fspath) self.appendGraph(name, graph)