valuestore

package
v0.9.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 20, 2021 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ColumnResultValuesType

type ColumnResultValuesType map[string]map[string]ResultValue

ColumnResultValuesType is used to store results fetched for column oids Structure: map[<COLUMN OIDS AS STRING>]map[<ROW INDEX>]ResultValue - the first map key is the table column oid - the second map key is the index part of oid (not prefixed with column oid)

type ResultValue

type ResultValue struct {
	SubmissionType string      // used when sending the metric
	Value          interface{} // might be a `string` or `float64` type
}

ResultValue represent a snmp value

func (ResultValue) ExtractStringValue

func (sv ResultValue) ExtractStringValue(extractValuePattern *regexp.Regexp) (ResultValue, error)

ExtractStringValue extract value using a regex

func (*ResultValue) ToFloat64

func (sv *ResultValue) ToFloat64() (float64, error)

ToFloat64 converts value to float64

func (ResultValue) ToString

func (sv ResultValue) ToString() (string, error)

ToString converts value to string

type ResultValueStore

type ResultValueStore struct {
	// TODO: make fields private + use a constructor instead
	ScalarValues ScalarResultValuesType
	ColumnValues ColumnResultValuesType
}

ResultValueStore store OID values

func (*ResultValueStore) GetColumnIndexes

func (v *ResultValueStore) GetColumnIndexes(columnOid string) ([]string, error)

GetColumnIndexes returns column indexes for a specific column oid

func (*ResultValueStore) GetColumnValueAsFloat

func (v *ResultValueStore) GetColumnValueAsFloat(oid string, index string) float64

GetColumnValueAsFloat look for oid/index in ResultValueStore and returns a float64

func (*ResultValueStore) GetColumnValueAsString

func (v *ResultValueStore) GetColumnValueAsString(oid string, index string) string

GetColumnValueAsString look for oid/index in ResultValueStore and returns a string

func (*ResultValueStore) GetColumnValues

func (v *ResultValueStore) GetColumnValues(oid string) (map[string]ResultValue, error)

GetColumnValues look for oid in ResultValueStore and returns a map[<fullIndex>]ResultValue where `fullIndex` refer to the entire index part of the instance OID. For example if the row oid (instance oid) is `1.3.6.1.4.1.1.2.3.10.11.12`, the column oid is `1.3.6.1.4.1.1.2.3`, the fullIndex is `10.11.12`.

func (*ResultValueStore) GetScalarValue

func (v *ResultValueStore) GetScalarValue(oid string) (ResultValue, error)

GetScalarValue look for oid in ResultValueStore and returns the value and boolean weather valid value has been found

func (*ResultValueStore) GetScalarValueAsString

func (v *ResultValueStore) GetScalarValueAsString(oid string) string

GetScalarValueAsString returns a scalar value as string

type ScalarResultValuesType

type ScalarResultValuesType map[string]ResultValue

ScalarResultValuesType is used to store results fetched for scalar oids Structure: map[<INSTANCE OID VALUE>]ResultValue - the instance oid value (suffixed with `.0`)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL