Site Search

How to visualize SNMP data using OSS ~Grafana x OcNOS~

Introduction

This article introduces how to visualize SNMP (Simple Network Management Protocol) data using the Open Source Software (OSS) Grafana dashboard.

In the 9th article, I touched on the visualization of SNMP data using OSS, using SONiC as an example. I touched on OcNOS in the 4th article, so be sure to check that out as well.

Since OSS tools are used, there is no cost, and as long as you have a server running the tools and network devices to be monitored, you can view SNMP data that used to be viewed as text as a diagram.

There are other articles related to Open Networking, so please see the articles that interest you from the "List of articles" below.



We will explain the settings of the OSS tool used to visualize SNMP data using the simple network configuration diagram below as an example.

The contents of this issue are as follows:
① Setting to use telegraf to obtain MIB information from white Box switches and store it in influxDB
② Check access to InfluxDB and Grafana
③ Grafana dashboard visualization example
We will introduce you to the following.

For an overview of the various tools, please refer to Part 9.

Simple network diagram

Simple network diagram

What is SNMP?

First, I will explain the overview of SNMP for visualization.

SNMP is an application layer protocol for monitoring and controlling communication devices such as servers and switches via a network.
It consists of an SNMP manager on the managing side and an SNMP agent on the managed side as shown below, and exchanges information such as the number of discarded packets. The SNMP manager uses UDP Port = 162 and the SNMP agent uses UDP Port = 161.

SNMP operation image diagram

SNMP operation image diagram

MIB for data exchange in SNMP communication

Next, we will explain the MIB (Management Information Base) used to exchange information with SNMP.
MIB refers to a collection of device information held by the SNMP agent. This MIB includes information such as the number of packets received and the number of packets discarded, and by exchanging the MIB, it is possible to check the interface usage status, etc.

Additionally, the MIB has a tree structure. The information in the MIB is called an object and is assigned an OID (Object ID).

MIB tree structure diagram

MIB tree structure diagram

 

For example, each object is assigned an OID as shown below.

 

Object OID explanation
SysName 1.3.6.1.2.1.1.5 Device host name
interface 1.3.6.1.2.1.2 Various information such as interface status and traffic
if In Octets 1.3.6.1.2.1.2.2.1.10 Total number of bytes received by each Interface

Settings for various OSS tools

Edit telegraf configuration file

Edit the telegraf configuration file (telegraf.conf) with the following command to get SNMP MIB information from the whitebox Box. If the settings are reflected correctly, the MIB information of the whitebox Box will be acquired by telegraf and saved in i nfluxDB.

$ sudo vi /etc/telegraf/telegraf.conf

 

* The image below is an example of editing telegraf.conf. Agent is a white Box switch that outputs MIB information. Various setting items are as follows.

interval: Interval for collecting Agent data (MIB information)

# Configuration for telegraf agent
[agent]
 ## Default data collection interval for all inputs
 interval = "20s"

Agent data collection interval

url: influxDB url for output
database: Tool used for influxDB (telegraf)

# Configuration for sending metrics to InfluxDB
[[outputs.influxdb]]
 ## The full HTTP or UDP URL for your InfluxDB instance.
 ##
 ## Multiple URLs can be specified for a single cluster, only ONE of the
 ## urls will be written to each interval.
 # urls = [ "unix:///var/run/influxdb.sock"]
 # urls = [ "udp://127.0.0.1:8089"]
  urls = [ "http://127.0.0.1:8086"]

 ## The target database for metrics; will be created as needed.
 ## For UDP url endpoint database needs to be configured on server side.

  database = "telegraf"

Destination i nfluxDB

agents: IP of target device for data collection
timeout: Time to wait for a response after issuing a data collection request
version: SNMP version
agent_host_tag: the tag used to refer to the data host
community: SNMP community name for which you want to obtain data
retries: number of times to try retries

# # Retrieves SNMP values from remote agents
[[inputs.snmp]]
# ## Agent addresses to retrieve values from.
# ##  format: agents = ["<scheme://><hostname>:<port>"]
# ##  scheme: optional, either udp, udp4, udp6, tcp, tcp4, tcp6.
# ##       default is udp
# ##  port: optional
# ##  example: agents = ["udp://127.0.0.1:161"]
# ##       agents = ["tcp://127.0.0.1:161"]
# ##       agents = ["udp4://v4only-snmp-agent"]

  agents = ["udp://192.168.0.70:161"]
#
# ## Timeout for each request.

  timeout = "5s"
#
# ## SNMP version; can be 1, 2, or 3.

  version = 2
#
# ## Agent host tag; the tag used to reference the source host

  agent_host_tag = "agent_host"
#
# ## SNMP community string.

  community = "SNMPServer"
#
# ## Number of retries to attempt.

  retries = 3

SNMP related settings – Agent IP, Timeout time, etc.

name: MIB object name
oid: OID of SNMP (this time set by name instead of number)

[[inputs.snmp.field]]
name = "sysUpTime"
oid = "DISMAN-EVENT-MIB::sysUpTimeInstance"

#
# Interfacec metrics
#
[[inputs.snmp.table]]
name = "ifTable"
oid = "IF-MIB::ifTable"
inherit_tags = [ "sysName" ]
[[inputs.snmp.table.field]]
name = "ifName"
oid = "IF-MIB::ifName"
is_tag = true
[[inputs.snmp.table.field]]
name = "ifDescr"
oid = "IF-MIB::ifDescr"
is_tag = true
[[inputs.snmp.table]]
name = "ifXTable"
oid = "IF-MIB::ifXTable"
inherit_tags = ["sysName"]
[[inputs.snmp.table.field]]
name = "ifName"
oid = "IF-MIB::ifName"
is_tag = true
[[inputs.snmp.table.field]]
name = "ifDescr"
oid = "IF-MIB::ifDescr"
is_tag = true

MIB information to retrievestandard / extended MIB, etc.

service_address: UDP port number

# # Receive SNMP traps
[[inputs.snmp_trap]]
# ## Transport, local address, and port to listen on, Transport must
# ## be "udp://", Omit local address to listen on all interfaces.
# ## example: "udp://127.0.0.1:1234"
# ##
# ## Special permissions may be required to listen on a port less than
# ## 1024. See README.md for datails
# ##
  service_address = "udp://:162"
# ## Timeout running snmptranslate command
  timeout = "5s"
# ## Snmp version, defaults to 2c
  version = "2c"

SNMP Trap settings – UDP Port, Timeout, SNMP ver., etc.

Start telegraf, influxDB and Grafana

Start various OSS tools on the Ubuntu server.

$ sudo systemctl daemon-reload
$ sudo systemctl start influxdb.service
$ sudo telegraf --config /etc/telegraf/telegraf.conf &
$ sudo systemctl start grafana-server.service

Check access to influxDB

Check if you can access influxDB by accessing http://192.168.0.80:8086 on the web.

* The version used this time does not support GUI, so 404 page not found is displayed. (The access itself is successful.)

Check access to Grafana

Check whether you can access Grafana by accessing http://192.168.0.80:3000 on the web in the same way as influxDB.
For the first access, use the User and Password below.

User: admin
Password: admin

*When you log in, you will be asked to change your password.

GrafanaのHome画面

Grafana​ ​home screen

Grafana dashboard visualization example

Grafana By configuring a dashboard using the dashboard creation method, you can display various information about your switch, such as:

The displayed content of the visualization example below includes the following information:

① Switch activation time
② Interface link and connection information
③CPU Load information such as temperature and usage rate
④Fan speed
⑤ All traffic passing through an interface or specific packets (Unicast packets, etc.) Only traffic information

Dashboard visualization example

Dashboard visualization example

The above is an example of settings for obtaining MIB information of a white Box switch using SNMP and visualization of the Grafana dashboard.

In Part 11, I will introduce how to create a Grafana dashboard.

At the end

Macnica provides a service that remotely provides an environment where you can experience open networking and conduct tests and verifications.
This service allows us to verify the operability of network OSes and perform tests that combine network OSes from various manufacturers, white Box switches, and optical transceivers.

マクニカではオープンネットワーキングを実際に体験し、試験や検証をおこなえる環境をリモートで提供するサービスのご用意があります。  本サービスでは、ネットワークOSの操作性の検証、様々なメーカーのネットワークOSやホワイトボックススイッチ、光トランシーバーを組み合わせた試験をおこなえます。

Image of remote verification service

It is a service that allows you to easily verify open networking, and the basic configuration is free of charge.

You can check the downloadable materials for available network OS and white Box switches, specific use cases, and how to apply. The materials can be downloaded from the URL listed in the information email by answering the questionnaire from the "Macnica Network OS Remote Verification Service" below.

These people are using the remote verification service.

Here are some testimonials from people who have actually used the service.

 

Furukawa Network Solution Co., Ltd.

“Recently, the number of remote service environments is increasing, but I was impressed with the ease of access to the evaluation equipment.

The materials you provided were easy to understand, and we were able to proceed smoothly with the intended verification. ”


Click here for list of materials

Document list

In addition to introducing products handled by Macnica,
We publish materials related to open networking, such as BGP cross network automatic construction files and network operation test evaluation reports.

Click here for details

Product Page Top

Edgecore Networks

We continue to be a pioneer in open networking by developing and selling products related to OpenNetworking/white Box switches.

Aviz Networks

We are pioneers of SONiC, an open source network operating system, providing observability, configuration automation tools and support from a team of SONiC experts.

IP Infusion

As a market leader among open networking providers, we provide reliable network solutions to over 600 customers, including carriers, service providers, and data centers.

Inquiry/Document request

In charge of Macnica Edgecore Networks

Weekdays: 9:00-17:00