summaryrefslogtreecommitdiffstats
path: root/collectors/python.d.plugin/gearman
diff options
context:
space:
mode:
authorIlya Mashchenko <ilya@netdata.cloud>2020-07-27 15:28:59 +0300
committerGitHub <noreply@github.com>2020-07-27 15:28:59 +0300
commit7377887f361fa08ad0101e2af2a8af41a7d29187 (patch)
treebbd7ce58e5c1f055f8fbb0a625622c57fc50bd56 /collectors/python.d.plugin/gearman
parentb0d42a5e61e610c2ef5a6c277bd5908c9c75b771 (diff)
python.d/gearmand: handle func prefixes in `status\n` response (#9610)
Diffstat (limited to 'collectors/python.d.plugin/gearman')
-rw-r--r--collectors/python.d.plugin/gearman/gearman.chart.py22
1 files changed, 17 insertions, 5 deletions
diff --git a/collectors/python.d.plugin/gearman/gearman.chart.py b/collectors/python.d.plugin/gearman/gearman.chart.py
index eb8a3749d7..5e280a4d80 100644
--- a/collectors/python.d.plugin/gearman/gearman.chart.py
+++ b/collectors/python.d.plugin/gearman/gearman.chart.py
@@ -121,6 +121,7 @@ class Service(SocketService):
Example output returned from
_get_raw_data():
+ prefix generic_worker4 78 78 500
generic_worker2 78 78 500
generic_worker3 0 0 760
generic_worker1 0 0 500
@@ -137,13 +138,24 @@ class Service(SocketService):
self.debug("Gearman returned no data")
raise GearmanReadException()
- job_lines = raw.splitlines()[:-1]
- job_lines = [job.split() for job in sorted(job_lines)]
+ workers = list()
- for line in job_lines:
- line[1:] = map(int, line[1:])
+ for line in raw.splitlines()[:-1]:
+ parts = line.split()
+ if not parts:
+ continue
+
+ name = '_'.join(parts[:-3])
+ try:
+ values = [int(w) for w in parts[-3:]]
+ except ValueError:
+ continue
+
+ w = [name]
+ w.extend(values)
+ workers.append(w)
- return job_lines
+ return workers
def process_jobs(self, active_jobs):