Skip to main content

Audit the Autoprovisioning Script: voip_chk_prov.sh

Posted by dbenders on Fri, 10/26/2007

Hi, I made a script in our server in order to check every day how is working the autoprovisioning. We found that after the fileld service made the instalations, always there is problems with some phones so this script will give us a feedback from the phones that are getting an error when are trying to get the autoprovisioning file. Also It give us the information of the good provisioned, and with that info, we can chek the version of the frimware of the phone. Very usefull to. Here is the script that I want to share:


#!/bin/sh
#
#############################################################################
# voip_chk_prov.sh
#
# Last Change : $Author: malopez $
# Date Changed : $Date: 2007/10/09 13:33:26 $
# Version : $Revision: 1.1 $
# Description : Script para auditar provisianamiento Xentrip
# Autor : Danny Bendersky
# Date Build : 08/10/2007
#
#############################################################################
# Global variables
#############################################################################

LOCALSERVER=`uname -n | awk -F'.' '{print $1}'`

HTTP_LOG="/var/log/httpd/access_log"

CURRENTDATE=$(date "+%d/%b/%Y") # Example: 08/Oct/2007

TMP_FILE="/var/log/httpd/access_log.tmp"
TMP_BAD_PROV="/var/log/httpd/bad_prov.tmp"
TMP_GOOD_PROV="/var/log/httpd/good_prov.tmp"

#----------------------------------------------------------------------------
# Main
#----------------------------------------------------------------------------

grep $CURRENTDATE $HTTP_LOG > $TMP_FILE
grep " 404 " $TMP_FILE|awk -F' ' '{print $1 " " $7 " " $12 " " $13}'| sed -e 's/\"//g'|sort|uniq > $TMP_BAD_PROV
grep -v " 404 " $TMP_FILE|awk -F' ' '{print $1 " " $7 " " $12 " " $13}'| sed -e 's/\"//g'|sort|uniq > $TMP_GOOD_PROV

#----------------------------------------------------------------------------
# Send info by E-MAIL
#----------------------------------------------------------------------------

cat $TMP_BAD_PROV | mail -s "$LOCALSERVER: BAD Provisioned " "dbenders@netline.cl"
cat $TMP_GOOD_PROV | mail -s "$LOCALSERVER: GOOD Provisioned " "dbenders@netline.cl"

#############################################################################
# End
#############################################################################