Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SnmpTranslate ¶ added in v1.14.0
func SnmpTranslate(oid string) (mibName string, oidNum string, oidText string, conversion string, err error)
snmpTranslate resolves the given OID.
func SnmpTranslateClear ¶ added in v1.14.0
func SnmpTranslateClear()
Types ¶
type Field ¶ added in v1.14.0
type Field struct {
// Name will be the name of the field.
Name string
// OID is prefix for this field. The plugin will perform a walk through all
// OIDs with this as their parent. For each value found, the plugin will strip
// off the OID prefix, and use the remainder as the index. For multiple fields
// to show up in the same row, they must share the same index.
Oid string
// OidIndexSuffix is the trailing sub-identifier on a table record OID that will be stripped off to get the record's index.
OidIndexSuffix string
// OidIndexLength specifies the length of the index in OID path segments. It can be used to remove sub-identifiers that vary in content or length.
OidIndexLength int
// IsTag controls whether this OID is output as a tag or a value.
IsTag bool
// Conversion controls any type conversion that is done on the value.
// "float"/"float(0)" will convert the value into a float.
// "float(X)" will convert the value into a float, and then move the decimal before Xth right-most digit.
// "int" will conver the value into an integer.
// "hwaddr" will convert a 6-byte string to a MAC address.
// "ipaddr" will convert the value to an IPv4 or IPv6 address.
Conversion string
// contains filtered or unexported fields
}
Field holds the configuration for a Field to look up.
type RTable ¶ added in v1.14.0
type RTable struct {
// Name is the name of the field, copied from Table.Name.
Name string
// Time is the time the table was built.
Time time.Time
// Rows are the rows that were found, one row for each table OID index found.
Rows []RTableRow
}
RTable is the resulting table built from a Table.
type RTableRow ¶ added in v1.14.0
type RTableRow struct {
// Tags are all the Field values which had IsTag=true.
Tags map[string]string
// Fields are all the Field values which had IsTag=false.
Fields map[string]interface{}
}
RTableRow is the resulting row containing all the OID values which shared the same index.
type Snmp ¶
type Snmp struct {
// The SNMP agent to query. Format is [SCHEME://]ADDR[:PORT] (e.g.
// udp://1.2.3.4:161). If the scheme is not specified then "udp" is used.
Agents []string `toml:"agents"`
// The tag used to name the agent host
AgentHostTag string `toml:"agent_host_tag"`
snmp.ClientConfig
Tables []Table `toml:"table"`
// Name & Fields are the elements of a Table.
// Telegraf chokes if we try to embed a Table. So instead we have to embed the
// fields of a Table, and construct a Table during runtime.
Name string // deprecated in 1.14; use name_override
Fields []Field `toml:"field"`
// contains filtered or unexported fields
}
Snmp holds the configuration for the plugin.
func (*Snmp) Description ¶
Description returns a one-sentence description on the input.
func (*Snmp) Gather ¶
func (s *Snmp) Gather(acc telegraf.Accumulator) error
Gather retrieves all the configured fields and tables. Any error encountered does not halt the process. The errors are accumulated and returned at the end.
func (*Snmp) SampleConfig ¶
SampleConfig returns the default configuration of the input.
type Table ¶ added in v1.14.0
type Table struct {
// Name will be the name of the measurement.
Name string
// Which tags to inherit from the top-level config.
InheritTags []string
// Adds each row's table index as a tag.
IndexAsTag bool
// Fields is the tags and values to look up.
Fields []Field `toml:"field"`
// OID for automatic field population.
// If provided, init() will populate Fields with all the table columns of the
// given OID.
Oid string
// contains filtered or unexported fields
}
Table holds the configuration for a SNMP table.
Click to show internal directories.
Click to hide internal directories.