You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
416 B
Bash
20 lines
416 B
Bash
#!/bin/bash
|
|
|
|
plugins=/usr/local/monitoring/nagios/libexec
|
|
|
|
if [[ "$#" -lt "3" ]]; then echo "Usage: check_output_convert <command> <args_or_two_double_quotes_if_none> <pipe_to_command> [pipe_to_command_args]"; exit 3; fi
|
|
|
|
command="$1"
|
|
args="$2"
|
|
pipecmd="$3"
|
|
pipecmd_args="$4"
|
|
|
|
out=`eval ${plugins}/$command $args 2>&1`
|
|
stat=$?
|
|
|
|
out=`echo "STATUS: $stat; $out" | $pipecmd $pipecmd_args`
|
|
stat=$?
|
|
|
|
echo $out
|
|
exit $stat
|