thetherington / Cisco-NX-REST-API

Cisco NX metrics collector designed for the inSITE Poller program python module.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cisco Nexus Metrics and Log Collection

Cisco NX metrics collector designed for the inSITE Poller program python module. Metrics collector module uses the NX-REST-API feature of a Cisco Nexus Switch. Package also contains configuration for log and netflow data collection. Custom dashboards are included to visulize the cisco metric and log data.

The module uses the Magnum SDVN configuration from the inSITE Magnum collector to annotate the metric data with device names and source descriptions.

The metrics collection module has the below distinct abilities and features:

  1. Collects CPU, memory, temperature and module status.
    • show hardware
    • show environment
    • show system resources
  2. Collects physical port statistics.
    • show interface
  3. Collects multicast routing table information.
    • show ip mroute
  4. Collects netflow protocol information. Netflow data is annotated into the multicast routing table data collection.
  5. Collects Cisco NX syslog and with custom log parsing.
  6. Magnum SDVN configuration is annotated into the metric data collection.
  7. High level dashboards to navigate and access logs and metric information.

Minimum Requirements:

  • inSITE Version 10.3 and service pack 6.
  • Imported Magnum SDVN Configuration containing the Cisco NBM devices.
  • Python3.7 (already installed on inSITE machine)
  • Python3.7 Requests library (already installed on inSITE machine)
  • Netflow setup is configured on the Cisco device(s). see extra/commands for configuration reference
  • Syslog setup is configured on the Cisco device(s). see extra/commands for configuration reference
  • Sufficent knowledge of Kibana to import dashboards and configure index patterns.

Installation of the Script Module and Logstash Configuration:

  1. Installation of the metrics collection module starts with setting up the logstash template files for netflow and syslog. Below command creates a folder and copy the template files into the created mappings folder.

     sudo install -d -m 0755 -o insite -g insite /opt/mappings
     cp logstash/elasticsearch-template-netflow.json /opt/mappings/
     cp logstash/elasticsearch-template-ciscolog.json /opt/mappings/
    
  2. Load the logstash custom configuration needs to be imported. Log into insite with user:developer, password:-open-up-

  3. Find the Collectibles (Unicast) - Logstash program and select the node settings link.

  4. Select the Collectables tab, and then click the Expert Options link.

  5. Copy and paste the contents of logstash/logstash.yaml into the panel.

  6. Press OK, then Press Save to apply the changes.

  7. Copy CiscoNX.py script to the poller python modules folder:

     cp scripts/CiscoNX.py /opt/evertz/insite/parasite/applications/pll-1/data/python/modules/
    
  8. Restart the poller application

Configuration:

To configure a poller to use the module start a new python poller configuration outlined below:

  1. Click the create a custom poller from the poller application settings page.

  2. Enter a Name, Summary and Description information.

  3. Enter the ip address of the Cisco switch in the Hosts tab.

  4. From the Input tab change the Type to Python

  5. From the Input tab change the Metric Set Name field to cisconx

  6. From the Python tab select the Advanced tab and enable the CPython Bindings option

  7. Select the Script tab, then paste the contents of scripts/poller_config.py into the script panel.

  8. The poller config script reqires a couple modifications for it to access the REST-API interface, and the magnum configuration.

    1. Update the user and password key in the params definition with the REST API login credentials.
        'user': 'admin',
        'password': 'Evertz123',
    
    1. Update the cluster_ip key in the params definition with the ip address of the magnum sdvn cluster ip address.
        'cluster_ip': '172.17.143.201',
    
    1. Optional: uncomment the sub_interface key (remove hash tag) if the switch contains expansion modules with sub interfaces. This will help align magnum port numbers to the cisco interface labels. It's OK to use this option even if the switch doesn't contain expansion modules. Without this, the script will assume the magnum port number is the same as the switch port number in the interface label (Ethernet1/##)
        'sub_interfaces': True
    
  9. Save changes.

  10. Repeat Step 1. for additional switches in the system.

  11. Restart the Poller program.

Dashboards:

This packages contains 4x dashboards that are useful for navigating the log and metric data. The below index patterns will need to be created in Kibana before installing the dashboards:

  • log-netflow-*
  • log-ciscolog-*
  • log-metric-poller-cisconx-*

Incase the data collection isn't fully working (cisco syslog and netflow), you can import some sample data from the extra folder. This will allow Kibana to discover all the required fields when adding the above index patterns and installing the dashboards. Below are the exports which can be re-imported into inSITE using the inSITE Elastic Maintenance program.

  • extra/log-ciscolog-2020.10.19.tar.gz
  • extra/log-metric-poller-cisconx-2020.10.19.tar.gz
  • extra/log-netflow-2020.10.19.tar.gz

Once the index patterns are added and the pattern is verified to work in the Kibana Discover tab, then you can now install the below dashboard templates into the inSITE Kibana Template Manager. don't forget to install the dashboard from the template manager after installing the template

  • dashboards/Cisco_Switch_Health.json
  • dashboards/Cisco_Switch_Logs.json
  • dashboards/Cisco_Switch_Multicast_Routes.json
  • dashboards/Cisco_Switch_Port_List.json

The image dashboards/field formatters.PNG contains a picture of which fields need which field formatters configured in the log-metric-poller-cisconx-* index pattern.

About

Cisco NX metrics collector designed for the inSITE Poller program python module.


Languages

Language:Python 100.0%