Code Duplication    Length = 15-22 lines in 4 locations

plumd/plugins/readers/linux/proc/stat.py 1 location

@@ 28-43 (lines=16) @@
25
        'per_cpu': False,
26
    }
27
28
    def __init__(self, log, config):
29
        """Plugin to measure various kernel metrics from /proc/stat
30
31
        :param log: A logger
32
        :type log: logging.RootLogger
33
        :param config: a plumd.config.Conf configuration helper instance.
34
        :type config: plumd.config.Conf
35
        """
36
        super(Stat, self).__init__(log, config)
37
        self.config.defaults(Stat.defaults)
38
        self.calc = Differential()
39
        self.proc_file = "{0}/stat".format(config.get('proc_path'))
40
        self.per_cpu = self.config.get('per_cpu')
41
        self.cpu_metrics = self.config.get('cpu_metrics')
42
        self.gauges = self.config.get('proc_stat_gauges')
43
        self.rates = self.config.get('proc_stat_rates')
44
45
46
    def poll(self):

plumd/plugins/readers/linux/proc/netsnmp.py 1 location

@@ 45-59 (lines=15) @@
42
        'proc_netsnmp_rates': {}
43
    }
44
45
    def __init__(self, log, config):
46
        """Plugin to measure various kernel metrics from /proc.
47
48
        :param log: A logger
49
        :type log: logging.RootLogger
50
        :param config: a plumd.config.Conf configuration helper instance.
51
        :type config: plumd.config.Conf
52
        """
53
        super(NetSnmp, self).__init__(log, config)
54
        self.config.defaults(NetSnmp.defaults)
55
        self.calc = Differential()
56
        self.proc_file = "{0}/net/snmp".format(config.get('proc_path'))
57
        self.filter = Filter()
58
        self.gauges = self.config.get('proc_netsnmp_gauges')
59
        self.rates = self.config.get('proc_netsnmp_rates')
60
61
62
    def poll(self):

plumd/plugins/readers/linux/proc/sockstat.py 1 location

@@ 24-41 (lines=18) @@
21
        'proc_path': '/proc'
22
    }
23
24
    def __init__(self, log, config):
25
        """Plugin to measure various kernel metrics from /proc.
26
27
        :param log: A logger
28
        :type log: logging.RootLogger
29
        :param config: a plumd.config.Conf configuration helper instance.
30
        :type config: plumd.config.Conf
31
        """
32
        super(SockStat, self).__init__(log, config)
33
        self.config.defaults(SockStat.defaults)
34
        self.calc = Differential()
35
        proc_path = config.get('proc_path')
36
        self.proc_file = "{0}/net/sockstat".format(proc_path)
37
        # sys/net/ipv4/tcp_mem format: min, pressure, max
38
        self.fname_limits = "{0}/sys/net/ipv4/tcp_mem".format(proc_path)
39
        # orphan limit: /proc/sys/net/ipv4/tcp_max_orphans
40
        self.fname_orph = "{0}/sys/net/ipv4/tcp_max_orphans".format(proc_path)
41
        self.filter = Filter()
42
43
44
    def poll(self):

plumd/plugins/readers/memcache.py 1 location

@@ 97-118 (lines=22) @@
94
        'timeout': 10        # connection timeouts
95
    }
96
97
    def __init__(self, log, config):
98
        """Plugin to record memcache stats.
99
100
        :param log: A logger
101
        :type log: logging.RootLogger
102
        :param config: a plumd.config.Conf configuration helper instance.
103
        :type config: plumd.config.Conf
104
        """
105
        super(Memcache, self).__init__(log, config)
106
        self.config.defaults(Memcache.defaults)
107
108
        # metrics to record
109
        self.gauges = self.config.get('gauges')
110
        self.rates = self.config.get('rates')
111
112
        # memcached connection
113
        host = self.config.get('host')
114
        port = self.config.get('port')
115
        self.addr = (host, port)
116
        self.socket = None
117
        self.timeout = config.get('timeout')
118
        self.calc = Differential()
119
120
121
    def poll(self):