Skip to content

Instantly share code, notes, and snippets.

@spiffin
Last active September 23, 2017 12:41
Show Gist options
  • Save spiffin/27caa618ae941512f2b1 to your computer and use it in GitHub Desktop.
Save spiffin/27caa618ae941512f2b1 to your computer and use it in GitHub Desktop.
Munin plugin for ioping (monitor VPS disk latency, seek rate and sequential speed)
#!/bin/sh
#
# Monitor VPS disk latency, seekrate and speed via ioping
#
# Requirements:
#
# ioping 0.8: https://code.google.com/p/ioping/
# ioping path = /usr/bin/ioping (symlink it if it's somewhere else)
#
# Parameters understood:
#
# config (required)
# autoconf (optional - used by munin-config)
#
#This plugin must be run as root, to do that append the following
#to your /etc/munin/plugins/plugin-conf.d/munin-node:
#
#[ioping_stats]
#user root
#
# Magic markers (optional - used by munin-config and installation scripts):
#
#%# family=auto
#%# capabilities=autoconf
if [ "$1" = "autoconf" ]; then
echo yes
exit 0
fi
output_config() {
echo "graph_category disk"
echo "graph_args --base 1000 -l 0"
echo "graph_title Ioping stats"
echo "graph_vlabel usec"
echo "iolatency.label Latency"
echo "seekrate.label Seekrate"
echo "sequentialspeed.label Sequential-speed"
}
output_values() {
printf "iolatency.value %d\n" $(iolatency)
printf "seekrate.value %d\n" $(seekrate)
printf "sequentialspeed.value %d\n" $(sequentialspeed)
}
iolatency() {
ioping -q / -c 5 -p 5 | cut -d' ' -f6
}
seekrate() {
ioping -R / -c 50 -p 50 | cut -d' ' -f6
}
sequentialspeed() {
ioping -RL / -c 50 -p 50 | cut -d' ' -f6
}
output_usage() {
printf >&2 "%s - munin plugin to graph ioping stats\n" ${0##*/}
printf >&2 "Usage: %s [config]\n" ${0##*/}
}
case $# in
0)
output_values
;;
1)
case $1 in
config)
output_config
;;
*)
output_usage
exit 1
;;
esac
;;
*)
output_usage
exit 1
;;
esac
@janus57
Copy link

janus57 commented Mar 30, 2015

ioping raw stats are in usec and not ms, so i think the "graph_vlabel ms" are wrong
Cf : https://code.google.com/p/ioping/wiki/man

@spiffin
Copy link
Author

spiffin commented Oct 5, 2015

Thanks, graph_vlabel amended to usec.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment