sensu-plugins / sensu-plugins-aws

This plugin provides native AWS instrumentation for monitoring and metrics collection, including: health and metrics for various AWS services, such as EC2, RDS, ELB, and more, as well as handlers for EC2, SES, and SNS.
http://sensu-plugins.io
MIT License
81 stars 143 forks source link

Highlight false positives in `check-sqs-messages` when metric is unsupported #381

Closed majormoses closed 4 years ago

majormoses commented 4 years ago

Pull Request Checklist

380

General

Purpose

Highlight false positives in check-sqs-messages when metric is unsupported

Previously you could see something like this:

bundle _1.17.3_ exec ./bin/check-sqs-messages.rb -r us-east-1 -q test-sensu-380 -m ApproximateAgeOfOldestMessage -c 1
NEWER VERSION AVAILABLE: Please upgrade to AWS SDK For Ruby V3
SQSMsgs OK: 0 messages in test-sensu-380 queue

Instead this will now properly notify responders to the (now) known bug. As it appears to be an api limitation and not something we did in our code we will keep the discussion open for a proper solution but first things first is getting it to tell the truth. After the fix it should look something like this:

bundle exec ./bin/check-sqs-messages.rb -r us-east-1 -q test-sensu-380 -m ApproximateAgeOfOldestMessage -c 1
SQSMsgs UNKNOWN: failed to pull metric ApproximateAgeOfOldestMessage on queue: test-sensu-380.
available attributes: {"QueueArn"=>"arn:aws:sqs:us-east-1:REDACTED:test-sensu-380", "ApproximateNumberOfMessages"=>"2", "ApproximateNumberOfMessagesNotVisible"=>"0", "ApproximateNumberOfMessagesDelayed"=>"0", "CreatedTimestamp"=>"1592356301", "LastModifiedTimestamp"=>"1592356301", "VisibilityTimeout"=>"30", "MaximumMessageSize"=>"262144", "MessageRetentionPeriod"=>"345600", "DelaySeconds"=>"0", "ReceiveMessageWaitTimeSeconds"=>"0"}

Signed-off-by: Ben Abrams me@benabrams.it

Known Compatibility Issues

There is a bug that is being masked, this surfaces it. This will not actually break any code, system, etc but deploying this will result in several unknowns from community members.