示例#1
0
 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._instance = self.envGet('instance')
     varnish_info = VarnishInfo(self._instance)
     self._stats = varnish_info.getStats()
     self._desc = varnish_info.getDescDict()
     
     graph_name = 'varnish_client_conn'
     if self.graphEnabled(graph_name):
         graph = MuninGraph('Varnish - Client Connections / sec', 
             'Varnish',
             info='Client connections per second for Varnish Cache.',
             args='--base 1000 --lower-limit 0')
         graph.addField('client_conn', 'conn', draw='LINE2', type='DERIVE', 
                        min=0, info=self._desc.get('client_conn'))
         graph.addField('client_drop', 'drop', draw='LINE2', type='DERIVE', 
                        min=0, info=self._desc.get('client_drop'))
         self.appendGraph(graph_name, graph)
     
     graph_name = 'varnish_client_requests'
     if self.graphEnabled(graph_name):
         graph = MuninGraph('Varnish - Client Requests / sec', 
             'Varnish',
             info='Requests per second to Varnish Cache.',
             args='--base 1000 --lower-limit 0')
         graph.addField('client_req', 'reqs', draw='LINE2', type='DERIVE', 
                        min=0, info=self._desc.get('client_req'))
         self.appendGraph(graph_name, graph)
     
     graph_name = 'varnish_backend_conn'
     if self.graphEnabled(graph_name):
         graph = MuninGraph('Varnish - Backend Connections / sec', 
             'Varnish',
             info='Connections per second from Varnish Cache to backends.',
             args='--base 1000 --lower-limit 0')
         graph.addField('backend_conn', 'conn', draw='LINE2', type='DERIVE', 
                        min=0, info=self._desc.get('backend_conn'))
         self.appendGraph(graph_name, graph)
     
     graph_name = 'varnish_backend_requests'
     if self.graphEnabled(graph_name):
         graph = MuninGraph('Varnish - Backend Requests / sec', 
             'Varnish',
             info='Requests per second from Varnish Cache to backends.',
             args='--base 1000 --lower-limit 0')
         graph.addField('backend_req', 'reqs', draw='LINE2', type='DERIVE', 
                        min=0, info=self._desc.get('backend_req'))
         self.appendGraph(graph_name, graph)
         
     graph_name = 'varnish_traffic'
     if self.graphEnabled(graph_name):
         graph = MuninGraph('Varnish - Traffic (bytes/sec)', 
             'Varnish',
             info='HTTP Header and Body traffic. '
                  '(TCP/IP overhead not included.)',
             args='--base 1000 --lower-limit 0')
         graph.addField('s_hdrbytes', 'header', draw='AREASTACK', type='DERIVE', 
                        min=0, info=self._desc.get('s_hdrbytes'))
         graph.addField('s_bodybytes', 'body', draw='AREASTACK', type='DERIVE', 
                        min=0, info=self._desc.get('s_bodybytes'))
         self.appendGraph(graph_name, graph)
         
     graph_name = 'varnish_workers'
     if self.graphEnabled(graph_name):
         graph = MuninGraph('Varnish - Worker Threads', 
             'Varnish',
             info='Number of worker threads.',
             args='--base 1000 --lower-limit 0')
         graph.addField('cache_hit', 'hit', draw='AREASTACK', type='DERIVE', 
                        min=0, info=self._desc.get('cache_hit'))
         graph.addField('cache_hitpass', 'pass', draw='AREASTACK', type='DERIVE', 
                        min=0, info=self._desc.get('cache_hitpass'))
         graph.addField('cache_miss', 'miss', draw='AREASTACK', type='DERIVE', 
                        min=0, info=self._desc.get('cache_miss'))
         self.appendGraph(graph_name, graph)
         
     graph_name = 'varnish_hits'
     if self.graphEnabled(graph_name):
         graph = MuninGraph('Varnish - Cache Hits vs. Misses', 
             'Varnish',
             info='Number of Cache Hits and Misses por second.',
             args='--base 1000 --lower-limit 0')
         graph.addField('n_wrk', 'req', draw='AREASTACK', type='DERIVE', 
                        min=0, info=self._desc.get('n_wrk'))
         self.appendGraph(graph_name, graph)
示例#2
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._instance = self.envGet("instance")
        self._category = "Varnish"
        varnish_info = VarnishInfo(self._instance)
        self._stats = varnish_info.getStats()
        self._desc = varnish_info.getDescDict()

        graph_name = "varnish_client_conn"
        if self.graphEnabled(graph_name):
            graph = MuninGraph(
                "Varnish - Client Connections / sec",
                self._category,
                info="Client connections per second for Varnish Cache.",
                args="--base 1000 --lower-limit 0",
            )
            graph.addField(
                "client_conn", "conn", draw="LINE2", type="DERIVE", min=0, info=self._desc.get("client_conn")
            )
            graph.addField(
                "client_drop", "drop", draw="LINE2", type="DERIVE", min=0, info=self._desc.get("client_drop")
            )
            self.appendGraph(graph_name, graph)

        graph_name = "varnish_client_requests"
        if self.graphEnabled(graph_name):
            graph = MuninGraph(
                "Varnish - Client Requests / sec",
                self._category,
                info="Requests per second to Varnish Cache.",
                args="--base 1000 --lower-limit 0",
            )
            graph.addField("client_req", "reqs", draw="LINE2", type="DERIVE", min=0, info=self._desc.get("client_req"))
            self.appendGraph(graph_name, graph)

        graph_name = "varnish_backend_conn"
        if self.graphEnabled(graph_name):
            graph = MuninGraph(
                "Varnish - Backend Connections / sec",
                self._category,
                info="Connections per second from Varnish Cache to backends.",
                args="--base 1000 --lower-limit 0",
            )
            graph.addField(
                "backend_conn", "conn", draw="LINE2", type="DERIVE", min=0, info=self._desc.get("backend_conn")
            )
            self.appendGraph(graph_name, graph)

        graph_name = "varnish_backend_requests"
        if self.graphEnabled(graph_name):
            graph = MuninGraph(
                "Varnish - Backend Requests / sec",
                self._category,
                info="Requests per second from Varnish Cache to backends.",
                args="--base 1000 --lower-limit 0",
            )
            graph.addField(
                "backend_req", "reqs", draw="LINE2", type="DERIVE", min=0, info=self._desc.get("backend_req")
            )
            self.appendGraph(graph_name, graph)

        graph_name = "varnish_traffic"
        if self.graphEnabled(graph_name):
            graph = MuninGraph(
                "Varnish - Traffic (bytes/sec)",
                self._category,
                info="HTTP Header and Body traffic. " "(TCP/IP overhead not included.)",
                args="--base 1000 --lower-limit 0",
            )
            graph.addField(
                "s_hdrbytes", "header", draw="AREASTACK", type="DERIVE", min=0, info=self._desc.get("s_hdrbytes")
            )
            graph.addField(
                "s_bodybytes", "body", draw="AREASTACK", type="DERIVE", min=0, info=self._desc.get("s_bodybytes")
            )
            self.appendGraph(graph_name, graph)

        graph_name = "varnish_workers"
        if self.graphEnabled(graph_name):
            graph = MuninGraph(
                "Varnish - Worker Threads",
                self._category,
                info="Number of worker threads.",
                args="--base 1000 --lower-limit 0",
            )
            graph.addField("cache_hit", "hit", draw="AREASTACK", type="DERIVE", min=0, info=self._desc.get("cache_hit"))
            graph.addField(
                "cache_hitpass", "pass", draw="AREASTACK", type="DERIVE", min=0, info=self._desc.get("cache_hitpass")
            )
            graph.addField(
                "cache_miss", "miss", draw="AREASTACK", type="DERIVE", min=0, info=self._desc.get("cache_miss")
            )
            self.appendGraph(graph_name, graph)

        graph_name = "varnish_hits"
        if self.graphEnabled(graph_name):
            graph = MuninGraph(
                "Varnish - Cache Hits vs. Misses",
                self._category,
                info="Number of Cache Hits and Misses por second.",
                args="--base 1000 --lower-limit 0",
            )
            graph.addField("n_wrk", "req", draw="AREASTACK", type="DERIVE", min=0, info=self._desc.get("n_wrk"))
            self.appendGraph(graph_name, graph)
示例#3
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._instance = self.envGet('instance')
        self._category = 'Varnish'
        varnish_info = VarnishInfo(self._instance)
        self._stats = varnish_info.getStats()
        self._desc = varnish_info.getDescDict()

        graph_name = 'varnish_requests'
        if self.graphEnabled(graph_name):
            graph = MuninGraph(
                'Varnish - Client/Backend Requests / sec',
                self._category,
                info=
                'Number of client and backend requests per second for Varnish Cache.',
                args='--base 1000 --lower-limit 0')
            for flabel in (
                    'client',
                    'backend',
            ):
                fname = '%s_req' % flabel
                finfo = self._desc.get(fname, '')
                graph.addField(fname,
                               flabel,
                               draw='LINE2',
                               type='DERIVE',
                               min=0,
                               info=finfo)
            self.appendGraph(graph_name, graph)

        graph_name = 'varnish_hits'
        if self.graphEnabled(graph_name):
            graph = MuninGraph(
                'Varnish - Cache Hits vs. Misses (%)',
                self._category,
                info='Number of Cache Hits and Misses per second.',
                args='--base 1000 --lower-limit 0')
            for flabel, fname in (('hit', 'cache_hit'),
                                  ('pass', 'cache_hitpass'), ('miss',
                                                              'cache_miss')):
                finfo = self._desc.get(fname, '')
                graph.addField(fname,
                               flabel,
                               draw='AREASTACK',
                               type='DERIVE',
                               min=0,
                               info=finfo)
            self.appendGraph(graph_name, graph)

        graph_name = 'varnish_client_conn'
        if self.graphEnabled(graph_name):
            graph = MuninGraph(
                'Varnish - Client Connections / sec',
                self._category,
                info='Client connections per second for Varnish Cache.',
                args='--base 1000 --lower-limit 0')
            for flabel in (
                    'conn',
                    'drop',
            ):
                fname = 'client_%s' % flabel
                finfo = self._desc.get(fname, '')
                graph.addField(fname,
                               flabel,
                               draw='AREASTACK',
                               type='DERIVE',
                               min=0,
                               info=finfo)
            self.appendGraph(graph_name, graph)

        graph_name = 'varnish_backend_conn'
        if self.graphEnabled(graph_name):
            graph = MuninGraph(
                'Varnish - Backend Connections / sec',
                self._category,
                info='Connections per second from Varnish Cache to backends.',
                args='--base 1000 --lower-limit 0')
            for flabel in (
                    'conn',
                    'reuse',
                    'busy',
                    'fail',
                    'retry',
                    'unhealthy',
            ):
                fname = 'backend_%s' % flabel
                finfo = self._desc.get(fname, '')
                graph.addField(fname,
                               flabel,
                               draw='AREASTACK',
                               type='DERIVE',
                               min=0,
                               info=finfo)
            self.appendGraph(graph_name, graph)

        graph_name = 'varnish_traffic'
        if self.graphEnabled(graph_name):
            graph = MuninGraph('Varnish - Traffic (bytes/sec)',
                               self._category,
                               info='HTTP Header and Body traffic. '
                               '(TCP/IP overhead not included.)',
                               args='--base 1024 --lower-limit 0')
            for flabel, fname in (
                ('header', 's_hdrbytes'),
                ('body', 's_bodybytes'),
            ):
                finfo = self._desc.get(fname, '')
                graph.addField(fname,
                               flabel,
                               draw='AREASTACK',
                               type='DERIVE',
                               min=0,
                               info=finfo)
            self.appendGraph(graph_name, graph)

        graph_name = 'varnish_workers'
        if self.graphEnabled(graph_name):
            graph = MuninGraph('Varnish - Worker Threads',
                               self._category,
                               info='Number of worker threads.',
                               args='--base 1000 --lower-limit 0')
            fname = 'n_wrk'
            flabel = 'req'
            finfo = self._desc.get(fname, '')
            graph.addField(fname,
                           flabel,
                           draw='LINE2',
                           type='GAUGE',
                           min=0,
                           info=finfo)
            self.appendGraph(graph_name, graph)

        graph_name = 'varnish_work_queue'
        if self.graphEnabled(graph_name):
            graph = MuninGraph(
                'Varnish - Queued/Dropped Work Requests / sec',
                self._category,
                info='Requests queued for waiting for a worker thread to become '
                'available and requests dropped because of overflow of queue.',
                args='--base 1000 --lower-limit 0')
            for flabel, fname in (('queued', 'n_wrk_queued'), ('dropped',
                                                               'n_wrk_drop')):
                finfo = self._desc.get(fname, '')
                graph.addField(fname,
                               flabel,
                               draw='LINE2',
                               type='DERIVE',
                               min=0,
                               info=finfo)
            self.appendGraph(graph_name, graph)

        graph_name = 'varnish_memory'
        if self.graphEnabled(graph_name):
            graph = MuninGraph('Varnish - Cache Memory Usage (bytes)',
                               self._category,
                               info='Varnish cache memory usage in bytes.',
                               args='--base 1024 --lower-limit 0')
            for flabel, fname in (('used', 'SMA_s0_g_bytes'),
                                  ('free', 'SMA_s0_g_space')):
                finfo = self._desc.get(fname, '')
                graph.addField(fname,
                               flabel,
                               draw='AREASTACK',
                               type='GAUGE',
                               min=0,
                               info=finfo)
            self.appendGraph(graph_name, graph)

        graph_name = 'varnish_expire_purge'
        if self.graphEnabled(graph_name):
            graph = MuninGraph(
                'Varnish - Expired/Purged Objects / sec',
                self._category,
                info='Expired objects and LRU purged objects per second.',
                args='--base 1000 --lower-limit 0')
            for flabel, fname in (('expire', 'n_expired'), ('purge',
                                                            'n_lru_nuked')):
                finfo = self._desc.get(fname, '')
                graph.addField(fname,
                               flabel,
                               draw='LINE2',
                               type='DERIVE',
                               min=0,
                               info=finfo)
            self.appendGraph(graph_name, graph)
示例#4
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._instance = self.envGet('instance')
        self._category = 'Varnish'
        varnish_info = VarnishInfo(self._instance)
        self._stats = varnish_info.getStats()
        self._desc = varnish_info.getDescDict()

        graph_name = 'varnish_client_conn'
        if self.graphEnabled(graph_name):
            graph = MuninGraph(
                'Varnish - Client Connections / sec',
                self._category,
                info='Client connections per second for Varnish Cache.',
                args='--base 1000 --lower-limit 0')
            graph.addField('client_conn',
                           'conn',
                           draw='LINE2',
                           type='DERIVE',
                           min=0,
                           info=self._desc.get('client_conn'))
            graph.addField('client_drop',
                           'drop',
                           draw='LINE2',
                           type='DERIVE',
                           min=0,
                           info=self._desc.get('client_drop'))
            self.appendGraph(graph_name, graph)

        graph_name = 'varnish_client_requests'
        if self.graphEnabled(graph_name):
            graph = MuninGraph('Varnish - Client Requests / sec',
                               self._category,
                               info='Requests per second to Varnish Cache.',
                               args='--base 1000 --lower-limit 0')
            graph.addField('client_req',
                           'reqs',
                           draw='LINE2',
                           type='DERIVE',
                           min=0,
                           info=self._desc.get('client_req'))
            self.appendGraph(graph_name, graph)

        graph_name = 'varnish_backend_conn'
        if self.graphEnabled(graph_name):
            graph = MuninGraph(
                'Varnish - Backend Connections / sec',
                self._category,
                info='Connections per second from Varnish Cache to backends.',
                args='--base 1000 --lower-limit 0')
            graph.addField('backend_conn',
                           'conn',
                           draw='LINE2',
                           type='DERIVE',
                           min=0,
                           info=self._desc.get('backend_conn'))
            self.appendGraph(graph_name, graph)

        graph_name = 'varnish_backend_requests'
        if self.graphEnabled(graph_name):
            graph = MuninGraph(
                'Varnish - Backend Requests / sec',
                self._category,
                info='Requests per second from Varnish Cache to backends.',
                args='--base 1000 --lower-limit 0')
            graph.addField('backend_req',
                           'reqs',
                           draw='LINE2',
                           type='DERIVE',
                           min=0,
                           info=self._desc.get('backend_req'))
            self.appendGraph(graph_name, graph)

        graph_name = 'varnish_traffic'
        if self.graphEnabled(graph_name):
            graph = MuninGraph('Varnish - Traffic (bytes/sec)',
                               self._category,
                               info='HTTP Header and Body traffic. '
                               '(TCP/IP overhead not included.)',
                               args='--base 1000 --lower-limit 0')
            graph.addField('s_hdrbytes',
                           'header',
                           draw='AREASTACK',
                           type='DERIVE',
                           min=0,
                           info=self._desc.get('s_hdrbytes'))
            graph.addField('s_bodybytes',
                           'body',
                           draw='AREASTACK',
                           type='DERIVE',
                           min=0,
                           info=self._desc.get('s_bodybytes'))
            self.appendGraph(graph_name, graph)

        graph_name = 'varnish_workers'
        if self.graphEnabled(graph_name):
            graph = MuninGraph('Varnish - Worker Threads',
                               self._category,
                               info='Number of worker threads.',
                               args='--base 1000 --lower-limit 0')
            graph.addField('cache_hit',
                           'hit',
                           draw='AREASTACK',
                           type='DERIVE',
                           min=0,
                           info=self._desc.get('cache_hit'))
            graph.addField('cache_hitpass',
                           'pass',
                           draw='AREASTACK',
                           type='DERIVE',
                           min=0,
                           info=self._desc.get('cache_hitpass'))
            graph.addField('cache_miss',
                           'miss',
                           draw='AREASTACK',
                           type='DERIVE',
                           min=0,
                           info=self._desc.get('cache_miss'))
            self.appendGraph(graph_name, graph)

        graph_name = 'varnish_hits'
        if self.graphEnabled(graph_name):
            graph = MuninGraph(
                'Varnish - Cache Hits vs. Misses',
                self._category,
                info='Number of Cache Hits and Misses por second.',
                args='--base 1000 --lower-limit 0')
            graph.addField('n_wrk',
                           'req',
                           draw='AREASTACK',
                           type='DERIVE',
                           min=0,
                           info=self._desc.get('n_wrk'))
            self.appendGraph(graph_name, graph)