Hello. Do not tell me what could be the problem. If you send ./zbxtg.py ID test test from the command line, then messages come to telegram. If in Zabbix choose Administration -> Notification Methods -> Telegram -> Test, then in the server log - Failed to execute command "/usr/lib/zabbix/alertscripts/zbxtg.py 'ID' test '' test '": Timeout while executing a shell script.
Ad Widget
Collapse
Telegram alert
Collapse
X
-
I’ll clarify the question. If to execute sudo -u zabbix ./zbxtg.py «@ivanov» «test» «test» then messages are issued:
File "./zbxtg.py", line 937, in <module>
main()
File "./zbxtg.py", line 846, in main
tg.send_message(uid, zbxtg_body_text)
File "./zbxtg.py", line 94, in send_message
answer = requests.post(url, params=params, proxies=self.proxies)
File "/usr/lib/python2.7/site-packages/requests/api.py", line 116, in post
return request('post', url, data=data, json=json, **kwargs)
File "/usr/lib/python2.7/site-packages/requests/api.py", line 60, in request
return session.request(method=method, url=url, **kwargs)
File "/usr/lib/python2.7/site-packages/requests/sessions.py", line 533, in request
resp = self.send(prep, **send_kwargs)
File "/usr/lib/python2.7/site-packages/requests/sessions.py", line 646, in send
r = adapter.send(request, **kwargs)
File "/usr/lib/python2.7/site-packages/requests/adapters.py", line 449, in send
timeout=timeout
File "/usr/lib/python2.7/site-packages/urllib3/connectionpool.py", line 672, in urlopen
chunked=chunked,
File "/usr/lib/python2.7/site-packages/urllib3/connectionpool.py", line 376, in _make_request
self._validate_conn(conn)
File "/usr/lib/python2.7/site-packages/urllib3/connectionpool.py", line 994, in _validate_conn
conn.connect()
File "/usr/lib/python2.7/site-packages/urllib3/connection.py", line 334, in connect
conn = self._new_conn()
File "/usr/lib/python2.7/site-packages/urllib3/connection.py", line 157, in _new_conn
(self._dns_host, self.port), self.timeout, **extra_kw
File "/usr/lib/python2.7/site-packages/urllib3/util/connection.py", line 74, in create_connection
sock.connect(sa)
File "/usr/lib64/python2.7/socket.py", line 224, in meth
return getattr(self._sock,name)(*args)
if you execute the command as root: ./zbxtg.py "@ivanov" "test" "test" then the message comes in telegramsLast edited by GeorgeKup; 01-03-2020, 11:10. -
I'll try to clarify again. Internet access is through a proxy. From root the command is executed ./zbxtg.py "@ivanov" "test" "test" and messages come to telegram. If you execute the command from the user zabbix: sudo -u zabbix ./zbxtg.py "@ivanov" "test" "test", then error messages are issued. I managed to run a command from the user zabbix, which leads to sending messages to telegrams: sudo -u zabbix -E bash -c '/usr/lib/zabbix/alertscripts/zbxtg.py "@ivanov" "test" "test"'. How to use this command so that zabbix sends messages to telegram itself.Comment
Comment