summaryrefslogtreecommitdiffstats
path: root/collectors/python.d.plugin/beanstalk
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2018-11-07 12:19:29 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2018-11-07 12:20:17 +0000
commita64a253794ac64cb40befee54db53bde17dd0d49 (patch)
treec1024acc5f6e508814b944d99f112259bb28b1be /collectors/python.d.plugin/beanstalk
parentNew upstream version 1.10.0+dfsg (diff)
downloadnetdata-a64a253794ac64cb40befee54db53bde17dd0d49.tar.xz
netdata-a64a253794ac64cb40befee54db53bde17dd0d49.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/beanstalk/Makefile.inc13
-rw-r--r--collectors/python.d.plugin/beanstalk/README.md103
-rw-r--r--collectors/python.d.plugin/beanstalk/beanstalk.chart.py (renamed from python.d/beanstalk.chart.py)43
-rw-r--r--collectors/python.d.plugin/beanstalk/beanstalk.conf (renamed from conf.d/python.d/beanstalk.conf)0
4 files changed, 136 insertions, 23 deletions
diff --git a/collectors/python.d.plugin/beanstalk/Makefile.inc b/collectors/python.d.plugin/beanstalk/Makefile.inc
new file mode 100644
index 000000000..4bbb7087d
--- /dev/null
+++ b/collectors/python.d.plugin/beanstalk/Makefile.inc
@@ -0,0 +1,13 @@
+# SPDX-License-Identifier: GPL-3.0-or-later
+
+# THIS IS NOT A COMPLETE Makefile
+# IT IS INCLUDED BY ITS PARENT'S Makefile.am
+# IT IS REQUIRED TO REFERENCE ALL FILES RELATIVE TO THE PARENT
+
+# install these files
+dist_python_DATA += beanstalk/beanstalk.chart.py
+dist_pythonconfig_DATA += beanstalk/beanstalk.conf
+
+# do not install these files, but include them in the distribution
+dist_noinst_DATA += beanstalk/README.md beanstalk/Makefile.inc
+
diff --git a/collectors/python.d.plugin/beanstalk/README.md b/collectors/python.d.plugin/beanstalk/README.md
new file mode 100644
index 000000000..c2d7d5787
--- /dev/null
+++ b/collectors/python.d.plugin/beanstalk/README.md
@@ -0,0 +1,103 @@
+# beanstalk
+
+Module provides server and tube-level statistics:
+
+**Requirements:**
+ * `python-beanstalkc`
+
+**Server statistics:**
+
+1. **Cpu usage** in cpu time
+ * user
+ * system
+
+2. **Jobs rate** in jobs/s
+ * total
+ * timeouts
+
+3. **Connections rate** in connections/s
+ * connections
+
+4. **Commands rate** in commands/s
+ * put
+ * peek
+ * peek-ready
+ * peek-delayed
+ * peek-buried
+ * reserve
+ * use
+ * watch
+ * ignore
+ * delete
+ * release
+ * bury
+ * kick
+ * stats
+ * stats-job
+ * stats-tube
+ * list-tubes
+ * list-tube-used
+ * list-tubes-watched
+ * pause-tube
+
+5. **Current tubes** in tubes
+ * tubes
+
+6. **Current jobs** in jobs
+ * urgent
+ * ready
+ * reserved
+ * delayed
+ * buried
+
+7. **Current connections** in connections
+ * written
+ * producers
+ * workers
+ * waiting
+
+8. **Binlog** in records/s
+ * written
+ * migrated
+
+9. **Uptime** in seconds
+ * uptime
+
+**Per tube statistics:**
+
+1. **Jobs rate** in jobs/s
+ * jobs
+
+2. **Jobs** in jobs
+ * using
+ * ready
+ * reserved
+ * delayed
+ * buried
+
+3. **Connections** in connections
+ * using
+ * waiting
+ * watching
+
+4. **Commands** in commands/s
+ * deletes
+ * pauses
+
+5. **Pause** in seconds
+ * since
+ * left
+
+
+### configuration
+
+Sample:
+
+```yaml
+host : '127.0.0.1'
+port : 11300
+```
+
+If no configuration is given, module will attempt to connect to beanstalkd on `127.0.0.1:11300` address
+
+---
diff --git a/python.d/beanstalk.chart.py b/collectors/python.d.plugin/beanstalk/beanstalk.chart.py
index 8880afdd9..1472b4e1a 100644
--- a/python.d/beanstalk.chart.py
+++ b/collectors/python.d.plugin/beanstalk/beanstalk.chart.py
@@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-
# Description: beanstalk netdata python.d module
# Author: l2isbad
+# SPDX-License-Identifier: GPL-3.0-or-later
try:
import beanstalkc
@@ -8,13 +9,8 @@ try:
except ImportError:
BEANSTALKC = False
-try:
- import yaml
- YAML = True
-except ImportError:
- YAML = False
-
from bases.FrameworkServices.SimpleService import SimpleService
+from bases.loaders import safe_load
# default module values (can be overridden per job in `config`)
# update_every = 2
@@ -114,12 +110,13 @@ CHARTS = {
def tube_chart_template(name):
- order = ['{0}_jobs_rate'.format(name),
- '{0}_jobs'.format(name),
- '{0}_connections'.format(name),
- '{0}_commands'.format(name),
- '{0}_pause'.format(name)
- ]
+ order = [
+ '{0}_jobs_rate'.format(name),
+ '{0}_jobs'.format(name),
+ '{0}_connections'.format(name),
+ '{0}_commands'.format(name),
+ '{0}_pause'.format(name)
+ ]
family = 'tube {0}'.format(name)
charts = {
@@ -127,7 +124,8 @@ def tube_chart_template(name):
'options': [None, 'Job Rate', 'jobs/s', family, 'beanstalk.jobs_rate', 'area'],
'lines': [
['_'.join([name, 'total-jobs']), 'jobs', 'incremental']
- ]},
+ ]
+ },
order[1]: {
'options': [None, 'Jobs', 'jobs', family, 'beanstalk.jobs', 'stacked'],
'lines': [
@@ -136,27 +134,30 @@ def tube_chart_template(name):
['_'.join([name, 'current-jobs-reserved']), 'reserved'],
['_'.join([name, 'current-jobs-delayed']), 'delayed'],
['_'.join([name, 'current-jobs-buried']), 'buried']
- ]},
+ ]
+ },
order[2]: {
'options': [None, 'Connections', 'connections', family, 'beanstalk.connections', 'stacked'],
'lines': [
['_'.join([name, 'current-using']), 'using'],
['_'.join([name, 'current-waiting']), 'waiting'],
['_'.join([name, 'current-watching']), 'watching']
- ]},
+ ]
+ },
order[3]: {
'options': [None, 'Commands', 'commands/s', family, 'beanstalk.commands', 'stacked'],
'lines': [
['_'.join([name, 'cmd-delete']), 'deletes', 'incremental'],
['_'.join([name, 'cmd-pause-tube']), 'pauses', 'incremental']
- ]},
+ ]
+ },
order[4]: {
'options': [None, 'Pause', 'seconds', family, 'beanstalk.pause', 'stacked'],
'lines': [
['_'.join([name, 'pause']), 'since'],
['_'.join([name, 'pause-time-left']), 'left']
- ]}
-
+ ]
+ }
}
return order, charts
@@ -176,10 +177,6 @@ class Service(SimpleService):
self.error("'beanstalkc' module is needed to use beanstalk.chart.py")
return False
- if not YAML:
- self.error("'yaml' module is needed to use beanstalk.chart.py")
- return False
-
self.conn = self.connect()
return True if self.conn else False
@@ -231,7 +228,7 @@ class Service(SimpleService):
return beanstalkc.Connection(host=host,
port=port,
connect_timeout=timeout,
- parse_yaml=yaml.load)
+ parse_yaml=safe_load)
except beanstalkc.SocketError as error:
self.error('Connection to {0}:{1} failed: {2}'.format(host, port, error))
return None
diff --git a/conf.d/python.d/beanstalk.conf b/collectors/python.d.plugin/beanstalk/beanstalk.conf
index 940801877..940801877 100644
--- a/conf.d/python.d/beanstalk.conf
+++ b/collectors/python.d.plugin/beanstalk/beanstalk.conf