Monitoring OpenStack Networks

In this article by Chandan Dutta Chowdhury and Sriram Subramanian, authors of the book OpenStack Networking Cookbook, we will explore various means to monitor the network resource utilization using Ceilometer. We will cover the following topics:

  • Virtual Machine bandwidth monitoring
  • L3 bandwidth monitoring

(For more resources related to this topic, see here.)

Introduction

Due to the dynamic nature of virtual infrastructure and multiple users sharing the same cloud platform, the OpenStack administrator needs to track how the tenants use the resources. The data can also help in capacity planning by giving an estimate of the capacity of the physical devices and the trends of resource usage.

An OpenStack Ceilometer project provides you with telemetry service. It can measure the usage of the resources by collecting statistics across the various OpenStack components. The usage data is collected over the message bus or by polling the various components. The OpenStack Neutron provides Ceilometer with the statistics that are related to the virtual networks.

The following figure shows you how Ceilometer interacts with the Neutron and Nova services:

To implement these recipes, we will use an OpenStack setup as described in the following screenshot:

This setup has two compute nodes and one node for the controller and networking services.

Virtual Machine bandwidth monitoring

OpenStack Ceilometer collects the resource utilization of virtual machines by running a Ceilometer compute agent on all the compute nodes. These agents collect the various metrics that are related to each virtual machine running on the compute node. The data that is collected is periodically sent to the Ceilometer collector over the message bus.

In this recipe, we will learn how to use the Ceilometer client to check the bandwidth utilization by a virtual machine.

Getting ready

For this recipe, you will need the following information:

  • The SSH login credentials for a node where the OpenStack client packages are installed
  • A shell RC file that initializes the environment variables for CLI

How to do it…

The following steps will show you how to determine the bandwidth utilization of a virtual machine:

  1. Using the appropriate credentials, SSH into the OpenStack node installed with the OpenStack client packages.
  2. Source the shell RC file to initialize the environment variables required for the CLI commands.
  3. Use the nova list command to find the ID of the virtual machine instance that is to be monitored:
  4. Use the ceilometer resource-list| grep <virtual-machine-id> command to find the resource ID of the network port associated with the virtual machine. Note down the resource ID for the virtual port associated to the virtual machine for use in the later commands. The virtual port resource ID is a combination of the virtual machine ID and the name of the tap interface for the virtual port. It's named in the form instance-<virtual-machine-id>-<tap-interface-name>:
  5. Use ceilometer meter-list –q resource=<virtual-port-resource-id> to find the meters associated with the network port on the virtual machine:
  6. Next, use ceilometer statistics –m <meter-name> –q resource=<virtual-port-resource-id> to view the network usage statistics. Use the meters that we discovered in the last step to view the associated data:

Ceilometer stores the port bandwidth data for the incoming and outgoing packets and the bytes and their rates.

How it works…

The OpenStack Ceilometer compute agent collects the statistics related to the network port connected to the virtual machines and posts them on the message bus. These statistics are collected by the Ceilometer collector daemon. The Ceilometer client can be used to query a meter and filter the statistical data based on the resource ID.

L3 bandwidth monitoring

The OpenStack Neutron provides you with metering commands in order to enable the Layer 3 (L3) traffic monitoring. The metering commands create a label that can hold a list of the packet matching rules. Neutron counts and associates any L3 packet that matches these rules with the metering label. In this recipe, we will learn how to use the L3 traffic monitoring commands of Neutron to enable packet counting.

Getting ready

For this recipe, we will use a virtual machine that is connected to a network that, in turn, is connected to a router. The following figure describes the topology:

We will use a network called private with CIDR of 10.10.10.0/24.

For this recipe, you will need the following information:

  • The SSH login credentials for a node where the OpenStack client packages are installed
  • A shell RC file that initializes the environment variables for CLI
  • The name of the L3 metering label
  • The CIDR for which the traffic needs to be measured

How to do it…

The following steps will show you how to enable the monitoring traffic to or from any L3 network:

  1. Using the appropriate credentials, SSH into the OpenStack node installed with the OpenStack client packages.
  2. Source the shell RC file to initialize the environment variables required for the CLI commands.
  3. Use the Neutron meter-label-create command to create a metering label. Note the label ID as this will be used later with the Ceilometer commands:
  4. Use the Neutron meter-label-rule-create command to create a rule that associates a network address to the label that we created in the last step. In our case, we will count any packet that reaches the gateway from the CIDR 10.10.10.0/24 network to which the virtual machine is connected:
  5. Use the ceilometer meter-list command with the resource filter to find the meters associated with the label resource:
  6. Use the ceilometer statistics command to view the number of packets matching the metering label:

The packet counting is now enabled and the bandwidth statistics can be viewed using Ceilometer.

How it works…

The Neutron monitoring agent implements the packet counting meter in the L3 router. It uses iptables to implement a packet counter. The Neutron agent collects the counter statistics periodically and posts them on the message bus, which is collected by the Ceilometer collector daemon.

Summary

In this article, we learned about ways to monitor the usage of virtual and physical networking resources. The resource utilization data can be used to bill the users of a public cloud and debug the infrastructure-related problems.

Resources for Article:


Further resources on this subject:


You've been reading an excerpt of:

OpenStack Networking Cookbook

Explore Title