Target-Defined Mode for Cached Generic Counters Data
Feature Name |
Release Information |
Description |
---|---|---|
Target-Defined Mode for Cached Generic Counters Data |
Release 7.5.1 |
This feature streams telemetry data for cached generic counters using a TARGET_DEFINED subscription. This subscription ensures that any change to the cache streams the latest data to the collector as an event-driven telemetry notification. This feature introduces support for the following sensor path:
|
Streaming telemetry pushes the subscribed data from the router to one or more collectors. The telemetry infrastructure retrieves
the data from the system database when you send a subscription request. Based on the subscription request or the telemetry
configuration the cached generic counters data can be retrieved periodically based on the sample-interval. Data, such as interface
statistics, is cached and refreshed at certain intervals. The TARGET_DEFINED
subscription mode can be used to retrieve data when the cache gets updated, and is not based on a timer.
The application can register as a data producer with the telemetry library and the SysdB paths it supports. One of the data
producers, Statsd, uses the library with a TARGET_DEFINED
subscription mode. As part of this mode, the producer registers the sensor paths. The statistics infrastructure streams the
incremental updates for statsd cache sensor path Cisco-IOS-XR-infra-statsd-oper:infra-statistics/interfaces/interface/cache/generic-counters
. With this path in the subscription, whenever cache is updated, the statsd application pushes the updates to the telemetry
daemon. The daemon sends these incremental updates to the collector. The cache updates are pushed for physical interfaces,
physical subinterfaces, bundle interfaces, and bundle subinterfaces. You can subscribe to the sensor path for the cached generic
counters with TARGET_DEFINED
mode instead of the sensor path for the latest generic counters (Cisco-IOS-XR-infra-statsd-oper:infra-statistics/interfaces/interface/latest/generic-counters
) to reduce the system load.
Configure the router to stream telemetry data from cache for generic counters using the following instructions:
Create a TARGET_DEFINED
subscription mode for cached generic counters using one of the two options:
- Option 1: gRPC Network Management Interface (gNMI) subscribe request
{ "name": "SubscribeRequest", "subscribe": { "prefix": {"origin": "Cisco-IOS-XR-infra-statsd-oper" }, "mode": "STREAM", "encoding": "PROTO", "updates_only": "false", "subscription": [ { "path": {"elem": [ {"name":"infra-statistics"}, {"name":"interfaces"}, {"name":"interface"}, {"name":"cache"}, {"name":"generic-counters"} ] }, "mode": "TARGET_DEFINED" } ] } }
-
Option 2: Model-driven telemetry configuration for non-gNMI requests Router(config)#telemetry model-driven Router(config-model-driven)#subscription sub1 Router(config-model-driven-subs)#sensor-group-id grp1 mode target-defined Router(config-model-driven-subs)#source-interface Interface1 Router(config-model-driven-subs)#commit
After the subscription is triggered, updates to the stats cache are monitored. The statsd application pushes the cached generic counters to the client (collector).
View the number of incremental updates for the sensor path.
Router#show telemetry model-driven subscription .*
Fri Nov 12 23:36:27.212 UTC
Subscription: GNMI__16489080148754121540
-------------
Collection Groups:
------------------
Id: 1
Sample Interval: 0 ms (Incremental Updates)
Heartbeat Interval: NA
Heartbeat always: False
Encoding: gnmi-proto
Num of collection: 1
Incremental updates: 12
Collection time: Min: 5 ms Max: 5 ms
Total time: Min: 6 ms Avg: 6 ms Max: 6 ms
Total Deferred: 1
Total Send Errors: 0
Total Send Drops: 0
Total Other Errors: 0
No data Instances: 0
Last Collection Start:2021-11-12
23:34:27.1362538876 +0000
Last Collection End: 2021-11-12 23:34:27.1362545589
+0000
Sensor Path: Cisco-IOS-XR-infra-statsd-oper:infra-statistics/interfaces/
interface/cache/generic-counters
In this example, the incremental updates of 12
indicates that the cache is updated 12 times.
statsd-target
is the subscription name.Router#show telemetry model-driven subscription statsd-target internal
Fri Nov 12 08:51:16.728 UTC
Subscription: statsd-target
-------------
State: ACTIVE
Sensor groups:
Id: statsd
Sample Interval: 0 ms (Incremental Updates)
Heartbeat Interval: NA
Sensor Path: Cisco-IOS-XR-infra-statsd-oper:infra-statistics/interfaces/interface/cache/
generic-counters
Sensor Path State: Resolved
Destination Groups:
Group Id: statsd-target
Destination IP: 192.0.2.1
Destination Port: 56000
Encoding: json
Transport: grpc
State: Active
TLS : False
Total bytes sent: 623656
Total packets sent: 13
Last Sent time: 2021-08-16 08:51:15.1304821089 +0000
Collection Groups:
------------------
Id: 2
Sample Interval: 0 ms (Incremental Updates)
Heartbeat Interval: NA
Heartbeat always: False
Encoding: json
Num of collection: 1
Incremental updates: 3
Collection time: Min: 94 ms Max: 94 ms
Total time: Min: 100 ms Avg: 100 ms Max: 100 ms
Total Deferred: 0
Total Send Errors: 0
Total Send Drops: 0
Total Other Errors: 0
No data Instances: 0
Last Collection Start:2021-08-16 08:51:04.1293895665 +0000
Last Collection End: 2021-08-16 08:51:04.1293996284 +0000
The sample interval of 0
indicates that the data is streamed whenever an event occurs. Here, the event represents the updates to the cache state.
Related Commands:
-
show tech telemetry model-driven
-
show running-config telemetry model-driven
-
show telemetry producers trace producer name info
-
show telemetry producers trace producer name err