September 2014
« Aug   Oct »

Nagios : How do I monitor Amazon RDS MySQL server

One of the recent requirement which I had ask to do was to setup some mechanism to monitor the MySQL RDS server where we do not have limited access towards the resources statistics and utilization.

Found that Percona has developed a tool for monitoring MySQL RDS Activities including RAM,Load and Disk utilization. One thing I’m not sure that I do not have any way to confirm whether it’s showing correct value or not since this script is calculating the statistics based on the Cloudwatch report.

a. Download and install the package from Percona site

You may get the Nagios plugins from this Percona download area.

I uses rpm package to install this Nagios plug-in

b. Set the AWS credentials for this Plugin system (/etc/boto.cfg).

You may need to provide the Access Key and Access ID set on this configuration file.

[root@host01 ~]# cat /etc/boto.cfg
aws_access_key_id = AKIdfdfsdfdsSWQXQ
aws_secret_access_key = KWVdfdsfHFHUJJHJHJ/4Ql
[root@host01 ~]#

c. Verifying the connectivity.

1. Listing the no. RDS launched in our account.

[root@host01 ~]#  /usr/lib64/nagios/plugins/ -l
List of all DB instances:
[root@host01 ~]#

2. Check the load average

[root@host01 ~]# /usr/lib64/nagios/plugins/ -i RDS_instancen_name  -m load -w 90,85,80 -c 98,95,90     OK Load average: 1.33%, 3.63%, 5.98% | load1=1.33;90.0;98.0;0;100 load5=3.63;85.0;95.0;0;100 load15=5.98;80.0;90.0;0;100
[root@host01 ~]#

3. Check the Disk usage

[root@host01 ~]# /usr/lib64/nagios/plugins/ -i RDS_instancen_name  -m storage -w 10 -c 5
OK Free storage: 23.03 GB (92%) of 25.0 GB | free_storage=92.12;10.0;5.0;0;100
[root@host01 ~]

4. Check the Memory usage

[root@host01 ~]# /usr/lib64/nagios/plugins/ -i RDS_instancen_name  -m memory -w 5 -c 2
OK Free memory: 0.78 GB (21%) of 3.75 GB | free_memory=20.8;5.0;2.0;0;100
[root@host01 ~]#

How do I create nagios host configuration file is here,

Note: I have opened MySQL remote Access to RDS server towards my Nagios Monitoring host to watch the run-time mysql variables. Check the command defined for “check_rds_mysql” and also I uses the port (3306) checking for verify the Host availability rather than not using http or ping method. Here I’m using the RDS domain name instead of IP address are declared in Host configuration section

define host{
        use             RDS-servers    
        host_name      RDS-Host  
        alias           RDS-HostAlias  

define service{
      use                             local-service
      host_name                 RDS-Host
      service_description             RDS Status
      check_command                   check_rds!status!0!0

define service{
      use                             local-service
      host_name                 RDS-Host
      service_description             RDS Load Average
      check_command                   check_rds!load!90,85,80!98,95,90

define service{
      use                             local-service
      host_name                 RDS-Host
      service_description             RDS Free Storage
      check_command                   check_rds!storage!10!5

define service{
      use                             local-service
      host_name                 RDS-Host
      service_description             RDS Free Memory
      check_command                   check_rds!memory!5!2

define command{
      command_name    check_rds
      command_line    $USER1$/ -i $HOSTALIAS$ -m $ARG1$ -w $ARG2$ -c $ARG3$

define command{
      command_name    check-host-alive-by-port
      command_line      /usr/lib64/nagios/plugins/check_tcp -H  -p 3306

define service{
use            local-service
host_name       RDS-Host
contact_groups   vtwbo-admins
service_description  MySQL RDS Connectivity
check_command   check_rds_mysql

define command{
        command_name    check_rds_mysql
        command_line  $USER1$/check_mysql -H -d database -u user_name -p password

define host{
        name                    RDS-servers  
        use                     generic-host  
        check_period            24x7          
        check_interval          5              
        retry_interval          1              
        max_check_attempts      10              
        check_command           check-host-alive-by-port  
        notification_period     24x7          
        notification_interval   20            
        notification_options    d,r            
        contact_groups          rc-admins          
        register                0              

Once you added this host configuration file in Nagios main configuration, You will see the same output screen as shown below,


7 comments to Nagios : How do I monitor Amazon RDS MySQL server

  • Hello

    i have been trying to implement this on our nagios machine, but i am running into issues, all i seem to get when i run the command ./ -l is List of all DB instances: [] and when i run and command and specify the instance i get No DB instance “mysql01” found on your AWS account. or i get UNK Unable to get RDS instance

    woud you have any idea of what is wrong, i have confirmed that boto is installed and my AWS Creds are correct

  • Joshua Seidel

    Im getting that same error, its gotta be something that has changed in the API?

  • Shalom Yerushalmy

    Is there any progress with this error?

  • The issues here is that boto plugin it defaults it region to us-east-1 ,Liju copied this instruction from another site and he doesn’t know how to change default region .

  • nagios_user

    With /etc/boto.cfg file I can give Access Key and Access ID of only one account and coz of that I can monitor only that AWS accounts RDS instances, but what If I have multiple AWS accounts and want to monitor RDS instances of all of them over Nagios than ?

Leave a Reply

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>