Accounting client
The accounting toolset visualizes and reports resource usage data. This tool addresses the accounting of virtual resources, including the resource consumption of virtual machines as reported by the hypervisor. It can be accessed via the dashboard CLI or web front GUI. Below is an introduction to the dashboard CLI command.
Usage
hypercloud acct
will print accounting information for virtual machines
| Usage: hypercloud acct [options] |
| -s, --start TIME | First day of the data to retrieve
| -e, --end TIME | Last day of the data to retrieve
| -u, --userfilter user | User name or id to filter the results
| -g, --group group | Group name or id to filter the results
| -H, --host HOST | Host name or id to filter the results
| --xpath XPATH_EXPRESSION | Xpath expression to filter the results. For example, hypercloud acct --xpath 'HISTORY[ETIME>0]'
|-x, --xml | Show the resource in xml format
|-j, --json | Show the resource in json format
| --split | Split the output in a table for each VM
|-v, --verbose | Verbose mode
| -h, --help | Show this message
| -V, --version | Show version and copyright information
| --describe | Describe list columns
| -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 HyperCloud
| --password password | Password to authenticate with HyperCloud
| --endpoint endpoint | URL of HyperCloud API front-end
The time can be written as month/day/year hour:minute:second
, or any other similar fashion, e.g. month/day hour:minute
.
To integrate this tool with other systems, the -j, -x, or --csv
flags can be used to organize the information in a computer-readable format.
Output
The hypercloud acct
command prints individual virtual machine history records. This means that for a singular VM, it is possible to have several accounting entries returned; one for each migration or stop/suspend action. A disk resize or disk/NIC attachment will also result in a new entry.
Each entry contains complete information for the VM, including VM monitoring information; however, by default, only network consumption is reported. See Tuning & Extending for more information.
When the results are filtered with -s
and/or -e
options, all history records active during that time interval are shown, but they can have started or ended outside the given interval.
Example
$ hypercloud acct -s 05/01 -e 06/01
Showing active history records from 2016-05-01 00:00:00 +0200 to 2016-06-02 00:00:00 +0200
# User 0
VID HOSTNAME ACTION REAS START_TIME END_TIME MEMORY CPU NETRX NETTX DISK
28 host01 terminate user 05/27 16:40:47 05/27 17:09:20 1024M 0.1 0K 0K 10.4G
29 host02 none none 05/27 17:09:28 - 256M 1 2.4M 1.3K 10G
The record shows the complete history record, and total network consumption. It will not reflect the consumption made only during the month of May.
Attention
Active history records, those with END_TIME
'-', refresh their monitoring information each time the VM is monitored. Once the VM is shut down, migrated, or stopped, the END_TIME
is set and the monitoring information stored is frozen. The final values reflect the total for accumulative attributes, like NETRX/NETTX
.
Sample output
$ hypercloud acct
# User 0
VID HOSTNAME ACTION REAS START_TIME END_TIME MEMORY CPU NETRX NETTX DISK
13 host01 nic-attach user 05/17 17:10:57 05/17 17:12:48 256M 0.1 19.2K 15.4K 8G
13 host01 nic-detach user 05/17 17:12:48 05/17 17:13:48 256M 0.1 36.9K 25K 8G
13 host01 nic-attach user 05/17 17:13:48 05/17 17:14:54 256M 0.1 51.2K 36.4K 8G
13 host01 nic-detach user 05/17 17:14:54 05/17 17:17:19 256M 0.1 79.8K 61.7K 8G
13 host01 nic-attach user 05/17 17:17:19 05/17 17:17:27 256M 0.1 79.8K 61.7K 8G
13 host01 terminate-hard user 05/17 17:17:27 05/17 17:37:52 256M 0.1 124.6K 85.9K 8G
14 host02 nic-attach user 05/17 17:38:16 05/17 17:40:00 256M 0.1 16.5K 13.2K 8G
14 host02 poweroff user 05/17 17:40:00 05/17 17:53:40 256M 0.1 38.3K 18.8K 8G
14 host02 terminate-hard user 05/17 17:55:55 05/18 14:54:19 256M 0.1 1M 27.3K 8G
Headers
The column explanations are:
Column | Meaning |
---|---|
VID | Virtual Machine ID |
HOSTNAME | Host Name |
ACTION | Virtual Machine action that created a new history record |
REASON | VM state change reason: - none : Virtual Machine still running - erro : The VM ended in error - user : VM action started by the user |
START_TIME | Start time |
END_TIME | End time |
MEMORY | Assigned memory. This is the requested memory, not the monitored memory consumption. |
CPU | Number of CPUs. This is the requested number of Host CPU share, not the monitored CPU usage. |
NETRX |
Data received from the network |
NETTX |
Data sent to the network |
The information can be formatted to show CSV output with the --csv
flag enabled, an example of this format is:
$ hypercloud acct --csv
UID,VID,HOSTNAME,ACTION,REASON,START_TIME,END_TIME,MEMORY,CPU,NETRX,NETTX,DISK
0,12,host01,none,user,05/09 19:20:42,05/09 19:35:23,1024M,1,29.8M,638.8K,0K
0,13,host01,nic-attach,user,05/17 17:10:57,05/17 17:12:48,256M,0.1,19.2K,15.4K,8G
0,13,host01,nic-detach,user,05/17 17:12:48,05/17 17:13:48,256M,0.1,36.9K,25K,8G
0,13,host01,nic-attach,user,05/17 17:13:48,05/17 17:14:54,256M,0.1,51.2K,36.4K,8G
0,13,host01,nic-detach,user,05/17 17:14:54,05/17 17:17:19,256M,0.1,79.8K,61.7K,8G
0,13,host01,nic-attach,user,05/17 17:17:19,05/17 17:17:27,256M,0.1,79.8K,61.7K,8G
0,13,host01,terminate-hard,user,05/17 17:17:27,05/17 17:37:52,256M,0.1,124.6K,85.9K,8G
0,14,host02,nic-attach,user,05/17 17:38:16,05/17 17:40:00,256M,0.1,16.5K,13.2K,8G
0,14,host01,poweroff,user,05/17 17:40:00,05/17 17:53:40,256M,0.1,38.3K,18.8K,8G
0,14,host02,terminate-hard,user,05/17 17:55:55,05/18 14:54:19,256M,0.1,1M,27.3K,8G
0,29,host02,none,none,05/27 17:09:28,-,256M,1,2.4M,1.3K,10G
HyperCloud dashboard
The accounting information can be accessed via the HyperCloud dashboard web front GUI under Settings --> Accounting.
Tuning and extending
There are two types of monitoring values:
- Instantaneous values:
VM/CPU
orVM/MEMORY
show the memory consumption last reported by the monitoring probes. - Accumulative values:
VM/NETRX
orVM/NETTX
show the total network consumption since the history record started.