IO Token checking nagios plugin

I'm just all about writing stuff tonight.

This plugin can be used to monitor available IO tokens. It's pretty self-explanatory.

Edit: Fixed the bug listed in the reply

#!/bin/bash
TOKENS=`cat /proc/io_status | awk '{print $3}' | cut -d'=' -f2`

if [[ $TOKENS -lt 500000 ]]; then
        echo "CRITICAL: Only $TOKENS io_tokens available"
        exit 2
elif [[ $TOKENS -lt 1000000 ]]; then
        echo "WARNING: Only $TOKENS io_tokens available"
        exit 1
else
        echo "OK: $TOKENS io_tokens available"
        exit 0
fi

echo "UNKNOWN: Ack! You shouldn't have gotten here!"
exit 255

3 Replies

Nice idea. Have been meaning to look at nagios for ages, I heard it was easy to write custom plugins!

Looks to me like you'll never hit the critical condition though - you probably want to do the lt 50000 test before the lt 100000 test?

That's awfully clever of you, and awfully stupid of me.

@TehDan:

Nice idea. Have been meaning to look at nagios for ages, I heard it was easy to write custom plugins!

Looks to me like you'll never hit the critical condition though - you probably want to do the lt 50000 test before the lt 100000 test?

Nagios plugins are SUPER EASY. Catch me on #linode if you ever have any questions, I've written a ton of stuff, and done a lot of nagios work.

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct