Git Product home page Git Product logo

cwput's Introduction

cwput

Very simple script to send custom metrics to AWS CloudWatch

Requirements

  • aws-cli
  • upstart
  • AWS API permissions
    • cloudwatch:PutMetricData

Install

./install.bash

Configure

Add or remove checks

See ./etc/cwput/checks. Use these example checks or remove them and replace them with your own. These example checks are installed during the above installation step.

Settings

CWPUT_GROUP

Set the CWPUT_GROUP environment variable to define a second dimension for grouping together metrics. For example, by setting CWPUT_GROUP to the autoscaling group ID of instances metrics can be tracked both by individual instance IDs and by the AS group as a whole.

If unset the second dimension will fallback to the instance ID.

CWPUT_NAMESPACE

Set the CWPUT_NAMESPACE environment variable to submit metrics to CloudWatch using a namespace different from the cwput default of System/Linux

CWPUT_PERIOD

The number of minutes between metric reporting. Expected values are 0, 1 & 5. Setting CWPUT_PERIOD to other values will result in undefined behavior. Setting a value of 0 will disable reporting. Default is 1.

cwput's People

Contributors

ianshward avatar miccolis avatar rclark avatar yhahn avatar

Stargazers

 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  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  avatar  avatar

cwput's Issues

Error on string type

Seeing this for the disk metrics:

Invalid type for parameter MetricData[0].Value, value: 20, type: <type 'unicode'>, valid types: <type 'float'>, <class 'decimal.Decimal'>, <type 'int'>, <type 'long'>

Removing the quotes around the value in checks/disk works -- will write tests to see if I can reproduce and then PR.

dockerDiskUtilization broken for docker 17.06.2-ce

It looks like the format changed for the latest docker release from having spaces between the value and the unit to no longer having spaces:

Old format:

 Data Space Used: 14.84 GB
 Data Space Total: 309.2 GB
 Data Space Available: 294.4 GB

New Format:

 Data Space Used: 55.52GB
 Data Space Total: 3.073TB
 Data Space Available: 3.017TB

We'll need to change the docker info parsing script to handle this before we can upgrade docker.

cc/ @rclark @arunasank @brendanmcfarland

Docker is wrecking disk metrics

On EC2s that run docker and use the devicemapper storage type, there's been a change that breaks the disk check in cwput.

On docker version 1.12.6:

$ df -x tmpfs -x devtmpfs
Filesystem                 1K-blocks     Used Available Use% Mounted on
/dev/xvda1                   8123812  1984972   6038592  25% /
/dev/mapper/docker-persist 495279944 70200096 424811812  15% /mnt/persist

On docker version 17.03.1-ce:

$ df -x tmpfs -x devtmpfs -T
Filesystem                 Type  1K-blocks    Used  Available Use% Mounted on
/dev/xvda1                 ext4    8123812 1762756    6260808  22% /
/dev/mapper/docker-persist ext4 1230497624  105800 1229750320   1% /mnt/persist
/dev/dm-4                  ext4  230032572   69692  218254876   1% /mnt/persist/docker/devicemapper/mnt/0e1709e79c7fbb0869c4b251bebc1a0894a394c316f7861884f09968615b7ba7
/dev/dm-5                  ext4  230032572  171772  218152796   1% /mnt/persist/docker/devicemapper/mnt/b15f0017892182e0cfd112ce1d783e35de8ee92d1d5727703ff31e30bf078a9d
/dev/dm-6                  ext4  230032572  542612  217781956   1% /mnt/persist/docker/devicemapper/mnt/2ccf85dff56206156852d2e03bebc6fc833f910c91ec055807162c9d278ce09a
/dev/dm-9                  ext4  230032572 1876692  216447876   1% /mnt/persist/docker/devicemapper/mnt/5e58062b2eac74475aa00b91c8b061ca20da01b111cef9f97d5d3bf80ede3996
/dev/dm-7                  ext4  230032572 1879400  216445168   1% /mnt/persist/docker/devicemapper/mnt/ff97570bec4ead1db5a03acd36d7485fe65c1308d2f2c801f1c9a0e59534b09d
/dev/dm-8                  ext4  230032572 1879088  216445480   1% /mnt/persist/docker/devicemapper/mnt/106051b44b39f1054f6d11b5bcb4326a280cc496f9a0cf20a58f637d5c57639b

On the new version, each physical disk partition that contributes to docker's logical volume now appears in the df call that the disk check makes. As a result, the disk check attempts to put a metric for each of those physical partitions.

Then, when it comes time to actually put metrics, there are more than 20 data points included in the request, which is not allowed.

We need to find a way to exclude these additional partitions from the disk check, in a way that's agnostic as to whether or not you're running docker at all.

cc @vsmart

CI user deleted & repo archived

We've deleted the CI user for this project as part of archiving the repo. If we want to revive active development on this repo we'll need to recreate the CI user in a different account.

does not send metrics automatically every 60 seconds

Hi,

I appreciate your work, and just wanted to inform you of maybe a bug.. but I am not sure.
I am using an Amazon EC2 instance running Ubuntu 14.04 LTS and if i manually run the command

cwput.bash

it is posting metrics to Amazon, however, it does not automatically do this every 60 seconds as written in your code "the forever loop".

Memory usage doesn't account for shared memory

If you have processes which use larged shared memory segments (like OSRM) we don't properly report the amount of memory used/available.

Additionally this project should probably switch to looking at /proc/meminfo directly and parsing what it needs from there.

Newer versions of the linux kernel will have MemAvailable but the still widely used Ubuntu 14.04 doesn't, we should handle this for folks.

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.