Using OpenStack Telemetry to interrogate usage statistics

With the telemetry modules installed and configured, we can now use the Ceilometer command line to interrogate resource usage statistics. We do this by retrieving meters that were set up for our environment and in listing the data.

Getting ready

Ensure that you are logged into a Ubuntu host that has access to our OpenStack environment on the 192.168.100.0/24 public network. This host will be used to run client tools against the OpenStack environment created. If you are using the accompanying Vagrant environment, as described in the Preface, you can use the controller node. This has the python-ceilometer package that provides the ceilometer command-line client.

If you created this node with Vagrant, you can execute the following command:

vagrant ssh controller 

Ensure that you have set the following credentials (adjust the path to your certificates and key file to match your environment if not using the Vagrant environment):

export OS_TENANT_NAME=cookbook
export OS_USERNAME=admin
export OS_PASSWORD=openstack
export OS_AUTH_URL=https://192.168.100.200:5000/v2.0/
export OS_NO_CACHE=1
export OS_KEY=/vagrant/cakey.pem
export OS_CACERT=/vagrant/ca.pem
vagrant ssh controller

How to do it...

We will first list the meters available in our environment:

  1. We will list the meters available in our environment:
    ceilometer meter-list
    

    The preceding command will display the following information:

    How to do it...
  2. Narrow down the meter list by a particular VM:
    ceilometer meter-list --query resource=4be430e2-9b12
    

    We get the following output:

    How to do it...
  3. We can view sample data for different meters related to our VM. To view the sample data, use the following command:
    ceilometer sample-list -m disk.write.bytes
    

    This will provide a lot of raw data:

    How to do it...

    We trimmed the preceding output for readability; usually there will be a lot more data.

  4. Ceilometer comes with some helpful tools to perform calculations and provide statistics. We can now get the statistics for individual meters and investigate the disk write rate:
    ceilometer statistics --meter disk.write.bytes.rate 
    

    The preceding command will provide the following output:

    How to do it...
  5. Ceilometer allows custom queries. To view the data for a particular date range, we will enter start and end times:
    ceilometer  statistics -m disk.write.bytes.rate  
    -q 'timestamp>2015-04-14T22:38:15; 
    timestamp<=2015-04-19T04:28:15' --period 60
    

    The preceding command will give us a lot of data for a given range. Here is the truncated output:

    How to do it...
  6. To investigate statistics for cumulative data, we will check network outgoing bytes with the following command:
    ceilometer statistics -m network.outgoing.bytes 
    

    The preceding command will give us the following output:

    How to do it...

    Tip

    Here, we wrapped the table output for easier readability. Normally, all columns would be presented together.

    The main difference is that, in addition to all the other columns as before, we now have a Sum column that has the total sum of all outgoing bytes.

  7. To list a running sum of bytes for outgoing networks, we will use a query for a specific time range:
    ceilometer statistics -m network.outgoing.bytes 
    -q 'timestamp>2015-04-14T22:38:15;
    timestamp<=2015-04-19T04:28:15' --period 60
    

    We will get the following output:

    How to do it...

    We can see the cumulative running total during the specified time interval. For the sake of readability, we removed the Period, Count, and Duration columns and some data in the middle of the time range.

How it works...

Ceilometer collects data from various OpenStack components. We have viewed meters that were set up for our environment and queried data based on the date range. Ceilometer provides three types of data—cumulative, gauge, and delta. We have looked at gauge data, which provided information about the disk write rate. We also looked at cumulative data for a date interval. To list the Ceilometer meters, use the following command:

ceilometer meter-list

To view sample data for individual meters, we used the -m or --meter flags with the following command:

ceilometer sample-list -m disk.write.bytes

Ceilometer also provides statistics for the various data it collects. To view statistics, we issue the following command:

ceilometer statistics --meter disk.write.bytes.rate 

The preceding command also accepts queries in the following format:

ceilometer statistics -m disk.write.bytes.rate -q 
'timestamp>2015-04-14T22:38:15;
timestamp<=2015-04-19T04:28:15' --period 60

Tip

Ceilometer collects, stores, and queries what can be middling-to-large amounts of data or big data—depending on the number of hosts and meters configured. While it is beyond the scope of this book to teach you how to handle middling-to-large data problems, it is recommended that, if you deploy Ceilometer in production, you should host its operations where it will not otherwise impact your workloads.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset