Coder Social home page Coder Social logo

ecks's Introduction

Ecks

In the original Men in Black comics, an agent named Ecks went rogue and wanted to eliminate the MiB. This little Python library has a similar aim...

Ecks provides a simple way to get data out of a remote machine using SNMP without having to deal with a single MIB or OID.

Ecks is made up of a core class that will collect data via SNMP, and a set of plugins that contain the OID and the code needed to transform the results from nested OID's to usable data.

For far too long people have been abusing their servers by connecting to them using SSH and then scraping the output of processes like df, free, uptime and netstat to find out what their machines are up to. They do this because it's easier than using SNMP. Ecks now makes the right way the easy way...

Installation

The easiest way to install Ecks is:

pip install ecks

You can also clone the repository and run python setup.py install

Requirements

The python requirements to use the library are:

Some of the OID's used by the standard plugins shipped with Ecks are not enabled by default on some Linux distributions.

The following snmpd.conf file should get you enough access to test with:

com2sec notConfigUser  default       my-secret-community
group   notConfigGroup v2c           notConfigUser
view    systemview     included      .1
access  notConfigGroup ""            any       noauth    exact  systemview none none

If you are worried about other people being able to just read your data then I suggest you restrict the IP address(es) that can access the host as well.

Usage

>>> import ecks
>>> e = ecks.Ecks()
>>> e.get_data('127.0.0.1', 'public', 'disk')
[(2, 'Physical memory', 8589934592, 5169360896), (3, 'Swap space', 134213632, 45056), (4, '/', 290984034304, 243201781760)]
>>> e.get_data('127.0.0.1', 'public', 'cpu')
(21, 9, 68)
>>> e.get_data('127.0.0.1', 'public', 'uptime')
18879153
>>> e.get_uptime('127.0.0.1', 'public')
18879153

Note that the last two method calls are interchangable.

This shows how easy it is to get the data out of the system. What you do with it then is up to you...

I currently use this library to feed our internal time series monitoring system and send email alerts when certain thresholds are crossed.

Plugins

All the hard work is done by the plugins. Currently I have working plugins for:

  • CPU Utilization
  • Disk Utilization (think df -k)
  • Load average (think uptime)
  • Memory Utilization (think free)
  • Network Interface Counters (think ifconfig)
  • Process Tree (think ps -ef)
  • TCP Connections (think netstat -an -p tcp)
  • Uptime (you guessed it - think uptime)
  • TCP Stack Statistics
  • OS Identification

More plugins coming soon (and more info on how to create your own)...

Platforms

All base plugins have been tested to work with the default SNMP agent for:

  • Solaris
  • Ubuntu
  • RedHat Enterprise Linux
  • OSX
  • Windows Server

Note: For the windows systems, the load average has no meaning and so does not work. The way CPU and Memory are reported are different, so use wincpu and winmemory instead of cpu and memory

Copyright

Copyright (c) 2011-2015 Chris Read. See LICENSE for details.

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.