emitter.py 报错 Unable to post payload
探针安装后启动成功,但 web 上没有数据,此时可以查看探针的 log ,在 /var/log/CiAgent
目录下面有 collector.log
和 forwarder.log
2个文件,看看里面报 error
的段落,如图:
2015-12-25 11:40:54 CST | ERROR | ci.collector | checks.collector(emitter.py:69) | Unable to post payload.
Traceback (most recent call last):
File "/opt/CiAgent/agent/emitter.py", line 61, in http_emitter
r = requests.post(url, data=zipped, timeout=5, headers=headers)
File "/opt/CiAgent/embedded/lib/python2.7/site-packages/requests/api.py", line 108, in post
return request('post', url, data=data, json=json, **kwargs)
File "/opt/CiAgent/embedded/lib/python2.7/site-packages/requests/api.py", line 50, in request
response = session.request(method=method, url=url, **kwargs)
File "/opt/CiAgent/embedded/lib/python2.7/site-packages/requests/sessions.py", line 464, in request
resp = self.send(prep, **send_kwargs)
File "/opt/CiAgent/embedded/lib/python2.7/site-packages/requests/sessions.py", line 576, in send
r = adapter.send(request, **kwargs)
File "/opt/CiAgent/embedded/lib/python2.7/site-packages/requests/adapters.py", line 415, in send
raise ConnectionError(err, request=request)
ConnectionError: ('Connection aborted.', error(97, 'Address family not supported by protocol'))
如果有以上 Unable to post payload
的问题,可以修改 /etc/CiAgent/CiAgent.conf
文件,在里面添加如下内容:
bind_host: 127.0.0.1
之后重启探针,在 web 上看看是否已经有数据。
service CiAgent restart
这是因为探针默认会读取 localhost 的数据,如果本机没有把 localhost 解析成 127.0.0.1 ,就会报这个错误,所以可以对本机进行解析,也可以在 Cloud Insight 配置文件里面绑定 127.0.0.1。