summaryrefslogtreecommitdiffstats
path: root/collectors/python.d.plugin/go_expvar
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--collectors/python.d.plugin/go_expvar/Makefile.inc13
-rw-r--r--collectors/python.d.plugin/go_expvar/metadata.yaml329
l---------src/collectors/python.d.plugin/go_expvar/README.md (renamed from collectors/python.d.plugin/go_expvar/README.md)0
-rw-r--r--src/collectors/python.d.plugin/go_expvar/go_expvar.chart.py (renamed from collectors/python.d.plugin/go_expvar/go_expvar.chart.py)0
-rw-r--r--src/collectors/python.d.plugin/go_expvar/go_expvar.conf (renamed from collectors/python.d.plugin/go_expvar/go_expvar.conf)2
-rw-r--r--src/collectors/python.d.plugin/go_expvar/integrations/go_applications_expvar.md (renamed from collectors/python.d.plugin/go_expvar/integrations/go_applications_expvar.md)20
6 files changed, 11 insertions, 353 deletions
diff --git a/collectors/python.d.plugin/go_expvar/Makefile.inc b/collectors/python.d.plugin/go_expvar/Makefile.inc
deleted file mode 100644
index 74f50d765..000000000
--- a/collectors/python.d.plugin/go_expvar/Makefile.inc
+++ /dev/null
@@ -1,13 +0,0 @@
-# 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 += go_expvar/go_expvar.chart.py
-dist_pythonconfig_DATA += go_expvar/go_expvar.conf
-
-# do not install these files, but include them in the distribution
-dist_noinst_DATA += go_expvar/README.md go_expvar/Makefile.inc
-
diff --git a/collectors/python.d.plugin/go_expvar/metadata.yaml b/collectors/python.d.plugin/go_expvar/metadata.yaml
deleted file mode 100644
index 9419b024a..000000000
--- a/collectors/python.d.plugin/go_expvar/metadata.yaml
+++ /dev/null
@@ -1,329 +0,0 @@
-plugin_name: python.d.plugin
-modules:
- - meta:
- plugin_name: python.d.plugin
- module_name: go_expvar
- monitored_instance:
- name: Go applications (EXPVAR)
- link: "https://pkg.go.dev/expvar"
- categories:
- - data-collection.apm
- icon_filename: "go.png"
- related_resources:
- integrations:
- list: []
- info_provided_to_referring_integrations:
- description: ""
- keywords:
- - go
- - expvar
- - application
- most_popular: false
- overview:
- data_collection:
- metrics_description: "This collector monitors Go applications that expose their metrics with the use of the `expvar` package from the Go standard library. It produces charts for Go runtime memory statistics and optionally any number of custom charts."
- method_description: "It connects via http to gather the metrics exposed via the `expvar` package."
- supported_platforms:
- include: []
- exclude: []
- multi_instance: true
- additional_permissions:
- description: ""
- default_behavior:
- auto_detection:
- description: ""
- limits:
- description: ""
- performance_impact:
- description: ""
- setup:
- prerequisites:
- list:
- - title: "Enable the go_expvar collector"
- description: |
- The `go_expvar` collector is disabled by default. To enable it, use `edit-config` from the Netdata [config directory](https://github.com/netdata/netdata/blob/master/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](https://github.com/netdata/netdata/blob/master/docs/configure/start-stop-restart.md) for your system.
- - title: "Sample `expvar` usage in a Go application"
- description: |
- The `expvar` package exposes metrics over HTTP and is very easy to use.
- Consider this minimal sample below:
-
- ```go
- package main
-
- import (
- _ "expvar"
- "net/http"
- )
-
- func main() {
- http.ListenAndServe("127.0.0.1:8080", nil)
- }
- ```
-
- When imported this way, the `expvar` package registers a HTTP handler at `/debug/vars` that
- exposes Go runtime's memory statistics in JSON format. You can inspect the output by opening
- the URL in your browser (or by using `wget` or `curl`).
-
- Sample output:
-
- ```json
- {
- "cmdline": ["./expvar-demo-binary"],
- "memstats": {"Alloc":630856,"TotalAlloc":630856,"Sys":3346432,"Lookups":27, <omitted for brevity>}
- }
- ```
-
- You can of course expose and monitor your own variables as well.
- Here is a sample Go application that exposes a few custom variables:
-
- ```go
- package main
-
- import (
- "expvar"
- "net/http"
- "runtime"
- "time"
- )
-
- func main() {
-
- tick := time.NewTicker(1 * time.Second)
- num_go := expvar.NewInt("runtime.goroutines")
- counters := expvar.NewMap("counters")
- counters.Set("cnt1", new(expvar.Int))
- counters.Set("cnt2", new(expvar.Float))
-
- go http.ListenAndServe(":8080", nil)
-
- for {
- select {
- case <- tick.C:
- num_go.Set(int64(runtime.NumGoroutine()))
- counters.Add("cnt1", 1)
- counters.AddFloat("cnt2", 1.452)
- }
- }
- }
- ```
-
- Apart from the runtime memory stats, this application publishes two counters and the
- number of currently running Goroutines and updates these stats every second.
- configuration:
- file:
- name: python.d/go_expvar.conf
- options:
- description: |
- There are 2 sections:
-
- * Global variables
- * One or more JOBS that can define multiple different instances to monitor.
-
- The following options can be defined globally: priority, penalty, autodetection_retry, update_every, but can also be defined per JOB to override the global values.
-
- Additionally, the following collapsed table contains all the options that can be configured inside a JOB definition.
-
- Every configuration JOB starts with a `job_name` value which will appear in the dashboard, unless a `name` parameter is specified. Each JOB can be used to monitor a different Go application.
- folding:
- title: "Config options"
- enabled: true
- list:
- - name: update_every
- description: Sets the default data collection frequency.
- default_value: 5
- required: false
- - name: priority
- description: Controls the order of charts at the netdata dashboard.
- default_value: 60000
- required: false
- - name: autodetection_retry
- description: Sets the job re-check interval in seconds.
- default_value: 0
- required: false
- - name: penalty
- description: Indicates whether to apply penalty to update_every in case of failures.
- default_value: yes
- required: false
- - name: name
- description: Job name. This value will overwrite the `job_name` value. JOBS with the same name are mutually exclusive. Only one of them will be allowed running at any time. This allows autodetection to try several alternatives and pick the one that works.
- default_value: ""
- required: false
- - name: url
- description: the URL and port of the expvar endpoint. Please include the whole path of the endpoint, as the expvar handler can be installed in a non-standard location.
- default_value: ""
- required: true
- - name: user
- description: If the URL is password protected, this is the username to use.
- default_value: ""
- required: false
- - name: pass
- description: If the URL is password protected, this is the password to use.
- default_value: ""
- required: false
- - name: collect_memstats
- description: Enables charts for Go runtime's memory statistics.
- default_value: ""
- required: false
- - name: extra_charts
- description: Defines extra data/charts to monitor, please see the example below.
- default_value: ""
- required: false
- examples:
- folding:
- enabled: false
- title: "Config"
- list:
- - name: Monitor a Go app1 application
- description: |
- The example below sets a configuration for a Go application, called `app1`. Besides the `memstats`, the application also exposes two counters and the number of currently running Goroutines and updates these stats every second.
-
- The `go_expvar` collector can monitor these as well with the use of the `extra_charts` configuration variable.
-
- The `extra_charts` variable is a YaML list of Netdata chart definitions.
- Each chart definition has the following keys:
-
- ```
- id: Netdata chart ID
- options: a key-value mapping of chart options
- lines: a list of line definitions
- ```
-
- **Note: please do not use dots in the chart or line ID field.
- See [this issue](https://github.com/netdata/netdata/pull/1902#issuecomment-284494195) for explanation.**
-
- Please see these two links to the official Netdata documentation for more information about the values:
-
- - [External plugins - charts](https://github.com/netdata/netdata/blob/master/collectors/plugins.d/README.md#chart)
- - [Chart variables](https://github.com/netdata/netdata/blob/master/collectors/python.d.plugin/README.md#global-variables-order-and-chart)
-
- **Line definitions**
-
- Each chart can define multiple lines (dimensions).
- A line definition is a key-value mapping of line options.
- Each line can have the following options:
-
- ```
- # mandatory
- expvar_key: the name of the expvar as present in the JSON output of /debug/vars endpoint
- expvar_type: value type; supported are "float" or "int"
- id: the id of this line/dimension in Netdata
-
- # optional - Netdata defaults are used if these options are not defined
- name: ''
- algorithm: absolute
- multiplier: 1
- divisor: 100 if expvar_type == float, 1 if expvar_type == int
- hidden: False
- ```
-
- Please see the following link for more information about the options and their default values:
- [External plugins - dimensions](https://github.com/netdata/netdata/blob/master/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.
- Expvar names are joined together with '.' when flattening.
-
- Example:
-
- ```
- {
- "counters": {"cnt1": 1042, "cnt2": 1512.9839999999983},
- "runtime.goroutines": 5
- }
- ```
-
- In the above case, the exported variables will be available under `runtime.goroutines`,
- `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.
- config: |
- app1:
- name : 'app1'
- url : 'http://127.0.0.1:8080/debug/vars'
- collect_memstats: true
- extra_charts:
- - id: "runtime_goroutines"
- options:
- name: num_goroutines
- title: "runtime: number of goroutines"
- units: goroutines
- family: runtime
- context: expvar.runtime.goroutines
- chart_type: line
- lines:
- - {expvar_key: 'runtime.goroutines', expvar_type: int, id: runtime_goroutines}
- - id: "foo_counters"
- options:
- name: counters
- title: "some random counters"
- units: awesomeness
- family: counters
- context: expvar.foo.counters
- chart_type: line
- lines:
- - {expvar_key: 'counters.cnt1', expvar_type: int, id: counters_cnt1}
- - {expvar_key: 'counters.cnt2', expvar_type: float, id: counters_cnt2}
- troubleshooting:
- problems:
- list: []
- alerts: []
- metrics:
- folding:
- title: Metrics
- enabled: false
- description: ""
- availability: []
- scopes:
- - name: global
- description: "These metrics refer to the entire monitored application."
- labels: []
- metrics:
- - name: expvar.memstats.heap
- description: "memory: size of heap memory structures"
- unit: "KiB"
- chart_type: line
- dimensions:
- - name: alloc
- - name: inuse
- - name: expvar.memstats.stack
- description: "memory: size of stack memory structures"
- unit: "KiB"
- chart_type: line
- dimensions:
- - name: inuse
- - name: expvar.memstats.mspan
- description: "memory: size of mspan memory structures"
- unit: "KiB"
- chart_type: line
- dimensions:
- - name: inuse
- - name: expvar.memstats.mcache
- description: "memory: size of mcache memory structures"
- unit: "KiB"
- chart_type: line
- dimensions:
- - name: inuse
- - name: expvar.memstats.live_objects
- description: "memory: number of live objects"
- unit: "objects"
- chart_type: line
- dimensions:
- - name: live
- - name: expvar.memstats.sys
- description: "memory: size of reserved virtual address space"
- unit: "KiB"
- chart_type: line
- dimensions:
- - name: sys
- - name: expvar.memstats.gc_pauses
- description: "memory: average duration of GC pauses"
- unit: "ns"
- chart_type: line
- dimensions:
- - name: avg
diff --git a/collectors/python.d.plugin/go_expvar/README.md b/src/collectors/python.d.plugin/go_expvar/README.md
index f28a82f34..f28a82f34 120000
--- a/collectors/python.d.plugin/go_expvar/README.md
+++ b/src/collectors/python.d.plugin/go_expvar/README.md
diff --git a/collectors/python.d.plugin/go_expvar/go_expvar.chart.py b/src/collectors/python.d.plugin/go_expvar/go_expvar.chart.py
index dca010817..dca010817 100644
--- a/collectors/python.d.plugin/go_expvar/go_expvar.chart.py
+++ b/src/collectors/python.d.plugin/go_expvar/go_expvar.chart.py
diff --git a/collectors/python.d.plugin/go_expvar/go_expvar.conf b/src/collectors/python.d.plugin/go_expvar/go_expvar.conf
index 4b821cde9..088fca9cf 100644
--- a/collectors/python.d.plugin/go_expvar/go_expvar.conf
+++ b/src/collectors/python.d.plugin/go_expvar/go_expvar.conf
@@ -74,7 +74,7 @@
#
# Please visit the module wiki page for more information on how to use the extra_charts variable:
#
-# https://github.com/netdata/netdata/tree/master/collectors/python.d.plugin/go_expvar
+# https://github.com/netdata/netdata/tree/master/src/collectors/python.d.plugin/go_expvar
#
# Configuration example
# ---------------------
diff --git a/collectors/python.d.plugin/go_expvar/integrations/go_applications_expvar.md b/src/collectors/python.d.plugin/go_expvar/integrations/go_applications_expvar.md
index 8d61fa2ae..cbe7f265f 100644
--- a/collectors/python.d.plugin/go_expvar/integrations/go_applications_expvar.md
+++ b/src/collectors/python.d.plugin/go_expvar/integrations/go_applications_expvar.md
@@ -1,9 +1,9 @@
<!--startmeta
-custom_edit_url: "https://github.com/netdata/netdata/edit/master/collectors/python.d.plugin/go_expvar/README.md"
-meta_yaml: "https://github.com/netdata/netdata/edit/master/collectors/python.d.plugin/go_expvar/metadata.yaml"
+custom_edit_url: "https://github.com/netdata/netdata/edit/master/src/collectors/python.d.plugin/go_expvar/README.md"
+meta_yaml: "https://github.com/netdata/netdata/edit/master/src/collectors/python.d.plugin/go_expvar/metadata.yaml"
sidebar_label: "Go applications (EXPVAR)"
learn_status: "Published"
-learn_rel_path: "Data Collection/APM"
+learn_rel_path: "Collecting Metrics/APM"
most_popular: False
message: "DO NOT EDIT THIS FILE DIRECTLY, IT IS GENERATED BY THE COLLECTOR'S metadata.yaml FILE"
endmeta-->
@@ -84,14 +84,14 @@ There are no alerts configured by default for this integration.
#### Enable the go_expvar collector
-The `go_expvar` collector is disabled by default. To enable it, use `edit-config` from the Netdata [config directory](https://github.com/netdata/netdata/blob/master/docs/configure/nodes.md), which is typically at `/etc/netdata`, to edit the `python.d.conf` file.
+The `go_expvar` collector is disabled by default. To enable it, use `edit-config` from the Netdata [config directory](/docs/netdata-agent/configuration/README.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](https://github.com/netdata/netdata/blob/master/docs/configure/start-stop-restart.md) for your system.
+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](/packaging/installer/README.md#maintaining-a-netdata-agent-installation) for your system.
#### Sample `expvar` usage in a Go application
@@ -172,7 +172,7 @@ The configuration file name for this integration is `python.d/go_expvar.conf`.
You can edit the configuration file using the `edit-config` script from the
-Netdata [config directory](https://github.com/netdata/netdata/blob/master/docs/configure/nodes.md#the-netdata-config-directory).
+Netdata [config directory](/docs/netdata-agent/configuration/README.md#the-netdata-config-directory).
```bash
cd /etc/netdata 2>/dev/null || cd /opt/netdata/etc/netdata
@@ -192,7 +192,7 @@ Additionally, the following collapsed table contains all the options that can be
Every configuration JOB starts with a `job_name` value which will appear in the dashboard, unless a `name` parameter is specified. Each JOB can be used to monitor a different Go application.
-<details><summary>Config options</summary>
+<details open><summary>Config options</summary>
| Name | Description | Default | Required |
|:----|:-----------|:-------|:--------:|
@@ -231,8 +231,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](https://github.com/netdata/netdata/blob/master/collectors/plugins.d/README.md#chart)
-- [Chart variables](https://github.com/netdata/netdata/blob/master/collectors/python.d.plugin/README.md#global-variables-order-and-chart)
+- [External plugins - charts](/src/collectors/plugins.d/README.md#chart)
+- [Chart variables](/src/collectors/python.d.plugin/README.md#global-variables-order-and-chart)
**Line definitions**
@@ -255,7 +255,7 @@ hidden: False
```
Please see the following link for more information about the options and their default values:
-[External plugins - dimensions](https://github.com/netdata/netdata/blob/master/collectors/plugins.d/README.md#dimension)
+[External plugins - dimensions](/src/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.