[asterisk-users] Asterisk not return int value

Farooq Hussain farooqhussain786 at gmail.com
Sat Feb 16 07:04:11 CST 2013


Hello Everyone,

I have write a script following script for nagios


-- typeset -i CRITICAL;

#Positional parameter
CRITICAL=`echo $2`;
ME=`basename $0`;
#echo $CRITICAL

if [[ "$2" == "" ]]
then
echo NO INPUT!!! Usage ./$ME -c N
else
typeset -i ASCALLS;
ASCALLS=`asterisk -rx "core show channels" | grep active | grep call | awk
'{print $1}'`
#echo $ASCALLS;
#mload=`echo "$ASCALLS" | $BC`;
#echo $((num+1))

        if [[ "$ASCALLS" -lt "$CRITICAL" ]]
        then
        echo OK!!! Total Active Calls:$ASCALLS;
        exit 0
        else
        echo CRITICAL!!! Total Active Calls:$ASCALLS;
        exit 2
        fi
fi
Thanks


But following in not return int value

`asterisk -rx "core show channels" | grep active | grep call | awk '{print
$1}'`

Please let me know if anyone help me in regard

Farooq Hussain
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-users/attachments/20130216/91571c96/attachment.htm>


More information about the asterisk-users mailing list