我正在尝试通过 http_listener_v2 将来自 python 脚本(abc.py)的 test_data 输出发布到电报。
abc.py
------
import requests
url = "https://testazure.local/telegraf"
test_data = {'key1': 'value1'}
op = requests.post(url, data = test_data)
print(op.test_data)
这是我的telegraf.conf文件中用于输入的片段。
telegraf.conf
-----------------
[[inputs.http_listener_v2]]
# ## Address and port to host HTTP listener on
# methods = ["POST", "PUT"]
data_format = "json"
不确定,如果我将所有要求的详细信息传递给输入插件。
尝试执行我的 python 脚本时出现连接错误。任何建议/帮助将不胜感激。
Traceback (most recent call last):
File "abc.py", line 6, in <module>
x = requests.post(url, data = test_data)
File "/usr/local/lib/python3.6/site-packages/requests/api.py", line 119, in post
return request('post', url, data=data, json=json, **kwargs)
requests.exceptions.ConnectionError: HTTPSConnectionPool(host'testazure.local', port=443):
Max retries exceeded with url: /telegraf (Caused by
NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f9eb8c72438>:
Failed to establish a new connection: [Errno 111] Connection refused',))