Giter Club home page Giter Club logo

network.telemetry's Introduction

Network Telemetry Validated Content

CI OpenSSF Best Practices

This repository contains the network.telemetry Ansible Collection.

Description

The network.telemetry enables user to manage the Telemetry configuration on networking devices and also setup a Telegraf - Kafka stack to seemlessly integrate with Event-Driven Ansible.

Tested with Ansible

Tested with ansible-core >=2.15 releases.

Installation

To consume this Validated Content from Automation Hub, the following needs to be added to ansible.cfg:

[galaxy]
server_list = automation_hub

[galaxy_server.automation_hub]
url=https://cloud.redhat.com/api/automation-hub/
auth_url=https://sso.redhat.com/auth/realms/redhat-external/protocol/openid-connect/token
token=<SuperSecretToken>

Get the required token from the Automation Hub Web UI.

With this configured, simply run the following commands:

ansible-galaxy collection install network.base
ansible-galaxy collection install network.telemetry

Capabilities

  • Gather Telemetry Facts: Gather telemetry facts from network devices and store it as host_vars (locally or remote), enabling the creation of a telemetry source-of-truth on a per target host basis.

  • Manage Telemetry Configuration: Configure telemetry as a discrete resource on target hosts. Use locally or remotely stored source-of-truth to push (or update) configuration and also detect/remediate drifts.

  • Perform Telemetry Health Checks: Run health checks to validate the telemetry process running on target hosts. Check for transport connection status, verify data collection statistics for sensor paths, and more.

Usage

Gather Telemetry Facts with action: gather

  • This action "gathers" telemetry configuration from the target host and displays it.
- name: Gather telemetry configuration
  hosts: nxos-9k
  gather_facts: false
  tasks:
  - name: Run Telemetry Manager
    ansible.builtin.include_role:
      name: network.telemetry.run
    vars:
      ansible_network_os: cisco.nxos.nxos
      operations:
        - name: gather

Build Brownfield Inventory with action: persist

  • Gather telemetry configuration (as structured data) from the target host and build a source-of-truth.
  • This action "persists" the gathered telemetry configuration into a flat-file (telemetry.yaml) in YAML format.
  • By default, this file will be created under host_vars/{{ inventory_hostname }}/ directory.
  • To persist this data in a remote scm, specify details in the scm option under data_store key.
  • Or, to persist this data locally, please specify the path in the local option under the data_store key.
- name: Persist telemetry configuration as host_vars
  hosts: nxos-9k
  gather_facts: false
  tasks:
  - name: Run Telemetry Manager
    ansible.builtin.include_role:
      name: network.telemetry.run
    vars:
      ansible_network_os: cisco.nxos.nxos
      operations:
        - name: persist
      data_store:
        scm:
          origin:
            url: "/path/to/remote/scm"
            token: "superSecretToken"
            user:
              name: scm_user_name
        local: ./telemetry_backup # optional

Deploy Telemetry Configuration with action: deploy

  • This action "deploys" (pushes) telemetry configuration defined in the host_vars (SoT) to the target hosts.
- name: Deploy telemetry configuration from host_vars
  hosts: nxos-9k
  gather_facts: false
  tasks:
  - name: Run Telemetry Manager
    include_role:
      name: network.telemetry.run
    vars:
      ansible_network_os: cisco.nxos.nxos
      operations:
        - name: deploy
      data_store:
        scm:
          origin:
            url: "/path/to/remote/scm"
            token: "superSecretToken"
            user:
              name: scm_user_name

Perform Telemetry Health Checks with action: health_check

---
- name: Perform telemetry health checks
  hosts: nxos-9k
  gather_facts: false
  tasks:
  - name: Run Telemetry Manager
    ansible.builtin.include_role:
      name: network.telemetry.run
    vars:
      ansible_network_os: cisco.nxos.nxos
      operations:
        - name: health_check
          vars:
            checks:
              - name: transport_connected

Supported Health Checks

Health Check Supported For
transport_connected cisco.nxos

Deploy a telemetry collector for use with Event-Driven Ansible

  • This action builds a containerized Telegraf - Kafka that collects telemetry from network devices.
  • The Telegraf container is configured to receive the data on port 57000 and write it to the Kafka topic eda.
  • The Kafka container is configured to listen for reads/writes on port 9092.
  • An EDA rulebook can then read the telemetry data from this Kafka topic by leveraging the Kafka source plugin and take operations.
  • Optionally, you can set the kafka_external_listener variable to the IP address of the host where these containers are deployed. This is required when EDA is running on a different host.
- name: Deploy telemetry collector
  hosts: collector01
  gather_facts: true
  tasks:
  - name: Run Telemetry Manager
    include_role:
      name: network.telemetry.run
    vars:
      operations:
        - name: deploy_collector
          kafka_external_listener: 203.0.113.100 # optional

Example Rulebook

- name: Report incident to ServiceNow
  hosts: nxos
  sources:
    - ansible.eda.kafka:
        host: 203.0.113.100
        topic: eda
        port: 9092
  rules:
    - name: Check route count drops
      condition:
        all:
          - event.fields.routeCount < 100
          - event.tags.vrfName == "prod"
      actions:
        - run_playbook:
            name: report_event.yaml

Support Matrix

Action Platform
deploy Cisco NX-OS
gather Cisco NX-OS
persist Cisco NX-OS
deploy_collector RHEL
CentOS
Fedora

Code of Conduct

This collection follows the Ansible project's Code of Conduct. Please read and familiarize yourself with this document.

Release notes

Release notes are available here.

Contributing to this collection

We welcome community contributions to this collection. If you find problems, please open an issue or create a PR against this repository.

Testing and Development

The project uses tox to run ansible-lint and ansible-test sanity. Assuming this repository is checked out in the proper structure, e.g. collections_root/ansible_collections/network/telemetry, run:

  tox -e ansible-lint
  tox -e py39-sanity

To run integration tests, ensure that your inventory has a network_telemetry group. Depending on what test target you are running, comment out the host(s).

[network_telemetry]
nxos
collector01

[nxos_9k]
nxos

[collectors]
collector01

[nxos_9k:vars]
< enter inventory details for this group >

[collectors:vars]
< enter inventory details for this group >
  ansible-test network-integration -i /path/to/inventory --python 3.9 [target]

Licensing

GNU General Public License v3.0 or later.

See COPYING to see the full text.

network.telemetry's People

Contributors

kb-perbyte avatar nilashishc avatar roverflow avatar ruchip16 avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.