Open eriweb opened 10 years ago
For the record, this is XenServer 6.2
I tried this on my pool as well recently (Xenserver 6.5) and had no luck either. If you point it at the pool master, it only returns stats for VM's local to the system. If you point it at the slaves as well, it fails to authenticate. From what I can tell, when authenticating against a pool slave, the session ID has to be gotten from the master. The other way is to cheat and make it authorize an independent session against each server (authenticating on each poll), and ignore the notion of session ID's.
Trying to use this on a pool, and it works fine on the pool master but when trying to check pool slaves I get the following stack trace: (172.30.86.54 is the pool master)
Dec 3 14:26:56 inf-ccpr1-ccp01 collectd[12206]: Exiting normally. Dec 3 14:26:56 inf-ccpr1-ccp01 collectd[12206]: collectd: Stopping 5 read threads. Dec 3 14:26:56 inf-ccpr1-ccp01 collectd[12206]: Unhandled python exception in shutdown callback: KeyError: 'session' Dec 3 14:26:56 inf-ccpr1-ccp01 collectd[12206]: Traceback (most recent call last): Dec 3 14:26:56 inf-ccpr1-ccp01 collectd[12206]: File "/usr/lib64/collectd/collectd-xenserver.py", line 304, in Shutdown#012 self.hosts[hostname]['session'].logout() Dec 3 14:26:56 inf-ccpr1-ccp01 collectd[12206]: KeyError: 'session' Dec 3 14:26:56 inf-ccpr1-ccp01 collectd[12206]: collectd: Stopping 5 write threads. Dec 3 14:26:56 inf-ccpr1-ccp01 collectdmon[11921]: Info: collectd terminated with exit status 0 Dec 3 14:26:56 inf-ccpr1-ccp01 collectdmon[11921]: Warning: restarting collectd Dec 3 14:26:56 inf-ccpr1-ccp01 collectd[12222]: Unhandled python exception in init callback: Failure: ['HOST_IS_SLAVE', '172.30.86.54'] Dec 3 14:26:56 inf-ccpr1-ccp01 collectd[12222]: Traceback (most recent call last): Dec 3 14:26:56 inf-ccpr1-ccp01 collectd[12222]: File "/usr/lib64/collectd/collectd-xenserver.py", line 238, in Connect#012 self.hosts[hostname]['session'].xenapi.login_with_password(user, passwd) Dec 3 14:26:56 inf-ccpr1-ccp01 collectd[12222]: File "/usr/lib/python2.6/site-packages/XenAPI.py", line 229, in call#012 return self.send(self.name, args) Dec 3 14:26:56 inf-ccpr1-ccp01 collectd[12222]: File "/usr/lib/python2.6/site-packages/XenAPI.py", line 124, in xenapi_request#012 self._login(methodname, params) Dec 3 14:26:56 inf-ccpr1-ccp01 collectd[12222]: File "/usr/lib/python2.6/site-packages/XenAPI.py", line 148, in _login#012 result = _parse_result(getattr(self, 'session.%s' % method)(*params)) Dec 3 14:26:56 inf-ccpr1-ccp01 collectd[12222]: File "/usr/lib/python2.6/site-packages/XenAPI.py", line 203, in _parse_result#012 raise Failure(result['ErrorDescription']) Dec 3 14:26:56 inf-ccpr1-ccp01 collectd[12222]: Failure: ['HOST_IS_SLAVE', '172.30.86.54'] Dec 3 14:26:56 inf-ccpr1-ccp01 collectd[12222]: Initialization complete, entering read-loop. Dec 3 14:26:56 inf-ccpr1-ccp01 collectd[12222]: python: Interactive interpreter exited, stopping collectd ... Dec 3 14:26:56 inf-ccpr1-ccp01 collectd[12222]: Unhandled python exception in read callback: IOError: ('http error', 401, 'Unauthorised', <httplib.HTTPMessage instance at 0x7f71eb5aa170>) Dec 3 14:26:56 inf-ccpr1-ccp01 collectd[12222]: Traceback (most recent call last): Dec 3 14:26:56 inf-ccpr1-ccp01 collectd[12222]: File "/usr/lib64/collectd/collectd-xenserver.py", line 285, in Read#012 self.hosts[hostname]['rrdupdates'].Refresh(self.hosts[hostname]['session'].handle, self.rrdParams, self.hosts[hostname]['url']) Dec 3 14:26:56 inf-ccpr1-ccp01 collectd[12222]: File "/usr/lib64/collectd/collectd-xenserver.py", line 139, in Refresh#012 sock = urllib.URLopener().open(url) Dec 3 14:26:56 inf-ccpr1-ccp01 collectd[12222]: File "/usr/lib64/python2.6/urllib.py", line 207, in open#012 return getattr(self, name)(url) Dec 3 14:26:56 inf-ccpr1-ccp01 collectd[12222]: File "/usr/lib64/python2.6/urllib.py", line 362, in open_http#012 return self.http_error(url, fp, errcode, errmsg, headers) Dec 3 14:26:56 inf-ccpr1-ccp01 collectd[12222]: File "/usr/lib64/python2.6/urllib.py", line 379, in http_error#012 return self.http_error_default(url, fp, errcode, errmsg, headers) Dec 3 14:26:56 inf-ccpr1-ccp01 collectd[12222]: File "/usr/lib64/python2.6/urllib.py", line 385, in http_error_default#012 raise IOError, ('http error', errcode, errmsg, headers) Dec 3 14:26:56 inf-ccpr1-ccp01 collectd[12222]: IOError: ('http error', 401, 'Unauthorised', <httplib.HTTPMessage instance at 0x7f71eb5aa170>) Dec 3 14:26:56 inf-ccpr1-ccp01 collectd[12222]: read-function of plugin `python.collectd-xenserver' failed. Will suspend it for 20.000 seconds.