0
我試圖使用Splunk的python SDK(http://docs.splunk.com/Documentation/PythonSDK)連接到我的Splunk服務器,但我得到一個ParseError。當使用splunk python SDK無法連接到非本地主機
>>> pip install splunk-sdk
>>> import splunklib.binding as binding
>>> cargs = {}
>>> cargs['host'] = 'splunk.mydomain.com'
>>> cargs['scheme'] = 'https'
>>> cargs['port'] = 443
>>> cargs['username'] = 'my_username'
>>> cargs['password'] = 'my_password'
>>> c = binding.connect(**cargs)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/myframework/lib/python2.7/site-packages/splunklib/binding.py", line 867, in connect
c.login()
File "/myframework/lib/python2.7/site-packages/splunklib/binding.py", line 753, in login
session = XML(body).findtext("./sessionKey")
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/xml/etree/ElementTree.py", line 1302, in XML
return parser.close()
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/xml/etree/ElementTree.py", line 1655, in close
self._raiseerror(v)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/xml/etree/ElementTree.py", line 1507, in _raiseerror
raise err
xml.etree.ElementTree.ParseError: no element found: line 1, column 0
所以無論頁面返回到connect()沒有預期的「./sessionKey」文本。我見過的所有例子都使用「localhost」作爲主機,所以我不確定這個外部主機是否有問題。我希望我能把我的手放在返回的頁面上。
此主機在我的企業網上,所以不應該有訪問問題。
Something正在返回;我測試了這個由離開了港口,這讓我:
錯誤:[錯誤60]操作超時
那麼,我究竟做錯了什麼?
當然,這是問題,我在考慮https和那個服務器端口。謝謝,Neeraj。 – sophe 2013-05-03 17:12:06