I realize this is an old thread but I came across this via Google while trying to solve this exact problem so I figured I’d post a solution just in case anyone else runs across this thread as I did.
First, I don’t know which is more broken, boto or pmp-check-aws-rds.py, but here is my solution:
- Use the most recent version of boto (2.38.0 at the time I’m writing this).
- Being able to set the “Default” region in the boto.cfg file is a lie. Do not bother with this unless you check the config manually
- Make the following changes to pmp-check-aws-rds.py:
in the “imports” section add these lines:
in get_rds_info change the first line to this:
rds = boto.rds.connect_to_region('us-west-2')
(replace ‘us-west-2’ with the region you care about)
in get_rds_stats change the first line to this:
cw = boto.ec2.cloudwatch.connect_to_region('us-west-2')
(again, replace ‘us-west-2’ with the region you care about)
- re-start nagios. You will now find the instances you care about.
For a more robust solution, we really need a more robust solution and I can think of two of these:
- Manually add a
region = 'region-I-care-about'
to /etc/boto.cfg and manually load that config file and parse the region out of it. This is just fine if you have one Nagios server per region (and hence only need to configure it once for the server and it won’t change)
- Add another argument to the OptionParser() under main() that accepts a region. This would be more work (in my opinion) but would allow you to specify the region to use with every command and you could then configure your various .cfg files in nagios to have the host-region or something like that and pass it as another argument. This is my long-term solution. We deploy all of this through Salt anyway so it’s relatively easy for me to pull the region for each instance from the grains on that instance (I use a custom proxy minion in Salt to manage RDS instances in case you’re wondering and the “grains” for region are also a custom script for RDS). Then I just set things accordingly in the pillar values and salt will miracle everything into place.
Note: Boto advertises that you can set in the boto.cfg a
region = us-west-2
and it will allow things like
to automatically pick up the correct region. My experience has been that this is broken and upon inspecting the Boto 2.38.0 codebase from github (I synced it yesterday) there is nothing in the rds module that suggests that this functionality is in place or (my opinion) could even be put into place without breaking things. It would be extremely convenient if Boto would make handling regions a bit more seamless (also my opinion).
I’m not sure if this pmp-check-aws-rds.py is open source but if there is a way for me to contribute these changes so that everyone can consume them then I’d be happy to do so if someone can point me in the right direction for how to do that.
Ninja edit: I just re-downloaded the pmp-check-aws-rds.py from the tarball option instead of from Percona’s Yum repository and it looks like a much more recent version that has the region included as a parameter (so basically the change that I was making above). It also has an update set of db_classes. Not sure why these would be out of sync but they are.