Code Monkey home page Code Monkey logo

sdn-prometheus's Introduction

Monitoring system for an SDN with Prometheus and Grafana

Setting up prometheus to monitor an SDN Controller (ONOS) and its topology.

Set up a topology on mininet

You can create your topology on mininet following the example file in this repository.

To run it
$ sudo mn --custom path-to-file/topology.py --topo mytopo

Set all the switches to use OpenFlow protocol
$ sudo ovs-vsctl set bridge <switch-name> protocols=OpenFlow14,OpenFlow13

Download and Run the Controller on the local machine, following the official documentation. The last steps are:
$ sudo ./onos-2.0.0/apache-karaf-4.2.2/bin/start
$ sudo ./onos-2.0.0/apache-karaf-4.2.2/bin/client
and inside the onos cli run this final command
$ app activate org.onosproject.fwd org.onosproject.openflow

Now connect all the switches to the controller
$ sudo ovs-vsctl set-controller <switch-name> tcp:localhost
and set the secure mode $ sudo ovs-vsctl set-fail-mode <switch-name> secure

Install Open vSwitch.
By running $ sudo ovs-vsctl show you can see the topology.
And at http://localhost:8181/onos/ui you can access the ONOS's UI.

Set up Prometheus

Download Prometheus in your preferred environment.
e.g. $ wget https://github.com/prometheus/prometheus/releases/download/v2.24.0/prometheus-2.24.0.linux-amd64.tar.gz

For linux:
$ cd download-folder
$ tar -xzf prometheus-<version>.linux-amd64.tar.gz

To run it:
$ cd download-folder/prometheus-<version>.linux-amd64/
$ ./prometheus

Once it is running, you can connect to localhost:9090 to see the dashboard.

Set up the exporters

Node Exporter

To have general information about the heath of the machine get the node_exporter. E.g.
$ wget https://github.com/prometheus/node_exporter/releases/download/v1.0.1/node_exporter-1.0.1.linux-amd64.tar.gz
unzip it: $ tar -xzf node_exp..[TAB]
$ cd node_exp..[TAB] and run it
$ ./node_exporter

Then, in the prometheus folder, modify prometheus.yml and add a new job for the node_exporter (port 9100). Check the file in this repo for a full example.

- job_name: 'node-exporter'
    static_configs:
    - targets: ['localhost:9100']

Run: $ kill -s HUP $(pidof prometheus) to refresh prometheus without any scraping downtime.

ONOS Exporter

Set the onos-config.json with the required information to access the ONOS controller.

Install the requirements of the onos-exporter with
$ pip install requirements
then run $ python3 exporter.py

Add another job to the prometheus configuration file (port 9091).

- job_name: 'onos-exporter'
    static_configs:
    - targets: ['localhost:9091']

Run again $ kill -s HUP $(pidof prometheus). This onos exporter was build from the great work of Zufar Dhiyaulhaq.

Set up Grafana

Download and run Grafana. From the UI:

  • add prometheus as data source
  • import the dashboard in this repo.

References

Great introduction to set-up prometheus with node exporter here.

sdn-prometheus's People

Contributors

querciak avatar

Stargazers

Niloy Saha avatar

Watchers

James Cloos 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.