4 Documents Ganeti version 2.0
11 Ganeti supports a remote API for enable external tools to easily
12 retrieve information about a cluster's state. The remote API daemon,
13 *ganeti-rapi*, is automatically started on the master node. By default
14 it runs on TCP port 5080, but this can be changed either in
15 ``.../constants.py`` or via the command line parameter *-p*. SSL mode,
16 which is used by default, can also be disabled by passing command line
22 The protocol used is JSON_ over HTTP designed after the REST_
25 .. _JSON: http://www.json.org/
26 .. _REST: http://en.wikipedia.org/wiki/Representational_State_Transfer
31 You can access the API using your favorite programming language as
32 long as it supports network connections.
39 wget -q -O - https://CLUSTERNAME:5080/2/info
43 curl https://CLUSTERNAME:5080/2/info
52 f = urllib2.urlopen('https://CLUSTERNAME:5080/2/info')
59 .. warning:: While it's possible to use JavaScript, it poses several potential
60 problems, including browser blocking request due to
61 non-standard ports or different domain names. Fetching the data
62 on the webserver is easier.
66 var url = 'https://CLUSTERNAME:5080/2/info';
68 var xmlreq = new XMLHttpRequest();
69 xmlreq.onreadystatechange = function () {
70 if (xmlreq.readyState != 4) return;
71 if (xmlreq.status == 200) {
72 info = eval("(" + xmlreq.responseText + ")");
75 alert('Error fetching cluster info');
79 xmlreq.open('GET', url, true);
85 .. include:: rapi-resources.gen