Giter Site home page Giter Site logo

cacti-iostat's Introduction

iostat on Cacti via SNMP

iostat to SNMP

Like I described in similar Cacti sources, I run a cron job to pick up data and dump it in files where snmpd can pick it up as a low privilege user. I'm doing the same here, except that I'm using it to run iostat in the background to collect data over the polling period.

Take the data collection script iostat_cron.py, make this executable and stick it somewhere convenient. I will assume /etc/snmp/ for this article with the output files in /var/local/snmp/. Then add a CRON job (every 5 minutes or to match your Cacti polling time) to run a script to launch this:

# background the iostat run
/etc/snmp/iostat_cron.py /var/local/snmp/iostat.json &

That will launch iostat in a wrapper which will run for 5 minutes (300 seconds) outputting to a temporary file and rename the temporary file to the name given as the first argument. You can easily alter the script if you poll more/less frequently. Also you can modify the iostat arguments to output per-partition statistics if you require.

Check that the output file is being created and has data in it - it will take 5 minutes from the next cron run before the file is created.

Make the extension script iostat_stats.py executable and put it somewhere suitable like /etc/snmp/ which is what we will assume for this article. Next, to get the data into snmpd add the lines from snmpd.conf.cacti-iostat to the /etc/snmp/snmpd.conf file.

That simply picks up the column specified from data file when SNMP is queried. Restart snmpd and you should be able to test that with snmpwalk.

SNMP to Cacti

I have the query xml iostat.xml in /usr/local/share/cacti/resource/snmp_queries/ however if you put it elsewhere then you will need to modify the data query path in the template to match.

Import the Cacti template cacti_host_template_iostat.xml into Cacti and add it to the host you have configured above. Add the graphs and all going well after a couple polls data should start appearing on the graphs.

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.