I am running a multithreaded process against the ZabbixAPI (pyzabbix) in Python:
pool.apply_async(getLatestData, args = (item, ), callback = outputSenderLine)
Where "item" is set by a for-loop to either 'CPU Utilization Percent' or 'Memory Percentage Used'
In "getLatestData," I loop through my target host IDs for this data:
items = zapi.item.get(hostids=hId,output='extend',search={ 'name':item},expandName=1)
The final host ID, for the last item (which varies, due to the nature of multi threading), when calling zapi.item.get, always causes an exception:
According to the DEBUG logging from ZabbixAPI, the data appears to have already returned from that last hostId before the exception for both 'CPU Utilization Percent' and 'Memory Percentage Used.' I see a "Sending" block of JSON for each hostId, as well as a "Response Body" for each hostId. The "Response Code" is 200 for each, and the JSON appears to be valid in the Response Body sections.
Any suggestions as to how I could track down a good solution here?
pool.apply_async(getLatestData, args = (item, ), callback = outputSenderLine)
Where "item" is set by a for-loop to either 'CPU Utilization Percent' or 'Memory Percentage Used'
In "getLatestData," I loop through my target host IDs for this data:
items = zapi.item.get(hostids=hId,output='extend',search={ 'name':item},expandName=1)
The final host ID, for the last item (which varies, due to the nature of multi threading), when calling zapi.item.get, always causes an exception:
ERROR:root: ('Connection aborted.', BadStatusLine("''",))
Traceback (most recent call last):
File "groupsum_v2.py", line 179, in getLatestData
items = zapi.item.get(hostids=hId,output='extend',search={ 'name':item},expandName=1)
File "/usr/lib/python2.7/site-packages/pyzabbix/__init__.py", line 157, in fn
args or kwargs
File "/usr/lib/python2.7/site-packages/pyzabbix/__init__.py", line 103, in do_request
timeout=self.timeout
File "/usr/lib/python2.7/site-packages/requests/sessions.py", line 507, in post
return self.request('POST', url, data=data, json=json, **kwargs)
File "/usr/lib/python2.7/site-packages/requests/sessions.py", line 464, in request
resp = self.send(prep, **send_kwargs)
File "/usr/lib/python2.7/site-packages/requests/sessions.py", line 576, in send
r = adapter.send(request, **kwargs)
File "/usr/lib/python2.7/site-packages/requests/adapters.py", line 415, in send
raise ConnectionError(err, request=request)
ConnectionError: ('Connection aborted.', BadStatusLine("''",))
Traceback (most recent call last):
File "groupsum_v2.py", line 179, in getLatestData
items = zapi.item.get(hostids=hId,output='extend',search={ 'name':item},expandName=1)
File "/usr/lib/python2.7/site-packages/pyzabbix/__init__.py", line 157, in fn
args or kwargs
File "/usr/lib/python2.7/site-packages/pyzabbix/__init__.py", line 103, in do_request
timeout=self.timeout
File "/usr/lib/python2.7/site-packages/requests/sessions.py", line 507, in post
return self.request('POST', url, data=data, json=json, **kwargs)
File "/usr/lib/python2.7/site-packages/requests/sessions.py", line 464, in request
resp = self.send(prep, **send_kwargs)
File "/usr/lib/python2.7/site-packages/requests/sessions.py", line 576, in send
r = adapter.send(request, **kwargs)
File "/usr/lib/python2.7/site-packages/requests/adapters.py", line 415, in send
raise ConnectionError(err, request=request)
ConnectionError: ('Connection aborted.', BadStatusLine("''",))
According to the DEBUG logging from ZabbixAPI, the data appears to have already returned from that last hostId before the exception for both 'CPU Utilization Percent' and 'Memory Percentage Used.' I see a "Sending" block of JSON for each hostId, as well as a "Response Body" for each hostId. The "Response Code" is 200 for each, and the JSON appears to be valid in the Response Body sections.
Any suggestions as to how I could track down a good solution here?