GithubHelp home page GithubHelp logo

a10_monitoring's Introduction

A10 Monitoring

This repo contains alerting and metrics-collection scripts for A10 load balancers. Use it monitor your A10 SLBs via your Nagios-compatible monitoring system, and store A10 metrics to your Graphite-compatible metrics system.

Repo Contents

bin/              Misc utilities
src/              Ruby source code
scripts/
    alerting/     Alerting scripts
    metrics/      Metrics-collection scripts

A10 REST API

The a10_monitoring scripts use the A10 ACOS Application Programming Interface (aXAPI), a REST API, to query the A10 for information. All communication with the REST API is handled via the A10RestApi class.

API Documentation: aXAPI Reference (pdf)

Alerting

Alerting scripts are compatible with Nagios / Icinga. They take a SLB hostname, as well as optional warning and critical thresholds, query the A10 REST API, and return the proper status. Eg:

$ ./check_a10_cpu.rb -s slb1.company.com
OK: A10 CPU usage ok (data: 67.7%, mgmt: 20.0%)

You can add the --verbose flag for additional output, including backtraces for debugging exceptions.

Metrics

Metrics-collection scripts query the REST API for metrics and can send them either to stdout, or to a graphite-compatible backend. The metrics will be formatted in Graphite plaintext protocol format.

For example:

# Graphite plaintext protocol
production.us-west.slb1.memory_usage 34.5 1455761070

Configuration

To use the a10_monitoring scripts, you simply need to add a set of A10 user credentials to a file. These credentials will be used to establish a session with the A10 SLB and query it for information.

The default file location is: /etc/a10_monitoring/credentials.json

Contents should look like:

{
  "user": "a10username",
  "pass": "supersecretpassword"
}

Please note:

  • Make sure that the file is only readable by privileged users!
  • I suggest you create a user with read-only access, and use that for monitoring.
  • You do not need to use the default file location, but it's easier if you do.

API Query Utility

I've included a useful utility for generic queries against the A10 REST API, located at bin/query_a10_api.rb. You can query any 'metric' exposed by the A10 API. For example:

$ ./query_a10_api.rb -s slb1.company.com -m system.device_info.get
{"device_information"=>
  {"cpu_count"=>20,
   "cpu_status"=>"ALL_OK",
   "cpu_temperature"=>{"temperature_C"=>47, "temperature_F"=>116},
   "disk_usage"=>{"used(KB)"=>39056976, "total(KB)"=>78148192},
   "disk_status"=>{"disk1"=>"stopped", "disk2"=>"stopped"},
   "fan_status"=>
    [{"id"=>1, "status"=>"OK-med/high"},
     {"id"=>2, "status"=>"OK-med/high"},
     ...
     {"id"=>12, "status"=>"OK-fixed/high"}],
   "power_supply"=>{"supply1"=>"on", "supply2"=>"on"},
   "memory_usage"=>{"used(KB)"=>19429520, "total(KB)"=>65169012}}}

Some queries require inputs. These inputs can be specified as command-line arguments of the form key=value. For example:

# Query data for network interface 2. Requires the 'port_num' input.
$ ./query_a10_api.rb -s slb1.company.com -m network.interface.get port_num=2
{"interface"=>
  {"port_num"=>2,
   "type"=>"ethernet",
   ...

For a list of useful metrics, run ./query_a10_api.rb --help, or see the aXAPI Reference

Ruby Code

You can reuse the existing Ruby code for your own programs and scripts. Code is located in src/a10_monitoring. Of particular import is the a10RestApi class, which actually queries the REST API. You would use it like so:

api = A10RestApi.new('slb1.company.com')
data = api.get('system.device_info.cpu.current_usage.get')
pp data

-- Evan Kuhn

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.