Code Monkey home page Code Monkey logo

sensu-plugins-memory-checks's Introduction

Sensu Bonsai Asset Build Status Gem Version Code Climate Test Coverage Dependency Status

Sensu Memory Check Plugin

Overview

This plugin provides native memory instrumentation for monitoring and metrics collection, including memory usage via free and vmstat, including metrics. NOTE: This plugin may have cross-platform issues.

Files

  • bin/check-memory.rb
  • bin/check-memory.sh
  • bin/check-memory-percent.rb
  • bin/check-memory-percent.sh
  • bin/check-ram.rb
  • bin/check-swap-percent.rb
  • bin/check-swap.sh
  • bin/check-swap.rb
  • bin/metrics-memory-percent.rb
  • bin/metrics-memory.rb

check-memory Evaluate free system memory for Linux-based systems.

check-memory-percent Evaluate the percentage of free system memory for Linux-based systems.

check-ram Check the percentage of free RAM.

check-swap-percent Checks swap usage as a percentage of the total swap.

check-swap Evaluate swap memory usage for Linux-based systems.

metrics-memory-percent Read memory statistics as a percentage and put them in a form usable by Graphite. Metrics borrowed from HoardD.

metrics-memory-vmstat Read memory statistics and put them in a form usable by vmstat.

metrics-memory Read memory statistics and put them in a form usable by Graphite. Metrics borrowed from HoardD.

Usage examples

Help

check-ram.rb

Usage: /opt/sensu/embedded/bin/check-ram.rb (options)
    -c CRIT
    -f, --free                       checks free threshold, defaults to true
    -m, --megabytes                  Unless --megabytes is specified the thresholds are in percentage of memory used as opposed to MB of ram left
    -u, --used                       checks used threshold, defaults to false
    -w WARN

metrics-memory-percent.rb

Usage: /opt/sensu/embedded/bin/metrics-memory-percent.rb (options)
    -s, --scheme SCHEME              Metric naming scheme, text to prepend to metric

Configuration

Sensu Go

Asset registration

Assets are the best way to make use of this plugin. If you're not using an asset, please consider doing so! If you're using sensuctl 5.13 or later, you can use the following command to add the asset:

sensuctl asset add sensu-plugins/sensu-plugins-memory-checks

If you're using an earlier version of sensuctl, you can download the asset definition from this project's Bonsai Asset Index page.

Asset definition

---
type: Asset
api_version: core/v2
metadata:
  name: sensu-plugins-memory-checks
spec:
  url: https://assets.bonsai.sensu.io/c5391d4ae186484226732344b35cf95c0b07b8ec/sensu-plugins-memory-checks_4.0.0_centos_linux_amd64.tar.gz
  sha512: ea297a85aa3612da7f78d948f9784443fffac511040c5130a2dcde7191a0004044c2ef881e665520cbc64431955ab19920d84de6b5fed85c63da7091c4b93bf0

Check definition

---
type: CheckConfig
spec:
  command: "check-memory.rb"
  handlers: []
  high_flap_threshold: 0
  interval: 10
  low_flap_threshold: 0
  publish: true
  runtime_assets:
  - sensu-plugins/sensu-plugins-memory-checks
  - sensu/sensu-ruby-runtime
  subscriptions:
  - linux

Sensu Core

Check definition

{
  "checks": {
    "metrics-disk-usage": {
      "command": "metric-disk-usage.rb",
      "subscribers": ["linux"],
      "interval": 10,
      "refresh": 10,
      "handlers": ["influxdb"]
    }
  }
}

Installation from source

Sensu Go

See the instructions above for asset registration

Sensu Core

Install and setup plugins on Sensu Core

Additional notes

bin/check-ram.rb

Ruby does not have a good native way to grab information on memory usage (without using C extensions or running shell commands and parsing out). For this reason, check-ram.rb uses a gem called vmstat that has a dependency on a GCC to compile the C extensions.

To avoid errors that occur when trying to compile the C extensions without GCC present, we do not install the vmstat gem by default.

Users who need to use check-ram.rb must install build tools, including GCC. This usually requires two steps but can vary based on your distribution and Ruby setup:

  1. Install gcc. If you are on a Debian system, GCC is located in the build-essential package. On RHEL systems, yum groupinstall "Development tools" will provide the required packages.
  2. Install the vmstat gem into the path from which Sensu gems are expected to run, sudo /opt/sensu/embedded/bin/gem install vmstat --no-rdoc --no-ri, or the equivalent for installing Sensu gems in your configuration management system.

Certification verification

If you are verifying certificates in the gem install you will need the certificate for the sys-filesystem gem loaded in the gem certificate store.

Contributing

See CONTRIBUTING.md for information about contributing to this plugin.

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.