Welcome to Delicate template
Just another WordPress site

Playing with Counters (XenServer) – PART 2

marzo 1st, 2013 | Posted by cristiansan in CLI | Monitoring | Performance | XenServer

Getting data from the command line.

Some CLI commands require unique data for each host/vm. These properties should be included in a script.

 xe host-data-source-list> out.txt

 With the command above, obtain a list of available metrics. With an editor like «vi» can edit and list these metrics in order to obtain the list of specific metrics.

The information obtained can be used to create a small script that stores data in a CSV file to proceed with further analysis.

For example, consider how to get data out of creating a script.

 xe host-cpu-list

 This will display the list of available CPUs and associated data as «vendor», «speed», «uuid», etc.. With these data, we can look at the specific use of CPU for a specific UUID.

Suppose we want to acquire usage data for CPU0. Using the above command we get the uuid of the CPU, and run:

 #xe host-cpu-param-get uuid=UUID_CPU param-name=utilization


 Repeat the command in a script and storing it in a CSV file, we will provide active monitoring of environment we want to obtain data.

An example of console output to a CSV CPU.


The procedure is simple once it’s clear. As starting points for future analysis of these we take into consideration the following points.

• Script where to obtain all the data to be analyzed.

• Save the data to a CSV file.

• Generate an order for execution Cron Script or manually run it for a specific time period.

• Download the CSV file.

• Analyze data and generate graphs of the data obtained.

 Generating a Script

First, we generate the list of «sources» to verify and monitor counters to choose.

xe host-data-source-list

In our case, we chose the following Sources:

CPU: cpu0, cpu1, cpu2, CPU3.

Are located uuid for specified physical resources.

xe host-cpu-list

Localized uuid, generate a script performance CPUs. which, based on the previous script is generated as shown below.

# Define the column titles of the CSV file here, overwrite if need be

echo ‘»Time», «Processor Zero», «Processor One», «Two Processor», «Processor Three»‘

echo ‘»Time», «Processor Zero», «Processor One», «Two Processor», «Processor Three»‘> cpu_process.csv

echo «»

count = 0

# Set up a never-ending loop

while [$ count-lt 2]


# Calculates date & time for the current sample

DateVar = «$ (date + ‘% H:% M:% S’)» 

# Calculates processor Utilisation, uuid’s hard-coded

pcpu0 = «$ (xe host-cpu-param-get uuid = 51d14846-3e4d-7118-f41d-81d038884df1 param-name = Utilisation)»

pcpu1 = «$ (xe host-cpu-param-get uuid = 5bc0e076-6750-B807-d3a5d0db6ddb bf3a-param-name = Utilisation)»

pcpu2 = «$ (xe host-cpu-param-get uuid = cba2fd2d-93ed-F246-5559-713dceabe89b param-name = Utilisation)»

pcpu3 = «$ (xe host-cpu-param-get uuid = f729393c-af9a-3568-0922-8adaaf61628e param-name = Utilisation)»

# Now output to screen

echo» $ DateVar ‘,’ $ pcpu0 ‘,’ $ pcpu1 ‘,’ $ pcpu2 ‘,’ $ pcpu3»

# Now append to the file

echo» $ DateVar ‘,’ $ pcpu0 ‘,’ $ pcpu1 ‘,’ $ pcpu2 ‘,’ $ pcpu3» >> cpu_process.csv

sleep 5

# Count = $ (($ count + 1))


The script will run every 5 seconds the CPU status inquiry. Initially no time limit, so we can adjust its expiration via crontab or modifying the script to the end where appropriate.

Executed the same, we will have a file «cpu_process.csv» with the following data:






Where available, as we have defined the data as follows:

Date, CPU0, CPU1, CPU2, CPU3

Performing on an Excel csv export can obtain a summary and performance graphs for analysis.

Detail XenCenter GUI:


Detail Excel CSV Format:


You can follow any responses to this entry through the RSS 2.0 You can leave a response, or trackback.

Leave a Reply

Tu dirección de correo electrónico no será publicada. Los campos obligatorios están marcados con *