Documentation ¶
Index ¶
- Constants
- func InitCounters(namespace string, log *logger.Logger) (map[string]*prometheus.Counter, map[string]*prometheus.CounterVec)
- type Alerter
- func (a *Alerter) Alert(cfgNames []string) []of.Alert
- func (a *Alerter) AutoClear(defEndsAt int, alertEndsAt int, alert *of.Alert)
- func (a *Alerter) EndsAt(alert *of.Alert)
- func (a *Alerter) Fingerprint(al of.Alert) string
- func (a *Alerter) StartsAt(alert *of.Alert)
- func (a *Alerter) Unknown(level string) []of.Alert
- type Handler
- type Lookup
- type Modifier
- type Service
- type Value
- func (v *Value) OIDValue(ptr string) (string, error)
- func (v *Value) OIDValueStr(ptr string) (string, error)
- func (v *Value) OIDValueStrShort(ptr string) (string, error)
- func (v *Value) Value(oid string) (string, error)
- func (v *Value) ValueAs(oid string, as of_snmp.As) (string, error)
- func (v *Value) ValueStr(oid string) (string, error)
- func (v *Value) ValueStrShort(oid string) (string, error)
Constants ¶
View Source
const (
HandlerRestarted = "handler_restarted"
)
Variables ¶
This section is empty.
Functions ¶
func InitCounters ¶
func InitCounters(namespace string, log *logger.Logger) (map[string]*prometheus.Counter, map[string]*prometheus.CounterVec)
Create counters..
Types ¶
type Alerter ¶
type Alerter struct { Log *logger.Logger Configs *of_snmp.V2Config Receipts *of.Receipts Value *Value MR of.MIBRegistry U of.UUIDGen Cntr map[string]*prometheus.Counter CntrVec map[string]*prometheus.CounterVec LogUnknown bool ForwardUnknown bool }
Implements of_snmp.AlertGenerator
func (*Alerter) Fingerprint ¶
Fingerprint the alert.
type Handler ¶
type Handler struct { Config *of.SNMPConfig SNMP *Service Log *logger.Logger // contains filtered or unexported fields }
type Lookup ¶
type Lookup struct { Configs of_snmp.V2Config // Concatenate list of configs MR of.MIBRegistry Log *logger.Logger // contains filtered or unexported fields }
func (*Lookup) Build ¶
Build lookup to match with SNMP Trap var
Ex: Sample config. epc: - key in configs select: - type: equals oid: .1.3.6.1.6.3.1.1.4.1 - key in lookupMap as: value - key in asMap values: - .1.3.6.1.4.1.8164.2.13 - key in valueMap - .1.3.6.1.4.1.8164.2.4 - key in valueMap - type: equals oid: .1.3.6.1.6.3.1.1.4.1 - key in lookupMap as: valueStr - key in asMap values: - name_of_oid - keys in valueMap nso: - key in configs - type: equals oid: .1.3.6.1.6.3.1.1.4.1 - key in lookupMap as: value - key in asMap values: - .1.3.6.1.4.1.8164.2.13 - key in valueMap The lookup for above example config would be : '.1.3.6.1.6.3.1.1.4.1' -> 'value' -> '.1.3.6.1.4.1.8164.2.13' -> "epc" -> bool // bool value is irrelevant. "nso" -> bool // bool value is irrelevant. '.1.3.6.1.4.1.8164.2.4' -> "epc" -> bool // bool value is irrelevant. 'valueStr' -> 'name_of_oid' -> "epc" -> bool // bool value is irrelevant.
type Modifier ¶
type Modifier struct { Map *map[string]string // Pointer to map to be modified V *Value // Gets value for given oid, based on the `of_snmp.As` type }
type Service ¶
type Service struct { Writer of.Writer Log *logger.Logger Configs *of_snmp.V2Config MR of.MIBRegistry U of.UUIDGen Lookup of_snmp.Lookup As of.Notifier Cntr map[string]*prometheus.Counter CntrVec map[string]*prometheus.CounterVec SNMPConfig *of.SNMPConfig }
func NewService ¶
func NewService(l *logger.Logger, cfg *of.SNMPConfig, cntr map[string]*prometheus.Counter, cntrVec map[string]*prometheus.CounterVec) (*Service, error)
func (Service) AlertHandler ¶
func (s Service) AlertHandler(w of.ResponseWriter, r of.Request)
HTTP handler func to recieve SNMP traps.
type Value ¶
type Value struct {
// contains filtered or unexported fields
}
Implements of_snmp.ValueGenerator
func NewValue ¶
func NewValue(trapVars *[]of.TrapVar, mr of.MIBRegistry) *Value
Initialize Value. trapVars are converted into a map[oid]value
func (*Value) OIDValueStr ¶
String representation of the value, for OID pointed by given OID.
func (*Value) OIDValueStrShort ¶
Short Name of the value, for OID pointed by given OID.
Click to show internal directories.
Click to hide internal directories.