samuel / python-munin

Python framework for building Munin plugins (also includes some plugins prebuilt).
http://samuel.github.com/python-munin/
Other
290 stars 50 forks source link

Unable to get queue length for queues not in us-east-1 #11

Open derektamsen opened 11 years ago

derektamsen commented 11 years ago

The munin plugin tracebacks when trying to query the queue length for message queues outside the default region of us-east-1.

$ sudo munin-run aws_sqs_queue_length_test-queue-us-west-2
Traceback (most recent call last):
  File "/etc/munin/plugins/aws_sqs_queue_length_sg-test-queue", line 45, in <module>
    AWSSQSQueueLengthPlugin().run()
  File "/usr/lib/python2.6/site-packages/munin/__init__.py", line 50, in run
    values = self.execute()
  File "/etc/munin/plugins/aws_sqs_queue_length_sg-test-queue", line 41, in execute
    for qname in self.queues
  File "/etc/munin/plugins/aws_sqs_queue_length_sg-test-queue", line 41, in <genexpr>
    for qname in self.queues
AttributeError: 'NoneType' object has no attribute 'get_queue'
derektamsen commented 11 years ago

Since the SQSConnection() method is being called the region is being set to the defaults in boto

class SQSConnection(AWSQueryConnection):
    ...
    DefaultRegionName = 'us-east-1'
    DefaultRegionEndpoint = 'sqs.us-east-1.amazonaws.com'
    ...