Synology: howto measure disk io

Synology: howto measure disk io

Synology: howto measure disk io 150 150 Roderick Derks

By default there is no tool to measure disk IO. Bootstrap your Synology to make this possible and download the package dstat.

This is what I did on my DS411J

 

cd /volumes1/@tmp
wget http://wizjos.endofinternet.net/synology/archief/syno-mvkw-bootstrap_1.2-7_arm-ds111.xsh
chmod +x syno-mvkw-bootstrap_1.2-7_arm-ds111.xsh
sh syno-mvkw-bootstrap_1.2-7_arm-ds111.xsh
vi /root/.profile
and comment out the following two lines:
#PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/syno/sbin:/usr/syno/bin:/usr/local/sbin:/usr/local/bin
#export PATH

ipkg update
ipkg upgrade
ipkg install dstat

The command executed on the Synnas prompt will give you six lines of output like this. You can forget about the first line. I added the -t so I could use awk to select the lines containing the character ":".
# dstat --disk -t 1 5|awk ' /:/ { printf "%s:", $1 }; /:/ { print $2 }; '|/bin/sed -e "s/|.*$//g"
5129k:4352k
0:0
0:0
0:0
0:0
0:0

You can see the first line contains RW info (5129k 4352k). The rest of the lines indicate there is no RW activity right now. I think the first line gives us the last known RW average rate. So you got to forget about the first line when you extract the info.

Further more you can see this on a line too: 5129k 32M. Now we got to convert the numbers to the same unit and add up them up. Then divide them by 5 to get an average.

Now put this in your /usr/syno/etc/snmpd.conf:

extend diskrw /bin/ash -c "dstat --disk -t 1 5|awk ' /:/ { printf \"%s:\", \$1 }; /:/ { print \$2 }; '|/bin/sed -e \"s/|.*$//g\""

Restart snmpd daemon:
/usr/syno/etc/rc.d/S08snmpd.sh restart

After a reboot of my synology the command in snmp.conf gave an error output: could not find dstat. This is PATH variable problem. I did a quick fix:
ln -s /opt/bin/dstat /bin/dstat

Go to the command prompt of your monitoring server like 360viewpoint and execute the followwing command:
# snmpwalk -v 2c -c public synnas01 'NET-SNMP-EXTEND-MIB::nsExtendOutLine."diskio"'
NET-SNMP-EXTEND-MIB::nsExtendOutLine."diskio".1 = STRING: 3620k:3067k
NET-SNMP-EXTEND-MIB::nsExtendOutLine."diskio".2 = STRING: 0:0
NET-SNMP-EXTEND-MIB::nsExtendOutLine."diskio".3 = STRING: 0:0
NET-SNMP-EXTEND-MIB::nsExtendOutLine."diskio".4 = STRING: 0:0
NET-SNMP-EXTEND-MIB::nsExtendOutLine."diskio".5 = STRING: 0:0
NET-SNMP-EXTEND-MIB::nsExtendOutLine."diskio".6 = STRING: 0:0

Remember: the first line gives you an average or something like that, the current IO information is on line 2 and further.

Now you need to write a script that will grab the info, put it in the rifght format and sends it to a monitoring engine like Nagios. You need more info about this contact me.

Roderick Derks

Liefhebber van fietsen, van het oplossen van IT puzzels, en van het delen van informatie om anderen te helpen.

All stories by:Roderick Derks

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

    Your Name (required)

    Your Email (required)

    Subject

    Your Message

      Your Name (required)

      Your Email (required)

      Subject

      Your Message