GithubHelp home page GithubHelp logo

sensu-plugins / sensu-plugins-aws Goto Github PK

View Code? Open in Web Editor NEW
80.0 18.0 144.0 878 KB

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.

Home Page: http://sensu-plugins.io

License: MIT License

Ruby 100.00%
aws sensu-plugins monitoring metrics sensu aws-monitoring ec2 load-balancer rds sns

sensu-plugins-aws's People

Contributors

ajmath avatar analytically avatar arthurzenika avatar boutetnico avatar brendangibat avatar damiendurant avatar dependabot-preview[bot] avatar dependabot-support avatar eheydrick avatar guikcd avatar ivanfetch avatar jmccarty3 avatar johntdyer avatar majormoses avatar marckysharky avatar masneyb avatar mattdoller avatar mattyjones avatar mool avatar multani avatar oba11 avatar obazoud avatar phoppe93 avatar reardencode avatar runningman84 avatar sensu-plugin avatar sstarcher avatar swibowo avatar tas50 avatar zbintliff avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sensu-plugins-aws's Issues

Deprecation Warnings due to using right_aws which uses right_http_connection and has not been maintained.

Just testing these plugins and getting some deprecations warnings which is messing up the alerts in sensu:

eg

/opt/sensu/embedded/bin/ruby ./check-elb-health.rb -a <accessid> -k <accesskey> -r ap-southeast-2 -n sensu-ELB -v

Digest::Digest is deprecated; use Digest
Digest::Digest is deprecated; use Digest
/opt/sensu/embedded/lib/ruby/gems/2.3.0/gems/right_http_connection-1.5.0/lib/base/net_fix.rb:51:in `rbuf_fill': Object#timeout is deprecated, use Timeout.timeout instead.
/opt/sensu/embedded/lib/ruby/gems/2.3.0/gems/right_http_connection-1.5.0/lib/base/net_fix.rb:51:in `rbuf_fill': Object#timeout is deprecated, use Timeout.timeout instead.

/opt/sensu/embedded/bin/ruby --version
ruby 2.3.0p0 (2015-12-25 revision 53290) [x86_64-linux]

are any updated versions for these AWS plugins coming shortly?

aws-sdk-v1 error to install nokogiri dependecy

Hi,
I have problems to install aws-sdk-v1 on ubuntu instance because a nokogiri error.
I needed do:
apt-get install libxml2 libxml2-dev libxslt1-dev libxslt1.1
and run:
/opt/sensu/embedded/bin/gem install 'nokogiri -- --use-system-libraries --with-xml2-include=/usr/include/libxml2/'
so I can install it:
/opt/sensu/embedded/bin/gem install aws-sdk-v1

Standardize the fetching of creds

Some of the plugins can pull from the env and others require CLI. In the long run we want to do this 100% by config, but for now we should support CLI/ENV for all plugins. Copy paste code here. Pretty simple change.

check elb health

It looks like the current elb health checks do not check if the minmum amout of health hosts is met. I think these events should be alerted too...

Furthermore I am confused about three different health check scripts, check-elb, check-elb-fox, check-elb-sdk...

I would prefer a single working script here. What is your plan for the future? Would it make sense to create a pull request for this feature? Which api/sdk do you want to use?

Invalid region on some checks

With new regions launched e.g ap-south-1, noticed that check-instance-events.rb and check-rds-events.rb doesnt work with the error Invalid region specified!.

Creating a PR to fix this

Is there a reason still using AWS SDK V1

The V1 SDK is outdated and most newer features of AWS sources are not supported on it. Is there aversion to updateding to SDK core?

Would a new gem version be enough of an upgrade. or should we create side by side scripts?

New Release soon?

I was trying to figure out what the release schedule is for rubgems but it seems to be on-demand. I was hoping you guys would consider doing a release soon as I see quite a few changes that my team is currently trying to take advantage of but have not yet reached the latest release (2.0.1). Are there plans to release anytime soon or would it be recommended that we start building our own gem?

One change that comes to mind is support of newer instance types for rds:
224484d

handler-ec2_node - missing credentials

In the handler documentation:

{
"aws": {
"access_key": "adsafdafda",
"secret_key": "qwuieohajladsafhj23nm",
"region": "us-east-1c"
}
}

Does not seem to work. I tried many different ways to try to make this work, with no luck.
I'm not a Ruby programmer either, so I'm a bit confused about how these credentials are passed to the AWS client.

metrics-elasticache.rb

Check failed to run: undefined method downcase' for nil:NilClass, ["/var/lib/gems/1.9.1/gems/sensu-plugins-aws-1.2.0/bin/metrics-elasticache.rb:95:inrun'", "/var/lib/gems/1.9.1/gems/sensu-plugin-1.2.0/lib/sensu-plugin/cli.rb:56:in `block in class:CLI'"]

Feature Requests / Questions?

  • metrics-rds.rb is not included in the latest tagged version. Is there a reason for this?

  • I recently submitted a pull request to include the flags to pass the access key and secret in metrics-rds.rb, but it was denied because I was told the intended way was to pass through environment variables. How do we do this?

  • metrics-rds.rb doesn't seem to include all of the statistics for an Aurora DB, whereas when running this on a MySQL DB, this works as intended. Clearly, the AWS console provides this information for both types, but this check doesn't seem to support both.

Example output for checking an Aurora DB:
xxxxxx.databaseconnections 93.0 1481824800
xxxxxx.binlogdiskusage 0.0 1481824800

  • Is there a check I can use to ensure each specified availability zone is up? Else, warn if down at a specified time (seconds) and critical at another specified period (seconds).

  • Support for checks and metrics for ALBs

Thanks

`check-rds.rb` sporadically returns `UNKNOWN: DB instance not found` for existing instances

Pasting a log entry here for context:

{"timestamp":"2016-02-23T16:12:55.980595+0000","level":"info","message":"event was filtered",
"handler":{"command":"/etc/sensu/plugins/mailer.rb -j '<removed>'","type":"pipe","filters":
["exclude_host_<removed>","exclude_check_<removed>"],"severities":["ok","warning","critical",
"unknown"],"name":"<removed>"},"event":{"id":"5132d1d8-1a43-48da-ab5f-be0ee755fe39","client":
{"name":"<removed>","address":"unknown","subscriptions":[],"keepalives":false,"version":"0.20.3"},
"check":{"command":"sudo /opt/sensu/embedded/bin/ruby /etc/sensu/plugins/check-rds.rb -i <removed>
-r us-west-2 --disk-warning-over 85 --disk-critical-over 90 --period 180","handlers":["<removed>",
"<removed>"],"interval":180,"occurrences":2,"source":"<removed>","subscribers":
["roundrobin:blackbox"],"standalone":false,"refresh":3600,"name":"
<removed>_cloudwatch_FreeStorageSpace_check","issued":1456243942,"executed":1456243942,"duration":
33.442,"output":"CheckRDS UNKNOWN: DB instance not found.\n","status":3,"history":
["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","3"],
"total_state_change":6},"occurrences":1,"action":"create","timestamp":1456243975}}

As you can see the previous history states were 0. This looks like a throttling issue, have you guys seen this before?

check-elb-sum-requests.rb - bad output for influxdb

Hi, i need store the result of this check into grafana trought influxdb but the result has not an associated metric and into grafana i view directly the result instead the metric, it's possibile to modify the script to add a metric name at the result? eg,

<name> <result>

intead of:

<result>
CheckELBSumRequests OK: <AWS::ELB::LoadBalancer name:xxxxx>; ( within 60 seconds between 2016-03-09 09:46:05 +0100 to 2016-03-09 09:47:05 +0100)

To grafana the output of influxdb is this:

elb-sum

Ensure support for multiple objects in all checks

AWS plugins are very resource intensive (sdk load time). We need to make sure that when a plugin runs it can check all resource types so the user doesn't have to run multiple instances of the same check for each resource. I recently added this to the metrics-elb-full plugin, which can now poll multiple ELBs in 1 run. We need to make sure we're doing this in all plugins.

This plugin does not yet support 0.29 because of version conflicting versions of `sensu-plugin`

All other checks work fine. ELB, RDS, etc. No issues. This is only one that fails on my rig.

sensu version = 0.29
/opt/sensu/embedded/bin/ruby = ruby 2.4.1p111

the exact command i'm running is:
/opt/sensu/embedded/bin/ruby /etc/sensu/plugins/sensu-plugins-aws/bin/check-reserved-instances.rb -w 2592000 -c 259200

and the error is:

/opt/sensu/embedded/lib/ruby/site_ruby/2.4.0/rubygems/specification.rb:2288:in raise_if_conflicts': Unable to activate sensu-plugins-aws-6.1.0, because sensu-plugin-2.0.1 conflicts with sensu-plugin (~> 1.3) (Gem::ConflictError) from /opt/sensu/embedded/lib/ruby/site_ruby/2.4.0/rubygems/specification.rb:1408:in >activate'
from /opt/sensu/embedded/lib/ruby/site_ruby/2.4.0/rubygems.rb:220:in rescue in try_activate' from /opt/sensu/embedded/lib/ruby/site_ruby/2.4.0/rubygems.rb:213:in try_activate'
from /opt/sensu/embedded/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:126:in rescue in require' from /opt/sensu/embedded/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:40:in >require'
from /etc/sensu/plugins/sensu-plugins-aws/bin/check-reserved-instances.rb:30:in`<main>'

I tried removing and installing gems from scratch. i can't remove old gems w/o breaking other plugins.

full gem list as follows:
*** LOCAL GEMS ***

activesupport (4.2.9, 4.2.6)
addressable (2.5.1)
amq-protocol (2.0.1)
amqp (1.6.0)
aws-es-transport (0.1.4)
aws-sdk (2.10.4, 2.4.4)
aws-sdk-core (2.10.4, 2.4.4)
aws-sdk-resources (2.10.4, 2.4.4)
aws-sdk-v1 (1.67.0, 1.66.0)
aws-ses (0.6.0)
aws-sigv4 (1.0.0)
bigdecimal (default: 1.3.0)
bson (4.2.1)
builder (3.2.3)
bunny (2.5.0)
carrot-top (0.0.7)
CFPropertyList (2.3.5)
childprocess (0.5.8)
chronic_duration (0.10.6)
cookiejar (0.3.3)
did_you_mean (1.1.0)
dnsbl-client (1.0.2)
dnsruby (1.60.1)
domain_name (0.5.20170404)
elasticsearch (1.1.2, 1.0.14)
elasticsearch-api (5.0.4, 1.1.2, 1.0.18, 1.0.14)
elasticsearch-transport (5.0.4, 1.1.2, 1.0.18, 1.0.14)
em-http-request (1.1.5)
em-http-server (0.1.8)
em-socksify (0.3.1)
em-worker (0.0.2)
english (0.6.3)
erubis (2.7.0)
eventmachine (1.2.2)
excon (0.57.0)
faraday (0.9.2)
faraday_middleware (0.10.1)
ffi (1.9.18)
fission (0.5.0)
fog (1.32.0)
fog-atmos (0.1.0)
fog-aws (1.4.0)
fog-brightbox (0.11.0)
fog-core (1.43.0)
fog-ecloud (0.1.1)
fog-google (0.5.3)
fog-json (1.0.2)
fog-local (0.3.1)
fog-powerdns (0.1.1)
fog-profitbricks (3.0.0)
fog-radosgw (0.0.5)
fog-riakcs (0.1.0)
fog-sakuracloud (1.7.5)
fog-serverlove (0.1.2)
fog-softlayer (1.1.4)
fog-storm_on_demand (0.1.1)
fog-terremark (0.1.0)
fog-vmfusion (0.1.0)
fog-voxel (0.1.0)
fog-xml (0.1.3)
formatador (0.2.5)
http-cookie (1.0.3)
http_parser.rb (0.6.0)
i18n (0.8.4)
inflecto (0.0.2)
inifile (3.0.0)
io-console (default: 0.4.6)
ipaddress (0.8.3)
jenkins_api_client (1.5.3)
jmespath (1.3.1)
json (default: 2.0.2, 1.8.6)
language (0.6.0)
mail (2.6.6)
mime-types (3.1, 2.99.3)
mime-types-data (3.2016.0521)
mini_portile2 (2.2.0)
minitest (5.10.1)
mixlib-cli (1.7.0)
mixlib-shellout (2.2.7)
mongo (2.4.1)
mono_logger (1.1.0)
multi_json (1.12.1)
multipart-post (2.0.0)
mustermann (1.0.0)
net-ping (1.7.8)
net-telnet (0.1.1)
netrc (0.11.0)
nokogiri (1.8.0)
numerizer (0.1.1)
oj (2.18.1)
openssl (default: 2.0.3)
pagerduty (2.1.0)
parse-cron (0.1.4)
power_assert (0.4.1)
psych (default: 2.2.2)
public_suffix (2.0.5)
rack (2.0.3)
rack-protection (2.0.0)
raindrops (0.18.0)
rake (12.0.0)
rake-compiler (1.0.3)
rb-readline (0.5.3)
rdoc (default: 5.0.0)
redis (3.3.3)
redis-namespace (1.5.3)
resque (1.25.2)
rest-client (1.8.0)
right_aws (3.1.0)
right_http_connection (1.5.0)
ruby-mysql (2.9.14)
rubygems-update (2.6.10)
sensu (0.29.0)
sensu-extension (1.5.1)
sensu-extensions (1.9.0)
sensu-extensions-check-dependencies (1.0.1)
sensu-extensions-debug (1.0.0)
sensu-extensions-json (1.0.0)
sensu-extensions-occurrences (1.2.0)
sensu-extensions-only-check-output (1.0.0)
sensu-extensions-ruby-hash (1.0.0)
sensu-json (2.1.0)
sensu-logger (1.2.1)
sensu-plugin (2.0.1, 1.4.5, 1.2.0)
sensu-plugins-apache (0.0.5)
sensu-plugins-aws (6.1.0)
sensu-plugins-disk-checks (2.2.0)
sensu-plugins-dns (1.2.1)
sensu-plugins-elasticsearch (1.3.1)
sensu-plugins-filesystem-checks (0.2.0)
sensu-plugins-github (2.0.0)
sensu-plugins-http (2.4.0)
sensu-plugins-load-checks (3.0.0)
sensu-plugins-memory-checks (2.1.0)
sensu-plugins-mongodb (1.3.0)
sensu-plugins-mysql (2.1.1)
sensu-plugins-network-checks (2.0.0)
sensu-plugins-nginx (2.1.0)
sensu-plugins-ntp (1.0.1)
sensu-plugins-openvpn (0.0.3)
sensu-plugins-postfix (0.1.0)
sensu-plugins-process-checks (2.3.0)
sensu-plugins-rabbitmq (3.2.0)
sensu-plugins-resque (0.1.0)
sensu-plugins-sensu (1.1.0)
sensu-plugins-slack (1.1.1)
sensu-plugins-ssl (1.4.0)
sensu-plugins-uchiwa (1.0.0)
sensu-redis (2.1.1)
sensu-settings (10.0.0)
sensu-spawn (2.2.1)
sensu-transport (7.0.2)
sinatra (2.0.0)
socksify (1.7.1)
stomp (1.4.3)
sys-filesystem (1.1.7)
sys-proctable (0.9.8 universal-linux)
terminal-table (1.8.0)
test-unit (3.2.3)
thor (0.19.4)
thread_safe (0.3.6)
tilt (2.0.7)
tzinfo (1.2.3)
unf (0.1.4)
unf_ext (0.0.7.4)
unicode-display_width (1.3.0)
vegas (0.1.11)
whois (3.6.3)
xml-simple (1.1.5)
xmlrpc (0.2.1)

Metric checks don't really work

for instance:

  def statistics_options
    {
      start_time: config[:end_time] - config[:period],
      end_time:   config[:end_time],
      statistics: ['Average'],
      period:     config[:period]
    }
  end

(That method comes from check-ec2-network, many of the other metric checks have near identical methods following the same principle)

Results in only one data point ever being retrieved from CloudWatch. Not exactly the most useful thing when trying to compute an average of averages for say...network traffic

DDB tests don't check all tables

We have 415 or so ddb tables but when I run the ddb check scripts (either throttle or capacity) they stop at 100; I'm assuming pagination needs to be added.

gem install fails on ubuntu 14.04

Please document how to install this on a fresh ubuntu 14.04 box:

ubuntu@atlanta:~$ sudo /opt/sensu/embedded/bin/gem install sensu-plugins-aws
Fetching: jmespath-1.0.2.gem (100%)
Successfully installed jmespath-1.0.2
Fetching: aws-sdk-core-2.1.14.gem (100%)
Successfully installed aws-sdk-core-2.1.14
Fetching: aws-sdk-resources-2.1.14.gem (100%)
Successfully installed aws-sdk-resources-2.1.14
Fetching: aws-sdk-2.1.14.gem (100%)
Successfully installed aws-sdk-2.1.14
Fetching: mini_portile-0.6.2.gem (100%)
Successfully installed mini_portile-0.6.2
Fetching: nokogiri-1.6.6.2.gem (100%)
Building native extensions.  This could take a while...
ERROR:  Error installing sensu-plugins-aws:
    ERROR: Failed to build gem native extension.

    /opt/sensu/embedded/bin/ruby extconf.rb
checking if the C compiler accepts ... yes
Building nokogiri using packaged libraries.
checking for gzdopen() in -lz... yes
checking for iconv using --with-opt-* flags... yes
************************************************************************
IMPORTANT NOTICE:

Building Nokogiri with a packaged version of libxml2-2.9.2
with the following patches applied:
    - 0001-Revert-Missing-initialization-for-the-catalog-module.patch
    - 0002-Fix-missing-entities-after-CVE-2014-3660-fix.patch

Team Nokogiri will keep on doing their best to provide security
updates in a timely manner, but if this is a concern for you and want
to use the system library instead; abort this installation process and
reinstall nokogiri as follows:

    gem install nokogiri -- --use-system-libraries
        [--with-xml2-config=/path/to/xml2-config]
        [--with-xslt-config=/path/to/xslt-config]

If you are using Bundler, tell it to use the option:

    bundle config build.nokogiri --use-system-libraries
    bundle install

Note, however, that nokogiri is not fully compatible with arbitrary
versions of libxml2 provided by OS/package vendors.
************************************************************************
Extracting libxml2-2.9.2.tar.gz into tmp/x86_64-unknown-linux-gnu/ports/libxml2/2.9.2... OK
Running patch with /opt/sensu/embedded/lib/ruby/gems/2.0.0/gems/nokogiri-1.6.6.2/ports/patches/libxml2/0001-Revert-Missing-initialization-for-the-catalog-module.patch...
Running 'patch' for libxml2 2.9.2... OK
Running patch with /opt/sensu/embedded/lib/ruby/gems/2.0.0/gems/nokogiri-1.6.6.2/ports/patches/libxml2/0002-Fix-missing-entities-after-CVE-2014-3660-fix.patch...
Running 'patch' for libxml2 2.9.2... OK
Running 'configure' for libxml2 2.9.2... OK
Running 'compile' for libxml2 2.9.2... ERROR, review '/opt/sensu/embedded/lib/ruby/gems/2.0.0/gems/nokogiri-1.6.6.2/ext/nokogiri/tmp/x86_64-unknown-linux-gnu/ports/libxml2/2.9.2/compile.log' to see what happened.
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You may
need configuration options.

Provided configuration options:
    --with-opt-dir
    --with-opt-include
    --without-opt-include=${opt-dir}/include
    --with-opt-lib
    --without-opt-lib=${opt-dir}/lib
    --with-make-prog
    --without-make-prog
    --srcdir=.
    --curdir
    --ruby=/opt/sensu/embedded/bin/ruby
    --help
    --clean
    --use-system-libraries
    --enable-static
    --disable-static
    --with-zlib-dir
    --without-zlib-dir
    --with-zlib-include
    --without-zlib-include=${zlib-dir}/include
    --with-zlib-lib
    --without-zlib-lib=${zlib-dir}/lib
    --enable-cross-build
    --disable-cross-build
/opt/sensu/embedded/lib/ruby/gems/2.0.0/gems/mini_portile-0.6.2/lib/mini_portile.rb:279:in `block in execute': Failed to complete compile task (RuntimeError)
    from /opt/sensu/embedded/lib/ruby/gems/2.0.0/gems/mini_portile-0.6.2/lib/mini_portile.rb:271:in `chdir'
    from /opt/sensu/embedded/lib/ruby/gems/2.0.0/gems/mini_portile-0.6.2/lib/mini_portile.rb:271:in `execute'
    from /opt/sensu/embedded/lib/ruby/gems/2.0.0/gems/mini_portile-0.6.2/lib/mini_portile.rb:70:in `compile'
    from /opt/sensu/embedded/lib/ruby/gems/2.0.0/gems/mini_portile-0.6.2/lib/mini_portile.rb:110:in `cook'
    from extconf.rb:278:in `block in process_recipe'
    from extconf.rb:177:in `tap'
    from extconf.rb:177:in `process_recipe'
    from extconf.rb:475:in `<main>'


Gem files will remain installed in /opt/sensu/embedded/lib/ruby/gems/2.0.0/gems/nokogiri-1.6.6.2 for inspection.
Results logged to /opt/sensu/embedded/lib/ruby/gems/2.0.0/gems/nokogiri-1.6.6.2/ext/nokogiri/gem_make.out

handler-ec2_node.rb sdk conflict

is this a known problem?

{"timestamp":"2016-07-01T07:17:13.378147+0000","level":"info","message":"handler output","handler":{"type":"pipe","filters":["keepalives","ec2"],"severities":["warning","critical"],"command":"handler-ec2_node.rb","timeout":300,"name":"ec2_node"},"output":["/opt/sensu/embedded/lib/ruby/site_ruby/2.3.0/rubygems/specification.rb:2288:in `raise_if_conflicts': Unable to activate sensu-plugins-aws-3.1.0, because aws-sdk-2.3.19 conflicts with aws-sdk (= 2.2.28) (Gem::ConflictError)\n\tfrom /opt/sensu/embedded/lib/ruby/site_ruby/2.3.0/rubygems/specification.rb:1408:in `activate'\n\tfrom /opt/sensu/embedded/lib/ruby/site_ruby/2.3.0/rubygems.rb:200:in `rescue in try_activate'\n\tfrom /opt/sensu/embedded/lib/ruby/site_ruby/2.3.0/rubygems.rb:193:in `try_activate'\n\tfrom /opt/sensu/embedded/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:126:in `rescue in require'\n\tfrom /opt/sensu/embedded/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:40:in `require'\n\tfrom /opt/sensu/embedded/bin/handler-ec2_node-custom.rb:144:in `<main>'\nonly handling every 60 occurrences: server1-ubuntu-1404/keepalive\n"]}

sns handler usage for multiple sns topics

Hi,

I am unable to use the sns handler to send messages to different AWS sns topics. Am I doing something wrong or is the handler rb file hardcoded to accept handlers with name 'sns' only?

error CheckRDS::Common (NameError)

After I did the check-rds upgrade to use the version 2 of aws-sdk

/etc/sensu/plugins/checks/check_rds.rb:58:in <class:CheckRDS>': uninitialized constant CheckRDS::Common (NameError) from /etc/sensu/plugins/checks/check_rds.rb:57:in

'
Invalid check argument(s): invalid option: -i, ["/opt/sensu/embedded/lib/ruby/gems/2.0.0/gems/mixlib-cli-1.5.0/lib/mixlib/cli.rb:191:in parse_options'", "/opt/sensu/embedded/lib/ruby/gems/2.0.0/gems/sensu-plugin-1.2.0/lib/sensu-plugin/cli.rb:13:ininitialize'", "/opt/sensu/embedded/lib/ruby/gems/2.0.0/gems/sensu-plugin-1.2.0/lib/sensu-plugin/cli.rb:55:in new'", "/opt/sensu/embedded/lib/ruby/gems/2.0.0/gems/sensu-plugin-1.2.0/lib/sensu-plugin/cli.rb:55:inblock in class:CLI'"]

handler-ec2_node - No Authorization Error

Hello, attempting to get the handler-ec2_node plugin working to remove aws clients that are terminated or stopped.

have the following configuration

cat /etc/sensu/conf.d/ec2_node.json
{
  "filters": {
     "ghost_nodes": {
       "attributes": {
         "check": {
           "name": "keepalive",
           "status": 2
         },
         "occurences": "eval: value =2"
       }
     }
   },
  "handlers": {
    "ec2_node": {
       "type": "pipe",
       "command": "/etc/sensu/plugins/handler-ec2_node.rb",
       "severities": ["ok", "unknown", "warning", "critical"], # Note: unless i added 'ok' and 'unknown' i saw errors.
       "filter": "ghost_nodes"
    }
  }
}

cat /etc/sensu/conf.d/ec2_states.json 
{
  "ec2_node": {
    "ec2_states": [
      "terminated",
      "stopping",
      "shutting-down",
      "stopped"
    ]
   }
}

I have a sensu-client connected, with it's ec2 instance id as the client name. I power it off and wait for the keepalive warning, but only see the following error in the sensu logs:

{
  "timestamp": "2016-08-24T00:24:51.449000+0000",
  "level": "info",
  "message": "handler output",
  "handler": {
    "type": "pipe",
    "command": "/etc/sensu/plugins/handler-ec2_node.rb",
    "severities": [
      "ok",
      "unknown",
      "warning",
      "critical"
    ],
    "filter": "ghost_nodes",
    "name": "ec2_node"
  },
  "output": [
    "/opt/sensu/embedded/lib/ruby/gems/2.3.0/gems/aws-sdk-core-2.5.5/lib/seahorse/client/plugins/raise_response_errors.rb:15:in `call': You are not authorized to perform this operation. (Aws::EC2::Errors::UnauthorizedOperation)\n\tfrom /opt/sensu/embedded/lib/ruby/gems/2.3.0/gems/aws-sdk-core-2.5.5/lib/aws-sdk-core/plugins/param_converter.rb:20:in `call'\n\tfrom /opt/sensu/embedded/lib/ruby/gems/2.3.0/gems/aws-sdk-core-2.5.5/lib/aws-sdk-core/plugins/response_paging.rb:26:in `call'\n\tfrom /opt/sensu/embedded/lib/ruby/gems/2.3.0/gems/aws-sdk-core-2.5.5/lib/seahorse/client/plugins/response_target.rb:21:in `call'\n\tfrom /opt/sensu/embedded/lib/ruby/gems/2.3.0/gems/aws-sdk-core-2.5.5/lib/seahorse/client/request.rb:70:in `send_request'\n\tfrom /opt/sensu/embedded/lib/ruby/gems/2.3.0/gems/aws-sdk-core-2.5.5/lib/seahorse/client/base.rb:207:in `block (2 levels) in define_operation_methods'\n\tfrom /etc/sensu/plugins/handler-ec2_node.rb:191:in `ec2_node_should_be_deleted?'\n\tfrom /etc/sensu/plugins/handler-ec2_node.rb:164:in `handle'\n\tfrom /opt/sensu/embedded/lib/ruby/gems/2.3.0/gems/sensu-plugin-1.3.0/lib/sensu-handler.rb:57:in `block in <class:Handler>'\n"
  ]
}

As per the plugin info I've tried creating a file at /etc/sensu/conf.d/aws.json with details of an IAM user with full admin access profile:

{
  "aws": {
    "access_key": "mykey",
    "secret_key": "mykey",
    "region": "ap-southeast-2"
   }
}

Have also used the 'aws configure' option to set the credentials as well as creating /etc/profile.d/aws-key.sh with my key values as exports. Still get the auth error above.

What am I doing wrong?

check-elb-cert

Running the check elb cert script gives this error:

Check failed to run: undefined method empty?' for 0:Fixnum, ["./check-elb-certs.rb:131:inrun'", "/opt/sensu/embedded/lib/ruby/gems/2.2.0/gems/sensu-plugin-1.2.0/lib/sensu-plugin/cli.rb:56:in `block in class:CLI'"]

line 131 is
https://github.com/sensu-plugins/sensu-plugins-aws/blob/master/bin/check-elb-certs.rb#L131

if !critical_message.length.empty?

.length will always return an int, and .empty? isn't a method on an int.

Bug appears to have been introduced in recent commit where someone was attempting to clean up styling and accidentally introduced this bug: ded9399

Using a version of this script one commit back fixes the issue as temp workaround.

check-elb-health-fog.rb doesn't pass key and secret correctly

check-elb-health-fog.rb is not detecting our access key or secret. This is with:

# ruby -v
ruby 2.1.5p273 (2014-11-13) [x86_64-linux-gnu]

aws-sdk 2.2.11

See here:

# env | grep AWS
AWS_SECRET_ACCESS_KEY=XXXX
AWS_ACCESS_KEY_ID=XXXXXXX
AWS_ACCESS_KEY=XXXXXXX
AWS_SECRET_KEY=xxxxxxx
# check-elb-health-fog.rb -n MyLB
ELBHealth WARNING: An issue occured while communicating with the AWS EC2 API: Missing required arguments: aws_access_key_id, aws_secret_access_key
# check-elb-health-fog.rb -n MyLB -a XXXXXXX -k xxxxxxx
ELBHealth WARNING: An issue occured while communicating with the AWS EC2 API: Missing required arguments: aws_access_key_id, aws_secret_access_key
#

New release planned?

Just a question: Is a new release planned any time soon for this plugin? That last release was in August and new checks have been added since then (i.e. check-s3-object) which would be very useful for us.

openssl dependency is broken

https://rubygems.org/gems/openssl

I think you just need to remove the dependency, as was done here.

sensu-plugins/sensu-plugins-graphite#3

msg: ERROR: While executing gem ... (Gem::DependencyError)
Unable to resolve dependencies: sensu-plugins-aws requires openssl (= 1.0.0.beta)
failed: [...] => (item=sensu-plugins-aws) => {"cmd": "/bin/gem install --version 0.0.2 --no-user-install --no-rdoc --no-ri sensu-plugins-aws", "failed": true, "item": "sensu-plugins-aws", "rc": 1}
stderr: ERROR: While executing gem ... (Gem::DependencyError)
Unable to resolve dependencies: sensu-plugins-aws requires openssl (= 1.0.0.beta)

check-ses-limit always returning 0% used

I've currently using the ses limit check and I can see in one of my accounts in eu-west-1 i've consumed 8% of my quota of emails, but the check just says 0% all the time.

Ruby errors running check-vpc-vpn.rb

check-vpc-vpn.rb is completely broken on my system.

# ruby -v
ruby 2.1.5p273 (2014-11-13) [x86_64-linux-gnu]

aws-sdk 2.2.11

# check-vpc-vpn.rb -v vpn-xxxxxxxx
Check failed to run: uninitialized constant CheckAwsVpcVpnConnections::AWS, ["/var/lib/gems/2.1.0/gems/sensu-plugins-aws-2.1.0/bin/check-vpc-vpn.rb:84:in `rescue in fetch_connection_data'", "/var/lib/gems/2.1.0/gems/sensu-plugins-aws-2.1.0/bin/check-vpc-vpn.rb:77:in `fetch_connection_data'", "/var/lib/gems/2.1.0/gems/sensu-plugins-aws-2.1.0/bin/check-vpc-vpn.rb:93:in `run'", "/var/lib/gems/2.1.0/gems/sensu-plugin-1.2.0/lib/sensu-plugin/cli.rb:56:in `block in <class:CLI>'"]

check-cloudwatch-metric.rb always fails with undefined method `empty?'

While attempting to use sensu plugin check-cloudwatch-metric.rb it always fails with the following error:

Check failed to run: undefined method `empty?' for 10:Fixnum, ["/Users/wlindsey/work/sensu/sensu-plugins-aws.github/lib/sensu-plugins-aws/cloudwatch-common.rb:13:in `resp_has_no_data'", "/Users/wlindsey/work/sensu/sensu-plugins-aws.github/lib/sensu-plugins-aws/cloudwatch-common.rb:45:in `check'", "/Users/wlindsey/work/sensu/sensu-plugins-aws.github/bin/check-cloudwatch-metric.rb:115:in `run'", "/Users/wlindsey/.rvm/gems/ruby-2.0.0-p643/gems/sensu-plugin-1.2.0/lib/sensu-plugin/cli.rb:56:in `block in <class:CLI>'"]

Seems the you cannot ask a length method if it is empty?

Attaching pull request.

check_vpc_vpn.py tries to run as Ruby script rather than Python script

check_vpc_vpn.py -v vpn-xxxxxxx

/usr/local/bin/check_vpc_vpn.py:23:in `load': /var/lib/gems/2.1.0/gems/sensu-plugins-aws-2.1.0/bin/check_vpc_vpn.py:10: syntax error, unexpected ':' (SyntaxError)
/var/lib/gems/2.1.0/gems/sensu-plugins-aws-2.1.0/bin/check_vpc_vpn.py:13: syntax error, unexpected ':', expecting keyword_end
/var/lib/gems/2.1.0/gems/sensu-plugins-aws-2.1.0/bin/check_vpc_vpn.py:18: syntax error, unexpected ':', expecting keyword_do_cond or ';' or '\n'
/var/lib/gems/2.1.0/gems/sensu-plugins-aws-2.1.0/bin/check_vpc_vpn.py:19: syntax error, unexpected ':'
/var/lib/gems/2.1.0/gems/sensu-plugins-aws-2.1.0/bin/check_vpc_vpn.py:20: syntax error, unexpected ':', expecting keyword_then or ';' or '\n'
/var/lib/gems/2.1.0/gems/sensu-plugins-aws-2.1.0/bin/check_vpc_vpn.py:21: syntax error, unexpected ')', expecting '='
...side_ip_address, tunnel.status))
...                               ^
/var/lib/gems/2.1.0/gems/sensu-plugins-aws-2.1.0/bin/check_vpc_vpn.py:23: syntax error, unexpected ':', expecting keyword_then or ';' or '\n'
/var/lib/gems/2.1.0/gems/sensu-plugins-aws-2.1.0/bin/check_vpc_vpn.py:26: syntax error, unexpected ':', expecting ')'
/var/lib/gems/2.1.0/gems/sensu-plugins-aws-2.1.0/bin/check_vpc_vpn.py:29: syntax error, unexpected keyword_else, expecting ')'
    else:
        ^
/var/lib/gems/2.1.0/gems/sensu-plugins-aws-2.1.0/bin/check_vpc_vpn.py:33: syntax error, unexpected ':', expecting keyword_then or ';' or '\n'
/var/lib/gems/2.1.0/gems/sensu-plugins-aws-2.1.0/bin/check_vpc_vpn.py:42: syntax error, unexpected end-of-input, expecting ')'
    from /usr/local/bin/check_vpc_vpn.py:23:in `<main>'
root@shared-monitoring-1b:~# /usr/bin/python /var/lib/gems/2.1.0/gems/sensu-plugins-aws-2.1.0/bin/check_vpc_vpn.py
usage: check_vpc_vpn.py [-h] -a AWS_ACCESS_KEY_ID -s AWS_SECRET_ACCESS_KEY -r
                        REGION
check_vpc_vpn.py: error: argument -a/--aws-access-key-id is required

This was installed via gem install sensu-plugins-aws. The file it created at /usr/local/bin/check_vpc_vpn.py is:

#!/usr/bin/ruby2.1
#
# This file was generated by RubyGems.
#
# The application 'sensu-plugins-aws' is installed as part of a gem, and
# this file is here to facilitate running it.
#

require 'rubygems'

version = ">= 0"

if ARGV.first
    str = ARGV.first
    str = str.dup.force_encoding("BINARY") if str.respond_to? :force_encoding
    if str =~ /\A_(.*)_\z/ and Gem::Version.correct?($1) then
       version = $1
       ARGV.shift
   end
end

gem 'sensu-plugins-aws', version
load Gem.bin_path('sensu-plugins-aws', 'check_vpc_vpn.py', version)

Plugin Tests

This is more of a question as I continue to work on the rewrite. I understand rspec is required for some of the ci tools in the gem but I'd prefer to write my tests using the default testing lib Minitest and avoid using rspec syntax. @mattyjones if I could get some input from you on the direction you're looking to take regarding tests in each of these gems.

metrics-elb-full.rb wrong output

The output of metrics-elb-full.rb looks strange:

{:timestamp=>2016-04-21 07:59:00 UTC, :unit=>"Count", :average=>2.0}
MyELB.HealthyHostCount 2.0 1461225540
HTTPCode_Backend_2XX
{:timestamp=>2016-04-21 07:59:00 UTC, :unit=>"Count", :sum=>1150.0}
MyELB.HTTPCode_Backend_2XX 1150.0 1461225540
HTTPCode_Backend_3XX
{:timestamp=>2016-04-21 07:59:00 UTC, :unit=>"Count", :sum=>80.0}
MyELB.HTTPCode_Backend_3XX 80.0 1461225540
HTTPCode_Backend_4XX
{:timestamp=>2016-04-21 07:59:00 UTC, :unit=>"Count", :sum=>12.0}
MyELB.HTTPCode_Backend_4XX 12.0 1461225540

The output of metrics-elb.rb looks quite different:

MyELB.latency 0.0310536090119496 1461225840

check-asg-instances-created check fails due to int and string comparison

I got the following error in the check.

# check-asg-instances-created.rb -r us-east-1 -g my_asg -w 1 -c 2 Check failed to run: comparison of Integer with String failed, ["/usr/local/bundle/gems/sensu-plugins-aws-6.1.0/bin/check-asg-instances-created.rb:121:in >='", "/usr/local/bundle/gems/sensu-plugins-aws-6.1.0
/bin/check-asg-instances-created.rb:121:in run'", "/usr/local/bundle/gems/sensu-plugin-1.4.5/lib/sensu-plugin/cli.rb:58:in block in class:CLI'"]
#`

I resolved the problem by making config[:warning_limit] to config[:warning_limit].to_i in line 81 and config[:critical_limit] to config[:critical_limit].to_i in line 83

check-instance-events.rb is missing an Events Code

Line 121 includes some Events Codes that prevent the Sensu alert from firing. For example, if a system-maintenance is marked as Completed, the alert will not fire. AWS has given me back an Events Code that is not included in this check, causing the alert to continue to fire even after the instance scheduled for a reboot has been rebooted. I can confirm the code provided by AWS by running aws ec2 describe-instance-status --instance-id i-xxxxxxxx.

AWS returns:

"Events": [
{
"Code": "instance-reboot",
"Description": "[Completed] Your instance will be rebooted"

Apparently instance-reboot is another Code that AWS is using that is overlooked by this check. I will file a PR shortly to update this.

uninitialized constant CheckRDSEvents::Common (NameError)

I try to use new RDS check: check-rds-pending.rb but I experienced some issues:

# /opt/sensu/embedded/bin/check-rds-pending.rb
Sensu::Plugin::CLI: ["Not implemented! You should override Sensu::Plugin::CLI#run."]
/opt/sensu/embedded/lib/ruby/gems/2.3.0/gems/sensu-plugins-aws-3.1.0/bin/check-rds-pending.rb:37:in `<class:CheckRDSEvents>': uninitialized constant CheckRDSEvents::Common (NameError)
    from /opt/sensu/embedded/lib/ruby/gems/2.3.0/gems/sensu-plugins-aws-3.1.0/bin/check-rds-pending.rb:36:in `<top (required)>'
    from /opt/sensu/embedded/bin/check-rds-pending.rb:22:in `load'
    from /opt/sensu/embedded/bin/check-rds-pending.rb:22:in `<main>'
/opt/sensu/embedded/bin/check-rds-pending.rb -r eu-west-1
Invalid check argument(s): invalid option: -r, ["/opt/sensu/embedded/lib/ruby/gems/2.3.0/gems/mixlib-cli-1.5.0/lib/mixlib/cli.rb:191:in `parse_options'", "/opt/sensu/embedded/lib/ruby/gems/2.3.0/gems/sensu-plugin-1.2.0/lib/sensu-plugin/cli.rb:13:in `initialize'", "/opt/sensu/embedded/lib/ruby/gems/2.3.0/gems/sensu-plugin-1.2.0/lib/sensu-plugin/cli.rb:55:in `new'", "/opt/sensu/embedded/lib/ruby/gems/2.3.0/gems/sensu-plugin-1.2.0/lib/sensu-plugin/cli.rb:55:in `block in <class:CLI>'"]
/opt/sensu/embedded/lib/ruby/gems/2.3.0/gems/sensu-plugins-aws-3.1.0/bin/check-rds-pending.rb:37:in `<class:CheckRDSEvents>': uninitialized constant CheckRDSEvents::Common (NameError)
    from /opt/sensu/embedded/lib/ruby/gems/2.3.0/gems/sensu-plugins-aws-3.1.0/bin/check-rds-pending.rb:36:in `<top (required)>'
    from /opt/sensu/embedded/bin/check-rds-pending.rb:22:in `load'
    from /opt/sensu/embedded/bin/check-rds-pending.rb:22:in `<main>'

sensu: 0.23.2-2 amd64
sensu-plugins-aws: 3.1.0

Any idea ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.