Not the answer you need?
Register and ask your own question!

Nagios not listing all databases in the respective regions - pmp-check-aws-rds.py

ricardoheynricardoheyn EntrantCurrent User Role Beginner
Hello everyone!

I have installed percona plugins, put the credentials on /etc/boto.cfg and /etc/nagios3/.boto, but the script only show the database at US Virginia, how can I display my databases at "São Paulo" zone?

I am new to administrate percona scripts, I appreciate any help.

Regards,

Ricardo

Comments

  • weberweber Advisor Inactive User Role Beginner
    The existing plugin can't connect to the specific region as it does not use connect_to_region() function, so the listing shouldn't work. The fix must be appropriate here. Can you check if you can get the stats using the script for the specific DBInstanceIdentifier taken from AWS panel?
  • ricardoheynricardoheyn Entrant Current User Role Beginner
    Hello weber,

    First, thank you for your help.

    The plugin pmp-check-aws-rds just display one dbinstance (I am using -l to list all), on Virginia, but I have others dbinstances on São Paulo, Ireland, Tokyo.. That is the problem :/

    When I try to check the dbinstance, displayed the erro "No DB instance "dbinstance" found on your AWS account."

    But when I use http://exchange.nagios.org/directory/Plugins/Operating-Systems/*-Virtual-Environments/Others/Check_AWS_CloudWatch_metrics/details
    seems everything fine, and I can list all of dbinstances. I am using the same key for both plugin.

    I put the key on /etc/boto.cfg file, example:

    [Credentials]
    aws_access_key_id = THE_KEY
    aws_secret_access_key = THE_KEY2

    Regards,

    Ricardo
  • jtuckerjtucker Entrant Current User Role Beginner
    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:
    1. Use the most recent version of boto (2.38.0 at the time I'm writing this).
    2. 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
    3. Make the following changes to pmp-check-aws-rds.py:

    in the "imports" section add these lines:
    import boto.rds
    import boto.ec2.cloudwatch
    
    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)

    4. 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:
    1. 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)

    2. 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
    boto.connect_rds()
    
    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.
  • weberweber Advisor Inactive User Role Beginner
    Hello,
    We have made a release 2 weeks ago that includes region support and new instance classes: https://www.percona.com/blog/2015/06/22/percona-monitoring-plugins-1-1-5-release/
Sign In or Register to comment.

MySQL, InnoDB, MariaDB and MongoDB are trademarks of their respective owners.
Copyright ©2005 - 2020 Percona LLC. All rights reserved.