Giter Club home page Giter Club logo

graph-iostats's Introduction

Graph iostats

A simple how to for graphing iostats. The output of iostat is useful but its also nice if you can get it into a graph. The idea of this small repository is to show how this is done.

Acknoledgements to the following links where I drew inspiration:

http://www.linuxuser.co.uk/tutorials/create-a-graph-of-your-systems-performance

http://sysmagazine.com/posts/165855/

Overview

Theres nothing more special here than a bunch of shell scripts that run gnuplot and could probably be very easily improved. There's a few things that will need to be setup beforehand though and you'll also need to run a iostat command to collect data. Note this was all tested on Centos Linux, you may run into problems running these scripts on a Mac. It's definitely not going to work on MS Windows, sorry!

Also a lot of the scripts are grouped by the type of measurement, i.e. queue length is in requests but queue size is in sectors. Otehr things like read/write requests are per second. I kept all the scripts seperate for now to keep things simpler to follow if for example you only wanted to graph one of two stats.

Setup

You'll need to install the following:

  • gnuplot
  • iostat (usually installed on more common Linux distros)

MacOS users

If you're running this on a MAC you'll need to install homebrew first:

Install brew

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Install GNU Plot

brew install gnuplot

Collecting data

Run the following iostat command for a decent period of time to collect some data:

iostat -xk -t 5 | awk '// {print strftime("%Y-%m-%d %H:%M:%S"),$0}' > iostat-server1.out

You should see a resulting output something like so:

2015-10-29 17:20:18 10/29/2015 05:20:18 PM
2015-10-29 17:20:18 avg-cpu:  %user   %nice %system %iowait  %steal   %idle
2015-10-29 17:20:18            0.96    0.00    2.65    0.00    0.00   96.38
2015-10-29 17:20:18
2015-10-29 17:20:18 Device:         rrqm/s   wrqm/s     r/s     w/s    rkB/s    wkB/s avgrq-sz avgqu-sz   await  svctm  %util
2015-10-29 17:20:18 sda               0.00     1.80    0.00    2.00     0.00    12.80    12.80     0.00    0.00   0.00   0.00
2015-10-29 17:20:18 sdb               0.00     0.40    0.00    0.60     0.00     3.20    10.67     0.00    0.00   0.00   0.00
2015-10-29 17:20:18 sdc               0.00     0.00    0.00    0.00     0.00     0.00     0.00     0.00    0.00   0.00   0.00

Figuring out which disks

In the above output it might be useful to grab all the devices. Here's a useful one-liner you can use for that:

sed -n "/sda/,/sdc/p" iostat-server1.out | cut -d\  -f3 | sort -u > disks

Where "sda" and "sdc" are the first and last disks in your iostat output respectively. Change those for your own needs. You can also redirect the output to a file as shown.

Creating the graphs

This is the fun part, using the disk-report.sh script, you can then essentially loop through all the disks and then produce the output. For example

/disk-report.sh discs iostat-server1.out

Note you might see some warnings on fonts but you shouldnt see any errors

This will create a bunch of .png files which you can then view with your favourite image viewer and / or embed into presentations to impress your audiences :-)

graph-iostats's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

graph-iostats's Issues

Problem when ploting the data

Hi Mark,

Im trying to use these scripts in order to show graphically the iostat output, Nevertheless, the graphic seems not to be representing the data as expected. Let me show an example. As we can see in the output provided by iostat the sda % of usage goes arround 100% at some points but the graphic shows 35% as the maximum reached. The rest of the graphics have the same problem.

I upload the iostat output(.out) file as a txt file so you can see the data. Im using the same iostat command you mentioned on README.txt
iostat-server1.txt

image
image

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.