Documentation
¶
Overview ¶
Copyright The OpenTelemetry Authors SPDX-License-Identifier: Apache-2.0
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewFactory ¶
NewFactory creates a new receiver factory for SNMP
Types ¶
type Attribute ¶
type Attribute struct {
// Name is required and should match the key for an AttributeConfig
Name string `mapstructure:"name"`
// Value is optional and is only needed for a matched AttributeConfig's with enum value.
// Value should match one of the AttributeConfig's enum values in this case
Value string `mapstructure:"value"`
}
Attribute is a connection between a metric configuration and an AttributeConfig
type AttributeConfig ¶
type AttributeConfig struct {
// Value is optional, and will allow for a different attribute key other than the attribute name
Value string `mapstructure:"value"`
// Description is optional and describes what the attribute represents
Description string `mapstructure:"description"`
// Enum is required only if OID and IndexedValuePrefix are not defined.
// This contains a list of possible values that can be associated with this attribute
Enum []string `mapstructure:"enum"`
// OID is required only if Enum and IndexedValuePrefix are not defined.
// This is the column OID which will provide indexed values to be used for this attribute (alongside a metric with ColumnOIDs)
OID string `mapstructure:"oid"`
// IndexedValuePrefix is required only if Enum and OID are not defined.
// This is used alongside metrics with ColumnOIDs to assign attribute values using this prefix + the OID index of the metric value
IndexedValuePrefix string `mapstructure:"indexed_value_prefix"`
}
AttributeConfig contains config info about all of the metric attributes that will be used by this receiver.
type ColumnOID ¶
type ColumnOID struct {
// OID is required and is the column OID that is associated with a metric
OID string `mapstructure:"oid"`
// ResourceAttributes is required only if there are no Attributes associated with non enum
// AttributeConfigs defined here. Valid values are ResourceAttributeConfig names that will
// be used to differentiate the indexed values for the column OID
ResourceAttributes []string `mapstructure:"resource_attributes"`
// Attributes is required only if there are no ResourceAttributes associated defined here.
// Valid values are non enum AttributeConfig names that will be used to differentiate the
// indexed values for the column OID
Attributes []Attribute `mapstructure:"attributes"`
}
ColumnOID holds OID info for an indexed metric as well as any attributes or resource attributes that are attached to it
type Config ¶
type Config struct {
scraperhelper.ControllerConfig `mapstructure:",squash"`
// Endpoint is the SNMP target to request data from. Must be formatted as [udp|tcp|][4|6|]://{host}:{port}.
// Default: udp://localhost:161
// If no scheme is given, udp4 is assumed.
// If no port is given, 161 is assumed.
Endpoint string `mapstructure:"endpoint"`
// Version is the version of SNMP to use for this connection.
// Valid options: v1, v2c, v3.
// Default: v2c
Version string `mapstructure:"version"`
// Community is the SNMP community string to use.
// Only valid for versions "v1" and "v2c"
// Default: public
Community string `mapstructure:"community"`
// User is the SNMP User for this connection.
// Only valid for version “v3”
User string `mapstructure:"user"`
// SecurityLevel is the security level to use for this SNMP connection.
// Only valid for version “v3”
// Valid options: “no_auth_no_priv”, “auth_no_priv”, “auth_priv”
// Default: "no_auth_no_priv"
SecurityLevel string `mapstructure:"security_level"`
// AuthType is the type of authentication protocol to use for this SNMP connection.
// Only valid for version “v3” and if “no_auth_no_priv” is not selected for SecurityLevel
// Valid options: “md5”, “sha”, “sha224”, “sha256”, “sha384”, “sha512”
// Default: "md5"
AuthType string `mapstructure:"auth_type"`
// AuthPassword is the authentication password used for this SNMP connection.
// Only valid for version "v3" and if "no_auth_no_priv" is not selected for SecurityLevel
AuthPassword configopaque.String `mapstructure:"auth_password"`
// PrivacyType is the type of privacy protocol to use for this SNMP connection.
// Only valid for version “v3” and if "auth_priv" is selected for SecurityLevel
// Valid options: “des”, “aes”, “aes192”, “aes256”, “aes192c”, “aes256c”
// Default: "des"
PrivacyType string `mapstructure:"privacy_type"`
// PrivacyPassword is the authentication password used for this SNMP connection.
// Only valid for version “v3” and if "auth_priv" is selected for SecurityLevel
PrivacyPassword configopaque.String `mapstructure:"privacy_password"`
// ResourceAttributes defines what resource attributes will be used for this receiver and is composed
// of resource attribute names along with their resource attribute configurations
ResourceAttributes map[string]*ResourceAttributeConfig `mapstructure:"resource_attributes"`
// Attributes defines what attributes will be used on metrics for this receiver and is composed of
// attribute names along with their attribute configurations
Attributes map[string]*AttributeConfig `mapstructure:"attributes"`
// Metrics defines what SNMP metrics will be collected for this receiver and is composed of metric
// names along with their metric configurations
Metrics map[string]*MetricConfig `mapstructure:"metrics"`
}
Config defines the configuration for the various elements of the receiver.
type GaugeMetric ¶
type GaugeMetric struct {
// ValueType is required and can be either int or double
ValueType string `mapstructure:"value_type"`
// contains filtered or unexported fields
}
GaugeMetric contains info about the value of the gauge metric
type MetricConfig ¶
type MetricConfig struct {
// Description is optional and describes what this metric represents
Description string `mapstructure:"description"`
// Unit is required
Unit string `mapstructure:"unit"`
// Either Gauge or Sum config is required
Gauge *GaugeMetric `mapstructure:"gauge"`
Sum *SumMetric `mapstructure:"sum"`
// Either ScalarOIDs or ColumnOIDs is required.
// ScalarOIDs is used if one or more scalar OID values is used for this metric.
// ColumnOIDs is used if one or more column OID indexed set of values is used
// for this metric.
ScalarOIDs []ScalarOID `mapstructure:"scalar_oids"`
ColumnOIDs []ColumnOID `mapstructure:"column_oids"`
}
MetricConfig contains config info about a given metric
type ResourceAttributeConfig ¶
type ResourceAttributeConfig struct {
// Description is optional and describes what the resource attribute represents
Description string `mapstructure:"description"`
// OID is required only if ScalarOID or IndexedValuePrefix is not set.
// This is the column OID which will provide indexed values to be used for this resource attribute. These indexed values
// will ultimately each be associated with a different "resource" as an attribute on that resource. Indexed metric values
// will then be used to associate metric datapoints to the matching "resource" (based on matching indexes).
OID string `mapstructure:"oid"`
// ScalarOID is required only if OID or IndexedValuePrefix is not set.
// This is the scalar OID which will provide a value to be used for this resource attribute.
// Single or indexed metrics can then be associated with the resource. (Indexed metrics also need an indexed attribute or resource attribute to associate with a scalar metric resource attribute)
ScalarOID string `mapstructure:"scalar_oid"`
// IndexedValuePrefix is required only if OID or ScalarOID is not set.
// This will be used alongside indexed metric values for this resource attribute. The prefix value concatenated with
// specific indexes of metric indexed values (Ex: prefix.1.2) will ultimately each be associated with a different "resource"
// as an attribute on that resource. The related indexed metric values will then be used to associate metric datapoints to
// those resources.
IndexedValuePrefix string `mapstructure:"indexed_value_prefix"` // required and valid if no oid or scalar_oid field
// contains filtered or unexported fields
}
ResourceAttributeConfig contains config info about all of the resource attributes that will be used by this receiver.
type ScalarOID ¶
type ScalarOID struct {
// OID is required and is the scalar OID that is associated with a metric
OID string `mapstructure:"oid"`
// ResourceAttributes is optional and may contain only scalar OID values to associate this metric with
ResourceAttributes []string `mapstructure:"resource_attributes"`
// Attributes is optional and may contain names and values associated with enum
// AttributeConfigs to associate with the value of the scalar OID
Attributes []Attribute `mapstructure:"attributes"`
// contains filtered or unexported fields
}
ScalarOID holds OID info for a scalar metric as well as any {resource} attributes that are attached to it
type SumMetric ¶
type SumMetric struct {
// Aggregation is required and can be cumulative or delta
Aggregation string `mapstructure:"aggregation"`
// Monotonic is required and can be true or false
Monotonic bool `mapstructure:"monotonic"`
// ValueType is required and can be either int or double
ValueType string `mapstructure:"value_type"`
// contains filtered or unexported fields
}
SumMetric contains info about the value of the sum metric