caker wrote:
bji wrote:
Does anyone else have a copy of these MRTG scripts? The original posters domain is down and none of the links in this thread are working right now.
They seem to be working for me ...
-Chris
You were right, the site became accessible to me later that day. Must have been a transient network problem somewhere out there on the 'net.
Anyway, I wrote a couple of very simple munin scripts to track I/O token usage. They're very small so I'm putting them "in-line" here:
Code:
bji$ cat /etc/munin/plugins/io_tokens_rate
#!/bin/sh
if [ "$1" = "config" ]; then
echo "graph_title I/O token consumption rate"
echo "graph_vlabel tokens per second"
echo "io_tokens_rate.label rate"
echo "io_tokens_refill.label refill"
exit 0
fi
IO_STATUS=`cat /proc/io_status`
# IO_RATE is the rate at which tokens are being used
IO_RATE=`echo "$IO_STATUS" | awk '{ print $2; }' | cut -d '=' -f 2`
# TOKENS_REFILL is the refill rate - when IO_RATE is higher than this, we're
# using tokens at a rate faster than they are being refilled, and our
# io_count will start to decrease
TOKENS_REFILL=`echo "$IO_STATUS" | awk '{ print $4; }' | cut -d '=' -f 2`
echo "io_tokens_rate.value $IO_RATE"
echo "io_tokens_refill.value $TOKENS_REFILL"
Code:
bji$ cat /etc/munin/plugins/io_tokens_pct
#!/bin/sh
if [ "$1" = "config" ]; then
echo "graph_title I/O token usage (in %)"
echo "graph_vlabel %"
echo "graph_args --base 1000 --rigid --lower-limit 0 --upper-limit 101"
echo "graph_scale no"
echo "io_tokens_pct.label rate"
echo "io_tokens_pct.min 0"
echo "io_tokens_pct.max 101"
echo "io_tokens_pct.warning :80"
echo "io_tokens_pct.critical :100"
exit 0
fi
IO_STATUS=`cat /proc/io_status`
# ((TOKEN_MAX - IO_TOKENS) / TOKEN_MAX) is the "token usage percentage"
# When this gets to 100%, limiting occurs
IO_TOKENS=`echo "$IO_STATUS" | awk '{ print $3; }' | cut -d '=' -f 2`
TOKEN_MAX=`echo "$IO_STATUS" | awk '{ print $5; }' | cut -d '=' -f 2`
TOKEN_DEBT_PCT=$[((TOKEN_MAX - IO_TOKENS) * 100) / TOKEN_MAX]
echo "io_tokens_pct.value $TOKEN_DEBT_PCT"
These scripts are probably not the most efficient since they fire up two programs (awk and cut) just to extract one value from the /proc/io_status line. But I'm not the best awk/sed/etc programmer in the world and I just did something simple. If anyone would like to submit a more efficient version of these scripts, that would be most welcome.
Anyway, the first script graphs the I/O token consumption rate as the actual io_rate value directly from /proc/io_status. This value ranges from 0 to somewhere in the 1000's as far as I can tell. I'm not sure what the upper bound is but munin/rrdtools auto scaling does a good job of keeping the graph in line. The script also graphs a line indicating the token_refill rate, so that you can easily tell when your io_rate has gone above the refill rate (and thus you are losing tokens).
The second script graphs the I/O tokens currently consumed as a percentage. Basically, io_tokens and token_max are used to determine how may of your available tokens you have currently consumed. When this value gets to 100%, your Linode will start being I/O limited and will be I/O limited until this value drops below 100%. 101% is the maximum possible value here (the reason is a little complicated - but elsewhere in this thread is an explanation of why this is true).