Documentation ¶
Overview ¶
Package metadata defines types for describing data about a device.
Index ¶
- Constants
- type DeviceMetadata
- type DeviceOID
- type DeviceStatus
- type Diagnosis
- type DiagnosisMetadata
- type IDType
- type IPAddressMetadata
- type IfAdminStatus
- type IfOperStatus
- type InterfaceMetadata
- type InterfaceStatus
- type NetflowExporter
- type NetworkDevicesMetadata
- type TopologyLinkDevice
- type TopologyLinkInterface
- type TopologyLinkMetadata
- type TopologyLinkSide
Constants ¶
const ( // DeviceStatusReachable means the device can be reached by snmp integration DeviceStatusReachable = DeviceStatus(1) // DeviceStatusUnreachable means the device cannot be reached by snmp integration DeviceStatusUnreachable = DeviceStatus(2) )
const ( // IDTypeMacAddress represent mac address in `00:00:00:00:00:00` format IDTypeMacAddress = "mac_address" //nolint:revive // TODO(NDM) Fix revive linter IDTypeInterfaceName = "interface_name" //nolint:revive // TODO(NDM) Fix revive linter IDTypeInterfaceAlias = "interface_alias" )
const PayloadMetadataBatchSize = 100
PayloadMetadataBatchSize is the number of resources per event payload Resources are devices, interfaces, etc
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DeviceMetadata ¶
type DeviceMetadata struct { ID string `json:"id"` IDTags []string `json:"id_tags"` // id_tags is the input to produce device.id, it's also used to correlated with device metrics. Tags []string `json:"tags"` IPAddress string `json:"ip_address"` Status DeviceStatus `json:"status"` PingStatus DeviceStatus `json:"ping_status,omitempty"` Name string `json:"name,omitempty"` Description string `json:"description,omitempty"` SysObjectID string `json:"sys_object_id,omitempty"` Location string `json:"location,omitempty"` Profile string `json:"profile,omitempty"` ProfileVersion uint64 `json:"profile_version,omitempty"` Vendor string `json:"vendor,omitempty"` Subnet string `json:"subnet,omitempty"` SerialNumber string `json:"serial_number,omitempty"` Version string `json:"version,omitempty"` ProductName string `json:"product_name,omitempty"` Model string `json:"model,omitempty"` OsName string `json:"os_name,omitempty"` OsVersion string `json:"os_version,omitempty"` OsHostname string `json:"os_hostname,omitempty"` Integration string `json:"integration,omitempty"` // indicates the source of the data SNMP, meraki_api, etc. DeviceType string `json:"device_type,omitempty"` }
DeviceMetadata contains device metadata
type DeviceOID ¶
type DeviceOID struct { DeviceID string `json:"device_id"` OID string `json:"oid"` Type string `json:"type"` Value string `json:"value"` }
DeviceOID device scan oid data
type Diagnosis ¶
type Diagnosis struct { Severity string `json:"severity"` Message string `json:"message"` Code string `json:"code"` }
Diagnosis contain data for a diagnosis
type DiagnosisMetadata ¶
type DiagnosisMetadata struct { ResourceType string `json:"resource_type"` ResourceID string `json:"resource_id"` Diagnoses []Diagnosis `json:"diagnoses"` }
DiagnosisMetadata contains diagnoses info
type IPAddressMetadata ¶
type IPAddressMetadata struct { InterfaceID string `json:"interface_id"` IPAddress string `json:"ip_address"` Prefixlen int32 `json:"prefixlen,omitempty"` }
IPAddressMetadata contains ip address metadata
type IfAdminStatus ¶
type IfAdminStatus int
IfAdminStatus interface admin status type
const ( AdminStatusUp IfAdminStatus = 1 AdminStatusDown IfAdminStatus = 2 AdminStatusTesting IfAdminStatus = 3 )
IfAdminStatus enums
func (IfAdminStatus) AsString ¶
func (i IfAdminStatus) AsString() string
AsString convert to string value
type IfOperStatus ¶
type IfOperStatus int
IfOperStatus interface oper status type
const ( OperStatusUp IfOperStatus = 1 OperStatusDown IfOperStatus = 2 OperStatusTesting IfOperStatus = 3 OperStatusUnknown IfOperStatus = 4 OperStatusDormant IfOperStatus = 5 OperStatusNotPresent IfOperStatus = 6 OperStatusLowerLayerDown IfOperStatus = 7 )
IfOperStatus enums
func (IfOperStatus) AsString ¶
func (i IfOperStatus) AsString() string
AsString convert to string value
type InterfaceMetadata ¶
type InterfaceMetadata struct { DeviceID string `json:"device_id"` IDTags []string `json:"id_tags"` // used to correlate with interface metrics Index int32 `json:"index"` // IF-MIB ifIndex type is InterfaceIndex (Integer32 (1..2147483647)) RawID string `json:"raw_id,omitempty"` // used to uniquely identify the interface in the context of the device RawIDType string `json:"raw_id_type,omitempty"` // used to indicate the type of identifier used (i.e. portId for Meraki switches, uplink for Meraki uplinks, blank for SNMP for compatibility) Name string `json:"name,omitempty"` Alias string `json:"alias,omitempty"` Description string `json:"description,omitempty"` MacAddress string `json:"mac_address,omitempty"` AdminStatus IfAdminStatus `json:"admin_status,omitempty"` // IF-MIB ifAdminStatus type is INTEGER OperStatus IfOperStatus `json:"oper_status,omitempty"` // IF-MIB ifOperStatus type is INTEGER MerakiEnabled *bool `json:"meraki_enabled,omitempty"` // enabled bool for Meraki devices, use a pointer to determine if the value was actually sent MerakiStatus string `json:"meraki_status,omitempty"` // status for Meraki devices }
InterfaceMetadata contains interface metadata
type InterfaceStatus ¶
type InterfaceStatus string
InterfaceStatus interface status
const ( InterfaceStatusUp InterfaceStatus = "up" InterfaceStatusDown InterfaceStatus = "down" InterfaceStatusWarning InterfaceStatus = "warning" InterfaceStatusOff InterfaceStatus = "off" )
InterfaceStatus enums
type NetflowExporter ¶
type NetflowExporter struct { ID string `json:"id"` // used by backend as unique id (e.g. in cache) IPAddress string `json:"ip_address"` FlowType string `json:"flow_type"` }
NetflowExporter contains netflow exporters info
type NetworkDevicesMetadata ¶
type NetworkDevicesMetadata struct { Subnet string `json:"subnet,omitempty"` Namespace string `json:"namespace"` Devices []DeviceMetadata `json:"devices,omitempty"` Interfaces []InterfaceMetadata `json:"interfaces,omitempty"` IPAddresses []IPAddressMetadata `json:"ip_addresses,omitempty"` Links []TopologyLinkMetadata `json:"links,omitempty"` NetflowExporters []NetflowExporter `json:"netflow_exporters,omitempty"` Diagnoses []DiagnosisMetadata `json:"diagnoses,omitempty"` DeviceOIDs []DeviceOID `json:"device_oids,omitempty"` CollectTimestamp int64 `json:"collect_timestamp"` }
NetworkDevicesMetadata contains network devices metadata
func BatchDeviceScan ¶
func BatchDeviceScan(namespace string, collectTime time.Time, batchSize int, deviceOIDs []*DeviceOID) []NetworkDevicesMetadata
BatchDeviceScan batches a bunch of DeviceOID entries across multiple NetworkDevicesMetadata payloads.
func BatchPayloads ¶
func BatchPayloads(namespace string, subnet string, collectTime time.Time, batchSize int, devices []DeviceMetadata, interfaces []InterfaceMetadata, ipAddresses []IPAddressMetadata, topologyLinks []TopologyLinkMetadata, netflowExporters []NetflowExporter, diagnoses []DiagnosisMetadata) []NetworkDevicesMetadata
BatchPayloads batch NDM metadata payloads
type TopologyLinkDevice ¶
type TopologyLinkDevice struct { DDID string `json:"dd_id,omitempty"` ID string `json:"id,omitempty"` IDType string `json:"id_type,omitempty"` Name string `json:"name,omitempty"` Description string `json:"description,omitempty"` IPAddress string `json:"ip_address,omitempty"` }
TopologyLinkDevice contain device link data
type TopologyLinkInterface ¶
type TopologyLinkInterface struct { DDID string `json:"dd_id,omitempty"` ID string `json:"id"` IDType string `json:"id_type,omitempty"` Description string `json:"description,omitempty"` }
TopologyLinkInterface contain interface link data
type TopologyLinkMetadata ¶
type TopologyLinkMetadata struct { ID string `json:"id"` SourceType string `json:"source_type"` Local *TopologyLinkSide `json:"local"` Remote *TopologyLinkSide `json:"remote"` }
TopologyLinkMetadata contains topology interface to interface links metadata
type TopologyLinkSide ¶
type TopologyLinkSide struct { Device *TopologyLinkDevice `json:"device,omitempty"` Interface *TopologyLinkInterface `json:"interface,omitempty"` }
TopologyLinkSide contain data for remote or local side of the link