FIWARE Lab Statistics

From FIWARE Forge Wiki

Jump to: navigation, search

Contents

Available Resources

Physical resources

According to OpenStack documentation the default overcommit for RAM is 1.5:1, the default overcommit for CPU is 16:1 and disk space for the Virtual Machines should not be overcommitted (please, notice that Volumes provisioned by Cinder is not physically where the Virtual machines are) -- That is shown in this page of the documentation:

https://docs.openstack.org/arch-design/design-compute/design-compute-overcommit.html

The available physical resources can be easily calculated when the hardware is bought and installed. However, we could ask nova about the resources (available and used) with a small and simple script like this one:

( nova --timeout 15 --insecure list > /dev/null || exit 1
  h=$(($(nova --timeout 60 --insecure list  --all-tenants | wc -l) - 4))
  echo hosts $h
  for a in `nova --timeout 60 --insecure host-list | awk '/compute/ {print $2}'`; do 
   nova --timeout 60 --insecure host-describe $a | awk '
       /total/ {printf ("cpu %s\nmem %s\ndisk %s\n",$6,$8,$10)}
       /used_now/ {printf ("used_cpu %s\nused_mem %s\nused_disk %s\n",$6,$8,$10)}
       ' &
done ) | awk '{sum[$1] += $2 } ; END {for (a in sum) {print a,sum[a]}}'


The output for this script is something like this:

mem 6767440
used_mem 7213056
disk 512859
used_disk 69913
hosts 1864
cpu 1632
used_cpu 3509

Where mem, disk and cpu are the physical resources installed in all the compute nodes, and used_mem, used_disk and used_cpu are the virtual resources used. The other field, hosts, is the number of VMs deployed in the node.

As a caveat, the command “nova host-describe” will perform something like a Unix “df” command. So, the returned value for disk is the free space in /var/lib/nova/instances. If a NFS share is mounted in several compute nodes (this would make easier some administrative tasks), the nova host-describe is going to return the free space in the NFS Share multiplied for the number of hosts where it is mounted as well as the used_disk. So, the disk information is wrong.

Floating IPs

The default external network providing floating IPs, how it was described in the previous section is named public-ext-net-01.

neutron net-show public-ext-net-01

We will see that the subnet associated with that network has ID 4430b64a-85d8-4933-ae79-9a76ff1e2aa9, therefore, querying the subnet:

neutron subnet-show 4430b64a-85d8-4933-ae79-9a76ff1e2aa9 
…
| allocation_pools  | {"start": "130.206.112.16", "end": "130.206.127.254"} |
| cidr              | 130.206.112.0/20                                      |


We have a /20 CIDR which is 2^(32-20)=4096 IPs, however, the 1st one is 130.206.112.16 (16 IPs not in the pool from 130.206.112.0 to 130.206.112.15) and the last IP in the pool is 130.206.127.254 (1 IP not in the pool at the end) --- So There are 17 IPs not in the pool, this means 4096-17=4079 floating IPs. To know how many floating IPs there are in use, we can check it with Neutron as administrator:

neutron floatingip-list | grep “ 130.206” | wc -l 

Get summary statistics

In order to get the summary statistics on one node during a period of time, you can execute the command:

$ openstack usage list

It will return the list of resources consumed for each tenant/project as shown below:

Usage from 2013-06-25 to 2013-07-24:

Project Servers RAM MB-Hours CPU Hours Disk GB-Hours
demo 1 344064.44 672.00 0.00
stack 3 671626.76 327.94 6558.86

Hosted Users

In order to get the Users, there are several ways of doing this, the way we usually do is using a script made in Python which retrieves all the information about users stored in Keystone (groups, users, roles, role_assignments, etc.) and produces a big json.

Using the Command Line tool jq, we query this json file:

jq -r '.role_assignments[] | 
       select (.role.id == "<role_id basic,  trial or community") |
       .user.id' <fichero_json_usuarios> | wc -l  

It is worth noting that this information is also visible at http://infographic.lab.fiware.org

Personal tools
Create a book