From f2360f92d678b51dbe9040a747c68e114e30b34d Mon Sep 17 00:00:00 2001 From: Craig Peterson <192540+captncraig@users.noreply.github.com> Date: Tue, 12 Sep 2023 09:59:14 -0600 Subject: [PATCH 01/11] initial implementation of linode --- component/all/all.go | 1 + component/discovery/linode/linode.go | 72 ++++++++++ .../reference/components/discovery.kuma.md | 2 +- .../reference/components/discovery.linode.md | 125 ++++++++++++++++++ 4 files changed, 199 insertions(+), 1 deletion(-) create mode 100644 component/discovery/linode/linode.go create mode 100644 docs/sources/flow/reference/components/discovery.linode.md diff --git a/component/all/all.go b/component/all/all.go index 3c37f484ebb4..0b1a68446a96 100644 --- a/component/all/all.go +++ b/component/all/all.go @@ -18,6 +18,7 @@ import ( _ "github.com/grafana/agent/component/discovery/kubelet" // Import discovery.kubelet _ "github.com/grafana/agent/component/discovery/kubernetes" // Import discovery.kubernetes _ "github.com/grafana/agent/component/discovery/kuma" // Import discovery.kuma + _ "github.com/grafana/agent/component/discovery/linode" // Import discovery.linode _ "github.com/grafana/agent/component/discovery/marathon" // Import discovery.marathon _ "github.com/grafana/agent/component/discovery/nerve" // Import discovery.nerve _ "github.com/grafana/agent/component/discovery/nomad" // Import discovery.nomad diff --git a/component/discovery/linode/linode.go b/component/discovery/linode/linode.go new file mode 100644 index 000000000000..9467ae79824a --- /dev/null +++ b/component/discovery/linode/linode.go @@ -0,0 +1,72 @@ +package kuma + +import ( + "fmt" + "time" + + "github.com/grafana/agent/component" + "github.com/grafana/agent/component/common/config" + "github.com/grafana/agent/component/discovery" + "github.com/prometheus/common/model" + prom_discovery "github.com/prometheus/prometheus/discovery/linode" +) + +func init() { + component.Register(component.Registration{ + Name: "discovery.linode", + Args: Arguments{}, + Exports: discovery.Exports{}, + + Build: func(opts component.Options, args component.Arguments) (component.Component, error) { + return New(opts, args.(Arguments)) + }, + }) +} + +// Arguments configure the discovery.linode component. +type Arguments struct { + RefreshInterval time.Duration `river:"refresh_interval,attr,optional"` + Port int `river:"port,attr,optional"` + TagSeparator string `river:"tag_separator,attr,optional"` + HTTPClientConfig config.HTTPClientConfig `river:",squash"` +} + +// DefaultArguments is used to initialize default values for Arguments. +var DefaultArguments = Arguments{ + TagSeparator: ",", + Port: 80, + RefreshInterval: 60 * time.Second, + + HTTPClientConfig: config.DefaultHTTPClientConfig, +} + +// SetToDefault implements river.Defaulter. +func (args *Arguments) SetToDefault() { + *args = DefaultArguments +} + +// Validate implements river.Validator. +func (args *Arguments) Validate() error { + if args.RefreshInterval <= 0 { + return fmt.Errorf("refresh_interval must be greater than 0") + } + return args.HTTPClientConfig.Validate() +} + +// Convert returns the upstream configuration struct. +func (args *Arguments) Convert() *prom_discovery.SDConfig { + return &prom_discovery.SDConfig{ + RefreshInterval: model.Duration(args.RefreshInterval), + Port: args.Port, + TagSeparator: args.TagSeparator, + HTTPClientConfig: *(args.HTTPClientConfig.Convert()), + } +} + +// New returns a new instance of a discovery.linode component. +func New(opts component.Options, args Arguments) (*discovery.Component, error) { + return discovery.New(opts, args, func(args component.Arguments) (discovery.Discoverer, error) { + newArgs := args.(Arguments) + return prom_discovery.NewDiscovery(newArgs.Convert(), opts.Logger) + }) +} diff --git a/docs/sources/flow/reference/components/discovery.kuma.md b/docs/sources/flow/reference/components/discovery.kuma.md index 9d76e2ae0979..ff314b93ea38 100644 --- a/docs/sources/flow/reference/components/discovery.kuma.md +++ b/docs/sources/flow/reference/components/discovery.kuma.md @@ -40,7 +40,7 @@ Name | Type | Description - [`oauth2` block][oauth2]. The following blocks are supported inside the definition of -`discovery.nomad`: +`discovery.kuma`: Hierarchy | Block | Description | Required --------- | ----- | ----------- | -------- diff --git a/docs/sources/flow/reference/components/discovery.linode.md b/docs/sources/flow/reference/components/discovery.linode.md new file mode 100644 index 000000000000..a60345e4d8cf --- /dev/null +++ b/docs/sources/flow/reference/components/discovery.linode.md @@ -0,0 +1,125 @@ +--- +canonical: https://grafana.com/docs/agent/latest/flow/reference/components/discovery.linode/ +title: discovery.linode +--- + +# discovery.linode + +`discovery.linode` allows retrieving scrape targets from [Linode's](https://www.linode.com/) Linode APIv4. + +## Usage + +```river +discovery.linode "LABEL" { + bearer_token = LINODE_API_TOKEN +} +``` + +## Arguments + +The following arguments are supported: + +Name | Type | Description | Default | Required +------------------ | -------------- | -------------------------------------------------------------- | ------------- | -------- +`refresh_interval` | `duration` | The time to wait between polling update requests. | `"60s"` | no +`port` | `int` | Port that metrics should be scraped from. | `80` | no +`tag_separator` | `string` | The string by which Linode Instance tags are joined into the tag label. | `,` | no + +`bearer_token` | `secret` | Bearer token to authenticate with. | | no +`bearer_token_file` | `string` | File containing a bearer token to authenticate with. | | no +`proxy_url` | `string` | HTTP proxy to proxy requests through. | | no +`follow_redirects` | `bool` | Whether redirects returned by the server should be followed. | `true` | no +`enable_http2` | `bool` | Whether HTTP2 is supported for requests. | `true` | no + + You can provide one of the following arguments for authentication: + - [`bearer_token` argument](#arguments). + - [`bearer_token_file` argument](#arguments). + - [`authorization` block][authorization]. + - [`oauth2` block][oauth2]. + +The following blocks are supported inside the definition of +`discovery.linode`: + +Hierarchy | Block | Description | Required +--------- | ----- | ----------- | -------- +authorization | [authorization][] | Configure generic authorization to the endpoint. | no +oauth2 | [oauth2][] | Configure OAuth2 for authenticating to the endpoint. | no +oauth2 > tls_config | [tls_config][] | Configure TLS settings for connecting to the endpoint. | no + +The `>` symbol indicates deeper levels of nesting. For example, +`oauth2 > tls_config` refers to a `tls_config` block defined inside +an `oauth2` block. + +[authorization]: #authorization-block +[oauth2]: #oauth2-block +[tls_config]: #tls_config-block + +### authorization block + +{{< docs/shared lookup="flow/reference/components/authorization-block.md" source="agent" version="" >}} + +### oauth2 block + +{{< docs/shared lookup="flow/reference/components/oauth2-block.md" source="agent" version="" >}} + +### tls_config block + +{{< docs/shared lookup="flow/reference/components/tls-config-block.md" source="agent" version="" >}} + + +## Exported fields + +The following fields are exported and can be referenced by other components: + +Name | Type | Description +--------- | ------------------- | ----------- +`targets` | `list(map(string))` | The set of targets discovered from the Kuma API. + +The following meta labels are available on targets and can be used by the +discovery.relabel component: + +* `__meta_kuma_mesh`: the name of the proxy's Mesh +* `__meta_kuma_dataplane`: the name of the proxy +* `__meta_kuma_service`: the name of the proxy's associated Service +* `__meta_kuma_label_`: each tag of the proxy + +## Component health + +`discovery.linode` is only reported as unhealthy when given an invalid +configuration. In those cases, exported fields retain their last healthy +values. + +## Debug information + +`discovery.linode` does not expose any component-specific debug information. + +### Debug metrics + +`discovery.linode` does not expose any component-specific debug metrics. + +## Example + +```river +discovery.linode "example" { + bearer_token = env("LINODE_TOKEN") + port = 8876 +} +prometheus.scrape "demo" { + targets = discovery.linode.example.targets + forward_to = [prometheus.remote_write.demo.receiver] +} +prometheus.remote_write "demo" { + endpoint { + url = PROMETHEUS_REMOTE_WRITE_URL + basic_auth { + username = USERNAME + password = PASSWORD + } + } +} +``` +Replace the following: + - `PROMETHEUS_REMOTE_WRITE_URL`: The URL of the Prometheus remote_write-compatible server to send metrics to. + - `USERNAME`: The username to use for authentication to the remote_write API. + - `PASSWORD`: The password to use for authentication to the remote_write API. + From 3644c25cd60a7275427d59f64dd2218fc4a01fc9 Mon Sep 17 00:00:00 2001 From: Craig Peterson <192540+captncraig@users.noreply.github.com> Date: Tue, 12 Sep 2023 10:15:53 -0600 Subject: [PATCH 02/11] docs --- .../reference/components/discovery.linode.md | 47 +++++++++++++++++-- 1 file changed, 42 insertions(+), 5 deletions(-) diff --git a/docs/sources/flow/reference/components/discovery.linode.md b/docs/sources/flow/reference/components/discovery.linode.md index a60345e4d8cf..546194069249 100644 --- a/docs/sources/flow/reference/components/discovery.linode.md +++ b/docs/sources/flow/reference/components/discovery.linode.md @@ -6,6 +6,7 @@ title: discovery.linode # discovery.linode `discovery.linode` allows retrieving scrape targets from [Linode's](https://www.linode.com/) Linode APIv4. +This service discovery uses the public IPv4 address by default, by that can be changed with relabeling. ## Usage @@ -15,6 +16,8 @@ discovery.linode "LABEL" { } ``` +Note: Linode APIv4 Token must be created with scopes: `linodes:read_only`, `ips:read_only`, and `events:read_only`. + ## Arguments The following arguments are supported: @@ -73,15 +76,29 @@ The following fields are exported and can be referenced by other components: Name | Type | Description --------- | ------------------- | ----------- -`targets` | `list(map(string))` | The set of targets discovered from the Kuma API. +`targets` | `list(map(string))` | The set of targets discovered from the Linode API. The following meta labels are available on targets and can be used by the discovery.relabel component: -* `__meta_kuma_mesh`: the name of the proxy's Mesh -* `__meta_kuma_dataplane`: the name of the proxy -* `__meta_kuma_service`: the name of the proxy's associated Service -* `__meta_kuma_label_`: each tag of the proxy +* `__meta_linode_instance_id`: the id of the linode instance +* `__meta_linode_instance_label`: the label of the linode instance +* `__meta_linode_image`: the slug of the linode instance's image +* `__meta_linode_private_ipv4`: the private IPv4 of the linode instance +* `__meta_linode_public_ipv4`: the public IPv4 of the linode instance +* `__meta_linode_public_ipv6`: the public IPv6 of the linode instance +* `__meta_linode_region`: the region of the linode instance +* `__meta_linode_type`: the type of the linode instance +* `__meta_linode_status`: the status of the linode instance +* `__meta_linode_tags`: a list of tags of the linode instance joined by the tag separator +* `__meta_linode_group`: the display group a linode instance is a member of +* `__meta_linode_hypervisor`: the virtualization software powering the linode instance +* `__meta_linode_backups`: the backup service status of the linode instance +* `__meta_linode_specs_disk_bytes`: the amount of storage space the linode instance has access to +* `__meta_linode_specs_memory_bytes`: the amount of RAM the linode instance has access to +* `__meta_linode_specs_vcpus`: the number of VCPUS this linode has access to +* `__meta_linode_specs_transfer_bytes`: the amount of network transfer the linode instance is allotted each month +* `__meta_linode_extra_ips`: a list of all extra IPv4 addresses assigned to the linode instance joined by the tag separator ## Component health @@ -123,3 +140,23 @@ Replace the following: - `USERNAME`: The username to use for authentication to the remote_write API. - `PASSWORD`: The password to use for authentication to the remote_write API. +### Using private IP address: + +``` +discovery.linode "example" { + bearer_token = env("LINODE_TOKEN") + port = 8876 +} +discovery.relabel "private_ips" { + targets = discovery.linode.example.targets + rule { + source_labels = ["__meta_linode_private_ipv4"] + replacement = "[$1]:8876" + target_label = "__address__" + } +} +prometheus.scrape "demo" { + targets = discovery.relabel.private_ips.targets + forward_to = [...] +} +``` \ No newline at end of file From 9bc0f0fc8cb044e0815b26fbc59cb14b58471d48 Mon Sep 17 00:00:00 2001 From: Craig Peterson <192540+captncraig@users.noreply.github.com> Date: Tue, 12 Sep 2023 10:25:35 -0600 Subject: [PATCH 03/11] tests --- component/discovery/kuma/kuma_test.go | 4 +- component/discovery/linode/linode.go | 2 +- component/discovery/linode/linode_test.go | 50 +++++++++++++++++++++++ 3 files changed, 53 insertions(+), 3 deletions(-) create mode 100644 component/discovery/linode/linode_test.go diff --git a/component/discovery/kuma/kuma_test.go b/component/discovery/kuma/kuma_test.go index 24d318c65296..488834540cbc 100644 --- a/component/discovery/kuma/kuma_test.go +++ b/component/discovery/kuma/kuma_test.go @@ -66,13 +66,13 @@ func TestValidateNoServers(t *testing.T) { RefreshInterval: 10 * time.Second, } err := riverArgs.Validate() - require.Error(t, err, "fetch_timeout must be greater than 0") + require.ErrorContains(t, err, "fetch_timeout must be greater than 0") }) t.Run("validate refresh interval", func(t *testing.T) { riverArgs := Arguments{ FetchTimeout: 10 * time.Second, } err := riverArgs.Validate() - require.Error(t, err, "refresh_interval must be greater than 0") + require.ErrorContains(t, err, "refresh_interval must be greater than 0") }) } diff --git a/component/discovery/linode/linode.go b/component/discovery/linode/linode.go index 9467ae79824a..27080ba930fa 100644 --- a/component/discovery/linode/linode.go +++ b/component/discovery/linode/linode.go @@ -1,4 +1,4 @@ -package kuma +package linode import ( "fmt" diff --git a/component/discovery/linode/linode_test.go b/component/discovery/linode/linode_test.go new file mode 100644 index 000000000000..9c344d6e2629 --- /dev/null +++ b/component/discovery/linode/linode_test.go @@ -0,0 +1,50 @@ +package linode + +import ( + "testing" + "time" + + "github.com/grafana/agent/component/common/config" + "github.com/grafana/river" + promconfig "github.com/prometheus/common/config" + "github.com/prometheus/common/model" + "github.com/stretchr/testify/require" +) + +func TestRiverConfig(t *testing.T) { + var exampleRiverConfig = ` + refresh_interval = "10s" + port = 8080 + tag_separator = ";" +` + var args Arguments + err := river.Unmarshal([]byte(exampleRiverConfig), &args) + require.NoError(t, err) +} + +func TestConvert(t *testing.T) { + riverArgs := Arguments{ + Port: 8080, + RefreshInterval: 15 * time.Second, + TagSeparator: ";", + HTTPClientConfig: config.HTTPClientConfig{ + BearerToken: "FOO", + }, + } + + promArgs := riverArgs.Convert() + require.Equal(t, 8080, promArgs.Port) + require.Equal(t, model.Duration(15*time.Second), promArgs.RefreshInterval) + require.Equal(t, ";", promArgs.TagSeparator) + require.Equal(t, promconfig.Secret("FOO"), promArgs.HTTPClientConfig.BearerToken) +} + +func TestValidate(t *testing.T) { + t.Run("validate RefreshInterval", func(t *testing.T) { + riverArgs := Arguments{ + RefreshInterval: 0, + } + err := riverArgs.Validate() + require.ErrorContains(t, err, "refresh_interval must be greater than 0") + }) +} From ab7cd292ca28f26674f214c8cddcee80a351f7bf Mon Sep 17 00:00:00 2001 From: Craig Peterson <192540+captncraig@users.noreply.github.com> Date: Tue, 12 Sep 2023 11:19:40 -0600 Subject: [PATCH 04/11] converters --- .../internal/prometheusconvert/linode.go | 36 +++++++++++++++++++ .../prometheusconvert/prometheusconvert.go | 4 +++ .../prometheusconvert/testdata/linode.river | 34 ++++++++++++++++++ .../prometheusconvert/testdata/linode.yaml | 15 ++++++++ .../internal/prometheusconvert/validate.go | 3 ++ 5 files changed, 92 insertions(+) create mode 100644 converter/internal/prometheusconvert/linode.go create mode 100644 converter/internal/prometheusconvert/testdata/linode.river create mode 100644 converter/internal/prometheusconvert/testdata/linode.yaml diff --git a/converter/internal/prometheusconvert/linode.go b/converter/internal/prometheusconvert/linode.go new file mode 100644 index 000000000000..22e6ba8be90f --- /dev/null +++ b/converter/internal/prometheusconvert/linode.go @@ -0,0 +1,36 @@ +package prometheusconvert + +import ( + "time" + + "github.com/grafana/agent/component/discovery" + "github.com/grafana/agent/component/discovery/linode" + "github.com/grafana/agent/converter/diag" + "github.com/grafana/agent/converter/internal/common" + prom_linode "github.com/prometheus/prometheus/discovery/linode" +) + +func appendDiscoveryLinode(pb *prometheusBlocks, label string, sdConfig *prom_linode.SDConfig) discovery.Exports { + discoveryLinodeArgs := ToDiscoveryLinode(sdConfig) + name := []string{"discovery", "linode"} + block := common.NewBlockWithOverride(name, label, discoveryLinodeArgs) + pb.discoveryBlocks = append(pb.discoveryBlocks, newPrometheusBlock(block, name, label, "", "")) + return NewDiscoveryExports("discovery.linode." + label + ".targets") +} + +func validateDiscoveryLinode(sdConfig *prom_linode.SDConfig) diag.Diagnostics { + return ValidateHttpClientConfig(&sdConfig.HTTPClientConfig) +} + +func ToDiscoveryLinode(sdConfig *prom_linode.SDConfig) *linode.Arguments { + if sdConfig == nil { + return nil + } + + return &linode.Arguments{ + RefreshInterval: time.Duration(sdConfig.RefreshInterval), + Port: sdConfig.Port, + TagSeparator: sdConfig.TagSeparator, + HTTPClientConfig: *ToHttpClientConfig(&sdConfig.HTTPClientConfig), + } +} diff --git a/converter/internal/prometheusconvert/prometheusconvert.go b/converter/internal/prometheusconvert/prometheusconvert.go index 695637a20fa4..43b57094e401 100644 --- a/converter/internal/prometheusconvert/prometheusconvert.go +++ b/converter/internal/prometheusconvert/prometheusconvert.go @@ -21,6 +21,7 @@ import ( prom_gce "github.com/prometheus/prometheus/discovery/gce" prom_ionos "github.com/prometheus/prometheus/discovery/ionos" prom_kubernetes "github.com/prometheus/prometheus/discovery/kubernetes" + prom_linode "github.com/prometheus/prometheus/discovery/linode" prom_marathon "github.com/prometheus/prometheus/discovery/marathon" prom_docker "github.com/prometheus/prometheus/discovery/moby" prom_scaleway "github.com/prometheus/prometheus/discovery/scaleway" @@ -181,6 +182,9 @@ func AppendServiceDiscoveryConfigs(pb *prometheusBlocks, serviceDiscoveryConfig case *prom_zk.ServersetSDConfig: labelCounts["serverset"]++ exports = appendDiscoveryServerset(pb, common.LabelWithIndex(labelCounts["serverset"]-1, label), sdc) + case *prom_linode.SDConfig: + labelCounts["linode"]++ + exports = appendDiscoveryLinode(pb, common.LabelWithIndex(labelCounts["linode"]-1, label), sdc) case *prom_nerve.NerveSDConfig: labelCounts["nerve"]++ exports = appendDiscoveryNerve(pb, common.LabelWithIndex(labelCounts["nerve"]-1, label), sdc) diff --git a/converter/internal/prometheusconvert/testdata/linode.river b/converter/internal/prometheusconvert/testdata/linode.river new file mode 100644 index 000000000000..63ac878e3b5d --- /dev/null +++ b/converter/internal/prometheusconvert/testdata/linode.river @@ -0,0 +1,34 @@ +discovery.linode "prometheus1" { + refresh_interval = "1m40s" + port = 8080 +} + +discovery.linode "prometheus2" { } + +prometheus.scrape "prometheus1" { + targets = concat( + discovery.linode.prometheus1.targets, + [{ + __address__ = "localhost:9090", + }], + ) + forward_to = [prometheus.remote_write.default.receiver] + job_name = "prometheus1" +} + +prometheus.scrape "prometheus2" { + targets = discovery.linode.prometheus2.targets + forward_to = [prometheus.remote_write.default.receiver] + job_name = "prometheus2" +} + +prometheus.remote_write "default" { + endpoint { + name = "remote1" + url = "http://remote-write-url1" + + queue_config { } + + metadata_config { } + } +} diff --git a/converter/internal/prometheusconvert/testdata/linode.yaml b/converter/internal/prometheusconvert/testdata/linode.yaml new file mode 100644 index 000000000000..1b0eac38ac1c --- /dev/null +++ b/converter/internal/prometheusconvert/testdata/linode.yaml @@ -0,0 +1,15 @@ +scrape_configs: + - job_name: "prometheus1" + static_configs: + - targets: ["localhost:9090"] + linode_sd_configs: + - refresh_interval: "100s" + port: 8080 + - job_name: "prometheus2" + linode_sd_configs: + - {} + +remote_write: + - name: "remote1" + url: "http://remote-write-url1" + diff --git a/converter/internal/prometheusconvert/validate.go b/converter/internal/prometheusconvert/validate.go index ed05f0850830..fb6e9f810c1f 100644 --- a/converter/internal/prometheusconvert/validate.go +++ b/converter/internal/prometheusconvert/validate.go @@ -18,6 +18,7 @@ import ( _ "github.com/prometheus/prometheus/discovery/install" // Register Prometheus SDs prom_ionos "github.com/prometheus/prometheus/discovery/ionos" prom_kubernetes "github.com/prometheus/prometheus/discovery/kubernetes" + prom_linode "github.com/prometheus/prometheus/discovery/linode" prom_marathon "github.com/prometheus/prometheus/discovery/marathon" prom_docker "github.com/prometheus/prometheus/discovery/moby" prom_scaleway "github.com/prometheus/prometheus/discovery/scaleway" @@ -110,6 +111,8 @@ func ValidateServiceDiscoveryConfigs(serviceDiscoveryConfigs prom_discover.Confi diags.AddAll(validateDiscoveryLightsail(sdc)) case *prom_kuma.SDConfig: diags.AddAll(validateDiscoveryKuma(sdc)) + case *prom_linode.SDConfig: + diags.AddAll(validateDiscoveryLinode(sdc)) case *prom_triton.SDConfig: diags.AddAll(validateDiscoveryTriton(sdc)) case *prom_scaleway.SDConfig: From 12adb6fed5aac4c46a8b769c0c4b69388258785d Mon Sep 17 00:00:00 2001 From: Craig Peterson <192540+captncraig@users.noreply.github.com> Date: Tue, 12 Sep 2023 11:20:51 -0600 Subject: [PATCH 05/11] changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index dcf7b04d21ff..99caa04d7a98 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,6 +24,7 @@ Main (unreleased) flow mode equivalent to static mode's `service_graphs` processor. (@ptodev) - `discovery.consulagent` discovers scrape targets from Consul Agent. (@wildum) - `discovery.kuma` discovers scrape targets from the Kuma control plane. (@tpaschalis) + - `discovery.linode` discovers scrape targets from the Linode API. (@captncraig) - `discovery.marathon` discovers scrape targets from Marathon servers. (@wildum) - `discovery.ionos` discovers scrape targets from the IONOS Cloud API. (@wildum) - `discovery.triton` discovers scrape targets from Triton Container Monitor. (@erikbaranowski) From e5a657283bffd12d028ecec37370638b996ba4c5 Mon Sep 17 00:00:00 2001 From: Craig Peterson <192540+captncraig@users.noreply.github.com> Date: Tue, 12 Sep 2023 14:14:43 -0600 Subject: [PATCH 06/11] complete example --- .../flow/reference/components/discovery.linode.md | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/docs/sources/flow/reference/components/discovery.linode.md b/docs/sources/flow/reference/components/discovery.linode.md index 546194069249..4a0657d037e7 100644 --- a/docs/sources/flow/reference/components/discovery.linode.md +++ b/docs/sources/flow/reference/components/discovery.linode.md @@ -157,6 +157,15 @@ discovery.relabel "private_ips" { } prometheus.scrape "demo" { targets = discovery.relabel.private_ips.targets - forward_to = [...] + forward_to = [prometheus.remote_write.demo.receiver] +} +prometheus.remote_write "demo" { + endpoint { + url = PROMETHEUS_REMOTE_WRITE_URL + basic_auth { + username = USERNAME + password = PASSWORD + } + } } ``` \ No newline at end of file From 69915672784dd814b9cd303848efb0ad7d45562a Mon Sep 17 00:00:00 2001 From: Craig Peterson <192540+captncraig@users.noreply.github.com> Date: Thu, 14 Sep 2023 12:27:49 -0400 Subject: [PATCH 07/11] Update docs/sources/flow/reference/components/discovery.linode.md Co-authored-by: Clayton Cornell <131809008+clayton-cornell@users.noreply.github.com> --- docs/sources/flow/reference/components/discovery.linode.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/sources/flow/reference/components/discovery.linode.md b/docs/sources/flow/reference/components/discovery.linode.md index 4a0657d037e7..5579a7c670ad 100644 --- a/docs/sources/flow/reference/components/discovery.linode.md +++ b/docs/sources/flow/reference/components/discovery.linode.md @@ -5,7 +5,7 @@ title: discovery.linode # discovery.linode -`discovery.linode` allows retrieving scrape targets from [Linode's](https://www.linode.com/) Linode APIv4. +`discovery.linode` allows you to retrieve scrape targets from [Linode's](https://www.linode.com/) Linode APIv4. This service discovery uses the public IPv4 address by default, by that can be changed with relabeling. ## Usage From 21f5beb5395e1cdbc53741e49eca08491d5ea6bf Mon Sep 17 00:00:00 2001 From: Craig Peterson <192540+captncraig@users.noreply.github.com> Date: Thu, 14 Sep 2023 12:27:58 -0400 Subject: [PATCH 08/11] Update docs/sources/flow/reference/components/discovery.linode.md Co-authored-by: Clayton Cornell <131809008+clayton-cornell@users.noreply.github.com> --- docs/sources/flow/reference/components/discovery.linode.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/sources/flow/reference/components/discovery.linode.md b/docs/sources/flow/reference/components/discovery.linode.md index 5579a7c670ad..3b5047eb3b9f 100644 --- a/docs/sources/flow/reference/components/discovery.linode.md +++ b/docs/sources/flow/reference/components/discovery.linode.md @@ -6,7 +6,7 @@ title: discovery.linode # discovery.linode `discovery.linode` allows you to retrieve scrape targets from [Linode's](https://www.linode.com/) Linode APIv4. -This service discovery uses the public IPv4 address by default, by that can be changed with relabeling. +This service discovery uses the public IPv4 address by default, but that can be changed with relabeling. ## Usage From 3c299a46cce249f3a6d64f5103ba586a00e85c17 Mon Sep 17 00:00:00 2001 From: Craig Peterson <192540+captncraig@users.noreply.github.com> Date: Thu, 14 Sep 2023 12:28:10 -0400 Subject: [PATCH 09/11] Update docs/sources/flow/reference/components/discovery.linode.md Co-authored-by: Clayton Cornell <131809008+clayton-cornell@users.noreply.github.com> --- docs/sources/flow/reference/components/discovery.linode.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/sources/flow/reference/components/discovery.linode.md b/docs/sources/flow/reference/components/discovery.linode.md index 3b5047eb3b9f..728a14bca0ad 100644 --- a/docs/sources/flow/reference/components/discovery.linode.md +++ b/docs/sources/flow/reference/components/discovery.linode.md @@ -16,7 +16,9 @@ discovery.linode "LABEL" { } ``` -Note: Linode APIv4 Token must be created with scopes: `linodes:read_only`, `ips:read_only`, and `events:read_only`. +{{% admonition type="note" %}} +The linode APIv4 Token must be created with the scopes: `linodes:read_only`, `ips:read_only`, and `events:read_only`. +{{% /admonition %}} ## Arguments From 522bda3745ce4b2787296ece351df4b4af1bf838 Mon Sep 17 00:00:00 2001 From: Craig Peterson <192540+captncraig@users.noreply.github.com> Date: Thu, 14 Sep 2023 12:28:16 -0400 Subject: [PATCH 10/11] Update docs/sources/flow/reference/components/discovery.linode.md Co-authored-by: Clayton Cornell <131809008+clayton-cornell@users.noreply.github.com> --- docs/sources/flow/reference/components/discovery.linode.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/sources/flow/reference/components/discovery.linode.md b/docs/sources/flow/reference/components/discovery.linode.md index 728a14bca0ad..6032eae106ca 100644 --- a/docs/sources/flow/reference/components/discovery.linode.md +++ b/docs/sources/flow/reference/components/discovery.linode.md @@ -27,7 +27,7 @@ The following arguments are supported: Name | Type | Description | Default | Required ------------------ | -------------- | -------------------------------------------------------------- | ------------- | -------- `refresh_interval` | `duration` | The time to wait between polling update requests. | `"60s"` | no -`port` | `int` | Port that metrics should be scraped from. | `80` | no +`port` | `int` | Port that metrics are scraped from. | `80` | no `tag_separator` | `string` | The string by which Linode Instance tags are joined into the tag label. | `,` | no `bearer_token` | `secret` | Bearer token to authenticate with. | | no From 0085ef0807dad56931bf50db31f044dc10c3efa9 Mon Sep 17 00:00:00 2001 From: Craig Peterson <192540+captncraig@users.noreply.github.com> Date: Thu, 14 Sep 2023 12:28:23 -0400 Subject: [PATCH 11/11] Update docs/sources/flow/reference/components/discovery.linode.md Co-authored-by: Clayton Cornell <131809008+clayton-cornell@users.noreply.github.com> --- .../reference/components/discovery.linode.md | 36 +++++++++---------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/docs/sources/flow/reference/components/discovery.linode.md b/docs/sources/flow/reference/components/discovery.linode.md index 6032eae106ca..0b2254dd5c43 100644 --- a/docs/sources/flow/reference/components/discovery.linode.md +++ b/docs/sources/flow/reference/components/discovery.linode.md @@ -83,24 +83,24 @@ Name | Type | Description The following meta labels are available on targets and can be used by the discovery.relabel component: -* `__meta_linode_instance_id`: the id of the linode instance -* `__meta_linode_instance_label`: the label of the linode instance -* `__meta_linode_image`: the slug of the linode instance's image -* `__meta_linode_private_ipv4`: the private IPv4 of the linode instance -* `__meta_linode_public_ipv4`: the public IPv4 of the linode instance -* `__meta_linode_public_ipv6`: the public IPv6 of the linode instance -* `__meta_linode_region`: the region of the linode instance -* `__meta_linode_type`: the type of the linode instance -* `__meta_linode_status`: the status of the linode instance -* `__meta_linode_tags`: a list of tags of the linode instance joined by the tag separator -* `__meta_linode_group`: the display group a linode instance is a member of -* `__meta_linode_hypervisor`: the virtualization software powering the linode instance -* `__meta_linode_backups`: the backup service status of the linode instance -* `__meta_linode_specs_disk_bytes`: the amount of storage space the linode instance has access to -* `__meta_linode_specs_memory_bytes`: the amount of RAM the linode instance has access to -* `__meta_linode_specs_vcpus`: the number of VCPUS this linode has access to -* `__meta_linode_specs_transfer_bytes`: the amount of network transfer the linode instance is allotted each month -* `__meta_linode_extra_ips`: a list of all extra IPv4 addresses assigned to the linode instance joined by the tag separator +* `__meta_linode_instance_id`: the id of the Linode instance +* `__meta_linode_instance_label`: the label of the Linode instance +* `__meta_linode_image`: the slug of the Linode instance's image +* `__meta_linode_private_ipv4`: the private IPv4 of the Linode instance +* `__meta_linode_public_ipv4`: the public IPv4 of the Linode instance +* `__meta_linode_public_ipv6`: the public IPv6 of the Linode instance +* `__meta_linode_region`: the region of the Linode instance +* `__meta_linode_type`: the type of the Linode instance +* `__meta_linode_status`: the status of the Linode instance +* `__meta_linode_tags`: a list of tags of the Linode instance joined by the tag separator +* `__meta_linode_group`: the display group a Linode instance is a member of +* `__meta_linode_hypervisor`: the virtualization software powering the Linode instance +* `__meta_linode_backups`: the backup service status of the Linode instance +* `__meta_linode_specs_disk_bytes`: the amount of storage space the Linode instance has access to +* `__meta_linode_specs_memory_bytes`: the amount of RAM the Linode instance has access to +* `__meta_linode_specs_vcpus`: the number of VCPUS this Linode has access to +* `__meta_linode_specs_transfer_bytes`: the amount of network transfer the Linode instance is allotted each month +* `__meta_linode_extra_ips`: a list of all extra IPv4 addresses assigned to the Linode instance joined by the tag separator ## Component health