Page 1 of 2

Disk I/O for all disk at a time

Posted: Wed Jul 01, 2015 9:50 am
by yunushaikh
Hello Experts,

Is there any plugin available to monitor Disk I/O for all the disk without supplying parameter -d in it. I want to monitor all the Disk I/O on the servers using single command. I dont want to go on every server and check the device disk name. I want to monitor it using SNMP. Please suggest..

Thanks..

Re: Disk I/O for all disk at a time

Posted: Wed Jul 01, 2015 10:56 am
by tgriep

Re: Disk I/O for all disk at a time

Posted: Wed Jul 01, 2015 11:49 am
by yunushaikh
I already configured this plugin but here we have to tell the plugin using -d option which disk we need to monitor

I want it in the way that it should not ask me which disk to monitor. It should monitor all the disk present on the server.

Thanks for your help

Re: Disk I/O for all disk at a time

Posted: Wed Jul 01, 2015 1:04 pm
by jolson
Have you taken a look at the following?
https://exchange.nagios.org/directory/P ... mp/details
This plugin monitors free space and can alert when the free space percentage descends too low. You might have to tinker with it to get it to work - as per the comment in exchange.
nikonier wrote: Hi,
after installing the plugin I got an error:
(Service check did not exit properly)

after some "googling" I modified my entry in the commands.cfg:
command_line /usr/bin/perl $USER1$/check_hd $HOSTADDRESS$ public $ARG1$ $ARG2$ $ARG3$

everything works, but I don't like the output:
OK: hd C in use 5.19659161907092 perc and 529.744556427002 GB free w-40 c-60

so I did some more modifications. edit the plugin check_hd:
around Line 72:
$freespace=$fullsize1 - $usedsize1;
$freespace=$freespace / 1024 / 1024 / 1024;
$freespace = sprintf("%.2f", $freespace);
$percfilled=$usedsize1 * 100 / $fullsize1;
$percfilled = sprintf("%.2f", $percfilled);

ADD the commands with the sprintf command.

output now:
OK: hd C in use 5.20 perc and 529.74 GB free w-40 c-60

regards,
Juergen

Re: Disk I/O for all disk at a time

Posted: Wed Jul 01, 2015 2:30 pm
by yunushaikh
Hello Sir,

i dont want to monitor free space on the HDD. I want to monitor Disk I/O on all the disk.

Re: Disk I/O for all disk at a time

Posted: Wed Jul 01, 2015 2:55 pm
by lmiltchev
I was not able to find a SNMP plugin that does that, but I found a bash script, that seems to work fine.

https://exchange.nagios.org/directory/P ... ks/details

Code: Select all

./check_all_diskstat.sh
/dev/sda: critical write sectors/s (>20000), summary: 17 io/s, read 264 sectors (1kB/s), write 39112 sectors (208kB/s) in 94 seconds | tps_/dev/sda=17io/s;;; read_/dev/sda=1437b/s;;; write_/dev/sda=213035b/s;;;
/dev/sr0: summary: 0 io/s, read 0 sectors (0kB/s), write 0 sectors (0kB/s) in 94 seconds | tps_/dev/sr0=0io/s;;; read_/dev/sr0=0b/s;;; write_/dev/sr0=0b/s;;;

Re: Disk I/O for all disk at a time

Posted: Wed Jul 01, 2015 3:59 pm
by yunushaikh
Hello Sir,

Yes this two scripts if combined are pulling up all the HDD's but I cannot view the I/O of remote server

for example If I need to check disk stat of remote machine it gives me message using -H IP address

/usr/local/nagios/libexec/check_diskstat.sh: line 154: [: -H: integer expression expected
/usr/local/nagios/libexec/check_diskstat.sh: line 165: [: -H: integer expression expected
summary: 3 io/s, read 0 sectors (0kB/s), write 9728 sectors (35kB/s) in 138 seconds | tps_/dev/sda=3io/s;;; read_/dev/sda=0b/s;;; write_/dev/sda=36092b/s;;;
/dev/sr0: /usr/local/nagios/libexec/check_diskstat.sh: line 144: [: -H: integer expression expected
/usr/local/nagios/libexec/check_diskstat.sh: line 154: [: -H: integer expression expected
/usr/local/nagios/libexec/check_diskstat.sh: line 165: [: -H: integer expression expected
summary: 0 io/s, read 0 sectors (0kB/s), write 0 sectors (0kB/s) in 1226 seconds | tps_/dev/sr0=0io/s;;; read_/dev/sr0=0b/s;;; write_/dev/sr0=0b/s;;;
/dev/sr1: /usr/local/nagios/libexec/check_diskstat.sh: line 144: [: -H: integer expression expected
/usr/local/nagios/libexec/check_diskstat.sh: line 154: [: -H: integer expression expected
/usr/local/nagios/libexec/check_diskstat.sh: line 165: [: -H: integer expression expected
summary: 0 io/s, read 0 sectors (0kB/s), write 0 sectors (0kB/s) in 1225 seconds | tps_/dev/sr1=0io/s;;; read_/dev/sr1=0b/s;;; write_/dev/sr1=0b/s;;;

Re: Disk I/O for all disk at a time

Posted: Wed Jul 01, 2015 4:10 pm
by yunushaikh
I am running the command
./check_all_diskstat.sh -H X.X.X.X

But I think the script
check_diskstat will accept -H option

Any Idea about how to pass -H option to check_diskstat combining these two scripts.

Re: Disk I/O for all disk at a time

Posted: Wed Jul 01, 2015 4:39 pm
by ssax
I've modified the check_diskio_ucd script to do what you want, try the attached version and let me know what you think.

Example command for all disks:

Code: Select all

./check_diskio_ucd.pl -H 192.168.4.124 -C public -s 2 -w 50 -c 500
For specific disks:

Code: Select all

./check_diskio_ucd.pl -H 192.168.4.124 -C public -s 2 -d sda -w 50 -c 500 
check_diskio_ucd.zip
(5.66 KiB) Downloaded 391 times

Re: Disk I/O for all disk at a time

Posted: Wed Jul 01, 2015 4:44 pm
by lmiltchev
You are correct. The plugin works only locally.

You could use NRPE to check the remote machine. Copy both scripts to the remote box, set up a command in the common.cfg (or nrpe.cfg), for example:

Code: Select all

command[check_io]=/usr/local/nagios/libexec/check_all_diskstat.sh
Restart xinetd:

Code: Select all

service xinetd restart
and test it from the nagios server:

Code: Select all

./check_nrpe -H x.x.x.x -c check_io
/dev/sda: critical write sectors/s (>20000), summary: 8 io/s, read 0 sectors (0kB/s), write 624 sectors (104kB/s) in 3 seconds | tps_/dev/sda=8io/s;;; read_/dev/sda=0b/s;;; write_/dev/sda=106496b/s;;;
/dev/sr0: summary: 0 io/s, read 0 sectors (0kB/s), write 0 sectors (0kB/s) in 3 seconds | tps_/dev/sr0=0io/s;;; read_/dev/sr0=0b/s;;; write_/dev/sr0=0b/s;;;
If you don't want to install NRPE on the remote box, you could try ssax's solution.