kt

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2022 License: Apache-2.0 Imports: 24 Imported by: 1

Documentation

Index

Constants

View Source
const (
	AwsSmPrefix  = "aws.sm."
	AWSErrPrefix = "AwsError: "
)
View Source
const (
	AzureKVPrefix  = "azure.kv."
	AzureErrPrefix = "AzureError: "
)
View Source
const (
	GCPSmPrefix  = "gcp.sm."
	GCPErrPrefix = "GCPError: "
)
View Source
const (
	LOGICAL_INTERFACE  = "logical"
	PHYSICAL_INTERFACE = "physical"
	PollAdjustTime     = 5
)
View Source
const (
	SNMP_GOOD                   = 1
	SNMP_BAD_NO_DATA            = 3
	SNMP_BAD_DEVICE_ERR         = 4
	SNMP_BAD_INTERFACE_ERR      = 5
	SNMP_BAD_POLL_TIMEOUT       = 6
	SNMP_BAD_INIT_METADATA      = 7
	SNMP_BAD_INIT_METRICS       = 8
	SNMP_BAD_FIRST_METRICS_POLL = 9
)
View Source
const (
	ObjID     Oidtype = 1
	String            = 2
	INTEGER           = 3
	NetAddr           = 4
	IpAddr            = 5
	Counter           = 6
	Gauge             = 7
	TimeTicks         = 8
	Counter64         = 11
	BitString         = 12
	Index             = 15
	Integer32         = 16
)
View Source
const (
	CompressionNone    Compression = "none"
	CompressionGzip                = "gzip"
	CompressionSnappy              = "snappy"
	CompressionDeflate             = "deflate"
	CompressionNull                = "null"

	KENTIK_EVENT_TYPE  = "KFlow"
	KENTIK_EVENT_SNMP  = "KSnmp"
	KENTIK_EVENT_TRACE = "KTrace"
	KENTIK_EVENT_SYNTH = "KSynth"

	KENTIK_EVENT_SNMP_DEV_METRIC = "KSnmpDeviceMetric"
	KENTIK_EVENT_SNMP_INT_METRIC = "KSnmpInterfaceMetric"
	KENTIK_EVENT_SNMP_METADATA   = "KSnmpInterfaceMetadata"
	KENTIK_EVENT_SNMP_TRAP       = "KSnmpTrap"
	KENTIK_EVENT_JSON            = "KJson"
	KENTIK_EVENT_KTRANS_METRIC   = "KTranslateMetric"

	KentikAPIToken   = "KENTIK_API_TOKEN"
	KentikAPITimeout = "KENTIK_API_TIMEOUT"
	IndexVar         = "Index"
	StringPrefix     = "ks_"
	PrivateIP        = "Private IP"
	DropMetric       = "DropMetric"
	AdminStatus      = "if_AdminStatus"
)
View Source
const (
	EventOutput  OutputType = "event"
	MetricOutput            = "metric"
	RollupOutput            = "rollup"
)
View Source
const (
	InstProvider  = "kentik"
	CollectorName = "ktranslate"
	SnmpCollector = "snmp"

	SendBatchDuration     = 1 * time.Second
	DefaultProfileMessage = "Missing matched profile. See overview page for details."
	SIGUSR1               = syscall.Signal(0xa) // Because windows doesn't have this.
	SIGUSR2               = syscall.Signal(0xc) // Because windows doesn't have this.

	PluginSyslog   = "ktranslate-syslog"
	PluginHealth   = "ktranslate-health"
	FloatMS        = "float_ms"
	InvalidEnum    = "invalid enum"
	DeviceTagTable = "KT_Device_Tag"
	FromLambda     = "awslambda"
	GaugeMetric    = "gauge"
	CountMetric    = "count"
	FromGCP        = "gcppubsub"
)
View Source
const (
	UserTagPrefix = "tags."
)

Variables

View Source
var (
	InputTesting = []*JCHF{
		&JCHF{CompanyId: 10, SrcAddr: "10.2.2.1", Protocol: "TCP", DstAddr: "2001:db8::68", Timestamp: 1, L4DstPort: 80, OutputPort: IfaceID(20), EventType: KENTIK_EVENT_TYPE, CustomStr: map[string]string{"foo": "bar"}, CustomInt: map[string]int32{"fooI": 1}, CustomBigInt: map[string]int64{"fooII": 12}, InBytes: 12121, InPkts: 12, OutBytes: 13, OutPkts: 1, SrcEthMac: "90:61:ae:fb:c2:19", avroSet: map[string]interface{}{}},
		&JCHF{CompanyId: 10, SrcAddr: "3.2.2.2", InBytes: 1, OutBytes: 12, InPkts: 12, OutPkts: 1, Protocol: "UDP", DstAddr: "2001:db8::69", SrcEthMac: "90:61:ae:fb:c2:20", Timestamp: 2, CustomStr: map[string]string{"tar": "far"}, EventType: KENTIK_EVENT_TYPE, avroSet: map[string]interface{}{}},
	}

	InputTestingSynth = []*JCHF{
		&JCHF{CompanyId: 10, SrcAddr: "10.2.2.1", Protocol: "TCP", DstAddr: "2001:db8::68", Timestamp: 1, L4DstPort: 80, OutputPort: IfaceID(20), EventType: KENTIK_EVENT_SYNTH, CustomStr: map[string]string{"foo": "bar"}, CustomInt: map[string]int32{"foo": 1}, CustomBigInt: map[string]int64{"foo": 12}, InBytes: 12121, InPkts: 12, OutBytes: 13, OutPkts: 1, SrcEthMac: "90:61:ae:fb:c2:19", avroSet: map[string]interface{}{}},
	}

	InputTestingSnmp = []*JCHF{
		&JCHF{CompanyId: 10, SrcAddr: "10.2.2.1", Protocol: "UDP", DstAddr: "2001:db8::68", Timestamp: 1, L4DstPort: 80, OutputPort: IfaceID(20), EventType: KENTIK_EVENT_SNMP_INT_METRIC, CustomStr: map[string]string{"foo": "bar"}, CustomInt: map[string]int32{"foo": 1}, CustomBigInt: map[string]int64{"foo": 12}, InBytes: 12121, InPkts: 12, OutBytes: 13, OutPkts: 1, SrcEthMac: "90:61:ae:fb:c2:19", avroSet: map[string]interface{}{}},
	}
)
View Source
var (
	SNMP_STATUS_MAP = map[int64]string{
		SNMP_GOOD:                   "GOOD",
		SNMP_BAD_NO_DATA:            "BAD: No data",
		SNMP_BAD_DEVICE_ERR:         "BAD: Device Error",
		SNMP_BAD_INTERFACE_ERR:      "BAD: Interface Error",
		SNMP_BAD_POLL_TIMEOUT:       "BAD: Poll Timeout",
		SNMP_BAD_INIT_METADATA:      "BAD: Init Metadata",
		SNMP_BAD_INIT_METRICS:       "BAD: Init Metrics",
		SNMP_BAD_FIRST_METRICS_POLL: "BAD: Metrics Poll",
	}
)

Functions

func FixupName

func FixupName(name string) string

func LookupEnvBool

func LookupEnvBool(key string, defaultVal bool) bool

func LookupEnvInt

func LookupEnvInt(key string, defaultVal int) int

func LookupEnvString

func LookupEnvString(key string, defaultVal string) string

Types

type Addr

type Addr struct {
	Address string `json:"address"`
	Netmask string `json:"netmask"`
}

type AgentId

type AgentId IntId

func NewAgentId

func NewAgentId(id string) AgentId

type Cid

type Cid IntId // company id

func (Cid) Itoa

func (id Cid) Itoa() string

type Column

type Column struct {
	ID   uint64 `json:"field_id,string"`
	Name string `json:"col_name"`
	Type string `json:"col_type"`
}

type Compression

type Compression string

type CustomColumn

type CustomColumn struct {
	ID              uint32
	Name            string
	Type            string // kt.FORMAT_UINT32 or kt.FORMAT_STRING or kt.FORMAT_ADDR
	CustomMapValues map[uint32]string
}

A CustomColumn corresponds a row in mn_kflow_field, which represents a field in the "Custom" field of a kflow record. This could either be a field we add to most kflow (e.g. i_ult_exit_network_bndry_name), or a "custom dimension" for a company (e.g. c_customer, c_kentik_services, etc.). The CustomMapValues field is filled in with data from mn_flow_tag_kv if it exists, but in a post HSCD (hyper-scale custom dimensions aka hippo tagging) world, these generally won't be there.

type Device

type Device struct {
	ID            DeviceID              `json:"id,string"`
	Name          string                `json:"device_name"`
	CompanyID     Cid                   `json:"company_id,string"`
	DeviceType    string                `json:"device_type"`
	DeviceSubtype string                `json:"device_subtype"`
	Description   string                `json:"device_description"`
	IP            net.IP                `json:"ip"`
	Interfaces    map[IfaceID]Interface `json:"-"`
	AllInterfaces []Interface           `json:"all_interfaces"`
	SendingIps    []net.IP              `json:"sending_ips"`
	SampleRate    uint32                `json:"device_sample_rate,string"`
	BgpType       string                `json:"device_bgp_type"`
	Plan          Plan                  `json:"plan"`
	CdnAttr       string                `json:"cdn_attr"`
	MaxFlowRate   int                   `json:"max_flow_rate"`
	Customs       []Column              `json:"custom_column_data,omitempty"`
	CustomStr     string                `json:"custom_columns"`
	// contains filtered or unexported fields
}

A Device represents a device, corresponding to a row in mn_device. It also has all its interfaces attached.

func (*Device) InitUserTags

func (d *Device) InitUserTags(tags map[string]string)

func (*Device) SetMsgUserTags

func (d *Device) SetMsgUserTags(in sfmt.LogParts)

func (*Device) SetUserTags

func (d *Device) SetUserTags(in map[string]string)

type DeviceData

type DeviceData struct {
	Manufacturer          string                    `yaml:"manufacturer"`
	InterfaceData         map[string]*InterfaceData `yaml:"interface_data"`
	DeviceMetricsMetadata *DeviceMetricsMetadata    `yaml:"device_metrics_metadata,omitempty"`
}

DeviceData holds information about a device, sent via ST, and sent to the portal in writeSNMPWrapper.

type DeviceID

type DeviceID IntId

DeviceID denotes id from mn_device table

func (DeviceID) Itoa

func (id DeviceID) Itoa() string

Itoa returns string formated device id

type DeviceList

type DeviceList struct {
	Devices []Device `json:"devices"`
}

type DeviceMap

type DeviceMap map[string]*SnmpDeviceConfig

func (*DeviceMap) UnmarshalYAML

func (a *DeviceMap) UnmarshalYAML(unmarshal func(interface{}) error) error

type DeviceMapper

type DeviceMapper struct {
	Devices map[DeviceID]map[IfaceID]*InterfaceRow
}

type DeviceMetricsMetadata

type DeviceMetricsMetadata struct {
	SysName     string `yaml:"sys_name,omitempty"`
	SysObjectID string `yaml:"sys_object_id,omitempty"`
	SysDescr    string `yaml:"sys_descr,omitempty"`
	SysLocation string `yaml:"sys_location,omitempty"`
	SysContact  string `yaml:"sys_contact,omitempty"`
	SysServices int    `yaml:"sys_services,omitempty"`
	EngineID    string `yaml:"-"`
	Customs     map[string]string
	CustomInts  map[string]int64
	Tables      map[string]DeviceTableMetadata
}

type DeviceTableMetadata

type DeviceTableMetadata struct {
	Customs map[string]MetaValue
}

func NewDeviceTableMetadata

func NewDeviceTableMetadata() DeviceTableMetadata

type Devices

type Devices map[DeviceID]*Device

Devices is a map of device ids to devices for a company.

type EAPIC

type EAPIC EAPIConfig // Need a 2nd type alias to avoid stack overflow on parsing.

type EAPIConfig

type EAPIConfig struct {
	Host      string `yaml:"host"`
	Username  string `yaml:"username"`
	Password  string `yaml:"password"`
	Transport string `yaml:"transport"`
	Port      int    `yaml:"port"`
	// contains filtered or unexported fields
}

func (*EAPIConfig) MarshalYAML

func (a *EAPIConfig) MarshalYAML() (interface{}, error)

Make sure that things serialize back to how they were.

func (*EAPIConfig) UnmarshalYAML

func (a *EAPIConfig) UnmarshalYAML(unmarshal func(interface{}) error) error

This lets the config get overriden by a global_v3 string.

type ExtensionSet

type ExtensionSet struct {
	ExtOnly      bool          `yaml:"ext_only"`
	EAPIConfig   *EAPIConfig   `yaml:"eapi_config,omitempty"` // Arista eAPI.
	MerakiConfig *MerakiConfig `yaml:"meraki_config,omitempty"`
}

Contain various extensions to snmp which can be used to get data.

type IPAddr

type IPAddr struct {
	Address string `yaml:"address"`
	Netmask string `yaml:"netmask"`
}

type IfaceID

type IfaceID IntId

IfaceID denotes interfce id note this is not mn_interface.id but snmp_id, {input,output}_port in flow

func (IfaceID) Itoa

func (id IfaceID) Itoa() string

Itoa returns string repr of interface id

type IntId

type IntId uint64

type Interface

type Interface struct {
	ID int64 `json:"id"`

	DeviceID   DeviceID `json:"device_id,string"`
	DeviceName string   `json:"device_name"`
	DeviceType string   `json:"device_type"`
	SiteID     int      `json:"site_id"`

	SnmpID               IfaceID `json:"snmp_id,string"`
	SnmpSpeedMbps        int64   `json:"snmp_speed,string"` // unit? TODO: switch to uint64, rename to SnmpSpeedMbps
	SnmpType             int     `json:"snmp_type"`
	SnmpAlias            string  `json:"snmp_alias"`
	InterfaceIP          string  `json:"interface_ip"`
	InterfaceDescription string  `json:"interface_description"`
	Provider             string  `json:"provider"`
	VrfID                int64   `json:"vrf_id"`
	Netmask              string  `json:"interface_ip_netmask"`
	Addrs                []Addr  `json:"secondary_ips"`

	SiteTitle   string `json:"site_title"`
	SiteCountry string `json:"site_country"`
}

An Interface is everything we know about a device's interfaces. It corresponds to a row in mn_interface, joined with information from mn_device and mn_site.

type InterfaceCapacityBPS

type InterfaceCapacityBPS = uint64

InterfaceCapacityBPS denotes capacity of interface in bits per second

type InterfaceData

type InterfaceData struct {
	IPAddr                        // embedded
	AliasAddr   []IPAddr          `yaml:"alias_address"`
	Index       string            `yaml:"index"`
	Speed       uint64            `yaml:"speed"`
	Description string            `yaml:"desc"`
	Alias       string            `yaml:"alias"`
	Type        string            `yaml:"type"`
	ExtraInfo   map[string]string `yaml:"extra_info"`
}

InterfaceData is the metadata we've discovered about an interface during SNMP polling, or from Streaming Telemetry. It's sent *to* the API server as part of a DeviceData.

type InterfaceRow

type InterfaceRow struct {
	DeviceId             uint32 `json:"device_id"`
	DeviceName           string `json:"device_name"`
	DeviceType           string `json:"device_type"`
	SiteId               uint32 `json:"site_id"`
	SnmpId               string `json:"snmp_id"`
	SnmpSpeed            int64  `json:"snmp_speed"`
	SnmpType             uint32 `json:"snmp_type"`
	SnmpAlias            string `json:"snmp_alias"`
	InterfaceIp          string `json:"interface_ip"`
	InterfaceDescription string `json:"interface_description"`
	Provider             string `json:"provider"`
	VrfId                uint32 `json:"vrf_id"`
	SiteTitle            string `json:"site_title"`
	SiteCountry          string `json:"site_country"`
}

type JCHF

type JCHF struct {
	Timestamp               int64             `json:"timestamp"`
	DstAs                   uint32            `json:"dst_as"`
	DstGeo                  string            `json:"dst_geo"`
	HeaderLen               uint32            `json:"header_len"`
	InBytes                 uint64            `json:"in_bytes"`
	InPkts                  uint64            `json:"in_pkts"`
	InputPort               IfaceID           `json:"input_port"`
	IpSize                  uint32            `json:"ip_size"`
	DstAddr                 string            `json:"dst_addr"`
	SrcAddr                 string            `json:"src_addr"`
	L4DstPort               uint32            `json:"l4_dst_port"`
	L4SrcPort               uint32            `json:"l4_src_port"`
	OutputPort              IfaceID           `json:"output_port"`
	Protocol                string            `json:"protocol"`
	SampledPacketSize       uint32            `json:"sampled_packet_size"`
	SrcAs                   uint32            `json:"src_as"`
	SrcGeo                  string            `json:"src_geo"`
	TcpFlags                uint32            `json:"tcp_flags"`
	Tos                     uint32            `json:"tos"`
	VlanIn                  uint32            `json:"vlan_in"`
	VlanOut                 uint32            `json:"vlan_out"`
	NextHop                 string            `json:"next_hop"`
	MplsType                uint32            `json:"mpls_type"`
	OutBytes                uint64            `json:"out_bytes"`
	OutPkts                 uint64            `json:"out_pkts"`
	TcpRetransmit           uint32            `json:"tcp_rx"`
	SrcFlowTags             string            `json:"src_flow_tags"`
	DstFlowTags             string            `json:"dst_flow_tags"`
	SampleRate              uint32            `json:"sample_rate"`
	DeviceId                DeviceID          `json:"device_id"`
	DeviceName              string            `json:"device_name"`
	CompanyId               Cid               `json:"company_id"`
	DstBgpAsPath            string            `json:"dst_bgp_as_path"`
	DstBgpCommunity         string            `json:"dst_bgp_comm"`
	SrcBgpAsPath            string            `json:"src_bpg_as_path"`
	SrcBgpCommunity         string            `json:"src_bgp_comm"`
	SrcNextHopAs            uint32            `json:"src_nexthop_as"`
	DstNextHopAs            uint32            `json:"dst_nexthop_as"`
	SrcGeoRegion            string            `json:"src_geo_region"`
	DstGeoRegion            string            `json:"dst_geo_region"`
	SrcGeoCity              string            `json:"src_geo_city"`
	DstGeoCity              string            `json:"dst_geo_city"`
	DstNextHop              string            `json:"dst_nexthop"`
	SrcNextHop              string            `json:"src_nexthop"`
	SrcRoutePrefix          string            `json:"src_route_prefix"`
	DstRoutePrefix          string            `json:"dst_route_prefix"`
	SrcSecondAsn            uint32            `json:"src_second_asn"`
	DstSecondAsn            uint32            `json:"dst_second_asn"`
	SrcThirdAsn             uint32            `json:"src_third_asn"`
	DstThirdAsn             uint32            `json:"dst_third_asn"`
	SrcEthMac               string            `json:"src_eth_mac"`
	DstEthMac               string            `json:"dst_eth_mac"`
	InputIntDesc            string            `json:"input_int_desc"`
	OutputIntDesc           string            `json:"output_int_desc"`
	InputIntAlias           string            `json:"input_int_alias"`
	OutputIntAlias          string            `json:"output_int_alias"`
	InputInterfaceCapacity  int64             `json:"input_int_capacity"`
	OutputInterfaceCapacity int64             `json:"output_int_capacity"`
	InputInterfaceIP        string            `json:"input_int_ip"`
	OutputInterfaceIP       string            `json:"output_int_ip"`
	CustomStr               map[string]string `json:"custom_str,omitempty"`
	CustomInt               map[string]int32  `json:"custom_int,omitempty"`
	CustomBigInt            map[string]int64  `json:"custom_bigint,omitempty"`
	EventType               string            `json:"eventType"`
	Provider                Provider          `json:"provider"` // Entity type for this data.

	CustomMetrics map[string]MetricInfo          `json:"-"`
	CustomTables  map[string]DeviceTableMetadata `json:"-"`
	MatchAttr     map[string]*regexp.Regexp      `json:"-"`
	// contains filtered or unexported fields
}

func NewJCHF

func NewJCHF() *JCHF

func (*JCHF) Flatten

func (j *JCHF) Flatten() map[string]interface{}

func (*JCHF) Reset

func (j *JCHF) Reset()

func (*JCHF) SetIFPorts

func (j *JCHF) SetIFPorts(p IfaceID) *JCHF

func (*JCHF) SetMap

func (j *JCHF) SetMap()

func (*JCHF) ToMap

func (j *JCHF) ToMap() map[string]interface{}

type KentikConfig added in v1.0.0

type KentikConfig struct {
	ApiEmail string
	ApiToken string
	ApiRoot  string
	ApiPlan  int
}

type LastMetadata

type LastMetadata struct {
	DeviceInfo    map[string]interface{}
	InterfaceInfo map[IfaceID]map[string]interface{}
	Tables        map[string]DeviceTableMetadata
	MatchAttr     map[string]*regexp.Regexp
	XtraInfo      map[string]MetricInfo
}

func (*LastMetadata) GetTableName

func (lm *LastMetadata) GetTableName(key string) (string, map[string]bool, bool)

func (*LastMetadata) Missing

func (lm *LastMetadata) Missing(new *LastMetadata) []string

func (*LastMetadata) Size

func (lm *LastMetadata) Size() int

type MerakiConfig

type MerakiConfig struct {
	ApiKey         string `yaml:"api_key"`         // Required.
	Host           string `yaml:"host"`            // Optional, defaults to api.meraki.com
	MonitorUplinks bool   `yaml:"monitor_uplinks"` // This will be the default if neither is set.
	MonitorDevices bool   `yaml:"monitor_devices"`
}

type MetaValue

type MetaValue struct {
	TableName  string
	TableNames map[string]bool
	StringVal  string
	IntVal     int64
}

func NewMetaValue

func NewMetaValue(mib *Mib, sv string, iv int64) MetaValue

func (*MetaValue) GetValue

func (mv *MetaValue) GetValue() interface{}

type MetricInfo

type MetricInfo struct {
	Oid     string          `json:"-"`
	Mib     string          `json:"-"`
	Name    string          `json:"-"`
	Profile string          `json:"-"`
	Table   string          `json:"-"`
	Format  string          `json:"-"`
	Type    string          `json:"-"`
	PollDur time.Duration   `json:"-"`
	Tables  map[string]bool `json:"-"`
}

func (*MetricInfo) GetType

func (m *MetricInfo) GetType() string

type Mib

type Mib struct {
	Oid        string
	Name       string
	Type       Oidtype
	Extra      string
	Tag        string
	Enum       map[string]int64
	EnumRev    map[int64]string
	Conversion string
	Mib        string
	Table      string
	PollDur    time.Duration
	MatchAttr  map[string]*regexp.Regexp

	FromExtended bool
	OtherTables  map[string]bool
	Format       string
	AllowDup     bool
	// contains filtered or unexported fields
}

func (*Mib) Extend

func (mb *Mib) Extend(nm *Mib)

func (*Mib) GetName

func (mb *Mib) GetName() string

func (*Mib) IsPollReady

func (mb *Mib) IsPollReady() bool

func (*Mib) String

func (mb *Mib) String() string

type Oidtype

type Oidtype int

type Output

type Output struct {
	Body []byte
	Ctx  OutputContext
	CB   func(error) // Called when this is sent to a sink.
}

func NewOutput

func NewOutput(body []byte) *Output

func NewOutputWithProvider

func NewOutputWithProvider(body []byte, prov Provider, stype OutputType) *Output

func (*Output) BodyLen

func (o *Output) BodyLen() int

func (*Output) GetDataType

func (o *Output) GetDataType() string

func (*Output) IsEvent

func (o *Output) IsEvent() bool

func (*Output) IsMetric

func (o *Output) IsMetric() bool

type OutputContext

type OutputContext struct {
	Provider Provider
	Type     OutputType
}

type OutputType

type OutputType string

type Plan

type Plan struct {
	ID   uint64 `json:"id"`
	Name string `json:"name"`
}

type Provider

type Provider string
const (
	ProviderRouter             Provider = "kentik-router"
	ProviderDefault            Provider = "kentik-default"
	ProviderVPC                Provider = "kentik-vpc"
	ProviderSynth              Provider = "kentik-network-synthetic"
	ProviderSwitch             Provider = "kentik-switch"
	ProviderFirewall           Provider = "kentik-firewall"
	ProviderUPS                Provider = "kentik-ups"
	ProviderPDU                Provider = "kentik-pdu"
	ProviderIOT                Provider = "kentik-iot"
	ProviderHost               Provider = "kentik-host"
	ProviderAlert              Provider = "kentik-alert"
	ProviderFlowDevice         Provider = "kentik-flow-device"
	ProviderWirelessController Provider = "kentik-wireless-controller"
	ProviderNas                Provider = "kentik-nas"
	ProviderSan                Provider = "kentik-san"
	ProviderAgent              Provider = "kentik-agent"
	ProviderFibreChannel       Provider = "kentik-fibre-channel"
	ProviderTrapUnknown        Provider = "kentik-trap-device"
	ProviderHttpDevice         Provider = "kentik-http"
)

type SNMPTestWalker

type SNMPTestWalker interface {
	WalkAll(string) ([]gosnmp.SnmpPDU, error)
}

type SnmpConfig

type SnmpConfig struct {
	Devices    DeviceMap         `yaml:"devices"`
	Trap       *SnmpTrapConfig   `yaml:"trap"`
	Disco      *SnmpDiscoConfig  `yaml:"discovery"`
	Global     *SnmpGlobalConfig `yaml:"global"`
	DeviceOrig string            `yaml:"-"`
}

type SnmpDeviceConfig

type SnmpDeviceConfig struct {
	DeviceName          string            `yaml:"device_name"`
	DeviceIP            string            `yaml:"device_ip"`
	Community           string            `yaml:"snmp_comm,omitempty"`
	UseV1               bool              `yaml:"use_snmp_v1"`
	V3                  *V3SNMPConfig     `yaml:"snmp_v3,omitempty"`
	Debug               bool              `yaml:"debug"`
	SampleRate          int64             `yaml:"sample_rate,omitempty"` // Used for flow.
	Port                uint16            `yaml:"port,omitempty"`
	OID                 string            `yaml:"oid"`
	Description         string            `yaml:"description"`
	Checked             time.Time         `yaml:"last_checked"`
	MibProfile          string            `yaml:"mib_profile"`
	Provider            Provider          `yaml:"provider"`
	FlowOnly            bool              `yaml:"flow_only,omitempty"`
	PingOnly            bool              `yaml:"ping_only,omitempty"`
	UserTags            map[string]string `yaml:"user_tags"`
	DiscoveredMibs      []string          `yaml:"discovered_mibs,omitempty"`
	PollTimeSec         int               `yaml:"poll_time_sec,omitempty"`
	TimeoutMS           int               `yaml:"timeout_ms,omitempty"`
	Retries             int               `yaml:"retries,omitempty"`
	EngineID            string            `yaml:"engine_id,omitempty"`
	MatchAttr           map[string]string `yaml:"match_attributes"`
	MonitorAdminShut    bool              `yaml:"monitor_admin_shut"`
	NoUseBulkWalkAll    bool              `yaml:"no_use_bulkwalkall"`
	InstrumentationName string            `yaml:"instrumentationName,omitempty"`
	RunPing             bool              `yaml:"response_time,omitempty"`
	Ext                 *ExtensionSet     `yaml:"ext,omitempty"`
	PingSec             int               `yaml:"ping_interval_sec,omitempty"`
	// contains filtered or unexported fields
}

func (*SnmpDeviceConfig) AddUserTag

func (d *SnmpDeviceConfig) AddUserTag(k string, v string)

func (*SnmpDeviceConfig) GetTestWalker

func (d *SnmpDeviceConfig) GetTestWalker() SNMPTestWalker

func (*SnmpDeviceConfig) GetUserTags

func (d *SnmpDeviceConfig) GetUserTags() map[string]string

func (*SnmpDeviceConfig) InitUserTags

func (d *SnmpDeviceConfig) InitUserTags(serviceName string)

func (*SnmpDeviceConfig) SetTestWalker

func (d *SnmpDeviceConfig) SetTestWalker(w SNMPTestWalker)

func (*SnmpDeviceConfig) SetUserTags

func (d *SnmpDeviceConfig) SetUserTags(in map[string]string)

func (*SnmpDeviceConfig) UpdateFrom

func (d *SnmpDeviceConfig) UpdateFrom(old *SnmpDeviceConfig, conf *SnmpConfig)

Save any hard coded parts of this profile which might get overriten by an automatic process.

type SnmpDeviceMetric

type SnmpDeviceMetric struct {
	DeviceMetrics    go_metrics.Meter
	InterfaceMetrics go_metrics.Meter
	Metadata         go_metrics.Meter
	Errors           go_metrics.Meter
	Fail             go_metrics.Gauge
	Missing          go_metrics.Gauge
	MissingMeta      go_metrics.Gauge
}

func NewSnmpDeviceMetric

func NewSnmpDeviceMetric(registry go_metrics.Registry, deviceName string) *SnmpDeviceMetric

type SnmpDiscoConfig

type SnmpDiscoConfig struct {
	Cidrs              StringArray     `yaml:"cidrs"`
	IgnoreList         StringArray     `yaml:"ignore_list"`
	Debug              bool            `yaml:"debug"`
	Ports              []int           `yaml:"ports"`
	DefaultCommunities []string        `yaml:"default_communities"`
	UseV1              bool            `yaml:"use_snmp_v1"`
	DefaultV3          *V3SNMPConfig   `yaml:"default_v3"`
	OtherV3s           []*V3SNMPConfig `yaml:"other_v3s,omitempty"`
	AddDevices         bool            `yaml:"add_devices"`
	AddAllMibs         bool            `yaml:"add_mibs"`
	Threads            int             `yaml:"threads"`
	ReplaceDevices     bool            `yaml:"replace_devices"`
	NoDedup            bool            `yaml:"no_dedup_engine_id,omitempty"`
	CheckAll           bool            `yaml:"check_all_ips,omitempty"`
	CidrOrig           string          `yaml:"-"`
	IgnoreOrig         string          `yaml:"-"`
}

type SnmpGlobalConfig

type SnmpGlobalConfig struct {
	PollTimeSec   int               `yaml:"poll_time_sec"`
	DropIfOutside bool              `yaml:"drop_if_outside_poll"`
	MibProfileDir string            `yaml:"mib_profile_dir"`
	MibDB         string            `yaml:"mibs_db"`
	MibsEnabled   []string          `yaml:"mibs_enabled"`
	TimeoutMS     int               `yaml:"timeout_ms"`
	Retries       int               `yaml:"retries"`
	GlobalV3      *V3SNMPConfig     `yaml:"global_v3"`
	RunPing       bool              `yaml:"response_time"`
	PingSec       int               `yaml:"ping_interval_sec,omitempty"`
	UserTags      map[string]string `yaml:"user_tags"`
	MatchAttr     map[string]string `yaml:"match_attributes"`
}

type SnmpMetricSet

type SnmpMetricSet struct {
	Devices map[string]*SnmpDeviceMetric
	Mux     sync.RWMutex
	Traps   go_metrics.Meter
}

func NewSnmpMetricSet

func NewSnmpMetricSet(registry go_metrics.Registry) *SnmpMetricSet

type SnmpTrapConfig

type SnmpTrapConfig struct {
	Listen    string        `yaml:"listen"`
	Community string        `yaml:"community"`
	Version   string        `yaml:"version"`
	Transport string        `yaml:"transport"`
	V3        *V3SNMPConfig `yaml:"v3_config"`
}

type StringArray

type StringArray []string

func (*StringArray) UnmarshalYAML

func (a *StringArray) UnmarshalYAML(unmarshal func(interface{}) error) error

type TestId

type TestId IntId

func NewTestId

func NewTestId(id string) TestId

type TopValue

type TopValue struct {
	Asn     uint32
	Packets uint64
}

type V3SNMP

type V3SNMP V3SNMPConfig // Need a 2nd type alias to avoid stack overflow on parsing.

type V3SNMPConfig

type V3SNMPConfig struct {
	UserName                 string `yaml:"user_name"`
	AuthenticationProtocol   string `yaml:"authentication_protocol"`
	AuthenticationPassphrase string `yaml:"authentication_passphrase"`
	PrivacyProtocol          string `yaml:"privacy_protocol"`
	PrivacyPassphrase        string `yaml:"privacy_passphrase"`
	ContextEngineID          string `yaml:"context_engine_id"`
	ContextName              string `yaml:"context_name"`
	// contains filtered or unexported fields
}

func (*V3SNMPConfig) InheritGlobal

func (a *V3SNMPConfig) InheritGlobal() bool

func (*V3SNMPConfig) MarshalYAML

func (a *V3SNMPConfig) MarshalYAML() (interface{}, error)

Make sure that things serialize back to how they were.

func (*V3SNMPConfig) UnmarshalYAML

func (a *V3SNMPConfig) UnmarshalYAML(unmarshal func(interface{}) error) error

This lets the config get overriden by a global_v3 string.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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