Skip to content

Commit

Permalink
update some of the analyzers
Browse files Browse the repository at this point in the history
  • Loading branch information
k-anderson committed Dec 22, 2015
1 parent 415e0b2 commit f49bc58
Show file tree
Hide file tree
Showing 10 changed files with 150 additions and 36 deletions.
2 changes: 1 addition & 1 deletion klap/analyzers/klap-accounts.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ for FILE in $(listFiles $@); do
statHeader

printStat "Unique Account DBs" $(wc -l $TMP_FILE)
cat $TMP_FILE | sort | uniq -c | sort -nr | head | printTable "Most Frequent Account DBs"
cat $TMP_FILE | sort 2> /dev/null| uniq -c | sort -nr 2> /dev/null | head | printTable "Most Frequent Account DBs"
done
38 changes: 33 additions & 5 deletions klap/analyzers/klap-amqp-worker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,38 @@ for FILE in $(listFiles $@); do

statHeader

printStat "Requests" $(countMatches "published request")
printStat "New Workers" $(countMatches "starting amqp worker")
printStat "Poolboy Exceptions" $(countMatches "poolboy exception")
printStat "Flowcontrol Enforced" $(countMatches "flow control")
printStat "Pending Queue" $(countMatches "prior to queue creation")

printStat "Collections" $(countMatches "attempting to collect")
printStat "Collection Timeouts" $(countMatches "req timeout for call_collect")

printStat "Message Publishes" $(countMatches "published message")
printStat "Failed Message Publishes" $(countMatches "failed to publish message")
printStat "Bad Publisher Fun" $(countMatches "publisher fun returned")
printStat "Message Publisher Errors" $(countMatches "error when publishing")
printStat "Returned Messages" $(countMatches "returned from the broker")
printStat "Late Message ACKs" $(countMatches "confirm message was returned from the broker but it was too late")
printStat "Message ACKs" $(countMatches "ack message was returned")
printStat "Message NACKs" $(countMatches "nack message was returned")

printStat "Request Publishes" $(countMatches "published request")
printStat "Failed Request Publishes" $(countMatches "failed to send request")
printStat "Failed Requests" $(countMatches "request failed")
printStat "Invalid Respones" $(countMatches "response failed validator")
printStat "Invalid Defered Respones" $(countMatches "invalid resp as it was deferred")
printStat "Deferred Respones" $(countMatches "waiting for primary response")
printStat "Only Deferred Respones" $(countMatches "only received defered response")
printStat "Unexpected Message" $(countMatches "received unexpected message")
printStat "Timeouts" $(countMatches "request timeout")
printStat "Failed Publishes" $(countMatches "failed to publish request")

zgrep -Eo " took [0-9]+ micro to return" $TMP_FILE | grep -Eo "[0-9]+" | normalize | sort -nr | uniq -c | printTable "Lookup Histogram"
printStat "Criteria Met" $(countMatches "criteria for the client")
printStat "Negative Threashold" $(countMatches "negative response threshold reached")
printStat "Completed Requests" $(countMatches "response for msg id")
printStat "Request Timeouts" $(countMatches "request timeout")

zgrep -Eo " took [0-9]+ micro to return" $TMP_FILE | grep -Eo "[0-9]+" | normalize | sort -nr 2> /dev/null | uniq -c | printTable "Lookup Histogram"
zgrep "published request" $TMP_FILE | grep -Eo "^\w+ \w+ [0-9]+:[0-9]+" | uniq -c | printTable "Most Frequent Request Rates"
zgrep "failed" $TMP_FILE | grep -Eo "^\w+ \w+ [0-9]+:[0-9]+" | uniq -c | sort -nr 2> /dev/null | head | printTable "Most Frequent Failure Rates"
zgrep "timeout" $TMP_FILE | grep -Eo "^\w+ \w+ [0-9]+:[0-9]+" | uniq -c | sort -nr 2> /dev/null | head | printTable "Most Frequent Timeout Rates"
done
42 changes: 34 additions & 8 deletions klap/analyzers/klap-amqp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ cd `dirname $0`
. ../klap-utils.sh

for FILE in $(listFiles $@); do
createTmpFile "\|wh_amqp_| Channel "
createTmpFile "\|wh_amqp_| Channel |amqp_"

isTmpFileEmpty
if [ $? != 0 ]; then
Expand All @@ -14,14 +14,40 @@ for FILE in $(listFiles $@); do

statHeader

printStat "Published" $(countMatches " published to ")
printStat "Channels" $(countMatches " create channel ")
printStat "Queues" $(countMatches " declared queue ")
printStat "Consumers" $(countMatches " created consumer ")
printStat "Bindings" $(countMatches " bound ")
printStat "New Connections" $(countMatches "connection .+ is now available")
printStat "Lost Connections" $(countMatches "connection .+ is no longer available")
printStat "Terminated Connections" $(countMatches "connection .+ went down")
printStat "Connection Auth Failure" $(countMatches "amqp authentication failure")
printStat "Failed Connections" $(countMatches "failed to connect")
printStat "Connection Errors" $(countMatches "unhandled case on connect")
printStat "Connection Execptions" $(countMatches "exception connecting to")
printStat "Invalid Connections" $(countMatches "assuming connection is invalid")
printStat "New Channels" $(countMatches "started amqp_channel")
printStat "Closed Unused Channels" $(countMatches "unused channel .+ on .+ went down")
printStat "Closed Floating Channels" $(countMatches "floating channel .+ on .+ went down")
printStat "Closed Sticky Channels" $(countMatches "sticky channel .+ on .+ went down")
printStat "Closed Channels" $(countMatches "closed amqp channel")
printStat "New Consumers" $(countMatches " created consumer ")
printStat "New Queues" $(countMatches " declared queue ")
printStat "New Bindings" $(countMatches " bound ")

printStat "Assigned Consumers" $(countMatches "assigned existing consumer")
printStat "Assigned Channels" $(countMatches "assigned existing channel")
printStat "Assigned New Channel" $(countMatches "assigned consumer .+ new channel")
printStat "Reassignments" $(countMatches "reassigning consumer")
printStat "Waiting on Sticky" $(countMatches "waiting on sticky AMQP channel")
printStat "Waiting on Float" $(countMatches "waiting on AMQP channel")

printStat "Replayed Commands" $(countMatches "replaying previous AMQP commands")
printStat "Replayed Command Failures" $(countMatches "replayed command failed")
printStat "Command Exceptions" $(countMatches "amqp command exception")
printStat "Unexpected Command Result" $(countMatches "unexpected AMQP command result")
printStat "Dropped Methods" $(countMatches " dropping method ")
printStat "Dropped Payloads" $(countMatches "dropping payload ")
printStat "Short Lived Channels" $(countMatches "short lived channel")
printStat "Connections" $(countMatches "connection to the AMQP broker")
printStat "Published" $(countMatches " published to ")

zgrep " published to " $TMP_FILE | grep -Eo "routing key [^\)]+" | cut -c12- | sort | uniq -c | sort -nr | head | printTable "Most Frequent Routing Keys"
zgrep " published to " $TMP_FILE | grep -Eo "routing key [^\)]+" | cut -c12- | sort 2> /dev/null | uniq -c | sort -nr 2> /dev/null | head | printTable "Most Frequent Routing Keys"
zgrep " published to " $TMP_FILE | grep -Eo "^\w+ \w+ [0-9]+:[0-9]+" | uniq -c | sort -nr 2> /dev/null | head | printTable "Most Frequent Publishes"
zgrep "started amqp_channel" $TMP_FILE | grep -Eo "^\w+ \w+ [0-9]+:[0-9]+" | uniq -c | sort -nr 2> /dev/null | head | printTable "Most Frequent New Channels"
done
27 changes: 24 additions & 3 deletions klap/analyzers/klap-callflow.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,33 @@ for FILE in $(listFiles $@); do

statHeader

printStat "Park Responses" $(countMatches "sent park response")
printStat "Denied 'no_match'" $(countMatches "nomatch for a unauthorized call")
printStat "Route Requests" $(countMatches "received a request asking if callflows can route this call")
printStat "Lookup Errors" $(countMatches "unable to find callflow")
printStat "Denied 'no_match'" $(countMatches "nomatch for a unauthorized call")
printStat "No Audio Service" $(countMatches "does not have audio service")
printStat "Restrictions Enforced" $(countMatches "endpoint is restricted from")
printStat "Park Responses" $(countMatches "park response")
printStat "Route Wins" $(countMatches "received a route win")
printStat "Route Win Errors" $(countMatches "callflow during second lookup")
printStat "Route Win Timeouts" $(countMatches "didn't received a route win")
printStat "On-Net Calls" $(countMatches "inception on-net")
printStat "Call Resumes" $(countMatches "received call resume")
printStat "Executer Started" $(countMatches "beginning to process the call")
printStat "Executer Reset" $(countMatches "has been reset")
printStat "Executer Branched" $(countMatches "has been branched")
printStat "Executer Transferred" $(countMatches "has been transferred")
printStat "Executer Usurped" $(countMatches "has been usurped")
printStat "Executer Stoped" $(countMatches "execution has been stopped")
printStat "Call-ID Updated" $(countMatches "updating callid")
printStat "Spawn Failures" $(countMatches "failed to spawn")
printStat "Task Listeners" $(countMatches "started event listener for cf_task")
printStat "MWI Query Replies" $(countMatches "replying to mwi query")
printStat "MWI Updates" $(countMatches "updating MWI for")
printStat "MWI Probe Replies" $(countMatches "replying to mwi presence prob")

zgrep "moving to action" $TMP_FILE | egrep -o "'cf_.+'$" | sort | uniq -c | sort -nr | head | printTable "Most Frequent Callflow Modules"
zgrep "received a request asking if callflows can route this call" $TMP_FILE | grep -Eo "^\w+ \w+ [0-9]+:[0-9]+" | uniq -c | sort -nr 2> /dev/null | head | printTable "Most Frequent Route Requests"
zgrep "received a route win" $TMP_FILE | grep -Eo "^\w+ \w+ [0-9]+:[0-9]+" | uniq -c | sort -nr 2> /dev/null | head | printTable "Most Frequent Route Wins"
zgrep "execution has been stopped" $TMP_FILE | grep -Eo "^\w+ \w+ [0-9]+:[0-9]+" | uniq -c | sort -nr 2> /dev/null | head | printTable "Most Frequent Execution Stop"
zgrep -Eo "callflow [A-Za-z0-9]+ in [A-Za-z0-9]+ satisfies request" $TMP_FILE | cut -d' ' -f4 | sort 2> /dev/null | uniq -c | sort -nr 2> /dev/null | head | printTable "Top Accounts"
zgrep -Eo "callflow [A-Za-z0-9]+ in [A-Za-z0-9]+ satisfies request" $TMP_FILE | cut -d' ' -f2 | sort 2> /dev/null | uniq -c | sort -nr 2> /dev/null | head | printTable "Top Callflows"
done
2 changes: 1 addition & 1 deletion klap/analyzers/klap-hotornot.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ for FILE in $(listFiles $@); do

statHeader

printStat "Rates Found" $(countMatches "using rate definition")
printStat "Rates Found" $(countMatches "using rate")
printStat "Missing Rates" $(countMatches "no (results|rates)")
printStat "Lookup Errors" $(countMatches "rate lookup error")

Expand Down
12 changes: 10 additions & 2 deletions klap/analyzers/klap-jonny5.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,16 @@ for FILE in $(listFiles $@); do

statHeader

printStat "Allowed Calls" $(countMatches "call is authorized as")
printStat "Disallowed call" $(countMatches "call is unauthorize due to")
printStat "Account Authorized Calls" $(egrep "account [A-Za-z0-9]+ authorized channel" $TMP_FILE | wc -l)
printStat "Reseller Authorized Calls" $(egrep "reseller [A-Za-z0-9]+ authorized channel" $TMP_FILE | wc -l)
printStat "Account Denied Calls" $(egrep "account [A-Za-z0-9]+ denied channel" $TMP_FILE | wc -l)
printStat "Reseller Denied Calls" $(egrep "reseller [A-Za-z0-9]+ denied channel" $TMP_FILE | wc -l)
printStat "Disabled Account Calls" $(egrep "account [A-Za-z0-9]+ is disabled" $TMP_FILE | wc -l)
printStat "Disabled Limits Calls" $(countMatches "limits are disabled")
printStat "Local Resources Processed" $(countMatches "authz_local_resources enabled")
printStat "Accounts Found by IP" $(countMatches "found account auth'd by IP")
printStat "Unknown Account IDs" $(countMatches "unable to determine account id")
printStat "Emergency Exceptions" $(countMatches "allowing emergency call")
printStat "Toll-free Exceptions" $(countMatches "allowing outbound tollfree call")
printStat "Channel Disparities" $(countMatches "channel disparity with ecallmgr")
done
2 changes: 1 addition & 1 deletion klap/analyzers/klap-phone-numbers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ for FILE in $(listFiles $@); do
printStat "Toll-Free Numbers" $(countMatches "\+1(800|888|877|866|855)[0-9]{7}")
printStat "Toll Numbers" $(countMatches "\+1900[0-9]{7}")
printStat "Caribbean" $(countMatches "\+1(684|264|268|242|246|441|284|345|767|809|829|849|473|671|876|664|670|787|939|869|758|784|721|868|649|340)[0-9]{7}")
cat $TMP_FILE | sort | uniq -c | sort -nr | head | printTable "Most Frequent Numbers"
cat $TMP_FILE | sort | uniq -c | sort -nr 2> /dev/null | head | printTable "Most Frequent Numbers"
done
18 changes: 11 additions & 7 deletions klap/analyzers/klap-registrar.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,17 @@ for FILE in $(listFiles $@); do

statHeader

printStat "Found Credentials" $(countMatches "SIP authentication reply")
printStat "Missing Credentials" $(countMatches "SIP authentication error")
printStat "Disabled Credentials" $(countMatches "rejecting")
printStat "Authentication Reply" $(countMatches "SIP authentication reply")
printStat "Authentication Error" $(countMatches "SIP authentication error")
printStat "Disabled Credentials" $(countMatches "rejecting authn for disabled")
printStat "Lookup By IP" $(countMatches "looking up IP")
printStat "Ignored IP Realm" $(countMatches "realm is an IP address")
printStat "Credential Lookup Errors" $(countMatches "failed to look up SIP")
printStat "Found Auth-by-IP" $(countMatches "replaying route_req")
printStat "Missing Auth-by-IP" $(countMatches "no entry in sip_auth")
printStat "Auth-by-IP Lookup Errors" $(countMatches "failed to lookup by ip")
printStat "Route Request Replays" $(countMatches "route req was missing account information")
printStat "Failed Route Request" $(countMatches "not replaying route req")

zgrep "auth failure for" ${TMP_FILE} | rev | cut -d " " -f 2 | rev | sort | uniq -c | sort -rn | head | printTable "Highest failures"
zgrep "auth failure for" ${TMP_FILE} | rev | cut -d " " -f 2 | rev | sort 2> /dev/null | uniq -c | sort -rn 2> /dev/null | head | printTable "Top User Failures"
zgrep "trying to authenticate" ${TMP_FILE} | rev | cut -d " " -f 1 | rev | sort 2> /dev/null | uniq -c | sort -rn 2> /dev/null | head | printTable "Top Requested Users"
zgrep "trying to authenticate" ${TMP_FILE} | rev | cut -d " " -f 1 | cut -d "@" -f 1 | rev | sort 2> /dev/null | uniq -c | sort -rn 2> /dev/null | head | printTable "Top Realms"
zgrep "trying to authenticate" $TMP_FILE | grep -Eo "^\w+ \w+ [0-9]+:[0-9]+" | uniq -c | sort -nr 2> /dev/null | head | printTable "Most Frequent Authentication Requests"
done
35 changes: 31 additions & 4 deletions klap/analyzers/klap-stepswitch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,38 @@ for FILE in $(listFiles $@); do

statHeader

printStat "Outbound Bridges" $(countMatches "sent bridge command to")
printStat "Outbound Originates" $(countMatches "sent originate command")
printStat "Outbound Loopbacks" $(countMatches "sent local extension command")
printStat "Outbound Failures" $(countMatches "no available resources for")
printStat "Route Request Replays" $(countMatches "sending SIP authentication reply")
printStat "Local Resource Requests" $(countMatches "attempting to find local resources")
printStat "Global Resource Requests" $(countMatches "attempting to find global resources")
printStat "No Matching Resource" $(countMatches "failed to find matching resource")
printStat "Local Fetch Failures" $(countMatches "unable to fetch local resources")
printStat "Global Fetch Failures" $(countMatches "unable to fetch global resources")
printStat "Bad Rules" $(countMatches "bad rule")
printStat "Outbound Audio Requests" $(countMatches "received outbound audio resource request")
printStat "Outbound SMS Requests" $(countMatches "received outbound sms ")
printStat "Shortdial Corrections" $(countMatches "corrected shortdial")
printStat "No Outbound Resources" $(countMatches "no endpoints found")
printStat "Outbound Bridge Attempts" $(countMatches "sent bridge command to")
printStat "Outbound Bridge Success" $(countMatches "outbound request successfully completed")
printStat "Outbound Bridge Failed" $(countMatches "resources for outbound request failed")
printStat "Outbound Bridge Errors" $(countMatches "error during outbound request")
printStat "Outbound Bridge Timeout" $(countMatches "attempt to connect to resources timed out")
printStat "Outbound Emergency " $(countMatches "endpoints contain an emergency resource")
printStat "Outbound Emergency Block" $(countMatches "terminating attempted emergency bridge")
printStat "Local Attempts" $(countMatches "sent local extension command")
printStat "Local Bridge Success" $(countMatches "local extension request successfully completed")
printStat "Local Bridge Errors" $(countMatches "error during outbound request")
printStat "Local Bridge Timeout" $(countMatches "attempt to connect to resources timed out")
printStat "Originate Attempts" $(countMatches "sent originate command")
printStat "Originate Success" $(countMatches "originate request successfully completed")
printStat "Originate Failed" $(countMatches "originate request failed")
printStat "Originate Errors" $(countMatches "error during originate request")
printStat "Originate Timeout" $(countMatches "attempt to connect to resources timed out")
printStat "Inbound Relays" $(countMatches "relaying route request")
printStat "Inbound Failues" $(countMatches "unable to determine account")
printStat "Inbound Blacklist" $(countMatches "is blacklisted")

zgrep "relaying route request" $TMP_FILE | grep -Eo "^\w+ \w+ [0-9]+:[0-9]+" | uniq -c | sort -nr 2> /dev/null | head | printTable "Most Frequent Inbound Requests"
zgrep "attempting to find" $TMP_FILE | grep -Eo "^\w+ \w+ [0-9]+:[0-9]+" | uniq -c | sort -nr 2> /dev/null | head | printTable "Most Frequent Outbound Requests"
done

8 changes: 4 additions & 4 deletions klap/analyzers/klap-system.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ for FILE in $(listFiles $@); do
statHeader

printStat "Unique PIDs" `cat $TMP_FILE | sort | uniq | wc -l`
zgrep -Eo "<[0-9]+\.[0-9]+\.[0-9]+>" $TMP_FILE | sort | uniq -c | sort -nr | head | printTable "Most Frequent PIDs"
zgrep -Eo "\|\w+:[0-9]+ " $TMP_FILE | cut -c2- | sort | uniq -c | sort -nr | head | printTable "Most Frequent Lines of Code"
zgrep -Eo "^\w+ \w+ [0-9]+:[0-9]+" "${FILE}" | sort | uniq -c | sort -nr | head | printTable "Most Active Times"
zgrep -Eo "2600hz\[[0-9]+\]" "${FILE}" | sort | uniq | printTable "OS Processes"
zgrep -Eo "<[0-9]+\.[0-9]+\.[0-9]+>" $TMP_FILE | sort 2> /dev/null | uniq -c | sort -nr 2> /dev/null | head | printTable "Most Frequent PIDs"
zgrep -Eo "\|\w+:[0-9]+ " $TMP_FILE | cut -c2- | sort 2> /dev/null | uniq -c | sort -nr 2> /dev/null | head | printTable "Most Frequent Lines of Code"
zgrep -Eo "^\w+ \w+ [0-9]+:[0-9]+" "${FILE}" | sort 2> /dev/null | uniq -c | sort -nr 2> /dev/null | head | printTable "Most Active Times"
zgrep -Eo "2600hz\[[0-9]+\]" "${FILE}" | sort 2> /dev/null | uniq | printTable "OS Processes"
done

0 comments on commit f49bc58

Please sign in to comment.