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/go_expvar/README.md | 58 +++++++++++++++------- .../python.d.plugin/go_expvar/go_expvar.chart.py | 3 +- 2 files changed, 41 insertions(+), 20 deletions(-) (limited to 'collectors/python.d.plugin/go_expvar') diff --git a/collectors/python.d.plugin/go_expvar/README.md b/collectors/python.d.plugin/go_expvar/README.md index 7d78fabd0..a73610e7a 100644 --- a/collectors/python.d.plugin/go_expvar/README.md +++ b/collectors/python.d.plugin/go_expvar/README.md @@ -1,11 +1,14 @@ -# go_expvar + -The `go_expvar` module can monitor any Go application that exposes its metrics with the use of -`expvar` package from the Go standard library. +# Go applications monitoring with Netdata -`go_expvar` produces charts for Go runtime memory statistics and optionally any number of custom charts. +Monitors Go application that exposes its metrics with the use of `expvar` package from the Go standard library. The package produces charts for Go runtime memory statistics and optionally any number of custom charts. -For the memory statistics, it produces the following charts: +The `go_expvar` module produces the following charts: 1. **Heap allocations** in kB @@ -36,7 +39,7 @@ For the memory statistics, it produces the following charts: - avg: average duration of all GC stop-the-world pauses -## Monitoring Go Applications +## Monitoring Go applications Netdata can be used to monitor running Go applications that expose their metrics with the use of the [expvar package](https://golang.org/pkg/expvar/) included in Go standard library. @@ -66,7 +69,7 @@ Sample output: ```json { "cmdline": ["./expvar-demo-binary"], -"memstats": {"Alloc":630856,"TotalAlloc":630856,"Sys":3346432,"Lookups":27, } +"memstats": {"Alloc":630856,"TotalAlloc":630856,"Sys":3346432,"Lookups":27, } } ``` @@ -112,9 +115,8 @@ the use of `netdata`s `go_expvar` module. ### Using Netdata go_expvar module -The `go_expvar` module is disabled by default. To enable it, edit [`python.d.conf`](../python.d.conf) -(to edit it on your system run `/etc/netdata/edit-config python.d.conf`), and change the `go_expvar` -variable to `yes`: +The `go_expvar` module is disabled by default. To enable it, edit `python.d.conf` (to edit it on your system run +`/etc/netdata/edit-config python.d.conf`), and change the `go_expvar` variable to `yes`: ``` # Enable / Disable python.d.plugin modules @@ -130,10 +132,9 @@ go_expvar: yes ... ``` -Next, we need to edit the module configuration file (found at [`/etc/netdata/python.d/go_expvar.conf`](go_expvar.conf) by default) -(to edit it on your system run `/etc/netdata/edit-config python.d/go_expvar.conf`). -The module configuration consists of jobs, where each job can be used to monitor a separate Go application. -Let's see a sample job configuration: +Next, we need to edit the module configuration file (found at `/etc/netdata/python.d/go_expvar.conf` by default) (to +edit it on your system run `/etc/netdata/edit-config python.d/go_expvar.conf`). The module configuration consists of +jobs, where each job can be used to monitor a separate Go application. Let's see a sample job configuration: ``` # /etc/netdata/python.d/go_expvar.conf @@ -208,8 +209,8 @@ See [this issue](https://github.com/netdata/netdata/pull/1902#issuecomment-28449 Please see these two links to the official Netdata documentation for more information about the values: -- [External plugins - charts](../../plugins.d/#chart) -- [Chart variables](../#global-variables-order-and-chart) +- [External plugins - charts](/collectors/plugins.d/README.md#chart) +- [Chart variables](/collectors/python.d.plugin/README.md#global-variables-order-and-chart) **Line definitions** @@ -232,7 +233,7 @@ hidden: False ``` Please see the following link for more information about the options and their default values: -[External plugins - dimensions](../../plugins.d/#dimension) +[External plugins - dimensions](/collectors/plugins.d/README.md#dimension) Apart from top-level expvars, this plugin can also parse expvars stored in a multi-level map; All dicts in the resulting JSON document are then flattened to one level. @@ -251,7 +252,28 @@ In the above case, the exported variables will be available under `runtime.gorou `counters.cnt1` and `counters.cnt2` expvar_keys. If the flattening results in a key collision, the first defined key wins and all subsequent keys with the same name are ignored. -**Configuration example** +## Enable the collector + +The `go_expvar` collector is disabled by default. To enable it, use `edit-config` from the Netdata [config +directory](/docs/configure/nodes.md), which is typically at `/etc/netdata`, to edit the `python.d.conf` file. + +```bash +cd /etc/netdata # Replace this path with your Netdata config directory, if different +sudo ./edit-config python.d.conf +``` + +Change the value of the `go_expvar` setting to `yes`. Save the file and restart the Netdata Agent with `sudo systemctl +restart netdata`, or the appropriate method for your system, to finish enabling the `go_expvar` collector. + +## Configuration + +Edit the `python.d/go_expvar.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/go_expvar.conf +``` The configuration below matches the second Go application described above. Netdata will monitor and chart memory stats for the application, as well as a custom chart of diff --git a/collectors/python.d.plugin/go_expvar/go_expvar.chart.py b/collectors/python.d.plugin/go_expvar/go_expvar.chart.py index e82a87761..f9bbdc164 100644 --- a/collectors/python.d.plugin/go_expvar/go_expvar.chart.py +++ b/collectors/python.d.plugin/go_expvar/go_expvar.chart.py @@ -4,13 +4,12 @@ # SPDX-License-Identifier: GPL-3.0-or-later from __future__ import division -import json +import json from collections import namedtuple from bases.FrameworkServices.UrlService import UrlService - MEMSTATS_ORDER = [ 'memstats_heap', 'memstats_stack', -- cgit v1.2.3