【Problem Resolved】zabbix微信報警,一開始能夠成功報警,以後報警忽然不行

Traceback (most recent call last):
File "/usr/lib/zabbix/alertscripts/wechat.py", line 61, in <module>
access_token_response = msgsender.geturl(msgsender.gettoken_url, msgsender.gettoken_content)
File "/usr/lib/zabbix/alertscripts/wechat.py", line 41, in geturl
response = urllib2.urlopen('%s?%s' % (url,data))
File "/usr/lib64/python2.7/urllib2.py", line 154, in urlopen
return opener.open(url, data, timeout)
File "/usr/lib64/python2.7/urllib2.py", line 431, in open
response = self._open(req, data)
File "/usr/lib64/python2.7/urllib2.py", line 449, in _open
'_open', req)
File "/usr/lib64/python2.7/urllib2.py", line 409, in _call_chain
result = func(*args)
File "/usr/lib64/python2.7/urllib2.py", line 1258, in https_open
context=self._context, check_hostname=self._check_hostname)
File "/usr/lib64/python2.7/urllib2.py", line 1214, in do_open
raise URLError(err)
urllib2.URLError: <urlopen error [Errno -2] Name or service not known>

 
解決辦法:檢測zabbix-server的網絡是否能夠解析外網域名,本人是由於zabbix-server的dns出現問題,因此修改/etc/resolv.conf 添加nameserver 114.114.114.114 (可用的DNS服務器)python

相關文章
相關標籤/搜索