GithubHelp home page GithubHelp logo

danfael / ciscoaci_grafana Goto Github PK

View Code? Open in Web Editor NEW

This project forked from nwmichl/ciscoaci_grafana

0.0 0.0 0.0 277 KB

Monitor Cisco ACI via REST-API with the TIG-Stack (Telegraf, InfluxDB, Grafana)

License: MIT License

Shell 100.00%

ciscoaci_grafana's Introduction

published

Monitor Cisco ACI via REST-API

Demo about how to monitor Cisco ACI via REST-API and the TIG-Stack (Telegraf, InfluxDB, Grafana).

Cisco ACI TIG-Stack

Use Case Description

Modern controller based networks are quite different from a monitoring perspective, all the fancy network abstraction information is hiding behind this thing called API. SNMP might still be there, but is missing most of the interesting bits like health scores, faults and Tenant/App/Policy based metrics. Cisco ACI is one of the few ‘API-first’ network solutions on the market, meaning really every bit of information is available via the programmable interface. You might monitor single fabric nodes via established SNMP processes, this demo though is all about the interesting metrics exposed by REST-API on the controller named APIC. The TIG-Stack (Telegraf, InfluxDB, Grafana) covers 200 different input sources, a scalable time series database and a powerful dashboard front-end – all you need for a single holistic view over the whole infrastructure stack.

Installation

Telegraf, InfluxDB, Grafana

First of all, you need a working TIG-Stack. The installation is pretty simple and not in the scope of this demo. In addition to that, your Telegraf instance needs curl and in the case of signature based authentication: OpenSSL.

sudo yum install curl
sudo yum install openssl

Shell scripts

apic_query.sh and apic_querysig.sh may live in the /etc/telegraf directory and provide a wrapper around the API Call. The Telegraf inputs.http doesn't support cookie handling, so I decided to break out to bash and use inputs.exec to parse the json response. Same for the cert / signature based authentication script, because nobody really wants to generate the signature and build the http header cookie by hand. Keep in mind that all user/password based API Calls are rate limited by the NGINX process at the APIC. So, depending on the scope and frequency you are better off with cert based access.

Configuration

Cisco ACI

On the APIC side, just create a dedicated Telegraf user with admin role and read-only rights on all security domains. In case you want to use cert based authentication, generate a X509 cert with CN=APIC username.

$openssl req -new -newkey rsa:4096 -days 3650 -nodes -x509 -keyout telegraf.key -out telegraf.crt -subj '/CN=telegraf/O=NWMICHL/C=DE' 

The telegraf.key file is your private key, should be kept secret (in your /etc/telegraf/ directory ;-) and will be used to sign API-Calls to authenticate every request. The public key has to be installed at the APIC for the telegraf user. Set the User Certificate Attribute to the certificate DN (telegraf) and copy/paste the output of ‘cat telegraf.crt’ to the APIC (User Certificates, click +). The Certificate Name should be in the form .crt for the following bash script to work. After submit, the new certificate should be active.

Telegraf

To read metrics from the APIC, the two shell scripts can now be invoked by the Telegraf inputs.exec plugin. Every API call gets a dedicated Telegraf configuration file to live in the /etc/telegraf/telegraf.d/ directory, because the API path / operation is different depending on the requested information. The five examples in this repository query all metrics to populate the Grafana dashboard of this demo.

Usage

Example bash execution of the two shell scripts would look like this:

sh /etc/telegraf/apic_query.sh sandboxapicdc.cisco.com /api/class/fabricHealthTotal.json telegraf telegraf

sh /etc/telegraf/apic_querysig.sh sandboxapicdc.cisco.com /api/class/fabricHealthTotal.json telegraf telegraf.key

Before reloading Telegraf to accept the new configuration, you can test the agent to show what lines will be added to the InfluxDB.

$telegraf --test --config-directory /etc/telegraf/telegraf.d --input-filter exec

$sudo systemctl reload telegraf

Grafana Dashboard

The Dashboard is a first idea to visualize central Cisco ACI metrics and should help to get started developing own solutions. The dashboard.json can be downloaded from github and imported via Grafana / click + / choose Import. Just enter a name, the database source and change the UID if needed.

Cisco ACI Dashboard

DevNet Sandbox

APIC Sandbox to play with, just in case: https://developer.cisco.com/docs/aci/#!sandbox

Getting help

Feel free to visit my blog at http://nwmichl.net/2020/04/19/monitor-cisco-aci-via-rest-api/ for full documentation of the ACI vs. TIG process.

ciscoaci_grafana's People

Contributors

nwmichl 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.