here is my code:
import splunklib.client as client
HOST = "myhost"
PORT = 8000
USERNAME = "admin"
PASSWORD = "mypassword"
service = client.connect(
host=HOST,
port=PORT,
username=USERNAME,
password=PASSWORD)
when i execute it failed with these errors
Traceback (most recent call last):
File "testconn.py", line 13, in
password=PASSWORD)
File "/u01/software/splunk/software/splunk-sdk-python-1.6.3/splunklib/client.py", line 322, in connect
s.login()
File "/u01/software/splunk/software/splunk-sdk-python-1.6.3/splunklib/binding.py", line 859, in login
cookie="1") # In Splunk 6.2+, passing "cookie=1" will return the "set-cookie" header
File "/u01/software/splunk/software/splunk-sdk-python-1.6.3/splunklib/binding.py", line 1204, in post
return self.request(url, message)
File "/u01/software/splunk/software/splunk-sdk-python-1.6.3/splunklib/binding.py", line 1221, in request
response = self.handler(url, message, **kwargs)
File "/u01/software/splunk/software/splunk-sdk-python-1.6.3/splunklib/binding.py", line 1360, in request
connection.request(method, path, body, head)
File "/u01/Anaconda/Anaconda25/lib/python2.7/httplib.py", line 1042, in request
self.send_request(method, url, body, headers)
File "/u01/Anaconda/Anaconda25/lib/python2.7/httplib.py", line 1082, in _send_request
self.endheaders(body)
File "/u01/Anaconda/Anaconda25/lib/python2.7/httplib.py", line 1038, in endheaders
self._send_output(message_body)
File "/u01/Anaconda/Anaconda25/lib/python2.7/httplib.py", line 882, in _send_output
self.send(msg)
File "/u01/Anaconda/Anaconda25/lib/python2.7/httplib.py", line 844, in send
self.connect()
File "/u01/Anaconda/Anaconda25/lib/python2.7/httplib.py", line 1263, in connect
server_hostname=server_hostname)
File "/u01/Anaconda/Anaconda25/lib/python2.7/ssl.py", line 363, in wrap_socket
_context=self)
File "/u01/Anaconda/Anaconda25/lib/python2.7/ssl.py", line 611, in __init_
self.do_handshake()
File "/u01/Anaconda/Anaconda25/lib/python2.7/ssl.py", line 840, in do_handshake
self._sslobj.do_handshake()
ssl.SSLError: [SSL: UNKNOWN_PROTOCOL] unknown protocol (_ssl.c:661)
what did i do wrong?
Hi @dvuichor,
I think you should try 8089 management port.
Can you please see example given in this link?
http://docs.splunk.com/DocumentationStatic/PythonSDK/1.1/client.html
http://dev.splunk.com/view/javascript-sdk/SP-CAAAEC9
Thanks
Hi,
that fixed my issue
Thanks for your help
Hi @dvuichor,
I think you should try 8089 management port.
Can you please see example given in this link?
http://docs.splunk.com/DocumentationStatic/PythonSDK/1.1/client.html
http://dev.splunk.com/view/javascript-sdk/SP-CAAAEC9
Thanks
Hi @kamlesh_vaghela ,
I am having the same issue as reported here, but i am using 8089 as a port, and my firewall is aswell down.
I am even able to do a curl , but the script continues to give the same certificate error.
Can you please suggest anything for this?
Thanks
Shahid
@shahid285
Not sure about your exact issue, So can you please refer below link for that?
https://answers.splunk.com/answers/609126/ssl-error-while-trying-to-connect-to-splunk-web-fr.html
Hi @dvuichor,
Great.
Can you please accept the answer to close this question. This will help the community.
!!!! Happy Splunking !!!!
thanks for your help!
I have the same issue. But, I used port 8089. But, I am still not able to connect. The error I get is:
ssl.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:579)
The code is below for the connection I used. Please guide me on this.
import splunklib.client as client
HOST = "localhost"
PORT = 8089
USERNAME = "admin"
PASSWORD = "Qwerty@1993"
service = client.connect(
host=HOST,
port=PORT,
username=USERNAME,
password=PASSWORD)
for app in service.apps:
print app.name