jablonka.czprosek.czf

xenstats

Subversion Repositories:
[/] [readme.txt] - Blame information for rev 3

 

Line No. Rev Author Line
11simandlhttp://skaya.enix.org/wiki/XenStats
2 
3I wrote a couple of (hopefully) useful quick and dirty scripts to quickly see which domain is eating your precious CPU cycles :
4- xenupdate.py: should be run in crontab ; will start xm list, parse its output, create on demand RRD files for your domains, and update them.
5- xengraph.py: should be run in crontab or manually ; will draw nice cumumlative graphs named xen-period.png in current directory, based over the previous RRDs. period will be hourly (display activity over the last hour), daily (over the last day), weekly, monthly, and yearly.
6 
7How to use them :
8- install the required packages (rrdtool and python ; I don't use any fancy python feature so no extra package should be needed)
9- you might have to modify xenupdate.py (path to #xm# binary is hardcoded)
10- put * * * * * /path/to/xenupdate.py /path/to/rrds/ in your crontab (RRD files will be created in the given directory)
11- if you want to run the update script less frequently, use */5 * * * * instead (to run it every five minutes) ; if you want to run them less often than every 10 minutes, you have to modify the 666 value in the xenupdate.py script (it's the "heart-beat" value of the data source ; if it gets updated less than 666 seconds, it will be considered invalid)
12- run (from crontab or manually) xengraph.py /path/to/rrds/ ; you can modify it if you want to change the output file, the timescale, the colors ...
13 
14Don't forget the trailing slash ; if the argument is /path/to/rrds then the update script will create files named /path/to/rrdsDomain-0 and the graph script will create files named /path/to/rrdsxen-hourly.png etc.
15 
16What happens when xenupdate.py runs :
17- first, it does a xm list and parses its output, getting the name and CPU time of each domain
18- then, for each domain, it checks if a RRD file exists, and creates it if needed
19- after ensuring that the RRD file exists, it updates it (NB: the value stored in the RRD is the CPU time in milliseconds, not seconds ; because COUNTER data sources must be integer values)
20- if a domain is dead, the RRD file won't be updated, and nothing else will happen
21 
22Feel free to adapt those scripts to your needs, they are (of course) GPL.
23 
24Thanks to the people who made Xen such an exciting project ! (Ian, I promise I will attach this serial cable and try to debug those restore/save problems real soon now!)
25 
26TODO: tweak the RPN expressions to get UNKNOWN values when computing AVERAGE, but ZERO values when drawing the STACK (else we will get a flat graph as soon as one domain is shut down but is RRD isn't removed).
27 
28 
29Comment:
30In Xen 3.0 you have to edit the xenupdate.py script.
31Change the line:
32name,id,mem,cpu,state,cputime,console=re.split("[\t ]+",domain)
33to
34name,id,mem,cpu,state,cputime=re.split("[\t ]+",domain)
35 
36Thanks for the good work :)
37Phillip Hagedorn - hagedorn[a]media-net.de
38 
39Comment:
40On debian testing, with rrdtool 1.2, the -unit % command line argument doesn't work.
41I have to remove it.
42 
43Thanks for these nice scripts.
44Eric Veiras Galisson - http://www.veiras.info

Powered by WebSVN 2.2.1