obfuscurity / synthesize

Easy installer for Graphite and StatsD
MIT License
384 stars 100 forks source link

Statsite not writing to Graphite v4.0.0 xrange and StandardError not defined #81

Open hkp opened 4 years ago

hkp commented 4 years ago

Did a fresh install of the v4.0.0 tagged and master branch.

Statsite was not flushing to Graphite. I found this error in the syslog.

Jul 11 21:34:07 ubuntu-bionic statsite[28695]: Traceback (most recent call last): Jul 11 21:34:07 ubuntu-bionic statsite[28695]: File "/usr/local/sbin/statsite-sink-graphite.py", line 102, in flush_lines Jul 11 21:34:07 ubuntu-bionic statsite[28695]: self._write_metric(data) Jul 11 21:34:07 ubuntu-bionic statsite[28695]: File "/usr/local/sbin/statsite-sink-graphite.py", line 156, in _writemetric Jul 11 21:34:07 ubuntu-bionic statsite[28695]: for in xrange(self.attempts): Jul 11 21:34:07 ubuntu-bionic statsite[28695]: NameError: name 'xrange' is not defined Jul 11 21:34:07 ubuntu-bionic statsite[28695]: During handling of the above exception, another exception occurred: Jul 11 21:34:07 ubuntu-bionic statsite[28695]: Traceback (most recent call last): Jul 11 21:34:07 ubuntu-bionic statsite[28695]: File "/usr/local/sbin/statsite-sink-graphite.py", line 186, in Jul 11 21:34:07 ubuntu-bionic statsite[28695]: main() Jul 11 21:34:07 ubuntu-bionic statsite[28695]: File "/usr/local/sbin/statsite-sink-graphite.py", line 182, in main Jul 11 21:34:07 ubuntu-bionic statsite[28695]: graphite.send_metrics() Jul 11 21:34:07 ubuntu-bionic statsite[28695]: File "/usr/local/sbin/statsite-sink-graphite.py", line 87, in send_metrics Jul 11 21:34:07 ubuntu-bionic statsite[28695]: self.flush() Jul 11 21:34:07 ubuntu-bionic statsite[28695]: File "/usr/local/sbin/statsite-sink-graphite.py", line 103, in flush_lines Jul 11 21:34:07 ubuntu-bionic statsite[28695]: except StandardError: Jul 11 21:34:07 ubuntu-bionic statsite[28695]: NameError: name 'StandardError' is not defined Jul 11 21:34:07 ubuntu-bionic statsite[28695]: statsite[28695]: Streaming command exited with status 1 Jul 11 21:34:07 ubuntu-bionic statsite[28695]: Streaming command exited with status 1

It looks like you're using a Python2 script with Python3, so it's failing.

hkp commented 4 years ago

Looking at the way you do the install, you're pulling the script from the statsite repo, so maybe I should submit a patch there to fix the sink to be Python3 compatible. Or you can keep your own python3 compatible version.

hkp commented 4 years ago

I sent a pull request that will fix this.