GithubHelp home page GithubHelp logo

s-tajima / zabbix-cloudwatch Goto Github PK

View Code? Open in Web Editor NEW

This project forked from randywallace/zabbix-cloudwatch

0.0 2.0 0.0 263 KB

An external script for getting cloudwatch metrics into Zabbix

License: MIT License

Ruby 100.00%

zabbix-cloudwatch's Introduction

zabbix-cloudwatch

Gem Version Code Climate Dependency Status Build Status Coverage Status

An external script for getting cloudwatch metrics into Zabbix

Usage: zabbix-cloudwatch

  -h, --help              This Message
  -n, --namespace         Namespace (AWS/Autoscaling, AWS/EC2, etc...)
  -m, --metricname        Metric Name (GroupInServiceInstances,EstimatedCharges, etc...)
  -d, --dimension-name    Dimension Name (AutoScalingGroupName, etc...)
  -v, --dimension-value   Dimension Value
  -t, --monitoring-type   detailed|basic                            Default: basic
  -s, --statistic         Minimum|Maximum|Average|Sum|SampleCount   Default: Average
  --aws-access-key        AWS Access Key
  --aws-secret-key        AWS Secret Key
  --aws-region            AWS Region                                Default: us-east-1

Getting it running

  • Currently tested against ruby 1.8.7, 1.9.3, and 2.0.0
  • for some of the gem dependencies, you will need the ruby development packages, gcc, libxml2, and libxslt

Modify these steps to taste (examples given running on the Amazon AMI 2013.03):

yum install ruby ruby-devel rubygems gcc libxml2-devel libxslt-devel
gem install bundler zabbix-cloudwatch
ln -s $(which zabbix-cloudwatch) /var/lib/zabbixsrv/externalscripts/zabbix-cloudwatch

Examples

zabbix-cloudwatch -n AWS/EC2 \
                  -m CPUUtilization \
                  -d AutoScalingGroupName \
                  -v your-auto-scaling-group \
                  -t detailed \
                  -s Sum

Creating the IAM User

The following actions need to be allowed in IAM for this script to work with the keys you provide:

"cloudwatch:DescribeAlarms"
"cloudwatch:GetMetricStatistics"

AWS Credentials

There are (3) ways to get your AWS Credentials into zabbix-cloudwatch.

Note that none of these options are "safe", so make sure you are using a set of IAM Keys with extremely restricted permissions.

1. Environment Variables (which is difficult with Zabbix):

export AWS_ACCESS_KEY_ID="YOUR ACCESS KEY" 
export AWS_SECRET_ACCESS_KEY="YOUR SECRET ACCESS KEY"
export AWS_REGION="YOUR AWS REGION"

2. Within the binary in the gem.

If you intend to do it this way, I suggest you make a copy of the binary and place it in your zabbix externalscript path (instead of the suggested symlink in the installation example).

Find the binary like this:

ls $(gem env gemdir)/gems/zabbix-cloudwatch-$(zabbix-cloudwatch --version)/bin/zabbix-cloudwatch

And place it in your externalscripts path like this (your zabbix path/user/group may be different):

cp $(gem env gemdir)/gems/zabbix-cloudwatch-$(zabbix-cloudwatch --version)/bin/zabbix-cloudwatch \
      /var/lib/zabbixsrv/externalscripts/
chown zabbix:zabbix /var/lib/zabbixsrv/externalscripts/zabbix-cloudwatch

The class variables for this are at the very top of the file for your convenience.

3. Passing in your AWS Keys when you run zabbix-cloudwatch using the command line flags.

zabbix-cloudwatch -n AWS/AutoScaling \
                  -m GroupInServiceInstances \
                  -d AutoScalingGroupName \
                  -v your-auto-scaling-group \
                  --aws-access-key 'YOUR ACCESS KEY' \
                  --aws-secret-key 'YOUR SECRET KEY' \
                  --aws-region 'YOUR AWS REGION'

Order of preference

The order of preference that this gem uses for the region and keys (individually) are:

  • Commandline flag
  • Within the binary
  • Environment Variable

zabbix-cloudwatch's People

Contributors

randywallace avatar

Watchers

James Cloos avatar  avatar

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.