• No results found

Showback

In document OpenNebula 5.0 Operation Guide (Page 62-67)

The showback toolset reports resource usage cost, and allows the integration with chargeback and billing platforms.

The toolset generates showback reports using the information retrieved from OpenNebula.

2.9.1 Set the VM Cost

Each VM Template can optionally define a cost (see thesyntax here). The cost is defined as cost per cpu per hour, and cost per memory MB per hour. The cost units are abstract and their equivalent to monetary or other cost metrics have to be defined in each deployment.

Using this cost schema allows the users to resize the Virtual Machine instances.

2.9. Showback 58

There is a default cost that will be applied to VM Templates without a cost defined. It can be set in the oned.conf file.

Warning: If your users can access the Sunstone ‘user’ view, it’s important to set a default cost. These users can manage their own Templates, which won’t have a specific cost assigned.

2.9.2 Calculate Monthly Reports

Before the cost reports can be seen by the users, the administrator has to generate them. To create the monthly cost reports, use the oneshowback command:

$ oneshowback calculate -h Usage: oneshowback [options]

-s, --start TIME First month of the data -e, --end TIME Last month of the data

When this command is executed, the OpenNebula core reads all the accounting records, and calculates the total cost for each month. The records include the total cost of the month, and basic information about the VM and its owner.

This information is then stored in the database, to be consumed with the oneshowback list command.

The monthly cost of each VM is calculated as the sum of:

• CPU_COST * CPU * HOURS

2.9. Showback 59

• MEMORY_COST * MEMORY * HOURS

• DISK_COST * DISK_SIZE * HOURS

The number of hours is calculated as the total number of hours that a VM has been running. The time a VM is in other states, such as pending, poweroff, or stopped does not count towards the cost.

If the time range includes the current month, OpenNebula will calculate the cost up to today’s date. It is up to the administrators to leave the current month out of the showback records, to update it daily, or hourly. In any case, it is important to re-calculate it when the month ends. This operation can be easily automated by a cron job.

The oneshowback command can only be executed by the oneadmin user.

Some examples:

To calculate all records, starting from March up to today:

$ oneshowback calculate --start "03/2016"

To calculate only September:

$ oneshowback calculate --start "09/2016" --end "09/2016"

Note: This is a resource intensive operation. For big deployments, it is recommended to use the --start option to process only the last missing months.

Note: Existing records can be re-calculated. This can be useful to update old records when a VM is renamed, or the owner is changed. In this case, the cost of previous months will be also assigned to the new user.

2.9.3 Retrieve Monthly Reports

Any user or administrator can see their monthly showback reports from the CLI or Sunstone:

2.9. Showback 60

## USAGE list

Returns the showback records

valid options: start_time, end_time, userfilter, group, xml, json, verbose,

˓→help, version, describe, list, csv, user, password, endpoint

## OPTIONS

-s, --start TIME First month of the data -e, --end TIME Last month of the data

-u, --userfilter user User name or id to filter the results -g, --group group Group name or id to filter the results -x, --xml Show the resource in xml format

-j, --json Show the resource in json format -v, --verbose Verbose mode

-h, --help Show this message

-V, --version Show version and copyright information --describe Describe list columns

2.9. Showback 61

-l, --list x,y,z Selects columns to display with list command

--csv Write table in csv format

--user name User name used to connect to OpenNebula --password password Password to authenticate with OpenNebula --endpoint endpoint URL of OpenNebula xmlrpc frontend

2.9.4 Disable Showback in Sunstone

Showback reports can be disabled in any of the Sunstone views modifying the yaml file of those views. These files can be found in /etc/one/sunstone-views

...

features:

showback: false

2.9.5 Tuning & Extending

To integrate the showback reports with external tools, you can get the CLI output as xml, json, or csv data.

$ oneshowback list -u cloud_user --list YEAR,MONTH,VM_ID,COST --csv YEAR,MONTH,VM_ID,COST

2015,10,4258,1824279.62 2015,10,4265,433749.03 2015,11,4258,34248600

Developers interacting with OpenNebula using the Ruby bindings can use theVirtualMachinePool.showback method to retrieve showback information filtering and ordering by multiple parameters.

2.9. Showback 62

THREE

VIRTUAL NETWORK MANAGEMENT

3.1 Overview

This chapter contains documentation on how to create and manageVirtual Networks, how to define and manage Security Groups, which will allow users and administrators to define firewall rules and apply them to the Virtual Machines, and how to create and manageVirtual Routerswhich are an OpenNebula resource that provide routing across Virtual Networks.

3.1.1 How Should I Read This Chapter

Before reading this chapter, you should have already installed your Frontend, the KVM Hosts or vCenter node and have an OpenNebula cloud up and running with at least one virtualization node.

3.1.2 Hypervisor Compatibility

Section Compatibility

Virtual Networks This Section applies to both KVM and vCenter.

Security Groups This Section applies to KVM.

Virtual Routers This Section applies to both KVM and vCenter.

In document OpenNebula 5.0 Operation Guide (Page 62-67)