File: report_system_info.sh

package info (click to toggle)
percona-toolkit 3.2.1-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, forky, sid, trixie
  • size: 68,916 kB
  • sloc: perl: 241,287; sql: 22,868; sh: 19,746; javascript: 6,799; makefile: 353; awk: 38; python: 30; sed: 1
file content (1688 lines) | stat: -rw-r--r-- 70,678 bytes parent folder | download | duplicates (2)
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
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
#!/usr/bin/env bash

plan 54

. "$LIB_DIR/alt_cmds.sh"
. "$LIB_DIR/log_warn_die.sh"
. "$LIB_DIR/parse_options.sh"
. "$LIB_DIR/summary_common.sh"
. "$LIB_DIR/report_formatting.sh"
. "$LIB_DIR/report_system_info.sh"

PT_TMPDIR="$TEST_PT_TMPDIR"
PATH="$PATH:$PERCONA_TOOLKIT_SANDBOX/bin"
TOOL="pt-summary"

samples="$PERCONA_TOOLKIT_BRANCH/t/pt-summary/samples"
NAME_VAL_LEN=12

# parse_proc_cpuinfo

cat <<EOF > "$PT_TMPDIR/expected"
  Processors | physical = 1, cores = 2, virtual = 2, hyperthreading = no
      Speeds | 2x1300.000
      Models | 2xGenuine Intel(R) CPU U7300 @ 1.30GHz
      Caches | 2x3072 KB
EOF

parse_proc_cpuinfo "$samples/proc_cpuinfo001.txt" > "$PT_TMPDIR/got"
no_diff "$PT_TMPDIR/got" "$PT_TMPDIR/expected" "parse_proc_cpuinfo, proc_cpuinfo001.txt"

cat <<EOF > "$PT_TMPDIR/expected"
  Processors | physical = 1, cores = 1, virtual = 2, hyperthreading = yes
      Speeds | 2x1000.000
      Models | 2xIntel(R) Atom(TM) CPU N455 @ 1.66GHz
      Caches | 2x512 KB
EOF

parse_proc_cpuinfo "$samples/proc_cpuinfo002.txt" > "$PT_TMPDIR/got"
no_diff "$PT_TMPDIR/got" "$PT_TMPDIR/expected" "parse_proc_cpuinfo, proc_cpuinfo002.txt"

# parse_ethtool
cat <<EOF > "$PT_TMPDIR/in"
Settings for eth0:
   Supported ports: [ TP MII ]
   Supported link modes:   10baseT/Half 10baseT/Full 
                           100baseT/Half 100baseT/Full 
   Supports auto-negotiation: Yes
   Advertised link modes:  10baseT/Half 10baseT/Full 
                           100baseT/Half 100baseT/Full 
   Advertised pause frame use: Symmetric Receive-only
   Advertised auto-negotiation: Yes
   Speed: 10Mb/s
   Duplex: Half
   Port: MII
   PHYAD: 0
   Transceiver: internal
   Auto-negotiation: on
   Supports Wake-on: pumbg
   Wake-on: d
   Current message level: 0x00000033 (51)
                drv probe ifdown ifup
   Link detected: no
EOF

cat <<EOF > "$PT_TMPDIR/expected"
  Device    Speed     Duplex
  ========= ========= =========
  eth0       10Mb/s     Half      
EOF

parse_ethtool "$PT_TMPDIR/in" > "$PT_TMPDIR/got"
no_diff \
   "$PT_TMPDIR/expected" \
   "$PT_TMPDIR/got" \
   "parse_ethtool works"

cat <<EOF > "$PT_TMPDIR/in"
Settings for eth0:
   Supported ports: [ TP MII ]
   Supported link modes:   10baseT/Half 10baseT/Full 
                           100baseT/Half 100baseT/Full 
   Supports auto-negotiation: Yes
   Advertised link modes:  10baseT/Half 10baseT/Full 
                           100baseT/Half 100baseT/Full 
   Advertised pause frame use: Symmetric Receive-only
   Advertised auto-negotiation: Yes
   Speed: 10Mb/s
   Duplex: Half
   Port: MII
   PHYAD: 0
   Transceiver: internal
   Auto-negotiation: on
   Supports Wake-on: pumbg
   Wake-on: d
   Current message level: 0x00000033 (51)
                drv probe ifdown ifup
   Link detected: no
Settings for eth4:
   Supported ports: [ TP MII ]
   Supported link modes:   10baseT/Half 10baseT/Full 
                           100baseT/Half 100baseT/Full 
   Supports auto-negotiation: Yes
   Advertised link modes:  10baseT/Half 10baseT/Full 
                           100baseT/Half 100baseT/Full 
   Advertised pause frame use: Symmetric Receive-only
   Advertised auto-negotiation: Yes
   Speed: 100Mb/s
   Duplex: Full
   Port: MII
   PHYAD: 0
   Transceiver: internal
   Auto-negotiation: on
   Supports Wake-on: pumbg
   Wake-on: d
   Current message level: 0x00000033 (51)
                drv probe ifdown ifup
   Link detected: no
EOF

cat <<EOF > "$PT_TMPDIR/expected"
  Device    Speed     Duplex
  ========= ========= =========
  eth0       10Mb/s     Half      
  eth4       100Mb/s    Full      
EOF

parse_ethtool "$PT_TMPDIR/in" > "$PT_TMPDIR/got"
no_diff \
   "$PT_TMPDIR/expected" \
   "$PT_TMPDIR/got" \
   "parse_ethtool works if there are multiple devices"

# parse_netstat

cat <<EOF > $PT_TMPDIR/expected
  Connections from remote IP addresses
    192.168.243.72      1
    192.168.243.81      2
  Connections to local IP addresses
    192.168.243.71      3
  Connections to top 10 local ports
    3306                3
  States of connections
    ESTABLISHED         4
    LISTEN             15
EOF
parse_netstat "$samples/netstat-001.txt" > "$PT_TMPDIR/got"
no_diff "$PT_TMPDIR/got" "$PT_TMPDIR/expected" "parse_netstat, netstat-001.txt"

cat <<EOF > "$PT_TMPDIR/expected"
  Connections from remote IP addresses
    10.14.82.196      175
    10.14.82.200       10
    10.14.82.202       45
    10.17.85.70        60
    10.17.85.72         1
    10.17.85.74         2
    10.17.85.86       225
    10.17.85.88        80
    10.17.85.90        40
    10.17.85.92         1
    10.17.85.100       25
    10.17.85.104       20
    10.36.34.66       300
    10.36.34.68       300
  Connections to local IP addresses
    10.17.85.70       175
    10.17.146.20     1250
  Connections to top 10 local ports
    3306             1250
    44811               1
    44816               1
    44817               1
    44820               1
    44822               1
    44824               1
    44825               1
    54446               1
  States of connections
    ESTABLISHED       150
    LISTEN             15
    TIME_WAIT        1250
EOF
parse_netstat "$samples/netstat-002.txt" > "$PT_TMPDIR/got"
no_diff "$PT_TMPDIR/got" "$PT_TMPDIR/expected" "parse_netstat, netstat-002.txt"

cat <<EOF > "$PT_TMPDIR/expected"
  Connections from remote IP addresses
    10.8.0.12           6
    10.8.0.14           2
    10.8.0.65           1
    10.8.0.76          25
    10.8.0.77           1
    192.168.5.77        2
  Connections to local IP addresses
    10.8.0.75          35
  Connections to top 10 local ports
    22                  1
    3306               25
    37570               1
    51071               1
    51072               1
    51073               1
    51074               1
    52300               1
    60757               1
  States of connections
    ESTABLISHED        30
    LISTEN              3
    TIME_WAIT           3
EOF

parse_netstat "$samples/netstat-003.txt" > "$PT_TMPDIR/got"
no_diff "$PT_TMPDIR/got" "$PT_TMPDIR/expected" "parse_netstat, netstat-003.txt"

# parse_lsi_megaraid

cat <<EOF > "$PT_TMPDIR/expected"
         BBU | 100% Charged, Temperature 18C, isSOHGood=Yes
EOF

cat <<EOF > "$PT_TMPDIR/in"
BBU status for Adapter: 0

BatteryType: BBU
Voltage: 4072 mV
Current: 0 mA
Temperature: 18 C
Firmware Status: 00000000

Battery state: 

GasGuageStatus:
  Fully Discharged        : No
  Fully Charged           : Yes
  Discharging             : Yes
  Initialized             : Yes
  Remaining Time Alarm    : No
  Remaining Capacity Alarm: No
  Discharge Terminated    : No
  Over Temperature        : No
  Charging Terminated     : No
  Over Charged            : No

Relative State of Charge: 100 %
Charger Status: Complete
Remaining Capacity: 867 mAh
Full Charge Capacity: 867 mAh
isSOHGood: Yes

Exit Code: 0x00
EOF
parse_lsi_megaraid_bbu_status "$PT_TMPDIR/in" > "$PT_TMPDIR/got"
no_diff "$PT_TMPDIR/got" "$PT_TMPDIR/expected"

# ############################################################################
cat <<EOF > "$PT_TMPDIR/expected"

  PhysiclDev Type State   Errors Vendor  Model        Size
  ========== ==== ======= ====== ======= ============ ===========
  Hard Disk  SAS  Online   0/0/0 SEAGATE ST373455SS   70007MB
  Hard Disk  SAS  Online   0/0/0 SEAGATE ST373455SS   70007MB
  Hard Disk  SAS  Online   0/0/0 SEAGATE ST373455SS   70007MB
  Hard Disk  SAS  Online   0/0/0 SEAGATE ST373455SS   70007MB
EOF

cat <<EOF > "$PT_TMPDIR/in"
                                     
Adapter #0

Enclosure Device ID: 32
Slot Number: 0
Device Id: 0
Sequence Number: 2
Media Error Count: 0
Other Error Count: 0
Predictive Failure Count: 0
Last Predictive Failure Event Seq Number: 0
PD Type: SAS
Raw Size: 70007MB [0x88bb93a Sectors]
Non Coerced Size: 69495MB [0x87bb93a Sectors]
Coerced Size: 69376MB [0x8780000 Sectors]
Firmware state: Online
SAS Address(0): 0x5000c500079f8cf9
SAS Address(1): 0x0
Connected Port Number: 0(path0) 
Inquiry Data: SEAGATE ST373455SS      S5273LQ2DZ33            
Foreign State: None 
Media Type: Hard Disk Device

Enclosure Device ID: 32
Slot Number: 1
Device Id: 1
Sequence Number: 2
Media Error Count: 0
Other Error Count: 0
Predictive Failure Count: 0
Last Predictive Failure Event Seq Number: 0
PD Type: SAS
Raw Size: 70007MB [0x88bb93a Sectors]
Non Coerced Size: 69495MB [0x87bb93a Sectors]
Coerced Size: 69376MB [0x8780000 Sectors]
Firmware state: Online
SAS Address(0): 0x5000c500079f5c35
SAS Address(1): 0x0
Connected Port Number: 1(path0) 
Inquiry Data: SEAGATE ST373455SS      S5273LQ2D9RH            
Foreign State: None 
Media Type: Hard Disk Device

Enclosure Device ID: 32
Slot Number: 2
Device Id: 2
Sequence Number: 2
Media Error Count: 0
Other Error Count: 0
Predictive Failure Count: 0
Last Predictive Failure Event Seq Number: 0
PD Type: SAS
Raw Size: 70007MB [0x88bb93a Sectors]
Non Coerced Size: 69495MB [0x87bb93a Sectors]
Coerced Size: 69376MB [0x8780000 Sectors]
Firmware state: Online
SAS Address(0): 0x5000c500079fc0c9
SAS Address(1): 0x0
Connected Port Number: 2(path0) 
Inquiry Data: SEAGATE ST373455SS      S5273LQ2DPST            
Foreign State: None 
Media Type: Hard Disk Device

Enclosure Device ID: 32
Slot Number: 3
Device Id: 3
Sequence Number: 2
Media Error Count: 0
Other Error Count: 0
Predictive Failure Count: 0
Last Predictive Failure Event Seq Number: 0
PD Type: SAS
Raw Size: 70007MB [0x88bb93a Sectors]
Non Coerced Size: 69495MB [0x87bb93a Sectors]
Coerced Size: 69376MB [0x8780000 Sectors]
Firmware state: Online
SAS Address(0): 0x5000c500079dc339
SAS Address(1): 0x0
Connected Port Number: 3(path0) 
Inquiry Data: SEAGATE ST373455SS      S5273LQ2CKD5            
Foreign State: None 
Media Type: Hard Disk Device


Exit Code: 0x00
EOF
parse_lsi_megaraid_devices "$PT_TMPDIR/in" > "$PT_TMPDIR/got"
no_diff "$PT_TMPDIR/got" "$PT_TMPDIR/expected"


# ############################################################################
cat <<EOF > "$PT_TMPDIR/expected"

  PhysiclDev Type State   Errors Vendor  Model        Size
  ========== ==== ======= ====== ======= ============ ===========
  Hard Disk  SAS  Online   0/0/0 SEAGATE ST373455SS   70007MB
  Hard Disk  SAS  Online   0/0/0 SEAGATE ST373455SS   70007MB
  Hard Disk  SAS  Online   0/0/0 SEAGATE ST373455SS   70007MB
  Hard Disk  SAS  Online   0/0/0 SEAGATE ST373455SS   70007MB
EOF

cat <<EOF > "$PT_TMPDIR/in"
[root@pc-db1 ~]# /opt/MegaRAID/MegaCli/MegaCli64 -LdPdInfo -aALL
                                     
Adapter #0

Number of Virtual Disks: 2
Virtual Disk: 0 (Target Id: 0)
Name:
RAID Level: Primary-1, Secondary-0, RAID Level Qualifier-0
Size:69376MB
State: Optimal
Stripe Size: 64kB
Number Of Drives:2
Span Depth:1
Default Cache Policy: WriteBack, ReadAheadNone, Direct, No Write Cache if Bad BBU
Current Cache Policy: WriteBack, ReadAheadNone, Direct, No Write Cache if Bad BBU
Access Policy: Read/Write
Disk Cache Policy: Disk's Default
Number of Spans: 1
Span: 0 - Number of PDs: 2
PD: 0 Information
Enclosure Device ID: 32
Slot Number: 0
Device Id: 0
Sequence Number: 2
Media Error Count: 0
Other Error Count: 0
Predictive Failure Count: 0
Last Predictive Failure Event Seq Number: 0
PD Type: SAS
Raw Size: 70007MB [0x88bb93a Sectors]
Non Coerced Size: 69495MB [0x87bb93a Sectors]
Coerced Size: 69376MB [0x8780000 Sectors]
Firmware state: Online
SAS Address(0): 0x5000c500079f8cf9
SAS Address(1): 0x0
Connected Port Number: 0(path0) 
Inquiry Data: SEAGATE ST373455SS      S5273LQ2DZ33            
Foreign State: None 
Media Type: Hard Disk Device

PD: 1 Information
Enclosure Device ID: 32
Slot Number: 1
Device Id: 1
Sequence Number: 2
Media Error Count: 0
Other Error Count: 0
Predictive Failure Count: 0
Last Predictive Failure Event Seq Number: 0
PD Type: SAS
Raw Size: 70007MB [0x88bb93a Sectors]
Non Coerced Size: 69495MB [0x87bb93a Sectors]
Coerced Size: 69376MB [0x8780000 Sectors]
Firmware state: Online
SAS Address(0): 0x5000c500079f5c35
SAS Address(1): 0x0
Connected Port Number: 1(path0) 
Inquiry Data: SEAGATE ST373455SS      S5273LQ2D9RH            
Foreign State: None 
Media Type: Hard Disk Device

Virtual Disk: 1 (Target Id: 1)
Name:
RAID Level: Primary-1, Secondary-0, RAID Level Qualifier-0
Size:69376MB
State: Optimal
Stripe Size: 64kB
Number Of Drives:2
Span Depth:1
Default Cache Policy: WriteBack, ReadAheadNone, Direct, No Write Cache if Bad BBU
Current Cache Policy: WriteBack, ReadAheadNone, Direct, No Write Cache if Bad BBU
Access Policy: Read/Write
Disk Cache Policy: Disk's Default
Number of Spans: 1
Span: 0 - Number of PDs: 2
PD: 0 Information
Enclosure Device ID: 32
Slot Number: 2
Device Id: 2
Sequence Number: 2
Media Error Count: 0
Other Error Count: 0
Predictive Failure Count: 0
Last Predictive Failure Event Seq Number: 0
PD Type: SAS
Raw Size: 70007MB [0x88bb93a Sectors]
Non Coerced Size: 69495MB [0x87bb93a Sectors]
Coerced Size: 69376MB [0x8780000 Sectors]
Firmware state: Online
SAS Address(0): 0x5000c500079fc0c9
SAS Address(1): 0x0
Connected Port Number: 2(path0) 
Inquiry Data: SEAGATE ST373455SS      S5273LQ2DPST            
Foreign State: None 
Media Type: Hard Disk Device

PD: 1 Information
Enclosure Device ID: 32
Slot Number: 3
Device Id: 3
Sequence Number: 2
Media Error Count: 0
Other Error Count: 0
Predictive Failure Count: 0
Last Predictive Failure Event Seq Number: 0
PD Type: SAS
Raw Size: 70007MB [0x88bb93a Sectors]
Non Coerced Size: 69495MB [0x87bb93a Sectors]
Coerced Size: 69376MB [0x8780000 Sectors]
Firmware state: Online
SAS Address(0): 0x5000c500079dc339
SAS Address(1): 0x0
Connected Port Number: 3(path0) 
Inquiry Data: SEAGATE ST373455SS      S5273LQ2CKD5            
Foreign State: None 
Media Type: Hard Disk Device


Exit Code: 0x00
EOF
parse_lsi_megaraid_devices "$PT_TMPDIR/in" > "$PT_TMPDIR/got"
no_diff "$PT_TMPDIR/got" "$PT_TMPDIR/expected"

# ############################################################################
cat <<EOF > "$PT_TMPDIR/expected"

  VirtualDev Size      RAID Level Disks SpnDpth Stripe Status  Cache
  ========== ========= ========== ===== ======= ====== ======= =========
  0(no name) 69376MB   1 (1-0-0)      2     1-1   64kB Optimal WB, no RA
  1(no name) 69376MB   1 (1-0-0)      2     1-1   64kB Optimal WB, no RA
EOF

cat <<EOF > "$PT_TMPDIR/in"
[root@pc-db1 ~]# /opt/MegaRAID/MegaCli/MegaCli64 -LdPdInfo -aALL
                                     
Adapter #0

Number of Virtual Disks: 2
Virtual Disk: 0 (Target Id: 0)
Name:
RAID Level: Primary-1, Secondary-0, RAID Level Qualifier-0
Size:69376MB
State: Optimal
Stripe Size: 64kB
Number Of Drives:2
Span Depth:1
Default Cache Policy: WriteBack, ReadAheadNone, Direct, No Write Cache if Bad BBU
Current Cache Policy: WriteBack, ReadAheadNone, Direct, No Write Cache if Bad BBU
Access Policy: Read/Write
Disk Cache Policy: Disk's Default
Number of Spans: 1
Span: 0 - Number of PDs: 2
PD: 0 Information
Enclosure Device ID: 32
Slot Number: 0
Device Id: 0
Sequence Number: 2
Media Error Count: 0
Other Error Count: 0
Predictive Failure Count: 0
Last Predictive Failure Event Seq Number: 0
PD Type: SAS
Raw Size: 70007MB [0x88bb93a Sectors]
Non Coerced Size: 69495MB [0x87bb93a Sectors]
Coerced Size: 69376MB [0x8780000 Sectors]
Firmware state: Online
SAS Address(0): 0x5000c500079f8cf9
SAS Address(1): 0x0
Connected Port Number: 0(path0) 
Inquiry Data: SEAGATE ST373455SS      S5273LQ2DZ33            
Foreign State: None 
Media Type: Hard Disk Device

PD: 1 Information
Enclosure Device ID: 32
Slot Number: 1
Device Id: 1
Sequence Number: 2
Media Error Count: 0
Other Error Count: 0
Predictive Failure Count: 0
Last Predictive Failure Event Seq Number: 0
PD Type: SAS
Raw Size: 70007MB [0x88bb93a Sectors]
Non Coerced Size: 69495MB [0x87bb93a Sectors]
Coerced Size: 69376MB [0x8780000 Sectors]
Firmware state: Online
SAS Address(0): 0x5000c500079f5c35
SAS Address(1): 0x0
Connected Port Number: 1(path0) 
Inquiry Data: SEAGATE ST373455SS      S5273LQ2D9RH            
Foreign State: None 
Media Type: Hard Disk Device

Virtual Disk: 1 (Target Id: 1)
Name:
RAID Level: Primary-1, Secondary-0, RAID Level Qualifier-0
Size:69376MB
State: Optimal
Stripe Size: 64kB
Number Of Drives:2
Span Depth:1
Default Cache Policy: WriteBack, ReadAheadNone, Direct, No Write Cache if Bad BBU
Current Cache Policy: WriteBack, ReadAheadNone, Direct, No Write Cache if Bad BBU
Access Policy: Read/Write
Disk Cache Policy: Disk's Default
Number of Spans: 1
Span: 0 - Number of PDs: 2
PD: 0 Information
Enclosure Device ID: 32
Slot Number: 2
Device Id: 2
Sequence Number: 2
Media Error Count: 0
Other Error Count: 0
Predictive Failure Count: 0
Last Predictive Failure Event Seq Number: 0
PD Type: SAS
Raw Size: 70007MB [0x88bb93a Sectors]
Non Coerced Size: 69495MB [0x87bb93a Sectors]
Coerced Size: 69376MB [0x8780000 Sectors]
Firmware state: Online
SAS Address(0): 0x5000c500079fc0c9
SAS Address(1): 0x0
Connected Port Number: 2(path0) 
Inquiry Data: SEAGATE ST373455SS      S5273LQ2DPST            
Foreign State: None 
Media Type: Hard Disk Device

PD: 1 Information
Enclosure Device ID: 32
Slot Number: 3
Device Id: 3
Sequence Number: 2
Media Error Count: 0
Other Error Count: 0
Predictive Failure Count: 0
Last Predictive Failure Event Seq Number: 0
PD Type: SAS
Raw Size: 70007MB [0x88bb93a Sectors]
Non Coerced Size: 69495MB [0x87bb93a Sectors]
Coerced Size: 69376MB [0x8780000 Sectors]
Firmware state: Online
SAS Address(0): 0x5000c500079dc339
SAS Address(1): 0x0
Connected Port Number: 3(path0) 
Inquiry Data: SEAGATE ST373455SS      S5273LQ2CKD5            
Foreign State: None 
Media Type: Hard Disk Device


Exit Code: 0x00
EOF
parse_lsi_megaraid_virtual_devices "$PT_TMPDIR/in" > "$PT_TMPDIR/got"
no_diff "$PT_TMPDIR/got" "$PT_TMPDIR/expected"

# ############################################################################
cat <<EOF > "$PT_TMPDIR/expected"

  VirtualDev Size      RAID Level Disks SpnDpth Stripe Status  Cache
  ========== ========= ========== ===== ======= ====== ======= =========
  0(no name) 69376MB   1 (1-0-0)      2      1-   64kB Optimal WB, no RA
  1(no name) 69376MB   1 (1-0-0)      2      1-   64kB Optimal WB, no RA
EOF

cat <<EOF > "$PT_TMPDIR/in"
[root@pc-db1 ~]# /opt/MegaRAID/MegaCli/MegaCli64 -LDInfo -Lall -aAll
                                     

Adapter 0 -- Virtual Drive Information:
Virtual Disk: 0 (Target Id: 0)
Name:
RAID Level: Primary-1, Secondary-0, RAID Level Qualifier-0
Size:69376MB
State: Optimal
Stripe Size: 64kB
Number Of Drives:2
Span Depth:1
Default Cache Policy: WriteBack, ReadAheadNone, Direct, No Write Cache if Bad BBU
Current Cache Policy: WriteBack, ReadAheadNone, Direct, No Write Cache if Bad BBU
Access Policy: Read/Write
Disk Cache Policy: Disk's Default
Virtual Disk: 1 (Target Id: 1)
Name:
RAID Level: Primary-1, Secondary-0, RAID Level Qualifier-0
Size:69376MB
State: Optimal
Stripe Size: 64kB
Number Of Drives:2
Span Depth:1
Default Cache Policy: WriteBack, ReadAheadNone, Direct, No Write Cache if Bad BBU
Current Cache Policy: WriteBack, ReadAheadNone, Direct, No Write Cache if Bad BBU
Access Policy: Read/Write
Disk Cache Policy: Disk's Default

Exit Code: 0x00
EOF
parse_lsi_megaraid_virtual_devices "$PT_TMPDIR/in" > "$PT_TMPDIR/got"
no_diff "$PT_TMPDIR/got" "$PT_TMPDIR/expected"


# ############################################################################
cat <<EOF > "$PT_TMPDIR/expected"
       Model | PERC 6/i Integrated, PCIE interface, 8 ports
       Cache | 256MB Memory, BBU Present
EOF

parse_lsi_megaraid_adapter_info "$samples/MegaCli64_AdpAllInfo_aALL001.txt" > "$PT_TMPDIR/got"
no_diff "$PT_TMPDIR/got" "$PT_TMPDIR/expected"

# Launchpad 886223
cat <<EOF > "$PT_TMPDIR/expected"

  VirtualDev Size      RAID Level Disks SpnDpth Stripe Status  Cache
  ========== ========= ========== ===== ======= ====== ======= =========
  0(no name)  135.5 GB 0 (:-1-0)      2 Depth-2  64 KB Optimal WB, no RA
EOF
parse_lsi_megaraid_virtual_devices "$PERCONA_TOOLKIT_BRANCH/t/pt-summary/samples/MegaCli64_LdPdInfo_aALL_886223" > "$PT_TMPDIR/got"
no_diff "$PT_TMPDIR/got" "$PT_TMPDIR/expected" "Bug 886223"

# parse_hpacucli

cat <<EOF > "$PT_TMPDIR/expected"
      logicaldrive 1 (136.7 GB, RAID 1, OK)
      physicaldrive 1I:1:1 (port 1I:box 1:bay 1, SAS, 146 GB, OK)
      physicaldrive 1I:1:2 (port 1I:box 1:bay 2, SAS, 146 GB, OK)
EOF

cat <<EOF > "$PT_TMPDIR/in"

Smart Array P400i in Slot 0 (Embedded)    (sn: PH73MU7325     )

   array A (SAS, Unused Space: 0 MB)


      logicaldrive 1 (136.7 GB, RAID 1, OK)

      physicaldrive 1I:1:1 (port 1I:box 1:bay 1, SAS, 146 GB, OK)
      physicaldrive 1I:1:2 (port 1I:box 1:bay 2, SAS, 146 GB, OK)

EOF
parse_hpacucli "$PT_TMPDIR/in" > "$PT_TMPDIR/got"
no_diff "$PT_TMPDIR/got" "$PT_TMPDIR/expected"

parse_hpacucli "$samples/hpaculi-003.txt" > "$PT_TMPDIR/got"
is \
   "$(cat "$PT_TMPDIR/got")" \
   "" \
   "parse_hpacucli, hpaculi-003.txt"

# parse_fusionmpt_lsiutil

cat <<EOF > "$PT_TMPDIR/expected"

  /proc/mpt/ioc0    LSI Logic SAS1068E B3    MPT 105   Firmware 00192f00   IOC 0
   B___T___L  Type       Vendor   Product          Rev      SASAddress     PhyNum
   0   0   0  Disk       Dell     VIRTUAL DISK     1028  
   0   2   0  Disk       Dell     VIRTUAL DISK     1028  
   0   8   0  EnclServ   DP       BACKPLANE        1.05  510240805f4feb00     8
  Hidden RAID Devices:
   B___T    Device       Vendor   Product          Rev      SASAddress     PhyNum
   0   1  PhysDisk 0     SEAGATE  ST373455SS       S52A  5000c50012a8ac61     1
   0   9  PhysDisk 1     SEAGATE  ST373455SS       S52A  5000c50012a8a24d     0
   0   3  PhysDisk 2     SEAGATE  ST3146855SS      S52A  5000c500130fcaed     3
   0  10  PhysDisk 3     SEAGATE  ST3146855SS      S52A  5000c500131093f5     2
EOF
parse_fusionmpt_lsiutil "$samples/lsiutil-001.txt" > "$PT_TMPDIR/got"
no_diff "$PT_TMPDIR/got" "$PT_TMPDIR/expected" "lsiutil-001.txt"

cat <<EOF > "$PT_TMPDIR/expected"

  /proc/mpt/ioc0    LSI Logic SAS1064E B3    MPT 105   Firmware 011e0000   IOC 0
   B___T___L  Type       Vendor   Product          Rev      SASAddress     PhyNum
   0   1   0  Disk       LSILOGIC Logical Volume   3000  
  Hidden RAID Devices:
   B___T    Device       Vendor   Product          Rev      SASAddress     PhyNum
   0   2  PhysDisk 0     IBM-ESXS ST9300603SS   F  B536  5000c5001d784329     1
   0   3  PhysDisk 1     IBM-ESXS MBD2300RC        SB17  500000e113c17152     0
EOF
parse_fusionmpt_lsiutil "$samples/lsiutil-002.txt" > "$PT_TMPDIR/got"
no_diff "$PT_TMPDIR/got" "$PT_TMPDIR/expected" "lsiutil-002.txt"

cat <<EOF > "$PT_TMPDIR/expected"

  /proc/mpt/ioc0    LSI Logic SAS1064E B3    MPT 105   Firmware 011e0000   IOC 0
   B___T___L  Type       Vendor   Product          Rev      SASAddress     PhyNum
   0   1   0  Disk       LSILOGIC Logical Volume   3000  
  Hidden RAID Devices:
   B___T    Device       Vendor   Product          Rev      SASAddress     PhyNum
   0   2  PhysDisk 0     IBM-ESXS MBD2300RC        SB17  500000e113c00ed2     1
   0   3  PhysDisk 1     IBM-ESXS MBD2300RC        SB17  500000e113c17ee2     0
EOF
parse_fusionmpt_lsiutil "$samples/lsiutil-003.txt" > "$PT_TMPDIR/got"
no_diff "$PT_TMPDIR/got" "$PT_TMPDIR/expected" "lsiutil-003.txt"

# parse_free_minus_b

cat <<EOF > "$PT_TMPDIR/expected"
       Total | 3.9G
        Free | 1.4G
        Used | physical = 2.5G, swap allocated = 4.9G, swap used = 0.0, virtual = 2.5G
     Buffers | 131.8M
      Caches | 1.9G
       Dirty | 60 kB
EOF

cat <<EOF > "$PT_TMPDIR/in"
             total       used       free     shared    buffers     cached
Mem:    4182048768 2653696000 1528352768          0  138240000 2060787712
-/+ buffers/cache:  454668288 3727380480
Swap:   5284814848          0 5284814848
MemTotal:        4084040 kB
MemFree:         2390720 kB
Buffers:          121868 kB
Cached:          1155116 kB
SwapCached:            0 kB
Active:           579712 kB
Inactive:         941436 kB
Active(anon):     244720 kB
Inactive(anon):    40572 kB
Active(file):     334992 kB
Inactive(file):   900864 kB
Unevictable:          48 kB
Mlocked:              48 kB
HighTotal:       3251848 kB
HighFree:        1837740 kB
LowTotal:         832192 kB
LowFree:          552980 kB
SwapTotal:       5144572 kB
SwapFree:        5144572 kB
Dirty:                60 kB
Writeback:             0 kB
AnonPages:        244264 kB
Mapped:            84452 kB
Shmem:             41140 kB
Slab:             133548 kB
SReclaimable:     107672 kB
SUnreclaim:        25876 kB
KernelStack:        2264 kB
PageTables:         7740 kB
NFS_Unstable:          0 kB
Bounce:                0 kB
WritebackTmp:          0 kB
CommitLimit:     7186592 kB
Committed_AS:    1192140 kB
VmallocTotal:     122880 kB
VmallocUsed:       32276 kB
VmallocChunk:      65120 kB
HardwareCorrupted:     0 kB
HugePages_Total:       0
HugePages_Free:        0
HugePages_Rsvd:        0
HugePages_Surp:        0
Hugepagesize:       2048 kB
DirectMap4k:       10232 kB
DirectMap2M:      897024 kB
EOF
parse_free_minus_b "$PT_TMPDIR/in" > "$PT_TMPDIR/got"
no_diff "$PT_TMPDIR/got" "$PT_TMPDIR/expected" "parse_free_minus_b"

# Bug 993436: Memory: Total reports M when it should say G
cat <<EOF > "$PT_TMPDIR/expected"
       Total | 1010.5M
        Free | 784.4M
        Used | physical = 226.1M, swap allocated = 2.0G, swap used = 0.0, virtual = 226.1M
     Buffers | 48.8M
      Caches | 122.2M
       Dirty | 152 kB
EOF
parse_free_minus_b "$T_DIR/pt-summary/samples/Linux/002/memory" > "$PT_TMPDIR/got"
no_diff "$PT_TMPDIR/got" "$PT_TMPDIR/expected" "parse_free_minus_b (bug 993436)"

# parse_filesystems

cat <<EOF > $PT_TMPDIR/expected
  Filesystem  Size Used Type  Opts Mountpoint
  /dev/sda1    99M  13% ext3  rw   /boot
  /dev/sda2   540G  89% ext3  rw   /
  tmpfs        48G   0% tmpfs rw   /dev/shm
EOF
parse_filesystems "$samples/df-mount-003.txt" "Linux" > "$PT_TMPDIR/got"
no_diff "$PT_TMPDIR/got" "$PT_TMPDIR/expected" "df-mount-003.txt Linux"

cat <<EOF > $PT_TMPDIR/expected
  Filesystem  Size Used Type        Opts              Mountpoint
  /dev/sda1   9.9G  34% ext3        rw                /
  /dev/sdb    414G   1% ext3        rw                /mnt
  none        7.6G   0% devpts      rw,gid=5,mode=620 /dev/shm
  none        7.6G   0% tmpfs       rw                /dev/shm
  none        7.6G   0% binfmt_misc rw                /dev/shm
  none        7.6G   0% proc        rw                /dev/shm
  none        7.6G   0% sysfs       rw                /dev/shm
EOF
parse_filesystems "$samples/df-mount-004.txt" "Linux" > "$PT_TMPDIR/got"
no_diff "$PT_TMPDIR/got" "$PT_TMPDIR/expected" "df-mount-004.txt Linux"

cat <<EOF > $PT_TMPDIR/expected
  Filesystem                         Size Used Type  Opts       Mountpoint
  /dev/cciss/c0d0p1                   99M  24% ext3  rw         /boot
  /dev/mapper/VolGroup00-LogVol00    194G  58% ext3  rw         /
  /dev/mapper/VolGroup00-mysql_log   191G   4% ext3  rw         /data/mysql-log
  /dev/mapper/VolGroup01-mysql_data 1008G  44% ext3  rw,noatime /data/mysql-data
  tmpfs                               48G   0% tmpfs rw         /dev/shm
EOF
parse_filesystems "$samples/df-mount-005.txt" "Linux" > "$PT_TMPDIR/got"
no_diff "$PT_TMPDIR/got" "$PT_TMPDIR/expected" "df-mount-005.txt Linux"

cat <<EOF > $PT_TMPDIR/expected
  Filesystem   Size Used Type  Opts                Mountpoint
  /dev/ad0s1a  496M  32% ufs   local               /
  /dev/ad0s1d  1.1G   1% ufs   local, soft-updates /var
  /dev/ad0s1e  496M   0% ufs   local, soft-updates /tmp
  /dev/ad0s1f   17G   9% ufs   local, soft-updates /usr
  devfs        1.0K 100% devfs local               /dev
EOF
parse_filesystems "$samples/df-mount-006.txt" "FreeBSD" > "$PT_TMPDIR/got"
no_diff "$PT_TMPDIR/got" "$PT_TMPDIR/expected" "df-mount-006.txt FreeBSD"

# parse_ip_s_link

cat <<EOF > "$PT_TMPDIR/expected"
  interface  rx_bytes rx_packets  rx_errors   tx_bytes tx_packets  tx_errors
  ========= ========= ========== ========== ========== ========== ==========
  lo          3000000      25000          0    3000000      25000          0
  eth0      175000000   30000000          0  125000000     900000          0
  wlan0      50000000      80000          0   20000000      90000          0
  vboxnet0          0          0          0          0          0          0
EOF
parse_ip_s_link "$samples/ip-s-link-001.txt" > $PT_TMPDIR/got
no_diff "$PT_TMPDIR/got" "$PT_TMPDIR/expected" "ip-s-link-001.txt"

cat <<EOF > "$PT_TMPDIR/expected"
  interface  rx_bytes rx_packets  rx_errors   tx_bytes tx_packets  tx_errors
  ========= ========= ========== ========== ========== ========== ==========
  lo       3500000000  350000000          0 3500000000  350000000          0
  eth0     1750000000 1250000000          0 3500000000  700000000          0
  eth1     1250000000   60000000          0  900000000   50000000          0
  sit0              0          0          0          0          0          0
EOF
parse_ip_s_link "$samples/ip-s-link-002.txt" > "$PT_TMPDIR/got"
no_diff "$PT_TMPDIR/got" "$PT_TMPDIR/expected" "ip-s-link-002.txt"

cat <<EOF > "$PT_TMPDIR/expected"
  interface  rx_bytes rx_packets  rx_errors   tx_bytes tx_packets  tx_errors
  ========= ========= ========== ========== ========== ========== ==========
  lo         25000000     300000          0   25000000     300000          0
  eth0              0          0          0          0          0          0
  wlan0             0          0          0          0          0          0
  virbr0            0          0          0          0          0          0
EOF
parse_ip_s_link "$samples/ip-s-link-003.txt" > "$PT_TMPDIR/got"
no_diff "$PT_TMPDIR/got" "$PT_TMPDIR/expected" "ip-s-link-003.txt"

# parse_fdisk

cat <<EOF > "$PT_TMPDIR/expected"
Device       Type      Start        End               Size
============ ==== ========== ========== ==================
/dev/dm-0    Disk                             494609104896
/dev/dm-1    Disk                               5284823040
/dev/sda     Disk                             500107862016
/dev/sda1    Part          1         26          205632000
/dev/sda2    Part         26      60801       499891392000
EOF
parse_fdisk "$samples/fdisk-01.txt" > "$PT_TMPDIR/got"
no_diff "$PT_TMPDIR/got" "$PT_TMPDIR/expected" "parse_fdisk"

# parse_ethernet_controller_lspci

cat <<EOF > $PT_TMPDIR/expected
  Controller | Broadcom Corporation NetXtreme II BCM5708 Gigabit Ethernet (rev 12)
  Controller | Broadcom Corporation NetXtreme II BCM5708 Gigabit Ethernet (rev 12)
EOF
parse_ethernet_controller_lspci "$samples/lspci-001.txt" > "$PT_TMPDIR/got"
no_diff "$PT_TMPDIR/got" "$PT_TMPDIR/expected"

# parse_dmidecode_mem_devices

cat <<EOF > $PT_TMPDIR/expected
  Locator   Size     Speed             Form Factor   Type          Type Detail
  ========= ======== ================= ============= ============= ===========
  SODIMM0   2048 MB  800 MHz           SODIMM        Other         Synchronous
  SODIMM1   2048 MB  800 MHz           SODIMM        Other         Synchronous
EOF
parse_dmidecode_mem_devices "$samples/dmidecode-001.txt" > $PT_TMPDIR/got
no_diff "$PT_TMPDIR/got" "$PT_TMPDIR/expected" "dmidecode-001.tx"

cat <<EOF > "$PT_TMPDIR/expected"
  Locator   Size     Speed             Form Factor   Type          Type Detail
  ========= ======== ================= ============= ============= ===========
  DIMM1     2048 MB  667 MHz (1.5 ns)  {OUT OF SPEC} {OUT OF SPEC} Synchronous
  DIMM2     2048 MB  667 MHz (1.5 ns)  {OUT OF SPEC} {OUT OF SPEC} Synchronous
  DIMM3     2048 MB  667 MHz (1.5 ns)  {OUT OF SPEC} {OUT OF SPEC} Synchronous
  DIMM4     2048 MB  667 MHz (1.5 ns)  {OUT OF SPEC} {OUT OF SPEC} Synchronous
  DIMM5     2048 MB  667 MHz (1.5 ns)  {OUT OF SPEC} {OUT OF SPEC} Synchronous
  DIMM6     2048 MB  667 MHz (1.5 ns)  {OUT OF SPEC} {OUT OF SPEC} Synchronous
  DIMM7     2048 MB  667 MHz (1.5 ns)  {OUT OF SPEC} {OUT OF SPEC} Synchronous
  DIMM8     2048 MB  667 MHz (1.5 ns)  {OUT OF SPEC} {OUT OF SPEC} Synchronous
EOF
parse_dmidecode_mem_devices "$samples/dmidecode-002.txt" > "$PT_TMPDIR/got"
no_diff "$PT_TMPDIR/got" "$PT_TMPDIR/expected" "dmidecode-002.tx"

cat <<EOF > "$PT_TMPDIR/expected"
  Locator   Size     Speed             Form Factor   Type          Type Detail
  ========= ======== ================= ============= ============= ===========
            1024 kB  33 MHz            Other         Flash         Non-Volatile
  D5        4096 MB  1066 MHz          DIMM          Other         Other   
  D8        4096 MB  1066 MHz          DIMM          Other         Other   
  D0        {EMPTY}  1333 MHz          DIMM          Other         Other   
  D0        {EMPTY}  1333 MHz          DIMM          Other         Other   
  D1        {EMPTY}  1333 MHz          DIMM          Other         Other   
  D1        {EMPTY}  1333 MHz          DIMM          Other         Other   
  D2        {EMPTY}  1333 MHz          DIMM          Other         Other   
  D2        {EMPTY}  1333 MHz          DIMM          Other         Other   
  D3        {EMPTY}  1333 MHz          DIMM          Other         Other   
  D3        {EMPTY}  1333 MHz          DIMM          Other         Other   
  D4        {EMPTY}  1333 MHz          DIMM          Other         Other   
  D4        {EMPTY}  1333 MHz          DIMM          Other         Other   
  D5        {EMPTY}  1333 MHz          DIMM          Other         Other   
  D6        {EMPTY}  1333 MHz          DIMM          Other         Other   
  D6        {EMPTY}  1333 MHz          DIMM          Other         Other   
  D7        {EMPTY}  1333 MHz          DIMM          Other         Other   
  D7        {EMPTY}  1333 MHz          DIMM          Other         Other   
  D8        {EMPTY}  1333 MHz          DIMM          Other         Other   
EOF
parse_dmidecode_mem_devices "$samples/dmidecode-003.txt" > "$PT_TMPDIR/got"
no_diff "$PT_TMPDIR/got" "$PT_TMPDIR/expected" "dmidecode-003.txt"

cat <<EOF > "$PT_TMPDIR/expected"
  Locator   Size     Speed             Form Factor   Type          Type Detail
  ========= ======== ================= ============= ============= ===========
  DIMM_A2   4096 MB  1066 MHz (0.9 ns) DIMM          {OUT OF SPEC} Synchronous
  DIMM_A3   4096 MB  1066 MHz (0.9 ns) DIMM          {OUT OF SPEC} Synchronous
  DIMM_A5   4096 MB  1066 MHz (0.9 ns) DIMM          {OUT OF SPEC} Synchronous
  DIMM_A6   4096 MB  1066 MHz (0.9 ns) DIMM          {OUT OF SPEC} Synchronous
  DIMM_B2   4096 MB  1066 MHz (0.9 ns) DIMM          {OUT OF SPEC} Synchronous
  DIMM_B3   4096 MB  1066 MHz (0.9 ns) DIMM          {OUT OF SPEC} Synchronous
  DIMM_B5   4096 MB  1066 MHz (0.9 ns) DIMM          {OUT OF SPEC} Synchronous
  DIMM_B6   4096 MB  1066 MHz (0.9 ns) DIMM          {OUT OF SPEC} Synchronous
  DIMM_A1   {EMPTY}  Unknown           DIMM          {OUT OF SPEC} Synchronous
  DIMM_A4   {EMPTY}  Unknown           DIMM          {OUT OF SPEC} Synchronous
  DIMM_B1   {EMPTY}  Unknown           DIMM          {OUT OF SPEC} Synchronous
  DIMM_B4   {EMPTY}  Unknown           DIMM          {OUT OF SPEC} Synchronous
EOF
parse_dmidecode_mem_devices "$samples/dmidecode-004.txt" > "$PT_TMPDIR/got"
no_diff "$PT_TMPDIR/got" "$PT_TMPDIR/expected" "dmidecode-004.txt"

cat <<EOF > "$PT_TMPDIR/expected"
  Locator   Size     Speed             Form Factor   Type          Type Detail
  ========= ======== ================= ============= ============= ===========
  P1-DIMM1A 16384 MB 1066 MHz (0.9 ns) DIMM          {OUT OF SPEC} Other   
  P1-DIMM2A 16384 MB 1066 MHz (0.9 ns) DIMM          {OUT OF SPEC} Other   
  P1-DIMM3A 16384 MB 1066 MHz (0.9 ns) DIMM          {OUT OF SPEC} Other   
  P2-DIMM1A 16384 MB 1066 MHz (0.9 ns) DIMM          {OUT OF SPEC} Other   
  P2-DIMM2A 16384 MB 1066 MHz (0.9 ns) DIMM          {OUT OF SPEC} Other   
  P2-DIMM3A 16384 MB 1066 MHz (0.9 ns) DIMM          {OUT OF SPEC} Other   
            4096 kB  33 MHz (30.3 ns)  Other         Flash         Non-Volatile
  P1-DIMM1B {EMPTY}  Unknown           DIMM          {OUT OF SPEC} Other   
  P1-DIMM1C {EMPTY}  Unknown           DIMM          {OUT OF SPEC} Other   
  P1-DIMM2B {EMPTY}  Unknown           DIMM          {OUT OF SPEC} Other   
  P1-DIMM2C {EMPTY}  Unknown           DIMM          {OUT OF SPEC} Other   
  P1-DIMM3B {EMPTY}  Unknown           DIMM          {OUT OF SPEC} Other   
  P1-DIMM3C {EMPTY}  Unknown           DIMM          {OUT OF SPEC} Other   
  P2-DIMM1B {EMPTY}  Unknown           DIMM          {OUT OF SPEC} Other   
  P2-DIMM1C {EMPTY}  Unknown           DIMM          {OUT OF SPEC} Other   
  P2-DIMM2B {EMPTY}  Unknown           DIMM          {OUT OF SPEC} Other   
  P2-DIMM2C {EMPTY}  Unknown           DIMM          {OUT OF SPEC} Other   
  P2-DIMM3B {EMPTY}  Unknown           DIMM          {OUT OF SPEC} Other   
  P2-DIMM3C {EMPTY}  Unknown           DIMM          {OUT OF SPEC} Other   
EOF
parse_dmidecode_mem_devices "$samples/dmidecode-005.txt" > "$PT_TMPDIR/got"
no_diff "$PT_TMPDIR/got" "$PT_TMPDIR/expected" "dmidecode-005.txt"

cat <<EOF > "$PT_TMPDIR/expected"
  Locator   Size     Speed             Form Factor   Type          Type Detail
  ========= ======== ================= ============= ============= ===========
  DIMM 1    8192 MB  1600 MHz          SODIMM        DDR3          Synchronous
  DIMM 2    8192 MB  1600 MHz          SODIMM        DDR3          Synchronous
EOF
parse_dmidecode_mem_devices "$samples/dmidecode-006.txt" > "$PT_TMPDIR/got"
no_diff "$PT_TMPDIR/got" "$PT_TMPDIR/expected" "dmidecode-006.txt"


# parse_arcconf

cat <<EOF > "$PT_TMPDIR/expected"
       Specs | Adaptec 3405, SAS/SATA, 128 MB cache, Optimal
     Battery | 99%, 3d1h11m remaining, Optimal

  LogicalDev Size      RAID Disks Stripe Status  Cache
  ========== ========= ==== ===== ====== ======= =======
  raid10     279800 MB   10     4 256 KB Optimal On (WB)

  PhysiclDev State   Speed         Vendor  Model        Size        Cache
  ========== ======= ============= ======= ============ =========== =======
  Hard drive Online  SAS 3.0 Gb/s  SEAGATE ST3146855SS  140014 MB   On (WB)
  Hard drive Online  SAS 3.0 Gb/s  SEAGATE ST3146356SS  140014 MB   On (WB)
  Hard drive Online  SAS 3.0 Gb/s  SEAGATE ST3146356SS  140014 MB   On (WB)
  Hard drive Online  SAS 3.0 Gb/s  SEAGATE ST3146855SS  140014 MB   On (WB)
EOF

cat <<EOF > "$PT_TMPDIR/in"
# /usr/StorMan/arcconf getconfig 1
Controllers found: 1
----------------------------------------------------------------------
Controller information
----------------------------------------------------------------------
   Controller Status                        : Optimal
   Channel description                      : SAS/SATA
   Controller Model                         : Adaptec 3405
   Controller Serial Number                 : 8C16103E017
   Physical Slot                            : 1
   Temperature                              : 35 C/ 95 F (Normal)
   Installed memory                         : 128 MB
   Copyback                                 : Disabled
   Background consistency check             : Disabled
   Automatic Failover                       : Enabled
   Global task priority                     : High
   Stayawake period                         : Disabled
   Spinup limit internal drives             : 0
   Spinup limit external drives             : 0
   Defunct disk drive count                 : 0
   Logical devices/Failed/Degraded          : 1/0/0
   --------------------------------------------------------
   Controller Version Information
   --------------------------------------------------------
   BIOS                                     : 5.2-0 (17304)
   Firmware                                 : 5.2-0 (17304)
   Driver                                   : 1.1-5 (2461)
   Boot Flash                               : 5.2-0 (17304)
   --------------------------------------------------------
   Controller Battery Information
   --------------------------------------------------------
   Status                                   : Optimal
   Over temperature                         : No
   Capacity remaining                       : 99 percent
   Time remaining (at current draw)         : 3 days, 1 hours, 11 minutes

----------------------------------------------------------------------
Logical device information
----------------------------------------------------------------------
Logical device number 0
   Logical device name                      : raid10
   RAID level                               : 10
   Status of logical device                 : Optimal
   Size                                     : 279800 MB
   Stripe-unit size                         : 256 KB
   Read-cache mode                          : Enabled
   Write-cache mode                         : Enabled (write-back)
   Write-cache setting                      : Enabled (write-back) when protected by battery
   Partitioned                              : Unknown
   Protected by Hot-Spare                   : No
   Bootable                                 : Yes
   Failed stripes                           : No
   Power settings                           : Disabled
   --------------------------------------------------------
   Logical device segment information
   --------------------------------------------------------
   Group 0, Segment 0                       : Present (0,0) 3LN6552C00009903T8E4
   Group 0, Segment 1                       : Present (0,1) 3QN26HL400009009KZ0Q
   Group 1, Segment 0                       : Present (0,2) 3QN1S2AN00009001XVFZ
   Group 1, Segment 1                       : Present (0,3) 3LN648WZ00009903T916


----------------------------------------------------------------------
Physical Device information
----------------------------------------------------------------------
      Device #0
         Device is a Hard drive
         State                              : Online
         Supported                          : Yes
         Transfer Speed                     : SAS 3.0 Gb/s
         Reported Channel,Device(T:L)       : 0,0(0:0)
         Reported Location                  : Connector 0, Device 0
         Vendor                             : SEAGATE
         Model                              : ST3146855SS
         Firmware                           : 0002
         Serial number                      : 3LN6552C00009903T8E4
         World-wide name                    : 5000C5000C4DDBB8
         Size                               : 140014 MB
         Write Cache                        : Enabled (write-back)
         FRU                                : None
         S.M.A.R.T.                         : No
      Device #1
         Device is a Hard drive
         State                              : Online
         Supported                          : Yes
         Transfer Speed                     : SAS 3.0 Gb/s
         Reported Channel,Device(T:L)       : 0,1(1:0)
         Reported Location                  : Connector 0, Device 1
         Vendor                             : SEAGATE
         Model                              : ST3146356SS
         Firmware                           : 0005
         Serial number                      : 3QN26HL400009009KZ0Q
         World-wide name                    : 5000C50016F5E66C
         Size                               : 140014 MB
         Write Cache                        : Enabled (write-back)
         FRU                                : None
         S.M.A.R.T.                         : No
      Device #2
         Device is a Hard drive
         State                              : Online
         Supported                          : Yes
         Transfer Speed                     : SAS 3.0 Gb/s
         Reported Channel,Device(T:L)       : 0,2(2:0)
         Reported Location                  : Connector 0, Device 2
         Vendor                             : SEAGATE
         Model                              : ST3146356SS
         Firmware                           : 0005
         Serial number                      : 3QN1S2AN00009001XVFZ
         World-wide name                    : 5000C50016F5EF4C
         Size                               : 140014 MB
         Write Cache                        : Enabled (write-back)
         FRU                                : None
         S.M.A.R.T.                         : No
      Device #3
         Device is a Hard drive
         State                              : Online
         Supported                          : Yes
         Transfer Speed                     : SAS 3.0 Gb/s
         Reported Channel,Device(T:L)       : 0,3(3:0)
         Reported Location                  : Connector 0, Device 3
         Vendor                             : SEAGATE
         Model                              : ST3146855SS
         Firmware                           : 0002
         Serial number                      : 3LN648WZ00009903T916
         World-wide name                    : 5000C5000C4DEA60
         Size                               : 140014 MB
         Write Cache                        : Enabled (write-back)
         FRU                                : None
         S.M.A.R.T.                         : No


Command completed successfully.

EOF
parse_arcconf "$PT_TMPDIR/in" > "$PT_TMPDIR/got"
no_diff "$PT_TMPDIR/got" "$PT_TMPDIR/expected"

cat <<EOF > "$PT_TMPDIR/expected"
       Specs | Adaptec 3405, SAS/SATA, 128 MB cache, Optimal
     Battery | 99%, 3d1h11m remaining, Optimal

  LogicalDev Size      RAID Disks Stripe Status  Cache
  ========== ========= ==== ===== ====== ======= =======
  Raid10-A   571392 MB   10     4 256 KB Optimal On (WB)

  PhysiclDev State   Speed         Vendor  Model        Size        Cache
  ========== ======= ============= ======= ============ =========== =======
  Hard drive Online  SAS 3.0 Gb/s  SEAGATE ST3300655SS  286102 MB   On (WB)
  Hard drive Online  SAS 3.0 Gb/s  SEAGATE ST3300655SS  286102 MB   On (WB)
  Hard drive Online  SAS 3.0 Gb/s  SEAGATE ST3300655SS  286102 MB   On (WB)
  Hard drive Online  SAS 3.0 Gb/s  SEAGATE ST3300655SS  286102 MB   On (WB)
EOF
parse_arcconf "$samples/arcconf-002.txt" > "$PT_TMPDIR/got"
no_diff "$PT_TMPDIR/got" "$PT_TMPDIR/expected" "arcconf-002.txt"

# Launchpad 917781, parse_arcconf doesn't work with ZMM
# https://bugs.launchpad.net/percona-toolkit/+bug/917781
cat <<EOF > "$PT_TMPDIR/expected"
       Specs | Adaptec 5405Z, SAS/SATA, 512 MB cache, Optimal
     Battery | ZMM Optimal

  LogicalDev Size      RAID Disks Stripe Status  Cache
  ========== ========= ==== ===== ====== ======= =======
  RAID10-A   571382 MB   10     4 256 KB Optimal On (WB)

  PhysiclDev State   Speed         Vendor  Model        Size        Cache
  ========== ======= ============= ======= ============ =========== =======
  Hard drive Full rpm,Powered off SATA 3.0 Gb/s WDC     WD3000HLFS-0 286168 MB   On (WB)
  Hard drive Full rpm,Powered off SATA 3.0 Gb/s WDC     WD3000HLFS-0 286168 MB   On (WB)
  Hard drive Full rpm,Powered off SATA 3.0 Gb/s WDC     WD3000HLFS-0 286168 MB   On (WB)
  Hard drive Full rpm,Powered off SATA 3.0 Gb/s WDC     WD3000HLFS-0 286168 MB   On (WB)
EOF

parse_arcconf "$samples/arcconf-004_917781.txt" > "$PT_TMPDIR/got"
no_diff "$PT_TMPDIR/got" "$PT_TMPDIR/expected" "Bug 917781"

# Launchpad 900285, ${var/ /} doesn't work in sh
# https://bugs.launchpad.net/percona-toolkit/+bug/900285
cat <<EOF > "$PT_TMPDIR/expected"
       Specs | Adaptec 5805Z, SAS/SATA, 512 MB cache, Optimal
     Battery | ZMM Optimal

  LogicalDev Size      RAID Disks Stripe Status  Cache
  ========== ========= ==== ===== ====== ======= =======
  RAID10-A   121790 MB   10     4 256 KB Optimal On (WB)
  RAID1-A    285686 MB    1     0        Optimal On (WB)

  PhysiclDev State   Speed         Vendor  Model        Size        Cache
  ========== ======= ============= ======= ============ =========== =======
  Hard drive Full rpm,Powered off SATA 3.0 Gb/s INTEL   SSDSA2SH064G1GC 61057 MB    On (WB)
  Hard drive Full rpm,Powered off SATA 3.0 Gb/s INTEL   SSDSA2SH064G1GC 61057 MB    On (WB)
  Hard drive Full rpm,Powered off SATA 3.0 Gb/s INTEL   SSDSA2SH064G1GC 61057 MB    On (WB)
  Hard drive Full rpm,Powered off SATA 3.0 Gb/s INTEL   SSDSA2SH064G1GC 61057 MB    On (WB)
  Hard drive Full rpm,Powered off SAS 3.0 Gb/s  SEAGATE ST3300657SS  286102 MB   On (WB)
  Hard drive Full rpm,Powered off SAS 3.0 Gb/s  SEAGATE ST3300657SS  286102 MB   On (WB)
EOF
parse_arcconf "$samples/arcconf-003_900285.txt" > "$PT_TMPDIR/got"
no_diff "$PT_TMPDIR/got" "$PT_TMPDIR/expected" "Bug 900285"

# parse_uptime

cat <<EOF > "$PT_TMPDIR/in"
 15:10:14 up 1 day, 15:08, 11 users,  load average: 0.18, 0.09, 0.08
EOF
is \
   "$( parse_uptime "$PT_TMPDIR/in" )" \
   "1 day, 15:08, 11 users,  load average: 0.18, 0.09, 0.08" \
   "parse_uptime works with Ubuntu's uptime"

cat <<EOF > "$PT_TMPDIR/in"
 some weird format etc 1 day, 15:08, 11 users,  load average: 0.18, 0.09, 0.08
EOF
is \
   "$( parse_uptime "$PT_TMPDIR/in" )" \
   " some weird format etc 1 day, 15:08, 11 users,  load average: 0.18, 0.09, 0.08" \
   "parse_uptime returns uptime as-if if it doesn't contain an 'up'"

# parse_lvs

is \
   "$(format_lvs "" "")" \
   "Unable to collect information" \
   "format_lvs has a meaningful error message if all goes wrong"


echo "Pretending to be an lvs dump" > "$PT_TMPDIR/in"
is \
   "$(format_lvs "$PT_TMPDIR/in" "")" \
   "Pretending to be an lvs dump" \
   "format_lvs dumps the file passed in"

# report_system_summary
parse_options "$BIN_DIR/pt-summary"

cat <<EOF > "$PT_TMPDIR/expected"
    Hostname | 
      Uptime | 57 mins, 1 user, load averages: 0.16, 0.03, 0.07
    Platform | FreeBSD
     Release | 8.2-RELEASE
      Kernel | 199506
Architecture | CPU = 32-bit, OS = 32-bit
 Virtualized | No virtualization detected
# Processor ##################################################
  Processors | virtual = 1
      Speeds | 2109
      Models | AMD Athlon(tm) 64 X2 Dual Core Processor 4000+
# Memory #####################################################
       Total | 499.4M
     Virtual | 511.9M
        Used | 66.4M
     UsedRSS | 17.7M
# Mounted Filesystems ########################################
  Filesystem   Size Used Type    Opts                Mountpoint
  /dev/ad0s1a  620M  30% ufs     local               /
  /dev/ad0s1d  1.3G   0% ufs     local, soft-updates /var
  /dev/ad0s1e  341M   0% ufs     local, soft-updates /tmp
  /dev/ad0s1f  3.3G  32% ufs     local, soft-updates /usr
  /dev/da0s1   3.8G   0% msdosfs local               /mnt/usb
  devfs        1.0K 100% devfs   local, multilabel   /dev
  procfs       4.0K 100% procfs  local               /proc
# RAID Controller ############################################
  Controller | No RAID controller detected
# Top Processes ##############################################
  PID USERNAME  THR PRI NICE   SIZE    RES STATE    TIME   WCPU COMMAND
23318 root        1  76    0  3632K  1744K wait     0:00  0.98% sh
  447 root        1  44    0  1888K   584K select   0:00  0.00% devd
  945 root        1  44    0  4672K  2336K pause    0:00  0.00% csh
  556 root        1  44    0  3352K  1264K select   0:00  0.00% syslogd
  848 root        1  44    0  6092K  3164K select   0:00  0.00% sendmail
  859 root        1  44    0  3380K  1308K nanslp   0:00  0.00% cron
  931 root        1  44    0  3816K  1724K wait     0:00  0.00% login
  937 root        1  76    0  3352K  1096K ttyin    0:00  0.00% getty
  934 root        1  76    0  3352K  1096K ttyin    0:00  0.00% getty
# Notable Processes ##########################################
  PID    OOM    COMMAND
    ?      ?    sshd doesn't appear to be running
# Simplified and fuzzy rounded vmstat (wait please) ##########
 procs      memory      page                    disks     faults         cpu
 r b w     avm    fre   flt  re  pi  po    fr  sr ad0 da0   in   sy   cs us sy id
 1 0 0   63720  339504  1158   0   0   0  1022   0   0   0  246 1201  336 22 15 63
 0 0 0   58164  339792  7924   0   0   0  6663   0   4   3  242 5829  744 15 71 14
 0 0 0   58164  339792     0   0   0   0     0   0   0   0  230  107  231  0  9 91
 0 0 0   58164  339792     0   0   0   0     0   0   0   0  230  107  229  0  3 97
 0 0 0   58164  339792     0   0   0   0     0   0   0   0  231  115  229  0  5 95
# The End ####################################################
EOF
report_system_summary "$samples/BSD/freebsd_001" | tail -n +3 > "$PT_TMPDIR/got"
no_diff "$PT_TMPDIR/got" "$PT_TMPDIR/expected" "report_system_summary works with samples from a FreeBSD box"

cat <<EOF > "$PT_TMPDIR/expected"
    Hostname | 
      Uptime | 43 mins, 2 users, load averages: 0.00, 0.00, 0.00
    Platform | NetBSD
     Release | 5.1.2
      Kernel | 501000200
Architecture | CPU = 32-bit, OS = 32-bit
 Virtualized | No virtualization detected
# Processor ##################################################
  Processors | physical = 1, cores = 0, virtual = 1, hyperthreading = no
      Speeds | 1x2178.48
      Models | 1xAMD Athlon(tm) 64 X2 Dual Core Processor 4000+
      Caches | 
# Memory #####################################################
       Total | 127.6M
        User | 127.2M
        Swap | 64.5M
     UsedRSS | 10.6M
# Mounted Filesystems ########################################
  Filesystem  Size Used Type Opts                                                             Mountpoint
  /dev/sd0e   3.8G   0% yp   dev/sd0e 3.8G 17M 3.7G 0% /mnt/usb on /mnt/usb type msdos (local /mnt/usb
  /dev/wd0a   1.8G  30% yp   dev/wd0a 1.8G 545M 1.2G 30% / on / type ffs (local               /
  kernfs      1.0K 100% yp   ernfs 1.0K 1.0K 0B 100% /kern on /kern type kernfs (local        /kern
  procfs      4.0K 100% yp   rocfs 4.0K 4.0K 0B 100% /proc on /proc type procfs (local        /proc
  ptyfs       1.0K 100% yp   tyfs 1.0K 1.0K 0B 100% /dev/pts on /dev/pts type ptyfs (local    /dev/pts
# RAID Controller ############################################
  Controller | No RAID controller detected
# Top Processes ##############################################
  PID USERNAME PRI NICE   SIZE   RES STATE      TIME   WCPU    CPU COMMAND
    0 root     124    0     0K   20M syncer     0:01  0.00%  0.00% [system]
 3922 root      43    0  2976K  984K CPU        0:00  0.00%  0.00% top
  277 root      85    0  5592K 2232K wait       0:00  0.00%  0.00% login
  279 root      85    0  5592K 2164K wait       0:00  0.00%  0.00% login
 3501 root      85    0  2836K 1396K pause      0:00  0.00%  0.00% ksh
  284 root      85    0  2960K 1192K wait       0:00  0.00%  0.00% sh
 1957 root      85    0  2960K 1164K ttyraw     0:00  0.00%  0.00% sh
  116 root      85    0  2940K 1016K kqueue     0:00  0.00%  0.00% syslogd
  272 root      85    0  2920K  940K ttyraw     0:00  0.00%  0.00% getty
# Notable Processes ##########################################
  PID    OOM    COMMAND
    ?      ?    sshd doesn't appear to be running
# Simplified and fuzzy rounded vmstat (wait please) ##########
 procs    memory      page                       disks   faults      cpu
 r b w    avm    fre  flt  re  pi   po   fr   sr w0 c0   in   sy  cs us sy id
 2 0 0  78624  21544  103   0   0    0    0    0  6  0  113  154  33  0  2 98
 2 0 0  78652  21260 12425  0   0    0    0    0  0  0   92 6208 355 12 84  4
 0 0 0  78564  21364 1208   0   0    0    0    0  0  0   98  806  43  2  9 89
 0 0 0  78564  21364    0   0   0    0    0    0  0  0  101   11   9  0 0 100
 0 0 0  78564  21364    0   0   0    0    0    0  0  0  101   11  10  0 0 100
# The End ####################################################
EOF
report_system_summary "$samples/BSD/netbsd_001" | tail -n +3 > "$PT_TMPDIR/got"
no_diff "$PT_TMPDIR/got" "$PT_TMPDIR/expected" "netbsd_001"

cat <<EOF > "$PT_TMPDIR/expected"
    Hostname | openbsd.my.domain
      Uptime | 1:14, 1 user, load averages: 0.44, 0.20, 0.16
    Platform | OpenBSD
     Release | 5.0
      Kernel | 201111
Architecture | CPU = 32-bit, OS = 32-bit
 Virtualized | No virtualization detected
# Processor ##################################################
  Processors | 1
      Speeds | 2111
      Models | AMD 
# Memory #####################################################
       Total | 255.5M
        User | 255.5M
        Swap | 81.1M
     UsedRSS | 5.3M
# Mounted Filesystems ########################################
  Filesystem  Size Used Type Opts                                               Mountpoint
  /dev/sd0i   3.8G   0% yp   long                                               /mnt/usb
  /dev/wd0a   788M   6% yp   dev/wd0a 788M 42.5M 706M 6% / on / type ffs (local /
  /dev/wd0d   893M  48% yp   nodev                                              /usr
  /dev/wd0e   252M  37% yp   nodev, nosuid                                      /home
# RAID Controller ############################################
  Controller | No RAID controller detected
# Top Processes ##############################################
  PID USERNAME PRI NICE  SIZE   RES STATE     WAIT      TIME    CPU COMMAND
22422 root      18    0  888K 1012K sleep     pause     0:00  0.93% sh
20216 _pflogd    4    0  528K  312K sleep     bpf       0:01  0.00% pflogd
22982 root       2    0 1372K 1956K sleep     select    0:00  0.00% sendmail
26829 root      18    0  544K  532K sleep     pause     0:00  0.00% ksh
17299 _syslogd   2    0  524K  752K sleep     poll      0:00  0.00% syslogd
 7254 root       2    0  508K  872K idle      select    0:00  0.00% cron
    1 root      10    0  544K  324K idle      wait      0:00  0.00% init
28237 root       2    0  500K  696K idle      netio     0:00  0.00% syslogd
30259 root       3    0  408K  812K idle      ttyin     0:00  0.00% getty
# Notable Processes ##########################################
  PID    OOM    COMMAND
    ?      ?    sshd doesn't appear to be running
# Simplified and fuzzy rounded vmstat (wait please) ##########
 procs    memory       page                    disks    traps          cpu
 r b w    avm     fre  flt  re  pi  po  fr  sr wd0 cd0  int   sys   cs us sy id
 2 1 0   7608  191356   66   0   0   0   0   0   2   0  231   108   14  0  1 99
 1 1 0   7804  191192 9916   0   0   0   0   0   0   0  234 14726  315  9 90  1
 1 0 0   7600  191360 9461   0   0   0   0   0   0   0  256 14435  285  6 94  0
 0 0 0   7496  191456 1272   0   0   0   0   0   0   0  256  1973   50  2 12 85
 0 0 0   7496  191456   11   0   0   0   0   0   0   0  230    23   12  0  0 100
# The End ####################################################
EOF
report_system_summary "$samples/BSD/openbsd_001" | tail -n +3  > "$PT_TMPDIR/got"
no_diff "$PT_TMPDIR/got" "$PT_TMPDIR/expected" "openbsd_001"

cat <<EOF > "$PT_TMPDIR/expected"
    Hostname | hugmeir
      Uptime | 1 day, 15:14,  5 users,  load average: 0.00, 0.06, 0.07
      System | Quanta; UW3; vTBD (Other)
 Service Tag | 123456789
    Platform | Linux
     Release | Ubuntu 11.10 (oneiric)
      Kernel | 3.0.0-16-generic
Architecture | CPU = 32-bit, OS = 32-bit
   Threading | NPTL 2.13
     SELinux | No SELinux detected
 Virtualized | No virtualization detected
# Processor ##################################################
  Processors | physical = 1, cores = 1, virtual = 2, hyperthreading = yes
      Speeds | 1x1000.000, 1x1666.000
      Models | 2xIntel(R) Atom(TM) CPU N455 @ 1.66GHz
      Caches | 2x512 KB
# Memory #####################################################
       Total | 2.0G
        Free | 477.3M
        Used | physical = 1.5G, swap allocated = 2.0G, swap used = 0.0, virtual = 1.5G
     Buffers | 194.9M
      Caches | 726.8M
       Dirty | 144 kB
     UsedRSS | 1.1G
  Swappiness | 60
 DirtyPolicy | 20, 10
  Locator   Size     Speed             Form Factor   Type          Type Detail
  ========= ======== ================= ============= ============= ===========
  DIMM0     2048 MB  667 MHz (1.5 ns)  SODIMM        DDR2          Synchronous
# Mounted Filesystems ########################################
  Filesystem  Size Used Type       Opts                                                                                              Mountpoint
  /dev/sda7   333G  12% ext4       rw,errors=remount-ro,commit=0                                                                     /
  /dev/sdb1   3.8G   1% vfat       rw,nosuid,nodev,uid=1000,gid=1000,shortname=mixed,dmask=0077,utf8=1,showexec,flush,uhelper=udisks /media/PENDRIVE
  none       1002M   1% tmpfs      rw,noexec,nosuid,nodev,size=5242880                                                               /run/shm
  none       1002M   1% tmpfs      rw,nosuid,nodev                                                                                   /run/shm
  none       1002M   1% debugfs    rw                                                                                                /run/shm
  none       1002M   1% securityfs rw                                                                                                /run/shm
  none        5.0M   0% tmpfs      rw,noexec,nosuid,nodev,size=5242880                                                               /run/lock
  none        5.0M   0% tmpfs      rw,nosuid,nodev                                                                                   /run/lock
  none        5.0M   0% debugfs    rw                                                                                                /run/lock
  none        5.0M   0% securityfs rw                                                                                                /run/lock
  tmpfs       401M   1% tmpfs      rw,noexec,nosuid,size=10%,mode=0755                                                               /run
  udev        995M   1% devtmpfs   rw,mode=0755                                                                                      /dev
# Disk Schedulers And Queue Size #############################
         sda | [cfq] 128
         sdb | [cfq] 128
# Disk Partioning ############################################
Device       Type      Start        End               Size
============ ==== ========== ========== ==================
/dev/sda     Disk                             500107862016
/dev/sda1    Part       2048     206847          104857088
/dev/sda2    Part     206848   12494847         6291455488
/dev/sda3    Part   12494848  207808587       100000634368
/dev/sda4    Part  207810558  976771071       393707782656
/dev/sda5    Part  207810560  259807667        26622518784
/dev/sda6    Part  972603392  976771071         2133851648
/dev/sda7    Part  259809280  968421375       362809392640
/dev/sda8    Part  968423424  972591103         2133851648
/dev/sdb     Disk                               4041211904
/dev/sdb1    Part         63    7892991         4041179136
# Kernel Inode State #########################################
dentry-state | 78471 67588 45 0  0  0
     file-nr | 9248  0  203574
    inode-nr | 70996 10387
# LVM Volumes ################################################
  No volume groups found
# LVM Volume Groups ##########################################
Unable to collect information
# RAID Controller ############################################
  Controller | No RAID controller detected
# Network Config #############################################
  Controller | Realtek Semiconductor Co., Ltd. RTL8101E/RTL8102E PCI Express Fast Ethernet controller (rev 02)
 FIN Timeout | 60
  Port Range | 61000
# Interface Statistics #######################################
  interface  rx_bytes rx_packets  rx_errors   tx_bytes tx_packets  tx_errors
  ========= ========= ========== ========== ========== ========== ==========
  lo         25000000     350000          0   25000000     350000          0
  eth0              0          0          0          0          0          0
  wlan0             0          0          0          0          0          0
  virbr0            0          0          0          0          0          0
# Network Connections ########################################
  Connections from remote IP addresses
  Connections to local IP addresses
  Connections to top 10 local ports
  States of connections
    LISTEN              4
# Top Processes ##############################################
  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
 1548 hugmeir   20   0  122m  14m  10m S    2  0.7   1:44.97 gnome-settings-
 1567 hugmeir   20   0  257m  88m  22m S    2  4.4  83:35.58 compiz
 4455 hugmeir   20   0  283m  30m  21m S    2  1.5  30:42.87 knotify4
17394 hugmeir   20   0  118m  37m  26m S    2  1.9   0:29.35 kwrite
30819 root      20   0  2824 1144  844 R    2  0.1   0:00.03 top
    1 root      20   0  3328 1912 1248 S    0  0.1   0:01.55 init
    2 root      20   0     0    0    0 S    0  0.0   0:00.07 kthreadd
    3 root      20   0     0    0    0 S    0  0.0   0:05.54 ksoftirqd/0
    6 root      RT   0     0    0    0 S    0  0.0   0:00.00 migration/0
# Notable Processes ##########################################
  PID    OOM    COMMAND
    ?      ?    sshd doesn't appear to be running
  305    -17    udevd
29745    -17    udevd
29746    -17    udevd
# Simplified and fuzzy rounded vmstat (wait please) ##########
  procs  ---swap-- -----io---- ---system---- --------cpu--------
   r  b    si   so    bi    bo     ir     cs  us  sy  il  wa  st
   2  0     0    0     2     1    150     50   4   1  95   0    
   0  0     0    0     0     8    900   2250  28  26  46   0    
   0  0     0    0     0     0    200    200   1   0  99   0    
   1  0     0    0     0   150    225    225   1   1  95   3    
   0  0     0    0     0   150    250    250   1   0  99   0    
# The End ####################################################
EOF

report_system_summary "$samples/Linux/001" | tail -n +3 > "$PT_TMPDIR/got"
no_diff "$PT_TMPDIR/got" "$PT_TMPDIR/expected" "Linux/001 (Ubuntu)"

report_system_summary "$samples/Linux/002" | tail -n +3 > "$PT_TMPDIR/got"
no_diff "$PT_TMPDIR/got" "$samples/Linux/output_002.txt" "Linux/002 (CentOS 5.7, as root)"

report_system_summary "$samples/Linux/003" | tail -n +3 > "$PT_TMPDIR/got"
no_diff "$PT_TMPDIR/got" "$samples/Linux/output_003.txt" "Linux/003 (CentOS 5.7, as non-root)"

# pt-summary to show information about Fusion-io cards
# https://bugs.launchpad.net/percona-toolkit/+bug/952722

cat <<EOF > "$PT_TMPDIR/expected"
  fio Driver | 2.3.1 build 123
 ioDrive Duo | Fusion-io ioDrive Duo 640GB, Product Number:FS3-202-321-CS SN:40123
            fct0 | Attached as 'fioa' (block device)
                 | Fusion-io ioDrive Duo 640GB, Product Number:FS3-202-321-CS SN:06665
                 | Firmware v5.0.7, rev 101971
                 | Internal temperature: 47.7 degC, max 48.2 degC
                 | Media status: Healthy; Reserves: 100.00%, warn at 10.00%
            fct1 | Attached as 'fiob' (block device)
                 | Fusion-io ioDrive Duo 640GB, Product Number:FS3-202-321-CS SN:06478
                 | Firmware v5.0.7, rev 101971
                 | Internal temperature: 42.8 degC, max 47.7 degC
                 | Media status: Healthy; Reserves: 100.00%, warn at 10.00%
EOF

report_fio_minus_a "$samples/Linux/004/fio-001" > "$PT_TMPDIR/got"
no_diff \
   "$PT_TMPDIR/got" \
   "$PT_TMPDIR/expected" \
   "report_fio_minus_a works with one adapter and two modules"

cat <<EOF > "$PT_TMPDIR/expected"
  fio Driver | 2.3.1 build 123
     ioDrive | Fusion-io ioDrive 720GB, Product Number:FS1-003-721-CS SN:122210
            fct0 | Attached as 'fioa' (block device)
                 | Fusion-io ioDrive 720GB, Product Number:FS1-003-721-CS SN:122210
                 | Firmware v5.0.5, rev 43674
                 | Internal temperature: 53.2 degC, max 62.5 degC
                 | Media status: Healthy; Reserves: 100.00%, warn at 10.00%
EOF

report_fio_minus_a "$samples/Linux/004/fio-002" > "$PT_TMPDIR/got"

no_diff \
   "$PT_TMPDIR/got" \
   "$PT_TMPDIR/expected" \
   "report_fio_minus_a works with one adapter and one module"

cat <<EOF > "$PT_TMPDIR/expected"
  fio Driver | 2.3.1 build 123
 ioDrive Duo | Fusion-io ioDrive Duo 640GB, Product Number:FS3-202-321-CS SN:40123
            fct0 | Attached as 'fioa' (block device)
                 | Fusion-io ioDrive Duo 640GB, Product Number:FS3-202-321-CS SN:06665
                 | Firmware v5.0.7, rev 101971
                 | Internal temperature: 47.7 degC, max 48.2 degC
                 | Media status: Healthy; Reserves: 100.00%, warn at 10.00%
            fct1 | Attached as 'fiob' (block device)
                 | Fusion-io ioDrive Duo 640GB, Product Number:FS3-202-321-CS SN:06478
                 | Firmware v5.0.7, rev 101971
                 | Internal temperature: 42.8 degC, max 47.7 degC
                 | Media status: Healthy; Reserves: 100.00%, warn at 10.00%
 ioDrive Duo | Fusion-io ioDrive Duo 640GB, Product Number:FS3-202-321-CS SN:40124
            fct2 | Attached as 'fioc' (block device)
                 | Fusion-io ioDrive Duo 640GB, Product Number:FS3-202-321-CS SN:06665
                 | Firmware v5.0.7, rev 101971
                 | Internal temperature: 47.7 degC, max 48.2 degC
                 | Media status: Healthy; Reserves: 100.00%, warn at 10.00%
            fct3 | Attached as 'fiod' (block device)
                 | Fusion-io ioDrive Duo 640GB, Product Number:FS3-202-321-CS SN:06478
                 | Firmware v5.0.7, rev 101971
                 | Internal temperature: 42.8 degC, max 47.7 degC
                 | Media status: Healthy; Reserves: 100.00%, warn at 10.00%
EOF

report_fio_minus_a "$samples/Linux/004/fio-003" > "$PT_TMPDIR/got"

no_diff \
   "$PT_TMPDIR/got" \
   "$PT_TMPDIR/expected" \
   "report_fio_minus_a works with two adapters, each with two modules"

cat <<EOF > "$PT_TMPDIR/expected"
  fio Driver | 3.1.5 build 126
Dual Controller Adapter | Fusion-io ioDrive2 Duo 2.41TB, Product Number:F01-001-2T41-CS-0001, SN:1150D0121, FIO SN:1150D0121
            fct0 | Attached as 'fioa' (block device)
                 | SN:1150D0121-1121
                 | Firmware v7.0.0, rev 107322 Public
                 | Internal temperature: 51.68 degC, max 58.08 degC
                 | Reserve space status: Healthy; Reserves: 100.00%, warn at 10.00%
                 | Rated PBW: 17.00 PB, 98.41% remaining
            fct1 | Attached as 'fiob' (block device)
                 | SN:1150D0121-1111
                 | Firmware v7.0.0, rev 107322 Public
                 | Internal temperature: 46.76 degC, max 51.19 degC
                 | Reserve space status: Healthy; Reserves: 100.00%, warn at 10.00%
                 | Rated PBW: 17.00 PB, 98.95% remaining
EOF

report_fio_minus_a "$samples/Linux/004/fio-004" > "$PT_TMPDIR/got"

no_diff \
   "$PT_TMPDIR/got" \
   "$PT_TMPDIR/expected" \
   "report_fio_minus_a works with Dual Controller Adapter / ioMemory modules"