Exporting OpenNebula accounting data.
- Ruby >= 2.0
- Redis server (doesn't have to be present on the same machine)
- OpenNebula >= 4.4 (doesn't have to be present on the same machine)
From distribution specific packages
Distribution specific packages can be created with omnibus packaging for OneacctExport. When installing via packages you don't have to install neither ruby nor rubygems. Packages contain embedded ruby and all the necessary gems and libraries witch will not effect your system ruby, gems and libraries.
Currently supported distributions:
- Ubuntu 10.04
- Ubuntu 12.04
- Ubuntu 14.04
- Debian 6.0.10
- Debian 7.6
- CentOS 5.10
- CentOS 6.5
To install the most recent stable version
gem install oneacct-export
From source (dev)
Installation from source should never be your first choice! Especially, if you are not familiar with RVM, Bundler, Rake and other dev tools for Ruby!
However, if you wish to contribute to our project, this is the right way to start.
To build and install the bleeding edge version from master
git clone git://github.com/the-oneacct-export-project/oneacct_export.git cd oneacct_export gem install bundler bundle install bundle exec rake spec rake install
Create a new user account
Create or use an existing
apel user account which will be used to run
the export process. This account must be the same as the user account
used by the APEL SSM client.
Create a configuration file for OneacctExport
Configuration file can be read by OneacctExport from these three locations:
The example configuration file can be found at the last location
PATH_TO_GEM_DIR/config/conf.yml. When editing a configuration
file you have to follow the division into three environments:
test. All the configuration options are described
in the example configuration file.
Create a configuration file for Sidekiq
Sidekiq configuration file can be placed anywhere you want since you will provide
path to the configuration later during the Sidekiq start. How the Sidekiq
configuration should look like and what options you can use
can be found on its wiki page.
An example is provided in
The important thing is to set the same queue name in both OneacctExport and Sidekiq configuration files. OneacctExport is currently supporting adding jobs to only one queue.
Create required directories
mkdir -p /var/run/oneacct-export chown apel:apel /var/run/oneacct-export mkdir -p /var/log/oneacct-export chown apel:apel /var/log/oneacct-export
Configure RPC connection
RPC connection for OpenNebula can be configured in two ways:
- Via OneacctExport configuration file, option xml_rpc and its suboptions
- Via OpenNebula configuration mechanism:
System environment variable
ONE_AUTH contains path to the file containing
string in format
username:password to authenticate against OpenNebula.
If the variable is empty, default file location is
System environment variable
ONE_XMLRPC contains URL of OpenNebula RPC
gate. If empty, the same information can be stored in
Configure vmcatcher IMAGE attribute inheritance in OpenNebula
INHERIT_IMAGE_ATTR = "VMCATCHER_EVENT_AD_MPURI" INHERIT_IMAGE_ATTR = "VMCATCHER_EVENT_DC_IDENTIFIER" INHERIT_IMAGE_ATTR = "VMCATCHER_EVENT_IL_DC_IDENTIFIER" INHERIT_IMAGE_ATTR = "VMCATCHER_EVENT_SL_CHECKSUM_SHA512" INHERIT_IMAGE_ATTR = "VMCATCHER_EVENT_HV_VERSION"
Configure benchmark host attributes in OpenNebula
In order to recognize and fill
Benchmark APEL v0.4 fields,
two attributes have to be set for every host in OpenNebula:
BENCHMARK_TYPE- represents benchmark's type. For example:
BENCHMARK_VALUE- represents a per-core measured value of said benchmark. For example:
Both attributes can be set both for clusters and hosts in OpenNebula with hosts' attributes taking precedence. If attributes are set only for cluster, all hosts within the cluster will be assigned these values.
Set Rails environment variable according to your environment
You have to set system environment variable
RAILS_ENV to one of the
values production, development or test. OneacctExport is not a Rails
application but we chose the Rails variable for easier possible integration in
Both OpenNebula and Redis server must be running prior the next steps.
First you have to start Sidekiq so it can run the jobs from the queue. Since OneacctExport is not a Rails application Sidekiq has to be started with OneacctExport's worker class as an argument. For example:
sidekiq -r $PATH_TO_GEM_DIR/lib/one_worker.rb -C $PATH_TO_GEM_DIR/config/sidekiq.yml
OneacctExport is run with executable
oneacct-export. For a list of all
available options run
$ oneacct-export -h Usage oneacct-export [options] --records-from TIME Retrieves only records newer than TIME --records-to TIME Retrieves only records older than TIME --records-for PERIOD Retrieves only records within the time PERIOD --include-groups [GROUP1,GROUP2,...] Retrieves only records of virtual machines which belong to the specified groups --exclude-groups [GROUP1,GROUP2,...] Retrieves only records of virtual machines which don't belong to the specified groups --group-file FILE If --include-groups or --exclude-groups specified, loads groups from file FILE -b, --[no-]blocking Run in a blocking mode - wait until all submitted jobs are processed -t, --timeout N Timeout for blocking mode in seconds. Default is 1 hour. -c, --[no-]compatibility-mode Run in compatibility mode - supports OpenNebula 4.4.x -h, --help Shows this message -v, --version Shows version
Package specific scripts
When installed from packages build via omnibus packaging for OneacctExport,
both Sidekiq and OneacctExport are automatically registered as cron jobs to run
periodically. Cron job managing OneacctExport uses a bash script which is
simplifying OneacctExport interface for most common use cases. After the installation,
script can be found in
/usr/bin/oneacct-export-cron. Script can accept command line options
which sets age of retrieved records accordingly. There is also a set of files
which when present in
/opt/oneacct-export/ directory serves as a configuration shortcut:
compat.one- turns on compatibility mode (same as OneacctExport option
groups.include- contains list of groups to include (same as combination of OneacctExport options
groups.exclude- contains list of groups to exclude (same as combination of OneacctExport options
- Fork it ( https://github.com/the-oneacct-export-project/oneacct-export/fork )
- Create your feature branch (
git checkout -b my-new-feature)
- Commit your changes (
git commit -am 'Add some feature')
- Push to the branch (
git push origin my-new-feature)
- Create a new Pull Request
To change the log level of
sidekiq you have to set the environment variable ONEACCT_EXPORT_LOG_LEVEL to log level you need. Supported log levels are