Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: gnmi plugin #1068

Merged
merged 1 commit into from
Oct 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions agent/metrics_agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import (
_ "flashcat.cloud/categraf/inputs/ethtool"
_ "flashcat.cloud/categraf/inputs/exec"
_ "flashcat.cloud/categraf/inputs/filecount"
_ "flashcat.cloud/categraf/inputs/gnmi"
_ "flashcat.cloud/categraf/inputs/googlecloud"
_ "flashcat.cloud/categraf/inputs/greenplum"
_ "flashcat.cloud/categraf/inputs/haproxy"
Expand Down
112 changes: 112 additions & 0 deletions conf/input.gnmi/gnmi.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
interval="1s"
# gNMI telemetry input plugin
[[instances]]
## Address and port of the gNMI GRPC server
#addresses = [1.2.3.4:5678]
addresses = []

## define credentials
username = "admin"
password = "admin"

## gNMI encoding requested (one of: "proto", "json", "json_ietf", "bytes")
encoding = "proto"

## redial in case of failures after, default: 10 seconds
redial = "10s"

## gRPC Maximum Message Size, 4MB
max_msg_size = "4194304"

## Enable to get the canonical path as field-name
# canonical_field_names = false

## Remove leading slashes and dots in field-name
# trim_field_names = false

## Guess the path-tag if an update does not contain a prefix-path
## If enabled, the common-path of all elements in the update is used.
# guess_path_tag = false

## enable client-side TLS and define CA to authenticate the device
# enable_tls = false
# tls_ca = "/etc/pki/ca.pem"
## Minimal TLS version to accept by the client
# tls_min_version = "TLS12"
## Use TLS but skip chain & host verification
# insecure_skip_verify = true

## define client-side TLS certificate & key to authenticate to the device
# tls_cert = "/etc/pki/cert.pem"
# tls_key = "/etc/pki/key.pem"

## gNMI subscription prefix (optional, can usually be left empty)
## See: https://github.com/openconfig/reference/blob/master/rpc/gnmi/gnmi-specification.md#222-paths
# origin = ""
# prefix = ""
# target = ""

## Vendor specific options
## This defines what vendor specific options to load.
## * Juniper Header Extension (juniper_header): some sensors are directly managed by
## Linecard, which adds the Juniper GNMI Header Extension. Enabling this
## allows the decoding of the Extension header if present. Currently this knob
## adds component, component_id & sub_component_id as additionnal tags
# vendor_specific = []

## Define additional aliases to map encoding paths to measurement names
# [instances.aliases]
# ifcounters = "openconfig:/interfaces/interface/state/counters"

[[instances.subscription]]
## Name of the measurement that will be emitted
name = "ifcounters"

## Origin and path of the subscription
## See: https://github.com/openconfig/reference/blob/master/rpc/gnmi/gnmi-specification.md#222-paths
##
## origin usually refers to a (YANG) data model implemented by the device
## and path to a specific substructure inside it that should be subscribed
## to (similar to an XPath). YANG models can be found e.g. here:
## https://github.com/YangModels/yang/tree/master/vendor/cisco/xr
origin = "openconfig-interfaces"
path = "/interfaces/interface/state/counters"

## Subscription mode ("target_defined", "sample", "on_change") and interval
subscription_mode = "sample"
sample_interval = "10s"

## Suppress redundant transmissions when measured values are unchanged
# suppress_redundant = false

## If suppression is enabled, send updates at least every X seconds anyway
# heartbeat_interval = "60s"

## Tag subscriptions are applied as tags to other subscriptions.
# [[instances.tag_subscription]]
# ## When applying this value as a tag to other metrics, use this tag name
# name = "descr"
#
# ## All other subscription fields are as normal
# origin = "openconfig-interfaces"
# path = "/interfaces/interface/state"
# subscription_mode = "on_change"
#
# ## Match strategy to use for the tag.
# ## Tags are only applied for metrics of the same address. The following
# ## settings are valid:
# ## unconditional -- always match
# ## name -- match by the "name" key
# ## This resembles the previsou 'tag-only' behavior.
# ## elements -- match by the keys in the path filtered by the path
# ## parts specified `elements` below
# ## By default, 'elements' is used if the 'elements' option is provided,
# ## otherwise match by 'name'.
# # match = ""
#
# ## For the 'elements' match strategy, at least one path-element name must
# ## be supplied containing at least one key to match on. Multiple path
# ## elements can be specified in any order. All given keys must be equal
# ## for a match.
# # elements = ["description", "interface"]

8 changes: 4 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ require (

require (
cloud.google.com/go/compute/metadata v0.2.3 // indirect
github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 // indirect
github.com/Azure/go-ntlmssp v0.0.0-20221128193559-754e69321358 // indirect
github.com/Masterminds/semver v1.5.0 // indirect
github.com/alecthomas/participle v0.4.1 // indirect
Expand Down Expand Up @@ -143,6 +142,7 @@ require (
github.com/ema/qdisc v1.0.0
github.com/go-ldap/ldap/v3 v3.4.6
github.com/godbus/dbus/v5 v5.0.4
github.com/google/gnxi v0.0.0-20240912171544-ef18504847b0
github.com/hashicorp/go-envparse v0.1.0
github.com/hodgesds/perf-utils v0.7.0
github.com/illumos/go-kstat v0.0.0-20210513183136-173c9b0a9973
Expand All @@ -157,6 +157,7 @@ require (
github.com/mdlayher/netlink v1.7.2
github.com/mdlayher/wifi v0.1.0
github.com/nats-io/nats-server/v2 v2.10.9
github.com/openconfig/gnmi v0.11.0
github.com/opencontainers/selinux v1.11.0
github.com/percona/percona-toolkit v0.0.0-20211210121818-b2860eee3152
github.com/prometheus-community/go-runit v0.1.0
Expand Down Expand Up @@ -238,7 +239,7 @@ require (
github.com/golang-sql/civil v0.0.0-20190719163853-cb61b32ac6fe // indirect
github.com/golang-sql/sqlexp v0.1.0 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da
github.com/google/go-cmp v0.6.0
github.com/google/go-cmp v0.6.0 // indirect
github.com/google/go-querystring v1.1.0 // indirect
github.com/google/gofuzz v1.2.0 // indirect
github.com/google/gopacket v1.1.19
Expand Down Expand Up @@ -335,12 +336,11 @@ require (
google.golang.org/appengine v1.6.8 // indirect
google.golang.org/genproto v0.0.0-20231106174013-bbf56f31fb17
google.golang.org/grpc v1.61.1
google.golang.org/protobuf v1.33.0 // indirect
google.golang.org/protobuf v1.33.0
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/ini.v1 v1.66.6 // indirect
gopkg.in/natefinch/lumberjack.v2 v2.2.1
gopkg.in/yaml.v2 v2.4.0 // indirect
gotest.tools/v3 v3.2.0 // indirect
k8s.io/api v0.29.2
k8s.io/apimachinery v0.29.2
k8s.io/client-go v0.29.2
Expand Down
Loading
Loading