123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118 |
- #
- # $Id$
- #
- # control tool for maintaining Kamailio
- #
- #===================================================================
- ##### ----------------------------------------------- #####
- ### UNIXSOCK specific variables and functions
- #
- ##### ----------------------------------------------- #####
- ### load CTL base
- #
- if [ -f "$MYLIBDIR/kamctl.ctlbase" ]; then
- . "$MYLIBDIR/kamctl.ctlbase"
- else
- mwarn "Cannot load CTL core functions '$MYLIBDIR/kamctl.ctlbase' ..."
- # exit -1
- fi
- #
- ##### ----------------------------------------------- #####
- ### parameters
- #
- export CHROOT_DIR # needed for kamunix
- if [ -z "$OSER_UNIXSOCK" ]; then
- OSER_UNIXSOCK=$CHROOT_DIR/tmp/kamailio.sock
- fi
- if [ -z "$OSERUNIX" ]; then
- OSERUNIX=kamunix
- fi
- #
- ##### ----------------------------------------------- #####
- ### functions
- #
- usage_unixsock() {
- echo
- mecho " -- command 'unixsock'"
- echo
- cat <<EOF
- unixsock ........................... send raw unixsock command
- EOF
- }
- USAGE_FUNCTIONS="$USAGE_FUNCTIONS usage_unixsock"
- unixsock_cmd()
- {
- mdbg "entering unixsock_cmd $*"
- if [ "$#" -lt 1 ]; then
- merr "unixsock_cmd must take at least command name as parameter"
- exit
- fi
- # construct the command now
- CMD=":$1:\n";
- shift
- while [ -n "$1" ] ; do
- CMD="${CMD}${1}\n"
- shift
- done
- CMD="${CMD}\n"
-
- printf "$CMD" | $OSERUNIX $OSER_UNIXSOCK | filter_fl
- mdbg "UNIXSOCK command was:\n$CMD"
- }
- CTLCMD=unixsock_cmd
- unixsock_kamailio_monitor() {
- attempt=0
- if [ "$2" == "" ]; then
- loops=-1;
- else
- loops=$2;
- fi
- clear
- while [ $loops -ne $attempt ] ; do
- attempt=$(($attempt + 1))
- #clear
- tput cup 0 0
- # print_stats $attempt
- mecho "[cycle #: $attempt; if constant make sure server lives]"
- unixsock_cmd version
- unixsock_cmd uptime
- mecho "Transaction Statistics"
- unixsock_cmd get_statistics UAS_transactions
- unixsock_cmd get_statistics UAC_transactions
- unixsock_cmd get_statistics inuse_transactions
- mecho "Stateless Server Statistics"
- unixsock_cmd get_statistics sent_replies
- unixsock_cmd get_statistics sent_err_replies
- unixsock_cmd get_statistics received_ACKs
- mecho "UsrLoc Stats"
- unixsock_cmd get_statistics registered_users
- unixsock_cmd get_statistics location-users
- unixsock_cmd get_statistics location-contacts
- unixsock_cmd get_statistics location-expires
- if [ $loops -ne $attempt ] ; then
- sleep $WATCH_PERIOD
- fi
-
- done
- exit 0
- }
- KAMAILIO_MONITOR=unixsock_kamailio_monitor
|