From a8220ab2d293bb7f4b014b79d16b2fb05090fa93 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Feb 2021 12:45:55 +0100 Subject: Adding upstream version 1.29.0. Signed-off-by: Daniel Baumann --- collectors/python.d.plugin/gearman/README.md | 24 +++++++++++++++----- .../python.d.plugin/gearman/gearman.chart.py | 26 +++++++++++++++++----- 2 files changed, 38 insertions(+), 12 deletions(-) (limited to 'collectors/python.d.plugin/gearman') diff --git a/collectors/python.d.plugin/gearman/README.md b/collectors/python.d.plugin/gearman/README.md index cbb4da3e2..b9fc914bf 100644 --- a/collectors/python.d.plugin/gearman/README.md +++ b/collectors/python.d.plugin/gearman/README.md @@ -1,8 +1,12 @@ -# Gearman + -Module monitors Gearman worker statistics. A chart -is shown for each job as well as one showing a summary -of all workers. +# Gearman monitoring with Netdata + +Monitors Gearman worker statistics. A chart is shown for each job as well as one showing a summary of all workers. Note: Charts may show as a line graph rather than an area graph if you load Netdata with no jobs running. To change @@ -20,7 +24,15 @@ It produces: * Workers idle * Workers running -### configuration +## Configuration + +Edit the `python.d/gearman.conf` configuration file using `edit-config` from the Netdata [config +directory](/docs/configure/nodes.md), which is typically at `/etc/netdata`. + +```bash +cd /etc/netdata # Replace this path with your Netdata config directory, if different +sudo ./edit-config python.d/gearman.conf +``` ```yaml localhost: @@ -36,4 +48,4 @@ localhost: When no configuration file is found, module tries to connect to TCP/IP socket: `localhost:4730`. ---- +[![analytics](https://www.google-analytics.com/collect?v=1&aip=1&t=pageview&_s=1&ds=github&dr=https%3A%2F%2Fgithub.com%2Fnetdata%2Fnetdata&dl=https%3A%2F%2Fmy-netdata.io%2Fgithub%2Fcollectors%2Fpython.d.plugin%2Fgearman%2FREADME&_u=MAC~&cid=5792dfd7-8dc4-476b-af31-da2fdb9f93d2&tid=UA-64295674-3)]() diff --git a/collectors/python.d.plugin/gearman/gearman.chart.py b/collectors/python.d.plugin/gearman/gearman.chart.py index 26f3533c4..5e280a4d8 100644 --- a/collectors/python.d.plugin/gearman/gearman.chart.py +++ b/collectors/python.d.plugin/gearman/gearman.chart.py @@ -4,9 +4,9 @@ # Gearman Netdata Plugin -from bases.FrameworkServices.SocketService import SocketService from copy import deepcopy +from bases.FrameworkServices.SocketService import SocketService CHARTS = { 'total_workers': { @@ -29,6 +29,7 @@ def job_chart_template(job_name): ] } + def build_result_dict(job): """ Get the status for each job @@ -46,6 +47,7 @@ def build_result_dict(job): '{0}_running'.format(job['job_name']): running, } + def parse_worker_data(job): job_name = job[0] job_metrics = job[1:] @@ -119,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 @@ -135,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 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 - for line in job_lines: - line[1:] = map(int, line[1:]) + w = [name] + w.extend(values) + workers.append(w) - return job_lines + return workers def process_jobs(self, active_jobs): -- cgit v1.2.3