diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2018-11-07 12:19:29 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2018-11-07 12:20:17 +0000 |
commit | a64a253794ac64cb40befee54db53bde17dd0d49 (patch) | |
tree | c1024acc5f6e508814b944d99f112259bb28b1be /collectors/python.d.plugin/memcached/memcached.chart.py | |
parent | New upstream version 1.10.0+dfsg (diff) | |
download | netdata-upstream/1.11.0+dfsg.tar.xz netdata-upstream/1.11.0+dfsg.zip |
New upstream version 1.11.0+dfsgupstream/1.11.0+dfsg
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | collectors/python.d.plugin/memcached/memcached.chart.py (renamed from python.d/memcached.chart.py) | 61 |
1 files changed, 38 insertions, 23 deletions
diff --git a/python.d/memcached.chart.py b/collectors/python.d.plugin/memcached/memcached.chart.py index 4f7adfa23..3c310ec69 100644 --- a/python.d/memcached.chart.py +++ b/collectors/python.d.plugin/memcached/memcached.chart.py @@ -1,11 +1,12 @@ # -*- coding: utf-8 -*- # Description: memcached netdata python.d module # Author: Pawel Krupa (paulfantom) +# SPDX-License-Identifier: GPL-3.0-or-later from bases.FrameworkServices.SocketService import SocketService # default module values (can be overridden per job in `config`) -#update_every = 2 +# update_every = 2 priority = 60000 retries = 60 @@ -28,92 +29,106 @@ CHARTS = { 'lines': [ ['avail', 'available', 'absolute', 1, 1048576], ['used', 'used', 'absolute', 1, 1048576] - ]}, + ] + }, 'net': { 'options': [None, 'Network', 'kilobits/s', 'network', 'memcached.net', 'area'], 'lines': [ ['bytes_read', 'in', 'incremental', 8, 1024], ['bytes_written', 'out', 'incremental', -8, 1024] - ]}, + ] + }, 'connections': { 'options': [None, 'Connections', 'connections/s', 'connections', 'memcached.connections', 'line'], 'lines': [ ['curr_connections', 'current', 'incremental'], ['rejected_connections', 'rejected', 'incremental'], ['total_connections', 'total', 'incremental'] - ]}, + ] + }, 'items': { 'options': [None, 'Items', 'items', 'items', 'memcached.items', 'line'], 'lines': [ ['curr_items', 'current', 'absolute'], ['total_items', 'total', 'absolute'] - ]}, + ] + }, 'evicted_reclaimed': { 'options': [None, 'Items', 'items', 'items', 'memcached.evicted_reclaimed', 'line'], 'lines': [ ['reclaimed', 'reclaimed', 'absolute'], ['evictions', 'evicted', 'absolute'] - ]}, + ] + }, 'get': { 'options': [None, 'Requests', 'requests', 'get ops', 'memcached.get', 'stacked'], 'lines': [ ['get_hits', 'hits', 'percent-of-absolute-row'], ['get_misses', 'misses', 'percent-of-absolute-row'] - ]}, + ] + }, 'get_rate': { 'options': [None, 'Rate', 'requests/s', 'get ops', 'memcached.get_rate', 'line'], 'lines': [ ['cmd_get', 'rate', 'incremental'] - ]}, + ] + }, 'set_rate': { 'options': [None, 'Rate', 'requests/s', 'set ops', 'memcached.set_rate', 'line'], 'lines': [ ['cmd_set', 'rate', 'incremental'] - ]}, + ] + }, 'delete': { 'options': [None, 'Requests', 'requests', 'delete ops', 'memcached.delete', 'stacked'], 'lines': [ ['delete_hits', 'hits', 'percent-of-absolute-row'], ['delete_misses', 'misses', 'percent-of-absolute-row'], - ]}, + ] + }, 'cas': { 'options': [None, 'Requests', 'requests', 'check and set ops', 'memcached.cas', 'stacked'], 'lines': [ ['cas_hits', 'hits', 'percent-of-absolute-row'], ['cas_misses', 'misses', 'percent-of-absolute-row'], ['cas_badval', 'bad value', 'percent-of-absolute-row'] - ]}, + ] + }, 'increment': { 'options': [None, 'Requests', 'requests', 'increment ops', 'memcached.increment', 'stacked'], 'lines': [ ['incr_hits', 'hits', 'percent-of-absolute-row'], ['incr_misses', 'misses', 'percent-of-absolute-row'] - ]}, + ] + }, 'decrement': { 'options': [None, 'Requests', 'requests', 'decrement ops', 'memcached.decrement', 'stacked'], 'lines': [ ['decr_hits', 'hits', 'percent-of-absolute-row'], ['decr_misses', 'misses', 'percent-of-absolute-row'] - ]}, + ] + }, 'touch': { 'options': [None, 'Requests', 'requests', 'touch ops', 'memcached.touch', 'stacked'], 'lines': [ ['touch_hits', 'hits', 'percent-of-absolute-row'], ['touch_misses', 'misses', 'percent-of-absolute-row'] - ]}, + ] + }, 'touch_rate': { 'options': [None, 'Rate', 'requests/s', 'touch ops', 'memcached.touch_rate', 'line'], 'lines': [ ['cmd_touch', 'rate', 'incremental'] - ]} + ] + } } class Service(SocketService): def __init__(self, configuration=None, name=None): SocketService.__init__(self, configuration=configuration, name=name) - self.request = "stats\r\n" - self.host = "localhost" + self.request = 'stats\r\n' + self.host = 'localhost' self.port = 11211 self._keep_alive = True self.unix_socket = None @@ -131,13 +146,13 @@ class Service(SocketService): return None if response.startswith('ERROR'): - self.error("received ERROR") + self.error('received ERROR') return None try: - parsed = response.split("\n") + parsed = response.split('\n') except AttributeError: - self.error("response is invalid/empty") + self.error('response is invalid/empty') return None # split the response @@ -148,7 +163,7 @@ class Service(SocketService): t = line[5:].split(' ') data[t[0]] = t[1] except (IndexError, ValueError): - self.debug("invalid line received: " + str(line)) + self.debug('invalid line received: ' + str(line)) if not data: self.error("received data doesn't have any records") @@ -165,10 +180,10 @@ class Service(SocketService): def _check_raw_data(self, data): if data.endswith('END\r\n'): - self.debug("received full response from memcached") + self.debug('received full response from memcached') return True - self.debug("waiting more data from memcached") + self.debug('waiting more data from memcached') return False def check(self): |