PRTG giám sát cuộc gọi asterisk đẩy đến GSM thông qua bash script – PRTG monitoring calls asterik forward to GSM via bash script

on

1. Scripts monitoring calls with prefix

touch /home/scripts/monitor-call-gsm.sh

TOTAL_CALLS_GSM_PREFIX_211=0
LIST_NAME_GSM=(“Dial(SIP/TRUNK-GSMCH13/” “Dial(SIP/TRUNK-GSMCH15/” “Dial(SIP/TRUNK-GSMCH11/” “Dial(SIP/TRUNK-GSM80NEW11/” “Dial(SIP/TRUNK-GSM80NEW13/” “Dial(SIP/TRUNK-GSM80NEW15/” “Dial(SIP/TRUNK-GSM78NEW12/” “Dial(SIP/TRUNK-GSM78NEW13/” “Dial(SIP/TRUNK-GSM78NEW14/” “Dial(SIP/TRUNK-GSM78NEW15/” “Dial(SIP/TRUNK-GSM78NEW16/” “Dial(SIP/TRUNK-GSM80NEW162/” “Dial(SIP/TRUNK-GSM80NEW163/” “Dial(SIP/TRUNK-GSM80NEW164/”)
for call_gsm_prefix_211 in “${LIST_NAME_GSM[@]}”
do
value_call_gsm_prefix_211=asterisk -rx "core show channels" | grep "$call_gsm_prefix_211" | wc -l
TOTAL_CALLS_GSM_PREFIX_211=expr $TOTAL_CALLS_GSM_PREFIX_211 + $value_call_gsm_prefix_211
done
echo “0:”$TOTAL_CALLS_GSM_PREFIX_211”:OK date

2. Scripts monitoring total calls

touch /home/scripts/monitor-total-call-gsm.sh

GSM_17=asterisk -rx 'core show channels' | grep 'Dial(SIP/TRUNK-GSM17/' | wc -l
GSM_19=asterisk -rx 'core show channels' | grep 'Dial(SIP/TRUNK-GSM19/' | wc -l
GSM_21=asterisk -rx 'core show channels' | grep 'Dial(SIP/TRUNK-GSM21/' | wc -l
GSM_25=asterisk -rx 'core show channels' | grep 'Dial(SIP/TRUNK-GSM25/' | wc -l
GSM_27=asterisk -rx 'core show channels' | grep 'Dial(SIP/TRUNK-GSM27/' | wc -l
GSM_33=asterisk -rx 'core show channels' | grep 'Dial(SIP/TRUNK-GSM33/' | wc -l
GSM_156_28=asterisk -rx 'core show channels' | grep 'Dial(SIP/SIP-TRUNK-156/28' | wc -l
GSM_156_29=asterisk -rx 'core show channels' | grep 'Dial(SIP/SIP-TRUNK-156/29' | wc -l
GSM_55=asterisk -rx 'core show channels' | grep 'Dial(SIP/TRUNK-GSM55/' | wc -l
TOTAL_GSM=$(($GSM_17 + $GSM_19 + $GSM_21 + $GSM_25 +$GSM_27 + $GSM_33 + $GSM_156_27 + $GSM_156_28 + $GSM_55))
echo “0:”$TOTAL_GSM”:OK date

Leave a Reply

Your email address will not be published. Required fields are marked *