or perhaps a firewall/routing issue somewhere. I was suspecting dns when I first read it, but you already disproved that. It's been a while since I encountered that in python. I did some testing in one of the example scripts and can't get the same error. So perhaps in this context its not resolution but something else. I think it is for sure in your connection attempt.
When I pass bad host names I get:
for res in getaddrinfo(host, port, 0, SOCK_STREAM):
socket.gaierror: [Errno 8] nodename nor servname provided, or not known
I'm using python 2.7.11 for reference and the same version of the sdk.
So now I am not so sure. I tested connecting to splunk cloud and to a local instance using the .splunkrc file and the stail.py example in the sdk.
I couldn't get your script to work. But I modified the info.py script provided to provide the connection info in the script. Not sure if this will format right:
from splunklib.client import connect
from splunklib.results import ResultsReader
# Create a Service instance and log in
service = connect(
host='host.com',
port=8089,
username='admin',
password='mypass')
content = service.info
for key in sorted(content.keys()):
value = content[key]
if isinstance(value, list):
print "%s:" % key
for item in value: print " %s" % item
else:
print "%s: %s" % (key, value)
print "Settings:"
content = service.settings.content
for key in sorted(content.keys()):
value = content[key]
print " %s: %s" % (key, value)
... View more