Can someone tell me why I am not getting back anything else but: Unknown argument: 90,90%
Below are my configuration files and script.
switch.cfg
define service{
use generic-service
hostgroup_name Mikrotik_RG411
service_description tx-ccq
check_command mk_tx_ccq!90,90%!80,80%
}
command.cfg
define command{
command_name mk_tx_ccq
command_line $USER1$/mk_tx_ccq -H $HOSTADDRESS$ -U $ARG3$ -w $ARG1$ -c $ARG2$
}
Script:
###########################################
readccq=`cat /tmp/$host-ccq-status.txt|grep tx-ccq| grep -v overall-tx-ccq`
txccq=${readccq//[^0-9]/}
if [ $txccq -ge $warn ]
then
echo "tx-ccq OK = $txccq"
EXITCODE=0
elif [ $txccq -ge $critical ]
then
echo "tx-ccq WARNING less than 90% = $txccq"
EXITCODE=1
else
echo "tx-ccq CRITICAL less than 80% = $txccq"
EXITCODE=2
fi
exit ${EXITCODE}
Goal:
I would like to return the needed values to update nagiosgraph and nagios core.
Thank you,
Mike
Confused about device response
Re: Confused about device response
Your command is expanding to:
It looks to me like something should come after '-U' and before '-w', but you never provided a value for $ARG3$ in your service definition. Also, the script you posted is not very comprehensible. It seems like you just posted the end of it, but without context it doesn't really make sense.
Code: Select all
mk_tx_ccq -H <some_ip_addr> -U -w 90,90% -c 80,80%Re: Confused about device response
You are correct. Please allow me to fix that.
Here is the entire script.
#!/bin/bash
###########################################
## Do basic check on arguments passed to the script.
while test -n "$1"; do
case "$1" in
-H)
host="$2"
shift
;;
-U)
account="$2"
shift
;;
-w)
warn="$2"
shift
;;
-c)
critical="$2"
shift
;;
*)
echo "Unknown argument: $1"
exit $STATE_UNKNOWN
;;
esac
shift
done
###########################################
readccq=`cat /tmp/$host-ccq-status.txt|grep tx-ccq| grep -v overall-tx-ccq`
txccq=${readccq//[^0-9]/}
if [ $txccq -ge $warn ]
then
echo "tx-ccq OK = $txccq"
EXITCODE=0
elif [ $txccq -ge $critical ]
then
echo "tx-ccq WARNING less than 90% = $txccq"
EXITCODE=1
else
echo "tx-ccq CRITICAL less than 80% = $txccq"
EXITCODE=2
fi
exit ${EXITCODE}
Here is the entire script.
#!/bin/bash
###########################################
## Do basic check on arguments passed to the script.
while test -n "$1"; do
case "$1" in
-H)
host="$2"
shift
;;
-U)
account="$2"
shift
;;
-w)
warn="$2"
shift
;;
-c)
critical="$2"
shift
;;
*)
echo "Unknown argument: $1"
exit $STATE_UNKNOWN
;;
esac
shift
done
###########################################
readccq=`cat /tmp/$host-ccq-status.txt|grep tx-ccq| grep -v overall-tx-ccq`
txccq=${readccq//[^0-9]/}
if [ $txccq -ge $warn ]
then
echo "tx-ccq OK = $txccq"
EXITCODE=0
elif [ $txccq -ge $critical ]
then
echo "tx-ccq WARNING less than 90% = $txccq"
EXITCODE=1
else
echo "tx-ccq CRITICAL less than 80% = $txccq"
EXITCODE=2
fi
exit ${EXITCODE}
Re: Confused about device response
Okay, so $account is getting set to "-w" since you didn't provide an argument to the -U option. It doesn't seem like you use that variable at all in your script, so you should change your command definition to:
Code: Select all
define command{
command_name mk_tx_ccq
command_line $USER1$/mk_tx_ccq -H $HOSTADDRESS$ -w $ARG1$ -c $ARG2$
}Re: Confused about device response
You nailed the issue with the script. Thank you.
Any idea why nagiosgraph does not pickup on the new data?
Thanks!
Any idea why nagiosgraph does not pickup on the new data?
Thanks!