Welcome to Delicate template
Just another WordPress site

Playing with Counters (XenServer) – PART 1

febrero 28th, 2013 | Posted by cristiansan in CLI | Monitoring | Performance | XenServer

Not the first time that asked me about getting advanced performance metrics of XenServer servers. XenCenter data are indicative, but not enough for those who want to obtain complete metrics of our environments.

EdgeSight does not solve our problem, since it has no possibility (at least for now) to monitor our XenServer host. So we have to go to third party tools, such as Open-Source solutions (Nagios, Zabbix, etc) and/or proprietary tools like PHDMonitor or Goliath, among others.

But there is a way manually …

Lest we lose ourselves in the journey to the underworld CLI, here’s a short guide to help.

Performance on XenServer

The most common types of performance metrics can be obtained in a simple way on XenServer.

XenServer automatically collects a series of performance data physical hosts and virtual machines.

Resource data, such as network interface cards (NIC), CPU and memory data for both physical hosts to virtual machines can be achieved by creating queries in XenServer CLI.

For example, the command «xe host-data-source-list» is used to display performance statistics available to the XenServer host. Information such as the CPU, memory, data of NICs appear as a result of using this command so that we can incorporate a metric custom script.

This command can be used to collect performance statistics from the server and / or a virtual machine. This can be run to display a metric specified. The outputs of these queries can be included in a file at specific intervals. In this article we will explain how.

Creating variables and loops

Having programmed variables and loops, will be an essential requirement in the processes of data capture and storage in XenServer.

0The circuit used in the previous example is a «do-while» which starts in line 7 and finishes at line 36. The variable «Count» is used to keep track of the number of iterations of the loop and is set to zero on line 5. The conditions to continue or end this cycle is in line 7.

As shown in line 7, as long as the variable «count» is less than the number 2, the loop is executed.

These conditions can be altered so that the loop is executed a finite number of times before the end, by manipulating the output variable «count» on line 5, the number 2 in line 7 and the comments section on line 35, which increments the count variable at each iteration of the loop.

Lines 34 through 36 complete this loop.

Line 36 marks the end of the loop. The character «#» at the beginning of a line is a comment and indicates that the line should be run-in XenServer command line. The «#» can be removed in line 35 in order to increase the count variable to stop running this script automatically. Line 34 uses the «sleep» command to stop the loop for ten seconds. The number «10» can be changed to any number of seconds to set the desired polling interval.

Using these basic variables and loops in scripts may be useful to perform the tasks required to record and manipulate data XenServer performance as discussed below.

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 *