Documentation ¶
Index ¶
- Constants
- func SetConfDir(dir string)
- func SetDB(db *config.DatabaseCfg)
- type MetricRow
- type MetricTable
- func (mt *MetricTable) AddRow(id string, mr *MetricRow)
- func (mt *MetricTable) Debug(expr string)
- func (mt *MetricTable) Debugf(expr string, vars ...interface{})
- func (mt *MetricTable) Errorf(expr string, vars ...interface{})
- func (mt *MetricTable) GetSnmpMap() map[string]*SnmpMetric
- func (mt *MetricTable) GetSnmpMaps() ([]string, map[string]*SnmpMetric)
- func (mt *MetricTable) Infof(expr string, vars ...interface{})
- func (mt *MetricTable) Init(c *config.MeasurementCfg, l utils.Logger, CurIndexedLabels map[string]string)
- func (mt *MetricTable) InvalidateTable()
- func (mt *MetricTable) Len() int
- func (mt *MetricTable) Pop(p map[string]string) error
- func (mt *MetricTable) Push(p map[string]string) error
- func (mt *MetricTable) Warnf(expr string, vars ...interface{})
- type SnmpMetric
- func (s *SnmpMetric) GetDataSrcType() string
- func (s *SnmpMetric) GetEvaluableVariables(params map[string]interface{})
- func (s *SnmpMetric) GetFieldName() string
- func (s *SnmpMetric) GetID() string
- func (s *SnmpMetric) ImportFieldsAndTags(mid string, fields map[string]interface{}, tags map[string]string) int64
- func (s *SnmpMetric) Init(c *config.SnmpMetricCfg) error
- func (s *SnmpMetric) IsTag() bool
- func (s *SnmpMetric) MarshalJSON() ([]byte, error)
- func (s *SnmpMetric) SetLogger(l utils.Logger)
Constants ¶
const ( // NeverReport default value for metric resport flag NeverReport = 0 // AlwaysReport metric will send data allways AlwaysReport = 1 // OnNonZeroReport metric will send data only if computed value different than 0 OnNonZeroReport = 2 // OnChangedReport metric will send data only if data has a change from last changed value ( not implemente yet) OnChangedReport = 3 )
Variables ¶
This section is empty.
Functions ¶
func SetConfDir ¶
func SetConfDir(dir string)
SetConfDir enable load File Filters from anywhere in the our FS.
func SetDB ¶
func SetDB(db *config.DatabaseCfg)
SetDB load database config to load data if needed (used in filters)
Types ¶
type MetricRow ¶
type MetricRow struct { Valid bool Data map[string]*SnmpMetric }
MetricRow Measurment row type
func (*MetricRow) Add ¶
func (mr *MetricRow) Add(id string, m *SnmpMetric)
Add Add a new metric in the row
func (*MetricRow) Invalidate ¶
func (mr *MetricRow) Invalidate()
Invalidate set invalid all metrics on the row
func (*MetricRow) SetVisible ¶
SetVisible set visible only the selected metrics
type MetricTable ¶
type MetricTable struct { Header map[string]interface{} Row map[string]*MetricRow // contains filtered or unexported fields }
MetricTable Sequence of metric rows with headers
func NewMetricTable ¶
func NewMetricTable(c *config.MeasurementCfg, l utils.Logger, CurIndexedLabels map[string]string) *MetricTable
NewMetricTable create a new MetricTable
func (*MetricTable) AddRow ¶
func (mt *MetricTable) AddRow(id string, mr *MetricRow)
AddRow add a new row to the metricTable
func (*MetricTable) Debugf ¶
func (mt *MetricTable) Debugf(expr string, vars ...interface{})
Debugf info
func (*MetricTable) Errorf ¶
func (mt *MetricTable) Errorf(expr string, vars ...interface{})
Errorf info
func (*MetricTable) GetSnmpMap ¶
func (mt *MetricTable) GetSnmpMap() map[string]*SnmpMetric
GetSnmpMap get and snmpmetric OID map
func (*MetricTable) GetSnmpMaps ¶
func (mt *MetricTable) GetSnmpMaps() ([]string, map[string]*SnmpMetric)
GetSnmpMaps get an OID array and a metric Object OID mapped
func (*MetricTable) Infof ¶
func (mt *MetricTable) Infof(expr string, vars ...interface{})
Infof info
func (*MetricTable) Init ¶
func (mt *MetricTable) Init(c *config.MeasurementCfg, l utils.Logger, CurIndexedLabels map[string]string)
Init Initialize the MetricTable Object
func (*MetricTable) InvalidateTable ¶
func (mt *MetricTable) InvalidateTable()
InvalidateTable set invalid each row in the table
func (*MetricTable) Len ¶
func (mt *MetricTable) Len() int
Len get number of rows for the MetricTable
func (*MetricTable) Pop ¶
func (mt *MetricTable) Pop(p map[string]string) error
Pop remove MetricRows from the MetricTable
func (*MetricTable) Push ¶
func (mt *MetricTable) Push(p map[string]string) error
Push add New MetricRows to the MetricTable
func (*MetricTable) Warnf ¶
func (mt *MetricTable) Warnf(expr string, vars ...interface{})
Warnf log warn info
type SnmpMetric ¶
type SnmpMetric struct { Valid bool // indicate if has been updated in the last gathered process CookedValue interface{} CurValue interface{} LastValue interface{} CurTime time.Time LastTime time.Time ElapsedTime float64 Compute func(arg ...interface{}) `json:"-"` Scale func() `json:"-"` Convert func() `json:"-"` SetRawData func(pdu gosnmp.SnmpPDU, now time.Time) `json:"-"` RealOID string Report int // if false this metric won't be sent to the output buffer (is just taken as a coomputed input for other metrics) // contains filtered or unexported fields }
SnmpMetric type to metric runtime
func New ¶
func New(c *config.SnmpMetricCfg, l utils.Logger) (*SnmpMetric, error)
New create a new snmpmetric with a specific logger
func (*SnmpMetric) GetDataSrcType ¶
func (s *SnmpMetric) GetDataSrcType() string
GetDataSrcType get needed data
func (*SnmpMetric) GetEvaluableVariables ¶
func (s *SnmpMetric) GetEvaluableVariables(params map[string]interface{})
GetEvaluableVariables get all posible values to add to the
func (*SnmpMetric) GetFieldName ¶
func (s *SnmpMetric) GetFieldName() string
GetFieldName needed to generate Influx measurements
func (*SnmpMetric) GetID ¶
func (s *SnmpMetric) GetID() string
GetID needed to generate Influx measurements
func (*SnmpMetric) ImportFieldsAndTags ¶
func (s *SnmpMetric) ImportFieldsAndTags(mid string, fields map[string]interface{}, tags map[string]string) int64
ImportFieldsAndTags Add Fields and tags from the metric and returns number of metric sent and metric errors found
func (*SnmpMetric) Init ¶
func (s *SnmpMetric) Init(c *config.SnmpMetricCfg) error
Init Initialice a new snmpmetric object with the specific configuration
func (*SnmpMetric) IsTag ¶
func (s *SnmpMetric) IsTag() bool
IsTag needed to generate Influx measurements
func (*SnmpMetric) MarshalJSON ¶
func (s *SnmpMetric) MarshalJSON() ([]byte, error)
MarshalJSON return JSON formatted data
func (*SnmpMetric) SetLogger ¶
func (s *SnmpMetric) SetLogger(l utils.Logger)
SetLogger attach logger to the current snmpmetric object