tech-sketch / zabbix_aws_template

This is AWS monitoring integration Zabbix templates.
49 stars 29 forks source link

why occured error? #14

Closed SungHyeon closed 7 years ago

SungHyeon commented 7 years ago

Traceback (most recent call last): File "cloudwatch_zabbix.py", line 247, in aws_zabbix.send_metric_data_to_zabbix() File "cloudwatch_zabbix.py", line 192, in send_metric_data_to_zabbix send_data = json.loads(r'{"request":"sender data","data":[],"clock":%s,"ns":%s }' % (sec, ns)) File "/usr/lib64/python2.7/json/init.py", line 339, in loads return _default_decoder.decode(s) File "/usr/lib64/python2.7/json/decoder.py", line 364, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) File "/usr/lib64/python2.7/json/decoder.py", line 380, in raw_decode obj, end = self.scan_once(s, idx) ValueError: Expecting , delimiter: line 1 column 61 (char 60)

ike-dai commented 7 years ago

Thank you for your reporting. Please tell me about your environment information. OS type, version, Python version.

As far as I see this error message, it seems that cloudwatch_zabbix.py cannot get time data.

If you can, please check the following code in your Zabbix Server CLI.

$ python
>>> import time
>>> import json
>>> now = "%.9f" % time.time()
>>> sec = now.split(".")[0]
>>> ns = now.split(".")[1]
>>> send_data = json.loads('{"request":"sender data","data":[],"clock":%s,"ns":%s }' % (sec, ns))
>>> print now
>>> print sec
>>> print ns
>>> print send_data
SungHyeon commented 7 years ago

I found a solution. Solution is here. image

ike-dai commented 7 years ago

Thanks. It may be json string fail. Each json key-value must be surrounded by the double quotation. If not be surrounded, "sender data" is recognized "sender" + [space] + "data". It is json format error.