diff options
author | liu lei <leolovenet@gmail.com> | 2016-10-19 14:24:52 +0800 |
---|---|---|
committer | liu lei <leolovenet@gmail.com> | 2016-10-19 14:24:52 +0800 |
commit | c335489138f329e4dbcda92b0957b45c201d1b29 (patch) | |
tree | c05594b189f1fc66b61b7af04c85236282437d62 /python.d/redis.chart.py | |
parent | c9e318603b7cbfa65203d38431f43c5375f0118c (diff) |
1. changed arguments from decode() in base.py to support versions of Python 2.6
2. added pass parameters to redis for AUTH command
3. optimized nginx.chart.py and phpfpm.chart.py submenu name
4. optimized phpfpm.chart.py average display
Diffstat (limited to 'python.d/redis.chart.py')
-rw-r--r-- | python.d/redis.chart.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/python.d/redis.chart.py b/python.d/redis.chart.py index 218401e127..cb64a33bb7 100644 --- a/python.d/redis.chart.py +++ b/python.d/redis.chart.py @@ -68,6 +68,9 @@ class Service(SocketService): self.definitions = CHARTS self._keep_alive = True self.chart_name = "" + self.passwd = None + if 'pass' in configuration: + self.passwd = configuration['pass'] def _get_data(self): """ @@ -75,6 +78,14 @@ class Service(SocketService): :return: dict """ try: + if self.passwd: + info_request = self.request + self.request = "AUTH " + self.passwd + "\r\n" + raw = self._get_raw_data().strip() + if raw != "+OK": + self.error("invalid password") + return None + self.request = info_request raw = self._get_raw_data().split("\n") except AttributeError: self.error("no data received") @@ -112,6 +123,8 @@ class Service(SocketService): length = len(data) supposed = data.split('\n')[0][1:] offset = len(supposed) + 4 # 1 dollar sing, 1 new line character + 1 ending sequence '\r\n' + if (not supposed.isdigit()) : + return True supposed = int(supposed) if length - offset >= supposed: return True |