I'm looking at ways to monitor a GlusterFS setup with Nagios.  I've been
testing this plugin:

http://exchange.nagios.org/directory/Plugins/System-Metrics/File-System/GlusterFS-checks/details

The Exit() function is defined as such:

Exit () {
        $ECHO "$1: ${2:0}"
        status=STATE_$1
        exit ${!status}
}

The script seems to otherwise work and at the end it runs:

Exit OK "${bricksfound} bricks; free space ${freegb}GB"

which results in:

$ ./check_gluster.sh -v gv-fileshare -n 2 -w 10 -c 5
./check_gluster.sh: line 54: OK: 2 bricks; free space 59GB: command not
found

My question is that I don't really understand what that "status=STATE_$1"
and "exit ${!status}" statements are doing.

I suspect "status=STATE_$1" is setting $status to "STATE_OK", or some
string corresponding to what the exit state should be [OK,UNKNOWN, etc],
but I'm not familiar with the syntax of what looks like a variable
substitution statement in the exit command.

Does the "!" mean execute the string in the $status variable as a command?

That statement seems to be production the "command not found" bit at the
end of running the script.  Can anyone offer some insight or pointers?

Thanks,
Matt Larsen

/*
PLUG: http://plug.org, #utah on irc.freenode.net
Unsubscribe: http://plug.org/mailman/options/plug
Don't fear the penguin.
*/

Reply via email to