コード例 #1
0
ファイル: diskusagestats.py プロジェクト: 87439247/PyMunin
 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)
コード例 #2
0
 def __init__(self, argv = (), env = {}):
     """Populate Munin Plugin with MuninGraph instances.
     
     @param argv: List of command line arguments.
     @param env:  Dictionary of environment variables.
     
     """
     MuninPlugin.__init__(self, argv, env)
     
     self.envRegisterFilter('fspaths', '^[\w\-\/]+$')
     self.envRegisterFilter('fstypes', '^\w+$')
     
     self._statsSpace = None
     self._statsInode = None
     self._info = FilesystemInfo()
     
     name = 'diskspace'
     if self.graphEnabled(name):
         self._statsSpace = self._info.getSpaceUse()
         graph = MuninGraph('Disk Space Usage (%)', 'Disk Usage',
             info='Disk space usage of filesystems.',
             args='--base 1000 --lower-limit 0',
             autoFixNames=True)
         for (fspath, stats) in self._statsSpace.iteritems():
             if self.fsPathEnabled(fspath) and self.fsTypeEnabled(stats['type']):
                 graph.addField(fspath, fspath, draw='LINE2', type='GAUGE',
                     info="Disk space usage for filesystem: %s" % fspath)
         self.appendGraph(name, graph)
     
     name = 'diskinode'
     if self.graphEnabled(name):
         self._statsInode = self._info.getInodeUse()
         graph = MuninGraph('Inode Usage (%)', 'Disk Usage',
             info='Inode usage of filesystems.',
             args='--base 1000 --lower-limit 0',
             autoFixNames=True)
         for (fspath, stats) in self._statsInode.iteritems():
             if self.fsPathEnabled(fspath) and self.fsTypeEnabled(stats['type']):
                 graph.addField(fspath, fspath, draw='LINE2', type='GAUGE',
                     info="Inode usage for filesystem: %s" % fspath)
         self.appendGraph(name, graph)
コード例 #3
0
ファイル: diskusagestats.py プロジェクト: tehstone/PyMunin
    def __init__(self, argv=(), env={}, 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._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 (%)",
                "Disk Usage",
                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 (%)",
                "Disk Usage",
                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)
コード例 #4
0
ファイル: diskusagestats.py プロジェクト: tehstone/PyMunin
class MuninDiskUsagePlugin(MuninPlugin):
    """Multigraph Munin Plugin for Disk Usage of filesystems.

    """

    plugin_name = "diskusagestats"
    isMultigraph = True

    def __init__(self, argv=(), env={}, 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._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 (%)",
                "Disk Usage",
                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 (%)",
                "Disk Usage",
                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)

    def retrieveVals(self):
        """Retrieve values for graphs."""
        name = "diskspace"
        if self.hasGraph(name):
            for fspath in self._fslist:
                if self._statsSpace.has_key(fspath):
                    self.setGraphVal(name, fspath, self._statsSpace[fspath]["inuse_pcent"])
        name = "diskinode"
        if self.hasGraph(name):
            for fspath in self._fslist:
                if self._statsInode.has_key(fspath):
                    self.setGraphVal(name, fspath, self._statsInode[fspath]["inuse_pcent"])

    def fsPathEnabled(self, fspath):
        """Utility method to check if a filesystem path is included in monitoring.
        
        @param fspath: Filesystem path.
        @return:       Returns True if included in graphs, False otherwise.
            
        """
        return self.envCheckFilter("fspaths", fspath)

    def fsTypeEnabled(self, fstype):
        """Utility method to check if a filesystem type is included in monitoring.
        
        @param fstype: Filesystem type.
        @return:       Returns True if included in graphs, False otherwise.
            
        """
        return self.envCheckFilter("fstypes", fstype)
コード例 #5
0
ファイル: diskusagestats.py プロジェクト: 87439247/PyMunin
class MuninDiskUsagePlugin(MuninPlugin):
    """Multigraph Munin Plugin for Disk Usage of filesystems.

    """
    plugin_name = 'diskusagestats'
    isMultigraph = True

    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)
        
    def retrieveVals(self):
        """Retrieve values for graphs."""
        name = 'diskspace'
        if self.hasGraph(name):
            for fspath in self._fslist:
                if self._statsSpace.has_key(fspath):
                    self.setGraphVal(name, fspath, 
                                     self._statsSpace[fspath]['inuse_pcent'])
        name = 'diskinode'
        if self.hasGraph(name):
            for fspath in self._fslist:
                if self._statsInode.has_key(fspath):
                    self.setGraphVal(name, fspath, 
                                     self._statsInode[fspath]['inuse_pcent'])

    def fsPathEnabled(self, fspath):
        """Utility method to check if a filesystem path is included in monitoring.
        
        @param fspath: Filesystem path.
        @return:       Returns True if included in graphs, False otherwise.
            
        """
        return self.envCheckFilter('fspaths', fspath)

    def fsTypeEnabled(self, fstype):
        """Utility method to check if a filesystem type is included in monitoring.
        
        @param fstype: Filesystem type.
        @return:       Returns True if included in graphs, False otherwise.
            
        """
        return self.envCheckFilter('fstypes', fstype)
    
    def autoconf(self):
        """Implements Munin Plugin Auto-Configuration Option.
        
        @return: True if plugin can be  auto-configured, False otherwise.
                 
        """
        # If no exception is thrown during initialization, the plugin should work.
        return True
コード例 #6
0
class MuninDiskUsagePlugin(MuninPlugin):
    """Multigraph Munin Plugin for Disk Usage of filesystems.

    """
    plugin_name = 'diskusagestats'
    isMultigraph = True

    def __init__(self, argv = (), env = {}):
        """Populate Munin Plugin with MuninGraph instances.
        
        @param argv: List of command line arguments.
        @param env:  Dictionary of environment variables.
        
        """
        MuninPlugin.__init__(self, argv, env)
        
        self.envRegisterFilter('fspaths', '^[\w\-\/]+$')
        self.envRegisterFilter('fstypes', '^\w+$')
        
        self._statsSpace = None
        self._statsInode = None
        self._info = FilesystemInfo()
        
        name = 'diskspace'
        if self.graphEnabled(name):
            self._statsSpace = self._info.getSpaceUse()
            graph = MuninGraph('Disk Space Usage (%)', 'Disk Usage',
                info='Disk space usage of filesystems.',
                args='--base 1000 --lower-limit 0',
                autoFixNames=True)
            for (fspath, stats) in self._statsSpace.iteritems():
                if self.fsPathEnabled(fspath) and self.fsTypeEnabled(stats['type']):
                    graph.addField(fspath, fspath, draw='LINE2', type='GAUGE',
                        info="Disk space usage for filesystem: %s" % fspath)
            self.appendGraph(name, graph)
        
        name = 'diskinode'
        if self.graphEnabled(name):
            self._statsInode = self._info.getInodeUse()
            graph = MuninGraph('Inode Usage (%)', 'Disk Usage',
                info='Inode usage of filesystems.',
                args='--base 1000 --lower-limit 0',
                autoFixNames=True)
            for (fspath, stats) in self._statsInode.iteritems():
                if self.fsPathEnabled(fspath) and self.fsTypeEnabled(stats['type']):
                    graph.addField(fspath, fspath, draw='LINE2', type='GAUGE',
                        info="Inode usage for filesystem: %s" % fspath)
            self.appendGraph(name, graph)
        
    def retrieveVals(self):
        """Retrive values for graphs."""
        name = 'diskspace'
        if self.hasGraph(name):
            for (fspath, stats) in self._statsSpace.iteritems():
                if self.fsPathEnabled(fspath) and self.fsTypeEnabled(stats['type']):
                    self.setGraphVal(name, fspath, stats['inuse_pcent'])
        name = 'diskinode'
        if self.hasGraph(name):
            for (fspath, stats) in self._statsInode.iteritems():
                if self.fsPathEnabled(fspath) and self.fsTypeEnabled(stats['type']):
                    self.setGraphVal(name, fspath, stats['inuse_pcent'])

    def fsPathEnabled(self, fspath):
        """Utility method to check if a filesystem path is included in monitoring.
        
        @param fspath: Filesystem path.
        @return:       Returns True if included in graphs, False otherwise.
            
        """
        return self.envCheckFilter('fspaths', fspath)

    def fsTypeEnabled(self, fstype):
        """Utility method to check if a filesystem type is included in monitoring.
        
        @param fstype: Filesystem type.
        @return:       Returns True if included in graphs, False otherwise.
            
        """
        return self.envCheckFilter('fstypes', fstype)
コード例 #7
0
    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)
コード例 #8
0
class MuninDiskUsagePlugin(MuninPlugin):
    """Multigraph Munin Plugin for Disk Usage of filesystems.

    """
    plugin_name = 'diskusagestats'
    isMultigraph = True

    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)

    def retrieveVals(self):
        """Retrieve values for graphs."""
        name = 'diskspace'
        if self.hasGraph(name):
            for fspath in self._fslist:
                if self._statsSpace.has_key(fspath):
                    self.setGraphVal(name, fspath,
                                     self._statsSpace[fspath]['inuse_pcent'])
        name = 'diskinode'
        if self.hasGraph(name):
            for fspath in self._fslist:
                if self._statsInode.has_key(fspath):
                    self.setGraphVal(name, fspath,
                                     self._statsInode[fspath]['inuse_pcent'])

    def fsPathEnabled(self, fspath):
        """Utility method to check if a filesystem path is included in monitoring.
        
        @param fspath: Filesystem path.
        @return:       Returns True if included in graphs, False otherwise.
            
        """
        return self.envCheckFilter('fspaths', fspath)

    def fsTypeEnabled(self, fstype):
        """Utility method to check if a filesystem type is included in monitoring.
        
        @param fstype: Filesystem type.
        @return:       Returns True if included in graphs, False otherwise.
            
        """
        return self.envCheckFilter('fstypes', fstype)

    def autoconf(self):
        """Implements Munin Plugin Auto-Configuration Option.
        
        @return: True if plugin can be  auto-configured, False otherwise.
                 
        """
        # If no exception is thrown during initialization, the plugin should work.
        return True