-
Notifications
You must be signed in to change notification settings - Fork 0
/
ONE.pl
executable file
·4269 lines (3786 loc) · 143 KB
/
ONE.pl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#!/usr/bin/perl -w
$| = 1;
#
# This script reads the output file from /usr/local/bin/extract_one.pl and produces the following
# 1) Troubleshooting information for NetOps and TechSupport
# 2) TBD - XLS data output for Console data to load into EDW ( --xls flag )
# 3) GIS data? ( I'm already working with the data, why not? )
# Changes/ToDo
# 1) Get ATG Console data working for Troubleshooting output
# 2) Get ATG SM data working for Troubleshooting output
# 3) Get ATG Console data working for Troubleshooting output
use strict;
use diagnostics;
use Date::Calc qw(:all);
use Date::Manip;
use Class::Date;
use Text::CSV_XS;
my $csv = Text::CSV_XS->new( { binary => 1 } );
my $User=$ENV{"LOGNAME"};
# GetOpt
use vars qw( $opt_h $opt_v $opt_u $opt_f $opt_t $opt_all $opt_summary $opt_e $opt_temp $opt_fan $opt_flightstates $opt_auth $opt_stats $opt_start $opt_end $opt_pings $opt_dhcp $opt_values $opt_so $opt_devices $opt_month $opt_year $opt_SA $opt_Report $opt_Prov $opt_kml $opt_RR );
use Getopt::Mixed;
Getopt::Mixed::getOptions("h v u f=s e t all summary temp fan flightstates auth stats start=s end=s pings dhcp values so devices month=s year=s SA Report Prov kml RR");
my $MajorRun=1;
my $GGTT_Enable=1;
my $Rand=int( rand( 20 ) );
$opt_RR=1 if ( $Rand == 1 );
# Make it easier
if ( $opt_all ) {
$opt_e=1;
$opt_stats=1;
$opt_flightstates=1;
}
if ( $opt_summary ) {
$opt_e=1;
$opt_stats=1;
$opt_flightstates=0;
}
if ( $opt_h ) {
print "\n\n";
print "Usage: ONE.pl <options> -f <Log_File>\n"; print " -h = help (This screen)\n";
print "\n";
print "Required ( You need to use one of these so we know where to get the source date) : \n";
print " -f <Log_File> : Specify a highlander log to read.\n";
print " -t = Use TechSupport highlander.log ( /tmp/highlander-<user>.log )\n";
print " -u = Use local user highlander.log ( ./highlander-<user>.log )\n";
print "\n";
print "Display Options: \n";
print " --all = Show all options\n";
print " --summary = Show summary options\n";
print " This is probably the one you want\n";
print " -e = Show Display known \"error related lines\"\n";
print " --flightstates = Show changes in flight states\n";
print " --stats = Show ATG Stats/Versions\n";
print " --kml = Generate Google-Earth KML file\n";
print "\n";
print "Options: \n";
print " --values = Display hard coded values.\n";
print "\n";
print "Verbose Data Options: \n";
print " *** Due to verbosity, this is NOT included in --all ! \n";
print " --temp = Show Verbose Temperature Readings\"\n";
print " --fan = Show Verbose Fan RPM Readings\"\n";
print " --auth = Show Authentication Status information\n";
print " --pings = Show Ping Status information\n";
print " --dhcp = Show ATG DHCP activity\n";
print " --devices = Show when devices are discovered by the ATG\n";
print " --SA = Show GGTT Short Analysis report for the acid\n";
print " --Report = Show GGTT Report Analysis report for the acid\n";
print " --Prov = Show Tail Provisioning Report for the Tail\n";
print "\n";
print "Date Options: \n";
print " --start <Date> = Specify a starting date for processing.\n";
print " --end <Date> = Specify an ending date for processing.\n";
print " ** Date is in the format of 2014-02-03 19:00:10\n";
print " ** The time portion of the Date is optional.\n";
print "\n";
print "\n\n\n";
exit 0;
}
my $KML=1 if ( $opt_kml );
#
# Declare Variables
#
#
my $Verbose=$opt_v;
#
my $DateStart;
my $DateEnd;
#
# Defining values for min/max's as spesified by Engr.
# Fans
my $LockedFan=1318; my $FanType=0;
my $MaxFan=0;
my $FlightMaxFan=0;
my $MaxSafeFan=9000;
my $MinFan=900000;
my $FlightMinFan=900000;
my $MinSafeFan=5000;
my $MaxFanString;
my $FlightMaxFanString;
my $MinFanString="";
my $FlightMinFanString="";
my $PingATGReset=0;
my $FlightPingATGReset=0;
my $LastPacketLoss=0;
my $LastLatency=99999;
my $PowerATGReset=0;
my $FlightPowerATGReset=0;
# Temp
my $MaxTemp=0;
my $MaxSafeTemp=55;
my $MaxTempString="";
my $MinXPOL=15;
my $MinDRC=1800;
my $TempErrors;
my $FlightMaxTemp=0;
my $FlightMaxTempString="";
my $FlightTempErrors=0;
my $MaxFanErrors=0;
my $FlightMaxFanErrors=0;
my $MinFanErrors=0;
my $FlightMinFanErrors=0;
my $MaxFlightFanErrors=0;
my $FlightFanErrors=0;
#
# Define Valid Tail/Aircard verion matches as provided by Engr
my %Towers;
&Define_Towers;
my %ValidPairs=&Define_Pairs;
my @DRCValues=(38.4,38.4,76.8,153.6,307.2,307.2,614.4,614.4,921.6,1228.8,1228.8,1843.2,2457.6,1536,3072,0,460.8,614.4,768,921.6,1075.2,1228.8,1843.2,2150.4,2457.6,3686.4,4300.8,4915.2);
#
my $Line;
my @LogLines;
my $Tail;
my %NetOpsNote;
my $Loop;my %Auths; my %AuthAddr; my %FlightAuths; my %FlightAuthAddr;
my @Altitudes;
#
# This is used for calculating ASA/BSA, not state changes
my $Flight_State="";
# This is used for calculating state changes, not ASA/BSA
my $FlightState="";
# This is used for calculating state changes, not ASA/BSA
my $ATGLinkState="";
# This is used for calculating state changes, not ASA/BSA
my $SBBLinkState="";
#
my $OpenCommand;
my $DebugMode;
my $AircardVersion="Undefined";
my $ATGVersion=0;
my $ATGVersion_Shown="F";
my $AircardReset="False";
my $CheckAircardReset="0";
my $AircardState="";
my $OrigATGVersion;
my $OrigAircardVersion;
my $OrigACID="";
my $ACID="";
my $PlacingCall="F";
my $Coverage="";
my $Resets=0;
my $Ratio=0;
my $LatencyRatio=0;
my $FlightCount=0;
my $ASA="F";
my $ASATime="";
my $GoodSINR=6;
my $SINRRatio=75;
my $LastDrift=0;
my $LastSINR="";
my $LastSINRCount=0;
my $CountMin=20;
my $SINRGood=0;
my $SINRBad=0;
my $CoW="false";
my $CoWINIT="false";
my @Devices;
my $DateRange;
my $LastLat="undefined";
my $LastLon="undefined";
my $LastAlt="undefined";
my $LastCell="undefined";
my $LastSector="undefined";
# Ping Stats
my @Pings;
my $PingCount=0;
my $TotalPingCount=0;
my $AVGPacketLoss=0;
my $MinLatency=99999999;
my $AVGLatency=0;
my $sMaxLatency=0;
my $MaxLatency=0;
my $TotalMinLatency=999999999;
my $TotalAVGLatency=0;
my $TotalMaxLatency=0;
my @TotalDRC;
my @TotalSINR;
my $TotalDRC=0;
my $TotalSINR=0;
#
# X-Pol status tests
#
my $XPol=0;
my @XPol;
#
# We are using these for tracking errors and areas to investigate
#
my %Errors;
my %Investigation;
my %FlightErrors;
my $ACIDCHANGED;
my $AircardCHANGED;
#
# Maybe we can do something with the QoS logging?
# * Severly limited with Rev-B due to Qualcom software
#
my %QoS; $QoS{6}="-1"; $QoS{7}="-1";
my $QoS_Fails=0;
my $Last_QoS_Fail;
my $Last_QoS_Fail_Test;
my $Last_Repeat;
my $Last_Repeat_Test;
my $Repeats;
#
# Stuff for KML
#
my @AirlinkData;
my @RebootData;
my @GGTTData;
my @GGTTSMSData;
my @CallData;
#
# GGTT Parts
#
my $CallCount=0;
my $PopulateCallCount;
#
# 8K Specifics
#
my $Multiplexer_Version;
my %Aircard;
#
# This is used for the paste of the XPol.
#
# "e" is from Extract
my $eYear;
if ( $opt_year ) {
$eYear=$opt_year;
}
my $eMonth;
if ( $opt_month ) {
$eMonth=$opt_month;
}
#
# We know that ATG's drift time, lets track the changes
#
my $TotalDays=0; my $TotalHours=0; my $TotalMins=0; my $TotalSecs=0;
# DHCP Related
my %DHCPActivity;
my %NonAuthorative; my $NonAuthorative; my $DHCPOFFER=0; my $DHCPREQ=0; my $DHCPACK=0;
my %FlightNonAuthorative; my $FlightNonAuthorative=0; my $FlightDHCPOFFER=0; my $FlightDHCPREQ=0; my $FlightDHCPACK=0;
#
# Installed SWKeys
# Define known keys as inactive first
my $KeyCurrent=0;
#
# The Following defined at:
# https://inside.gogoair.com/display/BP/Software+Keys
#
my %KeysNamed = (
'100'=>'GogoBiz Voice',
'101'=>'Gogo Text & Talk',
'104'=>'ATG 5K Upgrade',
'200'=>'UCS5000 - Voice Communication System',
'201'=>'UCS5000 - In Air Vision',
'202'=>'UCS5000 - WAN Management for Bearers',
'203'=>'UCS5000 - Wan Optimization',
'204'=>'UCS5000 - Moving Map',
'205'=>'UCS5000 - Media ( NetJets Only )',
'294'=>'UCS5000 - Moving Map ( 90 Day )',
'291'=>'UCS5000 - In Air Vision ( 90 Day )',
'300'=>'Cloud Surfer',
'400'=>'ACARS',
'401'=>'FANS Over Iridium ( FOI )'
);
my %KeysInstalled;
my %KeysStart;
my %KeysEnd;
# Did a key go away? ( NetJets did )
my %KeysLastEntry;
my %KeysChanged;
if ( $opt_values ) {
print "\n";
print "The following values are hard coded for testing purpose:\n";
print "\n";
print " Maximum Safe Operating Temperature : $MaxSafeTemp\n";
print " Maximum FAN RPM : $MaxSafeFan\n";
print " Minimum FAN RPM : $MinSafeFan\n";
print " Minimum SINR considered \"good\" : $GoodSINR\n";
print " Minimum SINR Ratio : $SINRRatio\n";
print " Minimum X-Pol : $MinXPOL\n";
print " Minimum DRC : $MinDRC\n";
print "\n";
exit 0;
}
#
# Lets get our start and Finish
#
my $Start; my $End; my $Date1;
my $ParseStart="F";
# Nail down our Beginning Date
if ( $opt_start ) {
$Start=$opt_start;
$ParseStart="T";
} else {
$Start="1969-12-31";
$ParseStart="F";
}
# Nail down our End Date
my $ParseEnd="F";
if ( $opt_end ) {
$End=$opt_end;
my $ParseEnd="T";
} else {
$End="2052-12-31";
$ParseEnd="F";
}
my $Date2=ParseDate("$Start");
my $Date3=ParseDate("$End");
my %Mons = ("01"=>'Jan',"02"=>'Feb',"03"=>'Mar',"04"=>'Apr',"05"=>'May',"06"=>'Jun',"07"=>'Jul',"08"=>'Aug',"09"=>'Sep',"10"=>'Oct',"11"=>'Nov',"12"=>'Dec');
my %RMons = ("Jan"=>'01',"Feb"=>'02',"Mar"=>'03',"Apr"=>'04',"May"=>'05',"Jun"=>'06',"Jul"=>'07',"Aug"=>'08',"Sep"=>'09',"Oct"=>'10',"Nov"=>'11',"Dec"=>'12');
my @Days = qw(Sun Mon Tue Wed Thu Fri Sat Sun);
if ( $opt_t ) {
$opt_f="/tmp/highlander-".$User.".log";
}
if ( $opt_u ) {
$opt_f="highlander-".$User.".log";
}
if ( ! $opt_f ) {
$opt_f="highlander.log";
}
#
# What kind of file are we opening?
#
if ( ( $opt_f =~ /\.tar.gz$/ ) || ( $opt_f =~ /\.tgz$/ )) {
print "Opening Tar-GZ\n" if ( $opt_v );
$OpenCommand="tar xzvOf $opt_f |";
} elsif ( $opt_f =~ /\.gz/ ) {
print "Opening Compressed\n" if ( $opt_v );
$OpenCommand="/bin/gunzip -c $opt_f |";
} else {
print "Opening Un-compressed\n" if ( $opt_v );
$OpenCommand="<$opt_f";
}
#
# Get our Data
#
open(INPUT, "$OpenCommand") || die "Can't open $opt_f :$?:\n";
while(<INPUT>) {
chomp;
$Line=$_;
# Clean trash
next if ( $Line =~ /^$/ );
# Temp until we know if we need the non-date stamped lines
next unless ( ( $Line =~ /^\d\d\d\d-\d\d-\d\d \d\d:\d\d:\d\d,\d+/ ) || ( $Line =~ /::NetOps Note:/ ) );
push(@LogLines, $Line);
}
# Need these early
foreach $Line ( @LogLines ) {
next if ( $Line =~ /^$/ );
# Lets handle any extraction notes first:
&Process_NetOps_Notes("$Line") if ( $Line =~ /::NetOps Note:/ );
&Process_ACID("$Line") if ( $Line =~ /ACID: ACM MAC Address: acidValFromScript/ );
&Process_ACID2("$Line") if ( $Line =~ /ACID: Value parsed successfully:/ );
}
#print "ACID :$ACID:\n";
if ( $MajorRun ) {
#
# Merge in GGTT
#
&Get_GGTT if ( ( $GGTT_Enable ) && ( $ACID ));
@LogLines=sort(@LogLines);
foreach $Line ( @LogLines ) {
$Line =~ /(\d\d\d\d-\d\d-\d\d \d\d:\d\d:\d\d,\d+)/;
my $TestDate=$1;
# Lets throw away known 'noise'
# The ATG was just reset, we call that separately so these are trash
next if ( $Line =~ /Coverage -> false FLIGHT STATE -> null$/ );
next if ( $Line =~ /UNKNOWN_STATE$/ );
#
# Process ATG Console File Information
#
&Process_ATGVersion("$Line") if ( $Line =~ /ATG Application Version/ );
&Process_ATG_retrieveFiles("$Line") if ( $Line =~ /FTP Files in ACM are : acmFileList./ );
&Process_ATG_Corrupt_Keys("$Line") if ( $Line =~ /keys.amf is corupted/ );
&Process_Keys_Installed("$Line") if ( $Line =~ /SUCCESS, Software License Key added successfully/ );
&Process_Keys_Deleted("$Line") if ( $Line =~ /SUCCESS, Software License Key deleted successfully/ );
&Process_Keys_Uploaded("$Line") if ( $Line =~ /uploadFilesToACM: Uploading FilesList:/ );
&Process_Device_Discovered("$Line") if ( $Line =~ /AMP:.*is discovered/ );
&Process_Device_Notify("$Line") if ( $Line =~ /Notifying my device that .* is .* because/ );
&Process_AircardVersion("$Line") if ( $Line =~ /Aircard Version:/ );
&Process_CellOnWheels("$Line") if ( $Line =~ /CellOnWheels=/ );
&Process_Authentication_Mesg("$Line") if ( $Line =~ /Authentication Message response/ );
&Process_Coverage("$Line") if ( $Line =~ /ABS COVERAGE/ );
&Process_Flight_State("$Line") if ( $Line =~ /Flight State \=\=\=/ );
&Process_Flight_State_Change("$Line") if ( $Line =~ /Coverage.*FLIGHT/ );
&Process_ATG_Link("$Line") if ( $Line =~ / ATG LINK \w+$/ );
&Process_SBB_Link("$Line") if ( $Line =~ / SBB_LINK_\w+$/ );
&Process_Ping_Test("$Line") if ( $Line =~ /Reset Count: 1 Ping failure: 5/ );
&Process_Ping_Test2("$Line") if ( $Line =~ /ICMP ping to AAA server is failed/ );
&Process_Ping_Latency_16_1("$Line") if ( $Line =~ /Ping result:/ );
&Process_Ping_Latency_2_1("$Line") if ( $Line =~ /Conducting AAA Ping Test:./ );
&Process_Ping_Threshold("$Line") if ( $Line =~ /PING_FAILURE_THRESHOLD...5/ );
&Process_Signal_Strength("$Line") if ( $Line =~ /Signal Strength:/ );
# &Process_Power_Reset("$Line") if ( $Line =~ /Last reset is due/ );
&Process_Reset("$Line") if ( $Line =~ /rebootReason : / );
&Process_Link_Down("$Line") if ( $Line =~ /atgLink[Down|Up]/ );
&Process_Authentication_Status("$Line") if ( $Line =~ /Authentication Status/ );
&Process_new_subnet_mask("$Line") if ( $Line =~ /new_subnet_mask/ );
&Process_2_3_TimeError("$Line") if ( $Line =~ /rebootReason : System Time and GPS Time/ );
&Process_Temp("$Line") if ( $Line =~ /PCS Power Supply Temp/ );
&Process_Fan_RPM("$Line") if ( $Line =~ /Fan is .* with rpm/ );
# Process ATG SW Key Lines
# ForNon 2.4
&Process_Key_Feature("$Line") if ( $Line =~ /displyKeyValuesLogger\(\): keyValues.getFeature\(\)/ );
&Process_Key_Feature_Status("$Line") if ( $Line =~ /displyKeyValuesLogger\(\): keyValues.getKeyStatus/ );
&Process_Key_Feature_Start("$Line") if ( $Line =~ /displyKeyValuesLogger\(\): keyValues.getStartDate/ );
&Process_Key_Feature_End("$Line") if ( $Line =~ /displyKeyValuesLogger\(\): keyValues.getEndDate/ );
# for ATG2.4
&Process_Key_Feature("$Line") if ( $Line =~ /: keyValues.getFeature\(\)/ );
&Process_Key_Feature_Status("$Line") if ( $Line =~ /: keyValues.getKeyStatus/ );
&Process_Key_Feature_Start("$Line") if ( $Line =~ /: keyValues.getStartDate/ );
&Process_Key_Feature_End("$Line") if ( $Line =~ /: keyValues.getEndDate/ );
# Did we write out the config files correctly?
&Process_ACM_Status("$Line") if ( $Line =~ /downloadFileFromACM\(\): ConfigurationModuleConstants.ACM_CONNECTED_STATUS/ );
&Process_ACM_File_Read("$Line") if ( $Line =~ /ACM: In DownLoad: listACMFiles: No. of Files in ACM is: / );
&Process_ACM_FTP_Fail("$Line") if ( $Line =~ /ACM: ConnectACM: Establish FTP Connection for 3 time/ );
&Process_ACM_Read_Fail_2_1("$Line") if ( $Line =~ /FTP Connection Successful with Configuration Module. No. of Files in ACM is :/ );
# Get KML Data
&Process_Airlink("$Line") if ( $Line =~ / Airlink: / );
# Get GGTT Data
&Process_GGTT("$Line") if ( $Line =~ / GGTT: .* GDID / );
&Process_GGTTSMS("$Line") if ( $Line =~ / GGTTSMS: / );
# Capture Drift Changes
&Process_DriftLine("$Line") if ( $Line =~ / Drift: / );
#
# 8K Specific Matches
#
&Process_8K_Temp("$Line") if ( $Line =~ /ACPU board temperature/ );
&Process_8K_Multiplexer_Version("$Line") if ( $Line =~ /Multiplexer Software Version/ );
&Process_ACPUVersion("$Line") if ( $Line =~ /ACPU Application Version/ );
&Process_AircardIP("$Line") if ( $Line =~ /Aircard Simple IP/ );
#
# Process QoS Lines
#
&Process_QoS("$Line") if ( $Line =~ /Flow for QoS Profile:/ );
# These appear to be a false positive. Disabling until we get details from BA Eng
# &Process_QoS_Fail("$Line") if ( $Line =~ /rule prio 0 protocol 800 reclassify is buggy packet dropped/ );
# &Process_Last_Repeat("$Line") if ( $Line =~ /ATG4K last message repeated .* times/ );
#
# Process ATG Messages File Information
#
# Need Both of these?
&Process_DHCP_REQUEST("$Line") if ( $Line =~ /DHCPREQUEST from/ );
&Process_DHCP_REQUEST("$Line") if ( $Line =~ /DHCPREQUEST for/ );
&Process_DHCP_OFFER("$Line") if ( $Line =~ /DHCPOFFER on/ );
&Process_DHCP_DHCPACK("$Line") if ( $Line =~ /DHCPACK on/ );
}
}
&Calculate_Signals if ( $KML );
&Show_Flight_States if ( $opt_flightstates );
&Display_Stats if ( $opt_stats );
&Display_Errors if ( $opt_e );
&Display_Pings if ( $opt_pings );
&Display_Authentication_Status if ( $opt_auth );
&Display_DHCP if ( $opt_dhcp );
&Display_SA if ( $opt_SA );
&Display_Report if ( $opt_Report );
&Display_Provisioning if ( $opt_Prov );
&RickRoll if ( $opt_RR );
&Create_KML if ( $KML );
# Nothing to see below here, move along citizen.
exit 0;
#################
# Sub Procs Here #
##################
sub Define_Pairs {
#
# Must escape *, - and +
#
my %ValidPairs = (
"1.0.8-Rev-A"=>'Bigsky1737',
"1.0.17-Rev-A"=>'Bigsky1737',
"1.0.26-Rev-A"=>'Bigsky1737',
"1.1.14-Rev-A"=>'Bigsky1737',
"1.2.12-Rev-A"=>'Bigsky1737',
"1.2.16-Rev-A"=>'Bigsky1737',
"1.2.16.1-Rev-A"=>'Bigsky1737',
#
"2.0.1-Rev-A"=>'Bigsky1746',
"2.0.2-Rev-A"=>'Bigsky1746',
#
"2.1.1-Rev-A"=>'Bigsky1746\+blob\-071911\+kernel\-071911\+fs\-071911',
"2.1.1-Rev-B"=>'Aircard2.041',
#
"2.1.2-Rev-A"=>'Bigsky1746\+blob\-071911',
"2.1.2-Rev-B"=>'Aircard2.041\+blob\-111412',
#
"2.2.1-Rev-A"=>'Bigsky1746\+blob\-071911',
"2.2.1-Rev-B"=>'Aircard2.042\+blob\-100913',
#
"2.3.0-Rev-A"=>'Bigsky1746',
"2.3.0-Rev-B"=>'Aircard2.042'
);
return( %ValidPairs );
}
sub Display_Stats {
my $AircardType;
my $tmp;
$Tail="unknown" if ( ! $Tail );
$ACID="unknown" if ( ! $ACID );
print "\n";
$DateEnd =~ m,(\d+)/(\d+)/(\d+),;
my $DateEnd2=$1.$2.$3;
print "Final Tail Log Stats:\n";
print " Flight Charts available at http://performance.aircell.prod/reports/catalog/index.cgi?rm=details&tail=$Tail&date=$DateEnd2 \n";
print " ATG Tail : $Tail\n";
print " ATG ACID : $ACID\n";
print " This tail is in Debug mode\n" if ( $DebugMode );
print " *** Originally was $OrigACID!!! ***\n" if ( $OrigACID );
print " ATG Version : $ATGVersion\n";
print " *** Originally was $OrigATGVersion!!! ***\n" if ( $OrigATGVersion );
print " Aircard Version : $AircardVersion\n";
if ( $AircardVersion =~ /Bigsky/ ) {
$AircardType="Rev-A"
} elsif ( $AircardVersion =~ /Aircard2/ ) {
$AircardType="Rev-B"
} else {
$AircardType="Unknown"
}
print " Type: $AircardType\n" if ( $AircardType );
print " *** Originally was $OrigAircardVersion!!! ***\n" if ( $OrigAircardVersion );
if ( $ATGVersion && $AircardVersion ) {
my $TailCheck=$ATGVersion."-".$AircardType;
if ( $ValidPairs{$TailCheck} ) {
if ( "Bigsky1746+blob-071911+kernel-071911+fs-071911" !~ /Bigsky1746\+blob\-071911/ ) {
print "Explicit doesn't match.\n";
}
if ( $AircardVersion !~ /$ValidPairs{$TailCheck}/ ) {
print " ** NOT A VALID ATG/Aircard pair!!!\n";
$Investigation{"ATG-Aircard pair"}="** NOT A VALID ATG/Aircard pair!!!";
} else {
print " This IS a valid ATG/Aircard pair.\n";
}
} else {
if ( ( $AircardType ne "Unknown" ) && ( $ATGVersion ne "Unknown" ) ) {
print " ** No Pairs defined for this ATG Version Configuration.\n";
print " ** Please notify NetOps.\n";
$Investigation{"ATG-Aircard pair"}="** No Pairs defined for this ATG Version Configuration.";
}
}
} else {
print " Missing data, can't validate ATG/Aircard pairing\n";
}
print " ATG Max Temp: $MaxTemp\n";
if ( $MaxTemp < $MaxSafeTemp ) {
print " Temperature is within acceptable tolerances.\n";
} else {
print " ** Temperature is NOT within acceptable tolerances.\n";
}
print " Fan Type: ";
if ( $FanType == 1 ) {
print "*Locked.\n";
print " Minimum speed : $MinFan\n";
print " Maximum speed : $MaxFan\n";
if ( ( $MinFan == $LockedFan ) && ( $MaxFan == $LockedFan ) ) {
print " Fan RPM is within acceptable tolerances.\n";
} else {
print " ** Fan RPM is NOT within acceptable tolerances.\n";
}
} else {
print "Tach.\n";
print " Minimum speed : $MinFan\n";
print " Maximum speed : $MaxFan\n";
if ( ( $MinFan > $MinSafeFan ) && ( $MaxFan < $MaxSafeFan ) ) {
print " Fan RPM is within acceptable tolerances.\n";
} else {
print " ** Fan RPM is NOT within acceptable tolerances.\n";
}
print " Multiplexer Software Version : $Multiplexer_Version\n" if ( $Multiplexer_Version );
print " Aircard1 IP : $Aircard{1}\n" if ( $Aircard{1} );
print " Aircard2 IP : $Aircard{2}\n" if ( $Aircard{2} );
}
if ( $FlightCount != 0 ) {
$TotalAVGLatency=$TotalAVGLatency/$FlightCount;
# $TotalAVGLatency = sprintf "4%.4f", $TotalAVGLatency;
# Lets normalize our time
if ( $TotalSecs > 59 ) {
($tmp, $TotalSecs) = (int $TotalSecs / 60, $TotalSecs % 60);
$TotalMins += $tmp;
}
if ( $TotalMins > 59 ) {
($tmp, $TotalMins) = (int $TotalMins / 60, $TotalMins % 60);
$TotalHours += $tmp;
}
if ( $TotalHours > 24 ) {
($tmp, $TotalHours) = (int $TotalHours / 60, $TotalHours % 24);
$TotalDays += $tmp;
}
print " Flights processed: $FlightCount\n";
print " Time Above Service Altitude :\n";
print " Days: $TotalDays Hours: $TotalHours Mins: $TotalMins Secs: $TotalSecs\n";
print " Total DHCP Stats:\n";
if ( $DHCPREQ > 0 ) {
print " Requests Seen: $DHCPREQ\n";
} else {
print " No Requests Seen\n";
}
if ( $DHCPOFFER > 0 ) {
print " Offers Given: $DHCPOFFER\n";
} else {
print " No Offers Given\n";
}
if ( $DHCPACK > 0 ) {
print " Offers Ack'd : $DHCPACK\n";
} else {
print " No Offers Ack'd\n";
}
if ( scalar ( keys ( %Auths ) ) > 0 ) {
print " Total Unique IP Addresses Authenticated : ".scalar( keys (%AuthAddr) )."\n";
} else {
print "No IP's Authentication.\n";
}
if ( ( scalar ( keys ( %Auths ) ) < 1 ) && ( $DHCPREQ == 0 )) {
print " ** No DHCP Requests or IP's Authenticated. Could be a CTR Issue.\n";
$Investigation{"CTR"}="** No DHCP Requests or IP's Authenticated. Could be a CTR Issue if not a deadhead flight.";
}
} else {
print "No complete flights found.\n";
}
print "\n";
&Display_XPol;
print "\n";
if ( @Devices ) {
print "Devices Discovered:\n";
foreach $Loop ( 0..$#Devices ) {
print " $Devices[$Loop]\n";
}
print "\n";
}
if ( scalar ( keys ( %NetOpsNote ) ) > 0 ) {
print "NetOps Notes:\n";
foreach $Loop ( sort ( keys ( %NetOpsNote ) ) ) {
next if ( $Loop =~ /XPOL_Line/ );
print " $NetOpsNote{$Loop}\n";
}
print "\n";
}
if ( scalar ( keys ( %KeysInstalled ) ) > 0 ) {
print "Software Keys:\n";
foreach $Loop ( sort ( keys ( %KeysNamed ) ) ) {
$KeysInstalled{$Loop}="Not Installed" if ( ! $KeysInstalled{$Loop} );
print " $KeysNamed{$Loop} is $KeysInstalled{$Loop}\n";
print " $KeysChanged{$Loop}\n" if ( $KeysChanged{$Loop} );
print " Key start date : $KeysStart{$Loop}\n" if (( $KeysStart{$Loop} ) && ( $KeysInstalled{$Loop} ne "Not Installed" ) );
print " Key end date : $KeysEnd{$Loop}\n" if ( ( $KeysEnd{$Loop} ) && ( $KeysInstalled{$Loop} ne "Not Installed" ) );
}
print "\n";
} else {
print "Software Keys:\n";
print " ** No software keys installed.\n";
}
print "\n";
print "GGTT Data:\n";
if ( @CallData ) {
foreach $Loop ( sort @CallData ) {
print " $Loop\n";
}
} else {
print " No activity found in this time frame.\n";
}
}
sub Process_NetOps_Notes {
my $NoteLine=$_[0];
# Extracting Tail 11286 Starting with 2015/04/01 10:00:00 through 2015/04/10 22:00:00 to /tmp/highlander-rharris.log
if ( $NoteLine =~ /Extracting Tail \w+ Starting/ ) {
$NoteLine =~ /Extracting Tail (\w+) Starting with (.*) through (.*) to/;
$Tail=$1;
$DateStart=$2;
$DateEnd=$3;
#print "\$NoteLine :$NoteLine:\n";
#print "\$Tail :$Tail:\n";
#print "\$DateStart :$DateStart:\n";
#print "\$DateEnd :$DateEnd:\n";
$DateStart =~ s/ /_/g;
$DateEnd =~ s/ /_/g;
$DateRange=$DateStart."-".$DateEnd;
$DateRange =~ s,/,,g;
$DateRange =~ s,:,,g;
} elsif ( $NoteLine =~ /Extracting logs for tail \w+/ ) {
$NoteLine =~ /Extracting logs for tail (\w+)/;
$Tail=$1;
}
$NoteLine =~ /(.*)::NetOps Note: (.*)/;
my $Key=$1;
my $Note=$2;
$NetOpsNote{"$Key"}=$Note;
}
sub Display_XPol {
my $PATH;
my $XPStart; my $XPEnd;
my $XPYear; my $XPMon;
my $XPolScript="/usr/local/bin/xpol.pl";
print "Total Average DRC for this Time Window: ".sprintf("%.2f", $TotalDRC)."\n";
print "Total Average SINR for this Time Window: ".sprintf("%.2f", $TotalSINR)."\n";
print "\n";
my $XPolError=0;
my $DRCError=0;
my $Loop;
my $XPFiles;
my $Mon=`date +%m`; chomp( $Mon );
my $Day=`date +%d`; chomp( $Day );
$Mon=$eMonth if ( $eMonth );
my $Year=`date +%Y`; chomp( $Year );
$Year=$eYear if ( $eYear );
( $XPStart, undef )=split('_', $DateStart);
$XPStart =~ s,/,,g;
( $XPEnd, undef )=split('_', $DateEnd);
$XPEnd =~ s,/,,g;
$XPStart =~ /(\d\d\d\d)(\d\d)\d\d/;
$XPYear=$1;
$XPMon=$2;
$PATH="/opt/log/atg/".$XPYear."/".$XPMon."/".$Tail."/sm/*";
open(GETXPol, "/bin/ls -1 $PATH |");
while(<GETXPol>) {
chomp;
my $File=$_;
$File =~ /.*$Tail\.(\d\d\d\d-\d\d-\d\d)-\d\d.*SM.tar.gz/;
my $Key=$1;
$Key =~ s/-//g;
if ( ( $XPStart < $Key ) && ( $XPEnd > $Key ) ) {
$XPFiles .= " $File";
}
}
if ( $XPFiles ) {
open(GetXPol, "/bin/zcat $XPFiles | $XPolScript |") || die "Couldn't get X-Pol : $!";
while(<GetXPol>) {
chomp;
next if ( /^Tail/ );
if ( $_ ) {
$_ =~ s/ +//g;
@XPol=split(',', $_);
$XPol=1;
}
}
}
close( GetXPol );
if ( $XPol ) {
print "X-Pol from $DateStart until $DateEnd:\n";
print " Tail: $XPol[0] ATG Vers: $XPol[1] AvgDRC: $XPol[3]\n";
print " HFwd: $XPol[4] HAft: $XPol[6] VFwd: $XPol[8] VAft: $XPol[10]\n";
for $Loop ( 4,6,8,10 ) {
$XPol[$Loop] =~ /(\d+\.\d+)%/;
my $Val=$1;
$XPolError=1 if ( $Val < $MinXPOL );
}
if ( $XPolError ) {
print " ** X-Pol testing results are unacceptable!\n";
$Investigation{"02-X-Pol"}="** X-Pol could be an issue!";
} else {
print " X-Pol testing results are acceptable.\n";
}
print " HFwd: $XPol[5] HAft: $XPol[7] VFwd: $XPol[9] VAft: $XPol[11]\n";
for $Loop (5,7,9,11) {
$XPol[$Loop] =~ /(\d+\.\d+)/;
my $Val=$1;
$DRCError=1 if ( $Val < $MinDRC );
}
if ( $DRCError ) {
print " ** DRC could be an issue!\n";
$Investigation{"02-DRC"}="** DRC testing results are unacceptable!";
} else {
print " DRC testing results are acceptable.\n";
}
print "\n";
}
my $TmpMonth;
my $LastMonth;
if ( $Day < 7 ) {
$TmpMonth=ParseDate( "last month" );
$TmpMonth =~ m/\d\d\d\d(\d\d)\d\d\d\d:.*/;
$LastMonth = $1;
print "** Not enough days in $Mons{$Mon} yet. Running X-Pol against $Mons{$LastMonth}.\n";
$Mon=$LastMonth;
}
$PATH="/opt/log/atg/".$Year."/".$Mon."/".$Tail."/sm/*";
open(GetXPol, "/bin/zcat $PATH | $XPolScript |") || die "Couldn't get X-Pol : $!";
while(<GetXPol>) {
chomp;
next if ( /^Tail/ );
if ( $_ ) {
$_ =~ s/ +//g;
@XPol=split(',', $_);
$XPol=1;
}
}
close( GetXPol );
if ( $XPol ) {
print "X-Pol for $Year-$Mons{$Mon}:\n";
print " Tail: $XPol[0] ATG Vers: $XPol[1] AvgDRC: $XPol[3]\n";
print " HFwd: $XPol[4] HAft: $XPol[6] VFwd: $XPol[8] VAft: $XPol[10]\n";
for $Loop ( 4,6,8,10 ) {
$XPol[$Loop] =~ /(\d+\.\d+)%/;
my $Val=$1;
$XPolError=1 if ( $Val < $MinXPOL );
}
if ( $XPolError ) {
print " ** X-Pol testing results are unacceptable!\n";
$Investigation{"02-X-Pol"}="** X-Pol could be an issue!";
} else {
print " X-Pol testing results are acceptable.\n";
}
print " HFwd: $XPol[5] HAft: $XPol[7] VFwd: $XPol[9] VAft: $XPol[11]\n";
for $Loop (5,7,9,11) {
$XPol[$Loop] =~ /(\d+\.\d+)/;
my $Val=$1;
$DRCError=1 if ( $Val < $MinDRC );
}
if ( $DRCError ) {
print " ** DRC could be an issue!\n";
$Investigation{"02-DRC"}="** DRC testing results are unacceptable!";
} else {
print " DRC testing results are acceptable.\n";
}
print " Execute this for a NAV friendly output:\n";
print " Month=$Mon; Year=$Year; zcat /opt/log/atg/\$Year/\$Month/$Tail/sm/* | $XPolScript -t\n";
print " * Note you can change the value of Month and Year to run an older month than today\n";
} else {
print " No X-Pol available. Please run the command below by hand substituting the month you want.\n";
print " Month=$Mon; Year=$Year; zcat /opt/log/atg/\$Year/\$Month/$Tail/sm/* | $XPolScript\n";
print " * Note you can change the value of Month and Year to run an older month than today\n";
}
}
sub Process_Signal_Strength {
my $StateLine=$_[0];
return if ( $ASA ne "T" );
return if ( $Coverage ne "INSIDE ABS COVERAGE" );
return if ( $StateLine =~ /[GOOD|BAD]/ );
$StateLine =~ /(\d\d\d\d-\d\d-\d\d \d\d:\d\d:\d\d,\d+) +.*Signal Strength: +(.*)$/;
my $Date=$1;
my $SINR=$2;
if ( ( $SINR eq "-27.0" ) && ( $LastSINR eq "-27.0" ) ) {
$LastSINRCount++;
}
if ( $LastSINR ne $SINR ) {
if (( $LastSINR eq "-27.0" ) && ( $LastSINRCount > $CountMin ) ) {
push(@Altitudes,"Just ended a streak of -27 $LastSINRCount times at $1");
$Investigation{"Neg27-$Date"}="Neg-27: Experienced ended a streak of -27 $LastSINRCount times at $Date";
}
$LastSINRCount=0;
}
$LastSINR=$SINR;
push(@Altitudes, " Signal Strength: $Date -- $SINR") if ( $SINR < 6 );
$SINRGood++ if ( $SINR >= $GoodSINR );
$SINRBad++ if ( $SINR < $GoodSINR );
}
sub Display_Errors {
print "\n";
print "Errors Found:\n";
if ( $NetOpsNote{"0005-Console"} =~ /found 0 Console logs/ ) {
print " ** No console logs found for this tail. May need manual download.\n";
}
if ( ! keys ( %Errors ) ) {
print " * No errors logged.\n";
} else {
foreach $Loop ( sort ( keys( %Errors ) ) ) {
print " $Errors{$Loop}\n";
}
}
print "\n";
print "Indicators to Investigate:\n";
if ( $QoS_Fails > 10 ) {
print " Total ATG QoS Failure Complaints: $QoS_Fails ( TechSupp Ignore this for now. )\n";
}
if ( ! keys ( %Investigation ) ) {
print " * Nothing identified.\n";
} else {
if ( scalar ( keys ( %KeysInstalled ) ) < 1 ) {
print " ** No software keys installed.\n";
print " This could be a problem with the ACM, deleted keys or key file corruption.\n";
}
foreach $Loop ( sort ( keys ( %Investigation ) ) ) {
print " $Investigation{$Loop}\n";
}
}
print "\n";
}