OpenNebula Watch: Accounting and Statistics 3.0

OpenNebula Watch is an utility that provides statistics and accounting information for cloud resources. These values can be used by:

The accounting module will track information of the resource utilization that will be stored in predefined intervals of time. These intervals can be adjusted to the desired length according to your requirements, accounting per month, per hour. This information can be retrieved by User, Virtual Machine and Host.

The statistics module will keep a predefined number of samples containing statistics for Hosts and Virtual Machines. These samples are built from the information that is retrieved for each resource by the OpenNebula Information Manager.

For more information about the values that are stored by these modules, check the database schemas. Also there is a Ruby implementation for retrieving statistics information.

inlinetoc

Requirements

You must have an OpenNebula site properly configured and running to start OpenNebula Watch, be sure to check the OpenNebula Installation and Configuration Guides to set up your private cloud first. This guide also assumes that you are familiar with the configuration and use of OpenNebula.

OpenNebula Watch was installed during the OpenNebula installation, so you just need to install the following packages to meet the runtime dependencies:

  • The JSON parser library:

<xterm>$ sudo gem install json</xterm>

  • Database handler:

<xterm>$ sudo gem install sequel $ sudo gem install sqlite3</xterm>

Considerations & Limitations

OpenNebula 3.0.0 comes with a bug that makes the Accounting & Monitoring collector unable to retrieve memory and cpu data for accounting. To solve this you can download the patch and apply it. These are the steps required to apply it (in a system-wide installation):

<xterm> # cp accounting-3.0.patch /usr/lib/one/ruby/acct # cd /usr/lib/one/ruby/acct # patch < accounting-3.0.patch </xterm>

You now just need to restart the accounting collector.

Configuration

OpenNebula Watch configuration file can be found at /etc/one/acctd.conf.

# Duration of each daemon loop in seconds
:STEP: 300 # 5 minutes

#-------------------------------------------------------------------------------
# VM Monitoring
#-------------------------------------------------------------------------------

:VM_MONITORING:

    # Number of daemon loops until a VM monitoring watch
    :STEPS: 1

    # Number of VM records to preserve
    :WINDOW_SIZE: 5

#-------------------------------------------------------------------------------
# HOST Monitoring
#-------------------------------------------------------------------------------

:HOST_MONITORING:

    # Number of daemon loops until a Hosts monitoring watch
    :STEPS: 3

    # Number of HOST records to preserve
    :WINDOW_SIZE: 5

#-------------------------------------------------------------------------------
# Accounting
#-------------------------------------------------------------------------------

:ACCOUNTING:

    # Number of daemon loops until an accounting watch
    :STEPS: 10

Available options are:

Option Descripction
DB Database to be used instead of the default one. Check the Advance Configuration section below
STEP Duration of each daemon loop in seconds
STEPS Number of daemon loops until a monitoring watch
WINDOW_SIZE Number of records to preserve

:!: Preserve YAML syntax in the acctd.conf file.

Usage

To start the OpenNebula Watch just issue the following command as oneadmin <xterm> $ oneacctd start </xterm>

You can find the OpenNebula Watch log file in /var/log/one/oneacct.log.

To stop the OpenNebula Watch service: <xterm> $ oneacctd stop </xterm>

Tuning & Extending

Changing the default Database

If you want to change the default SQLite database file (/var/lib/one/oneacct.db), or you want to use MySQL instead, you will have to add a new section in the configuration file.

  • SQLite
# Database URI
:DB: sqlite:///var/lib/one/oneacct.db
  • MySQL
# Database URI
:DB: mysql://user:password@host/your_db

Disabling Accounting or Statistics

If you want to disable any of the components you only have to set the STEPS value to 0

#-------------------------------------------------------------------------------
# Accounting
#-------------------------------------------------------------------------------

:ACCOUNTING:

    # Number of daemon loops until an accounting watch
    :STEPS: 0