Adding upstream version 1.34.4.
Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
parent
e393c3af3f
commit
4978089aab
4963 changed files with 677545 additions and 0 deletions
166
plugins/inputs/cisco_telemetry_mdt/README.md
Normal file
166
plugins/inputs/cisco_telemetry_mdt/README.md
Normal file
|
@ -0,0 +1,166 @@
|
|||
# Cisco Model-Driven Telemetry (MDT) Input Plugin
|
||||
|
||||
This plugin consumes [Cisco model-driven telemetry (MDT)][cisco_mdt] data from
|
||||
Cisco IOS XR, IOS XE and NX-OS platforms via TCP or GRPC. GRPC-based transport
|
||||
can utilize TLS for authentication and encryption. Telemetry data is expected to
|
||||
be GPB-KV (self-describing-gpb) encoded.
|
||||
|
||||
The GRPC dialout transport is supported on various IOS XR (64-bit) 6.1.x and
|
||||
later, IOS XE 16.10 and later, as well as NX-OS 7.x and later platforms. The
|
||||
TCP dialout transport is supported on IOS XR (32-bit and 64-bit) 6.1.x and
|
||||
later.
|
||||
|
||||
⭐ Telegraf v1.11.0
|
||||
🏷️ applications
|
||||
💻 all
|
||||
|
||||
[cisco_mdt]: https://www.cisco.com/c/en/us/products/collateral/switches/catalyst-9300-series-switches/model-driven-telemetry-wp.html
|
||||
|
||||
## Service Input <!-- @/docs/includes/service_input.md -->
|
||||
|
||||
This plugin is a service input. Normal plugins gather metrics determined by the
|
||||
interval setting. Service plugins start a service to listen and wait for
|
||||
metrics or events to occur. Service plugins have two key differences from
|
||||
normal plugins:
|
||||
|
||||
1. The global or plugin specific `interval` setting may not apply
|
||||
2. The CLI options of `--test`, `--test-wait`, and `--once` may not produce
|
||||
output for this plugin
|
||||
|
||||
## Global configuration options <!-- @/docs/includes/plugin_config.md -->
|
||||
|
||||
In addition to the plugin-specific configuration settings, plugins support
|
||||
additional global and plugin configuration settings. These settings are used to
|
||||
modify metrics, tags, and field or create aliases and configure ordering, etc.
|
||||
See the [CONFIGURATION.md][CONFIGURATION.md] for more details.
|
||||
|
||||
[CONFIGURATION.md]: ../../../docs/CONFIGURATION.md#plugins
|
||||
|
||||
## Configuration
|
||||
|
||||
```toml @sample.conf
|
||||
# Cisco model-driven telemetry (MDT) input plugin for IOS XR, IOS XE and NX-OS platforms
|
||||
[[inputs.cisco_telemetry_mdt]]
|
||||
## Telemetry transport can be "tcp" or "grpc". TLS is only supported when
|
||||
## using the grpc transport.
|
||||
transport = "grpc"
|
||||
|
||||
## Address and port to host telemetry listener
|
||||
service_address = ":57000"
|
||||
|
||||
## Grpc Maximum Message Size, default is 4MB, increase the size. This is
|
||||
## stored as a uint32, and limited to 4294967295.
|
||||
max_msg_size = 4000000
|
||||
|
||||
## Enable TLS; grpc transport only.
|
||||
# tls_cert = "/etc/telegraf/cert.pem"
|
||||
# tls_key = "/etc/telegraf/key.pem"
|
||||
|
||||
## Enable TLS client authentication and define allowed CA certificates; grpc
|
||||
## transport only.
|
||||
# tls_allowed_cacerts = ["/etc/telegraf/clientca.pem"]
|
||||
|
||||
## Define (for certain nested telemetry measurements with embedded tags) which fields are tags
|
||||
# embedded_tags = ["Cisco-IOS-XR-qos-ma-oper:qos/interface-table/interface/input/service-policy-names/service-policy-instance/statistics/class-stats/class-name"]
|
||||
|
||||
## Include the delete field in every telemetry message.
|
||||
# include_delete_field = false
|
||||
|
||||
## Specify custom name for incoming MDT source field.
|
||||
# source_field_name = "mdt_source"
|
||||
|
||||
## Define aliases to map telemetry encoding paths to simple measurement names
|
||||
[inputs.cisco_telemetry_mdt.aliases]
|
||||
ifstats = "ietf-interfaces:interfaces-state/interface/statistics"
|
||||
## Define Property Xformation, please refer README and https://pubhub.devnetcloud.com/media/dme-docs-9-3-3/docs/appendix/ for Model details.
|
||||
[inputs.cisco_telemetry_mdt.dmes]
|
||||
# Global Property Xformation.
|
||||
# prop1 = "uint64 to int"
|
||||
# prop2 = "uint64 to string"
|
||||
# prop3 = "string to uint64"
|
||||
# prop4 = "string to int64"
|
||||
# prop5 = "string to float64"
|
||||
# auto-prop-xfrom = "auto-float-xfrom" #Xform any property which is string, and has float number to type float64
|
||||
# Per Path property xformation, Name is telemetry configuration under sensor-group, path configuration "WORD Distinguished Name"
|
||||
# Per Path configuration is better as it avoid property collision issue of types.
|
||||
# dnpath = '{"Name": "show ip route summary","prop": [{"Key": "routes","Value": "string"}, {"Key": "best-paths","Value": "string"}]}'
|
||||
# dnpath2 = '{"Name": "show processes cpu","prop": [{"Key": "kernel_percent","Value": "float"}, {"Key": "idle_percent","Value": "float"}, {"Key": "process","Value": "string"}, {"Key": "user_percent","Value": "float"}, {"Key": "onesec","Value": "float"}]}'
|
||||
# dnpath3 = '{"Name": "show processes memory physical","prop": [{"Key": "processname","Value": "string"}]}'
|
||||
|
||||
## Additional GRPC connection settings.
|
||||
[inputs.cisco_telemetry_mdt.grpc_enforcement_policy]
|
||||
## GRPC permit keepalives without calls, set to true if your clients are
|
||||
## sending pings without calls in-flight. This can sometimes happen on IOS-XE
|
||||
## devices where the GRPC connection is left open but subscriptions have been
|
||||
## removed, and adding subsequent subscriptions does not keep a stable session.
|
||||
# permit_keepalive_without_calls = false
|
||||
|
||||
## GRPC minimum timeout between successive pings, decreasing this value may
|
||||
## help if this plugin is closing connections with ENHANCE_YOUR_CALM (too_many_pings).
|
||||
# keepalive_minimum_time = "5m"
|
||||
```
|
||||
|
||||
## Metrics
|
||||
|
||||
Metrics are named by the encoding path that generated the data, or by the alias
|
||||
if the `inputs.cisco_telemetry_mdt.aliases` config section is defined.
|
||||
Metric fields are dependent on the device type and path.
|
||||
|
||||
Tags included in all metrics:
|
||||
|
||||
- source
|
||||
- path
|
||||
- subscription
|
||||
|
||||
Additional tags (such as interface_name) may be included depending on the path.
|
||||
|
||||
## Example Output
|
||||
|
||||
```text
|
||||
ifstats,path=ietf-interfaces:interfaces-state/interface/statistics,host=linux,name=GigabitEthernet2,source=csr1kv,subscription=101 in-unicast-pkts=27i,in-multicast-pkts=0i,discontinuity-time="2019-05-23T07:40:23.000362+00:00",in-octets=5233i,in-errors=0i,out-multicast-pkts=0i,out-discards=0i,in-broadcast-pkts=0i,in-discards=0i,in-unknown-protos=0i,out-unicast-pkts=0i,out-broadcast-pkts=0i,out-octets=0i,out-errors=0i 1559150462624000000
|
||||
ifstats,path=ietf-interfaces:interfaces-state/interface/statistics,host=linux,name=GigabitEthernet1,source=csr1kv,subscription=101 in-octets=3394770806i,in-broadcast-pkts=0i,in-multicast-pkts=0i,out-broadcast-pkts=0i,in-unknown-protos=0i,out-octets=350212i,in-unicast-pkts=9477273i,in-discards=0i,out-unicast-pkts=2726i,out-discards=0i,discontinuity-time="2019-05-23T07:40:23.000363+00:00",in-errors=30i,out-multicast-pkts=0i,out-errors=0i 1559150462624000000
|
||||
```
|
||||
|
||||
### NX-OS Configuration Example
|
||||
|
||||
```text
|
||||
Requirement DATA-SOURCE Configuration
|
||||
-----------------------------------------
|
||||
Environment DME path sys/ch query-condition query-target=subtree&target-subtree-class=eqptPsuSlot,eqptFtSlot,eqptSupCSlot,eqptPsu,eqptFt,eqptSensor,eqptLCSlot
|
||||
DME path sys/ch depth 5 (Another configuration option)
|
||||
Environment NXAPI show environment power
|
||||
NXAPI show environment fan
|
||||
NXAPI show environment temperature
|
||||
Interface Stats DME path sys/intf query-condition query-target=subtree&target-subtree-class=rmonIfIn,rmonIfOut,rmonIfHCIn,rmonIfHCOut,rmonEtherStats
|
||||
Interface State DME path sys/intf depth unbounded query-condition query-target=subtree&target-subtree-class=l1PhysIf,pcAggrIf,l3EncRtdIf,l3LbRtdIf,ethpmPhysIf
|
||||
VPC DME path sys/vpc query-condition query-target=subtree&target-subtree-class=vpcDom,vpcIf
|
||||
Resources cpu DME path sys/procsys query-condition query-target=subtree&target-subtree-class=procSystem,procSysCore,procSysCpuSummary,procSysCpu,procIdle,procIrq,procKernel,procNice,procSoftirq,procTotal,procUser,procWait,procSysCpuHistory,procSysLoad
|
||||
Resources Mem DME path sys/procsys/sysmem/sysmemused
|
||||
path sys/procsys/sysmem/sysmemusage
|
||||
path sys/procsys/sysmem/sysmemfree
|
||||
Per Process cpu DME path sys/proc depth unbounded query-condition rsp-foreign-subtree=ephemeral
|
||||
vxlan(svi stats) DME path sys/bd query-condition query-target=subtree&target-subtree-class=l2VlanStats
|
||||
BGP DME path sys/bgp query-condition query-target=subtree&target-subtree-class=bgpDom,bgpPeer,bgpPeerAf,bgpDomAf,bgpPeerAfEntry,bgpOperRtctrlL3,bgpOperRttP,bgpOperRttEntry,bgpOperAfCtrl
|
||||
mac dynamic DME path sys/mac query-condition query-target=subtree&target-subtree-class=l2MacAddressTable
|
||||
bfd DME path sys/bfd/inst depth unbounded
|
||||
lldp DME path sys/lldp depth unbounded
|
||||
urib DME path sys/urib depth unbounded query-condition rsp-foreign-subtree=ephemeral
|
||||
u6rib DME path sys/u6rib depth unbounded query-condition rsp-foreign-subtree=ephemeral
|
||||
multicast flow DME path sys/mca/show/flows depth unbounded
|
||||
multicast stats DME path sys/mca/show/stats depth unbounded
|
||||
multicast igmp NXAPI show ip igmp groups vrf all
|
||||
multicast igmp NXAPI show ip igmp interface vrf all
|
||||
multicast igmp NXAPI show ip igmp snooping
|
||||
multicast igmp NXAPI show ip igmp snooping groups
|
||||
multicast igmp NXAPI show ip igmp snooping groups detail
|
||||
multicast igmp NXAPI show ip igmp snooping groups summary
|
||||
multicast igmp NXAPI show ip igmp snooping mrouter
|
||||
multicast igmp NXAPI show ip igmp snooping statistics
|
||||
multicast pim NXAPI show ip pim interface vrf all
|
||||
multicast pim NXAPI show ip pim neighbor vrf all
|
||||
multicast pim NXAPI show ip pim route vrf all
|
||||
multicast pim NXAPI show ip pim rp vrf all
|
||||
multicast pim NXAPI show ip pim statistics vrf all
|
||||
multicast pim NXAPI show ip pim vrf all
|
||||
microburst NATIVE path microburst
|
||||
```
|
809
plugins/inputs/cisco_telemetry_mdt/cisco_telemetry_mdt.go
Normal file
809
plugins/inputs/cisco_telemetry_mdt/cisco_telemetry_mdt.go
Normal file
|
@ -0,0 +1,809 @@
|
|||
//go:generate ../../../tools/readme_config_includer/generator
|
||||
package cisco_telemetry_mdt
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
_ "embed"
|
||||
"encoding/binary"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"net"
|
||||
"path"
|
||||
"strconv"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
mdtdialout "github.com/cisco-ie/nx-telemetry-proto/mdt_dialout"
|
||||
telemetry "github.com/cisco-ie/nx-telemetry-proto/telemetry_bis"
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/grpc/credentials"
|
||||
_ "google.golang.org/grpc/encoding/gzip" // Required to allow gzip encoding
|
||||
"google.golang.org/grpc/keepalive"
|
||||
"google.golang.org/grpc/peer"
|
||||
"google.golang.org/protobuf/proto"
|
||||
|
||||
"github.com/influxdata/telegraf"
|
||||
"github.com/influxdata/telegraf/config"
|
||||
"github.com/influxdata/telegraf/metric"
|
||||
common_tls "github.com/influxdata/telegraf/plugins/common/tls"
|
||||
"github.com/influxdata/telegraf/plugins/inputs"
|
||||
)
|
||||
|
||||
//go:embed sample.conf
|
||||
var sampleConfig string
|
||||
|
||||
const (
|
||||
// Maximum telemetry payload size (in bytes) to accept for GRPC dialout transport
|
||||
tcpMaxMsgLen uint32 = 1024 * 1024
|
||||
|
||||
// default minimum time between successive pings
|
||||
// this value is specified in the GRPC docs via GRPC_ARG_HTTP2_MIN_RECV_PING_INTERVAL_WITHOUT_DATA_MS
|
||||
defaultKeepaliveMinTime = config.Duration(time.Second * 300)
|
||||
)
|
||||
|
||||
// CiscoTelemetryMDT plugin for IOS XR, IOS XE and NXOS platforms
|
||||
type CiscoTelemetryMDT struct {
|
||||
// Common configuration
|
||||
Transport string `toml:"transport"`
|
||||
ServiceAddress string `toml:"service_address"`
|
||||
MaxMsgSize int `toml:"max_msg_size"`
|
||||
Aliases map[string]string `toml:"aliases"`
|
||||
Dmes map[string]string `toml:"dmes"`
|
||||
EmbeddedTags []string `toml:"embedded_tags"`
|
||||
EnforcementPolicy grpcEnforcementPolicy `toml:"grpc_enforcement_policy"`
|
||||
IncludeDeleteField bool `toml:"include_delete_field"`
|
||||
SourceFieldName string `toml:"source_field_name"`
|
||||
|
||||
Log telegraf.Logger
|
||||
|
||||
// GRPC TLS settings
|
||||
common_tls.ServerConfig
|
||||
|
||||
// Internal listener / client handle
|
||||
grpcServer *grpc.Server
|
||||
listener net.Listener
|
||||
|
||||
// Internal state
|
||||
internalAliases map[string]string
|
||||
dmesFuncs map[string]string
|
||||
warned map[string]struct{}
|
||||
extraTags map[string]map[string]struct{}
|
||||
nxpathMap map[string]map[string]string // per path map
|
||||
propMap map[string]func(field *telemetry.TelemetryField, value interface{}) interface{}
|
||||
mutex sync.Mutex
|
||||
acc telegraf.Accumulator
|
||||
wg sync.WaitGroup
|
||||
|
||||
// Though unused in the code, required by protoc-gen-go-grpc to maintain compatibility
|
||||
mdtdialout.UnimplementedGRPCMdtDialoutServer
|
||||
}
|
||||
|
||||
type grpcEnforcementPolicy struct {
|
||||
PermitKeepaliveWithoutCalls bool `toml:"permit_keepalive_without_calls"`
|
||||
KeepaliveMinTime config.Duration `toml:"keepalive_minimum_time"`
|
||||
}
|
||||
|
||||
type nxPayloadXfromStructure struct {
|
||||
Name string `json:"Name"`
|
||||
Prop []struct {
|
||||
Key string `json:"Key"`
|
||||
Value string `json:"Value"`
|
||||
} `json:"prop"`
|
||||
}
|
||||
|
||||
func (*CiscoTelemetryMDT) SampleConfig() string {
|
||||
return sampleConfig
|
||||
}
|
||||
|
||||
// Start the Cisco MDT service
|
||||
func (c *CiscoTelemetryMDT) Start(acc telegraf.Accumulator) error {
|
||||
var err error
|
||||
c.acc = acc
|
||||
c.listener, err = net.Listen("tcp", c.ServiceAddress)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
c.propMap = make(map[string]func(field *telemetry.TelemetryField, value interface{}) interface{}, 100)
|
||||
c.propMap["test"] = nxosValueXformUint64Toint64
|
||||
c.propMap["asn"] = nxosValueXformUint64ToString // uint64 to string.
|
||||
c.propMap["subscriptionId"] = nxosValueXformUint64ToString // uint64 to string.
|
||||
c.propMap["operState"] = nxosValueXformUint64ToString // uint64 to string.
|
||||
|
||||
// Invert aliases list
|
||||
c.warned = make(map[string]struct{})
|
||||
c.internalAliases = make(map[string]string, len(c.Aliases))
|
||||
for alias, encodingPath := range c.Aliases {
|
||||
c.internalAliases[encodingPath] = alias
|
||||
}
|
||||
c.initDB()
|
||||
|
||||
c.dmesFuncs = make(map[string]string, len(c.Dmes))
|
||||
for dme, dmeKey := range c.Dmes {
|
||||
c.dmesFuncs[dmeKey] = dme
|
||||
switch dmeKey {
|
||||
case "uint64 to int":
|
||||
c.propMap[dme] = nxosValueXformUint64Toint64
|
||||
case "uint64 to string":
|
||||
c.propMap[dme] = nxosValueXformUint64ToString
|
||||
case "string to float64":
|
||||
c.propMap[dme] = nxosValueXformStringTofloat
|
||||
case "string to uint64":
|
||||
c.propMap[dme] = nxosValueXformStringToUint64
|
||||
case "string to int64":
|
||||
c.propMap[dme] = nxosValueXformStringToInt64
|
||||
case "auto-float-xfrom":
|
||||
c.propMap[dme] = nxosValueAutoXformFloatProp
|
||||
default:
|
||||
if !strings.HasPrefix(dme, "dnpath") { // not path based property map
|
||||
continue
|
||||
}
|
||||
|
||||
var jsStruct nxPayloadXfromStructure
|
||||
err := json.Unmarshal([]byte(dmeKey), &jsStruct)
|
||||
if err != nil {
|
||||
continue
|
||||
}
|
||||
|
||||
// Build 2 level Hash nxpathMap Key = jsStruct.Name, Value = map of jsStruct.Prop
|
||||
// It will override the default of code if same path is provided in configuration.
|
||||
c.nxpathMap[jsStruct.Name] = make(map[string]string, len(jsStruct.Prop))
|
||||
for _, prop := range jsStruct.Prop {
|
||||
c.nxpathMap[jsStruct.Name][prop.Key] = prop.Value
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Fill extra tags
|
||||
c.extraTags = make(map[string]map[string]struct{})
|
||||
for _, tag := range c.EmbeddedTags {
|
||||
dir := strings.ReplaceAll(path.Dir(tag), "-", "_")
|
||||
if _, hasKey := c.extraTags[dir]; !hasKey {
|
||||
c.extraTags[dir] = make(map[string]struct{})
|
||||
}
|
||||
c.extraTags[dir][path.Base(tag)] = struct{}{}
|
||||
}
|
||||
|
||||
switch c.Transport {
|
||||
case "tcp":
|
||||
// TCP dialout server accept routine
|
||||
c.wg.Add(1)
|
||||
go func() {
|
||||
c.acceptTCPClients()
|
||||
c.wg.Done()
|
||||
}()
|
||||
|
||||
case "grpc":
|
||||
var opts []grpc.ServerOption
|
||||
tlsConfig, err := c.ServerConfig.TLSConfig()
|
||||
if err != nil {
|
||||
c.listener.Close()
|
||||
return err
|
||||
} else if tlsConfig != nil {
|
||||
opts = append(opts, grpc.Creds(credentials.NewTLS(tlsConfig)))
|
||||
}
|
||||
|
||||
if c.MaxMsgSize > 0 {
|
||||
opts = append(opts, grpc.MaxRecvMsgSize(c.MaxMsgSize))
|
||||
}
|
||||
|
||||
if c.EnforcementPolicy.PermitKeepaliveWithoutCalls ||
|
||||
(c.EnforcementPolicy.KeepaliveMinTime != 0 && c.EnforcementPolicy.KeepaliveMinTime != defaultKeepaliveMinTime) {
|
||||
// Only set if either parameter does not match defaults
|
||||
opts = append(opts, grpc.KeepaliveEnforcementPolicy(keepalive.EnforcementPolicy{
|
||||
MinTime: time.Duration(c.EnforcementPolicy.KeepaliveMinTime),
|
||||
PermitWithoutStream: c.EnforcementPolicy.PermitKeepaliveWithoutCalls,
|
||||
}))
|
||||
}
|
||||
|
||||
c.grpcServer = grpc.NewServer(opts...)
|
||||
mdtdialout.RegisterGRPCMdtDialoutServer(c.grpcServer, c)
|
||||
|
||||
c.wg.Add(1)
|
||||
go func() {
|
||||
if err := c.grpcServer.Serve(c.listener); err != nil {
|
||||
c.Log.Errorf("serving GRPC server failed: %v", err)
|
||||
}
|
||||
c.wg.Done()
|
||||
}()
|
||||
|
||||
default:
|
||||
c.listener.Close()
|
||||
return fmt.Errorf("invalid Cisco MDT transport: %s", c.Transport)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (*CiscoTelemetryMDT) Gather(telegraf.Accumulator) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Stop listener and cleanup
|
||||
func (c *CiscoTelemetryMDT) Stop() {
|
||||
if c.grpcServer != nil {
|
||||
// Stop server and terminate all running dialout routines
|
||||
c.grpcServer.Stop()
|
||||
}
|
||||
if c.listener != nil {
|
||||
c.listener.Close()
|
||||
}
|
||||
c.wg.Wait()
|
||||
}
|
||||
|
||||
// MdtDialout RPC server method for grpc-dialout transport
|
||||
func (c *CiscoTelemetryMDT) MdtDialout(stream mdtdialout.GRPCMdtDialout_MdtDialoutServer) error {
|
||||
peerInCtx, peerOK := peer.FromContext(stream.Context())
|
||||
if peerOK {
|
||||
c.Log.Debugf("Accepted Cisco MDT GRPC dialout connection from %s", peerInCtx.Addr)
|
||||
}
|
||||
|
||||
var chunkBuffer bytes.Buffer
|
||||
|
||||
for {
|
||||
packet, err := stream.Recv()
|
||||
if err != nil {
|
||||
if !errors.Is(err, io.EOF) {
|
||||
c.acc.AddError(fmt.Errorf("receive error during GRPC dialout: %w", err))
|
||||
}
|
||||
break
|
||||
}
|
||||
|
||||
if len(packet.Data) == 0 && len(packet.Errors) != 0 {
|
||||
c.acc.AddError(fmt.Errorf("error during GRPC dialout: %s", packet.Errors))
|
||||
break
|
||||
}
|
||||
|
||||
// Reassemble chunked telemetry data received from NX-OS
|
||||
if packet.TotalSize == 0 {
|
||||
c.handleTelemetry(packet.Data)
|
||||
} else if int(packet.TotalSize) <= c.MaxMsgSize {
|
||||
chunkBuffer.Write(packet.Data)
|
||||
if chunkBuffer.Len() >= int(packet.TotalSize) {
|
||||
c.handleTelemetry(chunkBuffer.Bytes())
|
||||
chunkBuffer.Reset()
|
||||
}
|
||||
} else {
|
||||
c.acc.AddError(fmt.Errorf("dropped too large packet: %dB > %dB", packet.TotalSize, c.MaxMsgSize))
|
||||
}
|
||||
}
|
||||
|
||||
if peerOK {
|
||||
c.Log.Debugf("Closed Cisco MDT GRPC dialout connection from %s", peerInCtx.Addr)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// acceptTCPClients defines the TCP dialout server main routine
|
||||
func (c *CiscoTelemetryMDT) acceptTCPClients() {
|
||||
// Keep track of all active connections, so we can close them if necessary
|
||||
var mutex sync.Mutex
|
||||
clients := make(map[net.Conn]struct{})
|
||||
|
||||
for {
|
||||
conn, err := c.listener.Accept()
|
||||
var neterr *net.OpError
|
||||
if errors.As(err, &neterr) && (neterr.Timeout() || neterr.Temporary()) {
|
||||
continue
|
||||
} else if err != nil {
|
||||
break // Stop() will close the connection so Accept() will fail here
|
||||
}
|
||||
|
||||
mutex.Lock()
|
||||
clients[conn] = struct{}{}
|
||||
mutex.Unlock()
|
||||
|
||||
// Individual client connection routine
|
||||
c.wg.Add(1)
|
||||
go func() {
|
||||
c.Log.Debugf("Accepted Cisco MDT TCP dialout connection from %s", conn.RemoteAddr())
|
||||
err := c.handleTCPClient(conn)
|
||||
if err != nil {
|
||||
c.acc.AddError(err)
|
||||
}
|
||||
c.Log.Debugf("Closed Cisco MDT TCP dialout connection from %s", conn.RemoteAddr())
|
||||
|
||||
mutex.Lock()
|
||||
delete(clients, conn)
|
||||
mutex.Unlock()
|
||||
|
||||
if err := conn.Close(); err != nil {
|
||||
c.Log.Warnf("closing connection failed: %v", err)
|
||||
}
|
||||
c.wg.Done()
|
||||
}()
|
||||
}
|
||||
|
||||
// Close all remaining client connections
|
||||
mutex.Lock()
|
||||
for client := range clients {
|
||||
if err := client.Close(); err != nil {
|
||||
c.Log.Errorf("Failed to close TCP dialout client: %v", err)
|
||||
}
|
||||
}
|
||||
mutex.Unlock()
|
||||
}
|
||||
|
||||
// Handle a TCP telemetry client
|
||||
func (c *CiscoTelemetryMDT) handleTCPClient(conn net.Conn) error {
|
||||
// TCP Dialout telemetry framing header
|
||||
var hdr struct {
|
||||
MsgType uint16
|
||||
MsgEncap uint16
|
||||
MsgHdrVersion uint16
|
||||
MsgFlags uint16
|
||||
MsgLen uint32
|
||||
}
|
||||
|
||||
var payload bytes.Buffer
|
||||
|
||||
for {
|
||||
// Read and validate dialout telemetry header
|
||||
if err := binary.Read(conn, binary.BigEndian, &hdr); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
maxMsgSize := tcpMaxMsgLen
|
||||
if c.MaxMsgSize > 0 {
|
||||
maxMsgSize = uint32(c.MaxMsgSize)
|
||||
}
|
||||
|
||||
if hdr.MsgLen > maxMsgSize {
|
||||
return fmt.Errorf("dialout packet too long: %v", hdr.MsgLen)
|
||||
} else if hdr.MsgFlags != 0 {
|
||||
return fmt.Errorf("invalid dialout flags: %v", hdr.MsgFlags)
|
||||
}
|
||||
|
||||
// Read and handle telemetry packet
|
||||
payload.Reset()
|
||||
if size, err := payload.ReadFrom(io.LimitReader(conn, int64(hdr.MsgLen))); size != int64(hdr.MsgLen) {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return errors.New("premature EOF during TCP dialout")
|
||||
}
|
||||
|
||||
c.handleTelemetry(payload.Bytes())
|
||||
}
|
||||
}
|
||||
|
||||
// Handle telemetry packet from any transport, decode and add as measurement
|
||||
func (c *CiscoTelemetryMDT) handleTelemetry(data []byte) {
|
||||
msg := &telemetry.Telemetry{}
|
||||
err := proto.Unmarshal(data, msg)
|
||||
if err != nil {
|
||||
c.acc.AddError(fmt.Errorf("failed to decode: %w: %s", err, msg.String()))
|
||||
return
|
||||
}
|
||||
|
||||
grouper := metric.NewSeriesGrouper()
|
||||
for _, gpbkv := range msg.DataGpbkv {
|
||||
// Produce metadata tags
|
||||
var tags map[string]string
|
||||
|
||||
// Top-level field may have measurement timestamp, if not use message timestamp
|
||||
measured := gpbkv.Timestamp
|
||||
if measured == 0 {
|
||||
measured = msg.MsgTimestamp
|
||||
}
|
||||
|
||||
timestamp := time.Unix(int64(measured/1000), int64(measured%1000)*1000000)
|
||||
|
||||
// Find toplevel GPBKV fields "keys" and "content"
|
||||
var keys, content *telemetry.TelemetryField = nil, nil
|
||||
for _, field := range gpbkv.Fields {
|
||||
if field.Name == "keys" {
|
||||
keys = field
|
||||
} else if field.Name == "content" {
|
||||
content = field
|
||||
}
|
||||
}
|
||||
|
||||
if content == nil && !c.IncludeDeleteField {
|
||||
c.Log.Debug("Message skipped because no content found and include of delete field not enabled")
|
||||
continue
|
||||
}
|
||||
|
||||
if keys != nil {
|
||||
tags = make(map[string]string, len(keys.Fields)+3)
|
||||
for _, subfield := range keys.Fields {
|
||||
c.parseKeyField(tags, subfield, "")
|
||||
}
|
||||
// If incoming MDT contains source key, copy to mdt_src
|
||||
if _, ok := tags["source"]; ok {
|
||||
tags[c.SourceFieldName] = tags["source"]
|
||||
}
|
||||
} else {
|
||||
tags = make(map[string]string, 3)
|
||||
}
|
||||
// Parse keys
|
||||
tags["source"] = msg.GetNodeIdStr()
|
||||
if msgID := msg.GetSubscriptionIdStr(); msgID != "" {
|
||||
tags["subscription"] = msgID
|
||||
}
|
||||
encodingPath := msg.GetEncodingPath()
|
||||
tags["path"] = encodingPath
|
||||
|
||||
if content != nil {
|
||||
// Parse values
|
||||
for _, subfield := range content.Fields {
|
||||
prefix := ""
|
||||
switch subfield.Name {
|
||||
case "operation-metric":
|
||||
if len(subfield.Fields[0].Fields) > 0 {
|
||||
prefix = subfield.Fields[0].Fields[0].GetStringValue()
|
||||
}
|
||||
case "class-stats":
|
||||
if len(subfield.Fields[0].Fields) > 1 {
|
||||
prefix = subfield.Fields[0].Fields[1].GetStringValue()
|
||||
}
|
||||
}
|
||||
c.parseContentField(grouper, subfield, prefix, encodingPath, tags, timestamp)
|
||||
}
|
||||
}
|
||||
if c.IncludeDeleteField {
|
||||
grouper.Add(c.getMeasurementName(encodingPath), tags, timestamp, "delete", gpbkv.GetDelete())
|
||||
}
|
||||
|
||||
if content == nil {
|
||||
continue
|
||||
}
|
||||
|
||||
// Parse values
|
||||
for _, subfield := range content.Fields {
|
||||
c.parseContentField(grouper, subfield, "", encodingPath, tags, timestamp)
|
||||
}
|
||||
}
|
||||
|
||||
for _, groupedMetric := range grouper.Metrics() {
|
||||
c.acc.AddMetric(groupedMetric)
|
||||
}
|
||||
}
|
||||
|
||||
func decodeValue(field *telemetry.TelemetryField) interface{} {
|
||||
switch val := field.ValueByType.(type) {
|
||||
case *telemetry.TelemetryField_BytesValue:
|
||||
return val.BytesValue
|
||||
case *telemetry.TelemetryField_StringValue:
|
||||
if len(val.StringValue) > 0 {
|
||||
return val.StringValue
|
||||
}
|
||||
case *telemetry.TelemetryField_BoolValue:
|
||||
return val.BoolValue
|
||||
case *telemetry.TelemetryField_Uint32Value:
|
||||
return val.Uint32Value
|
||||
case *telemetry.TelemetryField_Uint64Value:
|
||||
return val.Uint64Value
|
||||
case *telemetry.TelemetryField_Sint32Value:
|
||||
return val.Sint32Value
|
||||
case *telemetry.TelemetryField_Sint64Value:
|
||||
return val.Sint64Value
|
||||
case *telemetry.TelemetryField_DoubleValue:
|
||||
return val.DoubleValue
|
||||
case *telemetry.TelemetryField_FloatValue:
|
||||
return val.FloatValue
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func decodeTag(field *telemetry.TelemetryField) string {
|
||||
switch val := field.ValueByType.(type) {
|
||||
case *telemetry.TelemetryField_BytesValue:
|
||||
return string(val.BytesValue)
|
||||
case *telemetry.TelemetryField_StringValue:
|
||||
return val.StringValue
|
||||
case *telemetry.TelemetryField_BoolValue:
|
||||
if val.BoolValue {
|
||||
return "true"
|
||||
}
|
||||
return "false"
|
||||
case *telemetry.TelemetryField_Uint32Value:
|
||||
return strconv.FormatUint(uint64(val.Uint32Value), 10)
|
||||
case *telemetry.TelemetryField_Uint64Value:
|
||||
return strconv.FormatUint(val.Uint64Value, 10)
|
||||
case *telemetry.TelemetryField_Sint32Value:
|
||||
return strconv.FormatInt(int64(val.Sint32Value), 10)
|
||||
case *telemetry.TelemetryField_Sint64Value:
|
||||
return strconv.FormatInt(val.Sint64Value, 10)
|
||||
case *telemetry.TelemetryField_DoubleValue:
|
||||
return strconv.FormatFloat(val.DoubleValue, 'f', -1, 64)
|
||||
case *telemetry.TelemetryField_FloatValue:
|
||||
return strconv.FormatFloat(float64(val.FloatValue), 'f', -1, 32)
|
||||
default:
|
||||
return ""
|
||||
}
|
||||
}
|
||||
|
||||
// Recursively parse tag fields
|
||||
func (c *CiscoTelemetryMDT) parseKeyField(tags map[string]string, field *telemetry.TelemetryField, prefix string) {
|
||||
localname := strings.ReplaceAll(field.Name, "-", "_")
|
||||
name := localname
|
||||
if len(localname) == 0 {
|
||||
name = prefix
|
||||
} else if len(prefix) > 0 {
|
||||
name = prefix + "/" + localname
|
||||
}
|
||||
|
||||
if tag := decodeTag(field); len(name) > 0 && len(tag) > 0 {
|
||||
if _, exists := tags[localname]; !exists { // Use short keys whenever possible
|
||||
tags[localname] = tag
|
||||
} else {
|
||||
tags[name] = tag
|
||||
}
|
||||
}
|
||||
|
||||
for _, subfield := range field.Fields {
|
||||
c.parseKeyField(tags, subfield, name)
|
||||
}
|
||||
}
|
||||
|
||||
func parseRib(grouper *metric.SeriesGrouper, field *telemetry.TelemetryField,
|
||||
encodingPath string, tags map[string]string, timestamp time.Time) {
|
||||
// RIB
|
||||
measurement := encodingPath
|
||||
for _, subfield := range field.Fields {
|
||||
// For Every table fill the keys which are vrfName, address and masklen
|
||||
switch subfield.Name {
|
||||
case "vrfName", "address", "maskLen":
|
||||
tags[subfield.Name] = decodeTag(subfield)
|
||||
}
|
||||
if value := decodeValue(subfield); value != nil {
|
||||
grouper.Add(measurement, tags, timestamp, subfield.Name, value)
|
||||
}
|
||||
if subfield.Name != "nextHop" {
|
||||
continue
|
||||
}
|
||||
// For next hop table fill the keys in the tag - which is address and vrfname
|
||||
for _, subf := range subfield.Fields {
|
||||
for _, ff := range subf.Fields {
|
||||
switch ff.Name {
|
||||
case "address", "vrfName":
|
||||
key := "nextHop/" + ff.Name
|
||||
tags[key] = decodeTag(ff)
|
||||
}
|
||||
if value := decodeValue(ff); value != nil {
|
||||
name := "nextHop/" + ff.Name
|
||||
grouper.Add(measurement, tags, timestamp, name, value)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func parseMicroburst(grouper *metric.SeriesGrouper, field *telemetry.TelemetryField,
|
||||
encodingPath string, tags map[string]string, timestamp time.Time) {
|
||||
var nxMicro *telemetry.TelemetryField
|
||||
var nxMicro1 *telemetry.TelemetryField
|
||||
// Microburst
|
||||
measurement := encodingPath
|
||||
if len(field.Fields) > 3 {
|
||||
nxMicro = field.Fields[2]
|
||||
if len(nxMicro.Fields) > 0 {
|
||||
nxMicro1 = nxMicro.Fields[0]
|
||||
if len(nxMicro1.Fields) >= 3 {
|
||||
nxMicro = nxMicro1.Fields[3]
|
||||
}
|
||||
}
|
||||
}
|
||||
for _, subfield := range nxMicro.Fields {
|
||||
if subfield.Name == "interfaceName" {
|
||||
tags[subfield.Name] = decodeTag(subfield)
|
||||
}
|
||||
|
||||
for _, subf := range subfield.Fields {
|
||||
switch subf.Name {
|
||||
case "sourceName":
|
||||
newstr := strings.Split(decodeTag(subf), "-[")
|
||||
if len(newstr) <= 2 {
|
||||
tags[subf.Name] = decodeTag(subf)
|
||||
} else {
|
||||
intfName := strings.Split(newstr[1], "]")
|
||||
queue := strings.Split(newstr[2], "]")
|
||||
tags["interface_name"] = intfName[0]
|
||||
tags["queue_number"] = queue[0]
|
||||
}
|
||||
case "startTs":
|
||||
tags[subf.Name] = decodeTag(subf)
|
||||
}
|
||||
if value := decodeValue(subf); value != nil {
|
||||
grouper.Add(measurement, tags, timestamp, subf.Name, value)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (c *CiscoTelemetryMDT) parseClassAttributeField(grouper *metric.SeriesGrouper, field *telemetry.TelemetryField,
|
||||
encodingPath string, tags map[string]string, timestamp time.Time) {
|
||||
// DME structure: https://developer.cisco.com/site/nxapi-dme-model-reference-api/
|
||||
var nxAttributes *telemetry.TelemetryField
|
||||
isDme := strings.Contains(encodingPath, "sys/")
|
||||
if encodingPath == "rib" {
|
||||
// handle native data path rib
|
||||
parseRib(grouper, field, encodingPath, tags, timestamp)
|
||||
return
|
||||
}
|
||||
if encodingPath == "microburst" {
|
||||
// dump microburst
|
||||
parseMicroburst(grouper, field, encodingPath, tags, timestamp)
|
||||
return
|
||||
}
|
||||
if field == nil || !isDme || len(field.Fields) == 0 || len(field.Fields[0].Fields) == 0 || len(field.Fields[0].Fields[0].Fields) == 0 {
|
||||
return
|
||||
}
|
||||
|
||||
if field.Fields[0] != nil && field.Fields[0].Fields != nil && field.Fields[0].Fields[0] != nil && field.Fields[0].Fields[0].Fields[0].Name != "attributes" {
|
||||
return
|
||||
}
|
||||
nxAttributes = field.Fields[0].Fields[0].Fields[0].Fields[0]
|
||||
|
||||
// Find dn tag among list of attributes
|
||||
for _, subfield := range nxAttributes.Fields {
|
||||
if subfield.Name == "dn" {
|
||||
tags["dn"] = decodeTag(subfield)
|
||||
break
|
||||
}
|
||||
}
|
||||
// Add attributes to grouper with consistent dn tag
|
||||
for _, subfield := range nxAttributes.Fields {
|
||||
c.parseContentField(grouper, subfield, "", encodingPath, tags, timestamp)
|
||||
}
|
||||
// Delete dn tag to prevent it from being added to the next node's attributes
|
||||
delete(tags, "dn")
|
||||
}
|
||||
|
||||
func (c *CiscoTelemetryMDT) getMeasurementName(encodingPath string) string {
|
||||
// Do alias lookup, to shorten measurement names
|
||||
measurement := encodingPath
|
||||
if alias, ok := c.internalAliases[encodingPath]; ok {
|
||||
measurement = alias
|
||||
} else {
|
||||
c.mutex.Lock()
|
||||
if _, haveWarned := c.warned[encodingPath]; !haveWarned {
|
||||
c.Log.Debugf("No measurement alias for encoding path: %s", encodingPath)
|
||||
c.warned[encodingPath] = struct{}{}
|
||||
}
|
||||
c.mutex.Unlock()
|
||||
}
|
||||
return measurement
|
||||
}
|
||||
|
||||
func (c *CiscoTelemetryMDT) parseContentField(
|
||||
grouper *metric.SeriesGrouper,
|
||||
field *telemetry.TelemetryField,
|
||||
prefix, encodingPath string,
|
||||
tags map[string]string,
|
||||
timestamp time.Time,
|
||||
) {
|
||||
name := strings.ReplaceAll(field.Name, "-", "_")
|
||||
|
||||
if (name == "modTs" || name == "createTs") && decodeValue(field) == "never" {
|
||||
return
|
||||
}
|
||||
if len(name) == 0 {
|
||||
name = prefix
|
||||
} else if len(prefix) > 0 {
|
||||
name = prefix + "/" + name
|
||||
}
|
||||
|
||||
extraTags := c.extraTags[strings.ReplaceAll(encodingPath, "-", "_")+"/"+name]
|
||||
|
||||
if value := decodeValue(field); value != nil {
|
||||
measurement := c.getMeasurementName(encodingPath)
|
||||
if val := c.nxosValueXform(field, value, encodingPath); val != nil {
|
||||
grouper.Add(measurement, tags, timestamp, name, val)
|
||||
} else {
|
||||
grouper.Add(measurement, tags, timestamp, name, value)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
if len(extraTags) > 0 {
|
||||
for _, subfield := range field.Fields {
|
||||
if _, isExtraTag := extraTags[subfield.Name]; isExtraTag {
|
||||
tags[name+"/"+strings.ReplaceAll(subfield.Name, "-", "_")] = decodeTag(subfield)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var nxAttributes, nxChildren, nxRows *telemetry.TelemetryField
|
||||
isNXOS := !strings.ContainsRune(encodingPath, ':') // IOS-XR and IOS-XE have a colon in their encoding path, NX-OS does not
|
||||
isEVENT := isNXOS && strings.Contains(encodingPath, "EVENT-LIST")
|
||||
nxChildren = nil
|
||||
nxAttributes = nil
|
||||
for _, subfield := range field.Fields {
|
||||
if isNXOS && subfield.Name == "attributes" && len(subfield.Fields) > 0 {
|
||||
nxAttributes = subfield.Fields[0]
|
||||
} else if isNXOS && subfield.Name == "children" && len(subfield.Fields) > 0 {
|
||||
if !isEVENT {
|
||||
nxChildren = subfield
|
||||
} else {
|
||||
sub := subfield.Fields
|
||||
if len(sub) > 0 && sub[0] != nil && sub[0].Fields[0].Name == "subscriptionId" && len(sub[0].Fields) >= 2 {
|
||||
nxAttributes = sub[0].Fields[1].Fields[0].Fields[0].Fields[0].Fields[0].Fields[0]
|
||||
}
|
||||
}
|
||||
// if nxAttributes == NULL then class based query.
|
||||
if nxAttributes == nil {
|
||||
// call function walking over walking list.
|
||||
for _, sub := range subfield.Fields {
|
||||
c.parseClassAttributeField(grouper, sub, encodingPath, tags, timestamp)
|
||||
}
|
||||
}
|
||||
} else if isNXOS && strings.HasPrefix(subfield.Name, "ROW_") {
|
||||
nxRows = subfield
|
||||
} else if _, isExtraTag := extraTags[subfield.Name]; !isExtraTag { // Regular telemetry decoding
|
||||
c.parseContentField(grouper, subfield, name, encodingPath, tags, timestamp)
|
||||
}
|
||||
}
|
||||
|
||||
if nxAttributes == nil && nxRows == nil {
|
||||
return
|
||||
} else if nxRows != nil {
|
||||
// NXAPI structure: https://developer.cisco.com/docs/cisco-nexus-9000-series-nx-api-cli-reference-release-9-2x/
|
||||
for _, row := range nxRows.Fields {
|
||||
for i, subfield := range row.Fields {
|
||||
if i == 0 { // First subfield contains the index, promote it from value to tag
|
||||
tags[prefix] = decodeTag(subfield)
|
||||
// We can have subfield so recursively handle it.
|
||||
if len(row.Fields) == 1 {
|
||||
tags["row_number"] = strconv.FormatInt(int64(i), 10)
|
||||
c.parseContentField(grouper, subfield, "", encodingPath, tags, timestamp)
|
||||
}
|
||||
} else {
|
||||
c.parseContentField(grouper, subfield, "", encodingPath, tags, timestamp)
|
||||
}
|
||||
// Nxapi we can't identify keys always from prefix
|
||||
tags["row_number"] = strconv.FormatInt(int64(i), 10)
|
||||
}
|
||||
delete(tags, prefix)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DME structure: https://developer.cisco.com/site/nxapi-dme-model-reference-api/
|
||||
rn := ""
|
||||
dn := false
|
||||
|
||||
for _, subfield := range nxAttributes.Fields {
|
||||
if subfield.Name == "rn" {
|
||||
rn = decodeTag(subfield)
|
||||
} else if subfield.Name == "dn" {
|
||||
dn = true
|
||||
}
|
||||
}
|
||||
|
||||
if len(rn) > 0 {
|
||||
tags[prefix] = rn
|
||||
} else if !dn { // Check for distinguished name being present
|
||||
c.acc.AddError(errors.New("failed while decoding NX-OS: missing 'dn' field"))
|
||||
return
|
||||
}
|
||||
|
||||
for _, subfield := range nxAttributes.Fields {
|
||||
if subfield.Name != "rn" {
|
||||
c.parseContentField(grouper, subfield, "", encodingPath, tags, timestamp)
|
||||
}
|
||||
}
|
||||
|
||||
if nxChildren != nil {
|
||||
// This is a nested structure, children will inherit relative name keys of parent
|
||||
for _, subfield := range nxChildren.Fields {
|
||||
c.parseContentField(grouper, subfield, prefix, encodingPath, tags, timestamp)
|
||||
}
|
||||
}
|
||||
delete(tags, prefix)
|
||||
}
|
||||
|
||||
func init() {
|
||||
inputs.Add("cisco_telemetry_mdt", func() telegraf.Input {
|
||||
return &CiscoTelemetryMDT{
|
||||
Transport: "grpc",
|
||||
ServiceAddress: "127.0.0.1:57000",
|
||||
SourceFieldName: "mdt_source",
|
||||
}
|
||||
})
|
||||
}
|
1381
plugins/inputs/cisco_telemetry_mdt/cisco_telemetry_mdt_test.go
Normal file
1381
plugins/inputs/cisco_telemetry_mdt/cisco_telemetry_mdt_test.go
Normal file
File diff suppressed because it is too large
Load diff
876
plugins/inputs/cisco_telemetry_mdt/cisco_telemetry_util.go
Normal file
876
plugins/inputs/cisco_telemetry_mdt/cisco_telemetry_util.go
Normal file
|
@ -0,0 +1,876 @@
|
|||
package cisco_telemetry_mdt
|
||||
|
||||
import (
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
telemetry "github.com/cisco-ie/nx-telemetry-proto/telemetry_bis"
|
||||
)
|
||||
|
||||
// xform Field to string
|
||||
func xformValueString(field *telemetry.TelemetryField) string {
|
||||
var str string
|
||||
switch val := field.ValueByType.(type) {
|
||||
case *telemetry.TelemetryField_StringValue:
|
||||
if len(val.StringValue) > 0 {
|
||||
return val.StringValue
|
||||
}
|
||||
case *telemetry.TelemetryField_Uint32Value:
|
||||
str = strconv.FormatUint(uint64(val.Uint32Value), 10)
|
||||
return str
|
||||
case *telemetry.TelemetryField_Uint64Value:
|
||||
str = strconv.FormatUint(val.Uint64Value, 10)
|
||||
return str
|
||||
case *telemetry.TelemetryField_Sint32Value:
|
||||
str = strconv.FormatInt(int64(val.Sint32Value), 10)
|
||||
return str
|
||||
case *telemetry.TelemetryField_Sint64Value:
|
||||
str = strconv.FormatInt(val.Sint64Value, 10)
|
||||
return str
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
// xform Uint64 to int64
|
||||
func nxosValueXformUint64Toint64(field *telemetry.TelemetryField, value interface{}) interface{} {
|
||||
if field.GetUint64Value() != 0 {
|
||||
return int64(value.(uint64))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// xform string to float
|
||||
func nxosValueXformStringTofloat(field *telemetry.TelemetryField, _ interface{}) interface{} {
|
||||
// convert property to float from string.
|
||||
vals := field.GetStringValue()
|
||||
if vals != "" {
|
||||
if valf, err := strconv.ParseFloat(vals, 64); err == nil {
|
||||
return valf
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// xform string to uint64
|
||||
func nxosValueXformStringToUint64(field *telemetry.TelemetryField, _ interface{}) interface{} {
|
||||
// string to uint64
|
||||
vals := field.GetStringValue()
|
||||
if vals != "" {
|
||||
if val64, err := strconv.ParseUint(vals, 10, 64); err == nil {
|
||||
return val64
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// xform string to int64
|
||||
func nxosValueXformStringToInt64(field *telemetry.TelemetryField, _ interface{}) interface{} {
|
||||
// string to int64
|
||||
vals := field.GetStringValue()
|
||||
if vals != "" {
|
||||
if val64, err := strconv.ParseInt(vals, 10, 64); err == nil {
|
||||
return val64
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// auto-xform float properties
|
||||
func nxosValueAutoXformFloatProp(field *telemetry.TelemetryField, _ interface{}) interface{} {
|
||||
// check if we want auto xformation
|
||||
vals := field.GetStringValue()
|
||||
if vals != "" {
|
||||
if valf, err := strconv.ParseFloat(vals, 64); err == nil {
|
||||
return valf
|
||||
}
|
||||
} // switch
|
||||
return nil
|
||||
}
|
||||
|
||||
// xform uint64 to string
|
||||
func nxosValueXformUint64ToString(field *telemetry.TelemetryField, _ interface{}) interface{} {
|
||||
switch val := field.ValueByType.(type) {
|
||||
case *telemetry.TelemetryField_StringValue:
|
||||
if len(val.StringValue) > 0 {
|
||||
return val.StringValue
|
||||
}
|
||||
case *telemetry.TelemetryField_Uint64Value:
|
||||
return strconv.FormatUint(val.Uint64Value, 10)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Xform value field.
|
||||
func (c *CiscoTelemetryMDT) nxosValueXform(field *telemetry.TelemetryField, value interface{}, path string) interface{} {
|
||||
if strings.ContainsRune(path, ':') {
|
||||
// not NXOS
|
||||
return nil
|
||||
}
|
||||
if _, ok := c.propMap[field.Name]; ok {
|
||||
return c.propMap[field.Name](field, value)
|
||||
}
|
||||
// check if we want auto xformation
|
||||
if _, ok := c.propMap["auto-prop-xfromi"]; ok {
|
||||
return c.propMap["auto-prop-xfrom"](field, value)
|
||||
}
|
||||
// Now check path based conversion.
|
||||
// If mapping is found then do the required transformation.
|
||||
if c.nxpathMap[path] == nil {
|
||||
return nil
|
||||
}
|
||||
switch c.nxpathMap[path][field.Name] {
|
||||
// Xformation supported is only from String, Uint32 and Uint64
|
||||
case "integer":
|
||||
switch val := field.ValueByType.(type) {
|
||||
case *telemetry.TelemetryField_StringValue:
|
||||
if vali, err := strconv.ParseInt(val.StringValue, 10, 32); err == nil {
|
||||
return vali
|
||||
}
|
||||
case *telemetry.TelemetryField_Uint32Value:
|
||||
vali, ok := value.(uint32)
|
||||
if ok {
|
||||
return vali
|
||||
}
|
||||
case *telemetry.TelemetryField_Uint64Value:
|
||||
vali, ok := value.(uint64)
|
||||
if ok {
|
||||
return vali
|
||||
}
|
||||
} // switch
|
||||
return nil
|
||||
// Xformation supported is only from String
|
||||
case "float":
|
||||
//nolint:revive // switch needed for `.(type)`
|
||||
switch val := field.ValueByType.(type) {
|
||||
case *telemetry.TelemetryField_StringValue:
|
||||
if valf, err := strconv.ParseFloat(val.StringValue, 64); err == nil {
|
||||
return valf
|
||||
}
|
||||
} //switch
|
||||
return nil
|
||||
case "string":
|
||||
return xformValueString(field)
|
||||
case "int64":
|
||||
switch val := field.ValueByType.(type) {
|
||||
case *telemetry.TelemetryField_StringValue:
|
||||
if vali, err := strconv.ParseInt(val.StringValue, 10, 64); err == nil {
|
||||
return vali
|
||||
}
|
||||
case *telemetry.TelemetryField_Uint64Value:
|
||||
return int64(value.(uint64))
|
||||
} // switch
|
||||
} // switch
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *CiscoTelemetryMDT) initMemPhys() {
|
||||
c.nxpathMap["show processes memory physical"] = map[string]string{"processname": "string"}
|
||||
}
|
||||
|
||||
func (c *CiscoTelemetryMDT) initBgpV4() {
|
||||
key := "show bgp ipv4 unicast"
|
||||
c.nxpathMap[key] = make(map[string]string, 1)
|
||||
c.nxpathMap[key]["aspath"] = "string"
|
||||
}
|
||||
|
||||
func (c *CiscoTelemetryMDT) initCPU() {
|
||||
key := "show processes cpu"
|
||||
c.nxpathMap[key] = make(map[string]string, 5)
|
||||
c.nxpathMap[key]["kernel_percent"] = "float"
|
||||
c.nxpathMap[key]["idle_percent"] = "float"
|
||||
c.nxpathMap[key]["process"] = "string"
|
||||
c.nxpathMap[key]["user_percent"] = "float"
|
||||
c.nxpathMap[key]["onesec"] = "float"
|
||||
}
|
||||
|
||||
func (c *CiscoTelemetryMDT) initResources() {
|
||||
key := "show system resources"
|
||||
c.nxpathMap[key] = make(map[string]string, 20)
|
||||
c.nxpathMap[key]["cpu_state_user"] = "float"
|
||||
c.nxpathMap[key]["kernel"] = "float"
|
||||
c.nxpathMap[key]["current_memory_status"] = "string"
|
||||
c.nxpathMap[key]["load_avg_15min"] = "float"
|
||||
c.nxpathMap[key]["idle"] = "float"
|
||||
c.nxpathMap[key]["load_avg_1min"] = "float"
|
||||
c.nxpathMap[key]["user"] = "float"
|
||||
c.nxpathMap[key]["cpu_state_idle"] = "float"
|
||||
c.nxpathMap[key]["load_avg_5min"] = "float"
|
||||
c.nxpathMap[key]["cpu_state_kernel"] = "float"
|
||||
}
|
||||
|
||||
func (c *CiscoTelemetryMDT) initPower() {
|
||||
key := "show environment power"
|
||||
c.nxpathMap[key] = make(map[string]string, 100)
|
||||
c.nxpathMap[key]["reserve_sup"] = "string"
|
||||
c.nxpathMap[key]["det_volt"] = "string"
|
||||
c.nxpathMap[key]["heatsink_temp"] = "string"
|
||||
c.nxpathMap[key]["det_pintot"] = "string"
|
||||
c.nxpathMap[key]["det_iinb"] = "string"
|
||||
c.nxpathMap[key]["ps_input_current"] = "string"
|
||||
c.nxpathMap[key]["modnum"] = "string"
|
||||
c.nxpathMap[key]["trayfannum"] = "string"
|
||||
c.nxpathMap[key]["modstatus_3k"] = "string"
|
||||
c.nxpathMap[key]["fan2rpm"] = "string"
|
||||
c.nxpathMap[key]["amps_alloced"] = "string"
|
||||
c.nxpathMap[key]["all_inlets_connected"] = "string"
|
||||
c.nxpathMap[key]["tot_pow_out_actual_draw"] = "string"
|
||||
c.nxpathMap[key]["ps_redun_op_mode"] = "string"
|
||||
c.nxpathMap[key]["curtemp"] = "string"
|
||||
c.nxpathMap[key]["mod_model"] = "string"
|
||||
c.nxpathMap[key]["fanmodel"] = "string"
|
||||
c.nxpathMap[key]["ps_output_current"] = "string"
|
||||
c.nxpathMap[key]["majthres"] = "string"
|
||||
c.nxpathMap[key]["input_type"] = "string"
|
||||
c.nxpathMap[key]["allocated"] = "string"
|
||||
c.nxpathMap[key]["fanhwver"] = "string"
|
||||
c.nxpathMap[key]["clkhwver"] = "string"
|
||||
c.nxpathMap[key]["fannum"] = "string"
|
||||
c.nxpathMap[key]["watts_requested"] = "string"
|
||||
c.nxpathMap[key]["cumulative_power"] = "string"
|
||||
c.nxpathMap[key]["tot_gridB_capacity"] = "string"
|
||||
c.nxpathMap[key]["pow_used_by_mods"] = "string"
|
||||
c.nxpathMap[key]["tot_pow_alloc_budgeted"] = "string"
|
||||
c.nxpathMap[key]["psumod"] = "string"
|
||||
c.nxpathMap[key]["ps_status_3k"] = "string"
|
||||
c.nxpathMap[key]["temptype"] = "string"
|
||||
c.nxpathMap[key]["regval"] = "string"
|
||||
c.nxpathMap[key]["inlet_temp"] = "string"
|
||||
c.nxpathMap[key]["det_cord"] = "string"
|
||||
c.nxpathMap[key]["reserve_fan"] = "string"
|
||||
c.nxpathMap[key]["det_pina"] = "string"
|
||||
c.nxpathMap[key]["minthres"] = "string"
|
||||
c.nxpathMap[key]["actual_draw"] = "string"
|
||||
c.nxpathMap[key]["sensor"] = "string"
|
||||
c.nxpathMap[key]["zone"] = "string"
|
||||
c.nxpathMap[key]["det_iin"] = "string"
|
||||
c.nxpathMap[key]["det_iout"] = "string"
|
||||
c.nxpathMap[key]["det_vin"] = "string"
|
||||
c.nxpathMap[key]["fan1rpm"] = "string"
|
||||
c.nxpathMap[key]["tot_gridA_capacity"] = "string"
|
||||
c.nxpathMap[key]["fanperc"] = "string"
|
||||
c.nxpathMap[key]["det_pout"] = "string"
|
||||
c.nxpathMap[key]["alarm_str"] = "string"
|
||||
c.nxpathMap[key]["zonespeed"] = "string"
|
||||
c.nxpathMap[key]["det_total_cap"] = "string"
|
||||
c.nxpathMap[key]["reserve_xbar"] = "string"
|
||||
c.nxpathMap[key]["det_vout"] = "string"
|
||||
c.nxpathMap[key]["watts_alloced"] = "string"
|
||||
c.nxpathMap[key]["ps_in_power"] = "string"
|
||||
c.nxpathMap[key]["tot_pow_input_actual_draw"] = "string"
|
||||
c.nxpathMap[key]["ps_output_voltage"] = "string"
|
||||
c.nxpathMap[key]["det_name"] = "string"
|
||||
c.nxpathMap[key]["tempmod"] = "string"
|
||||
c.nxpathMap[key]["clockname"] = "string"
|
||||
c.nxpathMap[key]["fanname"] = "string"
|
||||
c.nxpathMap[key]["regnumstr"] = "string"
|
||||
c.nxpathMap[key]["bitnumstr"] = "string"
|
||||
c.nxpathMap[key]["ps_slot"] = "string"
|
||||
c.nxpathMap[key]["actual_out"] = "string"
|
||||
c.nxpathMap[key]["ps_input_voltage"] = "string"
|
||||
c.nxpathMap[key]["psmodel"] = "string"
|
||||
c.nxpathMap[key]["speed"] = "string"
|
||||
c.nxpathMap[key]["clkmodel"] = "string"
|
||||
c.nxpathMap[key]["ps_redun_mode_3k"] = "string"
|
||||
c.nxpathMap[key]["tot_pow_capacity"] = "string"
|
||||
c.nxpathMap[key]["amps"] = "string"
|
||||
c.nxpathMap[key]["available_pow"] = "string"
|
||||
c.nxpathMap[key]["reserve_supxbarfan"] = "string"
|
||||
c.nxpathMap[key]["watts"] = "string"
|
||||
c.nxpathMap[key]["det_pinb"] = "string"
|
||||
c.nxpathMap[key]["det_vinb"] = "string"
|
||||
c.nxpathMap[key]["ps_state"] = "string"
|
||||
c.nxpathMap[key]["det_sw_alarm"] = "string"
|
||||
c.nxpathMap[key]["regnum"] = "string"
|
||||
c.nxpathMap[key]["amps_requested"] = "string"
|
||||
c.nxpathMap[key]["fanrpm"] = "string"
|
||||
c.nxpathMap[key]["actual_input"] = "string"
|
||||
c.nxpathMap[key]["outlet_temp"] = "string"
|
||||
c.nxpathMap[key]["tot_capa"] = "string"
|
||||
}
|
||||
|
||||
func (c *CiscoTelemetryMDT) initPtpCorrection() {
|
||||
key := "show ptp corrections"
|
||||
c.nxpathMap[key] = make(map[string]string, 20)
|
||||
c.nxpathMap[key]["sup-time"] = "string"
|
||||
c.nxpathMap[key]["correction-val"] = "int64"
|
||||
c.nxpathMap[key]["ptp-header"] = "string"
|
||||
c.nxpathMap[key]["intf-name"] = "string"
|
||||
c.nxpathMap[key]["ptp-end"] = "string"
|
||||
}
|
||||
|
||||
func (c *CiscoTelemetryMDT) initTrans() {
|
||||
key := "show interface transceiver details"
|
||||
c.nxpathMap[key] = make(map[string]string, 100)
|
||||
c.nxpathMap[key]["uncorrect_ber_alrm_hi"] = "string"
|
||||
c.nxpathMap[key]["uncorrect_ber_cur_warn_lo"] = "string"
|
||||
c.nxpathMap[key]["current_warn_lo"] = "float"
|
||||
c.nxpathMap[key]["pre_fec_ber_max_alrm_hi"] = "string"
|
||||
c.nxpathMap[key]["serialnum"] = "string"
|
||||
c.nxpathMap[key]["pre_fec_ber_acc_warn_lo"] = "string"
|
||||
c.nxpathMap[key]["pre_fec_ber_max_warn_lo"] = "string"
|
||||
c.nxpathMap[key]["laser_temp_warn_hi"] = "float"
|
||||
c.nxpathMap[key]["type"] = "string"
|
||||
c.nxpathMap[key]["rx_pwr_0"] = "float"
|
||||
c.nxpathMap[key]["rx_pwr_warn_hi"] = "float"
|
||||
c.nxpathMap[key]["uncorrect_ber_warn_hi"] = "string"
|
||||
c.nxpathMap[key]["qsfp_or_cfp"] = "string"
|
||||
c.nxpathMap[key]["protocol_type"] = "string"
|
||||
c.nxpathMap[key]["uncorrect_ber"] = "string"
|
||||
c.nxpathMap[key]["uncorrect_ber_cur_alrm_hi"] = "string"
|
||||
c.nxpathMap[key]["tec_current"] = "float"
|
||||
c.nxpathMap[key]["pre_fec_ber"] = "string"
|
||||
c.nxpathMap[key]["uncorrect_ber_max_warn_lo"] = "string"
|
||||
c.nxpathMap[key]["uncorrect_ber_min"] = "string"
|
||||
c.nxpathMap[key]["current_alrm_lo"] = "float"
|
||||
c.nxpathMap[key]["uncorrect_ber_acc_warn_lo"] = "string"
|
||||
c.nxpathMap[key]["snr_warn_lo"] = "float"
|
||||
c.nxpathMap[key]["rev"] = "string"
|
||||
c.nxpathMap[key]["laser_temp_alrm_lo"] = "float"
|
||||
c.nxpathMap[key]["current"] = "float"
|
||||
c.nxpathMap[key]["rx_pwr_1"] = "float"
|
||||
c.nxpathMap[key]["tec_current_warn_hi"] = "float"
|
||||
c.nxpathMap[key]["pre_fec_ber_cur_warn_lo"] = "string"
|
||||
c.nxpathMap[key]["cisco_part_number"] = "string"
|
||||
c.nxpathMap[key]["uncorrect_ber_acc_warn_hi"] = "string"
|
||||
c.nxpathMap[key]["temp_warn_hi"] = "float"
|
||||
c.nxpathMap[key]["laser_freq_warn_lo"] = "float"
|
||||
c.nxpathMap[key]["uncorrect_ber_max_alrm_lo"] = "string"
|
||||
c.nxpathMap[key]["snr_alrm_hi"] = "float"
|
||||
c.nxpathMap[key]["pre_fec_ber_cur_alrm_lo"] = "string"
|
||||
c.nxpathMap[key]["tx_pwr_alrm_hi"] = "float"
|
||||
c.nxpathMap[key]["pre_fec_ber_min_warn_lo"] = "string"
|
||||
c.nxpathMap[key]["pre_fec_ber_min_warn_hi"] = "string"
|
||||
c.nxpathMap[key]["rx_pwr_alrm_hi"] = "float"
|
||||
c.nxpathMap[key]["tec_current_warn_lo"] = "float"
|
||||
c.nxpathMap[key]["uncorrect_ber_acc_alrm_hi"] = "string"
|
||||
c.nxpathMap[key]["rx_pwr_4"] = "float"
|
||||
c.nxpathMap[key]["uncorrect_ber_cur"] = "string"
|
||||
c.nxpathMap[key]["pre_fec_ber_alrm_hi"] = "string"
|
||||
c.nxpathMap[key]["rx_pwr_warn_lo"] = "float"
|
||||
c.nxpathMap[key]["bit_encoding"] = "string"
|
||||
c.nxpathMap[key]["pre_fec_ber_acc"] = "string"
|
||||
c.nxpathMap[key]["sfp"] = "string"
|
||||
c.nxpathMap[key]["pre_fec_ber_acc_alrm_hi"] = "string"
|
||||
c.nxpathMap[key]["pre_fec_ber_min"] = "string"
|
||||
c.nxpathMap[key]["current_warn_hi"] = "float"
|
||||
c.nxpathMap[key]["pre_fec_ber_max_alrm_lo"] = "string"
|
||||
c.nxpathMap[key]["uncorrect_ber_cur_warn_hi"] = "string"
|
||||
c.nxpathMap[key]["current_alrm_hi"] = "float"
|
||||
c.nxpathMap[key]["pre_fec_ber_acc_alrm_lo"] = "string"
|
||||
c.nxpathMap[key]["snr_alrm_lo"] = "float"
|
||||
c.nxpathMap[key]["uncorrect_ber_acc"] = "string"
|
||||
c.nxpathMap[key]["tx_len"] = "string"
|
||||
c.nxpathMap[key]["uncorrect_ber_alrm_lo"] = "string"
|
||||
c.nxpathMap[key]["pre_fec_ber_alrm_lo"] = "string"
|
||||
c.nxpathMap[key]["txcvr_type"] = "string"
|
||||
c.nxpathMap[key]["tec_current_alrm_lo"] = "float"
|
||||
c.nxpathMap[key]["volt_alrm_lo"] = "float"
|
||||
c.nxpathMap[key]["temp_alrm_hi"] = "float"
|
||||
c.nxpathMap[key]["uncorrect_ber_min_warn_lo"] = "string"
|
||||
c.nxpathMap[key]["laser_freq"] = "float"
|
||||
c.nxpathMap[key]["uncorrect_ber_min_warn_hi"] = "string"
|
||||
c.nxpathMap[key]["uncorrect_ber_cur_alrm_lo"] = "string"
|
||||
c.nxpathMap[key]["pre_fec_ber_max_warn_hi"] = "string"
|
||||
c.nxpathMap[key]["name"] = "string"
|
||||
c.nxpathMap[key]["fiber_type_byte0"] = "string"
|
||||
c.nxpathMap[key]["laser_freq_alrm_lo"] = "float"
|
||||
c.nxpathMap[key]["pre_fec_ber_cur_warn_hi"] = "string"
|
||||
c.nxpathMap[key]["partnum"] = "string"
|
||||
c.nxpathMap[key]["snr"] = "float"
|
||||
c.nxpathMap[key]["volt_alrm_hi"] = "float"
|
||||
c.nxpathMap[key]["connector_type"] = "string"
|
||||
c.nxpathMap[key]["tx_medium"] = "string"
|
||||
c.nxpathMap[key]["tx_pwr_warn_hi"] = "float"
|
||||
c.nxpathMap[key]["cisco_vendor_id"] = "string"
|
||||
c.nxpathMap[key]["cisco_ext_id"] = "string"
|
||||
c.nxpathMap[key]["uncorrect_ber_max_warn_hi"] = "string"
|
||||
c.nxpathMap[key]["pre_fec_ber_max"] = "string"
|
||||
c.nxpathMap[key]["uncorrect_ber_min_alrm_hi"] = "string"
|
||||
c.nxpathMap[key]["pre_fec_ber_warn_hi"] = "string"
|
||||
c.nxpathMap[key]["tx_pwr_alrm_lo"] = "float"
|
||||
c.nxpathMap[key]["uncorrect_ber_warn_lo"] = "string"
|
||||
c.nxpathMap[key]["10gbe_code"] = "string"
|
||||
c.nxpathMap[key]["cable_type"] = "string"
|
||||
c.nxpathMap[key]["laser_freq_alrm_hi"] = "float"
|
||||
c.nxpathMap[key]["rx_pwr_3"] = "float"
|
||||
c.nxpathMap[key]["rx_pwr"] = "float"
|
||||
c.nxpathMap[key]["volt_warn_hi"] = "float"
|
||||
c.nxpathMap[key]["pre_fec_ber_cur_alrm_hi"] = "string"
|
||||
c.nxpathMap[key]["temperature"] = "float"
|
||||
c.nxpathMap[key]["voltage"] = "float"
|
||||
c.nxpathMap[key]["tx_pwr"] = "float"
|
||||
c.nxpathMap[key]["laser_temp_alrm_hi"] = "float"
|
||||
c.nxpathMap[key]["tx_speeds"] = "string"
|
||||
c.nxpathMap[key]["uncorrect_ber_min_alrm_lo"] = "string"
|
||||
c.nxpathMap[key]["pre_fec_ber_min_alrm_hi"] = "string"
|
||||
c.nxpathMap[key]["ciscoid"] = "string"
|
||||
c.nxpathMap[key]["tx_pwr_warn_lo"] = "float"
|
||||
c.nxpathMap[key]["cisco_product_id"] = "string"
|
||||
c.nxpathMap[key]["info_not_available"] = "string"
|
||||
c.nxpathMap[key]["laser_temp"] = "float"
|
||||
c.nxpathMap[key]["pre_fec_ber_cur"] = "string"
|
||||
c.nxpathMap[key]["fiber_type_byte1"] = "string"
|
||||
c.nxpathMap[key]["tx_type"] = "string"
|
||||
c.nxpathMap[key]["pre_fec_ber_min_alrm_lo"] = "string"
|
||||
c.nxpathMap[key]["pre_fec_ber_warn_lo"] = "string"
|
||||
c.nxpathMap[key]["temp_alrm_lo"] = "float"
|
||||
c.nxpathMap[key]["volt_warn_lo"] = "float"
|
||||
c.nxpathMap[key]["rx_pwr_alrm_lo"] = "float"
|
||||
c.nxpathMap[key]["rx_pwr_2"] = "float"
|
||||
c.nxpathMap[key]["tec_current_alrm_hi"] = "float"
|
||||
c.nxpathMap[key]["uncorrect_ber_acc_alrm_lo"] = "string"
|
||||
c.nxpathMap[key]["uncorrect_ber_max_alrm_hi"] = "string"
|
||||
c.nxpathMap[key]["temp_warn_lo"] = "float"
|
||||
c.nxpathMap[key]["snr_warn_hi"] = "float"
|
||||
c.nxpathMap[key]["laser_temp_warn_lo"] = "float"
|
||||
c.nxpathMap[key]["pre_fec_ber_acc_warn_hi"] = "string"
|
||||
c.nxpathMap[key]["laser_freq_warn_hi"] = "float"
|
||||
c.nxpathMap[key]["uncorrect_ber_max"] = "string"
|
||||
}
|
||||
|
||||
func (c *CiscoTelemetryMDT) initIgmp() {
|
||||
key := "show ip igmp groups vrf all"
|
||||
c.nxpathMap[key] = make(map[string]string, 20)
|
||||
c.nxpathMap[key]["group-type"] = "string"
|
||||
c.nxpathMap[key]["translate"] = "string"
|
||||
c.nxpathMap[key]["sourceaddress"] = "string"
|
||||
c.nxpathMap[key]["vrf-cntxt"] = "string"
|
||||
c.nxpathMap[key]["expires"] = "string"
|
||||
c.nxpathMap[key]["group-addr"] = "string"
|
||||
c.nxpathMap[key]["uptime"] = "string"
|
||||
}
|
||||
|
||||
func (c *CiscoTelemetryMDT) initVrfAll() {
|
||||
key := "show ip igmp interface vrf all"
|
||||
c.nxpathMap[key] = make(map[string]string, 20)
|
||||
c.nxpathMap[key]["if-name"] = "string"
|
||||
c.nxpathMap[key]["static-group-map"] = "string"
|
||||
c.nxpathMap[key]["rll"] = "string"
|
||||
c.nxpathMap[key]["host-proxy"] = "string"
|
||||
c.nxpathMap[key]["il"] = "string"
|
||||
c.nxpathMap[key]["join-group-map"] = "string"
|
||||
c.nxpathMap[key]["expires"] = "string"
|
||||
c.nxpathMap[key]["host-proxy-group-map"] = "string"
|
||||
c.nxpathMap[key]["next-query"] = "string"
|
||||
c.nxpathMap[key]["q-ver"] = "string"
|
||||
c.nxpathMap[key]["if-status"] = "string"
|
||||
c.nxpathMap[key]["un-solicited"] = "string"
|
||||
c.nxpathMap[key]["ip-sum"] = "string"
|
||||
}
|
||||
|
||||
func (c *CiscoTelemetryMDT) initIgmpSnoop() {
|
||||
key := "show ip igmp snooping"
|
||||
c.nxpathMap[key] = make(map[string]string, 20)
|
||||
c.nxpathMap[key]["repsup"] = "string"
|
||||
c.nxpathMap[key]["omf_enabled"] = "string"
|
||||
c.nxpathMap[key]["v3repsup"] = "string"
|
||||
c.nxpathMap[key]["grepsup"] = "string"
|
||||
c.nxpathMap[key]["lkupmode"] = "string"
|
||||
c.nxpathMap[key]["description"] = "string"
|
||||
c.nxpathMap[key]["vlinklocalgrpsup"] = "string"
|
||||
c.nxpathMap[key]["gv3repsup"] = "string"
|
||||
c.nxpathMap[key]["reportfloodall"] = "string"
|
||||
c.nxpathMap[key]["leavegroupaddress"] = "string"
|
||||
c.nxpathMap[key]["enabled"] = "string"
|
||||
c.nxpathMap[key]["omf"] = "string"
|
||||
c.nxpathMap[key]["sq"] = "string"
|
||||
c.nxpathMap[key]["sqr"] = "string"
|
||||
c.nxpathMap[key]["eht"] = "string"
|
||||
c.nxpathMap[key]["fl"] = "string"
|
||||
c.nxpathMap[key]["reportfloodenable"] = "string"
|
||||
c.nxpathMap[key]["snoop-on"] = "string"
|
||||
c.nxpathMap[key]["glinklocalgrpsup"] = "string"
|
||||
}
|
||||
|
||||
func (c *CiscoTelemetryMDT) initIgmpSnoopGroups() {
|
||||
key := "show ip igmp snooping groups"
|
||||
c.nxpathMap[key] = make(map[string]string, 20)
|
||||
c.nxpathMap[key]["src-uptime"] = "string"
|
||||
c.nxpathMap[key]["source"] = "string"
|
||||
c.nxpathMap[key]["dyn-if-name"] = "string"
|
||||
c.nxpathMap[key]["raddr"] = "string"
|
||||
c.nxpathMap[key]["old-host"] = "string"
|
||||
c.nxpathMap[key]["snoop-enabled"] = "string"
|
||||
c.nxpathMap[key]["expires"] = "string"
|
||||
c.nxpathMap[key]["omf-enabled"] = "string"
|
||||
c.nxpathMap[key]["uptime"] = "string"
|
||||
c.nxpathMap[key]["src-expires"] = "string"
|
||||
c.nxpathMap[key]["addr"] = "string"
|
||||
}
|
||||
|
||||
func (c *CiscoTelemetryMDT) initIgmpSnoopGroupDetails() {
|
||||
key := "show ip igmp snooping groups detail"
|
||||
c.nxpathMap[key] = make(map[string]string, 20)
|
||||
c.nxpathMap[key]["src-uptime"] = "string"
|
||||
c.nxpathMap[key]["source"] = "string"
|
||||
c.nxpathMap[key]["dyn-if-name"] = "string"
|
||||
c.nxpathMap[key]["raddr"] = "string"
|
||||
c.nxpathMap[key]["old-host"] = "string"
|
||||
c.nxpathMap[key]["snoop-enabled"] = "string"
|
||||
c.nxpathMap[key]["expires"] = "string"
|
||||
c.nxpathMap[key]["omf-enabled"] = "string"
|
||||
c.nxpathMap[key]["uptime"] = "string"
|
||||
c.nxpathMap[key]["src-expires"] = "string"
|
||||
c.nxpathMap[key]["addr"] = "string"
|
||||
}
|
||||
|
||||
func (c *CiscoTelemetryMDT) initIgmpSnoopGroupsSumm() {
|
||||
key := "show ip igmp snooping groups summary"
|
||||
c.nxpathMap[key] = make(map[string]string, 20)
|
||||
c.nxpathMap[key]["src-uptime"] = "string"
|
||||
c.nxpathMap[key]["source"] = "string"
|
||||
c.nxpathMap[key]["dyn-if-name"] = "string"
|
||||
c.nxpathMap[key]["raddr"] = "string"
|
||||
c.nxpathMap[key]["old-host"] = "string"
|
||||
c.nxpathMap[key]["snoop-enabled"] = "string"
|
||||
c.nxpathMap[key]["expires"] = "string"
|
||||
c.nxpathMap[key]["omf-enabled"] = "string"
|
||||
c.nxpathMap[key]["uptime"] = "string"
|
||||
c.nxpathMap[key]["src-expires"] = "string"
|
||||
c.nxpathMap[key]["addr"] = "string"
|
||||
}
|
||||
|
||||
func (c *CiscoTelemetryMDT) initMrouter() {
|
||||
key := "show ip igmp snooping mrouter"
|
||||
c.nxpathMap[key] = make(map[string]string, 20)
|
||||
c.nxpathMap[key]["uptime"] = "string"
|
||||
c.nxpathMap[key]["expires"] = "string"
|
||||
}
|
||||
|
||||
func (c *CiscoTelemetryMDT) initSnoopStats() {
|
||||
key := "show ip igmp snooping statistics"
|
||||
c.nxpathMap[key] = make(map[string]string, 20)
|
||||
c.nxpathMap[key]["ut"] = "string"
|
||||
}
|
||||
|
||||
func (c *CiscoTelemetryMDT) initPimInterface() {
|
||||
key := "show ip pim interface vrf all"
|
||||
c.nxpathMap[key] = make(map[string]string, 20)
|
||||
c.nxpathMap[key]["if-is-border"] = "string"
|
||||
c.nxpathMap[key]["cached_if_status"] = "string"
|
||||
c.nxpathMap[key]["genid"] = "string"
|
||||
c.nxpathMap[key]["if-name"] = "string"
|
||||
c.nxpathMap[key]["last-cleared"] = "string"
|
||||
c.nxpathMap[key]["is-pim-vpc-svi"] = "string"
|
||||
c.nxpathMap[key]["if-addr"] = "string"
|
||||
c.nxpathMap[key]["is-pim-enabled"] = "string"
|
||||
c.nxpathMap[key]["pim-dr-address"] = "string"
|
||||
c.nxpathMap[key]["hello-timer"] = "string"
|
||||
c.nxpathMap[key]["pim-bfd-enabled"] = "string"
|
||||
c.nxpathMap[key]["vpc-peer-nbr"] = "string"
|
||||
c.nxpathMap[key]["nbr-policy-name"] = "string"
|
||||
c.nxpathMap[key]["is-auto-enabled"] = "string"
|
||||
c.nxpathMap[key]["if-status"] = "string"
|
||||
c.nxpathMap[key]["jp-out-policy-name"] = "string"
|
||||
c.nxpathMap[key]["if-addr-summary"] = "string"
|
||||
c.nxpathMap[key]["if-dr"] = "string"
|
||||
c.nxpathMap[key]["jp-in-policy-name"] = "string"
|
||||
}
|
||||
|
||||
func (c *CiscoTelemetryMDT) initPimNeigh() {
|
||||
key := "show ip pim neighbor vrf all"
|
||||
c.nxpathMap[key] = make(map[string]string, 20)
|
||||
c.nxpathMap[key]["longest-hello-intvl"] = "string"
|
||||
c.nxpathMap[key]["if-name"] = "string"
|
||||
c.nxpathMap[key]["uptime"] = "string"
|
||||
c.nxpathMap[key]["expires"] = "string"
|
||||
c.nxpathMap[key]["bfd-state"] = "string"
|
||||
}
|
||||
|
||||
func (c *CiscoTelemetryMDT) initPimRoute() {
|
||||
key := "show ip pim route vrf all"
|
||||
c.nxpathMap[key] = make(map[string]string, 20)
|
||||
c.nxpathMap[key]["rpf-nbr-1"] = "string"
|
||||
c.nxpathMap[key]["rpf-nbr-addr"] = "string"
|
||||
c.nxpathMap[key]["register"] = "string"
|
||||
c.nxpathMap[key]["sgexpire"] = "string"
|
||||
c.nxpathMap[key]["oif-bf-str"] = "string"
|
||||
c.nxpathMap[key]["mcast-addrs"] = "string"
|
||||
c.nxpathMap[key]["rp-addr"] = "string"
|
||||
c.nxpathMap[key]["immediate-bf-str"] = "string"
|
||||
c.nxpathMap[key]["sgr-prune-list-bf-str"] = "string"
|
||||
c.nxpathMap[key]["context-name"] = "string"
|
||||
c.nxpathMap[key]["intf-name"] = "string"
|
||||
c.nxpathMap[key]["immediate-timeout-bf-str"] = "string"
|
||||
c.nxpathMap[key]["rp-local"] = "string"
|
||||
c.nxpathMap[key]["sgrexpire"] = "string"
|
||||
c.nxpathMap[key]["timeout-bf-str"] = "string"
|
||||
c.nxpathMap[key]["timeleft"] = "string"
|
||||
}
|
||||
|
||||
func (c *CiscoTelemetryMDT) initPimRp() {
|
||||
key := "show ip pim rp vrf all"
|
||||
c.nxpathMap[key] = make(map[string]string, 20)
|
||||
c.nxpathMap[key]["is-bsr-forward-only"] = "string"
|
||||
c.nxpathMap[key]["is-rpaddr-local"] = "string"
|
||||
c.nxpathMap[key]["bsr-expires"] = "string"
|
||||
c.nxpathMap[key]["autorp-expire-time"] = "string"
|
||||
c.nxpathMap[key]["rp-announce-policy-name"] = "string"
|
||||
c.nxpathMap[key]["rp-cand-policy-name"] = "string"
|
||||
c.nxpathMap[key]["is-autorp-forward-only"] = "string"
|
||||
c.nxpathMap[key]["rp-uptime"] = "string"
|
||||
c.nxpathMap[key]["rp-owner-flags"] = "string"
|
||||
c.nxpathMap[key]["df-bits-recovered"] = "string"
|
||||
c.nxpathMap[key]["bs-timer"] = "string"
|
||||
c.nxpathMap[key]["rp-discovery-policy-name"] = "string"
|
||||
c.nxpathMap[key]["arp-rp-addr"] = "string"
|
||||
c.nxpathMap[key]["auto-rp-addr"] = "string"
|
||||
c.nxpathMap[key]["autorp-expires"] = "string"
|
||||
c.nxpathMap[key]["is-autorp-enabled"] = "string"
|
||||
c.nxpathMap[key]["is-bsr-local"] = "string"
|
||||
c.nxpathMap[key]["is-autorp-listen-only"] = "string"
|
||||
c.nxpathMap[key]["autorp-dis-timer"] = "string"
|
||||
c.nxpathMap[key]["bsr-rp-expires"] = "string"
|
||||
c.nxpathMap[key]["static-rp-group-map"] = "string"
|
||||
c.nxpathMap[key]["rp-source"] = "string"
|
||||
c.nxpathMap[key]["autorp-cand-address"] = "string"
|
||||
c.nxpathMap[key]["autorp-up-time"] = "string"
|
||||
c.nxpathMap[key]["is-bsr-enabled"] = "string"
|
||||
c.nxpathMap[key]["bsr-uptime"] = "string"
|
||||
c.nxpathMap[key]["is-bsr-listen-only"] = "string"
|
||||
c.nxpathMap[key]["rpf-nbr-address"] = "string"
|
||||
c.nxpathMap[key]["is-rp-local"] = "string"
|
||||
c.nxpathMap[key]["is-autorp-local"] = "string"
|
||||
c.nxpathMap[key]["bsr-policy-name"] = "string"
|
||||
c.nxpathMap[key]["grange-grp"] = "string"
|
||||
c.nxpathMap[key]["rp-addr"] = "string"
|
||||
c.nxpathMap[key]["anycast-rp-addr"] = "string"
|
||||
}
|
||||
|
||||
func (c *CiscoTelemetryMDT) initPimStats() {
|
||||
key := "show ip pim statistics vrf all"
|
||||
c.nxpathMap[key] = make(map[string]string, 1)
|
||||
c.nxpathMap[key]["vrf-name"] = "string"
|
||||
}
|
||||
|
||||
func (c *CiscoTelemetryMDT) initIntfBrief() {
|
||||
key := "show interface brief"
|
||||
c.nxpathMap[key] = make(map[string]string, 2)
|
||||
c.nxpathMap[key]["speed"] = "string"
|
||||
c.nxpathMap[key]["vlan"] = "string"
|
||||
}
|
||||
|
||||
func (c *CiscoTelemetryMDT) initPimVrf() {
|
||||
key := "show ip pim vrf all"
|
||||
c.nxpathMap[key] = make(map[string]string, 1)
|
||||
c.nxpathMap[key]["table-id"] = "string"
|
||||
}
|
||||
|
||||
func (c *CiscoTelemetryMDT) initIPMroute() {
|
||||
key := "show ip mroute summary vrf all"
|
||||
c.nxpathMap[key] = make(map[string]string, 40)
|
||||
c.nxpathMap[key]["nat-mode"] = "string"
|
||||
c.nxpathMap[key]["oif-name"] = "string"
|
||||
c.nxpathMap[key]["nat-route-type"] = "string"
|
||||
c.nxpathMap[key]["uptime"] = "string"
|
||||
c.nxpathMap[key]["mofrr-nbr"] = "string"
|
||||
c.nxpathMap[key]["extranet_addr"] = "string"
|
||||
c.nxpathMap[key]["stale-route"] = "string"
|
||||
c.nxpathMap[key]["pending"] = "string"
|
||||
c.nxpathMap[key]["bidir"] = "string"
|
||||
c.nxpathMap[key]["expry_timer"] = "string"
|
||||
c.nxpathMap[key]["mofrr-iif"] = "string"
|
||||
c.nxpathMap[key]["group_addrs"] = "string"
|
||||
c.nxpathMap[key]["mpib-name"] = "string"
|
||||
c.nxpathMap[key]["rpf"] = "string"
|
||||
c.nxpathMap[key]["mcast-addrs"] = "string"
|
||||
c.nxpathMap[key]["route-mdt-iod"] = "string"
|
||||
c.nxpathMap[key]["sr-oif"] = "string"
|
||||
c.nxpathMap[key]["stats-rate-buf"] = "string"
|
||||
c.nxpathMap[key]["source_addr"] = "string"
|
||||
c.nxpathMap[key]["route-iif"] = "string"
|
||||
c.nxpathMap[key]["rpf-nbr"] = "string"
|
||||
c.nxpathMap[key]["translated-route-src"] = "string"
|
||||
c.nxpathMap[key]["group_addr"] = "string"
|
||||
c.nxpathMap[key]["lisp-src-rloc"] = "string"
|
||||
c.nxpathMap[key]["stats-pndg"] = "string"
|
||||
c.nxpathMap[key]["rate_buf"] = "string"
|
||||
c.nxpathMap[key]["extranet_vrf_name"] = "string"
|
||||
c.nxpathMap[key]["fabric-interest"] = "string"
|
||||
c.nxpathMap[key]["translated-route-grp"] = "string"
|
||||
c.nxpathMap[key]["internal"] = "string"
|
||||
c.nxpathMap[key]["oif-mpib-name"] = "string"
|
||||
c.nxpathMap[key]["oif-uptime"] = "string"
|
||||
c.nxpathMap[key]["omd-vpc-svi"] = "string"
|
||||
c.nxpathMap[key]["source_addrs"] = "string"
|
||||
c.nxpathMap[key]["stale-oif"] = "string"
|
||||
c.nxpathMap[key]["core-interest"] = "string"
|
||||
c.nxpathMap[key]["oif-list-bitfield"] = "string"
|
||||
}
|
||||
|
||||
func (c *CiscoTelemetryMDT) initIpv6Mroute() {
|
||||
key := "show ipv6 mroute summary vrf all"
|
||||
c.nxpathMap[key] = make(map[string]string, 40)
|
||||
c.nxpathMap[key]["nat-mode"] = "string"
|
||||
c.nxpathMap[key]["oif-name"] = "string"
|
||||
c.nxpathMap[key]["nat-route-type"] = "string"
|
||||
c.nxpathMap[key]["uptime"] = "string"
|
||||
c.nxpathMap[key]["mofrr-nbr"] = "string"
|
||||
c.nxpathMap[key]["extranet_addr"] = "string"
|
||||
c.nxpathMap[key]["stale-route"] = "string"
|
||||
c.nxpathMap[key]["pending"] = "string"
|
||||
c.nxpathMap[key]["bidir"] = "string"
|
||||
c.nxpathMap[key]["expry_timer"] = "string"
|
||||
c.nxpathMap[key]["mofrr-iif"] = "string"
|
||||
c.nxpathMap[key]["group_addrs"] = "string"
|
||||
c.nxpathMap[key]["mpib-name"] = "string"
|
||||
c.nxpathMap[key]["rpf"] = "string"
|
||||
c.nxpathMap[key]["mcast-addrs"] = "string"
|
||||
c.nxpathMap[key]["route-mdt-iod"] = "string"
|
||||
c.nxpathMap[key]["sr-oif"] = "string"
|
||||
c.nxpathMap[key]["stats-rate-buf"] = "string"
|
||||
c.nxpathMap[key]["source_addr"] = "string"
|
||||
c.nxpathMap[key]["route-iif"] = "string"
|
||||
c.nxpathMap[key]["rpf-nbr"] = "string"
|
||||
c.nxpathMap[key]["translated-route-src"] = "string"
|
||||
c.nxpathMap[key]["group_addr"] = "string"
|
||||
c.nxpathMap[key]["lisp-src-rloc"] = "string"
|
||||
c.nxpathMap[key]["stats-pndg"] = "string"
|
||||
c.nxpathMap[key]["rate_buf"] = "string"
|
||||
c.nxpathMap[key]["extranet_vrf_name"] = "string"
|
||||
c.nxpathMap[key]["fabric-interest"] = "string"
|
||||
c.nxpathMap[key]["translated-route-grp"] = "string"
|
||||
c.nxpathMap[key]["internal"] = "string"
|
||||
c.nxpathMap[key]["oif-mpib-name"] = "string"
|
||||
c.nxpathMap[key]["oif-uptime"] = "string"
|
||||
c.nxpathMap[key]["omd-vpc-svi"] = "string"
|
||||
c.nxpathMap[key]["source_addrs"] = "string"
|
||||
c.nxpathMap[key]["stale-oif"] = "string"
|
||||
c.nxpathMap[key]["core-interest"] = "string"
|
||||
c.nxpathMap[key]["oif-list-bitfield"] = "string"
|
||||
}
|
||||
|
||||
func (c *CiscoTelemetryMDT) initVpc() {
|
||||
key := "sys/vpc"
|
||||
c.nxpathMap[key] = make(map[string]string, 5)
|
||||
c.nxpathMap[key]["type2CompatQualStr"] = "string"
|
||||
c.nxpathMap[key]["compatQualStr"] = "string"
|
||||
c.nxpathMap[key]["name"] = "string"
|
||||
c.nxpathMap[key]["issuFromVer"] = "string"
|
||||
c.nxpathMap[key]["issuToVer"] = "string"
|
||||
}
|
||||
|
||||
func (c *CiscoTelemetryMDT) initBgp() {
|
||||
key := "sys/bgp"
|
||||
c.nxpathMap[key] = make(map[string]string, 18)
|
||||
c.nxpathMap[key]["dynRtMap"] = "string"
|
||||
c.nxpathMap[key]["nhRtMap"] = "string"
|
||||
c.nxpathMap[key]["epePeerSet"] = "string"
|
||||
c.nxpathMap[key]["asn"] = "string"
|
||||
c.nxpathMap[key]["peerImp"] = "string"
|
||||
c.nxpathMap[key]["wght"] = "string"
|
||||
c.nxpathMap[key]["assocDom"] = "string"
|
||||
c.nxpathMap[key]["tblMap"] = "string"
|
||||
c.nxpathMap[key]["unSupprMap"] = "string"
|
||||
c.nxpathMap[key]["sessionContImp"] = "string"
|
||||
c.nxpathMap[key]["allocLblRtMap"] = "string"
|
||||
c.nxpathMap[key]["defMetric"] = "string"
|
||||
c.nxpathMap[key]["password"] = "string"
|
||||
c.nxpathMap[key]["retainRttRtMap"] = "string"
|
||||
c.nxpathMap[key]["clusterId"] = "string"
|
||||
c.nxpathMap[key]["localAsn"] = "string"
|
||||
c.nxpathMap[key]["name"] = "string"
|
||||
c.nxpathMap[key]["defOrgRtMap"] = "string"
|
||||
}
|
||||
|
||||
func (c *CiscoTelemetryMDT) initCh() {
|
||||
key := "sys/ch"
|
||||
c.nxpathMap[key] = make(map[string]string, 10)
|
||||
c.nxpathMap[key]["fanName"] = "string"
|
||||
c.nxpathMap[key]["typeCordConnected"] = "string"
|
||||
c.nxpathMap[key]["vendor"] = "string"
|
||||
c.nxpathMap[key]["model"] = "string"
|
||||
c.nxpathMap[key]["rev"] = "string"
|
||||
c.nxpathMap[key]["vdrId"] = "string"
|
||||
c.nxpathMap[key]["hardwareAlarm"] = "string"
|
||||
c.nxpathMap[key]["unit"] = "string"
|
||||
c.nxpathMap[key]["hwVer"] = "string"
|
||||
}
|
||||
|
||||
func (c *CiscoTelemetryMDT) initIntf() {
|
||||
key := "sys/intf"
|
||||
c.nxpathMap[key] = make(map[string]string, 10)
|
||||
c.nxpathMap[key]["descr"] = "string"
|
||||
c.nxpathMap[key]["name"] = "string"
|
||||
c.nxpathMap[key]["lastStCause"] = "string"
|
||||
c.nxpathMap[key]["description"] = "string"
|
||||
c.nxpathMap[key]["unit"] = "string"
|
||||
c.nxpathMap[key]["operFECMode"] = "string"
|
||||
c.nxpathMap[key]["operBitset"] = "string"
|
||||
c.nxpathMap[key]["mdix"] = "string"
|
||||
}
|
||||
|
||||
func (c *CiscoTelemetryMDT) initProcsys() {
|
||||
key := "sys/procsys"
|
||||
c.nxpathMap[key] = make(map[string]string, 10)
|
||||
c.nxpathMap[key]["name"] = "string"
|
||||
c.nxpathMap[key]["id"] = "string"
|
||||
c.nxpathMap[key]["upTs"] = "string"
|
||||
c.nxpathMap[key]["interval"] = "string"
|
||||
c.nxpathMap[key]["memstatus"] = "string"
|
||||
}
|
||||
|
||||
func (c *CiscoTelemetryMDT) initProc() {
|
||||
key := "sys/proc"
|
||||
c.nxpathMap[key] = make(map[string]string, 2)
|
||||
c.nxpathMap[key]["processName"] = "string"
|
||||
c.nxpathMap[key]["procArg"] = "string"
|
||||
}
|
||||
|
||||
func (c *CiscoTelemetryMDT) initBfd() {
|
||||
key := "sys/bfd/inst"
|
||||
c.nxpathMap[key] = make(map[string]string, 4)
|
||||
c.nxpathMap[key]["descr"] = "string"
|
||||
c.nxpathMap[key]["vrfName"] = "string"
|
||||
c.nxpathMap[key]["name"] = "string"
|
||||
c.nxpathMap[key]["name"] = "string"
|
||||
}
|
||||
|
||||
func (c *CiscoTelemetryMDT) initLldp() {
|
||||
key := "sys/lldp"
|
||||
c.nxpathMap[key] = make(map[string]string, 7)
|
||||
c.nxpathMap[key]["sysDesc"] = "string"
|
||||
c.nxpathMap[key]["portDesc"] = "string"
|
||||
c.nxpathMap[key]["portIdV"] = "string"
|
||||
c.nxpathMap[key]["chassisIdV"] = "string"
|
||||
c.nxpathMap[key]["sysName"] = "string"
|
||||
c.nxpathMap[key]["name"] = "string"
|
||||
c.nxpathMap[key]["id"] = "string"
|
||||
}
|
||||
|
||||
func (c *CiscoTelemetryMDT) initDB() {
|
||||
c.nxpathMap = make(map[string]map[string]string, 200)
|
||||
|
||||
c.initPower()
|
||||
c.initMemPhys()
|
||||
c.initBgpV4()
|
||||
c.initCPU()
|
||||
c.initResources()
|
||||
c.initPtpCorrection()
|
||||
c.initTrans()
|
||||
c.initIgmp()
|
||||
c.initVrfAll()
|
||||
c.initIgmpSnoop()
|
||||
c.initIgmpSnoopGroups()
|
||||
c.initIgmpSnoopGroupDetails()
|
||||
c.initIgmpSnoopGroupsSumm()
|
||||
c.initMrouter()
|
||||
c.initSnoopStats()
|
||||
c.initPimInterface()
|
||||
c.initPimNeigh()
|
||||
c.initPimRoute()
|
||||
c.initPimRp()
|
||||
c.initPimStats()
|
||||
c.initIntfBrief()
|
||||
c.initPimVrf()
|
||||
c.initIPMroute()
|
||||
c.initIpv6Mroute()
|
||||
c.initVpc()
|
||||
c.initBgp()
|
||||
c.initCh()
|
||||
c.initIntf()
|
||||
c.initProcsys()
|
||||
c.initProc()
|
||||
c.initBfd()
|
||||
c.initLldp()
|
||||
}
|
59
plugins/inputs/cisco_telemetry_mdt/sample.conf
Normal file
59
plugins/inputs/cisco_telemetry_mdt/sample.conf
Normal file
|
@ -0,0 +1,59 @@
|
|||
# Cisco model-driven telemetry (MDT) input plugin for IOS XR, IOS XE and NX-OS platforms
|
||||
[[inputs.cisco_telemetry_mdt]]
|
||||
## Telemetry transport can be "tcp" or "grpc". TLS is only supported when
|
||||
## using the grpc transport.
|
||||
transport = "grpc"
|
||||
|
||||
## Address and port to host telemetry listener
|
||||
service_address = ":57000"
|
||||
|
||||
## Grpc Maximum Message Size, default is 4MB, increase the size. This is
|
||||
## stored as a uint32, and limited to 4294967295.
|
||||
max_msg_size = 4000000
|
||||
|
||||
## Enable TLS; grpc transport only.
|
||||
# tls_cert = "/etc/telegraf/cert.pem"
|
||||
# tls_key = "/etc/telegraf/key.pem"
|
||||
|
||||
## Enable TLS client authentication and define allowed CA certificates; grpc
|
||||
## transport only.
|
||||
# tls_allowed_cacerts = ["/etc/telegraf/clientca.pem"]
|
||||
|
||||
## Define (for certain nested telemetry measurements with embedded tags) which fields are tags
|
||||
# embedded_tags = ["Cisco-IOS-XR-qos-ma-oper:qos/interface-table/interface/input/service-policy-names/service-policy-instance/statistics/class-stats/class-name"]
|
||||
|
||||
## Include the delete field in every telemetry message.
|
||||
# include_delete_field = false
|
||||
|
||||
## Specify custom name for incoming MDT source field.
|
||||
# source_field_name = "mdt_source"
|
||||
|
||||
## Define aliases to map telemetry encoding paths to simple measurement names
|
||||
[inputs.cisco_telemetry_mdt.aliases]
|
||||
ifstats = "ietf-interfaces:interfaces-state/interface/statistics"
|
||||
## Define Property Xformation, please refer README and https://pubhub.devnetcloud.com/media/dme-docs-9-3-3/docs/appendix/ for Model details.
|
||||
[inputs.cisco_telemetry_mdt.dmes]
|
||||
# Global Property Xformation.
|
||||
# prop1 = "uint64 to int"
|
||||
# prop2 = "uint64 to string"
|
||||
# prop3 = "string to uint64"
|
||||
# prop4 = "string to int64"
|
||||
# prop5 = "string to float64"
|
||||
# auto-prop-xfrom = "auto-float-xfrom" #Xform any property which is string, and has float number to type float64
|
||||
# Per Path property xformation, Name is telemetry configuration under sensor-group, path configuration "WORD Distinguished Name"
|
||||
# Per Path configuration is better as it avoid property collision issue of types.
|
||||
# dnpath = '{"Name": "show ip route summary","prop": [{"Key": "routes","Value": "string"}, {"Key": "best-paths","Value": "string"}]}'
|
||||
# dnpath2 = '{"Name": "show processes cpu","prop": [{"Key": "kernel_percent","Value": "float"}, {"Key": "idle_percent","Value": "float"}, {"Key": "process","Value": "string"}, {"Key": "user_percent","Value": "float"}, {"Key": "onesec","Value": "float"}]}'
|
||||
# dnpath3 = '{"Name": "show processes memory physical","prop": [{"Key": "processname","Value": "string"}]}'
|
||||
|
||||
## Additional GRPC connection settings.
|
||||
[inputs.cisco_telemetry_mdt.grpc_enforcement_policy]
|
||||
## GRPC permit keepalives without calls, set to true if your clients are
|
||||
## sending pings without calls in-flight. This can sometimes happen on IOS-XE
|
||||
## devices where the GRPC connection is left open but subscriptions have been
|
||||
## removed, and adding subsequent subscriptions does not keep a stable session.
|
||||
# permit_keepalive_without_calls = false
|
||||
|
||||
## GRPC minimum timeout between successive pings, decreasing this value may
|
||||
## help if this plugin is closing connections with ENHANCE_YOUR_CALM (too_many_pings).
|
||||
# keepalive_minimum_time = "5m"
|
BIN
plugins/inputs/cisco_telemetry_mdt/testdata/microburst
vendored
Normal file
BIN
plugins/inputs/cisco_telemetry_mdt/testdata/microburst
vendored
Normal file
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue