Skip to content
This repository was archived by the owner on Jan 15, 2021. It is now read-only.

pmp-check-aws-rds.py: fixed for python3 #111

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 13 additions & 7 deletions nagios/bin/pmp-check-aws-rds.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def debug(val):
"""Debugging output"""
global options
if options.debug:
print 'DEBUG: %s' % val
print('DEBUG: %s' % val)


def main():
Expand Down Expand Up @@ -155,6 +155,12 @@ def main():
'db.t2.large': 8,
'db.t2.xlarge': 16,
'db.t2.2xlarge': 32,
'db.t3.micro': 1,
'db.t3.small': 2,
'db.t3.medium': 4,
'db.t3.large': 8,
'db.t3.xlarge': 16,
'db.t3.2xlarge': 32,
'db.m3.medium': 3.75,
'db.m3.large': 7.5,
'db.m3.xlarge': 15,
Expand Down Expand Up @@ -222,7 +228,7 @@ def main():
sys.exit()
elif options.db_list:
info = rds.get_list()
print 'List of all DB instances in %s region(s):' % (options.region,)
print('List of all DB instances in %s region(s):' % (options.region,))
pprint.pprint(info)
sys.exit()
elif not options.ident:
Expand All @@ -233,7 +239,7 @@ def main():
if info:
pprint.pprint(vars(info))
else:
print 'No DB instance "%s" found on your AWS account and %s region(s).' % (options.ident, options.region)
print('No DB instance "%s" found on your AWS account and %s region(s).' % (options.ident, options.region))

sys.exit()
elif not options.metric or options.metric not in metrics.keys():
Expand Down Expand Up @@ -356,7 +362,7 @@ def main():
try:
storage = db_classes[info.instance_class]
except:
print 'Unknown DB instance class "%s"' % info.instance_class
print('Unknown DB instance class "%s"' % info.instance_class)
sys.exit(CRITICAL)

free = '%.2f' % (free / 1024 ** 3)
Expand All @@ -382,12 +388,12 @@ def main():

# Final output
if status != UNKNOWN and perf_data:
print '%s %s | %s' % (short_status[status], note, perf_data)
print('%s %s | %s' % (short_status[status], note, perf_data))
elif status == UNKNOWN and not options.forceunknown:
print '%s %s | null' % ('OK', note)
print('%s %s | null' % ('OK', note))
sys.exit(0)
else:
print '%s %s' % (short_status[status], note)
print('%s %s' % (short_status[status], note))

sys.exit(status)

Expand Down