.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.43)
.\"
.\" Standard preamble:
.\" ========================================================================
.de Sp \" Vertical space (when we can't use .PP)
.if t .sp .5v
.if n .sp
..
.de Vb \" Begin verbatim text
.ft CW
.nf
.ne \\$1
..
.de Ve \" End verbatim text
.ft R
.fi
..
.\" Set up some character translations and predefined strings.  \*(-- will
.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
.\" double quote, and \*(R" will give a right double quote.  \*(C+ will
.\" give a nicer C++.  Capital omega is used to do unbreakable dashes and
.\" therefore won't be available.  \*(C` and \*(C' expand to `' in nroff,
.\" nothing in troff, for use with C<>.
.tr \(*W-
.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
.ie n \{\
.    ds -- \(*W-
.    ds PI pi
.    if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
.    if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\"  diablo 12 pitch
.    ds L" ""
.    ds R" ""
.    ds C` ""
.    ds C' ""
'br\}
.el\{\
.    ds -- \|\(em\|
.    ds PI \(*p
.    ds L" ``
.    ds R" ''
.    ds C`
.    ds C'
'br\}
.\"
.\" Escape single quotes in literal strings from groff's Unicode transform.
.ie \n(.g .ds Aq \(aq
.el       .ds Aq '
.\"
.\" If the F register is >0, we'll generate index entries on stderr for
.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
.\" entries marked with X<> in POD.  Of course, you'll have to process the
.\" output yourself in some meaningful fashion.
.\"
.\" Avoid warning from groff about undefined register 'F'.
.de IX
..
.nr rF 0
.if \n(.g .if rF .nr rF 1
.if (\n(rF:(\n(.g==0)) \{\
.    if \nF \{\
.        de IX
.        tm Index:\\$1\t\\n%\t"\\$2"
..
.        if !\nF==2 \{\
.            nr % 0
.            nr F 2
.        \}
.    \}
.\}
.rr rF
.\"
.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
.\" Fear.  Run.  Save yourself.  No user-serviceable parts.
.    \" fudge factors for nroff and troff
.if n \{\
.    ds #H 0
.    ds #V .8m
.    ds #F .3m
.    ds #[ \f1
.    ds #] \fP
.\}
.if t \{\
.    ds #H ((1u-(\\\\n(.fu%2u))*.13m)
.    ds #V .6m
.    ds #F 0
.    ds #[ \&
.    ds #] \&
.\}
.    \" simple accents for nroff and troff
.if n \{\
.    ds ' \&
.    ds ` \&
.    ds ^ \&
.    ds , \&
.    ds ~ ~
.    ds /
.\}
.if t \{\
.    ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
.    ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
.    ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
.    ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
.    ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
.    ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
.\}
.    \" troff and (daisy-wheel) nroff accents
.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
.ds ae a\h'-(\w'a'u*4/10)'e
.ds Ae A\h'-(\w'A'u*4/10)'E
.    \" corrections for vroff
.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
.    \" for low resolution devices (crt and lpr)
.if \n(.H>23 .if \n(.V>19 \
\{\
.    ds : e
.    ds 8 ss
.    ds o a
.    ds d- d\h'-1'\(ga
.    ds D- D\h'-1'\(hy
.    ds th \o'bp'
.    ds Th \o'LP'
.    ds ae ae
.    ds Ae AE
.\}
.rm #[ #] #H #V #F C
.\" ========================================================================
.\"
.IX Title "PMP-CHECK-AWS-RDS.PY 7"
.TH PMP-CHECK-AWS-RDS.PY 7 "2023-12-05" "perl v5.36.0" "User Contributed Perl Documentation"
.\" For nroff, turn off justification.  Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.if n .ad l
.nh
.SH "NAME"
pmp\-check\-aws\-rds.py \- Check Amazon RDS metrics.
.SH "SYNOPSIS"
.IX Header "SYNOPSIS"
.Vb 1
\&  Usage: pmp\-check\-aws\-rds.py [options]
\&
\&  Options:
\&    \-h, \-\-help            show this help message and exit
\&    \-l, \-\-list            list of all DB instances
\&    \-n PROFILE, \-\-profile\-name=PROFILE
\&                          AWS profile from ~/.boto or /etc/boto.cfg. Default:
\&                          None, fallbacks to "[Credentials]".
\&    \-r REGION, \-\-region=REGION
\&                          AWS region. Default: us\-east\-1. If set to "all", we
\&                          try to detect the instance region across all of them,
\&                          note this will be slower than you specify the region.
\&    \-i IDENT, \-\-ident=IDENT
\&                          DB instance identifier
\&    \-p, \-\-print           print status and other details for a given DB instance
\&    \-m METRIC, \-\-metric=METRIC
\&                          metric to check: [status, load, storage, memory]
\&    \-w WARN, \-\-warn=WARN  warning threshold
\&    \-c CRIT, \-\-crit=CRIT  critical threshold
\&    \-u UNIT, \-\-unit=UNIT  unit of thresholds for "storage" and "memory" metrics:
\&                          [percent, GB]. Default: percent
\&    \-t TIME, \-\-time=TIME  time period in minutes to query. Default: 5
\&    \-a AVG, \-\-avg=AVG     time average in minutes to request. Default: 1
\&    \-f, \-\-forceunknown    force alerts on unknown status. This prevents issues
\&                          related to AWS Cloudwatch throttling limits Default:
\&                          False
\&    \-d, \-\-debug           enable debug output
.Ve
.SH "REQUIREMENTS"
.IX Header "REQUIREMENTS"
This plugin is written on Python and utilizes the module \f(CW\*(C`boto\*(C'\fR (Python interface
to Amazon Web Services) to get various \s-1RDS\s0 metrics from CloudWatch and compare
them against the thresholds.
.PP
* Install the package: \f(CW\*(C`yum install python\-boto\*(C'\fR or \f(CW\*(C`apt\-get install python\-boto\*(C'\fR
* Create a config /etc/boto.cfg or ~nagios/.boto with your \s-1AWS API\s0 credentials.
  See http://code.google.com/p/boto/wiki/BotoConfig
.PP
This plugin that is supposed to be run by Nagios, i.e. under ``nagios`` user,
should have permissions to read the config /etc/boto.cfg or ~nagios/.boto.
.PP
Example:
.PP
.Vb 4
\&  [root@centos6 ~]# cat /etc/boto.cfg
\&  [Credentials]
\&  aws_access_key_id = THISISATESTKEY
\&  aws_secret_access_key = thisisatestawssecretaccesskey
.Ve
.PP
If you do not use this config with other tools such as our Cacti script,
you can secure this file the following way:
.PP
.Vb 2
\&  [root@centos6 ~]# chown nagios /etc/boto.cfg
\&  [root@centos6 ~]# chmod 600 /etc/boto.cfg
.Ve
.SH "DESCRIPTION"
.IX Header "DESCRIPTION"
The plugin provides 4 checks and some options to list and print \s-1RDS\s0 details:
.PP
* \s-1RDS\s0 Status
* \s-1RDS\s0 Load Average
* \s-1RDS\s0 Free Storage
* \s-1RDS\s0 Free Memory
.PP
To get the list of all \s-1RDS\s0 instances under \s-1AWS\s0 account:
.PP
.Vb 1
\&  # ./pmp\-check\-aws\-rds.py \-l
.Ve
.PP
To get the detailed status of \s-1RDS\s0 instance identified as \f(CW\*(C`blackbox\*(C'\fR:
.PP
.Vb 1
\&  # ./pmp\-check\-aws\-rds.py \-i blackbox \-p
.Ve
.PP
Nagios check for the overall status. Useful if you want to set the rest
of the checks dependent from this one:
.PP
.Vb 2
\&  # ./pmp\-check\-aws\-rds.py \-i blackbox \-m status
\&  OK mysql 5.1.63. Status: available
.Ve
.PP
Nagios check for \s-1CPU\s0 utilization, specify thresholds as percentage of
1\-min., 5\-min., 15\-min. average accordingly:
.PP
.Vb 2
\&  # ./pmp\-check\-aws\-rds.py \-i blackbox \-m load \-w 90,85,80 \-c 98,95,90
\&  OK Load average: 18.36%, 18.51%, 15.95% | load1=18.36;90.0;98.0;0;100 load5=18.51;85.0;95.0;0;100 load15=15.95;80.0;90.0;0;100
.Ve
.PP
Nagios check for the free memory, specify thresholds as percentage:
.PP
.Vb 4
\&  # ./pmp\-check\-aws\-rds.py \-i blackbox \-m memory \-w 5 \-c 2
\&  OK Free memory: 5.90 GB (9%) of 68 GB | free_memory=8.68;5.0;2.0;0;100
\&  # ./pmp\-check\-aws\-rds.py \-i blackbox \-m memory \-u GB \-w 4 \-c 2
\&  OK Free memory: 5.90 GB (9%) of 68 GB | free_memory=5.9;4.0;2.0;0;68
.Ve
.PP
Nagios check for the free storage space, specify thresholds as percentage or \s-1GB:\s0
.PP
.Vb 4
\&  # ./pmp\-check\-aws\-rds.py \-i blackbox \-m storage \-w 10 \-c 5
\&  OK Free storage: 162.55 GB (33%) of 500.0 GB | free_storage=32.51;10.0;5.0;0;100
\&  # ./pmp\-check\-aws\-rds.py \-i blackbox \-m storage \-u GB \-w 10 \-c 5
\&  OK Free storage: 162.55 GB (33%) of 500.0 GB | free_storage=162.55;10.0;5.0;0;500.0
.Ve
.PP
By default, the region is set to ``us\-east\-1``. You can re-define it globally in boto config or
specify with \-r option. The following command will list all instances across all regions under your \s-1AWS\s0 account:
.PP
.Vb 1
\&  # ./pmp\-check\-aws\-rds.py \-r all \-l
.Ve
.PP
The following command will show the status for the first instance identified as ``blackbox`` in all regions:
.PP
.Vb 1
\&  # ./pmp\-check\-aws\-rds.py \-r all \-i blackbox \-p
.Ve
.PP
Remember, scanning regions are slower operation than specifying it explicitly.
.SH "CONFIGURATION"
.IX Header "CONFIGURATION"
Here is the excerpt of potential Nagios config:
.PP
.Vb 6
\&  define host{
\&        use                             mysql\-host
\&        host_name                       blackbox
\&        alias                           blackbox
\&        address                         blackbox.abcdefgh.us\-east\-1.rds.amazonaws.com
\&        }
\&
\&  define servicedependency{
\&        host_name                       blackbox
\&        service_description             RDS Status
\&        dependent_service_description   RDS Load Average, RDS Free Storage, RDS Free Memory
\&        execution_failure_criteria      w,c,u,p
\&        notification_failure_criteria   w,c,u,p
\&        }
\&
\&  define service{
\&        use                             active\-service
\&        host_name                       blackbox
\&        service_description             RDS Status
\&        check_command                   check_rds!status!0!0
\&        }
\&
\&  define service{
\&        use                             active\-service
\&        host_name                       blackbox
\&        service_description             RDS Load Average
\&        check_command                   check_rds!load!90,85,80!98,95,90
\&        }
\&
\&  define service{
\&        use                             active\-service
\&        host_name                       blackbox
\&        service_description             RDS Free Storage
\&        check_command                   check_rds!storage!10!5
\&        }
\&
\&  define service{
\&        use                             active\-service
\&        host_name                       blackbox
\&        service_description             RDS Free Memory
\&        check_command                   check_rds!memory!5!2
\&        }
\&
\&  define command{
\&        command_name    check_rds
\&        command_line    $USER1$/pmp\-check\-aws\-rds.py \-i $HOSTALIAS$ \-m $ARG1$ \-w $ARG2$ \-c $ARG3$
\&        }
.Ve
.SH "COPYRIGHT, LICENSE, AND WARRANTY"
.IX Header "COPYRIGHT, LICENSE, AND WARRANTY"
This program is copyright 2014 Percona \s-1LLC\s0 and/or its affiliates.
Feedback and improvements are welcome.
.PP
\&\s-1THIS PROGRAM IS PROVIDED \*(L"AS IS\*(R" AND WITHOUT ANY EXPRESS OR IMPLIED
WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.\s0
.PP
This program is free software; you can redistribute it and/or modify it under
the terms of the \s-1GNU\s0 General Public License as published by the Free Software
Foundation, version 2.  You should have received a copy of the \s-1GNU\s0 General
Public License along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, \s-1MA\s0  02111\-1307  \s-1USA.\s0
.SH "VERSION"
.IX Header "VERSION"
\&\f(CW$PROJECT_NAME\fR$ pmp\-check\-aws\-rds.py \f(CW$VERSION\fR$