Skip to content

Instantly share code, notes, and snippets.

@mark05e
Last active December 15, 2024 14:40
Show Gist options
  • Save mark05e/12b2d355f5ab1bcced6b39f4d33b36bc to your computer and use it in GitHub Desktop.
Save mark05e/12b2d355f5ab1bcced6b39f4d33b36bc to your computer and use it in GitHub Desktop.
Scripts for performing monitoring & alerting on Avaya SBCE v8.0. Intended to be run as cronjob.
# Script for monitoring some SBCE stats.
# Note: Requires root
now=$(date +"%Y-%m-%d %T")
me=`basename "$0"`
echo -e "Starting $me at $now \n\n"
# ref: https://support.avaya.com/public/index?page=content&id=PRCS100962&actp=LIST
# This command will show all the dynamic media flows opened on PCF.
cmd1=$(showflow 310 dynamic | wc -l)
# ref: https://documentation.avaya.com/bundle/GUID-347B653D-6CCE-4A5B-B902-D7FD89E8ADCF/page/Private_enterprise_OIDS_support.html
# ipcs stats sip calls
# .iso.org.dod.internet.private.enterprises.Avaya.ipcsstatisticsinfo.ipcsstatssip.ipcsstatssipcalls
cmd2=$(snmpwalk -v3 -u initial -l authNoPriv -a SHA -A avaya123 localhost .1.3.6.1.4.1.6889.2.77.1.3.1.10 | cut -d ' ' -f 4)
# logic
if [ -z "$cmd2" ]
then
echo -e "ipcs stats sip calls is NULL \n\n"
cmd2='NULL'
else
echo -e "ipcs stats sip calls is NOT NULL \n\n"
fi
echo -e "Output:"
echo -e "timestamp,media-flows,sip-calls"
echo -e "$now,$cmd1,$cmd2"
# TODO:
# Write output section to csv for historical analysis
# Implenent notification trigger if $cmd2 > 800
# Script for SMS notification using SMS Webservice API
now=$(date +"%Y-%m-%d %T")
me=`basename "$0"`
echo -e "Starting $me at $now \n\n"
echo " "
echo "██████╗ █████╗ ██████╗ ██╗███╗ ██╗ ██████╗ ██████╗ █████╗ ████████╗███╗ ███╗ █████╗ ███╗ ██╗ "
echo "██╔══██╗██╔══██╗██╔════╝ ██║████╗ ██║██╔════╝ ██╔══██╗██╔══██╗╚══██╔══╝████╗ ████║██╔══██╗████╗ ██║ "
echo "██████╔╝███████║██║ ███╗██║██╔██╗ ██║██║ ███╗ ██████╔╝███████║ ██║ ██╔████╔██║███████║██╔██╗ ██║ "
echo "██╔═══╝ ██╔══██║██║ ██║██║██║╚██╗██║██║ ██║ ██╔══██╗██╔══██║ ██║ ██║╚██╔╝██║██╔══██║██║╚██╗██║ "
echo "██║ ██║ ██║╚██████╔╝██║██║ ╚████║╚██████╔╝ ██████╔╝██║ ██║ ██║ ██║ ╚═╝ ██║██║ ██║██║ ╚████║ "
echo "╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚═╝╚═╝ ╚═══╝ ╚═════╝ ╚═════╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═══╝ "
echo " "
echo " "
curl -s --header "Content-Type: text/xml;charset=UTF-8" --header 'SOAPAction:"SendSms"' --data @smsrequest.xml http://COMPANYX-API-GATEWAY/SOAP/SmsService -o temp11111.txt
cat temp11111.txt | xmllint --format -
rm temp11111.txt
# TODO:
# Accept input parameters for including in the SMS message
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:typ="http://COMPANYX-API-GATEWAY/ZESB/Services/SmsService/Types">
<soapenv:Header>
<wsse:Security soapenv:mustUnderstand="1" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
<wsse:UsernameToken wsu:Id="UsernameToken-4" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
<wsse:Username>username</wsse:Username>
<wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">password</wsse:Password>
</wsse:UsernameToken>
</wsse:Security>
</soapenv:Header>
<soapenv:Body>
<typ:SendSms>
<typ:User>
<typ:CustomerID>123</typ:CustomerID>
<typ:Name>username2</typ:Name>
<typ:Password>password2</typ:Password>
</typ:User>
<typ:From>GothamCity</typ:From>
<typ:To>99887766</typ:To>
<typ:Language>En</typ:Language>
<typ:Text>Hello Batman your support is required. SBCE1 is in trouble!</typ:Text>
</typ:SendSms>
</soapenv:Body>
</soapenv:Envelope>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment