-
Notifications
You must be signed in to change notification settings - Fork 233
Description
Hi,
I have Centos 7
[root@localhost log]# cat /etc/redhat-release
CentOS Linux release 7.6.1810 (Core)
I did install zbxtg from wiki
cat /var/log/zabbix/zabbix_server.log
13460:20190209:001533.252 Got signal
[signal:15(SIGTERM),sender_pid:13797,sender_uid:0,reason:0]. Exiting ...
13460:20190209:001533.310 [Z3001] connection to database 'zabbix' failed: [2002] Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2 "No such file or directory")
13460:20190209:001533.311 Cannot connect to the database. Exiting...
3538:20190209:001851.365 Starting Zabbix Server. Zabbix 4.0.4 (revision 89349).
3538:20190209:001851.382 ****** Enabled features ******
3538:20190209:001851.382 SNMP monitoring: YES
3538:20190209:001851.382 IPMI monitoring: YES
3538:20190209:001851.382 Web monitoring: YES
3538:20190209:001851.382 VMware monitoring: YES
3538:20190209:001851.382 SMTP authentication: YES
3538:20190209:001851.382 Jabber notifications: YES
3538:20190209:001851.382 Ez Texting notifications: YES
3538:20190209:001851.382 ODBC: YES
3538:20190209:001851.382 SSH2 support: YES
3538:20190209:001851.382 IPv6 support: YES
3538:20190209:001851.382 TLS support: YES
3538:20190209:001851.382 ******************************
3538:20190209:001851.382 using configuration file: /etc/zabbix/zabbix_server.conf
3538:20190209:001851.419 [Z3001] connection to database 'zabbix' failed: [2002] Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2 "No such file or directory")
3538:20190209:001851.419 database is down: reconnecting in 10 seconds
3538:20190209:001859.049 database connection re-established
3538:20190209:001859.051 current database version (mandatory/optional): 04000000/04000003
3538:20190209:001859.051 required mandatory version: 04000000
3538:20190209:001859.148 server #0 started [main process]
4091:20190209:001859.150 server #1 started [configuration syncer #1]
4092:20190209:001859.150 server #2 started [alerter #1]
4093:20190209:001859.151 server #3 started [alerter #2]
4094:20190209:001859.151 server #4 started [alerter #3]
4095:20190209:001859.152 server #5 started [housekeeper #1]
4096:20190209:001859.152 server #6 started [timer #1]
4097:20190209:001859.153 server #7 started [http poller #1]
4098:20190209:001859.154 server #8 started [discoverer #1]
4100:20190209:001859.155 server #10 started [history syncer #2]
4103:20190209:001859.159 server #13 started [escalator #1]
4108:20190209:001859.164 server #17 started [poller #1]
4101:20190209:001859.164 server #11 started [history syncer #3]
4105:20190209:001859.165 server #14 started [proxy poller #1]
4099:20190209:001859.166 server #9 started [history syncer #1]
4107:20190209:001859.170 server #16 started [task manager #1]
4111:20190209:001859.171 server #20 started [poller #4]
4109:20190209:001859.177 server #18 started [poller #2]
4102:20190209:001859.178 server #12 started [history syncer #4]
4106:20190209:001859.179 server #15 started [self-monitoring #1]
4110:20190209:001859.180 server #19 started [poller #3]
4112:20190209:001859.183 server #21 started [poller #5]
4115:20190209:001859.190 server #22 started [unreachable poller #1]
4117:20190209:001859.200 server #24 started [trapper #2]
4122:20190209:001859.201 server #26 started [trapper #4]
4121:20190209:001859.205 server #25 started [trapper #3]
4116:20190209:001859.205 server #23 started [trapper #1]
4125:20190209:001859.209 server #29 started [alert manager #1]
4124:20190209:001859.212 server #28 started [icmp pinger #1]
4126:20190209:001859.213 server #30 started [preprocessing manager #1]
4123:20190209:001859.213 server #27 started [trapper #5]
4128:20190209:001859.224 server #31 started [preprocessing worker #1]
4129:20190209:001859.225 server #32 started [preprocessing worker #2]
4134:20190209:001859.235 server #33 started [preprocessing worker #3]
When i started scrip manual - it's ok.
[root@localhost zabbix]# /usr/lib/zabbix/alertscripts/zbxtg.py "@avdanilov" "тест21" "тестовое сообщение12" --debug
zbxtg.py: {u'ok': True, u'result': {u'username': u'ithelp_group_zbx_bot', u'first_name': u'Monitoring IT Help Group', u'is_bot': True, u'id': 762026319}}
zbxtg.py: Cache file with uids: /usr/lib/zabbix/zbxtg/uids.txt
zbxtg.py: Trying to read cached uid for avdanilov, private, from /usr/lib/zabbix/zbxtg/uids.txt
zbxtg.py: Telegram uid of private 'avdanilov': 111981553zbxtg.py: Trying to /sendMessage:
zbxtg.py: https://api.telegram.org/bot762026319:AAG6jb7vde0JNZV9WZWk-WaLfvxRToBycYs/sendMessage
zbxtg.py: post params: {'text': '\xd1\x82\xd0\xb5\xd1\x81\xd1\x8221\n\xd1\x82\xd0\xb5\xd1\x81\xd1\x82\xd0\xbe\xd0\xb2\xd0\xbe\xd0\xb5 \xd1\x81\xd0\xbe\xd0\xbe\xd0\xb1\xd1\x89\xd0\xb5\xd0\xbd\xd0\xb8\xd0\xb512', 'disable_notification': False, 'chat_id': '111981553\n', 'disable_web_page_preview': False}
{u'ok': True, u'result': {u'date': 1549662356, u'text': u'\u0442\u0435\u0441\u044221\n\u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u043512', u'from': {u'username': u'ithelp_group_zbx_bot', u'first_name': u'Monitoring IT Help Group', u'is_bot': True, u'id': 762026319}, u'message_id': 60, u'chat': {u'username': u'avdanilov', u'first_name': u'\u0410\u043d\u0434\u0440\u0435\u0439', u'last_name': u'\u0414\u0430\u043d\u0438\u043b\u043e\u0432', u'type': u'private', u'id': 111981553}}}
But when it's did zabbix, i get error:
Traceback (most recent call last):
File "/usr/lib/zabbix/alertscripts/zbxtg.py", line 909, in
main()
File "/usr/lib/zabbix/alertscripts/zbxtg.py", line 785, in main
uid = tg.get_uid(zbx_to)
File "/usr/lib/zabbix/alertscripts/zbxtg.py", line 179, in get_uid
updates = self.get_updates()
File "/usr/lib/zabbix/alertscripts/zbxtg.py", line 67, in get_updates
answer = requests.post(url, params=params, proxies=self.proxies)
File "/usr/lib/python2.7/site-packages/requests/api.py", line 112, in post
return request('post', url, data=data, json=json, **kwargs)
File "/usr/lib/python2.7/site-packages/requests/api.py", line 58, in request
return session.request(method=method, url=url, **kwargs)
File "/usr/lib/python2.7/site-packages/requests/sessions.py", line 508, in request
resp = self.send(prep, **send_kwargs)
File "/usr/lib/python2.7/site-packages/requests/sessions.py", line 618, in send
r = adapter.send(request, **kwargs)
File "/usr/lib/python2.7/site-packages/requests/adapters.py", line 502, in send
raise ProxyError(e, request=request)
requests.exceptions.ProxyError: HTTPSConnectionPool(host='api.telegram.org', port=443): Max retries exceeded with url: /bot762026319:AAG6jb7vde0JNZV9WZWk-WaLfvxRToBycYs/getUpdates?offset=0 (Caused by ProxyError('Cannot connect to proxy.', NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x7f1e5678efd0>: Failed to establish a new connection: [Errno 13] Permission denied',))
[root@localhost zabbix]# pip list
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7.
Package Version
backports.ssl-match-hostname 3.5.0.1
certifi 2018.11.29
chardet 3.0.4
configobj 4.7.2
decorator 3.4.0
idna 2.6
iniparse 0.4
ipaddress 1.0.16
IPy 0.75
oauthlib 3.0.1
pep8 1.7.1
perf 0.1
pip 19.0.1
policycoreutils-default-encoding 0.1
proxy 0.0.1
pycurl 7.19.0
pygobject 3.22.0
pygpgme 0.3
pyliblzma 0.5.3
PySocks 1.6.8
python-linux-procfs 0.4.9
pyudev 0.15
pyxattr 0.5.1
requests 2.18.4
requests-oauthlib 0.6.2
requests-toolbelt 0.9.1
schedutils 0.4
seobject 0.1
sepolicy 1.1
setuptools 0.9.8
slip 0.4.0
slip.dbus 0.4.0
urlgrabber 3.10
urllib3 1.22
wheel 0.32.3
yum-metadata-parser 1.1.4
What is wrong ? =)