Custom Sensors for JTI, gRPC, and NETCONF
Overview
Contrail Insights includes several built-in JTI, gRPC, and NETCONF sensors. To enable these sensors, you can add the sensor information to the network device configuration file or from UI.
Contrail Insights also allows you to add new JTI, gRPC, and
NETCONF sensors into the system. You need to supply a configuration
file, set the variables in Ansible group_vars
, and then re-run the playbook. The Contrail Insights Ansible playbook
will deploy the new sensor configurations and start parsing data for
the new sensor.
Starting with Contrail Insights version 3.3.0, NETCONF custom command support is added.
Sensor Configuration File
The sensor configuration file you provide for Contrail Insights needs to have certain fields.
For example: sample_jti_grpc_netconf_config.py
# Sensor path of JTI/GRPC/NETCONF sensor, for example, '/interface/' for GRPC # openconfig sensor path, '/junos/system/linecard/interface/' for JTI # interface sensor, 'show interface terse' for NETCONF interface sensor. SENSOR_NAME = '' # We support two sensor types: device_entity and device. # device_entity means that the data output for this sensor is for entity of the # device, e.g. device interface data, device FAN data. # device means that the data output for this sensor is for the device itself, # such as device's system uptime or device's tcp stats SENSOR_TYPE = '' # This refers to which collection name user wants this data to be saved in # mongodb COLLECTION_NAME = '' # Entity Type is a list of strings. It indicates what is this sensor's data # for. If it reports interface data, ENTITY_TYPE=['interface'], if it reports # both FAN and FPC data, ENTITY_TYPE=['FAN', 'FPC'], if it reports the device # data, ENTITY_TYPE=['network_device'] ENTITY_TYPE = [] # METRIC_LIST is a list of metrics you want to monitor, Name will be the # metric_name shown in AppFormix, CalculationMethod can be either value or # rate. If you want AppFormix to calculate the rate of this metric, you should # put 'rate', otherwise, put value(and we will not do any calculation) METRIC_LIST = [ { 'Name': 'active-state-count', 'Units': 'Count', 'CalculationMethod': 'value' } ] # We need a parse_data function, which takes in raw json_data that we get from the device # and device OS version, that then returns the data AppFormix needs. The version # variable is optional and we use it for parsing sensor data for different # device OS versions. (Different device OS versions can result in different data # formats for the same sensor). # The return value of this function should be a dictionary, key will be the # entity_types this sensor reports data for which matches with the ENTITY_TYPE # specify above. The value should also be a dictionary, the keys is post_data. # 'post_data' is a list of data we post to AppFormix, each entry is a # dictionary, key is the metric name and value is the corresponding value. In # each entry, there is a mandatory key called 'entity_name' which should be # this data's corresponding entity_name(cannot include comma(',') in it) such as # 'xe-0/0/0'(interface_name), 'Fan0'(fan name) or # 'Routing Engine 0'(routing engine name). If this is a device data, entity_name # should be 'network_device' def parse_data(json_data, version=None): return {ENTITY_TYPE: {'post_data': []}} # After you finish the config file, we need to add this sensor from AppFormix # ansible playbook. # Put your sensor config file in AppFormix ansible directory and add following # variables in group_vars/all: # appformix_control_plane_plugin_config_files: # - { config_file_name: `config_file.py`, type: `type_of_sensor` } # config_file.py should be the name of the sensor config file and # type_of_sensor should be either 'GRPC' if it is a gRPC sensor, 'JTI' if it # is a JTI sensor or 'NETCONF' if it is a NETCONF sensor. # Then re-run AppFormix ansible playbook will add the new sensors into # AppFormix. It will copy your config file to all the agents and then update # certified_plugins/grpc_network_device_usage.json, # certified_plugins/jti_network_device_usage.json and # certified_plugins/netconf_commandline.json for you.
This sample configuration file indicates and describes all the
required fields for a JTI, gRPC, and NETCONF configuration file. Contrail
Insights Agent uses the parse_data
function
supplied in the configuration file to parse out the data received
from the data. Then Contrail Insights pushes the output of the parser
function to both event_stream
and Contrail
Insights DataManager.
Note that the input variable version
is needed in some scenarios because data format might be different
across different device OS versions. You can implement the parse_data
function with multiple parsers based on
the version
variable input.
Enable Sensors Through Contrail Insights Ansible Playbook
After completing the configuration file, you need to add the sensor from the Contrail Insights Ansible playbook.
Copy your sensor configuration file to the Contrail Insights
Ansible directory and add the following variables in group_vars/all
:
appformix_control_plane_plugin_config_files: - { config_file_name: `config_file.py`, type: `type_of_sensor` }
config_file.py
should be the name
of the sensor configuration file and type_of_sensor
should be either “GRPC” if it is a gRPC sensor, “JTI”
if it is a JTI sensor, or "NETCONF" if it is a NETCONF sensor.
Then re-run the Contrail Insights Ansible playbook to add the
new sensors into Contrail Insights. Contrail Insights copies your
configuration file to all the Agents and then updates certified_plugins/grpc_network_device_usage.json
and certified_plugins/jti_network_device_usage.json
and certified_plugins/netconf_commandline.json
for you.
Add More Metrics to Existing JTI, gPRC, and NETCONF Sensors
Contrail Insights has several built-in JTI, gRPC, and NETCONF
sensors. To add more metrics for these sensors, instead of creating
a new sensor_config
file, you modify the
existing sensor configuration file for these sensors.
To add metrics to existing JTI and gRPC sensors:
Starting with AppFormix version 3.1, the built-in
sensor_config
file and the dependent files can be found in the/opt/appformix/manager/tailwind_manager/
folder in every Agent. Copy these files from the Agent.Update the
sensor_config
file by adding more metrics, then modifying theparse_data
function to parse data for these new metrics.Place the updated files in your Ansible directory and re-run the playbook with
appformix_control_plane_plugin_config_files
defined correctly ingroup_vars/all
.
If your AppFormix version is earlier than 3.1, send an email to mailto:appformix-support and request the sensor configuration file for built-in JTI and gRPC sensors.
Change History Table
Feature support is determined by the platform and release you are using. Use Feature Explorer to determine if a feature is supported on your platform.