Create Policy File
You define a telemetry policy file to specify the kind of telemetry data to be generated and pushed to the receiver. Defining the policy files requires a path to stream data. The paths can be schemas, native YANG or allowed list entries.
For more information on the schema paths associated with a corresponding CLI command, see Schema Paths.
For more information on policy files, see Telemetry Policy File.
-
Determine the schema paths to stream data.
For example, the schema path for interfaces is: RootOper.InfraStatistics.Interface(*).Latest.GenericCounters
-
Create a policy file that contains these paths.
Example: Policy File
{
"Name": "Test",
"Metadata": {
"Version": 25,
"Description": "This is a sample policy",
"Comment": "This is the first draft",
"Identifier": "<data that may be sent by the encoder to the mgmt stn"
},
"CollectionGroups": {
"FirstGroup": {
"Period": 10,
"Paths": [
"RootOper.InfraStatistics.Interface(*).Latest.GenericCounters"
]
}
}
}
IncludeFields
in the policy file. In the example, the
entry within the IncludeFields section streams only the latest applied AutoBW
value for that TE tunnel, which is nested two levels down from the top level of
the path:
{
"Name": "RSVPTEPolicy",
"Metadata": {
"Version": 1,
"Description": "This policy collects auto bw stats",
"Comment": "This is the first draft"
},
"CollectionGroups": {
"FirstGroup": {
"Period": 10,
"Paths": {
"RootOper.MPLS_TE.P2P_P2MPTunnel.TunnelHead({'TunnelName': 'tunnel-te10'})": {
"IncludeFields": [{
"P2PInfo": [{
"AutoBandwidthOper": [
"LastBandwidthApplied"
]
}]
}]
}
}
}
}
}
"Paths": [
“/Cisco-IOS-XR-infra-statsd-oper:infra-statistics/interfaces/interface=*/latest/generic-counters”
]
What to Do Next:
Copy the policy file to the router. You may copy the same policy file to multiple routers.