#!/usr/bin/perl # # Script to check syslogs for PortMaster 3 disconnect reasons. # # Reads logs from standard in and writes info to standard out. # # by Chris Adams # 26 Sep 1997 # http://ro.com/~cadams/files/pm3-discon.pl # # Updated 23 Apr 1999 to also handle LE-Terminate-Detail from RADIUS detail # files and to try to "summarize" some of the common reasons. # # You can modify this at will, but please send me any improvements you # make. while (<>) { if (/(?:terminated - |LE-Terminate-Detail = ")([^"]+)"?\n$/) { $reason = $1; } else { next; } # The next set of lines makes this script ignore what can be considered # "normal" disconnect reasons. Comment out or delete any you want # reported. $reason = "normal" if ($reason eq "Admin Reset"); $reason = "normal" if ($reason eq "Host Request"); $reason = "normal" if ($reason eq "Idle Timeout"); $reason = "normal" if ($reason eq "Session Timeout"); $reason = "normal" if ($reason eq "User Request - PPP Term Req"); $reason = "normal" if ($reason eq "User Request - PPP Term Ack"); $reason = "normal" if ($reason eq "User Request - Normal LAPM Disconnect"); $reason = "PPP error" if ($reason eq "User Error - PPP NCP Active to Reply"); $reason = "PPP error" if ($reason eq "User Error - PPP NCP Active to Request"); $reason = "PPP error" if ($reason eq "NAS Request - PPP Maximum Retransmissions"); $reason = "PPP error" if ($reason eq "Service Unavailable - PPP No Protocol"); $reason = "Auth failed" if ($reason eq "Service Unavailable - Auth Failed"); $reason = "Auth failed" if ($reason eq "Service Unavailable - PPP Auth Failed"); $reason = "Auth failed" if ($reason eq "Service Unavailable - PPP PAP Auth Failed"); $reason = "Auth failed" if ($reason eq "Login Timeout"); $reason =~ s/^User Request - //; $discon{$reason} = 0 if (! $discon{$reason}); $discon{$reason} ++; $total ++; } foreach $reason (sort {$discon{$b} <=> $discon{$a}} keys %discon) { printf "%50s %5.2f%% %5d/%d\n", $reason, 100 * $discon{$reason} / $total, $discon{$reason}, $total; }