source: npl/monitoring/smokeping/syn3-asterisk_smokeping @ c5c522c

gcc484ntopperl-5.22
Last change on this file since c5c522c was c5c522c, checked in by Edwin Eefting <edwin@datux.nl>, 8 years ago

initial commit, transferred from cleaned syn3 svn tree

  • Property mode set to 100755
File size: 1.1 KB
RevLine 
[c5c522c]1#!/bin/bash
2#(C)Datux 2009
3
4#################### PEERS
5asterisk -r -x "sip show peers" > /tmp/peers || exit 1
6
7echo "+ peers"
8echo "menu = Asterisk peers"
9echo "title = Peerlist created at `date`"
10echo
11
12echo -n > /tmp/subnets
13
14IFS="
15"
16for PEER in `cat /tmp/peers |grep -v 'sip peers' | grep -v '^Name'|grep -v Unspecified|sort`; do
17    NAME=`echo $PEER| cut -f1 -d' '`
18    IP=`echo $PEER | cut -c28- | cut -f1 -d' '`
19
20    SECTION=`echo $IP| sed 's/[^A-Za-z0-9_-]/_/g'`
21    NET=`echo $IP|cut -f1-3 -d'.'`
22   
23    if ! grep -x "$NET" /tmp/subnets >/dev/null; then
24        echo "++ peer_$SECTION"
25        echo "menu = $IP"
26        echo "title = $IP ($NAME)"
27        echo "host = $IP"
28        echo
29        echo $NET >> /tmp/subnets
30    fi
31done
32
33#################### TRUNKS
34echo "+ trunks"
35echo "menu = Asterisk trunks"
36echo "title = Trunklist created at `date`"
37echo
38
39for TRUNK in `cat /etc/asterisk/sip.conf|grep ^host|cut -f2 -d'='|grep -v dynamic|sort|uniq`; do
40        SECTION=`echo $TRUNK| sed 's/[^A-Za-z0-9_-]/_/g'`
41        echo "++ trunk_$SECTION"
42        echo "menu = $TRUNK"
43        echo "title = $TRUNK"
44        echo "host = $TRUNK"
45        echo
46done
Note: See TracBrowser for help on using the repository browser.