#!/bin/bash

plugins=/usr/local/monitoring/nagios/libexec
port=9666
timeout=60
command=get_cpu

if [[ "$#" -lt "3" ]]; then echo "Usage: check_nrpe_wrapper_output_convert <hostname> <command> <pipe_to_command> [args]"; exit 3; fi

host="$1"
command="$2"
args="$3"
pipecmd="$4"

out=`${plugins}/check_nrpe -t $timeout -H $host -p $port -c $command $args 2>&1`
stat=$?

out=`echo "$out" | $pipecmd`

echo $out
exit $stat
