tech-sketch / zabbix_aws_template

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

json.loads() fails in get_rss #17

Closed moses-moore-spafax closed 6 years ago

moses-moore-spafax commented 7 years ago

When using scripts/AWS_Service_Health_Dashboard.py I see a lot of noise to stderr:

  File "/usr/lib/python2.7/threading.py", line 810, in __bootstrap_inner
    self.run()
  File "/usr/lib/python2.7/threading.py", line 763, in run
    self.__target(*self.__args, **self.__kwargs)
  File "./AWS_Service_Health_Dashboard.py", line 37, in get_rss
    send_data = json.loads('{"request":"sender data","data":[],"clock":%s,"ns":%s }' % (sec, ns))
  File "/usr/lib/python2.7/json/__init__.py", line 338, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python2.7/json/decoder.py", line 366, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib/python2.7/json/decoder.py", line 382, in raw_decode
    obj, end = self.scan_once(s, idx)
ValueError: Expecting , delimiter: line 1 column 61 (char 60)

I believe what's going on is json.loads() is given a string like this: {"request":"sender data","data":[],"clock":1495816085,"ns":067420959 } ... but the number data-type in JSON is treated as octal if it starts with '0' (which I'm sure you don't intend) and an octal number that contains '8' or '9' is invalid. You could try ns.lstrip('0') instead?