sosreport-3.5/ 0000755 0001750 0001750 00000000000 13203300002 013232 5 ustar caribou caribou sosreport-3.5/.coverage 0000644 0001750 0001750 00000072117 13203273413 015055 0 ustar caribou caribou !coverage.py: This is a private format, don't read it directly!{"lines": {"/home/caribou/git/sosreport/sos/plugins/yum.py": [15, 18, 20, 22, 23, 25, 26, 29, 30, 31, 34], "/home/caribou/git/sosreport/sos/plugins/hardware.py": [15, 18, 20, 22, 23, 25], "/home/caribou/git/sosreport/sos/plugins/ppp.py": [17, 20, 22, 24, 25, 27, 29], "/home/caribou/git/sosreport/sos/plugins/quagga.py": [17, 20, 22, 24, 25, 27, 28, 30], "/home/caribou/git/sosreport/sos/plugins/openstack_ansible.py": [36, 17, 20, 21, 23, 24, 25, 27], "/home/caribou/git/sosreport/sos/plugins/sssd.py": [17, 20, 22, 24, 25, 26, 28, 44, 51, 53, 57, 59], "/home/caribou/git/sosreport/sos/plugins/pcp.py": [17, 18, 19, 20, 23, 25, 27, 28, 29, 31, 34, 36, 37, 38, 40, 42, 50, 77], "/home/caribou/git/sosreport/sos/__init__.py": [34, 35, 37, 22, 24, 26, 28, 29, 31], "/home/caribou/git/sosreport/sos/plugins/openstack_manila.py": [71, 74, 17, 20, 22, 23, 24, 25, 27, 38, 50, 51, 58, 62, 63], "/home/caribou/git/sosreport/sos/plugins/virsh.py": [15, 16, 17, 20, 22, 24, 25, 27, 29], "/home/caribou/git/sosreport/sos/plugins/opencl.py": [15, 18, 20, 22, 23, 24, 26], "/home/caribou/git/sosreport/sos/plugins/ntp.py": [15, 18, 20, 22, 23, 25, 27, 39, 41, 47, 49], "/home/caribou/git/sosreport/sos/plugins/distupgrade.py": [35, 38, 17, 20, 21, 23, 24, 26, 29], "/home/caribou/git/sosreport/sos/plugins/ldap.py": [15, 18, 20, 22, 23, 24, 26, 30, 34, 36, 37, 39, 55, 69, 71, 72, 74, 96], "/home/caribou/git/sosreport/sos/plugins/sar.py": [15, 16, 19, 21, 23, 24, 26, 27, 28, 29, 32, 34, 77, 79, 82, 84], "/home/caribou/git/sosreport/sos/plugins/cman.py": [65, 15, 16, 17, 20, 22, 24, 25, 28, 29, 30, 33, 35, 36, 38], "/home/caribou/git/sosreport/sos/plugins/openshift.py": [15, 16, 25, 26, 28, 29, 34, 35, 37, 38, 39, 41, 42, 43, 44, 46, 49, 52, 117], "/home/caribou/git/sosreport/sos/plugins/lilo.py": [15, 18, 20, 22, 23, 24, 26], "/home/caribou/git/sosreport/sos/plugins/rhui.py": [15, 18, 20, 22, 23, 25, 27, 28, 30], "/home/caribou/git/sosreport/sos/plugins/apt.py": [17, 20, 22, 24, 25, 27], "/home/caribou/git/sosreport/sos/plugins/cgroups.py": [37, 39, 15, 18, 20, 22, 23, 24, 26], "/home/caribou/git/sosreport/sos/plugins/symcli.py": [37, 28, 17, 18, 21, 89, 23, 25, 26, 92], "/home/caribou/git/sosreport/sos/plugins/openstack_keystone.py": [68, 73, 77, 18, 19, 22, 24, 25, 26, 28, 30, 83, 57], "/home/caribou/git/sosreport/sos/plugins/vhostmd.py": [15, 16, 19, 21, 23, 24, 26, 28], "/home/caribou/git/sosreport/sos/plugins/acpid.py": [32, 15, 18, 19, 20, 21, 24, 25, 31], "/home/caribou/git/sosreport/sos/plugins/nis.py": [15, 18, 20, 22, 23, 25, 27], "/home/caribou/git/sosreport/sos/plugins/block.py": [15, 16, 19, 21, 23, 24, 26], "/home/caribou/git/sosreport/sos/plugins/grub.py": [35, 15, 18, 20, 22, 23, 24, 26], "/home/caribou/git/sosreport/sos/plugins/kpatch.py": [16, 17, 20, 22, 24, 26, 28], "/home/caribou/git/sosreport/sos/plugins/dpkg.py": [16, 19, 21, 23, 24, 26], "/home/caribou/git/sosreport/sos/plugins/usb.py": [15, 18, 20, 22, 23, 25], "/home/caribou/git/sosreport/sos/plugins/named.py": [15, 16, 19, 21, 23, 24, 25, 26, 28, 40, 50, 56, 58, 60, 61, 62, 64, 73, 75, 76, 77, 78, 79, 80, 82], "/home/caribou/git/sosreport/sos/plugins/ceph_ansible.py": [15, 18, 20, 22, 23, 25, 27], "/home/caribou/git/sosreport/sos/plugins/keepalived.py": [16, 19, 21, 23, 24, 26, 28], "/home/caribou/git/sosreport/sos/plugins/nscd.py": [17, 20, 22, 24, 25, 27, 28, 30], "/home/caribou/git/sosreport/sos/plugins/etcd.py": [17, 20, 23, 25], "/home/caribou/git/sosreport/sos/plugins/manageiq.py": [20, 22, 25, 27, 29, 31, 33, 35, 36, 37, 41, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 67, 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, 101], "/home/caribou/git/sosreport/sos/policies/ubuntu.py": [1, 3, 4, 7, 8, 9, 10, 12, 13, 14, 16, 20, 21, 22, 26], "/home/caribou/git/sosreport/sos/plugins/lsbrelease.py": [16, 19, 21, 23, 24, 26], "/home/caribou/git/sosreport/sos/policies/osx.py": [1, 2, 5, 7, 9, 11, 12], "/home/caribou/git/sosreport/sos/plugins/subscription_manager.py": [15, 18, 20, 22, 23, 25, 26, 28], "/home/caribou/git/sosreport/sos/plugins/satellite.py": [15, 18, 20, 22, 23, 24, 25, 27, 29, 38, 42], "/home/caribou/git/sosreport/sos/plugins/unity.py": [15, 18, 20, 22, 23, 27, 30], "/home/caribou/git/sosreport/sos/plugins/redis.py": [41, 17, 20, 22, 24, 25, 27, 28, 30], "/home/caribou/git/sosreport/sos/plugins/scsi.py": [15, 18, 20, 22, 23, 25], "/home/caribou/git/sosreport/sos/plugins/ptp.py": [17, 20, 22, 24, 25, 27, 29], "/home/caribou/git/sosreport/sos/plugins/navicli.py": [67, 17, 18, 22, 25, 27, 29, 30, 32, 35, 46], "/home/caribou/git/sosreport/sos/plugins/apache.py": [22, 15, 18, 83, 84, 21, 86, 25, 28, 33, 37, 40, 20], "/home/caribou/git/sosreport/sos/plugins/pci.py": [15, 18, 20, 22, 23, 25], "/home/caribou/git/sosreport/sos/plugins/tomcat.py": [15, 16, 50, 19, 21, 23, 24, 26, 28], "/home/caribou/git/sosreport/sos/plugins/pam.py": [15, 18, 20, 22, 23, 24, 26, 38, 39, 41, 45, 46, 48], "/home/caribou/git/sosreport/sos/plugins/tftpserver.py": [17, 20, 22, 24, 25, 27, 28, 30], "/home/caribou/git/sosreport/sos/plugins/sapnw.py": [139, 15, 16, 19, 27, 28, 30, 31, 33, 35, 100], "/home/caribou/git/sosreport/sos/plugins/grub2.py": [44, 15, 18, 20, 22, 23, 24, 26], "/home/caribou/git/sosreport/sos/plugins/services.py": [15, 18, 20, 22, 23, 25, 26, 28, 41, 43, 48, 50], "/home/caribou/git/sosreport/sos/plugins/kernel.py": [15, 16, 17, 20, 22, 24, 25, 27, 29], "/home/caribou/git/sosreport/sos/plugins/rpm.py": [15, 18, 20, 22, 23, 25, 26, 27, 30, 31, 32, 33, 34, 37], "/home/caribou/git/sosreport/sos/plugins/qpid.py": [15, 18, 20, 22, 23, 25, 26, 28, 30, 31, 33], "/home/caribou/git/sosreport/sos/plugins/ipa.py": [135, 17, 18, 19, 22, 24, 26, 27, 29, 30, 32, 33, 35, 44, 50, 55, 73, 78], "/home/caribou/git/sosreport/sos/plugins/dbus.py": [15, 18, 19, 21, 22, 24], "/home/caribou/git/sosreport/sos/plugins/upstart.py": [17, 20, 22, 24, 25, 26, 28], "/home/caribou/git/sosreport/sos/plugins/ds.py": [32, 41, 18, 19, 22, 24, 26, 27, 29, 30], "/home/caribou/git/sosreport/sos/plugins/processor.py": [15, 18, 20, 22, 23, 24, 25, 27], "/home/caribou/git/sosreport/sos/plugins/java.py": [15, 18, 19, 21, 22, 24], "/home/caribou/git/sosreport/sos/plugins/gdm.py": [15, 18, 20, 22, 23, 25], "/home/caribou/git/sosreport/sos/plugins/anaconda.py": [15, 16, 49, 19, 21, 23, 24, 28, 31], "/home/caribou/git/sosreport/sos/plugins/boot.py": [15, 16, 19, 21, 23, 24, 27, 30], "/home/caribou/git/sosreport/sos/plugins/virtwho.py": [15, 18, 20, 22, 23, 24, 26, 29], "/home/caribou/git/sosreport/sos/plugins/insights.py": [36, 15, 18, 20, 21, 22, 23, 24, 26], "/home/caribou/git/sosreport/sos/plugins/omsa.py": [16, 19, 21, 23, 24, 26, 27, 29, 31], "/home/caribou/git/sosreport/sos/plugins/foreman.py": [17, 20, 22, 24, 25, 26, 28], "/home/caribou/git/sosreport/sos/plugins/snmp.py": [17, 20, 22, 23, 24, 26, 28, 32, 34, 36, 40, 42, 44], "/home/caribou/git/sosreport/sos/plugins/nodejs.py": [36, 40, 41, 17, 21, 22, 24, 25, 27, 29], "/home/caribou/git/sosreport/sos/policies/suse.py": [17, 18, 19, 21, 22, 23, 26, 27, 28, 29, 30, 32, 52, 57, 59, 81, 86, 90, 91, 92, 93, 94, 105, 107, 110, 114], "/home/caribou/git/sosreport/sos/plugins/monit.py": [18, 19, 22, 24, 25, 26, 27, 31, 32, 33, 36, 38, 40, 44], "/home/caribou/git/sosreport/sos/plugins/pacemaker.py": [72, 15, 16, 17, 20, 21, 23, 24, 25, 28, 29, 32], "/home/caribou/git/sosreport/sos/plugins/salt.py": [15, 18, 20, 22, 23, 25, 27], "/home/caribou/git/sosreport/sos/plugins/process.py": [15, 18, 20, 22, 23, 25], "/home/caribou/git/sosreport/sos/plugins/nfsganesha.py": [15, 18, 20, 21, 22, 23, 25], "/home/caribou/git/sosreport/sos/plugins/openstack_trove.py": [18, 21, 23, 25, 26, 27, 29, 42, 54, 57, 58, 59, 60, 63, 67, 69, 71], "/home/caribou/git/sosreport/sos/plugins/openstack_nova.py": [128, 130, 146, 149, 22, 23, 153, 26, 28, 29, 30, 32, 75, 89, 91, 113, 116, 120], "/home/caribou/git/sosreport/sos/plugins/s390.py": [34, 17, 20, 22, 24, 25, 29], "/home/caribou/git/sosreport/sos/plugins/vulkan.py": [15, 18, 20, 22, 23, 24, 26], "/home/caribou/git/sosreport/sos/plugins/python.py": [17, 20, 22, 24, 25, 27, 29], "/home/caribou/git/sosreport/sos/plugins/teamd.py": [39, 16, 19, 21, 23, 24, 26, 28], "/home/caribou/git/sosreport/sos/plugins/networking.py": [15, 16, 17, 20, 22, 23, 24, 25, 27, 28, 32, 34, 52, 95, 64, 324, 333, 334, 336, 82, 350, 351, 353, 107, 115, 122], "/home/caribou/git/sosreport/sos/plugins/grafana.py": [48, 17, 20, 22, 23, 24, 26, 28], "/home/caribou/git/sosreport/sos/plugins/smartcard.py": [17, 20, 22, 24, 25, 27, 28, 30], "/home/caribou/git/sosreport/sos/plugins/dhcp.py": [15, 18, 20, 22, 23, 26, 28, 29, 31, 39, 41, 42, 44], "/home/caribou/git/sosreport/sos/sosreport.py": [4, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 39, 40, 41, 42, 43, 47, 48, 49, 51, 52, 54, 57, 60, 78, 80, 81, 82, 84, 85, 87, 88, 89, 91, 105, 107, 109, 124, 126, 127, 128, 129, 131, 133, 141, 144, 146, 148, 149, 150, 151, 152, 153, 155, 156, 162, 163, 187, 212, 219, 232, 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, 261, 263, 264, 265, 269, 274, 276, 277, 280, 287, 289, 290, 293, 298, 300, 301, 303, 308, 310, 311, 314, 319, 321, 322, 325, 330, 332, 333, 336, 341, 343, 345, 346, 349, 356, 362, 369, 375, 383, 389, 396, 402, 409, 411, 412, 415, 422, 428, 435, 437, 438, 441, 448, 450, 451, 454, 461, 467, 472, 478, 483, 485, 486, 489, 494, 496, 497, 500, 505, 507, 508, 511, 516, 518, 519, 522, 527, 533, 540, 542, 543, 546, 551, 553, 554, 557, 566, 572, 577, 580, 581, 582, 583, 584, 585, 586, 587, 588, 589, 590, 591, 592, 593, 594, 595, 596, 597, 598, 600, 601, 602, 603, 605, 606, 607, 608, 609, 610, 611, 612, 613, 614, 615, 616, 618, 619, 620, 621, 622, 623, 624, 625, 626, 627, 628, 629, 631, 632, 633, 634, 635, 636, 637, 638, 639, 640, 641, 642, 644, 645, 646, 647, 648, 649, 650, 651, 652, 653, 654, 655, 656, 657, 658, 659, 660, 661, 663, 664, 665, 667, 669, 672, 674, 676, 677, 678, 679, 680, 681, 682, 683, 684, 685, 686, 687, 689, 690, 691, 695, 696, 697, 699, 700, 704, 707, 709, 710, 717, 720, 721, 723, 725, 727, 728, 730, 733, 736, 738, 744, 745, 746, 748, 749, 750, 751, 752, 753, 754, 755, 756, 757, 758, 759, 760, 761, 764, 765, 767, 777, 782, 783, 784, 785, 787, 788, 792, 794, 810, 814, 815, 818, 820, 826, 827, 828, 829, 833, 834, 835, 836, 844, 846, 847, 848, 849, 850, 851, 852, 853, 855, 856, 857, 858, 861, 865, 866, 869, 870, 871, 872, 873, 874, 876, 878, 879, 880, 881, 882, 884, 896, 897, 898, 901, 903, 904, 905, 906, 913, 914, 915, 917, 918, 919, 920, 922, 927, 931, 932, 933, 934, 935, 938, 944, 946, 947, 948, 949, 950, 951, 952, 953, 955, 957, 958, 959, 962, 963, 964, 965, 966, 968, 970, 972, 973, 980, 981, 982, 983, 984, 987, 989, 990, 994, 998, 999, 1000, 1024, 1030, 1031, 1037, 1038, 1039, 1040, 1042, 1045, 1088, 1089, 1090, 1091, 1092, 1099, 1100, 1106, 1116, 1168, 1190, 1202, 1211, 1245, 1266, 1279, 1313, 1332, 1371, 1382, 1442, 1457, 1467, 1474, 1570, 1571, 1572, 1573, 1576, 1579, 1580, 1581, 1582, 1583, 1584, 1585, 1586, 1587, 1589, 1592, 1597, 1598, 1629, 1631, 1632], "/home/caribou/git/sosreport/sos/plugins/openstack_horizon.py": [20, 23, 25, 27, 28, 29, 31, 45, 58, 63, 66, 71, 76, 79, 84, 88, 91], "/home/caribou/git/sosreport/sos/plugins/powerpc.py": [32, 18, 19, 22, 24, 26, 27, 29], "/home/caribou/git/sosreport/sos/policies/__init__.py": [1, 3, 4, 5, 6, 7, 8, 9, 11, 14, 15, 16, 17, 18, 21, 22, 23, 24, 25, 26, 29, 30, 31, 33, 34, 35, 36, 37, 38, 40, 43, 46, 55, 57, 58, 60, 61, 62, 63, 64, 67, 71, 73, 77, 78, 80, 84, 85, 88, 90, 98, 99, 100, 101, 104, 113, 115, 119, 120, 121, 123, 130, 132, 147, 149, 150, 151, 152, 153, 155, 156, 158, 164, 165, 166, 167, 168, 169, 170, 172, 173, 175, 176, 178, 181, 182, 183, 184, 187, 194, 197, 199, 200, 202, 208, 216, 226, 227, 229, 231, 232, 233, 237, 238, 239, 241, 245, 246, 248, 249, 251, 257, 263, 264, 266, 268, 269, 270, 271, 272, 273, 275, 276, 278, 279, 281, 282, 284, 287, 289, 294, 321, 330, 346, 348, 350, 354, 356, 358, 359, 360, 362, 364, 365, 367, 386, 395, 398, 401, 404, 407, 411, 414, 417], "/home/caribou/git/sosreport/sos/plugins/cobbler.py": [15, 18, 19, 22, 24, 26, 27, 29, 38, 40, 42], "/home/caribou/git/sosreport/sos/plugins/kernelrt.py": [17, 20, 22, 24, 25, 29, 31], "/home/caribou/git/sosreport/sos/plugins/corosync.py": [71, 73, 77, 15, 16, 17, 82, 20, 22, 24, 25, 26, 79, 28, 63], "/home/caribou/git/sosreport/sos/plugins/npm.py": [16, 17, 19, 23, 26, 28, 29, 30, 34, 37, 39, 48, 87, 102, 105, 109], "/home/caribou/git/sosreport/sos/plugins/krb5.py": [17, 20, 22, 23, 24, 25, 27], "/home/caribou/git/sosreport/sos/plugins/haproxy.py": [16, 19, 21, 23, 24, 26, 28], "/home/caribou/git/sosreport/sos/plugins/md.py": [15, 18, 20, 22, 23, 25], "/home/caribou/git/sosreport/sos/plugins/devicemapper.py": [15, 18, 20, 22, 23, 25], "/home/caribou/git/sosreport/sos/plugins/sysvipc.py": [16, 19, 21, 23, 24, 26], "/home/caribou/git/sosreport/sos/plugins/kimchi.py": [17, 20, 22, 24, 25, 27], "/home/caribou/git/sosreport/sos/plugins/abrt.py": [33, 38, 17, 20, 22, 24, 25, 26, 27, 30], "/home/caribou/git/sosreport/sos/plugins/pxe.py": [15, 18, 20, 21, 22, 23, 24, 27, 29, 30, 32, 40, 42, 44], "/home/caribou/git/sosreport/sos/plugins/soundcard.py": [34, 36, 45, 15, 18, 20, 22, 23, 25, 47], "/home/caribou/git/sosreport/sos/plugins/origin.py": [17, 18, 165, 41, 42, 44, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 57, 190, 192, 194, 67, 71, 75, 97], "/home/caribou/git/sosreport/sos/plugins/powerpath.py": [43, 16, 56, 19, 21, 23, 24, 25, 27], "/home/caribou/git/sosreport/sos/plugins/openstack_ceilometer.py": [66, 70, 79, 21, 24, 25, 26, 27, 29, 31, 43, 56, 57], "/home/caribou/git/sosreport/sos/plugins/gluster.py": [15, 16, 17, 18, 19, 20, 23, 24, 26, 27, 29, 30, 31, 33, 47, 58, 70, 81], "/home/caribou/git/sosreport/sos/plugins/jars.py": [17, 18, 19, 20, 21, 22, 23, 26, 27, 29, 30, 31, 34, 45, 48, 79, 95, 123], "/home/caribou/git/sosreport/sos/plugins/dovecot.py": [15, 18, 20, 22, 23, 25, 30, 32, 33, 36, 37, 40, 42, 43, 46], "/home/caribou/git/sosreport/sos/plugins/ssh.py": [17, 20, 22, 24, 25, 27], "/home/caribou/git/sosreport/sos/plugins/gnocchi.py": [34, 36, 18, 19, 22, 23, 24, 26, 31, 63], "/home/caribou/git/sosreport/sos/plugins/openstack_sahara.py": [17, 20, 21, 22, 23, 25, 27, 42, 53, 54, 61, 64, 68, 69, 75, 78], "/home/caribou/git/sosreport/sos/plugins/ssmtp.py": [35, 16, 19, 21, 23, 24, 26, 28], "/home/caribou/git/sosreport/sos/plugins/openstack_swift.py": [65, 69, 78, 20, 23, 24, 25, 26, 28, 30, 43, 55], "/home/caribou/git/sosreport/sos/plugins/filesys.py": [15, 18, 20, 22, 23, 56, 25, 26, 27, 29], "/home/caribou/git/sosreport/sos/plugins/libvirt.py": [71, 15, 16, 17, 20, 22, 24, 25, 27], "/home/caribou/git/sosreport/sos/plugins/ctdb.py": [16, 47, 48, 19, 21, 22, 23, 24, 26], "/home/caribou/git/sosreport/sos/plugins/apport.py": [16, 19, 21, 23, 24, 26], "/home/caribou/git/sosreport/sos/plugins/system.py": [15, 18, 20, 22, 23, 25], "/home/caribou/git/sosreport/sos/plugins/openstack_cinder.py": [21, 24, 26, 27, 28, 30, 31, 33, 50, 68, 70, 78, 81, 85, 89, 91, 94, 96, 100], "/home/caribou/git/sosreport/sos/plugins/logs.py": [66, 69, 72, 15, 16, 19, 20, 22, 23, 25, 91, 93, 53], "/home/caribou/git/sosreport/sos/plugins/ovirt_hosted_engine.py": [32, 33, 35, 36, 38, 18, 21, 24, 25, 29], "/home/caribou/git/sosreport/sos/plugins/lightdm.py": [17, 20, 22, 23, 24, 25, 27], "/home/caribou/git/sosreport/sos/plugins/mysql.py": [15, 16, 19, 21, 23, 24, 25, 27, 30, 31, 32, 35, 81, 87, 90, 99, 105, 108], "/home/caribou/git/sosreport/sos/plugins/hpasm.py": [16, 19, 21, 23, 24, 26, 28], "/home/caribou/git/sosreport/sos/policies/ibmkvm.py": [19, 21, 22, 24, 27, 28, 29, 30, 32, 36, 40, 42, 52, 53, 54, 55, 57, 61, 65, 67], "/home/caribou/git/sosreport/sos/plugins/xfs.py": [15, 16, 19, 21, 23, 24, 26, 28], "/home/caribou/git/sosreport/sos/plugins/dmraid.py": [35, 37, 15, 18, 20, 22, 23, 25], "/home/caribou/git/sosreport/sos/plugins/landscape.py": [45, 15, 18, 20, 22, 23, 24, 25, 27], "/home/caribou/git/sosreport/sos/plugins/zfs.py": [16, 19, 21, 23, 24, 26, 28], "/home/caribou/git/sosreport/sos/plugins/devices.py": [15, 18, 20, 22, 23, 25], "/home/caribou/git/sosreport/sos/plugins/mrgmessg.py": [15, 18, 20, 22, 23, 25], "/home/caribou/git/sosreport/sos/plugins/x11.py": [15, 18, 20, 22, 23, 25, 27], "/home/caribou/git/sosreport/sos/plugins/sunrpc.py": [34, 39, 41, 17, 20, 22, 24, 25, 26, 28], "/home/caribou/git/sosreport/sos/plugins/samba.py": [54, 15, 18, 20, 21, 22, 23, 25, 52], "/home/caribou/git/sosreport/sos/plugins/storageconsole.py": [15, 18, 20, 22, 23, 25, 27], "/home/caribou/git/sosreport/sos/plugins/maas.py": [17, 20, 22, 24, 25, 28, 29, 30, 31, 32, 35, 39, 47], "/home/caribou/git/sosreport/sos/plugins/veritas.py": [34, 15, 16, 19, 21, 23, 24, 29, 31], "/home/caribou/git/sosreport/sos/plugins/infiniband.py": [17, 20, 22, 24, 25, 26, 28], "/home/caribou/git/sosreport/sos/plugins/openstack_heat.py": [67, 76, 80, 18, 19, 22, 89, 24, 25, 26, 28, 30, 57], "/home/caribou/git/sosreport/sos/plugins/cups.py": [15, 18, 20, 22, 23, 25, 27], "/home/caribou/git/sosreport/sos/plugins/saltmaster.py": [15, 18, 20, 22, 23, 25, 27], "/home/caribou/git/sosreport/sos/plugins/ovirt.py": [19, 20, 21, 24, 28, 29, 31, 32, 41, 44, 45, 53, 57, 62, 63, 64, 65, 68, 111], "/home/caribou/git/sosreport/sos/plugins/systemtap.py": [17, 20, 22, 24, 25, 27, 28, 30], "/home/caribou/git/sosreport/sos/plugins/mpt.py": [17, 20, 22, 23, 24, 25, 27], "/home/caribou/git/sosreport/sos/plugins/multipath.py": [15, 18, 20, 22, 23, 25], "/home/caribou/git/sosreport/sos/plugins/nfs.py": [15, 18, 20, 21, 22, 23, 25], "/home/caribou/git/sosreport/sos/plugins/ata.py": [15, 16, 19, 21, 23, 24, 26, 28], "/home/caribou/git/sosreport/sos/plugins/postfix.py": [15, 18, 20, 21, 22, 24, 26, 34, 36, 37, 39, 44, 46, 48], "/home/caribou/git/sosreport/sos/plugins/postgresql.py": [136, 138, 20, 21, 23, 24, 27, 28, 30, 31, 33, 35, 37, 40, 41, 42, 43, 44, 45, 48, 83, 96, 108, 110], "/home/caribou/git/sosreport/sos/plugins/vsftpd.py": [15, 18, 20, 22, 23, 25, 26, 28], "/home/caribou/git/sosreport/sos/plugins/openstack_neutron.py": [18, 19, 22, 24, 25, 26, 28, 53, 68, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 83, 86, 91, 94, 95, 97, 98, 99, 100, 101, 102, 103, 105, 106, 107, 108, 111, 114], "/home/caribou/git/sosreport/sos/plugins/opengl.py": [15, 18, 20, 22, 23, 24, 26], "/home/caribou/git/sosreport/sos/plugins/lstopo.py": [15, 16, 19, 21, 23, 24, 25, 27], "/home/caribou/git/sosreport/sos/plugins/dracut.py": [17, 20, 21, 23, 24, 26], "/home/caribou/git/sosreport/sos/plugins/collectd.py": [45, 16, 17, 20, 23, 24, 25, 27, 29], "/home/caribou/git/sosreport/sos/plugins/azure.py": [17, 20, 22, 24, 25, 26, 28], "/home/caribou/git/sosreport/sos/plugins/openstack_ironic.py": [18, 19, 22, 24, 25, 26, 28, 53, 65, 68, 69, 70, 73, 77, 80, 81, 82, 86, 87, 90], "/home/caribou/git/sosreport/sos/plugins/__init__.py": [17, 19, 21, 23, 24, 25, 26, 27, 28, 29, 30, 33, 34, 37, 43, 45, 46, 47, 48, 49, 52, 53, 54, 55, 56, 57, 60, 61, 64, 79, 102, 104, 105, 106, 107, 108, 109, 110, 111, 113, 114, 115, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 130, 131, 134, 135, 136, 137, 139, 144, 145, 146, 148, 149, 151, 154, 157, 158, 160, 161, 163, 164, 166, 167, 168, 169, 171, 172, 174, 176, 178, 179, 181, 185, 187, 189, 223, 262, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 287, 289, 303, 306, 308, 309, 312, 314, 322, 324, 325, 327, 329, 331, 337, 338, 341, 342, 347, 348, 349, 350, 352, 353, 354, 355, 356, 357, 365, 366, 367, 368, 369, 370, 371, 373, 374, 375, 376, 378, 385, 390, 391, 392, 394, 395, 397, 398, 400, 401, 402, 403, 404, 406, 407, 408, 410, 411, 412, 415, 423, 426, 430, 432, 433, 434, 435, 438, 442, 443, 445, 446, 448, 452, 454, 455, 456, 457, 459, 461, 470, 472, 475, 476, 477, 479, 481, 482, 483, 484, 485, 487, 488, 489, 490, 492, 494, 498, 499, 500, 501, 502, 503, 505, 506, 508, 514, 515, 517, 518, 520, 521, 523, 524, 527, 528, 530, 531, 532, 533, 535, 536, 537, 539, 540, 541, 542, 543, 544, 546, 547, 549, 550, 551, 552, 553, 554, 555, 556, 558, 559, 586, 587, 594, 601, 602, 603, 616, 617, 618, 629, 642, 649, 653, 671, 673, 674, 675, 677, 678, 679, 716, 724, 730, 736, 737, 797, 798, 800, 801, 802, 803, 805, 806, 824, 825, 839, 841, 842, 843, 844, 845, 846, 848, 850, 851, 852, 857, 867, 868, 869, 871, 872, 874, 875, 876, 878, 883, 890, 895, 949, 950, 951, 954, 955, 956, 959, 960, 961, 964, 965, 966, 969, 970, 971, 974, 975, 976, 979, 980, 981, 984, 985, 986, 989, 994, 995, 997], "/home/caribou/git/sosreport/sos/plugins/ipmitool.py": [16, 19, 21, 23, 24, 26, 28], "/home/caribou/git/sosreport/sos/plugins/saphana.py": [15, 16, 19, 20, 22, 23, 25, 27], "/home/caribou/git/sosreport/sos/plugins/nfsserver.py": [45, 17, 18, 19, 22, 24, 26, 27, 29], "/home/caribou/git/sosreport/sos/plugins/libraries.py": [15, 18, 20, 22, 23, 26, 29], "/home/caribou/git/sosreport/sos/plugins/dlm.py": [70, 15, 16, 17, 20, 21, 23, 24, 25, 27, 30, 31, 33, 45, 60], "/home/caribou/git/sosreport/sos/plugins/general.py": [15, 18, 19, 21, 22, 24, 42, 44, 53, 58, 60], "/home/caribou/git/sosreport/sos/plugins/cron.py": [15, 18, 20, 22, 23, 25, 27], "/home/caribou/git/sosreport/sos/plugins/openvswitch.py": [97, 99, 17, 20, 22, 23, 24, 26, 92, 94], "/home/caribou/git/sosreport/sos/plugins/rabbitmq.py": [15, 18, 20, 21, 22, 23, 24, 26], "/home/caribou/git/sosreport/sos/plugins/dnf.py": [33, 17, 20, 21, 22, 23, 25, 26, 29, 30], "/home/caribou/git/sosreport/sos/plugins/tuned.py": [17, 20, 22, 23, 24, 25, 27], "/home/caribou/git/sosreport/sos/plugins/numa.py": [16, 17, 20, 22, 24, 25, 27, 29], "/home/caribou/git/sosreport/sos/plugins/memory.py": [15, 18, 20, 22, 23, 25], "/home/caribou/git/sosreport/sos/plugins/kvm.py": [18, 19, 22, 24, 26, 27, 28, 30, 32, 35, 52], "/home/caribou/git/sosreport/sos/plugins/qpid_dispatch.py": [17, 18, 21, 23, 25, 26, 28, 29, 31, 33, 34, 36], "/home/caribou/git/sosreport/sos/plugins/firewalld.py": [17, 20, 22, 24, 25, 27, 29], "/home/caribou/git/sosreport/sos/plugins/kubernetes.py": [128, 17, 18, 21, 24, 28, 29, 32, 33, 34, 35, 36, 39, 47], "/home/caribou/git/sosreport/sos/plugins/xinetd.py": [17, 20, 22, 24, 25, 27, 28, 30], "/home/caribou/git/sosreport/sos/plugins/mrggrid.py": [15, 18, 20, 22, 23, 25], "/home/caribou/git/sosreport/sos/plugins/activemq.py": [16, 19, 21, 23, 24, 25, 26, 28, 37, 47, 49, 57, 58], "/home/caribou/git/sosreport/sos/plugins/puppet.py": [34, 15, 16, 19, 21, 23, 24, 26], "/home/caribou/git/sosreport/sos/plugins/crypto.py": [17, 20, 22, 24, 25, 27], "/home/caribou/git/sosreport/sos/plugins/docker.py": [16, 19, 22, 24, 25, 26, 29, 30, 31, 32, 33, 36, 100, 102, 104, 112, 114, 117, 119], "/home/caribou/git/sosreport/sos/plugins/systemd.py": [33, 17, 20, 22, 24, 25, 27, 30], "/home/caribou/git/sosreport/sos/plugins/apparmor.py": [16, 19, 21, 23, 24, 26], "/home/caribou/git/sosreport/sos/plugins/xen.py": [15, 16, 17, 18, 21, 23, 25, 26, 28, 43, 46, 51, 62], "/home/caribou/git/sosreport/sos/plugins/sanlock.py": [35, 37, 39, 15, 18, 20, 21, 22, 23, 25], "/home/caribou/git/sosreport/sos/plugins/atomichost.py": [32, 17, 18, 21, 22, 24, 26, 29], "/home/caribou/git/sosreport/sos/plugins/autofs.py": [65, 67, 17, 20, 22, 24, 25, 27, 28, 30, 42, 50, 57, 59], "/home/caribou/git/sosreport/sos/plugins/psacct.py": [15, 18, 20, 21, 22, 24, 25, 27, 30, 32, 34, 41, 43, 44, 46], "/home/caribou/git/sosreport/sos/plugins/last.py": [15, 18, 20, 22, 23, 25], "/home/caribou/git/sosreport/sos/plugins/mongodb.py": [17, 20, 22, 24, 25, 27, 28, 30, 36, 44, 46], "/home/caribou/git/sosreport/sos/plugins/auditd.py": [15, 18, 20, 22, 23, 25, 27], "/home/caribou/git/sosreport/sos/plugins/chrony.py": [15, 18, 20, 22, 23, 25, 27], "/home/caribou/git/sosreport/sos/plugins/openssl.py": [17, 20, 22, 24, 25, 26, 28, 44, 46, 48, 50, 55, 57, 59, 61], "/home/caribou/git/sosreport/sos/plugins/i18n.py": [15, 18, 20, 22, 23, 25], "/home/caribou/git/sosreport/sos/plugins/fcoe.py": [15, 18, 20, 22, 23, 24, 26], "/home/caribou/git/sosreport/sos/plugins/anacron.py": [15, 18, 19, 21, 22, 26], "/home/caribou/git/sosreport/sos/plugins/openswan.py": [17, 20, 22, 24, 25, 26, 27, 28, 30, 31, 33], "/home/caribou/git/sosreport/sos/plugins/lvm2.py": [15, 18, 20, 22, 23, 25, 26, 27, 28, 30, 45], "/home/caribou/git/sosreport/sos/plugins/radius.py": [17, 20, 22, 24, 25, 26, 29, 31, 33, 41, 46, 48, 50], "/home/caribou/git/sosreport/sos/plugins/ntb.py": [15, 18, 20, 22, 23, 25], "/home/caribou/git/sosreport/sos/utilities.py": [15, 17, 18, 19, 20, 21, 22, 23, 24, 25, 27, 30, 31, 34, 36, 37, 38, 39, 42, 44, 45, 46, 47, 48, 49, 50, 52, 55, 70, 77, 78, 79, 81, 82, 83, 85, 86, 88, 89, 92, 95, 97, 98, 99, 101, 104, 107, 108, 109, 112, 113, 121, 127, 129, 131, 135, 136, 139, 140, 141, 143, 144, 145, 146, 147, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 162, 163, 165, 166, 167, 171, 176, 177, 178, 179, 180, 181, 182, 184, 187, 191, 192, 195, 199, 201, 205, 207, 209, 210, 211, 213, 214, 215, 216, 217, 218, 220, 221, 222, 223, 224, 225, 229, 232, 233, 234, 235, 237], "/home/caribou/git/sosreport/sos/plugins/iscsi.py": [16, 19, 21, 23, 24, 27, 29, 31], "/home/caribou/git/sosreport/sos/policies/debian.py": [1, 2, 4, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 19, 20, 21, 22, 23, 24, 25, 27, 31, 33], "/home/caribou/git/sosreport/sos/plugins/selinux.py": [15, 18, 20, 22, 23, 25, 26, 27, 28, 30], "/home/caribou/git/sosreport/sos/plugins/targetcli.py": [17, 20, 22, 23, 24, 25, 27], "/home/caribou/git/sosreport/sos/plugins/canonical_livepatch.py": [16, 19, 21, 23, 24, 25, 27], "/home/caribou/git/sosreport/sos/plugins/lxd.py": [17, 20, 22, 23, 25], "/home/caribou/git/sosreport/sos/plugins/ipsec.py": [17, 20, 22, 24, 25, 26, 29, 31, 33, 37, 39, 41], "/home/caribou/git/sosreport/sos/plugins/hts.py": [15, 18, 20, 22, 23, 25], "/home/caribou/git/sosreport/sos/plugins/juju.py": [17, 18, 19, 22, 23, 24, 36, 37, 40, 42, 44, 45, 46, 49, 50, 51, 53, 56, 62, 79], "/home/caribou/git/sosreport/sos/plugins/openstack_glance.py": [22, 70, 78, 82, 21, 86, 25, 26, 27, 28, 30, 32, 59], "/home/caribou/git/sosreport/sos/plugins/keyutils.py": [16, 19, 21, 23, 24, 26, 28], "/home/caribou/git/sosreport/sos/plugins/iscsitarget.py": [18, 21, 23, 25, 26, 29, 31, 33, 39, 41, 43], "/home/caribou/git/sosreport/sos/archive.py": [18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 30, 32, 34, 35, 36, 37, 40, 41, 42, 45, 46, 48, 52, 54, 56, 57, 59, 60, 62, 65, 68, 71, 72, 74, 75, 76, 82, 85, 88, 91, 94, 97, 103, 109, 118, 122, 131, 133, 135, 136, 137, 139, 140, 141, 142, 143, 144, 145, 147, 148, 149, 150, 152, 153, 154, 156, 157, 159, 160, 161, 162, 163, 167, 169, 170, 173, 174, 178, 179, 180, 184, 194, 195, 197, 198, 199, 200, 201, 202, 203, 204, 205, 211, 212, 214, 215, 216, 217, 218, 219, 220, 222, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 239, 240, 242, 249, 252, 255, 260, 261, 262, 264, 265, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 288, 291, 292, 354, 355, 357, 358, 360, 361, 362, 363, 365, 366, 367, 368, 369, 372, 373, 374, 378, 379, 380, 381, 382, 383, 384, 385, 386, 390, 391, 393, 400, 401, 403, 408, 410, 413, 416, 417, 418, 420, 421, 423, 424, 425, 428, 431, 432, 433, 434, 436, 437, 438, 439, 440, 442, 443, 445, 446], "/home/caribou/git/sosreport/sos/plugins/ipvs.py": [16, 19, 21, 23, 24, 26, 28], "/home/caribou/git/sosreport/sos/plugins/openstack_instack.py": [78, 18, 19, 22, 24, 25, 26, 28, 112, 115, 116, 119], "/home/caribou/git/sosreport/sos/plugins/squid.py": [15, 18, 20, 22, 23, 26, 28, 29, 31, 40, 42, 43, 44, 46], "/home/caribou/git/sosreport/sos/plugins/logrotate.py": [15, 18, 20, 22, 23, 25], "/home/caribou/git/sosreport/sos/plugins/gfs2.py": [15, 16, 19, 20, 22, 23, 24, 27, 28, 29, 32, 33, 35, 48, 58], "/home/caribou/git/sosreport/sos/plugins/ceph.py": [32, 35, 15, 18, 20, 22, 23], "/home/caribou/git/sosreport/sos/plugins/procenv.py": [16, 19, 21, 23, 24, 26], "/home/caribou/git/sosreport/sos/plugins/vmware.py": [15, 18, 20, 22, 23, 25, 27], "/home/caribou/git/sosreport/sos/plugins/cs.py": [19, 20, 21, 24, 26, 28, 29, 34, 40, 43, 54], "/home/caribou/git/sosreport/sos/policies/redhat.py": [18, 19, 20, 22, 23, 24, 26, 27, 28, 31, 33, 36, 37, 38, 39, 40, 41, 42, 43, 44, 46, 75, 80, 82, 97, 119, 124, 128, 129, 132, 133, 134, 135, 136, 155, 157, 160, 164, 167, 184, 194, 198, 199, 200, 216, 218, 220, 221, 222, 234, 236, 237, 238, 240, 243, 247, 249], "/home/caribou/git/sosreport/sos/plugins/openhpi.py": [15, 18, 20, 22, 23, 25, 31], "/home/caribou/git/sosreport/sos/plugins/ubuntu.py": [15, 18, 20, 22, 23, 26, 27, 30], "/home/caribou/git/sosreport/sos/plugins/oddjob.py": [17, 20, 22, 24, 25, 27, 28, 30], "/home/caribou/git/sosreport/sos/plugins/sendmail.py": [17, 20, 22, 24, 25, 27, 30, 32, 33, 35, 43, 45, 46, 48], "/home/caribou/git/sosreport/sos/plugins/megacli.py": [35, 18, 19, 20, 23, 25, 27, 28, 30], "/home/caribou/git/sosreport/sos/plugins/iprconfig.py": [33, 17, 18, 19, 20, 23, 25, 27, 29], "/home/caribou/git/sosreport/sos/reporting.py": [20, 22, 23, 28, 29, 32, 34, 35, 37, 41, 42, 43, 46, 47, 49, 50, 52, 53, 55, 56, 57, 58, 61, 63, 65, 66, 67, 69, 70, 72, 73, 74, 75, 78, 80, 82, 83, 84, 85, 88, 90, 92, 93, 94, 97, 99, 101, 102, 105, 107, 109, 110, 113, 115, 117, 121, 122, 124, 125, 126, 127, 130, 131, 132, 133, 134, 137, 139, 140, 142, 143, 144, 145, 146, 147, 148, 149, 154, 156, 157, 158, 159, 161, 163, 164, 165, 166, 167], "/home/caribou/git/sosreport/sos/plugins/kdump.py": [15, 18, 20, 22, 23, 25, 31, 33, 34, 36, 44, 46, 47, 49], "/home/caribou/git/sosreport/sos/plugins/udev.py": [15, 18, 20, 22, 23, 25]}} sosreport-3.5/sos/ 0000755 0001750 0001750 00000000000 13203300002 014036 5 ustar caribou caribou sosreport-3.5/sos/__init__.py 0000644 0001750 0001750 00000002160 13203300002 016146 0 ustar caribou caribou # Copyright 2010 Red Hat, Inc.
# Author: Adam Stokes
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
"""
This module houses the i18n setup and message function. The default is to use
gettext to internationalize messages.
"""
import gettext
__version__ = "3.5"
gettext_dir = "/usr/share/locale"
gettext_app = "sos"
gettext.bindtextdomain(gettext_app, gettext_dir)
def _default(msg):
return gettext.dgettext(gettext_app, msg)
_sos = _default
sosreport-3.5/sos/__pycache__/ 0000755 0001750 0001750 00000000000 13203254630 016265 5 ustar caribou caribou sosreport-3.5/sos/utilities.py 0000644 0001750 0001750 00000017506 13203300002 016434 0 ustar caribou caribou # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from __future__ import with_statement
import os
import re
import inspect
from subprocess import Popen, PIPE, STDOUT
import logging
import fnmatch
import errno
import shlex
import glob
from contextlib import closing
# PYCOMPAT
import six
from six import StringIO
def tail(filename, number_of_bytes):
"""Returns the last number_of_bytes of filename"""
with open(filename, "rb") as f:
if os.stat(filename).st_size > number_of_bytes:
f.seek(-number_of_bytes, 2)
return f.read()
def fileobj(path_or_file, mode='r'):
"""Returns a file-like object that can be used as a context manager"""
if isinstance(path_or_file, six.string_types):
try:
return open(path_or_file, mode)
except:
log = logging.getLogger('sos')
log.debug("fileobj: %s could not be opened" % path_or_file)
return closing(StringIO())
else:
return closing(path_or_file)
def convert_bytes(bytes_, K=1 << 10, M=1 << 20, G=1 << 30, T=1 << 40):
"""Converts a number of bytes to a shorter, more human friendly format"""
fn = float(bytes_)
if bytes_ >= T:
return '%.1fT' % (fn / T)
elif bytes_ >= G:
return '%.1fG' % (fn / G)
elif bytes_ >= M:
return '%.1fM' % (fn / M)
elif bytes_ >= K:
return '%.1fK' % (fn / K)
else:
return '%d' % bytes_
def find(file_pattern, top_dir, max_depth=None, path_pattern=None):
"""Generator function to find files recursively.
Usage::
for filename in find("*.properties", "/var/log/foobar"):
print filename
"""
if max_depth:
base_depth = os.path.dirname(top_dir).count(os.path.sep)
max_depth += base_depth
for path, dirlist, filelist in os.walk(top_dir):
if max_depth and path.count(os.path.sep) >= max_depth:
del dirlist[:]
if path_pattern and not fnmatch.fnmatch(path, path_pattern):
continue
for name in fnmatch.filter(filelist, file_pattern):
yield os.path.join(path, name)
def grep(pattern, *files_or_paths):
"""Returns lines matched in fnames, where fnames can either be pathnames to
files to grep through or open file objects to grep through line by line"""
matches = []
for fop in files_or_paths:
with fileobj(fop) as fo:
matches.extend((line for line in fo if re.match(pattern, line)))
return matches
def is_executable(command):
"""Returns if a command matches an executable on the PATH"""
paths = os.environ.get("PATH", "").split(os.path.pathsep)
candidates = [command] + [os.path.join(p, command) for p in paths]
return any(os.access(path, os.X_OK) for path in candidates)
def sos_get_command_output(command, timeout=300, stderr=False,
chroot=None, chdir=None, env=None):
"""Execute a command and return a dictionary of status and output,
optionally changing root or current working directory before
executing command.
"""
# Change root or cwd for child only. Exceptions in the prexec_fn
# closure are caught in the parent (chroot and chdir are bound from
# the enclosing scope).
def _child_prep_fn():
if (chroot):
os.chroot(chroot)
if (chdir):
os.chdir(chdir)
cmd_env = os.environ
# ensure consistent locale for collected command output
cmd_env['LC_ALL'] = 'C'
# optionally add an environment change for the command
if env:
for key, value in env.items():
cmd_env[key] = value
# use /usr/bin/timeout to implement a timeout
if timeout and is_executable("timeout"):
command = "timeout %ds %s" % (timeout, command)
# shlex.split() reacts badly to unicode on older python runtimes.
if not six.PY3:
command = command.encode('utf-8', 'ignore')
args = shlex.split(command)
# Expand arguments that are wildcard paths.
expanded_args = []
for arg in args:
expanded_arg = glob.glob(arg)
if expanded_arg:
expanded_args.extend(expanded_arg)
else:
expanded_args.append(arg)
try:
p = Popen(expanded_args, shell=False, stdout=PIPE,
stderr=STDOUT if stderr else PIPE,
bufsize=-1, env=cmd_env, close_fds=True,
preexec_fn=_child_prep_fn)
stdout, stderr = p.communicate()
except OSError as e:
if e.errno == errno.ENOENT:
return {'status': 127, 'output': ""}
else:
raise e
if p.returncode == 126 or p.returncode == 127:
stdout = six.binary_type(b"")
return {
'status': p.returncode,
'output': stdout.decode('utf-8', 'ignore')
}
def import_module(module_fqname, superclasses=None):
"""Imports the module module_fqname and returns a list of defined classes
from that module. If superclasses is defined then the classes returned will
be subclasses of the specified superclass or superclasses. If superclasses
is plural it must be a tuple of classes."""
module_name = module_fqname.rpartition(".")[-1]
module = __import__(module_fqname, globals(), locals(), [module_name])
modules = [class_ for cname, class_ in
inspect.getmembers(module, inspect.isclass)
if class_.__module__ == module_fqname]
if superclasses:
modules = [m for m in modules if issubclass(m, superclasses)]
return modules
def shell_out(cmd, timeout=30, chroot=None, runat=None):
"""Shell out to an external command and return the output or the empty
string in case of error.
"""
return sos_get_command_output(cmd, timeout=timeout,
chroot=chroot, chdir=runat)['output']
class ImporterHelper(object):
"""Provides a list of modules that can be imported in a package.
Importable modules are located along the module __path__ list and modules
are files that end in .py.
"""
def __init__(self, package):
"""package is a package module
import my.package.module
helper = ImporterHelper(my.package.module)"""
self.package = package
def _plugin_name(self, path):
"Returns the plugin module name given the path"
base = os.path.basename(path)
name, ext = os.path.splitext(base)
return name
def _get_plugins_from_list(self, list_):
plugins = [self._plugin_name(plugin)
for plugin in list_
if "__init__" not in plugin and plugin.endswith(".py")]
plugins.sort()
return plugins
def _find_plugins_in_dir(self, path):
if os.path.exists(path):
py_files = list(find("*.py", path))
pnames = self._get_plugins_from_list(py_files)
if pnames:
return pnames
else:
return []
def get_modules(self):
"""Returns the list of importable modules in the configured python
package. """
plugins = []
for path in self.package.__path__:
if os.path.isdir(path) or path == '':
plugins.extend(self._find_plugins_in_dir(path))
return plugins
# vim: set et ts=4 sw=4 :
sosreport-3.5/sos/reporting.py 0000644 0001750 0001750 00000011303 13203300002 016417 0 ustar caribou caribou # Copyright (C) 2014 Red Hat, Inc.,
# Bryn M. Reeves
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
""" This provides a restricted tag language to define the sosreport
index/report
"""
try:
import json
except ImportError:
import simplejson as json
# PYCOMPAT
from six import iteritems
import six
class Node(object):
def __str__(self):
return json.dumps(self.data)
def can_add(self, node):
return False
class Leaf(Node):
"""Marker class that can be added to a Section node"""
pass
class Report(Node):
"""The root element of a report. This is a container for sections."""
def __init__(self):
self.data = {}
def can_add(self, node):
return isinstance(node, Section)
def add(self, *nodes):
for node in nodes:
if self.can_add(node):
self.data[node.name] = node.data
class Section(Node):
"""A section is a container for leaf elements. Sections may be nested
inside of Report objects only."""
def __init__(self, name):
self.name = name
self.data = {}
def can_add(self, node):
return isinstance(node, Leaf)
def add(self, *nodes):
for node in nodes:
if self.can_add(node):
self.data.setdefault(node.ADDS_TO, []).append(node.data)
class Command(Leaf):
ADDS_TO = "commands"
def __init__(self, name, return_code, href):
self.data = {"name": name,
"return_code": return_code,
"href": href}
class CopiedFile(Leaf):
ADDS_TO = "copied_files"
def __init__(self, name, href):
self.data = {"name": name,
"href": href}
class CreatedFile(Leaf):
ADDS_TO = "created_files"
def __init__(self, name):
self.data = {"name": name}
class Alert(Leaf):
ADDS_TO = "alerts"
def __init__(self, content):
self.data = content
class Note(Leaf):
ADDS_TO = "notes"
def __init__(self, content):
self.data = content
def ends_bs(string):
""" Return True if 'string' ends with a backslash, and False otherwise.
Define this as a named function for no other reason than that pep8
now forbids binding of a lambda expression to a name:
'E731 do not assign a lambda expression, use a def'
"""
return string.endswith('\\')
class PlainTextReport(object):
"""Will generate a plain text report from a top_level Report object"""
LEAF = " * %(name)s"
ALERT = " ! %s"
NOTE = " * %s"
DIVIDER = "=" * 72
subsections = (
(Command, LEAF, "- commands executed:"),
(CopiedFile, LEAF, "- files copied:"),
(CreatedFile, LEAF, "- files created:"),
(Alert, ALERT, "- alerts:"),
(Note, NOTE, "- notes:"),
)
line_buf = []
def __init__(self, report_node):
self.report_node = report_node
def unicode(self):
self.line_buf = line_buf = []
for section_name, section_contents in sorted(iteritems(
self.report_node.data)):
line_buf.append(section_name + "\n" + self.DIVIDER)
for type_, format_, header in self.subsections:
self.process_subsection(section_contents, type_.ADDS_TO,
header, format_)
# Workaround python.six mishandling of strings ending in '/' by
# adding a single space following any '\' at end-of-line.
# See Six issue #60.
line_buf = [line + " " if ends_bs(line) else line for line in line_buf]
output = u'\n'.join(map(lambda i: (i if isinstance(i, six.text_type)
else six.u(i)), line_buf))
if six.PY3:
return output
else:
return output.encode('utf8')
def process_subsection(self, section, key, header, format_):
if key in section:
self.line_buf.append(header)
for item in section.get(key):
self.line_buf.append(format_ % item)
# vim: set et ts=4 sw=4 :
sosreport-3.5/sos/plugins/ 0000755 0001750 0001750 00000000000 13203300044 015525 5 ustar caribou caribou sosreport-3.5/sos/plugins/dracut.py 0000644 0001750 0001750 00000002303 13203300002 017351 0 ustar caribou caribou # Copyright (C) 2016 Red Hat, Inc., Bryn M. Reeves
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, RedHatPlugin
class Dracut(Plugin, RedHatPlugin):
""" Dracut initramfs generator """
plugin_name = "dracut"
packages = ("dracut",)
def setup(self):
self.add_copy_spec([
"/etc/dracut.conf",
"/etc/dracut.conf.d"
])
self.add_cmd_output([
"dracut --list-modules",
"dracut --print-cmdline"
])
# vim: set et ts=4 sw=4 :
sosreport-3.5/sos/plugins/teamd.py 0000644 0001750 0001750 00000003637 13203300002 017174 0 ustar caribou caribou # Copyright (C) 2014 Red Hat, Inc. Bryn M. Reeves
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
class Teamd(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
"""Network interface teaming
"""
plugin_name = 'teamd'
profiles = ('network', 'hardware', )
packages = ('teamd',)
def _get_team_interfaces(self):
teams = []
ip_result = self.get_command_output("ip -o link")
if ip_result['status'] != 0:
return teams
for line in ip_result['output'].splitlines():
fields = line.split()
if fields[1][0:4] == 'team':
teams.append(fields[1][:-1])
return teams
def setup(self):
self.add_copy_spec([
"/etc/dbus-1/system.d/teamd.conf",
"/usr/lib/systemd/system/teamd@.service"
])
teams = self._get_team_interfaces()
for team in teams:
self.add_cmd_output([
"teamdctl %s state" % team,
"teamdctl %s state dump" % team,
"teamdctl %s config dump" % team,
"teamnl %s option" % team,
"teamnl %s ports" % team
])
# vim: set et ts=4 sw=4 :
sosreport-3.5/sos/plugins/anaconda.py 0000644 0001750 0001750 00000003327 13203300002 017642 0 ustar caribou caribou # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, RedHatPlugin
import os
class Anaconda(Plugin, RedHatPlugin):
"""Anaconda installer
"""
plugin_name = 'anaconda'
profiles = ('system',)
packages = ('anaconda',)
files = (
'/var/log/anaconda.log',
'/var/log/anaconda'
)
def setup(self):
paths = [
"/root/anaconda-ks.cfg"
]
if os.path.isdir('/var/log/anaconda'):
# new anaconda
paths.append('/var/log/anaconda')
else:
paths = paths + [
"/var/log/anaconda.*",
"/root/install.log",
"/root/install.log.syslog"
]
self.add_copy_spec(paths)
def postproc(self):
self.do_file_sub(
"/root/anaconda-ks.cfg",
r"(\s*rootpw\s*).*",
r"\1********"
)
self.do_file_sub(
"/root/anaconda-ks.cfg",
r"(user.*--password=*\s*)\s*(\S*)",
r"\1********"
)
# vim: set et ts=4 sw=4 :
sosreport-3.5/sos/plugins/omsa.py 0000644 0001750 0001750 00000004164 13203300002 017035 0 ustar caribou caribou # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
class omsa(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
'''Dell OpenManage Server Administrator (OMSA)
'''
plugin_name = 'omsa'
profiles = ('hardware', 'debug')
files = ('/opt/dell/srvadmin/bin/omreport',)
packages = ('srvadmin-omacore',)
omreport = '/opt/dell/srvadmin/bin/omreport'
def setup(self):
self.add_copy_spec([
"/var/log/dell/updatepackage/log/support",
"/opt/dell/srvadmin/var/log/openmanage/Inventory.xml*",
"/opt/dell/srvadmin/etc/omreg.cfg",
"/opt/dell/srvadmin/etc/openmanage/oma/ini",
"/opt/dell/srvadmin/etc/srvadmin-deng/ini",
"/opt/dell/srvadmin/etc/srvadmin-isvc/ini/d*ini",
])
self.add_cmd_output([
"{0} system alertaction".format(self.omreport),
"{0} system alertlog".format(self.omreport),
"{0} system cmdlog".format(self.omreport),
"{0} system pedestinations".format(self.omreport),
"{0} system platformevents".format(self.omreport),
"{0} system summary".format(self.omreport),
"{0} system events".format(self.omreport),
"{0} chassis info".format(self.omreport),
"{0} chassis biossetup".format(self.omreport),
"{0} storage controller".format(self.omreport),
], timeout=30)
# vim: et ts=4 sw=4
sosreport-3.5/sos/plugins/veritas.py 0000644 0001750 0001750 00000003215 13203300002 017547 0 ustar caribou caribou # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, RedHatPlugin
import os
class Veritas(Plugin, RedHatPlugin):
"""Veritas software
"""
plugin_name = 'veritas'
profiles = ('cluster', 'storage')
# Information about VRTSexplorer obtained from
# http://seer.entsupport.symantec.com/docs/243150.htm
option_list = [("script", "Define VRTSexplorer script path", "",
"/opt/VRTSspt/VRTSexplorer")]
def check_enabled(self):
return os.path.isfile(self.get_option("script"))
def setup(self):
""" interface with vrtsexplorer to capture veritas related data """
r = self.call_ext_prog(self.get_option("script"))
if r['status'] == 0:
tarfile = ""
for line in r['output']:
line = line.strip()
tarfile = self.do_regex_find_all(r"ftp (.*tar.gz)", line)
if len(tarfile) == 1:
self.add_copy_spec(tarfile[0])
# vim: set et ts=4 sw=4 :
sosreport-3.5/sos/plugins/openstack_ceilometer.py 0000644 0001750 0001750 00000006510 13203300002 022272 0 ustar caribou caribou # Copyright (C) 2013 Red Hat, Inc., Eoghan Lynn
# Copyright (C) 2012 Rackspace US, Inc.
# 2012 Justin Shepherd
# Copyright (C) 2009 Red Hat, Inc.
# 2009 Joey Boggs
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
class OpenStackCeilometer(Plugin):
"""Openstack Ceilometer"""
plugin_name = "openstack_ceilometer"
profiles = ('openstack', 'openstack_controller', 'openstack_compute')
option_list = []
var_puppet_gen = "/var/lib/config-data/puppet-generated/ceilometer"
def setup(self):
# Ceilometer
self.limit = self.get_option("log_size")
if self.get_option("all_logs"):
self.add_copy_spec([
"/var/log/ceilometer/*",
"/var/log/containers/ceilometer/*"
], sizelimit=self.limit)
else:
self.add_copy_spec([
"/var/log/ceilometer/*.log",
"/var/log/containers/ceilometer/*.log"
], sizelimit=self.limit)
self.add_copy_spec([
"/etc/ceilometer/*",
self.var_puppet_gen + "/etc/ceilometer/*"
])
if self.get_option("verify"):
self.add_cmd_output("rpm -V %s" % ' '.join(self.packages))
def postproc(self):
protect_keys = [
"admin_password", "connection_password", "host_password",
"memcache_secret_key", "os_password", "password", "qpid_password",
"rabbit_password", "readonly_user_password", "secret_key",
"ssl_key_password", "telemetry_secret", "connection",
"metering_secret"
]
regexp = r"((?m)^\s*(%s)\s*=\s*)(.*)" % "|".join(protect_keys)
self.do_path_regex_sub("/etc/ceilometer/*", regexp, r"\1*********")
self.do_path_regex_sub(
self.var_puppet_gen + "/etc/ceilometer/*",
regexp, r"\1*********"
)
class DebianCeilometer(OpenStackCeilometer, DebianPlugin,
UbuntuPlugin):
packages = (
'ceilometer-api',
'ceilometer-agent-central',
'ceilometer-agent-compute',
'ceilometer-collector',
'ceilometer-common',
'python-ceilometer',
'python-ceilometerclient'
)
class RedHatCeilometer(OpenStackCeilometer, RedHatPlugin):
packages = (
'openstack-ceilometer',
'openstack-ceilometer-api',
'openstack-ceilometer-central',
'openstack-ceilometer-collector',
'openstack-ceilometer-common',
'openstack-ceilometer-compute',
'python-ceilometerclient'
)
# vim: set et ts=4 sw=4 :
sosreport-3.5/sos/plugins/ipmitool.py 0000644 0001750 0001750 00000003051 13203300002 017724 0 ustar caribou caribou # Copyright (C) 2016 Red Hat, Inc. Bryn M. Reeves
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin
class IpmiTool(Plugin, RedHatPlugin, DebianPlugin):
"""IpmiTool hardware information.
"""
plugin_name = 'ipmitool'
profiles = ('hardware', 'system', )
packages = ('ipmitool',)
def setup(self):
result = self.get_command_output("ipmitool -I usb mc info")
have_usbintf = result['status']
if not have_usbintf:
cmd = "ipmitool -I usb"
else:
cmd = "ipmitool"
self.add_cmd_output([
"%s sel info" % cmd,
"%s sel list" % cmd,
"%s sensor list" % cmd,
"%s chassis status" % cmd,
"%s fru print" % cmd,
"%s mc info" % cmd,
"%s sdr info" % cmd
])
# vim: set et ts=4 sw=4 :
sosreport-3.5/sos/plugins/__init__.py 0000644 0001750 0001750 00000125350 13203300002 017636 0 ustar caribou caribou # Copyright (C) 2006 Steve Conklin
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
""" This exports methods available for use by plugins for sos """
from __future__ import with_statement
from sos.utilities import (sos_get_command_output, import_module, grep,
fileobj, tail, is_executable)
import os
import glob
import re
import stat
from time import time
import logging
import fnmatch
import errno
# PYCOMPAT
import six
from six.moves import zip, filter
def _to_u(s):
if not isinstance(s, six.text_type):
# Workaround python.six mishandling of strings ending in '\' by
# adding a single space following any '\' at end-of-line.
# See Six issue #60.
if s.endswith('\\'):
s += " "
s = six.u(s)
return s
def regex_findall(regex, fname):
'''Return a list of all non overlapping matches in the string(s)'''
try:
with fileobj(fname) as f:
return re.findall(regex, f.read(), re.MULTILINE)
except AttributeError:
return []
def _mangle_command(command, name_max):
mangledname = re.sub(r"^/(usr/|)(bin|sbin)/", "", command)
mangledname = re.sub(r"[^\w\-\.\/]+", "_", mangledname)
mangledname = re.sub(r"/", ".", mangledname).strip(" ._-")
mangledname = mangledname[0:name_max]
return mangledname
def _path_in_path_list(path, path_list):
return any(p in path for p in path_list)
def _node_type(st):
""" return a string indicating the type of special node represented by
the stat buffer st (block, character, fifo, socket).
"""
_types = [
(stat.S_ISBLK, "block device"),
(stat.S_ISCHR, "character device"),
(stat.S_ISFIFO, "named pipe"),
(stat.S_ISSOCK, "socket")
]
for t in _types:
if t[0](st.st_mode):
return t[1]
def _file_is_compressed(path):
"""Check if a file appears to be compressed
Return True if the file specified by path appears to be compressed,
or False otherwise by testing the file name extension against a
list of known file compression extentions.
"""
return path.endswith(('.gz', '.xz', '.bz', '.bz2'))
class Plugin(object):
""" This is the base class for sosreport plugins. Plugins should subclass
this and set the class variables where applicable.
plugin_name is a string returned by plugin.name(). If this is set to None
(the default) class\_.__name__.tolower() will be returned. Be sure to set
this if you are defining multiple plugins that do the same thing on
different platforms.
requires_root is a boolean that specifies whether or not sosreport should
execute this plugin as a super user.
version is a string representing the version of the plugin. This can be
useful for post-collection tooling.
packages (files) is an iterable of the names of packages (the paths
of files) to check for before running this plugin. If any of these packages
or files is found on the system, the default implementation of
check_enabled will return True.
profiles is an iterable of profile names that this plugin belongs to.
Whenever any of the profiles is selected on the command line the plugin
will be enabled (subject to normal check_enabled tests).
"""
plugin_name = None
requires_root = True
version = 'unversioned'
packages = ()
files = ()
commands = ()
archive = None
profiles = ()
sysroot = '/'
def __init__(self, commons):
if not getattr(self, "option_list", False):
self.option_list = []
self.copied_files = []
self.executed_commands = []
self.alerts = []
self.custom_text = ""
self.opt_names = []
self.opt_parms = []
self.commons = commons
self.forbidden_paths = []
self.copy_paths = set()
self.copy_strings = []
self.collect_cmds = []
self.sysroot = commons['sysroot']
self.soslog = self.commons['soslog'] if 'soslog' in self.commons \
else logging.getLogger('sos')
# get the option list into a dictionary
for opt in self.option_list:
self.opt_names.append(opt[0])
self.opt_parms.append({'desc': opt[1], 'speed': opt[2],
'enabled': opt[3]})
@classmethod
def name(cls):
"""Returns the plugin's name as a string. This should return a
lowercase string.
"""
if cls.plugin_name:
return cls.plugin_name
return cls.__name__.lower()
def _format_msg(self, msg):
return "[plugin:%s] %s" % (self.name(), msg)
def _log_error(self, msg):
self.soslog.error(self._format_msg(msg))
def _log_warn(self, msg):
self.soslog.warning(self._format_msg(msg))
def _log_info(self, msg):
self.soslog.info(self._format_msg(msg))
def _log_debug(self, msg):
self.soslog.debug(self._format_msg(msg))
def policy(self):
return self.commons["policy"]
def join_sysroot(self, path):
if path[0] == os.sep:
path = path[1:]
return os.path.join(self.sysroot, path)
def strip_sysroot(self, path):
if not self.use_sysroot():
return path
if path.startswith(self.sysroot):
return path[len(self.sysroot):]
return path
def use_sysroot(self):
return self.sysroot != os.path.abspath(os.sep)
def tmp_in_sysroot(self):
paths = [self.sysroot, self.archive.get_tmp_dir()]
return os.path.commonprefix(paths) == self.sysroot
def is_installed(self, package_name):
'''Is the package $package_name installed?'''
return self.policy().pkg_by_name(package_name) is not None
def do_cmd_private_sub(self, cmd):
'''Remove certificate and key output archived by sosreport. cmd
is the command name from which output is collected (i.e. exlcuding
parameters). Any matching instances are replaced with: '-----SCRUBBED'
and this function does not take a regexp or substituting string.
This function returns the number of replacements made.
'''
globstr = '*' + cmd + '*'
self._log_debug("Scrubbing certs and keys for commands matching %s"
% (cmd))
if not self.executed_commands:
return 0
replacements = None
try:
for called in self.executed_commands:
if called['file'] is None:
continue
if fnmatch.fnmatch(called['exe'], globstr):
path = os.path.join(self.commons['cmddir'], called['file'])
readable = self.archive.open_file(path)
certmatch = re.compile("-----BEGIN.*?-----END", re.DOTALL)
result, replacements = certmatch.subn(
"-----SCRUBBED", readable.read())
if replacements:
self.archive.add_string(result, path)
except Exception as e:
msg = "Certificate/key scrubbing failed for '%s' with: '%s'"
self._log_error(msg % (called['exe'], e))
replacements = None
return replacements
def do_cmd_output_sub(self, cmd, regexp, subst):
'''Apply a regexp substitution to command output archived by sosreport.
cmd is the command name from which output is collected (i.e. excluding
parameters). The regexp can be a string or a compiled re object. The
substitution string, subst, is a string that replaces each occurrence
of regexp in each file collected from cmd. Internally 'cmd' is treated
as a glob with a leading and trailing '*' and each matching file from
the current module's command list is subjected to the replacement.
This function returns the number of replacements made.
'''
globstr = '*' + cmd + '*'
self._log_debug("substituting '%s' for '%s' in commands matching '%s'"
% (subst, regexp, globstr))
if not self.executed_commands:
return 0
replacements = None
try:
for called in self.executed_commands:
# was anything collected?
if called['file'] is None:
continue
if fnmatch.fnmatch(called['exe'], globstr):
path = os.path.join(self.commons['cmddir'], called['file'])
self._log_debug("applying substitution to '%s'" % path)
readable = self.archive.open_file(path)
result, replacements = re.subn(
regexp, subst, readable.read())
if replacements:
self.archive.add_string(result, path)
except Exception as e:
msg = "regex substitution failed for '%s' with: '%s'"
self._log_error(msg % (called['exe'], e))
replacements = None
return replacements
def do_file_sub(self, srcpath, regexp, subst):
'''Apply a regexp substitution to a file archived by sosreport.
srcpath is the path in the archive where the file can be found. regexp
can be a regexp string or a compiled re object. subst is a string to
replace each occurance of regexp in the content of srcpath.
This function returns the number of replacements made.
'''
try:
path = self._get_dest_for_srcpath(srcpath)
self._log_debug("substituting scrpath '%s'" % srcpath)
self._log_debug("substituting '%s' for '%s' in '%s'"
% (subst, regexp, path))
if not path:
return 0
readable = self.archive.open_file(path)
result, replacements = re.subn(regexp, subst, readable.read())
if replacements:
self.archive.add_string(result, srcpath)
else:
replacements = 0
except Exception as e:
msg = "regex substitution failed for '%s' with: '%s'"
self._log_error(msg % (path, e))
replacements = 0
return replacements
def do_path_regex_sub(self, pathexp, regexp, subst):
'''Apply a regexp substituation to a set of files archived by
sos. The set of files to be substituted is generated by matching
collected file pathnames against pathexp which may be a regular
expression string or compiled re object. The portion of the file
to be replaced is specified via regexp and the replacement string
is passed in subst.'''
if not hasattr(pathexp, "match"):
pathexp = re.compile(pathexp)
match = pathexp.match
file_list = [f for f in self.copied_files if match(f['srcpath'])]
for file in file_list:
self.do_file_sub(file['srcpath'], regexp, subst)
def do_regex_find_all(self, regex, fname):
return regex_findall(regex, fname)
def _copy_symlink(self, srcpath):
# the target stored in the original symlink
linkdest = os.readlink(srcpath)
dest = os.path.join(os.path.dirname(srcpath), linkdest)
# Absolute path to the link target. If SYSROOT != '/' this path
# is relative to the host root file system.
absdest = os.path.normpath(dest)
# adjust the target used inside the report to always be relative
if os.path.isabs(linkdest):
reldest = os.path.relpath(linkdest, os.path.dirname(srcpath))
# trim leading /sysroot
if self.use_sysroot():
reldest = reldest[len(os.sep + os.pardir):]
self._log_debug("made link target '%s' relative as '%s'"
% (linkdest, reldest))
else:
reldest = linkdest
self._log_debug("copying link '%s' pointing to '%s' with isdir=%s"
% (srcpath, linkdest, os.path.isdir(absdest)))
dstpath = self.strip_sysroot(srcpath)
# use the relative target path in the tarball
self.archive.add_link(reldest, dstpath)
if os.path.isdir(absdest):
self._log_debug("link '%s' is a directory, skipping..." % linkdest)
return
# copy the symlink target translating relative targets
# to absolute paths to pass to _do_copy_path.
self._log_debug("normalized link target '%s' as '%s'"
% (linkdest, absdest))
# skip recursive copying of symlink pointing to itself.
if (absdest != srcpath):
self._do_copy_path(self.strip_sysroot(absdest))
else:
self._log_debug("link '%s' points to itself, skipping target..."
% linkdest)
self.copied_files.append({'srcpath': srcpath,
'dstpath': dstpath,
'symlink': "yes",
'pointsto': linkdest})
def _copy_dir(self, srcpath):
try:
for afile in os.listdir(srcpath):
self._log_debug("recursively adding '%s' from '%s'"
% (afile, srcpath))
self._do_copy_path(os.path.join(srcpath, afile), dest=None)
except OSError as e:
if e.errno == errno.ELOOP:
msg = "Too many levels of symbolic links copying"
self._log_error("_copy_dir: %s '%s'" % (msg, srcpath))
return
raise e
def _get_dest_for_srcpath(self, srcpath):
if self.use_sysroot():
srcpath = self.join_sysroot(srcpath)
for copied in self.copied_files:
if srcpath == copied["srcpath"]:
return copied["dstpath"]
return None
def _is_forbidden_path(self, path):
if self.use_sysroot():
path = self.join_sysroot(path)
return _path_in_path_list(path, self.forbidden_paths)
def _copy_node(self, path, st):
dev_maj = os.major(st.st_rdev)
dev_min = os.minor(st.st_rdev)
mode = st.st_mode
self.archive.add_node(path, mode, os.makedev(dev_maj, dev_min))
# Methods for copying files and shelling out
def _do_copy_path(self, srcpath, dest=None):
'''Copy file or directory to the destination tree. If a directory, then
everything below it is recursively copied. A list of copied files are
saved for use later in preparing a report.
'''
if self._is_forbidden_path(srcpath):
self._log_debug("skipping forbidden path '%s'" % srcpath)
return ''
if not dest:
dest = srcpath
if self.use_sysroot():
dest = self.strip_sysroot(dest)
try:
st = os.lstat(srcpath)
except (OSError, IOError):
self._log_info("failed to stat '%s'" % srcpath)
return
if stat.S_ISLNK(st.st_mode):
self._copy_symlink(srcpath)
return
else:
if stat.S_ISDIR(st.st_mode):
self._copy_dir(srcpath)
return
# handle special nodes (block, char, fifo, socket)
if not (stat.S_ISREG(st.st_mode) or stat.S_ISDIR(st.st_mode)):
ntype = _node_type(st)
self._log_debug("creating %s node at archive:'%s'"
% (ntype, dest))
self._copy_node(srcpath, st)
return
# if we get here, it's definitely a regular file (not a symlink or dir)
self._log_debug("copying path '%s' to archive:'%s'" % (srcpath, dest))
# if not readable(srcpath)
if not st.st_mode & 0o444:
# FIXME: reflect permissions in archive
self.archive.add_string("", dest)
else:
self.archive.add_file(srcpath, dest)
self.copied_files.append({
'srcpath': srcpath,
'dstpath': dest,
'symlink': "no"
})
def add_forbidden_path(self, forbidden):
"""Specify a path to not copy, even if it's part of a copy_specs[]
entry.
"""
if self.use_sysroot():
forbidden = self.join_sysroot(forbidden)
# Glob case handling is such that a valid non-glob is a reduced glob
for path in glob.glob(forbidden):
self.forbidden_paths.append(path)
def get_all_options(self):
"""return a list of all options selected"""
return (self.opt_names, self.opt_parms)
def set_option(self, optionname, value):
'''set the named option to value.'''
for name, parms in zip(self.opt_names, self.opt_parms):
if name == optionname:
parms['enabled'] = value
return True
else:
return False
def get_option(self, optionname, default=0):
"""Returns the first value that matches 'optionname' in parameters
passed in via the command line or set via set_option or via the
global_plugin_options dictionary, in that order.
optionaname may be iterable, in which case the first option that
matches any of the option names is returned.
"""
global_options = ('verify', 'all_logs', 'log_size')
if optionname in global_options:
return getattr(self.commons['cmdlineopts'], optionname)
def _check(key):
if hasattr(optionname, "__iter__"):
return key in optionname
else:
return key == optionname
for name, parms in zip(self.opt_names, self.opt_parms):
if _check(name):
val = parms['enabled']
if val is not None:
return val
items = six.iteritems(self.commons.get('global_plugin_options', {}))
for key, value in items:
if _check(key):
return value
return default
def get_option_as_list(self, optionname, delimiter=",", default=None):
'''Will try to return the option as a list separated by the
delimiter.
'''
option = self.get_option(optionname)
try:
opt_list = [opt.strip() for opt in option.split(delimiter)]
return list(filter(None, opt_list))
except Exception:
return default
def _add_copy_paths(self, copy_paths):
self.copy_paths.update(copy_paths)
def add_copy_spec(self, copyspecs, sizelimit=None, tailit=True):
"""Add a file or glob but limit it to sizelimit megabytes. If fname is
a single file the file will be tailed to meet sizelimit. If the first
file in a glob is too large it will be tailed to meet the sizelimit.
"""
if self.get_option('all_logs'):
sizelimit = None
if sizelimit:
sizelimit *= 1024 * 1024 # in MB
if not copyspecs:
return False
if isinstance(copyspecs, six.string_types):
copyspecs = [copyspecs]
for copyspec in copyspecs:
if not (copyspec and len(copyspec)):
return False
if self.use_sysroot():
copyspec = self.join_sysroot(copyspec)
files = self._expand_copy_spec(copyspec)
if len(files) == 0:
continue
# Files hould be sorted in most-recently-modified order, so that
# we collect the newest data first before reaching the limit.
def getmtime(path):
try:
return os.path.getmtime(path)
except (OSError, FileNotFoundError):
return 0
files.sort(key=getmtime, reverse=True)
current_size = 0
limit_reached = False
_file = None
for _file in files:
try:
current_size += os.stat(_file)[stat.ST_SIZE]
except (OSError, FileNotFoundError):
self._log_info("failed to stat '%s'" % _file)
if sizelimit and current_size > sizelimit:
limit_reached = True
break
self._add_copy_paths([_file])
if limit_reached and tailit and not _file_is_compressed(_file):
file_name = _file
if file_name[0] == os.sep:
file_name = file_name.lstrip(os.sep)
strfile = file_name.replace(os.path.sep, ".") + ".tailed"
self.add_string_as_file(tail(_file, sizelimit), strfile)
rel_path = os.path.relpath('/', os.path.dirname(_file))
link_path = os.path.join(rel_path, 'sos_strings',
self.name(), strfile)
self.archive.add_link(link_path, _file)
def get_command_output(self, prog, timeout=300, stderr=True,
chroot=True, runat=None, env=None):
if chroot or self.commons['cmdlineopts'].chroot == 'always':
root = self.sysroot
else:
root = None
result = sos_get_command_output(prog, timeout=timeout, stderr=stderr,
chroot=root, chdir=runat,
env=env)
if result['status'] == 124:
self._log_warn("command '%s' timed out after %ds"
% (prog, timeout))
# command not found or not runnable
if result['status'] == 126 or result['status'] == 127:
# automatically retry chroot'ed commands in the host namespace
if root and root != '/':
if self.commons['cmdlineopts'].chroot != 'always':
self._log_info("command '%s' not found in %s - "
"re-trying in host root"
% (prog.split()[0], root))
return self.get_command_output(prog, timeout=timeout,
chroot=False, runat=runat,
env=env)
self._log_debug("could not run '%s': command not found" % prog)
return result
def call_ext_prog(self, prog, timeout=300, stderr=True,
chroot=True, runat=None):
"""Execute a command independantly of the output gathering part of
sosreport.
"""
return self.get_command_output(prog, timeout=timeout, stderr=stderr,
chroot=chroot, runat=runat)
def check_ext_prog(self, prog):
"""Execute a command independently of the output gathering part of
sosreport and check the return code. Return True for a return code of 0
and False otherwise.
"""
return self.call_ext_prog(prog)['status'] == 0
def _add_cmd_output(self, cmd, suggest_filename=None,
root_symlink=None, timeout=300, stderr=True,
chroot=True, runat=None, env=None):
"""Internal helper to add a single command to the collection list."""
cmdt = (
cmd, suggest_filename,
root_symlink, timeout, stderr,
chroot, runat, env
)
_tuplefmt = "('%s', '%s', '%s', %s, '%s', '%s', '%s', '%s')"
_logstr = "packed command tuple: " + _tuplefmt
self._log_debug(_logstr % cmdt)
self.collect_cmds.append(cmdt)
self._log_info("added cmd output '%s'" % cmd)
def add_cmd_output(self, cmds, suggest_filename=None,
root_symlink=None, timeout=300, stderr=True,
chroot=True, runat=None, env=None):
"""Run a program or a list of programs and collect the output"""
if isinstance(cmds, six.string_types):
cmds = [cmds]
if len(cmds) > 1 and (suggest_filename or root_symlink):
self._log_warn("ambiguous filename or symlink for command list")
for cmd in cmds:
self._add_cmd_output(cmd, suggest_filename,
root_symlink, timeout, stderr,
chroot, runat, env)
def get_cmd_output_path(self, name=None, make=True):
"""Return a path into which this module should store collected
command output
"""
cmd_output_path = os.path.join(self.archive.get_tmp_dir(),
'sos_commands', self.name())
if name:
cmd_output_path = os.path.join(cmd_output_path, name)
if make:
os.makedirs(cmd_output_path)
return cmd_output_path
def file_grep(self, regexp, *fnames):
"""Returns lines matched in fnames, where fnames can either be
pathnames to files to grep through or open file objects to grep through
line by line.
"""
return grep(regexp, *fnames)
def _mangle_command(self, exe):
name_max = self.archive.name_max()
return _mangle_command(exe, name_max)
def _make_command_filename(self, exe):
"""The internal function to build up a filename based on a command."""
outfn = os.path.join(self.commons['cmddir'], self.name(),
self._mangle_command(exe))
# check for collisions
if os.path.exists(outfn):
inc = 2
while True:
newfn = "%s_%d" % (outfn, inc)
if not os.path.exists(newfn):
outfn = newfn
break
inc += 1
return outfn
def add_string_as_file(self, content, filename):
"""Add a string to the archive as a file named `filename`"""
self.copy_strings.append((content, filename))
if isinstance(content, six.string_types):
content = "..." + content.splitlines()[0]
else:
content = ("..." +
(content.splitlines()[0]).decode('utf8', 'ignore'))
self._log_debug("added string '%s' as '%s'" % (content, filename))
def get_cmd_output_now(self, exe, suggest_filename=None,
root_symlink=False, timeout=300, stderr=True,
chroot=True, runat=None, env=None):
"""Execute a command and save the output to a file for inclusion in the
report.
"""
start = time()
result = self.get_command_output(exe, timeout=timeout, stderr=stderr,
chroot=chroot, runat=runat,
env=env)
self._log_debug("collected output of '%s' in %s"
% (exe.split()[0], time() - start))
if suggest_filename:
outfn = self._make_command_filename(suggest_filename)
else:
outfn = self._make_command_filename(exe)
outfn_strip = outfn[len(self.commons['cmddir'])+1:]
self.archive.add_string(result['output'], outfn)
if root_symlink:
self.archive.add_link(outfn, root_symlink)
# save info for later
# save in our list
self.executed_commands.append({'exe': exe, 'file': outfn_strip})
self.commons['xmlreport'].add_command(cmdline=exe,
exitcode=result['status'],
f_stdout=outfn_strip)
return os.path.join(self.archive.get_archive_path(), outfn)
def is_module_loaded(self, module_name):
"""Return whether specified moudle as module_name is loaded or not"""
if len(grep("^" + module_name + " ", "/proc/modules")) == 0:
return None
else:
return True
# For adding output
def add_alert(self, alertstring):
"""Add an alert to the collection of alerts for this plugin. These
will be displayed in the report
"""
self.alerts.append(alertstring)
def add_custom_text(self, text):
"""Append text to the custom text that is included in the report. This
is freeform and can include html.
"""
self.custom_text += text
def add_journal(self, units=None, boot=None, since=None, until=None,
lines=None, allfields=False, output=None, timeout=None):
""" Collect journald logs from one of more units.
Keyword arguments:
units -- A string, or list of strings specifying the systemd
units for which journal entries will be collected.
boot -- A string selecting a boot index using the journalctl
syntax. The special values 'this' and 'last' are also
accepted.
since -- A string representation of the start time for journal
messages.
until -- A string representation of the end time for journal
messages.
lines -- The maximum number of lines to be collected.
allfields -- Include all journal fields regardless of size or
non-printable characters.
output -- A journalctl output control string, for example
"verbose".
timeout -- An optional timeout in seconds.
"""
journal_cmd = "journalctl --no-pager "
unit_opt = " --unit %s"
boot_opt = " --boot %s"
since_opt = " --since %s"
until_opt = " --until %s"
lines_opt = " --lines %s"
output_opt = " --output %s"
if isinstance(units, six.string_types):
units = [units]
if units:
for unit in units:
journal_cmd += unit_opt % unit
if allfields:
journal_cmd += " --all"
if boot:
if boot == "this":
boot = ""
if boot == "last":
boot = "-1"
journal_cmd += boot_opt % boot
if since:
journal_cmd += since_opt % since
if until:
journal_cmd += until_opt % until
if lines:
journal_cmd += lines_opt % lines
if output:
journal_cmd += output_opt % output
self._log_debug("collecting journal: %s" % journal_cmd)
self._add_cmd_output(journal_cmd, None, None, timeout)
def _expand_copy_spec(self, copyspec):
return glob.glob(copyspec)
def _collect_copy_specs(self):
for path in self.copy_paths:
self._log_info("collecting path '%s'" % path)
self._do_copy_path(path)
def _collect_cmd_output(self):
for progs in zip(self.collect_cmds):
(
prog,
suggest_filename, root_symlink,
timeout,
stderr,
chroot, runat,
env
) = progs[0]
self._log_debug("unpacked command tuple: " +
"('%s', '%s', '%s', %s, '%s', '%s', '%s', '%s')" %
progs[0])
self._log_info("collecting output of '%s'" % prog)
self.get_cmd_output_now(prog, suggest_filename=suggest_filename,
root_symlink=root_symlink, timeout=timeout,
stderr=stderr, chroot=chroot, runat=runat,
env=env)
def _collect_strings(self):
for string, file_name in self.copy_strings:
content = "..."
if isinstance(string, six.string_types):
content = "..." + content.splitlines()[0]
else:
content = ("..." +
(content.splitlines()[0]).decode('utf8', 'ignore'))
self._log_info("collecting string '%s' as '%s'"
% (content, file_name))
try:
self.archive.add_string(string,
os.path.join('sos_strings',
self.name(),
file_name))
except Exception as e:
self._log_debug("could not add string '%s': %s"
% (file_name, e))
def collect(self):
"""Collect the data for a plugin."""
start = time()
self._collect_copy_specs()
self._collect_cmd_output()
self._collect_strings()
fields = (self.name(), time() - start)
self._log_debug("collected plugin '%s' in %s" % fields)
def get_description(self):
""" This function will return the description for the plugin"""
try:
if hasattr(self, '__doc__') and self.__doc__:
return self.__doc__.strip()
return super(self.__class__, self).__doc__.strip()
except:
return ""
def check_enabled(self):
"""This method will be used to verify that a plugin should execute
given the condition of the underlying environment.
The default implementation will return True if none of class.files,
class.packages, nor class.commands is specified. If any of these is
specified the plugin will check for the existence of any of the
corresponding paths, packages or commands and return True if any
are present.
For SCLPlugin subclasses, it will check whether the plugin can be run
for any of installed SCLs. If so, it will store names of these SCLs
on the plugin class in addition to returning True.
For plugins with more complex enablement checks this method may be
overridden.
"""
# some files or packages have been specified for this package
if any([self.files, self.packages, self.commands]):
if isinstance(self.files, six.string_types):
self.files = [self.files]
if isinstance(self.packages, six.string_types):
self.packages = [self.packages]
if isinstance(self.commands, six.string_types):
self.commands = [self.commands]
if isinstance(self, SCLPlugin):
# save SCLs that match files or packages
type(self)._scls_matched = []
for scl in self._get_scls():
files = [f % {"scl_name": scl} for f in self.files]
packages = [p % {"scl_name": scl} for p in self.packages]
commands = [c % {"scl_name": scl} for c in self.commands]
if self._files_pkgs_or_cmds_present(files,
packages,
commands):
type(self)._scls_matched.append(scl)
return len(type(self)._scls_matched) > 0
return self._files_pkgs_or_cmds_present(self.files,
self.packages,
self.commands)
if isinstance(self, SCLPlugin):
# if files and packages weren't specified, we take all SCLs
type(self)._scls_matched = self._get_scls()
return True
def _files_pkgs_or_cmds_present(self, files, packages, commands):
return (any(os.path.exists(fname) for fname in files) or
any(self.is_installed(pkg) for pkg in packages) or
any(is_executable(cmd) for cmd in commands))
def default_enabled(self):
"""This decides whether a plugin should be automatically loaded or
only if manually specified in the command line."""
return True
def setup(self):
"""Collect the list of files declared by the plugin. This method
may be overridden to add further copy_specs, forbidden_paths, and
external programs if required.
"""
self.add_copy_spec(list(self.files))
def setup_verify(self):
if not hasattr(self, "verify_packages") or not self.verify_packages:
if hasattr(self, "packages") and self.packages:
# Limit automatic verification to only the named packages
self.verify_packages = [p + "$" for p in self.packages]
else:
return
pm = self.policy().package_manager
verify_cmd = pm.build_verify_command(self.verify_packages)
if verify_cmd:
self.add_cmd_output(verify_cmd)
def postproc(self):
"""Perform any postprocessing. To be replaced by a plugin if required.
"""
pass
def report(self):
""" Present all information that was gathered in an html file that
allows browsing the results.
"""
# make this prettier
html = u'
\n' % self.name()
# Intro
html = html + " Plugin " + self.name() + "
\n"
# Files
if len(self.copied_files):
html = html + "Files copied:
\n"
for afile in self.copied_files:
html = html + '- %s' % \
(u'..' + _to_u(afile['dstpath']), _to_u(afile['srcpath']))
if afile['symlink'] == "yes":
html = html + " (symlink to %s)" % _to_u(afile['pointsto'])
html = html + '
\n'
html = html + "
\n"
# Command Output
if len(self.executed_commands):
html = html + "Commands Executed:
\n"
# convert file name to relative path from our root
# don't use relpath - these are HTML paths not OS paths.
for cmd in self.executed_commands:
if cmd["file"] and len(cmd["file"]):
cmd_rel_path = u"../" + _to_u(self.commons['cmddir']) \
+ "/" + _to_u(cmd['file'])
html = html + '- %s
\n' % \
(cmd_rel_path, _to_u(cmd['exe']))
else:
html = html + '- %s
\n' % (_to_u(cmd['exe']))
html = html + "
\n"
# Alerts
if len(self.alerts):
html = html + "Alerts:
\n"
for alert in self.alerts:
html = html + '- %s
\n' % _to_u(alert)
html = html + "
\n"
# Custom Text
if self.custom_text != "":
html = html + "Additional Information:
\n"
html = html + _to_u(self.custom_text) + "
\n"
if six.PY2:
return html.encode('utf8')
else:
return html
class RedHatPlugin(object):
"""Tagging class for Red Hat's Linux distributions"""
pass
class SCLPlugin(RedHatPlugin):
"""Superclass for plugins operating on Software Collections (SCLs).
Subclasses of this plugin class can specify class.files and class.packages
using "%(scl_name)s" interpolation. The plugin invoking mechanism will try
to match these against all found SCLs on the system. SCLs that do match
class.files or class.packages are then accessible via self.scls_matched
when the plugin is invoked.
Additionally, this plugin class provides "add_cmd_output_scl" (run
a command in context of given SCL), and "add_copy_spec_scl" and
"add_copy_spec_limit_scl" (copy package from file system of given SCL).
For example, you can implement a plugin that will list all global npm
packages in every SCL that contains "npm" package:
class SCLNpmPlugin(Plugin, SCLPlugin):
packages = ("%(scl_name)s-npm",)
def setup(self):
for scl in self.scls_matched:
self.add_cmd_output_scl(scl, "npm ls -g --json")
"""
@property
def scls_matched(self):
if not hasattr(type(self), '_scls_matched'):
type(self)._scls_matched = []
return type(self)._scls_matched
def _get_scls(self):
output = sos_get_command_output("scl -l")["output"]
return [scl.strip() for scl in output.splitlines()]
def add_cmd_output_scl(self, scl, cmds, **kwargs):
"""Same as add_cmd_output, except that it wraps command in
"scl enable" call.
"""
if isinstance(cmds, six.string_types):
cmds = [cmds]
scl_cmds = []
scl_cmd_tpl = "scl enable %s \"%s\""
for cmd in cmds:
scl_cmds.append(scl_cmd_tpl % (scl, cmd))
self.add_cmd_output(scl_cmds, **kwargs)
# config files for Software Collections are under /etc/opt/rh/${scl} and
# var files are under /var/opt/rh/${scl}. So we need to insert the paths
# after the appropriate root dir.
def convert_copyspec_scl(self, scl, copyspec):
for rootdir in ['etc', 'var']:
p = re.compile('^/%s/' % rootdir)
copyspec = p.sub('/%s/opt/rh/%s/' % (rootdir, scl), copyspec)
return copyspec
def add_copy_spec_scl(self, scl, copyspecs):
"""Same as add_copy_spec, except that it prepends path to SCL root
to "copyspecs".
"""
if isinstance(copyspecs, six.string_types):
copyspecs = [copyspecs]
scl_copyspecs = []
for copyspec in copyspecs:
scl_copyspecs.append(self.convert_copyspec_scl(scl, copyspec))
self.add_copy_spec(scl_copyspecs)
def add_copy_spec_limit_scl(self, scl, copyspec, **kwargs):
"""Same as add_copy_spec_limit, except that it prepends path to SCL
root to "copyspec".
"""
self.add_copy_spec_limit(
self.convert_copyspec_scl(scl, copyspec),
**kwargs
)
class PowerKVMPlugin(RedHatPlugin):
"""Tagging class for IBM PowerKVM Linux"""
pass
class ZKVMPlugin(RedHatPlugin):
"""Tagging class for IBM ZKVM Linux"""
pass
class UbuntuPlugin(object):
"""Tagging class for Ubuntu Linux"""
pass
class DebianPlugin(object):
"""Tagging class for Debian Linux"""
pass
class SuSEPlugin(object):
"""Tagging class for SuSE Linux distributions"""
pass
class IndependentPlugin(object):
"""Tagging class for plugins that can run on any platform"""
pass
class ExperimentalPlugin(object):
"""Tagging class that indicates that this plugin is experimental"""
pass
def import_plugin(name, superclasses=None):
"""Import name as a module and return a list of all classes defined in that
module. superclasses should be a tuple of valid superclasses to import,
this defaults to (Plugin,).
"""
plugin_fqname = "sos.plugins.%s" % name
if not superclasses:
superclasses = (Plugin,)
return import_module(plugin_fqname, superclasses)
# vim: set et ts=4 sw=4 :
sosreport-3.5/sos/plugins/dovecot.py 0000644 0001750 0001750 00000002726 13203300002 017543 0 ustar caribou caribou # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
class Dovecot(Plugin):
"""Dovecot IMAP and POP3
"""
plugin_name = "dovecot"
profiles = ('mail',)
def setup(self):
self.add_copy_spec("/etc/dovecot*")
self.add_cmd_output("dovecot -n")
class RedHatDovecot(Dovecot, RedHatPlugin):
"""dovecot server related information
"""
def setup(self):
super(RedHatDovecot, self).setup()
packages = ('dovecot', )
files = ('/etc/dovecot.conf',)
class DebianDovecot(Dovecot, DebianPlugin, UbuntuPlugin):
"""dovecot server related information for Debian based distribution
"""
def setup(self):
super(DebianDovecot, self).setup()
files = ('/etc/dovecot/README',)
# vim: set et ts=4 sw=4 :
sosreport-3.5/sos/plugins/ssmtp.py 0000644 0001750 0001750 00000002455 13203300002 017245 0 ustar caribou caribou # Copyright (C) 2014 Red Hat, Inc. Bryn M. Reeves
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, RedHatPlugin
class Ssmtp(Plugin, RedHatPlugin):
"""sSMTP information
"""
plugin_name = 'ssmtp'
profiles = ('mail', 'system')
packages = ('ssmtp',)
def setup(self):
self.add_copy_spec([
"/etc/ssmtp/ssmtp.conf",
"/etc/ssmtp/revaliases",
"/etc/aliases"
])
def postproc(self):
self.do_file_sub(
'/etc/ssmtp/ssmtp.conf',
r'AuthPass=(\S*)',
r'AuthPass=********'
)
# vim: set et ts=4 sw=4 :
sosreport-3.5/sos/plugins/nodejs.py 0000644 0001750 0001750 00000002772 13203300002 017363 0 ustar caribou caribou # Copyright (C) 2016 Red Hat, Inc., Tomas Tomecek
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin, \
SuSEPlugin
class NodeJS(Plugin, RedHatPlugin, SuSEPlugin):
""" Get runtime version of NodeJS """
plugin_name = 'nodejs'
profiles = ('system',)
packages = ('nodejs',)
def setup(self):
# we could get much more info with:
# p = require("process"); console.log(p)
# unfortunately 'process' module is not available on 0.10
self.add_cmd_output("node -v", suggest_filename="nodejs-version")
class NodeJSUbuntu(NodeJS, UbuntuPlugin, DebianPlugin):
"""
Ubuntu/Debian require nodejs-legacy package in order to
have a node executable
"""
packages = ('nodejs', 'nodejs-legacy')
# vim: set et ts=4 sw=4 :
sosreport-3.5/sos/plugins/hardware.py 0000644 0001750 0001750 00000002443 13203300002 017671 0 ustar caribou caribou # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, RedHatPlugin, UbuntuPlugin, DebianPlugin
class Hardware(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
"""General hardware information
"""
plugin_name = "hardware"
profiles = ('system', 'hardware')
def setup(self):
self.add_copy_spec([
"/proc/interrupts",
"/proc/irq",
"/proc/dma",
"/proc/devices",
"/proc/rtc",
"/var/log/mcelog",
"/sys/class/dmi/id/*"
])
self.add_cmd_output("dmidecode", root_symlink="dmidecode")
# vim: set et ts=4 sw=4 :
sosreport-3.5/sos/plugins/mongodb.py 0000644 0001750 0001750 00000003756 13203300002 017531 0 ustar caribou caribou # Copyright (C) 2014 Red Hat, Inc., Bryn M. Reeves
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
class MongoDb(Plugin, DebianPlugin, UbuntuPlugin):
"""MongoDB document database
"""
plugin_name = 'mongodb'
profiles = ('services',)
packages = ('mongodb-server',)
var_puppet_gen = "/var/lib/config-data/puppet-generated/mongodb"
files = (
'/etc/mongodb.conf',
var_puppet_gen + '/etc/mongod.conf'
)
def setup(self):
self.add_copy_spec([
"/etc/mongodb.conf",
self.var_puppet_gen + "/etc/",
self.var_puppet_gen + "/etc/systemd/system/mongod.service.d/",
"/var/log/mongodb/mongodb.log",
"/var/log/containers/mongodb/mongodb.log"
])
def postproc(self):
self.do_file_sub(
"/etc/mongodb.conf",
r"(mms-token\s*=\s*.*)",
r"mms-token = ********"
)
self.do_file_sub(
self.var_puppet_gen + "/etc/mongodb.conf",
r"(mms-token\s*=\s*.*)",
r"mms-token = ********"
)
class RedHatMongoDb(MongoDb, RedHatPlugin):
def setup(self):
super(RedHatMongoDb, self).setup()
self.add_copy_spec("/etc/sysconfig/mongodb")
# vim: set et ts=4 sw=4 :
sosreport-3.5/sos/plugins/ipa.py 0000644 0001750 0001750 00000012656 13203300002 016654 0 ustar caribou caribou # Copyright (C) 2007 Red Hat, Inc., Kent Lamb
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, RedHatPlugin
from glob import glob
from os.path import exists
class Ipa(Plugin, RedHatPlugin):
""" Identity, policy, audit
"""
plugin_name = 'ipa'
profiles = ('identity',)
ipa_server = False
ipa_client = False
files = ('/etc/ipa',)
packages = ('ipa-server', 'ipa-client', 'freeipa-server', 'freeipa-client')
def check_ipa_server_version(self):
if self.is_installed("pki-server") \
or exists("/var/lib/pki") \
or exists("/usr/share/doc/ipa-server-4.2.0"):
return "v4"
elif self.is_installed("pki-common") \
or exists("/var/lib/pki-ca/"):
return "v3"
def ca_installed(self):
# Follow the same checks as IPA CA installer code
if exists("%s/conf/ca/CS.cfg" % self.pki_tomcat_dir_v4) \
or exists("%s/conf/CS.cfg" % self.pki_tomcat_dir_v3):
return True
def ipa_server_installed(self):
if self.is_installed("ipa-server") \
or self.is_installed("freeipa-server"):
return True
def retrieve_pki_logs(self, ipa_version):
if ipa_version == "v4":
self.add_copy_spec([
"/var/log/pki/pki-tomcat/ca/debug",
"/var/log/pki/pki-tomcat/ca/system",
"/var/log/pki/pki-tomcat/ca/transactions",
"/var/log/pki/pki-tomcat/catalina.*",
"/var/log/pki/pki-ca-spawn.*"
])
elif ipa_version == "v3":
self.add_copy_spec([
"/var/log/pki-ca/debug",
"/var/log/pki-ca/system",
"/var/log/pki-ca/transactions",
"/var/log/pki-ca/catalina.*",
"/var/log/pki/pki-ca-spawn.*"
])
def check_enabled(self):
self.ipa_server = self.is_installed("ipa-server")
self.ipa_client = self.is_installed("ipa-client")
return Plugin.check_enabled(self)
def setup(self):
self.pki_tomcat_dir_v4 = "/var/lib/pki/pki-tomcat"
self.pki_tomcat_dir_v3 = "/var/lib/pki-ca"
if self.ipa_server_installed():
self._log_debug("IPA server install detected")
ipa_version = self.check_ipa_server_version()
self._log_debug("IPA version is [%s]" % ipa_version)
self.add_copy_spec([
"/var/log/ipaserver-install.log",
"/var/log/ipareplica-install.log"
])
if self.ca_installed():
self._log_debug("CA is installed: retrieving PKI logs")
self.retrieve_pki_logs(ipa_version)
self.add_copy_spec([
"/var/log/ipaclient-install.log",
"/var/log/ipaupgrade.log",
"/var/log/krb5kdc.log",
"/var/log/dirsrv/slapd-*/logs/access",
"/var/log/dirsrv/slapd-*/logs/errors",
"/etc/dirsrv/slapd-*/dse.ldif",
"/etc/dirsrv/slapd-*/schema/99user.ldif",
"/etc/hosts",
"/etc/named.*",
"/etc/pki-ca/CS.cfg",
"/etc/ipa/ca.crt",
"/etc/ipa/default.conf",
"/var/lib/certmonger/requests/[0-9]*",
"/var/lib/certmonger/cas/[0-9]*"
])
self.add_forbidden_path("/etc/pki/nssdb/key*")
self.add_forbidden_path("/etc/pki-ca/flatfile.txt")
self.add_forbidden_path("/etc/pki-ca/password.conf")
self.add_forbidden_path("/var/lib/pki-ca/alias/key*")
self.add_forbidden_path("/etc/dirsrv/slapd-*/key*")
self.add_forbidden_path("/etc/dirsrv/slapd-*/pin.txt")
self.add_forbidden_path("/etc/dirsrv/slapd-*/pwdfile.txt")
self.add_forbidden_path("/etc/named.keytab")
self.add_cmd_output([
"ls -la /etc/dirsrv/slapd-*/schema/",
"getcert list",
"certutil -L -d /var/lib/pki-ca/alias",
"certutil -L -d /etc/httpd/alias/",
"klist -ket /etc/dirsrv/ds.keytab",
"klist -ket /etc/httpd/conf/ipa.keytab"
])
for certdb_directory in glob("/etc/dirsrv/slapd-*/"):
self.add_cmd_output(["certutil -L -d %s" % certdb_directory])
return
def postproc(self):
match = r"(\s*arg \"password )[^\"]*"
subst = r"\1********"
self.do_file_sub("/etc/named.conf", match, subst)
self.do_cmd_output_sub("getcert list",
r"(pin=)'(\d+)'",
r"\1'***'")
request_logs = "/var/lib/certmonger/requests/[0-9]*"
for request_log in glob(request_logs):
self.do_file_sub(request_log,
r"(key_pin=)(\d+)",
r"\1***")
# vim: set et ts=4 sw=4 :
sosreport-3.5/sos/plugins/kernelrt.py 0000644 0001750 0001750 00000003063 13073155336 017750 0 ustar caribou caribou # -*- python -*-
# -*- coding: utf-8 -*-
#
# Copyright 2012 Red Hat Inc.
# Guy Streeter
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; version 2.
#
# This application is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
from sos.plugins import Plugin, RedHatPlugin
class KernelRT(Plugin, RedHatPlugin):
'''Realtime kernel variant
'''
plugin_name = 'kernelrt'
profiles = ('system', 'hardware', 'kernel', 'mrg')
# this file exists only when the realtime kernel is booted
# this plugin will not be called is this file does not exist
files = ('/sys/kernel/realtime',)
def setup(self):
clocksource_path = '/sys/devices/system/clocksource/clocksource0/'
self.add_copy_spec([
'/etc/rtgroups',
'/proc/sys/kernel/sched_rt_period_us',
'/proc/sys/kernel/sched_rt_runtime_us',
'/sys/kernel/realtime',
clocksource_path + 'available_clocksource',
clocksource_path + 'current_clocksource'
])
# note: rhbz#1059685 'tuna - NameError: global name 'cgroups' is not
# defined this command throws an exception on versions prior to
# 0.10.4-5.
self.add_cmd_output('tuna -CP')
# vim: set et ts=4 sw=4 :
sosreport-3.5/sos/plugins/md.py 0000644 0001750 0001750 00000002313 13203300002 016470 0 ustar caribou caribou # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
class Md(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
"""MD RAID subsystem
"""
plugin_name = 'md'
profiles = ('storage',)
def setup(self):
self.add_cmd_output("mdadm -D /dev/md*")
self.add_copy_spec([
"/proc/mdstat",
"/etc/mdadm.conf",
"/dev/md/md-device-map",
"/proc/sys/dev/raid/*",
"/sys/block/md*/md*"
])
# vim: set et ts=4 sw=4 :
sosreport-3.5/sos/plugins/docker.py 0000644 0001750 0001750 00000007737 13203300002 017356 0 ustar caribou caribou # Copyright (C) 2014 Red Hat, Inc. Bryn M. Reeves
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, RedHatPlugin, UbuntuPlugin
class Docker(Plugin):
"""Docker containers
"""
plugin_name = 'docker'
profiles = ('virt',)
docker_cmd = "docker"
option_list = [
("all", "enable capture for all containers, even containers "
"that have terminated", 'fast', False),
("logs", "capture logs for running containers",
'fast', False),
("size", "capture image sizes for docker ps", 'slow', False)
]
def setup(self):
self.add_copy_spec([
"/var/lib/docker/repositories-*"
])
subcmds = [
'info',
'images',
'network ls',
'ps',
'ps -a',
'stats --no-stream',
'version'
]
for subcmd in subcmds:
self.add_cmd_output(
"{0} {1}".format(self.docker_cmd, subcmd)
)
# separately grab ps -s as this can take a *very* long time
if self.get_option('size'):
self.add_cmd_output('{0} ps -as'.format(self.docker_cmd))
self.add_journal(units="docker")
self.add_cmd_output("ls -alhR /etc/docker")
net_cmd = '{0} network ls'.format(self.docker_cmd)
nets = self.get_command_output(net_cmd)
if nets['status'] == 0:
n = [n.split()[1] for n in nets['output'].splitlines()[1:]]
for net in n:
self.add_cmd_output(
"{0} network inspect {1}".format(
self.docker_cmd,
net
)
)
ps_cmd = "{0} ps -q".format(self.docker_cmd)
if self.get_option('all'):
ps_cmd = "{0} -a".format(ps_cmd)
img_cmd = '{0} images -q'.format(self.docker_cmd)
insp = set()
for icmd in [ps_cmd, img_cmd]:
result = self.get_command_output(icmd)
if result['status'] == 0:
for con in result['output'].splitlines():
insp.add(con)
insp = list(insp)
if insp:
for container in insp:
self.add_cmd_output(
"{0} inspect {1}".format(
self.docker_cmd,
container
)
)
if self.get_option('logs'):
for container in containers:
self.add_cmd_output(
"{0} logs {1}".format(
self.docker_cmd,
container
)
)
class RedHatDocker(Docker, RedHatPlugin):
packages = ('docker', 'docker-latest', 'docker-io', 'docker-engine')
def setup(self):
super(RedHatDocker, self).setup()
self.add_copy_spec([
"/etc/udev/rules.d/80-docker.rules"
])
class UbuntuDocker(Docker, UbuntuPlugin):
packages = ('docker.io', 'docker-engine')
def setup(self):
super(UbuntuDocker, self).setup()
self.add_copy_spec([
"/etc/default/docker",
"/etc/docker/daemon.json",
"/var/run/docker/libcontainerd/containerd/events.log"
])
# vim: set et ts=4 sw=4 :
sosreport-3.5/sos/plugins/libraries.py 0000644 0001750 0001750 00000002373 13203300002 020052 0 ustar caribou caribou # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, RedHatPlugin, UbuntuPlugin
class Libraries(Plugin, RedHatPlugin, UbuntuPlugin):
"""Dynamic shared libraries
"""
plugin_name = 'libraries'
profiles = ('system',)
option_list = [
('ldconfigv', 'collect verbose ldconfig output', "slow", False)
]
def setup(self):
self.add_copy_spec(["/etc/ld.so.conf", "/etc/ld.so.conf.d"])
if self.get_option("ldconfigv"):
self.add_cmd_output("ldconfig -v -N -X")
self.add_cmd_output("ldconfig -p -N -X")
# vim: set et ts=4 sw=4 :
sosreport-3.5/sos/plugins/saltmaster.py 0000644 0001750 0001750 00000002323 13203300002 020250 0 ustar caribou caribou # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin
class SaltMaster(Plugin, RedHatPlugin, DebianPlugin):
"""Salt Master
"""
plugin_name = 'saltmaster'
profiles = ('sysmgmt',)
packages = ('salt-master',)
def setup(self):
if not self.get_option("all_logs"):
limit = self.get_option("log_size")
else:
limit = 0
self.add_copy_spec("/var/log/salt/master", sizelimit=limit)
self.add_cmd_output("salt-key --list all")
# vim: set et ts=4 sw=4 :
sosreport-3.5/sos/plugins/general.py 0000644 0001750 0001750 00000004020 13203300002 017502 0 ustar caribou caribou # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin
class General(Plugin):
"""general system information"""
plugin_name = "general"
profiles = ('system', 'sysmgmt')
def setup(self):
self.add_copy_spec([
"/etc/sos.conf",
"/etc/sysconfig",
"/proc/stat",
"/var/log/pm/suspend.log",
"/etc/hostid",
"/etc/localtime",
"/etc/os-release"
])
self.add_cmd_output("hostname -f")
self.add_cmd_output("hostname", root_symlink='hostname')
self.add_cmd_output("date", root_symlink="date")
self.add_cmd_output("uptime", root_symlink="uptime")
class RedHatGeneral(General, RedHatPlugin):
def setup(self):
super(RedHatGeneral, self).setup()
self.add_copy_spec([
"/etc/redhat-release",
"/etc/fedora-release",
"/var/log/up2date"
])
def postproc(self):
self.do_file_sub("/etc/sysconfig/rhn/up2date",
r"(\s*proxyPassword\s*=\s*)\S+", r"\1***")
class DebianGeneral(General, DebianPlugin):
def setup(self):
super(DebianGeneral, self).setup()
self.add_copy_spec([
"/etc/default",
"/etc/lsb-release",
"/etc/debian_version"
])
# vim: set et ts=4 sw=4 :
sosreport-3.5/sos/plugins/tftpserver.py 0000644 0001750 0001750 00000002131 13203300002 020272 0 ustar caribou caribou # Copyright (C) 2007 Shijoe George
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, RedHatPlugin
class TftpServer(Plugin, RedHatPlugin):
"""TFTP server
"""
plugin_name = 'tftpserver'
profiles = ('sysmgmt', 'network')
files = ('/etc/xinetd.d/tftp',)
packages = ('tftp-server',)
def setup(self):
self.add_cmd_output("ls -lanR /tftpboot")
# vim: set et ts=4 sw=4 :
sosreport-3.5/sos/plugins/openhpi.py 0000644 0001750 0001750 00000002312 13203300002 017531 0 ustar caribou caribou # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, RedHatPlugin
class OpenHPI(Plugin, RedHatPlugin):
"""Open Hardware Platform Interface
"""
plugin_name = 'openhpi'
profiles = ('system', 'hardware')
def setup(self):
self.add_copy_spec([
"/etc/openhpi/openhpi.conf",
"/etc/openhpi/openhpiclient.conf"
])
def postproc(self):
self.do_file_sub("/etc/openhpi/openhpi.conf",
r'(\s*[Pp]ass.*\s*=\s*).*', r'\1********')
# vim: set et ts=4 sw=4 :
sosreport-3.5/sos/plugins/rabbitmq.py 0000644 0001750 0001750 00000003360 13203300002 017674 0 ustar caribou caribou # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
class RabbitMQ(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
"""RabbitMQ messaging service
"""
plugin_name = 'rabbitmq'
profiles = ('services',)
var_puppet_gen = "/var/lib/config-data/puppet-generated/rabbitmq"
files = (
'/etc/rabbitmq/rabbitmq.conf',
var_puppet_gen + '/etc/rabbitmq/rabbitmq.config'
)
packages = ('rabbitmq-server',)
def setup(self):
self.add_cmd_output("rabbitmqctl report")
self.add_cmd_output("rabbitmqctl cluster_status")
self.add_cmd_output("rabbitmqctl list_policies")
self.add_copy_spec([
"/etc/rabbitmq/*",
self.var_puppet_gen + "/etc/rabbitmq/*",
self.var_puppet_gen + "/etc/security/limits.d/",
self.var_puppet_gen + "/etc/systemd/"
])
self.add_copy_spec([
"/var/log/rabbitmq/*",
"/var/log/containers/rabbitmq/*"
], sizelimit=self.get_option('log_size'))
# vim: set et ts=4 sw=4 :
sosreport-3.5/sos/plugins/sas3ircu.py 0000644 0001750 0001750 00000003117 13203300002 017627 0 ustar caribou caribou # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
# This sosreport plugin is meant for sas adapters.
# This plugin logs inforamtion on each adapter it finds.
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
class SAS3ircu(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
plugin_name = "sas3ircu"
commands = ("sas3ircu",)
def setup(self):
# get list of adapters
result = self.call_ext_prog("sas3ircu list", timeout=5)
if (result["status"] == 0):
self.add_cmd_output("sas3ircu list", timeout=5)
# only want devices
sas_lst = result["output"].splitlines()[10:-1]
# for each adapter get some basic info
for sas_info in sas_lst:
sas_num = sas_info.split()[0]
self.add_cmd_output("sas3ircu %s display" % sas_num, timeout=5)
self.add_cmd_output("sas3ircu %s status" % sas_num, timeout=5)
# vim: et ts=4 sw=4
sosreport-3.5/sos/plugins/soundcard.py 0000644 0001750 0001750 00000002727 13203300002 020063 0 ustar caribou caribou # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
class Soundcard(Plugin):
""" Sound devices
"""
plugin_name = "soundcard"
profiles = ('desktop', 'hardware')
def setup(self):
self.add_copy_spec("/proc/asound/*")
self.add_cmd_output([
"aplay -l",
"aplay -L",
"amixer"
])
class RedHatSoundcard(Soundcard, RedHatPlugin):
def setup(self):
super(RedHatSoundcard, self).setup()
self.add_copy_spec([
"/etc/alsa/*",
"/etc/asound.*"
])
class DebianSoundcard(Soundcard, DebianPlugin, UbuntuPlugin):
def setup(self):
super(DebianSoundcard, self).setup()
self.add_copy_spec("/etc/pulse/*")
# vim: set et ts=4 sw=4 :
sosreport-3.5/sos/plugins/openstack_neutron.py 0000644 0001750 0001750 00000012555 13203300002 021642 0 ustar caribou caribou # Copyright (C) 2013 Red Hat, Inc., Brent Eagles
# Copyright (C) 2017 Red Hat, Inc., Martin Schuppert
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
import os
class OpenStackNeutron(Plugin):
"""OpenStack Networking
"""
plugin_name = "openstack_neutron"
profiles = ('openstack', 'openstack_controller', 'openstack_compute')
var_puppet_gen = "/var/lib/config-data/puppet-generated/neutron"
def setup(self):
self.limit = self.get_option("log_size")
if self.get_option("all_logs"):
self.add_copy_spec([
"/var/log/neutron/",
"/var/log/containers/neutron/",
"/var/log/containers/httpd/neutron-api/"
], sizelimit=self.limit)
else:
self.add_copy_spec([
"/var/log/neutron/*.log",
"/var/log/containers/neutron/*.log",
"/var/log/containers/httpd/neutron-api/*log"
], sizelimit=self.limit)
self.add_copy_spec([
"/etc/neutron/",
self.var_puppet_gen + "/etc/neutron/",
self.var_puppet_gen + "/etc/default/neutron-server",
self.var_puppet_gen + "/etc/my.cnf.d/tripleo.cnf"
])
self.add_copy_spec("/var/lib/neutron/")
if self.get_option("verify"):
self.add_cmd_output("rpm -V %s" % ' '.join(self.packages))
vars_all = [p in os.environ for p in [
'OS_USERNAME', 'OS_PASSWORD']]
vars_any = [p in os.environ for p in [
'OS_TENANT_NAME', 'OS_PROJECT_NAME']]
if not (all(vars_all) and any(vars_any)):
self.soslog.warning("Not all environment variables set. Source "
"the environment file for the user intended "
"to connect to the OpenStack environment.")
else:
self.add_cmd_output("openstack subnet list")
self.add_cmd_output("openstack port list")
self.add_cmd_output("openstack router list")
self.add_cmd_output("openstack network agent list")
self.add_cmd_output("openstack network list")
self.add_cmd_output("openstack extension list")
self.add_cmd_output("openstack floating ip list")
self.add_cmd_output("openstack security group list")
def postproc(self):
protect_keys = [
"rabbit_password", "qpid_password", "nova_admin_password",
"xenapi_connection_password", "password", "connection",
"admin_password", "metadata_proxy_shared_secret", "eapi_password",
"crd_password", "primary_l3_host_password", "serverauth",
"ucsm_password", "ha_vrrp_auth_password", "ssl_key_password",
"nsx_password", "vcenter_password", "edge_appliance_password",
"tenant_admin_password", "apic_password", "server_auth"
]
regexp = r"((?m)^\s*(%s)\s*=\s*)(.*)" % "|".join(protect_keys)
self.do_path_regex_sub("/etc/neutron/*", regexp, r"\1*********")
self.do_path_regex_sub(
self.var_puppet_gen + "/etc/neutron/*",
regexp, r"\1*********"
)
class DebianNeutron(OpenStackNeutron, DebianPlugin, UbuntuPlugin):
packages = [
'neutron-common',
'neutron-plugin-cisco',
'neutron-plugin-linuxbridge-agent',
'neutron-plugin-nicira',
'neutron-plugin-openvswitch',
'neutron-plugin-openvswitch-agent',
'neutron-plugin-ryu',
'neutron-plugin-ryu-agent',
'neutron-server',
'python-neutron',
'python-neutronclient'
]
def check_enabled(self):
return self.is_installed("neutron-common")
def setup(self):
super(DebianNeutron, self).setup()
self.add_copy_spec("/etc/sudoers.d/neutron_sudoers")
class RedHatNeutron(OpenStackNeutron, RedHatPlugin):
packages = [
'openstack-neutron',
'openstack-neutron-linuxbridge'
'openstack-neutron-metaplugin',
'openstack-neutron-openvswitch',
'openstack-neutron-bigswitch',
'openstack-neutron-brocade',
'openstack-neutron-cisco',
'openstack-neutron-hyperv',
'openstack-neutron-midonet',
'openstack-neutron-nec'
'openstack-neutron-nicira',
'openstack-neutron-plumgrid',
'openstack-neutron-ryu',
'python-neutron',
'python-neutronclient'
]
def check_enabled(self):
return self.is_installed("openstack-neutron")
def setup(self):
super(RedHatNeutron, self).setup()
self.add_copy_spec("/etc/sudoers.d/neutron-rootwrap")
# vim: set et ts=4 sw=4 :
sosreport-3.5/sos/plugins/sysvipc.py 0000644 0001750 0001750 00000002375 13203300002 017600 0 ustar caribou caribou # Copyright (C) 2007-2012 Red Hat, Inc., Bryn M. Reeves
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
class SysVIPC(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
"""SysV IPC
"""
plugin_name = "sysvipc"
profiles = ('system', 'services')
def setup(self):
self.add_copy_spec([
"/proc/sysvipc/msg",
"/proc/sysvipc/sem",
"/proc/sysvipc/shm"
])
self.add_cmd_output([
"ipcs",
"ipcs -u"
])
# vim: set et ts=4 sw=4 :
sosreport-3.5/sos/plugins/openssl.py 0000644 0001750 0001750 00000003620 13203300002 017555 0 ustar caribou caribou # Copyright (C) 2007 Sadique Puthen
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
class OpenSSL(Plugin):
"""OpenSSL configuration
"""
plugin_name = "openssl"
profiles = ('network', 'security')
packages = ('openssl',)
verify_packages = ('openssl.*',)
def postproc(self):
protect_keys = [
"input_password",
"output_password",
"challengePassword"
]
regexp = r"(?m)^(\s*#?\s*(%s).*=)(.*)" % "|".join(protect_keys)
self.do_file_sub(
'/etc/ssl/openssl.cnf',
regexp,
r"\1 ******"
)
class RedHatOpenSSL(OpenSSL, RedHatPlugin):
"""openssl related information
"""
files = ('/etc/pki/tls/openssl.cnf',)
def setup(self):
super(RedHatOpenSSL, self).setup()
self.add_copy_spec("/etc/pki/tls/openssl.cnf")
class DebianOpenSSL(OpenSSL, DebianPlugin, UbuntuPlugin):
"""openssl related information for Debian distributions
"""
files = ('/etc/ssl/openssl.cnf',)
def setup(self):
super(DebianOpenSSL, self).setup()
self.add_copy_spec("/etc/ssl/openssl.cnf")
# vim: set et ts=4 sw=4 :
sosreport-3.5/sos/plugins/ssh.py 0000644 0001750 0001750 00000002231 13203300002 016664 0 ustar caribou caribou # Copyright (C) 2007 Red Hat, Inc., Eugene Teo
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
class Ssh(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
"""Secure shell service
"""
plugin_name = 'ssh'
profiles = ('services', 'security', 'identity')
def setup(self):
self.add_copy_spec([
"/etc/ssh/ssh_config",
"/etc/ssh/sshd_config"
])
# vim: set et ts=4 sw=4 :
sosreport-3.5/sos/plugins/openstack_cinder.py 0000644 0001750 0001750 00000011124 13203300002 021403 0 ustar caribou caribou # Copyright (C) 2009 Red Hat, Inc., Joey Boggs
# Copyright (C) 2012 Rackspace US, Inc.,
# Justin Shepherd
# Copyright (C) 2013 Red Hat, Inc., Flavio Percoco
# Copyright (C) 2013 Red Hat, Inc., Jeremy Agee
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
class OpenStackCinder(Plugin):
"""OpenStack cinder
"""
plugin_name = "openstack_cinder"
profiles = ('openstack', 'openstack_controller')
option_list = [("db", "gathers openstack cinder db version", "slow",
False)]
var_puppet_gen = "/var/lib/config-data/puppet-generated/cinder"
def setup(self):
if self.get_option("db"):
self.add_cmd_output(
"cinder-manage db version",
suggest_filename="cinder_db_version")
self.add_copy_spec([
"/etc/cinder/",
self.var_puppet_gen + "/etc/cinder/",
self.var_puppet_gen + "/etc/httpd/conf/",
self.var_puppet_gen + "/etc/httpd/conf.d/",
self.var_puppet_gen + "/etc/httpd/conf.modules.d/*.conf",
self.var_puppet_gen + "/etc/my.cnf.d/tripleo.cnf",
self.var_puppet_gen + "/etc/sysconfig/",
])
self.limit = self.get_option("log_size")
if self.get_option("all_logs"):
self.add_copy_spec([
"/var/log/cinder/",
"/var/log/httpd/cinder*",
"/var/log/containers/cinder/",
"/var/log/containers/httpd/cinder-api/"
], sizelimit=self.limit)
else:
self.add_copy_spec([
"/var/log/cinder/*.log",
"/var/log/httpd/cinder*.log",
"/var/log/containers/cinder/*.log",
"/var/log/containers/httpd/cinder-api/*log"
], sizelimit=self.limit)
if self.get_option("verify"):
self.add_cmd_output("rpm -V %s" % ' '.join(self.packages))
def postproc(self):
protect_keys = [
"admin_password", "backup_tsm_password", "chap_password",
"nas_password", "cisco_fc_fabric_password", "coraid_password",
"eqlx_chap_password", "fc_fabric_password",
"hitachi_auth_password", "hitachi_horcm_password",
"hp3par_password", "hplefthand_password", "memcache_secret_key",
"netapp_password", "netapp_sa_password", "nexenta_password",
"password", "qpid_password", "rabbit_password", "san_password",
"ssl_key_password", "vmware_host_password", "zadara_password",
"zfssa_initiator_password", "connection", "zfssa_target_password",
"os_privileged_user_password", "hmac_keys"
]
regexp = r"((?m)^\s*(%s)\s*=\s*)(.*)" % "|".join(protect_keys)
self.do_path_regex_sub("/etc/cinder/*", regexp, r"\1*********")
self.do_path_regex_sub(
self.var_puppet_gen + "/etc/cinder/*",
regexp, r"\1*********"
)
class DebianCinder(OpenStackCinder, DebianPlugin, UbuntuPlugin):
cinder = False
packages = (
'cinder-api',
'cinder-backup',
'cinder-common',
'cinder-scheduler',
'cinder-volume',
'python-cinder',
'python-cinderclient'
)
def check_enabled(self):
self.cinder = self.is_installed("cinder-common")
return self.cinder
def setup(self):
super(DebianCinder, self).setup()
class RedHatCinder(OpenStackCinder, RedHatPlugin):
cinder = False
packages = ('openstack-cinder',
'python-cinder',
'python-cinderclient')
def check_enabled(self):
self.cinder = self.is_installed("openstack-cinder")
return self.cinder
def setup(self):
super(RedHatCinder, self).setup()
self.add_copy_spec(["/etc/sudoers.d/cinder"])
# vim: set et ts=4 sw=4 :
sosreport-3.5/sos/plugins/azure.py 0000644 0001750 0001750 00000002517 13203300002 017224 0 ustar caribou caribou # Copyright (C) 2013 Adam Stokes
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, UbuntuPlugin, RedHatPlugin
class Azure(Plugin, UbuntuPlugin, RedHatPlugin):
""" Microsoft Azure client
"""
plugin_name = 'azure'
profiles = ('virt',)
packages = ('walinuxagent',)
def setup(self):
self.add_copy_spec([
"/var/log/waagent*",
"/var/lib/cloud",
"/etc/default/kv-kvp-daemon-init",
"/etc/waagent.conf",
"/sys/module/hv_netvsc/parameters/ring_size",
"/sys/module/hv_storvsc/parameters/storvsc_ringbuffer_size"
])
# vim: set et ts=4 sw=4 :
sosreport-3.5/sos/plugins/tuned.py 0000644 0001750 0001750 00000002621 13203300002 017211 0 ustar caribou caribou # Copyright (C) 2014 Red Hat, Inc., Peter Portante
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, RedHatPlugin
class Tuned(Plugin, RedHatPlugin):
"""Tuned system tuning daemon
"""
packages = ('tuned',)
profiles = ('system', 'performance')
plugin_name = 'tuned'
def setup(self):
self.add_cmd_output([
"tuned-adm list",
"tuned-adm active",
"tuned-adm recommend"
])
self.add_copy_spec([
"/etc/tuned.conf",
"/etc/tune-profiles"
])
self.add_copy_spec([
"/etc/tuned",
"/usr/lib/tuned",
"/var/log/tuned/tuned.log"
])
# vim: set et ts=4 sw=4 :
sosreport-3.5/sos/plugins/ppp.py 0000644 0001750 0001750 00000002327 13203300002 016674 0 ustar caribou caribou # Copyright (C) 2007 Sadique Puthen
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
class Ppp(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
"""Point-to-point protocol
"""
plugin_name = 'ppp'
profiles = ('system', 'network')
packages = ('ppp',)
def setup(self):
self.add_copy_spec([
"/etc/wvdial.conf",
"/etc/ppp",
"/var/log/ppp"
])
self.add_cmd_output("adsl-status")
# vim: set et ts=4 sw=4 :
sosreport-3.5/sos/plugins/npm.py 0000644 0001750 0001750 00000010364 13203300002 016667 0 ustar caribou caribou # Copyright (C) 2016 Red Hat, Inc., Tomas Tomecek
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
import os
import json
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin, \
SuSEPlugin
class Npm(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin, SuSEPlugin):
"""
Get info about available npm modules
"""
requires_root = False
plugin_name = 'npm'
profiles = ('system',)
option_list = [("project_path",
'List npm modules of a project specified by path',
'fast',
0)]
# in Fedora, Debian, Ubuntu and Suse the package is called npm
packages = ('npm',)
def _get_npm_output(self, cmd, filename, working_directory=None):
# stderr output is already part of the json, key "problems"
self.add_cmd_output(
cmd,
suggest_filename=filename,
stderr=False,
runat=working_directory
)
def _find_modules_in_npm_cache(self):
"""
Example 'npm cache ls' output
~/.npm
~/.npm/acorn
~/.npm/acorn/1.2.2
~/.npm/acorn/1.2.2/package.tgz
~/.npm/acorn/1.2.2/package
~/.npm/acorn/1.2.2/package/package.json
~/.npm/acorn/4.0.3
~/.npm/acorn/4.0.3/package.tgz
~/.npm/acorn/4.0.3/package
~/.npm/acorn/4.0.3/package/package.json
~/.npm/registry.npmjs.org
~/.npm/registry.npmjs.org/acorn
~/.npm/registry.npmjs.org/acorn/.cache.json
https://docs.npmjs.com/cli/cache
"""
output = {}
# with chroot=True (default) the command fails when run as non-root
user_cache = self.get_command_output("npm cache ls", chroot=False)
if user_cache['status'] == 0:
# filter out dirs with .cache.json ('registry.npmjs.org')
for package in [l for l in user_cache['output'].splitlines()
if l.endswith('package.tgz')]:
five_tuple = package.split(os.path.sep)
if len(five_tuple) != 5: # sanity check
continue
home, cache, name, version, package_tgz = five_tuple
if name not in output:
output[name] = [version]
else:
output[name].append(version)
self._log_debug("modules in cache: %s" % output)
outfn = self._make_command_filename("npm_cache_modules")
self.archive.add_string(json.dumps(output), outfn)
def setup(self):
if self.get_option("project_path") != 0:
project_path = os.path.abspath(os.path.expanduser(
self.get_option("project_path")))
self._get_npm_output("npm ls --json", "npm_ls_project",
working_directory=project_path)
self._get_npm_output("npm config list -l",
"npm_config_list_project",
working_directory=project_path)
self._get_npm_output("npm ls -g --json", "npm_ls_global")
self._get_npm_output("npm config list -l", "npm_config_list_global")
self._find_modules_in_npm_cache()
class NpmViaNodeJS(Npm):
"""
some distribution methods don't provide 'npm' via npm package
"""
# upstream doesn't have an npm package, it's just nodejs
# also in Fedora 24+ it is just nodejs, no npm package
packages = ('nodejs', )
# TODO: in RHEL npm and nodejs is available via software collections
# this should be handled separately
# vim: set et ts=4 sw=4 :
sosreport-3.5/sos/plugins/samba.py 0000644 0001750 0001750 00000004131 13203300002 017153 0 ustar caribou caribou # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
class Samba(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
"""Samba Windows interoperability
"""
packages = ('samba-common',)
plugin_name = "samba"
profiles = ('services',)
def setup(self):
self.limit = self.get_option("log_size")
self.add_copy_spec([
"/etc/samba/smb.conf",
"/etc/samba/lmhosts",
])
self.add_copy_spec("/var/log/samba/log.smbd", sizelimit=self.limit)
self.add_copy_spec("/var/log/samba/log.nmbd", sizelimit=self.limit)
self.add_copy_spec("/var/log/samba/log.winbindd", sizelimit=self.limit)
self.add_copy_spec("/var/log/samba/log.winbindd-idmap",
sizelimit=self.limit)
self.add_copy_spec("/var/log/samba/log.winbindd-dc-connect",
sizelimit=self.limit)
self.add_copy_spec("/var/log/samba/log.wb-*", sizelimit=self.limit)
if self.get_option("all_logs"):
self.add_copy_spec("/var/log/samba/", sizelimit=self.limit)
self.add_cmd_output([
"wbinfo --domain='.' -g",
"wbinfo --domain='.' -u",
"testparm -s",
])
class RedHatSamba(Samba, RedHatPlugin):
def setup(self):
super(RedHatSamba, self).setup()
self.add_copy_spec("/etc/sysconfig/samba")
# vim: set et ts=4 sw=4 :
sosreport-3.5/sos/plugins/devices.py 0000644 0001750 0001750 00000002141 13203300002 017511 0 ustar caribou caribou # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
class Devices(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
""" devices specific commands
"""
plugin_name = 'devices'
profiles = ('system', 'hardware', 'boot')
packages = ('udev', 'systemd-udev')
files = ('/dev',)
def setup(self):
self.add_cmd_output("udevadm info --export-db")
# vim: et ts=4 sw=4
sosreport-3.5/sos/plugins/vdo.py 0000644 0001750 0001750 00000002241 13203300002 016660 0 ustar caribou caribou #
# Copyright (c) 2017 Red Hat, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it would be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#
from sos.plugins import Plugin, RedHatPlugin
class Vdo(Plugin, RedHatPlugin):
"""Virtual Data Optimizer
"""
plugin_name = 'vdo'
profiles = ('storage',)
packages = ('vdo',)
files = (
'/sys/vdo',
'/sys/albireo',
'/etc/vdoconf.yml',
'/etc/vdoconf.xml'
)
def setup(self):
self.add_copy_spec(self.files)
self.add_cmd_output("vdo status")
# vim set et ts=4 sw=4 :
sosreport-3.5/sos/plugins/dmraid.py 0000644 0001750 0001750 00000003241 13203300002 017331 0 ustar caribou caribou # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
class Dmraid(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
"""dmraid software RAID
"""
plugin_name = 'dmraid'
profiles = ('hardware', 'storage')
packages = ('dmraid',)
option_list = [
("metadata", "capture dmraid device metadata", "slow", False)
]
# V - {-V/--version}
# b - {-b|--block_devices}
# r - {-r|--raid_devices}
# s - {-s|--sets}
# t - [-t|--test]
# a - {-a|--activate} {y|n|yes|no}
# D - [-D|--dump_metadata]
dmraid_options = ['V', 'b', 'r', 's', 'tay']
def setup(self):
for opt in self.dmraid_options:
self.add_cmd_output("dmraid -%s" % (opt,))
if self.get_option("metadata"):
metadata_path = self.get_cmd_output_path("metadata")
self.add_cmd_output("dmraid -rD", runat=metadata_path,
chroot=self.tmp_in_sysroot())
# vim: set et ts=4 sw=4 :
sosreport-3.5/sos/plugins/iscsi.py 0000644 0001750 0001750 00000003400 13203300002 017200 0 ustar caribou caribou # Copyright (C) 2007-2012 Red Hat, Inc., Ben Turner
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
class Iscsi(Plugin):
"""iSCSI initiator
"""
plugin_name = "iscsi"
profiles = ('storage',)
def setup(self):
var_puppet_gen = "/var/lib/config-data/puppet-generated/iscsid"
self.add_copy_spec([
"/etc/iscsi/iscsid.conf",
"/etc/iscsi/initiatorname.iscsi",
var_puppet_gen + "/etc/iscsi/initiatorname.iscsi",
"/var/lib/iscsi"
])
self.add_cmd_output([
"iscsiadm -m session -P 3",
"iscsiadm -m node -P 1",
"iscsiadm -m iface -P 1",
"iscsiadm -m node --op=show"
])
class RedHatIscsi(Iscsi, RedHatPlugin):
packages = ('iscsi-initiator-utils',)
def setup(self):
super(RedHatIscsi, self).setup()
class DebianIscsi(Iscsi, DebianPlugin, UbuntuPlugin):
packages = ('open-iscsi',)
def setup(self):
super(DebianIscsi, self).setup()
# vim: set et ts=4 sw=4 :
sosreport-3.5/sos/plugins/openstack_ansible.py 0000644 0001750 0001750 00000003321 13203300002 021554 0 ustar caribou caribou # Copyright (C) 2017 Major Hayden
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
class OpenStackAnsible(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
"""OpenStack-Ansible sos plugin."""
plugin_name = "openstack_ansible"
profiles = ('openstack',)
files = ('/etc/openstack_deploy/',)
def setup(self):
"""Gathering the contents of the report."""
self.add_copy_spec([
"/etc/openstack_deploy/",
"/etc/openstack-release",
"/etc/rpc_deploy/",
"/etc/rpc-release"
])
def postproc(self):
"""Remove sensitive keys and passwords from YAML files."""
secrets_files = [
"/etc/openstack_deploy/user_secrets.yml",
"/etc/rpc_deploy/user_secrets.yml"
]
regexp = r"(?m)^\s*#*([\w_]*:\s*).*"
for secrets_file in secrets_files:
self.do_path_regex_sub(
secrets_file,
regexp,
r"\1*********")
sosreport-3.5/sos/plugins/yum.py 0000644 0001750 0001750 00000006112 13203300002 016703 0 ustar caribou caribou # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, RedHatPlugin
class Yum(Plugin, RedHatPlugin):
"""yum information
"""
plugin_name = 'yum'
profiles = ('system', 'packagemanager', 'sysmgmt')
files = ('/etc/yum.conf',)
packages = ('yum',)
verify_packages = ('yum',)
option_list = [
("yumlist", "list repositories and packages", "slow", False),
("yumdebug", "gather yum debugging data", "slow", False),
("yum-history-info", "gather yum history info", "slow", False),
]
def setup(self):
# Pull all yum related information
self.add_copy_spec([
"/etc/yum",
"/etc/yum.repos.d",
"/etc/yum.conf",
"/var/log/yum.log"
])
# Get a list of channels the machine is subscribed to.
self.add_cmd_output("yum -C repolist")
# candlepin info
self.add_forbidden_path("/etc/pki/entitlement/key.pem")
self.add_forbidden_path("/etc/pki/entitlement/*-key.pem")
self.add_copy_spec([
"/etc/pki/product/*.pem",
"/etc/pki/consumer/cert.pem",
"/etc/pki/entitlement/*.pem"
])
self.add_cmd_output("yum history")
# packages installed/erased/updated per transaction
if self.get_option("yum-history-info"):
history = self.call_ext_prog("yum history")
transactions = None
if history['output']:
for line in history['output'].splitlines():
try:
transactions = int(line.split('|')[0].strip())
break
except ValueError:
pass
for tr_id in range(1, transactions+1):
self.add_cmd_output("yum history info %d" % tr_id)
if self.get_option("yumlist"):
# List various information about available packages
self.add_cmd_output("yum list")
if self.get_option("yumdebug") and self.is_installed('yum-utils'):
# RHEL6+ alternative for this whole function:
# self.add_cmd_output("yum-debug-dump '%s'"
# % os.path.join(self.commons['dstroot'],"yum-debug-dump"))
r = self.call_ext_prog("yum-debug-dump")
try:
self.add_cmd_output("zcat %s" % (r['output'].split()[-1],))
except IndexError:
pass
# vim: set et ts=4 sw=4 :
sosreport-3.5/sos/plugins/tomcat.py 0000644 0001750 0001750 00000004372 13203300002 017366 0 ustar caribou caribou # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, RedHatPlugin
from datetime import datetime
class Tomcat(Plugin, RedHatPlugin):
"""Apache Tomcat server
"""
plugin_name = 'tomcat'
profiles = ('webserver', 'java', 'services', 'sysmgmt')
packages = ('tomcat', 'tomcat6', 'tomcat7', 'tomcat8')
def setup(self):
self.add_copy_spec([
"/etc/tomcat",
"/etc/tomcat6",
"/etc/tomcat7",
"/etc/tomcat8"
])
limit = self.get_option("log_size")
if not self.get_option("all_logs"):
log_glob = "/var/log/tomcat*/catalina.out"
self.add_copy_spec(log_glob, sizelimit=limit)
# get today's date in iso format so that days/months below 10
# prepend 0
today = datetime.date(datetime.now()).isoformat()
log_glob = "/var/log/tomcat*/catalina.%s.log" % today
self.add_copy_spec(log_glob, sizelimit=limit)
else:
self.add_copy_spec("/var/log/tomcat*/*")
def postproc(self):
serverXmlPasswordAttributes = ['keyPass', 'keystorePass',
'truststorePass', 'SSLPassword']
for attr in serverXmlPasswordAttributes:
self.do_path_regex_sub(
r"\/etc\/tomcat.*\/server.xml",
r"%s=(\S*)" % attr,
r'%s="********"' % attr
)
self.do_path_regex_sub(
r"\/etc\/tomcat.*\/tomcat-users.xml",
r"password=(\S*)",
r'password="********"'
)
# vim: set et ts=4 sw=4 :
sosreport-3.5/sos/plugins/sar.py 0000644 0001750 0001750 00000005763 13203300002 016671 0 ustar caribou caribou # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
import os
class Sar(Plugin,):
"""System Activity Reporter
"""
plugin_name = 'sar'
profiles = ('system', 'performance')
packages = ('sysstat',)
sa_path = '/var/log/sa'
option_list = [("all_sar", "gather all system activity records",
"", False)]
# size-limit SAR data collected by default (MB)
sa_size = 20
def setup(self):
if self.get_option("all_sar"):
self.sa_size = 0
# Copy all sa??, sar??, sa??.* and sar??.* files, which will net
# compressed and uncompressed versions, typically.
for suffix in ('', '.*'):
self.add_copy_spec(
os.path.join(self.sa_path, "sa[0-3][0-9]" + suffix),
sizelimit=self.sa_size, tailit=False
)
self.add_copy_spec(
os.path.join(self.sa_path, "sar[0-3][0-9]" + suffix),
sizelimit=self.sa_size, tailit=False
)
try:
dir_list = os.listdir(self.sa_path)
except:
self._log_warn("sar: could not list %s" % self.sa_path)
return
# find all the sa files that don't have an existing sar file
for fname in dir_list:
if fname.startswith('sar'):
continue
if not fname.startswith('sa'):
continue
if len(fname) != 4:
# We either have an "sa" or "sa?" file, or more likely, a
# compressed data file like, "sa??.xz".
#
# FIXME: We don't have a detector for the kind of compression
# use for this file right now, so skip these kinds of files.
continue
sa_data_path = os.path.join(self.sa_path, fname)
sar_filename = 'sar' + fname[2:]
if sar_filename not in dir_list:
sar_cmd = 'sh -c "sar -A -f %s"' % sa_data_path
self.add_cmd_output(sar_cmd, sar_filename)
sadf_cmd = "sadf -x %s" % sa_data_path
self.add_cmd_output(sadf_cmd, "%s.xml" % fname)
class RedHatSar(Sar, RedHatPlugin):
sa_path = '/var/log/sa'
class DebianSar(Sar, DebianPlugin, UbuntuPlugin):
sa_path = '/var/log/sysstat'
# vim: set et ts=4 sw=4 :
sosreport-3.5/sos/plugins/xen.py 0000644 0001750 0001750 00000007575 13203300002 016701 0 ustar caribou caribou # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, RedHatPlugin
import os
import re
from stat import *
class Xen(Plugin, RedHatPlugin):
"""Xen virtualization
"""
plugin_name = 'xen'
profiles = ('virt',)
def determine_xen_host(self):
if os.access("/proc/acpi/dsdt", os.R_OK):
result = self.call_ext_prog("grep -qi xen /proc/acpi/dsdt")
if result['status'] == 0:
return "hvm"
if os.access("/proc/xen/capabilities", os.R_OK):
result = self.call_ext_prog(
"grep -q control_d /proc/xen/capabilities")
if result['status'] == 0:
return "dom0"
else:
return "domU"
return "baremetal"
def check_enabled(self):
return (self.determine_xen_host() == "baremetal")
def is_running_xenstored(self):
xs_pid = self.call_ext_prog("pidof xenstored")['output']
xs_pidnum = re.split('\n$', xs_pid)[0]
return xs_pidnum.isdigit()
def dom_collect_proc(self):
self.add_copy_spec([
"/proc/xen/balloon",
"/proc/xen/capabilities",
"/proc/xen/xsd_kva",
"/proc/xen/xsd_port"])
# determine if CPU has PAE support
self.add_cmd_output("grep pae /proc/cpuinfo")
# determine if CPU has Intel-VT or AMD-V support
self.add_cmd_output("egrep -e 'vmx|svm' /proc/cpuinfo")
def setup(self):
host_type = self.determine_xen_host()
if host_type == "domU":
# we should collect /proc/xen and /sys/hypervisor
self.dom_collect_proc()
# determine if hardware virtualization support is enabled
# in BIOS: /sys/hypervisor/properties/capabilities
self.add_copy_spec("/sys/hypervisor")
elif host_type == "hvm":
# what do we collect here???
pass
elif host_type == "dom0":
# default of dom0, collect lots of system information
self.add_copy_spec([
"/var/log/xen",
"/etc/xen",
"/sys/hypervisor/version",
"/sys/hypervisor/compilation",
"/sys/hypervisor/properties",
"/sys/hypervisor/type"])
self.add_cmd_output([
"xm dmesg",
"xm info",
"xm list",
"xm list --long",
"brctl show"
])
self.dom_collect_proc()
if self.is_running_xenstored():
self.add_copy_spec("/sys/hypervisor/uuid")
self.add_cmd_output("xenstore-ls")
else:
# we need tdb instead of xenstore-ls if cannot get it.
self.add_copy_spec("/var/lib/xenstored/tdb")
# FIXME: we *might* want to collect things in /sys/bus/xen*,
# /sys/class/xen*, /sys/devices/xen*, /sys/modules/blk*,
# /sys/modules/net*, but I've never heard of them actually being
# useful, so I'll leave it out for now
else:
# for bare-metal, we don't have to do anything special
return # USEFUL
self.add_custom_text("Xen hostType: "+host_type)
# vim: set et ts=4 sw=4 :
sosreport-3.5/sos/plugins/lvm2.py 0000644 0001750 0001750 00000006036 13203300002 016756 0 ustar caribou caribou # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
class Lvm2(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
"""LVM2 volume manager
"""
plugin_name = 'lvm2'
profiles = ('storage',)
option_list = [("lvmdump", 'collect an lvmdump tarball', 'fast', False),
("lvmdump-am", 'attempt to collect an lvmdump with '
'advanced options and raw metadata collection', 'slow',
False)]
def do_lvmdump(self, metadata=False):
"""Collects an lvmdump in standard format with optional metadata
archives for each physical volume present.
"""
lvmdump_path = self.get_cmd_output_path(name="lvmdump", make=False)
lvmdump_cmd = "lvmdump %s -d '%s'"
lvmdump_opts = ""
if metadata:
lvmdump_opts = "-a -m"
cmd = lvmdump_cmd % (lvmdump_opts, lvmdump_path)
self.add_cmd_output(cmd, chroot=self.tmp_in_sysroot())
def setup(self):
# use locking_type 0 (no locks) when running LVM2 commands,
# from lvm.conf:
# Turn locking off by setting to 0 (dangerous: risks metadata
# corruption if LVM2 commands get run concurrently).
# None of the commands issued by sos ever modify metadata and this
# avoids the possibility of hanging lvm commands when another process
# or node holds a conflicting lock.
lvm_opts = '--config="global{locking_type=0}"'
self.add_cmd_output(
"vgdisplay -vv %s" % lvm_opts,
root_symlink="vgdisplay"
)
pvs_cols = 'pv_mda_free,pv_mda_size,pv_mda_count,pv_mda_used_count'
pvs_cols = pvs_cols + ',' + 'pe_start'
vgs_cols = 'vg_mda_count,vg_mda_free,vg_mda_size,vg_mda_used_count'
vgs_cols = vgs_cols + ',' + 'vg_tags'
lvs_cols = 'lv_tags,devices'
self.add_cmd_output([
"vgscan -vvv %s" % lvm_opts,
"pvscan -v %s" % lvm_opts,
"pvs -a -v -o +%s %s" % (pvs_cols, lvm_opts),
"vgs -v -o +%s %s" % (vgs_cols, lvm_opts),
"lvs -a -o +%s %s" % (lvs_cols, lvm_opts)
])
self.add_copy_spec("/etc/lvm")
if self.get_option('lvmdump'):
self.do_lvmdump()
elif self.get_option('lvmdump-am'):
self.do_lvmdump(metadata=True)
# vim: set et ts=4 sw=4 :
sosreport-3.5/sos/plugins/monit.py 0000644 0001750 0001750 00000005371 13203300002 017225 0 ustar caribou caribou # Copyright (C) 2015 Red Hat, Inc.,
# Pablo Iranzo Gomez
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, RedHatPlugin
from glob import glob
class Monit(Plugin, RedHatPlugin):
"""Monit monitoring daemon
"""
packages = ('monit',)
profiles = ('system',)
plugin_name = 'monit'
# Define configuration files
# FIXME: direct globs will fail in container environments.
monit_conf = glob("/etc/monit.d/*")
monit_conf.append("/etc/monit.conf")
monit_conf.append("/etc/monitrc")
# Define log files
monit_log = ["/var/log/monit.log"]
option_list = []
def setup(self):
self.add_cmd_output("monit status")
self.add_copy_spec(self.monit_log + self.monit_conf)
def postproc(self):
# Post process the files included to scrub any
# password or other sensitive data
# usernames and emails are cleaned to not disclose any
# confidential data
for file in self.monit_conf:
# Remove username:password from files
self.do_file_sub(file,
r"allow (.*):(.*)",
r"allow ********:********"
)
self.do_file_sub(file,
r"ALLOW (.*):(.*)",
r"ALLOW ********:********"
)
# Remove MAILSERVER username/password
self.do_file_sub(file,
r"username (\w)+",
r"username ********"
)
self.do_file_sub(file,
r"password (\w)+",
r"password ********"
)
self.do_file_sub(file,
r"USERNAME (\w)+",
r"USERNAME ********"
)
self.do_file_sub(file,
r"PASSWORD (\w)+",
r"PASSWORD ********"
)
# vim: et ts=4 sw=4
sosreport-3.5/sos/plugins/apache.py 0000644 0001750 0001750 00000007765 13203300002 017331 0 ustar caribou caribou # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
class Apache(Plugin):
"""Apache http daemon
"""
plugin_name = "apache"
profiles = ('webserver', 'openshift')
packages = ('httpd',)
files = ('/var/www/',)
option_list = [
("log", "gathers all apache logs", "slow", False)
]
def setup(self):
# collect list of installed modules
self.add_cmd_output(["apachectl -M"])
class RedHatApache(Apache, RedHatPlugin):
files = (
'/etc/httpd/conf/httpd.conf',
'/etc/httpd22/conf/httpd.conf',
'/etc/httpd24/conf/httpd.conf'
)
def setup(self):
super(RedHatApache, self).setup()
self.add_copy_spec([
"/etc/httpd/conf/httpd.conf",
"/etc/httpd/conf.d/*.conf",
"/etc/httpd/conf.modules.d/*.conf",
# JBoss Enterprise Web Server 2.x
"/etc/httpd22/conf/httpd.conf",
"/etc/httpd22/conf.d/*.conf",
# Red Hat JBoss Web Server 3.x
"/etc/httpd24/conf/httpd.conf",
"/etc/httpd24/conf.d/*.conf",
"/etc/httpd24/conf.modules.d/*.conf",
])
self.add_forbidden_path("/etc/httpd/conf/password.conf")
# determine how much logs to collect
self.limit = None if self.get_option("all_logs") else 5
# collect only the current log set by default
self.add_copy_spec("/var/log/httpd/access_log", self.limit)
self.add_copy_spec("/var/log/httpd/error_log", self.limit)
self.add_copy_spec("/var/log/httpd/ssl_access_log", self.limit)
self.add_copy_spec("/var/log/httpd/ssl_error_log", self.limit)
# JBoss Enterprise Web Server 2.x
self.add_copy_spec("/var/log/httpd22/access_log", self.limit)
self.add_copy_spec("/var/log/httpd22/error_log", self.limit)
self.add_copy_spec("/var/log/httpd22/ssl_access_log", self.limit)
self.add_copy_spec("/var/log/httpd22/ssl_error_log", self.limit)
# Red Hat JBoss Web Server 3.x
self.add_copy_spec("/var/log/httpd24/access_log", self.limit)
self.add_copy_spec("/var/log/httpd24/error_log", self.limit)
self.add_copy_spec("/var/log/httpd24/ssl_access_log", self.limit)
self.add_copy_spec("/var/log/httpd24/ssl_error_log", self.limit)
if self.get_option("log") or self.get_option("all_logs"):
self.add_copy_spec([
"/var/log/httpd/*",
# JBoss Enterprise Web Server 2.x
"/var/log/httpd22/*",
# Red Hat JBoss Web Server 3.x
"/var/log/httpd24/*"
])
class DebianApache(Apache, DebianPlugin, UbuntuPlugin):
files = ('/etc/apache2/apache2.conf',)
def setup(self):
super(DebianApache, self).setup()
self.add_copy_spec([
"/etc/apache2/*",
"/etc/default/apache2"
])
# determine how much logs to collect
self.limit = None if self.get_option("all_logs") else 15
# collect only the current log set by default
self.add_copy_spec("/var/log/apache2/access_log", self.limit)
self.add_copy_spec("/var/log/apache2/error_log", self.limit)
if self.get_option("log") or self.get_option("all_logs"):
self.add_copy_spec("/var/log/apache2/*")
# vim: set et ts=4 sw=4 :
sosreport-3.5/sos/plugins/gdm.py 0000644 0001750 0001750 00000002165 13203300002 016644 0 ustar caribou caribou # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
class Gdm(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
"""GNOME display manager
"""
plugin_name = 'gdm'
profiles = ('desktop',)
packages = ('gdm',)
def setup(self):
self.add_copy_spec("/etc/gdm/*")
self.add_journal(units="gdm")
self.add_cmd_output("systemctl status gdm.service")
# vim: set et ts=4 sw=4 :
sosreport-3.5/sos/plugins/block.py 0000644 0001750 0001750 00000003722 13203300002 017167 0 ustar caribou caribou # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
import os
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
class Block(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
"""Block device information
"""
plugin_name = 'block'
profiles = ('storage', 'hardware')
verify_packages = ('util-linux',)
files = ('/sys/block',)
def setup(self):
self.add_cmd_output([
"lsblk",
"lsblk -t",
"blkid -c /dev/null",
"blockdev --report",
"ls -lanR /dev",
"ls -lanR /sys/block"
])
# legacy location for non-/run distributions
self.add_copy_spec([
"/etc/blkid.tab",
"/run/blkid/blkid.tab",
"/proc/partitions",
"/proc/diskstats",
"/sys/block/*/queue/scheduler"
])
if os.path.isdir("/sys/block"):
for disk in os.listdir("/sys/block"):
if disk.startswith("ram"):
continue
disk_path = os.path.join('/dev/', disk)
self.add_cmd_output([
"udevadm info -ap /sys/block/%s" % (disk),
"parted -s %s unit s print" % (disk_path),
"fdisk -l %s" % disk_path
])
# vim: set et ts=4 sw=4 :
sosreport-3.5/sos/plugins/keepalived.py 0000644 0001750 0001750 00000002246 13203300002 020206 0 ustar caribou caribou # Copyright (C) 2014 Red Hat, Inc. Bryn M. Reeves
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, RedHatPlugin
class Keepalived(Plugin, RedHatPlugin):
"""Keepalived routing server
"""
plugin_name = 'keepalived'
profiles = ('webserver', 'network', 'cluster')
packages = ('keepalived',)
def setup(self):
self.add_copy_spec([
"/etc/keepalived/keepalived.conf",
"/etc/sysconfig/keepalived"
])
# vim: set et ts=4 sw=4 :
sosreport-3.5/sos/plugins/lstopo.py 0000644 0001750 0001750 00000003101 13203300002 017404 0 ustar caribou caribou # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
from distutils.spawn import find_executable
class Lstopo(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
"""lstopo / machine topology/numa node information
"""
plugin_name = "lstopo"
profiles = ("system", "hardware")
packages = ("hwloc-libs", )
def setup(self):
# binary depends on particular package, both require hwloc-libs one
# hwloc-gui provides lstopo command
# hwloc provides lstopo-no-graphics command
if find_executable("lstopo"):
cmd = "lstopo"
else:
cmd = "lstopo-no-graphics"
self.add_cmd_output("%s --whole-io --of console" % cmd,
suggest_filename="lstopo.txt")
self.add_cmd_output("%s --whole-io --of xml" % cmd,
suggest_filename="lstopo.xml")
sosreport-3.5/sos/plugins/pcp.py 0000644 0001750 0001750 00000012427 13203300002 016661 0 ustar caribou caribou # Copyright (C) 2014 Michele Baldessari
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin
import os
import os.path
from socket import gethostname
class Pcp(Plugin, RedHatPlugin, DebianPlugin):
"""Performance Co-Pilot data
"""
plugin_name = 'pcp'
profiles = ('system', 'performance')
packages = ('pcp',)
pcp_conffile = '/etc/pcp.conf'
# size-limit of PCP logger and manager data collected by default (MB)
option_list = [
("pcplogs", "size-limit in MB of pmlogger and pmmgr logs", "", 100),
]
pcp_sysconf_dir = None
pcp_var_dir = None
pcp_log_dir = None
pcp_hostname = ''
def get_size(self, path):
total_size = 0
for dirpath, dirnames, filenames in os.walk(path):
for f in filenames:
fp = os.path.join(dirpath, f)
total_size += os.path.getsize(fp)
return total_size
def pcp_parse_conffile(self):
try:
pcpconf = open(self.pcp_conffile, "r")
lines = pcpconf.readlines()
pcpconf.close()
except:
return False
env_vars = {}
for line in lines:
if line.startswith('#'):
continue
try:
(key, value) = line.strip().split('=')
env_vars[key] = value
except:
pass
try:
self.pcp_sysconf_dir = env_vars['PCP_SYSCONF_DIR']
self.pcp_var_dir = env_vars['PCP_VAR_DIR']
self.pcp_log_dir = env_vars['PCP_LOG_DIR']
except:
# Fail if all three env variables are not found
return False
return True
def setup(self):
self.limit = (None if self.get_option("all_logs")
else self.get_option("pcplogs"))
if not self.pcp_parse_conffile():
self._log_warn("could not parse %s" % self.pcp_conffile)
return
# Add PCP_SYSCONF_DIR (/etc/pcp) and PCP_VAR_DIR (/var/lib/pcp/config)
# unconditionally. Obviously if someone messes up their /etc/pcp.conf
# in a ridiculous way (i.e. setting PCP_SYSCONF_DIR to '/') this will
# break badly.
var_conf_dir = os.path.join(self.pcp_var_dir, 'config')
self.add_copy_spec([
self.pcp_sysconf_dir,
self.pcp_conffile,
var_conf_dir
])
# We explicitely avoid /var/lib/pcp/config/{pmchart,pmlogconf,pmieconf,
# pmlogrewrite} as in 99% of the cases they are just copies from the
# rpms. It does not make up for a lot of size but it contains many
# files
self.add_forbidden_path(os.path.join(var_conf_dir, 'pmchart'))
self.add_forbidden_path(os.path.join(var_conf_dir, 'pmlogconf'))
self.add_forbidden_path(os.path.join(var_conf_dir, 'pmieconf'))
self.add_forbidden_path(os.path.join(var_conf_dir, 'pmlogrewrite'))
# Take PCP_LOG_DIR/pmlogger/`hostname` + PCP_LOG_DIR/pmmgr/`hostname`
# The *default* directory structure for pmlogger is the following:
# Dir: PCP_LOG_DIR/pmlogger/HOST/ (we only collect the HOST data
# itself)
# - YYYYMMDD.HH.MM.{N,N.index,N.meta} N in [0,1,...]
# - Latest
# - pmlogger.{log,log.prior}
#
# Can be changed via configuration in PCP_SYSCONF_DIR/pmlogger/control
# As a default strategy, collect up to 100MB data from each dir.
# Can be overwritten either via pcp.pcplogsize option or all_logs.
self.pcp_hostname = gethostname()
# Make sure we only add the two dirs if hostname is set, otherwise
# we would collect everything
if self.pcp_hostname != '':
for pmdir in ('pmlogger', 'pmmgr'):
path = os.path.join(self.pcp_log_dir, pmdir,
self.pcp_hostname)
self.add_copy_spec(path, sizelimit=self.limit)
self.add_copy_spec([
# Collect PCP_LOG_DIR/pmcd and PCP_LOG_DIR/NOTICES
os.path.join(self.pcp_log_dir, 'pmcd'),
os.path.join(self.pcp_log_dir, 'NOTICES*'),
# Collect PCP_VAR_DIR/pmns
os.path.join(self.pcp_var_dir, 'pmns'),
# Also collect any other log and config files
# (as suggested by fche)
os.path.join(self.pcp_log_dir, '*/*.log*'),
os.path.join(self.pcp_log_dir, '*/*/*.log*'),
os.path.join(self.pcp_log_dir, '*/*/config*')
])
# Need to get the current status of the PCP infrastructure
self.add_cmd_output("pcp")
# vim: set et ts=4 sw=4 :
sosreport-3.5/sos/plugins/iprconfig.py 0000644 0001750 0001750 00000011122 13203300002 020046 0 ustar caribou caribou # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
# This plugin enables collection of logs for Power systems
import os
import re
from sos.plugins import Plugin, RedHatPlugin, UbuntuPlugin, DebianPlugin
from sos.utilities import is_executable
class IprConfig(Plugin, RedHatPlugin, UbuntuPlugin, DebianPlugin):
"""IBM Power RAID storage adapter configuration information
"""
plugin_name = 'iprconfig'
def check_enabled(self):
arch = self.policy().get_arch()
return "ppc64" in arch and is_executable("iprconfig")
def setup(self):
self.add_cmd_output([
"iprconfig -c show-config",
"iprconfig -c show-alt-config",
"iprconfig -c show-arrays",
"iprconfig -c show-jbod-disks",
"iprconfig -c show-ioas",
])
show_ioas = self.call_ext_prog("iprconfig -c show-ioas")
if not show_ioas['status'] == 0:
return
devices = []
if show_ioas['output']:
p = re.compile('sg')
for line in show_ioas['output'].splitlines():
temp = line.split(' ')
# temp[0] holds the device name
if p.search(temp[0]):
devices.append(temp[0])
for device in devices:
self.add_cmd_output("iprconfig -c show-details %s" % (device,))
# Look for IBM Power RAID enclosures (iprconfig lists them)
show_config = self.call_ext_prog("iprconfig -c show-config")
if not show_config['status'] == 0:
return
if not show_config['output']:
return
# iprconfig -c show-config
# Name PCI/SCSI Location Description Status
# ------ ------------------------- ------------------------- -----------------
# 0005:60:00.0/0: PCI-E SAS RAID Adapter Operational
# sda 0005:60:00.0/0:0:0:0 Physical Disk Active
# sdb 0005:60:00.0/0:1:0:0 Physical Disk Active
# sdc 0005:60:00.0/0:2:0:0 Physical Disk Active
# sdd 0005:60:00.0/0:3:0:0 Physical Disk Active
# sde 0005:60:00.0/0:4:0:0 Physical Disk Active
# sdf 0005:60:00.0/0:5:0:0 Physical Disk Active
# 0005:60:00.0/0:8:0:0 Enclosure Active
# 0005:60:00.0/0:8:1:0 Enclosure Active
show_alt_config = "iprconfig -c show-alt-config"
altconfig = self.call_ext_prog(show_alt_config)
if not (altconfig['status'] == 0):
return
if not altconfig['output']:
return
# iprconfig -c show-alt-config
# Name Resource Path/Address Vendor Product ID Status
# ------ -------------------------- -------- ---------------- -----------------
# sg9 0: IBM 57C7001SISIOA Operational
# sg0 0:0:0:0 IBM MBF2300RC Active
# sg1 0:1:0:0 IBM MBF2300RC Active
# sg2 0:2:0:0 IBM HUC106030CSS600 Active
# sg3 0:3:0:0 IBM HUC106030CSS600 Active
# sg4 0:4:0:0 IBM HUC106030CSS600 Active
# sg5 0:5:0:0 IBM HUC106030CSS600 Active
# sg7 0:8:0:0 IBM VSBPD6E4A 3GSAS Active
# sg8 0:8:1:0 IBM VSBPD6E4B 3GSAS Active
for line in show_config['output'].splitlines():
if "Enclosure" in line:
temp = re.split('\s+', line)
# temp[1] holds the PCI/SCSI location
pci, scsi = temp[1].split('/')
for line in altconfig['output'].splitlines():
if scsi in line:
temp = line.split(' ')
# temp[0] holds device name
self.add_cmd_output("iprconfig -c "
"query-ses-mode %s" % (temp[0],))
sosreport-3.5/sos/plugins/jars.py 0000644 0001750 0001750 00000012605 13203300002 017034 0 ustar caribou caribou # Copyright (C) 2016 Red Hat, Inc., Michal Srb
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
import hashlib
import json
import os
import re
import zipfile
from functools import partial
from sos.plugins import Plugin, RedHatPlugin
class Jars(Plugin, RedHatPlugin):
"""Collect information about available Java archives."""
plugin_name = "jars"
version = "1.0.0"
profiles = ("java",)
option_list = [
("append_locations", "colon-separated list of additional JAR paths",
"fast", ""),
("all_known_locations", "scan all known paths", "slow", False)
]
# There is no standard location for JAR files and scanning
# the whole filesystem could be very slow. Therefore we only
# scan directories in which JARs can be typically found.
jar_locations = (
"/usr/share/java", # common location for JARs
"/usr/lib/java" # common location for JARs containing native code
)
# Following paths can be optionally scanned as well. Note the scan can take
# *very* long time.
extra_jar_locations = (
"/opt", # location for RHSCL and 3rd party software
"/usr/local", # used by sysadmins when installing SW locally
"/var/lib" # Java services commonly explode WARs there
)
def setup(self):
results = {"jars": []}
jar_paths = []
locations = list(Jars.jar_locations)
if self.get_option("all_known_locations"):
locations += list(Jars.extra_jar_locations)
# append also user-defined locations, if any
user_locations = self.get_option("append_locations")
if user_locations:
locations += user_locations.split(":")
# find all JARs in given locations
for location in locations:
for dirpath, _, filenames in os.walk(location):
for filename in filenames:
path = os.path.join(dirpath, filename)
if Jars.is_jar(path):
jar_paths.append(path)
# try to extract information about found JARs
for jar_path in jar_paths:
maven_id = Jars.get_maven_id(jar_path)
jar_id = Jars.get_jar_id(jar_path)
if maven_id or jar_id:
record = {"path": jar_path,
"sha1": jar_id,
"maven_id": maven_id
}
results["jars"].append(record)
results_str = json.dumps(results, indent=4, separators=(",", ": "))
self.add_string_as_file(results_str, "jars.json")
@staticmethod
def is_jar(path):
"""Check whether given file is a JAR file.
JARs are ZIP files which usually include a manifest
at the canonical location 'META-INF/MANIFEST.MF'.
"""
if os.path.isfile(path) and zipfile.is_zipfile(path):
try:
with zipfile.ZipFile(path) as f:
if "META-INF/MANIFEST.MF" in f.namelist():
return True
except (IOError, zipfile.BadZipfile):
pass
return False
@staticmethod
def get_maven_id(jar_path):
"""Extract Maven coordinates from a given JAR file, if possible.
JARs build by Maven (most popular Java build system) contain
'pom.properties' file. We can extract Maven coordinates
from there.
"""
props = {}
try:
with zipfile.ZipFile(jar_path) as f:
r = re.compile("META-INF/maven/[^/]+/[^/]+/pom.properties$")
result = [x for x in f.namelist() if r.match(x)]
if len(result) != 1:
return None
with f.open(result[0]) as props_f:
for line in props_f.readlines():
line = line.strip()
if not line.startswith(b"#"):
try:
(key, value) = line.split(b"=")
key = key.decode('utf8').strip()
value = value.decode('utf8').strip()
props[key] = value
except ValueError:
return None
except IOError:
pass
return props
@staticmethod
def get_jar_id(jar_path):
"""Compute JAR id.
Returns sha1 hash of a given JAR file.
"""
jar_id = ""
try:
with open(jar_path, mode="rb") as f:
m = hashlib.sha1()
for buf in iter(partial(f.read, 4096), b''):
m.update(buf)
jar_id = m.hexdigest()
except IOError:
pass
return jar_id
sosreport-3.5/sos/plugins/docker_distribution.py 0000644 0001750 0001750 00000003174 13203300002 022144 0 ustar caribou caribou # Copyright (C) 2017 Red Hat, Inc. Jake Hunsaker
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, RedHatPlugin
import os
class DockerDistribution(Plugin):
"""Docker Distribution"""
plugin_name = "docker_distribution"
def setup(self):
self.add_copy_spec('/etc/docker-distribution/')
self.add_journal('docker-distribution')
if os.path.exists('/etc/docker-distribution/registry/config.yml'):
with open('/etc/docker-distribution/registry/config.yml') as f:
for line in f:
if 'rootdirectory' in line:
loc = line.split()[1]
self.add_cmd_output('tree ' + loc)
class RedHatDockerDistribution(DockerDistribution, RedHatPlugin):
packages = ('docker-distribution',)
def setup(self):
self.add_forbidden_path('/etc/docker-distribution/registry/*passwd')
super(RedHatDockerDistribution, self).setup()
sosreport-3.5/sos/plugins/logs.py 0000644 0001750 0001750 00000010273 13203300002 017040 0 ustar caribou caribou # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
import os
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
class Logs(Plugin):
"""System logs"""
plugin_name = "logs"
profiles = ('system', 'hardware', 'storage')
def setup(self):
self.add_copy_spec([
"/etc/syslog.conf",
"/etc/rsyslog.conf",
"/etc/rsyslog.d"
])
self.limit = (None if self.get_option("all_logs")
else self.get_option("log_size"))
self.add_copy_spec("/var/log/boot.log", sizelimit=self.limit)
self.add_copy_spec("/var/log/cloud-init*", sizelimit=self.limit)
self.add_journal(boot="this")
self.add_journal(boot="this", allfields=True, output="verbose")
self.add_cmd_output("journalctl --disk-usage")
if self.get_option('all_logs'):
syslog_conf = self.join_sysroot("/etc/syslog.conf")
logs = self.do_regex_find_all("^\S+\s+(-?\/.*$)\s+", syslog_conf)
if self.is_installed("rsyslog") \
or os.path.exists("/etc/rsyslog.conf"):
rsyslog_conf = self.join_sysroot("/etc/rsyslog.conf")
logs += self.do_regex_find_all("^\S+\s+(-?\/.*$)\s+",
rsyslog_conf)
for i in logs:
if i.startswith("-"):
i = i[1:]
if os.path.isfile(i):
self.add_copy_spec(i, sizelimit=self.limit)
def postproc(self):
self.do_path_regex_sub(
r"/etc/rsyslog*",
r"ActionLibdbiPassword (.*)",
r"ActionLibdbiPassword [********]"
)
self.do_path_regex_sub(
r"/etc/rsyslog*",
r"pwd=.*",
r"pwd=[******]"
)
class RedHatLogs(Logs, RedHatPlugin):
option_list = [
("log_days", "the number of days logs to collect", "", 3)
]
def setup(self):
super(RedHatLogs, self).setup()
messages = "/var/log/messages"
self.add_copy_spec("/var/log/secure*", sizelimit=self.limit)
self.add_copy_spec(messages + "*", sizelimit=self.limit)
# collect three days worth of logs by default if the system is
# configured to use the journal and not /var/log/messages
if not os.path.exists(messages) and self.is_installed("systemd"):
try:
days = int(self.get_option("log_days"))
except:
days = 3
if self.get_option("all_logs"):
since = ""
else:
since = "-%ddays" % days
self.add_journal(since=since)
class DebianLogs(Logs, DebianPlugin, UbuntuPlugin):
def setup(self):
super(DebianLogs, self).setup()
if not self.get_option("all_logs"):
self.add_copy_spec("/var/log/syslog", sizelimit=self.limit)
self.add_copy_spec("/var/log/syslog.1", sizelimit=self.limit)
self.add_copy_spec("/var/log/kern.log", sizelimit=self.limit)
self.add_copy_spec("/var/log/kern.log.1", sizelimit=self.limit)
self.add_copy_spec("/var/log/udev", sizelimit=self.limit)
self.add_copy_spec("/var/log/dist-upgrade", sizelimit=self.limit)
self.add_copy_spec("/var/log/installer", sizelimit=self.limit)
self.add_copy_spec("/var/log/unattended-upgrades",
sizelimit=self.limit)
self.add_cmd_output('ls -alRh /var/log/')
else:
self.add_copy_spec("/var/log/")
# vim: set et ts=4 sw=4 :
sosreport-3.5/sos/plugins/__pycache__/ 0000755 0001750 0001750 00000000000 13203254631 017747 5 ustar caribou caribou sosreport-3.5/sos/plugins/corosync.py 0000644 0001750 0001750 00000005106 13203300002 017732 0 ustar caribou caribou # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
import os.path
import re
class Corosync(Plugin):
""" Corosync cluster engine
"""
plugin_name = "corosync"
profiles = ('cluster',)
packages = ('corosync',)
def setup(self):
self.add_copy_spec([
"/etc/corosync",
"/var/lib/corosync/fdata",
"/var/log/cluster/corosync.log"
])
self.add_cmd_output([
"corosync-quorumtool -l",
"corosync-quorumtool -s",
"corosync-cpgtool",
"corosync-cfgtool -s",
"corosync-blackbox",
"corosync-objctl -a",
"corosync-cmapctl"
])
self.call_ext_prog("killall -USR2 corosync")
corosync_conf = "/etc/corosync/corosync.conf"
if not os.path.exists(corosync_conf):
return
# collect user-defined logfiles, matching either of pattern:
# log_size: filename
# or
# logging.log_size: filename
# (it isnt precise but sufficient)
pattern = '^\s*(logging.)?logfile:\s*(\S+)$'
try:
with open("/etc/corosync/corosync.conf") as f:
for line in f:
if re.match(pattern, line):
self.add_copy_spec(re.search(pattern, line).group(2))
except IOError as e:
self._log_warn("could not read from %s: %s", corosync_conf, e)
def postproc(self):
self.do_cmd_output_sub(
"corosync-objctl",
r"(.*fence.*\.passwd=)(.*)",
r"\1******"
)
class RedHatCorosync(Corosync, RedHatPlugin):
def setup(self):
super(RedHatCorosync, self).setup()
class DebianCorosync(Corosync, DebianPlugin, UbuntuPlugin):
def setup(self):
super(DebianCorosync, self).setup()
files = ('/usr/sbin/corosync',)
# vim: set et ts=4 sw=4 :
sosreport-3.5/sos/plugins/salt.py 0000644 0001750 0001750 00000002457 13203300002 017044 0 ustar caribou caribou # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin
class Salt(Plugin, RedHatPlugin, DebianPlugin):
"""Salt
"""
plugin_name = 'salt'
profiles = ('sysmgmt',)
packages = ('salt',)
def setup(self):
all_logs = self.get_option("all_logs")
limit = self.get_option("log_size")
if not all_logs:
self.add_copy_spec("/var/log/salt/minion", sizelimit=limit)
else:
self.add_copy_spec("/var/log/salt", sizelimit=limit)
self.add_copy_spec("/etc/salt")
self.add_forbidden_path("/etc/salt/pki/*/*.pem")
# vim: set et ts=4 sw=4 :
sosreport-3.5/sos/plugins/apparmor.py 0000644 0001750 0001750 00000002634 13203300002 017717 0 ustar caribou caribou # Copyright (c) 2012 Adam Stokes
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, UbuntuPlugin
class Apparmor(Plugin, UbuntuPlugin):
"""Apparmor mandatory access control
"""
plugin_name = 'apparmor'
profiles = ('security',)
def setup(self):
self.add_copy_spec([
"/etc/apparmor*"
])
self.add_forbidden_path("/etc/apparmor.d/cache")
self.add_forbidden_path("/etc/apparmor.d/libvirt/libvirt*")
self.add_forbidden_path("/etc/apparmor.d/abstractions")
self.add_cmd_output([
"apparmor_status",
"ls -alh /etc/apparmor.d/abstractions",
"ls -alh /etc/apparmor.d/libvirt",
])
# vim: set et ts=4 sw=4 :
sosreport-3.5/sos/plugins/pam.py 0000644 0001750 0001750 00000003031 13203300002 016643 0 ustar caribou caribou # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
class Pam(Plugin):
"""Pluggable Authentication Modules
"""
plugin_name = "pam"
profiles = ('security', 'identity', 'system')
verify_packages = ('pam_.*',)
security_libs = ""
def setup(self):
self.add_copy_spec([
"/etc/pam.d",
"/etc/security"
])
self.add_cmd_output([
"ls -lanF %s" % self.security_libs,
"pam_tally2",
"faillock"
])
class RedHatPam(Pam, RedHatPlugin):
security_libs = "/lib*/security"
def setup(self):
super(RedHatPam, self).setup()
class DebianPam(Pam, DebianPlugin, UbuntuPlugin):
security_libs = "/lib/x86_64-linux-gnu/security"
def setup(self):
super(DebianPam, self).setup()
# vim: set et ts=4 sw=4 :
sosreport-3.5/sos/plugins/ceph.py 0000644 0001750 0001750 00000005744 13203300002 017022 0 ustar caribou caribou # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, RedHatPlugin, UbuntuPlugin
class Ceph(Plugin, RedHatPlugin, UbuntuPlugin):
"""CEPH distributed storage
"""
plugin_name = 'ceph'
profiles = ('storage', 'virt')
packages = (
'ceph',
'ceph-mds',
'ceph-common',
'libcephfs1',
'ceph-fs-common',
'calamari-server',
'librados2'
)
def setup(self):
all_logs = self.get_option("all_logs")
limit = self.get_option("log_size")
if not all_logs:
self.add_copy_spec([
"/var/log/ceph/*.log",
"/var/log/radosgw/*.log",
"/var/log/calamari/*.log"
], sizelimit=limit)
else:
self.add_copy_spec([
"/var/log/ceph/",
"/var/log/calamari",
"/var/log/radosgw"
], sizelimit=limit)
self.add_copy_spec([
"/etc/ceph/",
"/etc/calamari/",
"/var/lib/ceph/",
"/var/run/ceph/"
])
self.add_cmd_output([
"ceph status",
"ceph health detail",
"ceph osd tree",
"ceph osd stat",
"ceph osd dump",
"ceph mon stat",
"ceph mon dump",
"ceph df",
"ceph report",
"ceph osd df tree",
"ceph fs dump --format json-pretty",
"ceph fs ls",
"ceph pg dump",
"ceph health detail --format json-pretty",
"ceph osd crush show-tunables",
"ceph-disk list"
])
self.add_forbidden_path("/etc/ceph/*keyring*")
self.add_forbidden_path("/var/lib/ceph/*keyring*")
self.add_forbidden_path("/var/lib/ceph/*/*keyring*")
self.add_forbidden_path("/var/lib/ceph/*/*/*keyring*")
self.add_forbidden_path("/var/lib/ceph/osd/*")
self.add_forbidden_path("/var/lib/ceph/mon/*")
# Excludes temporary ceph-osd mount location like
# /var/lib/ceph/tmp/mnt.XXXX from sos collection.
# In the /var/lib/ceph/tmp/ can still other files of potential
# interest exists, so exclude only known temporary mount locations.
self.add_forbidden_path("/var/lib/ceph/tmp/*mnt*")
self.add_forbidden_path("/etc/ceph/*bindpass*")
# vim: set et ts=4 sw=4 :
sosreport-3.5/sos/plugins/keyutils.py 0000644 0001750 0001750 00000002327 13203300002 017746 0 ustar caribou caribou # Copyright (C) 2014 Red Hat, Inc. Bryn M. Reeves
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, RedHatPlugin
class Keyutils(Plugin, RedHatPlugin):
"""Kernel key ring
"""
plugin_name = 'keyutils'
profiles = ('system', 'kernel', 'security', 'storage')
packages = ('keyutils',)
def setup(self):
self.add_copy_spec([
"/etc/request-key.conf",
"/etc/request-key.d",
"/proc/key-users"
])
self.add_cmd_output("keyctl show")
# vim: set et ts=4 sw=4 :
sosreport-3.5/sos/plugins/openstack_sahara.py 0000644 0001750 0001750 00000006234 13203300002 021404 0 ustar caribou caribou # Copyright (C) 2015 Red Hat, Inc.,Poornima M. Kshirsagar
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
class OpenStackSahara(Plugin):
"""OpenStack Sahara"""
plugin_name = 'openstack_sahara'
profiles = ('openstack', 'openstack_controller')
option_list = []
var_puppet_gen = "/var/lib/config-data/puppet-generated/sahara"
def setup(self):
self.add_copy_spec([
"/etc/sahara/",
self.var_puppet_gen + "/etc/sahara/"
])
self.add_journal(units="openstack-sahara-all")
self.add_journal(units="openstack-sahara-api")
self.add_journal(units="openstack-sahara-engine")
self.limit = self.get_option("log_size")
if self.get_option("all_logs"):
self.add_copy_spec([
"/var/log/sahara/",
"/var/log/containers/sahara/"
], sizelimit=self.limit)
else:
self.add_copy_spec([
"/var/log/sahara/*.log",
"/var/log/containers/sahara/*.log"
], sizelimit=self.limit)
if self.get_option("verify"):
self.add_cmd_output("rpm -V %s" % ' '.join(self.packages))
def postproc(self):
protect_keys = [
"admin_password", "memcache_secret_key", "password",
"qpid_password", "rabbit_password", "ssl_key_password",
"xenapi_connection_password", "connection"
]
regexp = r"((?m)^\s*(%s)\s*=\s*)(.*)" % "|".join(protect_keys)
self.do_path_regex_sub("/etc/sahara/*", regexp, r"\1*********")
self.do_path_regex_sub(
self.var_puppet_gen + "/etc/sahara/*",
regexp, r"\1*********"
)
class DebianSahara(OpenStackSahara, DebianPlugin, UbuntuPlugin):
"""OpenStackSahara related information for Debian based distributions."""
packages = (
'sahara-api',
'sahara-common',
'sahara-engine',
'python-sahara',
'python-saharaclient',
)
def setup(self):
super(DebianSahara, self).setup()
class RedHatSahara(OpenStackSahara, RedHatPlugin):
"""OpenStack sahara related information for Red Hat distributions."""
packages = (
'openstack-sahara',
'openstack-sahara-api',
'openstack-sahara-engine',
'python-saharaclient'
)
def setup(self):
super(RedHatSahara, self).setup()
self.add_copy_spec("/etc/sudoers.d/sahara*")
# vim: et ts=4 sw=4
sosreport-3.5/sos/plugins/networking.py 0000644 0001750 0001750 00000035745 13203300002 020276 0 ustar caribou caribou # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, RedHatPlugin, UbuntuPlugin, DebianPlugin
import os
import re
class Networking(Plugin):
"""network and device configuration
"""
plugin_name = "networking"
profiles = ('network', 'hardware', 'system')
trace_host = "www.example.com"
option_list = [(
("traceroute", "collect a traceroute to %s" % trace_host, "slow",
False)
)]
# switch to enable netstat "wide" (non-truncated) output mode
ns_wide = "-W"
def get_bridge_name(self, brctl_file):
"""Return a list for which items are bridge name according to the
output of brctl show stored in brctl_file.
"""
out = []
try:
brctl_out = open(brctl_file).read()
except:
return out
for line in brctl_out.splitlines():
if line.startswith("bridge name") \
or line.isspace() \
or line[:1].isspace():
continue
br_name, br_rest = line.split(None, 1)
out.append(br_name)
return out
def get_eth_interfaces(self, ip_link_out):
"""Return a dictionary for which keys are ethernet interface
names taken from the output of "ip -o link".
"""
out = {}
for line in ip_link_out.splitlines():
match = re.match('.*link/ether', line)
if match:
iface = match.string.split(':')[1].lstrip()
out[iface] = True
return out
def get_ip_netns(self, ip_netns_file):
"""Returns a list for which items are namespaces in the output of
ip netns stored in the ip_netns_file.
"""
out = []
try:
ip_netns_out = open(ip_netns_file).read()
except:
return out
for line in ip_netns_out.splitlines():
# If there's no namespaces, no need to continue
if line.startswith("Object \"netns\" is unknown") \
or line.isspace() \
or line[:1].isspace():
return out
out.append(line.partition(' ')[0])
return out
def get_netns_devs(self, namespace):
"""Returns a list for which items are devices that exist within
the provided namespace.
"""
ip_link_result = self.call_ext_prog("ip netns exec " + namespace +
" ip -o link")
dev_list = []
if ip_link_result['status'] == 0:
for eth in self.get_eth_interfaces(ip_link_result['output']):
dev = eth.replace('@NONE', '')
dev_list.append(dev)
return dev_list
def collect_iptable(self, tablename):
""" When running the iptables command, it unfortunately auto-loads
the modules before trying to get output. Some people explicitly
don't want this, so check if the modules are loaded before running
the command. If they aren't loaded, there can't possibly be any
relevant rules in that table """
modname = "iptable_"+tablename
if self.check_ext_prog("grep -q %s /proc/modules" % modname):
cmd = "iptables -t "+tablename+" -nvL"
self.add_cmd_output(cmd)
def collect_ip6table(self, tablename):
""" Same as function above, but for ipv6 """
modname = "ip6table_"+tablename
if self.check_ext_prog("grep -q %s /proc/modules" % modname):
cmd = "ip6tables -t "+tablename+" -nvL"
self.add_cmd_output(cmd)
def collect_nftables(self):
""" Collects nftables rulesets with 'nft' commands if the modules
are present """
if self.check_ext_prog("grep -q nf_tables /proc/modules"):
self.add_cmd_output("nft list ruleset")
def setup(self):
super(Networking, self).setup()
self.add_copy_spec([
"/proc/net/",
"/etc/nsswitch.conf",
"/etc/yp.conf",
"/etc/inetd.conf",
"/etc/xinetd.conf",
"/etc/xinetd.d",
"/etc/host*",
"/etc/resolv.conf",
"/etc/network*",
"/etc/NetworkManager/NetworkManager.conf",
"/etc/NetworkManager/system-connections",
"/etc/nftables",
"/etc/sysconfig/nftables.conf",
"/etc/nftables.conf",
"/etc/dnsmasq*",
"/sys/class/net/*/flags",
"/etc/iproute2"
])
self.add_forbidden_path("/proc/net/rpc/use-gss-proxy")
self.add_forbidden_path("/proc/net/rpc/*/channel")
self.add_forbidden_path("/proc/net/rpc/*/flush")
# Cisco CDP
self.add_forbidden_path("/proc/net/cdp")
self.add_forbidden_path("/sys/net/cdp")
# Dialogic Diva
self.add_forbidden_path("/proc/net/eicon")
self.add_cmd_output("ip -o addr", root_symlink="ip_addr")
self.add_cmd_output("route -n", root_symlink="route")
self.add_cmd_output("plotnetcfg")
# collect iptables -t for any existing table, if we can't read the
# tables, collect 3 default ones (nat, mangle, filter)
try:
ip_tables_names = open("/proc/net/ip_tables_names").read()
except:
ip_tables_names = "nat\nmangle\nfilter\n"
for table in ip_tables_names.splitlines():
self.collect_iptable(table)
# collect the same for ip6tables
try:
ip_tables_names = open("/proc/net/ip6_tables_names").read()
except:
ip_tables_names = "nat\nmangle\nfilter\n"
for table in ip_tables_names.splitlines():
self.collect_ip6table(table)
self.collect_nftables()
self.add_cmd_output("netstat %s -neopa" % self.ns_wide,
root_symlink="netstat")
self.add_cmd_output([
"netstat -s",
"netstat %s -agn" % self.ns_wide,
"ss -peaonmi",
"ip route show table all",
"ip -6 route show table all",
"ip -4 rule",
"ip -6 rule",
"ip -s -d link",
"ip -d address",
"ifenslave -a",
"ip mroute show",
"ip maddr show",
"ip neigh show",
"ip neigh show nud noarp",
"biosdevname -d",
"tc -s qdisc show",
"ip -s macsec show",
])
# When iptables is called it will load the modules
# iptables and iptables_filter if they are not loaded.
# The same goes for ipv6.
if self.check_ext_prog("grep -q iptable_filter /proc/modules"):
self.add_cmd_output("iptables -vnxL")
if self.check_ext_prog("grep -q ip6table_filter /proc/modules"):
self.add_cmd_output("ip6tables -vnxL")
# There are some incompatible changes in nmcli since
# the release of NetworkManager >= 0.9.9. In addition,
# NetworkManager >= 0.9.9 will use the long names of
# "nmcli" objects.
# All versions conform to the following templates with differnt
# strings for the object being operated on.
nmcli_con_details_template = "nmcli con %s id"
nmcli_dev_details_template = "nmcli dev %s"
# test NetworkManager status for the specified major version
def test_nm_status(version=1):
status_template = "nmcli --terse --fields RUNNING %s status"
obj_table = [
"nm", # < 0.9.9
"general" # >= 0.9.9
]
status = self.call_ext_prog(status_template % obj_table[version])
return status['output'].lower().startswith("running")
# NetworkManager >= 0.9.9 (Use short name of objects for nmcli)
if test_nm_status(version=1):
self.add_cmd_output([
"nmcli general status",
"nmcli con",
"nmcli con show --active",
"nmcli dev"])
nmcli_con_details_cmd = nmcli_con_details_template % "show"
nmcli_dev_details_cmd = nmcli_dev_details_template % "show"
# NetworkManager < 0.9.9 (Use short name of objects for nmcli)
elif test_nm_status(version=0):
self.add_cmd_output([
"nmcli nm status",
"nmcli con",
"nmcli con status",
"nmcli dev"])
nmcli_con_details_cmd = nmcli_con_details_template % "list id"
nmcli_dev_details_cmd = nmcli_dev_details_template % "list iface"
# No grokkable NetworkManager version present
else:
nmcli_con_details_cmd = ""
nmcli_dev_details_cmd = ""
if len(nmcli_con_details_cmd) > 0:
nmcli_con_show_result = self.call_ext_prog(
"nmcli --terse --fields NAME con")
if nmcli_con_show_result['status'] == 0:
for con in nmcli_con_show_result['output'].splitlines():
if con[0:7] == 'Warning':
continue
# nm names may contain embedded quotes (" and '). These
# will cause an exception in shlex.split() if the quotes
# are unbalanced. This may happen with names like:
# "Foobar's Wireless Network". Although the problen will
# occur for both single and double quote characters the
# former is considerably more likely in object names since
# it is syntactically valid in many human languages.
#
# Reverse the normal sos quoting convention here and place
# double quotes around the innermost quoted string.
self.add_cmd_output('%s "%s"' %
(nmcli_con_details_cmd, con))
nmcli_dev_status_result = self.call_ext_prog(
"nmcli --terse --fields DEVICE dev")
if nmcli_dev_status_result['status'] == 0:
for dev in nmcli_dev_status_result['output'].splitlines():
if dev[0:7] == 'Warning':
continue
# See above comment describing quoting conventions.
self.add_cmd_output('%s "%s"' %
(nmcli_dev_details_cmd, dev))
# Get ethtool output for every device that does not exist in a
# namespace.
ip_link_result = self.call_ext_prog("ip -o link")
if ip_link_result['status'] == 0:
for dev in self.get_eth_interfaces(ip_link_result['output']):
eth = dev.replace('@NONE', '')
self.add_cmd_output([
"ethtool "+eth,
"ethtool -d "+eth,
"ethtool -i "+eth,
"ethtool -k "+eth,
"ethtool -S "+eth,
"ethtool -T "+eth,
"ethtool -a "+eth,
"ethtool -c "+eth,
"ethtool -g "+eth
])
# brctl command will load bridge and related kernel modules
# if those modules are not loaded at the time of brctl command running
# This behaviour causes an unexpected configuration change for system.
# sosreport should aovid such situation.
if self.is_module_loaded("bridge"):
brctl_file = self.get_cmd_output_now("brctl show")
if brctl_file:
for br_name in self.get_bridge_name(brctl_file):
self.add_cmd_output([
"brctl showstp "+br_name,
"brctl showmacs "+br_name
])
if self.get_option("traceroute"):
self.add_cmd_output("/bin/traceroute -n %s" % self.trace_host)
# Capture additional data from namespaces; each command is run
# per-namespace.
ip_netns_file = self.get_cmd_output_now("ip netns")
cmd_prefix = "ip netns exec "
if ip_netns_file:
for namespace in self.get_ip_netns(ip_netns_file):
self.add_cmd_output([
cmd_prefix + namespace + " ip address show",
cmd_prefix + namespace + " ip route show table all",
cmd_prefix + namespace + " iptables-save",
cmd_prefix + namespace + " ss -peaonmi"
])
# Devices that exist in a namespace use less ethtool
# parameters. Run this per namespace.
for namespace in self.get_ip_netns(ip_netns_file):
for eth in self.get_netns_devs(namespace):
ns_cmd_prefix = cmd_prefix + namespace + " "
self.add_cmd_output([
ns_cmd_prefix + "ethtool " + eth,
ns_cmd_prefix + "ethtool -i " + eth,
ns_cmd_prefix + "ethtool -k " + eth,
ns_cmd_prefix + "ethtool -S " + eth
])
return
def postproc(self):
for root, dirs, files in os.walk(
"/etc/NetworkManager/system-connections"):
for net_conf in files:
self.do_file_sub(
"/etc/NetworkManager/system-connections/"+net_conf,
r"psk=(.*)", r"psk=***")
class RedHatNetworking(Networking, RedHatPlugin):
trace_host = "rhn.redhat.com"
def setup(self):
# Handle change from -T to -W in Red Hat netstat 2.0 and greater.
try:
netstat_pkg = self.policy().package_manager.all_pkgs()['net-tools']
# major version
if int(netstat_pkg['version'][0]) < 2:
self.ns_wide = "-T"
except:
# default to upstream option
pass
super(RedHatNetworking, self).setup()
class UbuntuNetworking(Networking, UbuntuPlugin, DebianPlugin):
trace_host = "archive.ubuntu.com"
def setup(self):
super(UbuntuNetworking, self).setup()
self.add_copy_spec([
"/etc/resolvconf",
"/etc/network/interfaces",
"/etc/network/interfaces.d",
"/etc/ufw",
"/var/log/ufw.Log",
"/etc/resolv.conf"
])
self.add_cmd_output([
"/usr/sbin/ufw status",
"/usr/sbin/ufw app list"
])
if self.get_option("traceroute"):
self.add_cmd_output("/usr/sbin/traceroute -n %s" % self.trace_host)
# vim: set et ts=4 sw=4 :
sosreport-3.5/sos/plugins/qpid_dispatch.py 0000644 0001750 0001750 00000004607 13203300002 020714 0 ustar caribou caribou # Copyright (C) 2015 Red Hat, Inc., Pavel Moravec
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, RedHatPlugin
from socket import gethostname
class QpidDispatch(Plugin, RedHatPlugin):
"""Qpid dispatch router
"""
plugin_name = 'qpid_dispatch'
profiles = ('services',)
packages = ('qdrouterd', 'qpid-dispatch-tools', 'qpid-dispatch-router')
option_list = [("port", "listening port to connect to", '', ""),
("ssl-certificate",
"Path to file containing client SSL certificate", '', ""),
("ssl-key",
"Path to file containing client SSL private key", '', ""),
("ssl-trustfile", "trusted CA database file", '', "")]
def setup(self):
""" performs data collection for qpid dispatch router """
options = ""
if self.get_option("port"):
options = (options + " -b " + gethostname() +
":%s" % (self.get_option("port")))
# gethostname() is due to DISPATCH-156
# for either present option, add --option=value to 'options' variable
for option in ["ssl-certificate", "ssl-key", "ssl-trustfile"]:
if self.get_option(option):
options = (options + " --%s=" % (option) +
self.get_option(option))
self.add_cmd_output([
"qdstat -a" + options, # Show Router Addresses
"qdstat -n" + options, # Show Router Nodes
"qdstat -c" + options, # Show Connections
"qdstat -m" + options # Show Broker Memory Stats
])
self.add_copy_spec([
"/etc/qpid-dispatch/qdrouterd.conf"
])
# vim: et ts=4 sw=4
sosreport-3.5/sos/plugins/openstack_swift.py 0000644 0001750 0001750 00000006603 13203300002 021301 0 ustar caribou caribou # Copyright (C) 2013 Red Hat, Inc., Flavio Percoco
# Copyright (C) 2012 Rackspace US, Inc.,
# Justin Shepherd
# Copyright (C) 2009 Red Hat, Inc., Joey Boggs
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
class OpenStackSwift(Plugin):
"""OpenStack Swift"""
plugin_name = "openstack_swift"
profiles = ('openstack', 'openstack_controller')
option_list = []
var_puppet_gen = "/var/lib/config-data/puppet-generated"
def setup(self):
self.limit = self.get_option("log_size")
if self.get_option("all_logs"):
self.add_copy_spec([
"/var/log/swift/",
"/var/log/containers/swift/",
"/var/log/containers/httpd/swift-proxy/"
], sizelimit=self.limit)
else:
self.add_copy_spec([
"/var/log/swift/*.log",
"/var/log/containers/swift/*.log",
"/var/log/containers/httpd/swift-proxy/*log"
], sizelimit=self.limit)
self.add_copy_spec([
"/etc/swift/",
self.var_puppet_gen + "/swift/etc/*",
self.var_puppet_gen + "/swift/etc/swift/*",
self.var_puppet_gen + "/swift/etc/xinetd.d/*",
self.var_puppet_gen + "/memcached/etc/sysconfig/memcached"
])
if self.get_option("verify"):
self.add_cmd_output("rpm -V %s" % ' '.join(self.packages))
def postproc(self):
protect_keys = [
"ldap_dns_password", "neutron_admin_password", "rabbit_password",
"qpid_password", "powervm_mgr_passwd", "virtual_power_host_pass",
"xenapi_connection_password", "password", "host_password",
"vnc_password", "connection", "sql_connection", "admin_password"
]
regexp = r"((?m)^\s*(%s)\s*=\s*)(.*)" % "|".join(protect_keys)
self.do_path_regex_sub("/etc/swift/.*\.conf.*", regexp, r"\1*********")
self.do_path_regex_sub(
self.var_puppet_gen + "/swift/etc/swift/.*\.conf.*",
regexp, r"\1*********"
)
class DebianSwift(OpenStackSwift, DebianPlugin, UbuntuPlugin):
packages = (
'swift',
'swift-account',
'swift-container',
'swift-object',
'swift-proxy',
'swauth',
'python-swift',
'python-swauth'
)
class RedHatSwift(OpenStackSwift, RedHatPlugin):
packages = (
'openstack-swift',
'openstack-swift-account',
'openstack-swift-container',
'openstack-swift-object',
'openstack-swift-proxy',
'swift',
'python-swiftclient'
)
# vim: set et ts=4 sw=4 :
sosreport-3.5/sos/plugins/openshift.py 0000644 0001750 0001750 00000015541 13203300002 020076 0 ustar caribou caribou # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, RedHatPlugin
import os.path
# This plugin handles OpenShift Enterprise versions up to 2.x
# which are based in the upstream code of OpenShift Origin M4
# located here: https://github.com/openshift/origin-server
#
# For later of OpenShift Origin based on: https://github.com/openshift/origin
# like OpenShift Enterprise 3.x see the origin.py plugin
class Openshift(Plugin, RedHatPlugin):
'''Openshift 2.x node and broker'''
plugin_name = "openshift"
profiles = ('virt', 'openshift')
# The 'broker' and 'node' options are obsolete but are maintained
# here for compatibility with external programs that call sosreport
# with these names.
option_list = [("broker", "Gathers broker specific files", "slow", False),
("node", "Gathers node specific files", "slow", False)]
ruby = "ruby193"
vendor = "rh"
mco_config_dir = "/opt/%s/%s/root/etc/mcollective" % (vendor, ruby)
gear_base_dir = "/var/lib/openshift"
node_settings_dir = os.path.join(gear_base_dir, ".settings")
node_proxy_dir = os.path.join(gear_base_dir, ".httpd.d")
httpd_config_dir = "/etc/httpd/conf.d"
def is_broker(self):
return os.path.exists("/etc/openshift/broker.conf")
def is_node(self):
return os.path.exists("/etc/openshift/node.conf")
def setup(self):
self.add_copy_spec([
"/etc/openshift-enterprise-release",
"/var/log/openshift",
"/etc/openshift/*.conf",
"/etc/openshift/upgrade",
])
self.add_cmd_output("oo-diagnostics -v")
if self.is_broker():
self.add_copy_spec([
"/etc/openshift/quickstarts.json",
"/etc/openshift/plugins.d/*.conf",
os.path.join(self.mco_config_dir, "client.cfg"),
"/var/www/openshift/broker/httpd/httpd.conf",
"/var/www/openshift/broker/httpd/conf.d/*.conf",
"/var/www/openshift/console/httpd/httpd.conf",
"/var/www/openshift/console/httpd/conf.d/*.conf",
])
self.add_cmd_output([
"oo-accept-broker -v",
"oo-admin-chk -v",
"oo-mco ping",
])
if self.is_node():
self.add_copy_spec([
"/etc/openshift/node-plugins.d/*.conf",
"/etc/openshift/cart.conf.d",
"/etc/openshift/iptables.*.rules",
"/etc/openshift/env",
os.path.join(self.httpd_config_dir,
"openshift-vhost-logconf.include"),
os.path.join(self.httpd_config_dir,
"openshift-http-vhost.include"),
os.path.join(self.httpd_config_dir,
"openshift_restorer.include"),
os.path.join(self.mco_config_dir, "server.cfg"),
os.path.join(self.mco_config_dir, "facts.yaml"),
os.path.join(self.node_settings_dir, "district.info"),
os.path.join(self.node_proxy_dir, "*.conf"),
os.path.join(self.node_proxy_dir, "aliases.txt"),
os.path.join(self.node_proxy_dir, "nodes.txt"),
os.path.join(self.node_proxy_dir, "idler.txt"),
os.path.join(self.node_proxy_dir, "sts.txt"),
os.path.join(self.node_proxy_dir, "routes.json"),
os.path.join(self.node_proxy_dir, "geardb.json"),
os.path.join(self.node_proxy_dir, "sniproxy.json"),
"/var/log/httpd/openshift_log",
"/var/log/mcollective.log",
"/var/log/node-web-proxy/access.log",
"/var/log/node-web-proxy/error.log",
"/var/log/node-web-proxy/websockets.log",
"/var/log/node-web-proxy/supervisor.log",
])
self.add_cmd_output([
"oo-accept-node -v",
"oo-admin-ctl-gears list",
"ls -laZ %s" % self.gear_base_dir,
"ls -la %s" % self.node_proxy_dir
])
def postproc(self):
# Redact broker's MongoDB credentials:
# MONGO_PASSWORD="PasswordForOpenshiftUser"
self.do_file_sub('/etc/openshift/broker.conf',
r"(MONGO_PASSWORD\s*=\s*)(.*)",
r"\1*******")
# Redact session SHA keys:
# SESSION_SECRET=0c31...a7c8
self.do_file_sub('/etc/openshift/broker.conf',
r"(SESSION_SECRET\s*=\s*)(.*)",
r"\1*******")
self.do_file_sub('/etc/openshift/console.conf',
r"(SESSION_SECRET\s*=\s*)(.*)",
r"\1*******")
# Redact passwords of the form:
# plugin.activemq.pool.1.password = Pa$sW0Rd
self.do_file_sub(os.path.join(self.mco_config_dir, "server.cfg"),
r"(.*password\s*=\s*)\S+",
r"\1********")
self.do_file_sub(os.path.join(self.mco_config_dir, "client.cfg"),
r"(.*password\s*=\s*)\S+",
r"\1********")
# Redact DNS plugin credentials
# Dynect DNS: DYNECT_PASSWORD=s0ME-p4$_w0RD._
plugin_dir = '/etc/openshift/plugins.d/'
self.do_file_sub(plugin_dir + 'openshift-origin-dns-dynect.conf',
r"(DYNECT_PASSWORD\s*=\s*)(.*)",
r"\1********")
# Fog cloud: FOG_RACKSPACE_API_KEY="apikey"
self.do_file_sub(plugin_dir + 'openshift-origin-dns-fog.conf',
r"(FOG_RACKSPACE_API_KEY\s*=\s*)(.*)",
r"\1********")
# ISC bind: BIND_KEYVALUE="rndc key"
self.do_file_sub(plugin_dir + 'openshift-origin-dns-nsupdate.conf',
r"(BIND_KEYVALUE\s*=\s*)(.*)",
r"\1********")
# LDAP authentication: AuthLDAPBindPassword "IShouldNotBeHere"
ldap_paths = '/var/www/openshift/(broker|console)/httpd/conf.d/.*'
self.do_path_regex_sub(ldap_paths,
r"(AuthLDAPBindPassword)\s*(.*)",
r"\1********")
# vim: set et ts=4 sw=4 :
sosreport-3.5/sos/plugins/processor.py 0000644 0001750 0001750 00000003064 13203300002 020113 0 ustar caribou caribou # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, RedHatPlugin, UbuntuPlugin, DebianPlugin
class Processor(Plugin, RedHatPlugin, UbuntuPlugin, DebianPlugin):
"""CPU information
"""
plugin_name = 'processor'
profiles = ('system', 'hardware', 'memory')
files = ('/proc/cpuinfo',)
packages = ('cpufreq-utils', 'cpuid')
def setup(self):
self.add_copy_spec([
"/proc/cpuinfo",
"/sys/class/cpuid",
"/sys/devices/system/cpu"
])
self.add_cmd_output([
"lscpu",
"cpupower info",
"cpupower idle-info",
"cpupower frequency-info",
"cpufreq-info",
"cpuid",
"cpuid -r",
"turbostat --debug sleep 10"
])
if '86' in self.policy().get_arch():
self.add_cmd_output("x86info -a")
# vim: set et ts=4 sw=4 :
sosreport-3.5/sos/plugins/ubuntu.py 0000644 0001750 0001750 00000002363 13203300002 017417 0 ustar caribou caribou # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, UbuntuPlugin
class Ubuntu(Plugin, UbuntuPlugin):
""" Ubuntu specific information
"""
plugin_name = 'ubuntu'
profiles = ('system',)
option_list = [
('support-show-all',
'Show all packages with their status', '', False),
]
def setup(self):
cmd = ["ubuntu-support-status"]
if self.get_option('support-show-all'):
cmd.append("--show-all")
self.add_cmd_output(" ".join(cmd),
suggest_filename='ubuntu-support-status.txt')
sosreport-3.5/sos/plugins/puppet.py 0000644 0001750 0001750 00000002632 13203300002 017411 0 ustar caribou caribou # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
from glob import glob
class Puppet(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
"""Puppet service
"""
plugin_name = 'puppet'
profiles = ('services',)
def setup(self):
self.add_copy_spec([
"/etc/puppet/*.conf",
"/etc/puppet/rack/*",
"/etc/puppet/manifests/*",
"/var/log/puppet/*.log",
])
def postproc(self):
for device_conf in glob("/etc/puppet/device.conf*"):
self.do_file_sub(
device_conf,
r"(.*url*.ssh://.*:).*(@.*)",
r"\1%s\2" % ('***')
)
return
# vim: et ts=4 sw=4
sosreport-3.5/sos/plugins/kdump.py 0000644 0001750 0001750 00000002776 13203300002 017225 0 ustar caribou caribou # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
class KDump(Plugin):
"""Kdump crash dumps
"""
plugin_name = "kdump"
profiles = ('system', 'debug')
def setup(self):
self.add_copy_spec([
"/proc/cmdline"
])
class RedHatKDump(KDump, RedHatPlugin):
files = ('/etc/kdump.conf',)
packages = ('kexec-tools',)
def setup(self):
self.add_copy_spec([
"/etc/kdump.conf",
"/etc/udev/rules.d/*kexec.rules",
"/var/crash/*/vmcore-dmesg.txt"
])
class DebianKDump(KDump, DebianPlugin, UbuntuPlugin):
files = ('/etc/default/kdump-tools',)
packages = ('kdump-tools',)
def setup(self):
self.add_copy_spec([
"/etc/default/kdump-tools"
])
# vim: set et ts=4 sw=4 :
sosreport-3.5/sos/plugins/systemtap.py 0000644 0001750 0001750 00000002365 13203300002 020130 0 ustar caribou caribou # Copyright (C) 2007 Red Hat, Inc., Eugene Teo
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
class SystemTap(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
"""SystemTap dynamic instrumentation
"""
plugin_name = 'systemtap'
profiles = ('debug', 'performance')
files = ('stap',)
packages = ('systemtap', 'systemtap-runtime')
def setup(self):
self.add_cmd_output([
"stap -V 2",
"uname -r",
"stap-report"
])
# vim: set et ts=4 sw=4 :
sosreport-3.5/sos/plugins/radius.py 0000644 0001750 0001750 00000003333 13203300002 017362 0 ustar caribou caribou # Copyright (C) 2007 Navid Sheikhol-Eslami
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
class Radius(Plugin):
"""RADIUS service information
"""
plugin_name = "radius"
profiles = ('network', 'identity')
packages = ('freeradius',)
class RedHatRadius(Radius, RedHatPlugin):
files = ('/etc/raddb',)
def setup(self):
super(RedHatRadius, self).setup()
self.add_copy_spec([
"/etc/raddb",
"/etc/pam.d/radiusd",
"/var/log/radius"
])
def postproc(self):
self.do_file_sub(
"/etc/raddb/sql.conf", r"(\s*password\s*=\s*)\S+", r"\1***")
class DebianRadius(Radius, DebianPlugin, UbuntuPlugin):
files = ('/etc/freeradius',)
def setup(self):
super(DebianRadius, self).setup()
self.add_copy_spec([
"/etc/freeradius",
"/etc/pam.d/radiusd",
"/etc/default/freeradius",
"/var/log/freeradius"
])
# vim: set et ts=4 sw=4 :
sosreport-3.5/sos/plugins/xinetd.py 0000644 0001750 0001750 00000002314 13203300002 017364 0 ustar caribou caribou # Copyright (C) 2007 Red Hat, Inc., Eugene Teo
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
class Xinetd(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
"""xinetd information
"""
plugin_name = 'xinetd'
profiles = ('services', 'network', 'boot')
files = ('/etc/xinetd.conf',)
packages = ('xinetd',)
def setup(self):
self.add_copy_spec([
"/etc/xinetd.conf",
"/etc/xinetd.d"
])
# vim: set et ts=4 sw=4 :
sosreport-3.5/sos/plugins/etcd.py 0000644 0001750 0001750 00000004374 13203300002 017020 0 ustar caribou caribou # Copyright (C) 2015 Red Hat, Inc. Neependra Khare
# Copyright (C) 2015 Red Hat, Inc. Bryn M. Reeves
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, RedHatPlugin
class etcd(Plugin, RedHatPlugin):
"""etcd plugin
"""
plugin_name = 'etcd'
packages = ('etcd',)
profiles = ('system', 'services', 'cluster')
cmd = 'etcdctl'
def setup(self):
etcd_url = self.get_etcd_url()
self.add_copy_spec('/etc/etcd')
subcmds = [
'--version',
'member list',
'cluster-health',
'ls --recursive',
]
self.add_cmd_output(['%s %s' % (self.cmd, sub) for sub in subcmd])
urls = [
'/v2/stats/leader',
'/v2/stats/self',
'/v2/stats/store',
]
if etcd_url:
self.add_cmd_output(['curl -s %s%s' % (etcd_url, u) for u in urls])
self.add_cmd_output("ls -lR /var/lib/etcd/")
def get_etcd_url(self):
try:
with open('/etc/etcd/etcd.conf', 'r') as ef:
for line in ef:
if line.startswith('ETCD_LISTEN_CLIENT_URLS'):
return line.split('=')[1].replace('"', '').strip()
# If we can't read etcd.conf, assume defaults by etcd version
except:
ver = self.policy().package_manager.get_pkg_list()['etcd']
ver = ver['version'][0]
if ver == '2':
return 'http://localhost:4001'
if ver == '3':
return 'http://localhost:2379'
# vim: et ts=5 sw=4
sosreport-3.5/sos/plugins/insights.py 0000644 0001750 0001750 00000003334 13203300002 017724 0 ustar caribou caribou # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, RedHatPlugin
class RedHatInsights(Plugin, RedHatPlugin):
'''Collect config and log for Red Hat Insights
'''
plugin_name = 'insights'
packages = ['redhat-access-insights']
profiles = ('system', 'sysmgmt')
conf_file = '/etc/redhat-access-insights/redhat-access-insights.conf'
def setup(self):
self.add_copy_spec(self.conf_file)
self.limit = self.get_option("log_size")
if self.get_option("all_logs"):
self.add_copy_spec("/var/log/redhat-access-insights/*.log*",
sizelimit=self.limit)
else:
self.add_copy_spec("/var/log/redhat-access-insights/*.log",
sizelimit=self.limit)
def postproc(self):
self.do_file_sub(
self.conf_file,
r'(password[\t\ ]*=[\t\ ]*)(.+)',
r'\1********'
)
self.do_file_sub(
self.conf_file,
r'(proxy[\t\ ]*=.*)(:)(.*)(@.*)',
r'\1\2********\4'
)
sosreport-3.5/sos/plugins/systemd.py 0000644 0001750 0001750 00000004214 13203300002 017562 0 ustar caribou caribou # Copyright (C) 2012 Red Hat, Inc., Bryn M. Reeves
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
class Systemd(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
""" System management daemon
"""
plugin_name = "systemd"
profiles = ('system', 'services', 'boot')
packages = ('systemd',)
files = (
'/usr/lib/systemd/systemd',
'/lib/systemd/systemd'
)
def setup(self):
self.add_cmd_output([
"systemctl status --all",
"systemctl show --all",
"systemctl show *service --all",
# It is possible to do systemctl show with target, slice,
# device, socket, scope, and mount too but service and
# status --all mostly seems to cover the others.
"systemctl list-units",
"systemctl list-units --failed",
"systemctl list-unit-files",
"systemctl show-environment",
"systemd-delta",
"systemd-analyze",
"journalctl --list-boots",
"ls -lR /lib/systemd",
"timedatectl"
])
if self.get_option("verify"):
self.add_cmd_output("journalctl --verify")
self.add_copy_spec([
"/etc/systemd",
"/lib/systemd/system",
"/lib/systemd/user",
"/etc/vconsole.conf",
"/etc/yum/protected.d/systemd.conf"
])
# vim: set et ts=4 sw=4 :
sosreport-3.5/sos/plugins/gnocchi.py 0000644 0001750 0001750 00000006643 13203300002 017514 0 ustar caribou caribou # Copyright (C) 2016 Red Hat, Inc., Sachin Patil
# Copyright (C) 2017 Red Hat, Inc., Martin Schuppert
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
import os
from sos.plugins import Plugin, RedHatPlugin
class GnocchiPlugin(Plugin, RedHatPlugin):
"""Gnocchi - Metric as a service"""
plugin_name = "gnocchi"
profiles = ('openstack', 'openstack_controller')
packages = (
'openstack-gnocchi-metricd', 'openstack-gnocchi-common',
'openstack-gnocchi-statsd', 'openstack-gnocchi-api',
'openstack-gnocchi-carbonara'
)
requires_root = False
var_puppet_gen = "/var/lib/config-data/puppet-generated/gnocchi"
def setup(self):
self.add_copy_spec([
"/etc/gnocchi/*",
self.var_puppet_gen + "/etc/gnocchi/*",
self.var_puppet_gen + "/etc/httpd/conf/*",
self.var_puppet_gen + "/etc/httpd/conf.d/*",
self.var_puppet_gen + "/etc/httpd/conf.modules.d/wsgi.conf",
self.var_puppet_gen + "/etc/my.cnf.d/tripleo.cnf"
])
self.limit = self.get_option("log_size")
if self.get_option("all_logs"):
self.add_copy_spec([
"/var/log/gnocchi/*",
"/var/log/containers/gnocchi/*",
"/var/log/containers/httpd/gnocchi-api/*"],
sizelimit=self.limit
)
else:
self.add_copy_spec([
"/var/log/gnocchi/*.log",
"/var/log/containers/gnocchi/*.log",
"/var/log/containers/httpd/gnocchi-api/*log"],
sizelimit=self.limit
)
vars_all = [p in os.environ for p in [
'OS_USERNAME', 'OS_PASSWORD']]
vars_any = [p in os.environ for p in [
'OS_TENANT_NAME', 'OS_PROJECT_NAME']]
if not (all(vars_all) and any(vars_any)):
self.soslog.warning("Not all environment variables set. Source "
"the environment file for the user intended "
"to connect to the OpenStack environment.")
else:
self.add_cmd_output([
"gnocchi --version",
"gnocchi status",
"gnocchi capabilities list",
"gnocchi archive-policy list",
"gnocchi resource list",
"gnocchi resource-type list"
])
def postproc(self):
self.do_file_sub(
"/etc/gnocchi/gnocchi.conf",
r"password=(.*)",
r"password=*****",
)
self.do_file_sub(
self.var_puppet_gen + "/etc/gnocchi/"
"gnocchi.conf",
r"password=(.*)",
r"password=*****",
)
# vim: set et ts=4 sw=4 :
sosreport-3.5/sos/plugins/lxd.py 0000644 0001750 0001750 00000002746 13203300002 016671 0 ustar caribou caribou # Copyright (C) 2016 Jorge Niedbalski
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, UbuntuPlugin
class LXD(Plugin, UbuntuPlugin):
"""LXD is a containers hypervisor.
"""
plugin_name = 'lxd'
def setup(self):
self.add_copy_spec([
"/var/lib/lxd/lxd.db",
"/etc/default/lxc-bridge",
])
self.add_copy_spec("/var/log/lxd*",
sizelimit=self.get_option("log_size"))
# List of containers available on the machine
self.add_cmd_output([
"lxc list",
"lxc profile list",
"lxc image list",
])
self.add_cmd_output([
"find /var/lib/lxd -maxdepth 2 -type d -ls",
], suggest_filename='var-lxd-dirs.txt')
# vim: set et ts=4 sw=4 :
sosreport-3.5/sos/plugins/ptp.py 0000644 0001750 0001750 00000002270 13203300002 016675 0 ustar caribou caribou # Copyright (C) 2015 Pavel Moravec
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
class Ptp(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
"""Precision time protocol
"""
plugin_name = "ptp"
profiles = ('system', 'services')
packages = ('linuxptp',)
def setup(self):
self.add_copy_spec([
"/etc/ptp4l.conf",
"/etc/timemaster.conf",
"/sys/class/ptp"
])
# vim: et ts=4 sw=4
sosreport-3.5/sos/plugins/nss.py 0000644 0001750 0001750 00000002413 13203300002 016674 0 ustar caribou caribou # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
class NSS(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
"""Network Security Services configuration
"""
plugin_name = "nss"
profiles = ('network', 'security')
packages = ('nss',)
verify_packages = ('nss.*',)
def setup(self):
self.add_forbidden_path("/etc/pki/nssdb/cert*")
self.add_forbidden_path("/etc/pki/nssdb/key*")
self.add_forbidden_path("/etc/pki/nssdb/secmod.db")
self.add_copy_spec("/etc/pki/nssdb/pkcs11.txt")
# vim: set et ts=4 sw=4 :
sosreport-3.5/sos/plugins/firewalld.py 0000644 0001750 0001750 00000003210 13203300002 020036 0 ustar caribou caribou # Copyright (C) 2014 Red Hat, Inc. Jamie Bainbridge
# Copyright (C) 2014 Red Hat, Inc. Bryn M. Reeves
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, RedHatPlugin
class FirewallD(Plugin, RedHatPlugin):
"""Firewall daemon
"""
plugin_name = 'firewalld'
profiles = ('network',)
packages = ('firewalld',)
def setup(self):
self.add_copy_spec([
"/etc/firewalld/firewalld.conf",
"/etc/firewalld/*.xml",
"/etc/firewalld/icmptypes/*.xml",
"/etc/firewalld/services/*.xml",
"/etc/firewalld/zones/*.xml",
"/etc/sysconfig/firewalld",
"/var/log/firewalld",
])
# use a 10s timeout to workaround dbus problems in
# docker containers.
self.add_cmd_output([
"firewall-cmd --list-all-zones",
"firewall-cmd --permanent --list-all-zones"
], timeout=10)
# vim: set et ts=4 sw=4 :
sosreport-3.5/sos/plugins/megacli.py 0000644 0001750 0001750 00000002775 13203300002 017505 0 ustar caribou caribou # megacli.py
# Copyright (C) 2007-2014 Red Hat, Inc., Jon Magrini
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
import os
import os.path
from sos.plugins import Plugin, RedHatPlugin
class MegaCLI(Plugin, RedHatPlugin):
"""LSI MegaRAID devices
"""
plugin_name = 'megacli'
profiles = ('system', 'storage', 'hardware')
def setup(self):
if os.path.isfile("/opt/MegaRAID/MegaCli/MegaCli64"):
self.add_custom_text("LSI MegaCLI is installed.
")
self.get_megacli_files()
def get_megacli_files(self):
""" MegaCLI specific output
"""
self.add_cmd_output([
"MegaCli64 LDPDInfo -aALL",
"MegaCli64 -AdpAllInfo -aALL",
"MegaCli64 -AdpBbuCmd -GetBbuStatus -aALL",
"MegaCli64 -ShowSummary -a0"
])
# vim: set et ts=4 sw=4 :
sosreport-3.5/sos/plugins/conntrackd.py 0000755 0001750 0001750 00000003026 13203300002 020223 0 ustar caribou caribou # Copyright (C) 2017 Red Hat, Inc., Marcus Linden
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin, \
SuSEPlugin
class Conntrackd(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin, SuSEPlugin):
"""conntrackd - netfilter connection tracking user-space daemon
"""
plugin_name = 'conntrackd'
profiles = ('network', 'cluster')
packages = ('conntrack-tools', 'conntrackd')
def setup(self):
self.add_copy_spec("/etc/conntrackd/conntrackd.conf")
self.add_cmd_output([
"conntrackd -s network",
"conntrackd -s cache",
"conntrackd -s runtime",
"conntrackd -s link",
"conntrackd -s rsqueue",
"conntrackd -s queue",
"conntrackd -s ct",
"conntrackd -s expect",
])
# vim: set et ts=4 sw=4 :
sosreport-3.5/sos/plugins/atomichost.py 0000644 0001750 0001750 00000003234 13203300002 020245 0 ustar caribou caribou # Copyright (C) 2015 Red Hat, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, RedHatPlugin
import os.path
class AtomicHost(Plugin, RedHatPlugin):
""" Atomic Host """
plugin_name = "atomichost"
option_list = [
("info", "gather atomic info for each image", "fast", False)
]
def check_enabled(self):
return self.policy().in_container()
def setup(self):
self.add_copy_spec("/etc/ostree/remotes.d")
self.add_cmd_output("atomic host status")
if self.get_option('info'):
# The 'docker images' command may include duplicate rows of
# output (repeated "IMAGE ID" values). Use a set to filter
# these out and only obtain 'docker info' data once per image
# identifier.
images = self.get_command_output("docker images -q")['output']
for image in set(images.splitlines()):
self.add_cmd_output("atomic info {0}".format(image))
# vim: set et ts=4 sw=4 :
sosreport-3.5/sos/plugins/lightdm.py 0000644 0001750 0001750 00000003311 13203300002 017517 0 ustar caribou caribou # Copyright (C) 2015 Red Hat, Inc., Bryn M. Reeves
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
class LightDm(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
"""Light Display Manager
"""
packages = ('lightdm', )
profiles = ('desktop', )
plugin_name = 'lightdm'
def setup(self):
self.add_cmd_output("systemctl status lightdm.service")
self.add_journal(units="lightdm")
self.add_copy_spec([
"/etc/lightdm/lightdm.conf",
"/etc/lightdm/users.conf"
])
if not self.get_option("all_logs"):
limit = self.get_option("log_size")
self.add_copy_spec("/var/log/lightdm/lightdm.log", sizelimit=limit)
self.add_copy_spec("/var/log/lightdm/x-0-greeter.log",
sizelimit=limit)
self.add_copy_spec("/var/log/lightdm/x-0.log", sizelimit=limit)
else:
self.add_copy_spec("/var/log/lightdm")
# vim: set et ts=4 sw=4 :
sosreport-3.5/sos/plugins/gluster.py 0000644 0001750 0001750 00000012643 13203300002 017564 0 ustar caribou caribou # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
import time
import os.path
import os
import glob
import string
from sos.plugins import Plugin, RedHatPlugin
class Gluster(Plugin, RedHatPlugin):
"""GlusterFS storage"""
plugin_name = 'gluster'
profiles = ('storage', 'virt')
statedump_dir = '/tmp/glusterfs-statedumps'
packages = ["glusterfs", "glusterfs-core"]
files = ["/etc/glusterd", "/var/lib/glusterd"]
def get_volume_names(self, volume_file):
"""Return a dictionary for which key are volume names according to the
output of gluster volume info stored in volume_file.
"""
out = []
fp = open(volume_file, 'r')
for line in fp.readlines():
if not line.startswith("Volume Name:"):
continue
volname = line[12:-1]
out.append(volname)
fp.close()
return out
def make_preparations(self, name_dir):
try:
os.mkdir(name_dir)
except:
pass
fp = open('/tmp/glusterdump.options', 'w')
data = 'path=' + name_dir + '\n'
fp.write(data)
fp.write('all=yes')
fp.close()
def wait_for_statedump(self, name_dir):
statedumps_present = 0
statedump_entries = os.listdir(name_dir)
for statedump_file in statedump_entries:
statedumps_present = statedumps_present+1
last_line = 'tmp'
ret = -1
while ret == -1:
last_line = file(
name_dir + '/' + statedump_file, "r").readlines()[-1]
ret = string.count(last_line, 'DUMP_END_TIME')
def postproc(self):
if not os.path.exists(self.statedump_dir):
return
try:
for dirs in os.listdir(self.statedump_dir):
os.remove(os.path.join(self.statedump_dir, dirs))
os.rmdir(self.statedump_dir)
os.unlink('/tmp/glusterdump.options')
except:
pass
def setup(self):
self.add_forbidden_path("/var/lib/glusterd/geo-replication/secret.pem")
self.add_cmd_output("gluster peer status")
self.add_copy_spec([
"/etc/redhat-storage-release",
# collect unified file and object storage configuration
"/etc/swift/",
# glusterfs-server rpm scripts stash this on migration to 3.3.x
"/etc/glusterd.rpmsave",
# common to all versions
"/etc/glusterfs",
"/var/lib/glusterd/",
# collect nfs-ganesha related configuration
"/var/run/gluster/shared_storage/nfs-ganesha/"
] + glob.glob('/var/run/gluster/*tier-dht/*'))
# collect logs - apply log_size for any individual file
# all_logs takes precedence over logsize
if not self.get_option("all_logs"):
limit = self.get_option("log_size")
else:
limit = 0
if limit:
for f in (glob.glob("/var/log/glusterfs/*log") +
glob.glob("/var/log/glusterfs/*/*log") +
glob.glob("/var/log/glusterfs/geo-replication/*/*log")):
self.add_copy_spec(f, limit)
else:
self.add_copy_spec("/var/log/glusterfs")
self.make_preparations(self.statedump_dir)
if self.check_ext_prog("killall -USR1 glusterfs glusterfsd"):
# let all the processes catch the signal and create statedump file
# entries.
time.sleep(1)
self.wait_for_statedump(self.statedump_dir)
self.add_copy_spec('/tmp/glusterdump.options')
self.add_copy_spec(self.statedump_dir)
else:
self.soslog.info("could not send SIGUSR1 to glusterfs processes")
volume_file = self.get_cmd_output_now("gluster volume info")
if volume_file:
for volname in self.get_volume_names(volume_file):
self.add_cmd_output([
"gluster volume geo-replication %s status"
% volname,
"gluster volume heal %s info" % volname,
"gluster volume heal %s info split-brain"
% volname,
"gluster snapshot list %s" % volname,
"gluster volume quota %s list" % volname,
"gluster volume rebalance %s status"
% volname,
"gluster snapshot info %s" % volname,
"gluster snapshot status %s" % volname])
self.add_cmd_output("gluster pool list")
self.add_cmd_output("gluster volume status")
# vim: set et ts=4 sw=4 :
sosreport-3.5/sos/plugins/gfs2.py 0000644 0001750 0001750 00000004360 13203300002 016735 0 ustar caribou caribou # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
import os.path
class Gfs2(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
"""GFS2 (Global Filesystem 2)"""
plugin_name = "gfs2"
profiles = ("cluster", )
packages = ["gfs2-utils"]
option_list = [
("lockdump",
"capture lock dumps for all GFS2 filesystems",
"slow", False),
]
debugfs_path = "/sys/kernel/debug"
_debugfs_cleanup = False
def setup(self):
self.add_copy_spec([
"/sys/fs/gfs2/*/withdraw"
])
self.add_cmd_output([
"gfs_control ls -n",
"gfs_control dump"
])
if self.get_option("gfs2lockdump"):
if self._mount_debug():
self.add_copy_spec(["/sys/kernel/debug/gfs2/*"])
def _mount_debug(self):
if not os.path.ismount(self.debugfs_path):
self._debugfs_cleanup = True
r = self.call_ext_prog("mount -t debugfs debugfs %s"
% self.debugfs_path)
if r["status"] != 0:
self._log_error("debugfs not mounted and mount attempt failed")
self._debugfs_cleanup = False
return os.path.ismount(self.debugfs_path)
def postproc(self):
if self._debugfs_cleanup and os.path.ismount(self.debugfs_path):
r = self.call_ext_prog("umount %s" % self.debugfs_path)
if r["status"] != 0:
self._log_error("could not unmount %s" % self.debugfs_path)
return
# vim: et ts=4 sw=4
sosreport-3.5/sos/plugins/vsftpd.py 0000644 0001750 0001750 00000002055 13203300002 017401 0 ustar caribou caribou # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, RedHatPlugin
class Vsftpd(Plugin, RedHatPlugin):
"""Vsftpd server
"""
plugin_name = 'vsftpd'
profiles = ('services',)
files = ('/etc/vsftpd',)
packages = ('vsftpd',)
def setup(self):
self.add_copy_spec([
"/etc/ftp*",
"/etc/vsftpd"
])
# vim: set et ts=4 sw=4 :
sosreport-3.5/sos/plugins/opengl.py 0000644 0001750 0001750 00000002075 13203300002 017361 0 ustar caribou caribou # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
class OpenGL(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
"""OpenGL
"""
plugin_name = 'opengl'
profiles = ('hardware', 'desktop', 'gpu')
files = ('/usr/bin/glxinfo',)
def setup(self):
self.add_cmd_output([
"glxinfo",
])
# vim: set et ts=4 sw=4 :
sosreport-3.5/sos/plugins/s390.py 0000644 0001750 0001750 00000004631 13203300002 016573 0 ustar caribou caribou # Copyright (C) 2007 Red Hat, Inc., Justin Payne
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
class S390(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
"""IBM S/390
"""
plugin_name = 's390'
profiles = ('system', 'hardware')
# Check for s390 arch goes here
def check_enabled(self):
return ("s390" in self.policy().get_arch())
# Gather s390 specific information
def setup(self):
self.add_copy_spec([
"/proc/cio_ignore",
"/proc/crypto",
"/proc/dasd/devices",
"/proc/dasd/statistics",
"/proc/qeth",
"/proc/qeth_perf",
"/proc/qeth_ipa_takeover",
"/proc/sys/appldata/*",
"/proc/sys/kernel/hz_timer",
"/proc/sysinfo",
"/sys/bus/ccwgroup/drivers/qeth/0.*/*",
"/sys/bus/ccw/drivers/zfcp/0.*/*",
"/sys/bus/ccw/drivers/zfcp/0.*/0x*/*",
"/sys/bus/ccw/drivers/zfcp/0.*/0x*/0x*/*",
"/etc/zipl.conf",
"/etc/zfcp.conf",
"/etc/sysconfig/dumpconf",
"/etc/src_vipa.conf",
"/etc/ccwgroup.conf",
"/etc/chandev.conf"])
self.add_cmd_output([
"lscss",
"lsdasd",
"lstape",
"find /proc/s390dbf -type f",
"qethconf list_all",
"lsqeth",
"lszfcp"
])
r = self.call_ext_prog("ls /dev/dasd?")
dasd_dev = r['output']
for x in dasd_dev.split('\n'):
self.add_cmd_output([
"dasdview -x -i -j -l -f %s" % (x,),
"fdasd -p %s" % (x,)
])
# vim: set et ts=4 sw=4 :
sosreport-3.5/sos/plugins/zfs.py 0000644 0001750 0001750 00000002170 13203300002 016673 0 ustar caribou caribou # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, UbuntuPlugin, DebianPlugin
class Zfs(Plugin, UbuntuPlugin, DebianPlugin):
"""ZFS filesystem
"""
plugin_name = 'zfs'
profiles = ('storage',)
packages = ('zfsutils-linux',)
def setup(self):
self.add_cmd_output([
"zfs get all",
"zfs list -t all -o space",
"zpool list",
"zpool status -x"
])
# vim: set et ts=4 sw=4 :
sosreport-3.5/sos/plugins/pci.py 0000644 0001750 0001750 00000002271 13203300002 016646 0 ustar caribou caribou # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, RedHatPlugin, UbuntuPlugin, DebianPlugin
class Pci(Plugin, RedHatPlugin, UbuntuPlugin, DebianPlugin):
"""PCI devices
"""
plugin_name = "pci"
profiles = ('hardware', 'system')
def setup(self):
self.add_copy_spec([
"/proc/ioports",
"/proc/iomem",
"/proc/bus/pci"
])
self.add_cmd_output("lspci -nnvv", root_symlink="lspci")
self.add_cmd_output("lspci -tv")
# vim: set et ts=4 sw=4 :
sosreport-3.5/sos/plugins/saphana.py 0000644 0001750 0001750 00000006255 13203300002 017514 0 ustar caribou caribou # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
import os
from sos.plugins import Plugin, RedHatPlugin
class saphana(Plugin, RedHatPlugin):
"""SAP HANA"""
plugin_name = 'saphana'
profiles = ['sap']
files = ['/hana']
def setup(self):
sids = []
if os.path.isdir("/hana/shared"):
s = os.listdir("/hana/shared")
for sid in s:
if len(sid) == 3:
sid = sid.strip()
sids.append(sid)
for sid in sids:
sidadm = '%sadm' % sid.lower()
prefix = 'su - %s -c' % sidadm
self.add_cmd_output('%s "HDB info"' % prefix,
suggest_filename="%s_HDB_info" % sid)
self.add_cmd_output('%s "hdbsrvutil -v"' % prefix,
suggest_filename="%s_version" % sid)
self.add_cmd_output('%s \'hdbcons "mm l -s -S -p"\'' % prefix,
suggest_filename="%s_memusage" % sid)
self.add_cmd_output('%s \'hdbcons -e hdbindexserver \
"replication info"\'' % prefix,
suggest_filename="%s_replicainfo" % sid)
if os.path.isdir("/hana/shared/%s/" % sid):
i = os.listdir("/hana/shared/%s/" % sid)
for inst in i:
if "HDB" in inst:
inst = inst.strip()[-2:]
# get GREEN/RED status
self.add_cmd_output(
'su - %s -c "sapcontrol -nr %s \
-function GetProcessList"'
% (sidadm, inst),
suggest_filename="%s_%s_status"
% (sid, inst)
)
path = '/usr/sap/%s/HDB%s/exe/python_support'
path %= (sid, inst)
if os.path.isdir("%s" % path):
# SCALE OUT - slow
self.add_cmd_output(
'su - %s -c "python \
%s/landscapeHostConfiguration.py"'
% (sidadm, path),
suggest_filename="%s_%s_landscapeConfig"
% (sid, inst)
)
# vim: et ts=4 sw=4
sosreport-3.5/sos/plugins/fcoe.py 0000644 0001750 0001750 00000002523 13203300002 017007 0 ustar caribou caribou # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, RedHatPlugin
class fcoe(Plugin, RedHatPlugin):
"""Fibre Channel over Ethernet
"""
plugin_name = 'fcoe'
profiles = ('storage', 'hardware')
packages = ('fcoe-utils',)
def setup(self):
# Here we capture the information about all
# FCoE instances with the -i option, and
# information about all discovered FCFs
# with the -f option
self.add_cmd_output([
"fcoeadm -i",
"fcoeadm -f"
])
# Here we grab information about the
# interfaces's config files
self.add_copy_spec("/etc/fcoe")
# vim: set et ts=4 sw=4 :
sosreport-3.5/sos/plugins/lsbrelease.py 0000644 0001750 0001750 00000002277 13203300002 020222 0 ustar caribou caribou # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
class LsbRelease(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
"""Linux standard base
"""
plugin_name = 'lsbrelease'
profiles = ('system',)
def setup(self):
self.add_cmd_output("lsb_release -a")
self.add_cmd_output(
"lsb_release -d", suggest_filename="lsb_release",
root_symlink="lsb-release")
self.add_copy_spec("/etc/lsb-release*")
# vim: set et ts=4 sw=4 :
sosreport-3.5/sos/plugins/maas.py 0000644 0001750 0001750 00000004766 13203300002 017027 0 ustar caribou caribou # Copyright (C) 2013 Adam Stokes
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, UbuntuPlugin
class Maas(Plugin, UbuntuPlugin):
"""Ubuntu Metal-As-A-Service
"""
plugin_name = 'maas'
profiles = ('sysmgmt',)
option_list = [
('profile-name',
'The name with which you will later refer to this remote', '', False),
('url', 'The URL of the remote API', '', False),
('credentials',
'The credentials, also known as the API key', '', False)
]
def _has_login_options(self):
return self.get_option("url") and self.get_option("credentials") \
and self.get_option("profile-name")
def _remote_api_login(self):
ret = self.call_ext_prog("maas login %s %s %s" % (
self.get_option("profile-name"),
self.get_option("url"),
self.get_option("credentials")))
return ret['status'] == 0
def setup(self):
self.add_copy_spec([
"/etc/squid-deb-proxy",
"/etc/maas",
"/var/lib/maas/dhcp*",
"/var/log/apache2*",
"/var/log/maas*",
"/var/log/upstart/maas-*",
])
self.add_cmd_output([
"apt-cache policy maas-*",
"apt-cache policy python-django-*",
])
if self.is_installed("maas-region-controller"):
self.add_cmd_output([
"maas-region-admin dumpdata",
])
if self._has_login_options():
if self._remote_api_login():
self.add_cmd_output("maas %s commissioning-results list" %
self.get_option("profile-name"))
else:
self._log_error(
"Cannot login into MAAS remote API with provided creds.")
# vim: set et ts=4 sw=4 :
sosreport-3.5/sos/plugins/nis.py 0000644 0001750 0001750 00000002205 13203300002 016661 0 ustar caribou caribou # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
class Nis(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
"""Network information service
"""
plugin_name = 'nis'
profiles = ('identity', 'services')
files = ('/var/yp',)
def setup(self):
self.add_copy_spec([
"/etc/yp*.conf",
"/var/yp/*"
])
self.add_cmd_output("domainname")
# vim: set et ts=4 sw=4 :
sosreport-3.5/sos/plugins/last.py 0000644 0001750 0001750 00000002171 13203300002 017035 0 ustar caribou caribou # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
class Last(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
"""login information
"""
plugin_name = 'last'
profiles = ('system',)
def setup(self):
self.add_cmd_output("last", root_symlink="last")
self.add_cmd_output([
"last reboot",
"last shutdown",
"lastlog"
])
# vim: et ts=4 sw=4
sosreport-3.5/sos/plugins/dbus.py 0000644 0001750 0001750 00000002116 13203300002 017026 0 ustar caribou caribou # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
class Dbus(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
"""D-Bus message bus"""
plugin_name = "dbus"
profiles = ('system',)
packages = ('dbus',)
def setup(self):
self.add_copy_spec([
"/etc/dbus-1",
"/var/lib/dbus/machine-id"
])
# vim: set et ts=4 sw=4 :
sosreport-3.5/sos/plugins/vulkan.py 0000644 0001750 0001750 00000002103 13203300002 017365 0 ustar caribou caribou # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
class Vulkan(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
"""Vulkan
"""
plugin_name = 'vulkan'
profiles = ('hardware', 'desktop', 'gpu')
files = ('/usr/bin/vulkaninfo',)
def setup(self):
self.add_cmd_output([
"vulkaninfo",
])
# vim: set et ts=4 sw=4 :
sosreport-3.5/sos/plugins/openstack_horizon.py 0000644 0001750 0001750 00000010163 13203300002 021631 0 ustar caribou caribou # Copyright (C) 2009 Red Hat, Inc., Joey Boggs
# Copyright (C) 2012 Rackspace US, Inc.,
# Justin Shepherd
# Copyright (C) 2013 Red Hat, Inc., Jeremy Agee
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
class OpenStackHorizon(Plugin):
"""OpenStack Horizon
"""
plugin_name = "openstack_horizon"
profiles = ('openstack', 'openstack_controller')
option_list = []
var_puppet_gen = "/var/lib/config-data/puppet-generated"
def setup(self):
self.limit = self.get_option("log_size")
if self.get_option("all_logs"):
self.add_copy_spec([
"/var/log/horizon/",
"/var/log/containers/horizon/",
"/var/log/containers/httpd/horizon/"
], sizelimit=self.limit)
else:
self.add_copy_spec([
"/var/log/horizon/*.log",
"/var/log/containers/horizon/*.log",
"/var/log/containers/httpd/horizon/*log"
], sizelimit=self.limit)
self.add_copy_spec([
"/etc/openstack-dashboard/",
self.var_puppet_gen + "/horizon/etc/openstack-dashboard/",
self.var_puppet_gen + "/horizon/etc/httpd/conf/",
self.var_puppet_gen + "/horizon/etc/httpd/conf.d/",
self.var_puppet_gen + "/horizon/etc/httpd/conf.modules.d/*.conf",
self.var_puppet_gen + "/memcached/etc/sysconfig/memcached"
])
self.add_forbidden_path("*.py[co]")
if self.get_option("verify"):
self.add_cmd_output("rpm -V %s" % ' '.join(self.packages))
def postproc(self):
var_puppet_gen = self.var_puppet_gen + "/horizon"
protect_keys = [
"SECRET_KEY", "EMAIL_HOST_PASSWORD"
]
regexp = r"((?m)^\s*(%s)\s*=\s*)(.*)" % "|".join(protect_keys)
self.do_path_regex_sub(
"/etc/openstack-dashboard/.*\.json",
regexp, r"\1*********"
)
self.do_path_regex_sub(
var_puppet_gen + "/etc/openstack-dashboard/.*\.json",
regexp, r"\1*********"
)
self.do_path_regex_sub(
"/etc/openstack-dashboard/local_settings/.*\.conf.*",
regexp, r"\1*********"
)
self.do_path_regex_sub(
var_puppet_gen + "/etc/openstack-dashboard/.*\.conf.*",
regexp, r"\1*********"
)
class DebianHorizon(OpenStackHorizon, DebianPlugin):
packages = (
'python-django-horizon',
'openstack-dashboard',
'openstack-dashboard-apache'
)
def setup(self):
super(DebianHorizon, self).setup()
self.add_copy_spec("/etc/apache2/sites-available/")
class UbuntuHorizon(OpenStackHorizon, UbuntuPlugin):
packages = (
'python-django-horizon',
'openstack-dashboard',
'openstack-dashboard-ubuntu-theme'
)
def setup(self):
super(UbuntuHorizon, self).setup()
self.add_copy_spec("/etc/apache2/conf.d/openstack-dashboard.conf")
class RedHatHorizon(OpenStackHorizon, RedHatPlugin):
packages = (
'python-django-horizon',
'openstack-dashboard'
)
def setup(self):
super(RedHatHorizon, self).setup()
self.add_copy_spec("/etc/httpd/conf.d/openstack-dashboard.conf")
if self.get_option("log"):
self.add_copy_spec("/var/log/httpd/")
# vim: set et ts=4 sw=4 :
sosreport-3.5/sos/plugins/unity.py 0000644 0001750 0001750 00000002030 13203300002 017234 0 ustar caribou caribou # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, UbuntuPlugin
class unity(Plugin, UbuntuPlugin):
"""Unity
"""
plugin_name = 'unity'
profiles = ('hardware', 'desktop')
packages = (
'nux-tools',
'unity'
)
def setup(self):
self.add_cmd_output("/usr/lib/nux/unity_support_test -p")
# vim: set et ts=4 sw=4 :
sosreport-3.5/sos/plugins/ovirt.py 0000644 0001750 0001750 00000015757 13203300002 017253 0 ustar caribou caribou # Copyright (C) 2014 Red Hat, Inc., Sandro Bonazzola
# Copyright (C) 2014 Red Hat, Inc., Bryn M. Reeves
# Copyright (C) 2010 Red Hat, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
import os
import re
import signal
from sos.plugins import Plugin, RedHatPlugin
# Class name must be the same as file name and method names must not change
class Ovirt(Plugin, RedHatPlugin):
"""oVirt Engine"""
plugin_name = "ovirt"
profiles = ('virt',)
packages = (
'ovirt-engine',
'ovirt-engine-dwh',
'ovirt-engine-reports',
'ovirt-scheduler-proxy',
'rhevm',
'rhevm-dwh',
'rhevm-reports'
)
DB_PASS_FILES = re.compile(
flags=re.VERBOSE,
pattern=r"""
^
/etc/
(rhevm|ovirt-engine|ovirt-engine-dwh)/
(engine.conf|ovirt-engine-dwhd.conf)
(\.d/.+.conf)?
$
"""
)
DEFAULT_SENSITIVE_KEYS = (
'ENGINE_DB_PASSWORD:ENGINE_PKI_TRUST_STORE_PASSWORD:'
'ENGINE_PKI_ENGINE_STORE_PASSWORD:DWH_DB_PASSWORD'
)
option_list = [
('jbosstrace', 'Enable oVirt Engine JBoss stack trace collection',
'', True),
('sensitive_keys', 'Sensitive keys to be masked',
'', DEFAULT_SENSITIVE_KEYS)
]
def setup(self):
if self.get_option('jbosstrace'):
engine_pattern = "^ovirt-engine\ -server.*jboss-modules.jar"
pgrep = "pgrep -f '%s'" % engine_pattern
lines = self.call_ext_prog(pgrep)['output'].splitlines()
engine_pids = [int(x) for x in lines]
if not engine_pids:
self.soslog.error('Unable to get ovirt-engine pid')
self.add_alert('Unable to get ovirt-engine pid')
for pid in engine_pids:
try:
# backtrace written to '/var/log/ovirt-engine/console.log
os.kill(pid, signal.SIGQUIT)
except OSError as e:
self.soslog.error('Unable to send signal to %d' % pid, e)
self.add_forbidden_path('/etc/ovirt-engine/.pgpass')
self.add_forbidden_path('/etc/rhevm/.pgpass')
# Copy all engine tunables and domain information
self.add_cmd_output("engine-config --all")
self.add_cmd_output("engine-manage-domains list")
# Copy engine config files.
self.add_copy_spec([
"/etc/ovirt-engine",
"/etc/rhevm/",
"/etc/ovirt-engine-dwh",
"/etc/ovirt-engine-reports",
"/var/log/ovirt-engine",
"/var/log/ovirt-engine-dwh",
"/var/log/ovirt-engine-reports",
"/var/log/ovirt-scheduler-proxy",
"/var/log/rhevm",
"/etc/sysconfig/ovirt-engine",
"/usr/share/ovirt-engine/conf",
"/var/log/ovirt-guest-agent",
"/var/lib/ovirt-engine/setup-history.txt",
"/var/lib/ovirt-engine/setup/answers",
"/var/lib/ovirt-engine/external_truststore",
"/var/tmp/ovirt-engine/config",
"/var/lib/ovirt-engine/jboss_runtime/config",
"/var/lib/ovirt-engine-reports/jboss_runtime/config"
])
def postproc(self):
"""
Obfuscate sensitive keys.
"""
self.do_file_sub(
"/etc/ovirt-engine/engine-config/engine-config.properties",
r"Password.type=(.*)",
r"Password.type=********"
)
self.do_file_sub(
"/etc/rhevm/rhevm-config/rhevm-config.properties",
r"Password.type=(.*)",
r"Password.type=********"
)
engine_files = (
'ovirt-engine.xml',
'ovirt-engine_history/current/ovirt-engine.v1.xml',
'ovirt-engine_history/ovirt-engine.boot.xml',
'ovirt-engine_history/ovirt-engine.initial.xml',
'ovirt-engine_history/ovirt-engine.last.xml',
)
for filename in engine_files:
self.do_file_sub(
"/var/tmp/ovirt-engine/config/%s" % filename,
r"(.*)",
r"********"
)
self.do_file_sub(
"/etc/ovirt-engine/redhatsupportplugin.conf",
r"proxyPassword=(.*)",
r"proxyPassword=********"
)
passwd_files = [
"logcollector.conf",
"imageuploader.conf",
"isouploader.conf"
]
for conf_file in passwd_files:
conf_path = os.path.join("/etc/ovirt-engine", conf_file)
self.do_file_sub(
conf_path,
r"passwd=(.*)",
r"passwd=********"
)
self.do_file_sub(
conf_path,
r"pg-pass=(.*)",
r"pg-pass=********"
)
sensitive_keys = self.DEFAULT_SENSITIVE_KEYS
# Handle --alloptions case which set this to True.
keys_opt = self.get_option('sensitive_keys')
if keys_opt and keys_opt is not True:
sensitive_keys = keys_opt
key_list = [x for x in sensitive_keys.split(':') if x]
for key in key_list:
self.do_path_regex_sub(
self.DB_PASS_FILES,
r'{key}=(.*)'.format(key=key),
r'{key}=********'.format(key=key)
)
# Answer files contain passwords
for key in (
'OVESETUP_CONFIG/adminPassword',
'OVESETUP_CONFIG/remoteEngineHostRootPassword',
'OVESETUP_DWH_DB/password',
'OVESETUP_DB/password',
'OVESETUP_REPORTS_CONFIG/adminPassword',
'OVESETUP_REPORTS_DB/password',
):
self.do_path_regex_sub(
r'/var/lib/ovirt-engine/setup/answers/.*',
r'{key}=(.*)'.format(key=key),
r'{key}=********'.format(key=key)
)
# aaa profiles contain passwords
protect_keys = [
"vars.password",
"pool.default.auth.simple.password",
"pool.default.ssl.truststore.password",
"config.datasource.dbpassword"
]
regexp = r"((?m)^\s*#*(%s)\s*=\s*)(.*)" % "|".join(protect_keys)
self.do_path_regex_sub("/etc/ovirt-engine/aaa/.*\.properties", regexp,
r"\1*********")
# vim: expandtab tabstop=4 shiftwidth=4
sosreport-3.5/sos/plugins/storageconsole.py 0000644 0001750 0001750 00000004065 13203300002 021125 0 ustar caribou caribou # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin
class StorageConsole(Plugin, RedHatPlugin, DebianPlugin):
"""Red Hat Storage Console
"""
plugin_name = 'storageconsole'
profiles = ('storage',)
packages = ('rhscon-core',)
def setup(self):
all_logs = self.get_option("all_logs")
limit = self.get_option("log_size")
if not all_logs:
self.add_copy_spec([
"/var/log/skyring/skyring.log",
"/var/log/skyring/bigfin.log",
"/var/log/carbon/console.log",
"/var/log/graphite-web/info.log",
"/var/log/graphite-web/exception.log",
], sizelimit=limit)
else:
self.add_copy_spec([
"/var/log/skyring/",
"/var/log/carbon/",
"/var/log/graphite-web/"
])
self.add_copy_spec([
"/etc/skyring/",
"/etc/carbon/",
"/etc/graphite-web/"
])
self.add_cmd_output(
"mongo skyring --eval 'db.getCollectionNames()'",
suggest_filename="mongo_skyring_collectionnames.txt")
self.add_cmd_output(
"mongo skyring --eval 'DBQuery.shellBatchSize = 10000;"
"db.storage_nodes.find()'",
suggest_filename="mongo_skyring_storagenodes.txt")
# vim: set et ts=4 sw=4 :
sosreport-3.5/sos/plugins/ceph_ansible.py 0000644 0001750 0001750 00000002416 13203300002 020510 0 ustar caribou caribou # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin
class CephAnsible(Plugin, RedHatPlugin, DebianPlugin):
"""CEPH distributed storage - Ansible installer
"""
plugin_name = 'ceph_ansible'
profiles = ('storage',)
packages = ('ceph-ansible',)
def setup(self):
self.add_copy_spec([
"/usr/share/ceph-ansible/group_vars/",
"/usr/share/ceph-ansible/site*.yml",
"/usr/share/ceph-ansible/ansible.cfg"
])
self.add_forbidden_path("/usr/share/ceph-ansible/group_vars/*.sample")
# vim: set et ts=4 sw=4 :
sosreport-3.5/sos/plugins/collectd.py 0000644 0001750 0001750 00000004046 13203300002 017666 0 ustar caribou caribou # Copyright (C) 2016 Archit Sharma
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
import re
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
class Collectd(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
'''
Collectd config collector
'''
plugin_name = "collectd"
profiles = ('services', 'webserver')
packages = ('collectd',)
def setup(self):
self.add_copy_spec([
'/etc/collectd.conf',
'/etc/collectd.d/*.conf',
])
p = re.compile('^LoadPlugin.*')
try:
with open("/etc/collectd.conf") as f:
for line in f:
if p.match(line):
self.add_alert("Active Plugin found: %s" %
line.split()[-1])
except IOError as e:
self._log_warn("could not open /etc/collectd.conf: %s" % e)
def postproc(self):
# add these to protect_keys if need be:
# "Port", "[<]*Host",
protect_keys = [
"Password", "User",
"[<]*URL", "Address"
]
regexp = r"((?m)^[#]*\s*(%s)\s* \s*)(.*)" % "|".join(protect_keys)
self.do_path_regex_sub(
"/etc/collectd.d/*.conf",
regexp, r'\1"*********"'
)
self.do_file_sub("/etc/collectd.conf", regexp, r'\1"*********"')
# vim: set et ts=4 sw=4 :
sosreport-3.5/sos/plugins/i18n.py 0000644 0001750 0001750 00000002150 13203300002 016646 0 ustar caribou caribou # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
class I18n(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
"""Internationalization
"""
plugin_name = 'i18n'
profiles = ('system',)
def setup(self):
self.add_copy_spec([
"/etc/X11/xinit/xinput.d/*",
"/etc/locale.conf"
])
self.add_cmd_output("locale")
# vim: set et ts=4 sw=4 :
sosreport-3.5/sos/plugins/openvswitch.py 0000644 0001750 0001750 00000013010 13203300002 020435 0 ustar caribou caribou # Copyright (C) 2014 Adam Stokes
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
class OpenVSwitch(Plugin):
""" OpenVSwitch networking
"""
plugin_name = "openvswitch"
profiles = ('network', 'virt')
def setup(self):
all_logs = self.get_option("all_logs")
limit = self.get_option("log_size")
if not all_logs:
self.add_copy_spec("/var/log/openvswitch/*.log",
sizelimit=limit)
else:
self.add_copy_spec("/var/log/openvswitch/",
sizelimit=limit)
self.add_copy_spec([
"/var/run/openvswitch/ovsdb-server.pid",
"/var/run/openvswitch/ovs-vswitchd.pid"
])
self.add_cmd_output([
# The '-s' option enables dumping of packet counters on the
# ports.
"ovs-dpctl -s show",
# Capture the in-kernel flow information if it exists
"ovs-dpctl dump-flows -m",
# The '-t 5' adds an upper bound on how long to wait to connect
# to the Open vSwitch server, avoiding hangs when running sos.
"ovs-vsctl -t 5 show",
# Gather the database.
"ovsdb-client -f list dump",
# List the contents of runtime directory
"ls -laZ /var/run/openvswitch",
# List devices and their drivers
"dpdk_nic_bind --status",
"dpdk_devbind.py --status",
"driverctl list-devices",
"driverctl list-overrides",
# Capture a list of all bond devices
"ovs-appctl bond/list",
# Capture more details from bond devices
"ovs-appctl bond/show",
# Capture LACP details
"ovs-appctl lacp/show",
# Capture coverage stats"
"ovs-appctl coverage/show",
# Capture cached routes
"ovs-appctl ovs/route/show",
# Capture tnl arp table"
"ovs-appctl tnl/arp/show",
# Capture a list of listening ports"
"ovs-appctl tnl/ports/show",
# Capture upcall information
"ovs-appctl upcall/show",
# Capture DPDK and other parameters
"ovs-vsctl -t 5 get Open_vSwitch . other_config",
# Capture DPDK datapath packet counters and config
"ovs-appctl dpctl/show -s",
# Capture DPDK queue to pmd mapping
"ovs-appctl dpif-netdev/pmd-rxq-show",
# Capture DPDK pmd stats
"ovs-appctl dpif-netdev/pmd-stats-show"
])
# Gather systemd services logs
self.add_journal(units="openvswitch")
self.add_journal(units="openvswitch-nonetwork")
self.add_journal(units="ovs-vswitchd")
self.add_journal(units="ovsdb-server")
# Gather additional output for each OVS bridge on the host.
br_list_result = self.call_ext_prog("ovs-vsctl list-br")
if br_list_result['status'] == 0:
for br in br_list_result['output'].splitlines():
self.add_cmd_output([
"ovs-appctl fdb/show %s" % br,
"ovs-ofctl dump-flows %s" % br,
"ovs-ofctl dump-ports-desc %s" % br,
"ovs-ofctl dump-ports %s" % br,
"ovs-ofctl queue-get-config %s" % br,
"ovs-ofctl queue-stats %s" % br,
"ovs-ofctl show %s" % br
])
# Flow protocols currently supported
flow_versions = [
"OpenFlow10",
"OpenFlow11",
"OpenFlow12",
"OpenFlow13"
]
# List protocols currently in use, if any
ovs_list_bridge_cmd = "ovs-vsctl list bridge %s" % br
br_info_file = self.get_cmd_output_now(ovs_list_bridge_cmd)
br_info = open(br_info_file).read()
for line in br_info.splitlines():
if "protocols" in line:
br_protos_ln = line[line.find("[")+1:line.find("]")]
br_protos = br_protos_ln.replace('"', '').split(", ")
# Collect flow information for relevant protocol versions only
for flow in flow_versions:
if flow in br_protos:
self.add_cmd_output([
"ovs-ofctl -O %s dump-flows %s" % (flow, br),
"ovs-ofctl -O %s dump-ports-desc %s" % (flow, br)
])
class RedHatOpenVSwitch(OpenVSwitch, RedHatPlugin):
packages = ('openvswitch', 'openvswitch-dpdk')
class DebianOpenVSwitch(OpenVSwitch, DebianPlugin, UbuntuPlugin):
packages = ('openvswitch-switch',)
# vim: set et ts=4 sw=4 :
sosreport-3.5/sos/plugins/sapnw.py 0000644 0001750 0001750 00000013437 13203300002 017231 0 ustar caribou caribou # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
import os
from sos.plugins import Plugin, RedHatPlugin
def get_directory_listing(path):
try:
dir_list = os.listdir(path)
except:
dir_list = []
return dir_list
class sapnw(Plugin, RedHatPlugin):
"""SAP NetWeaver"""
plugin_name = 'sapnw'
profiles = ['sap']
files = ['/usr/sap']
def collect_list_instances(self):
# list installed instances
inst_out = self.get_cmd_output_now("/usr/sap/hostctrl/exe/saphostctrl \
-function ListInstances",
suggest_filename="SAPInstances")
if not inst_out:
return
sidsunique = set()
# Cycle through all the instances, get 'sid', 'instance_number'
# and 'vhost' to determine the proper profile
p = open(inst_out, "r").read().splitlines()
for line in p:
if "DAA" not in line:
fields = line.strip().split()
sid = fields[3]
inst = fields[5]
vhost = fields[7]
sidsunique.add(sid)
for line in get_directory_listing("/usr/sap/%s/SYS/profile/"
% sid):
if sid in line and inst in line and vhost in line:
ldenv = 'LD_LIBRARY_PATH=/usr/sap/%s/SYS/exe/run' % sid
# TODO: I am assuming unicode here
# nuc should be accounted
pt = '/usr/sap/%s/SYS/exe/uc/linuxx86_64' % sid
profile = line.strip()
# collect profiles
self.add_cmd_output(
"env -i %s %s/sappfpar \
all pf=/usr/sap/%s/SYS/profile/%s"
% (ldenv, pt, sid, profile),
suggest_filename="%s_parameters" % profile)
# collect instance status
self.add_cmd_output(
"env -i %s %s/sapcontrol -nr %s \
-function GetProcessList" % (ldenv, pt, inst),
suggest_filename="%s_%s_GetProcList"
% (sid, inst))
# collect version info for the various components
self.add_cmd_output(
"env -i %s %s/sapcontrol -nr %s \
-function GetVersionInfo" % (ldenv, pt, inst),
suggest_filename="%s_%s_GetVersInfo"
% (sid, inst))
# collect adm user environment
lowsid = sid.lower()
self.add_cmd_output(
"su - %sadm -c \"sapcontrol -nr %s -function \
GetEnvironment\"" % (lowsid, inst),
suggest_filename="%s_%sadm_%s_userenv"
% (sid, lowsid, inst))
# traverse the sids list, collecting info about dbclient
for sid in sidsunique:
for line in get_directory_listing("/usr/sap/%s/" % sid):
if 'DVEB' in line:
self.add_cmd_output(
"grep 'client driver' /usr/sap/%s/%s/work/dev_w0"
% (sid, line), suggest_filename="%s_dbclient"
% sid)
def collect_list_dbs(self):
# list installed sap dbs
db_out = self.get_cmd_output_now("/usr/sap/hostctrl/exe/saphostctrl \
-function ListDatabases",
suggest_filename="SAPDatabases")
if not db_out:
return
dbl = open(db_out, "r").read().splitlines()
for line in dbl:
if "Instance name" in line:
fields = line.strip().split()
dbadm = fields[2][:-1]
dbtype = fields[8][:-1]
sid = dbadm[3:].upper()
if dbtype == 'db6':
# IBM DB2
self.add_cmd_output(
"su - %s -c \"db2 get dbm cfg\""
% dbadm, suggest_filename="%s_%s_db2_info"
% (sid, dbadm))
if dbtype == 'sap':
# SAP MAXDB
sid = fields[2][:-1]
self.add_copy_spec(
"/sapdb/%s/data/config/%s.pah" % (sid, sid))
if dbtype == 'ora':
# Oracle
sid = fields[2][:-1]
self.add_copy_spec("/oracle/%s/*/dbs/init.ora" % sid)
if dbtype == 'syb':
# Sybase
sid = fields[2][:-1]
self.add_copy_spec("/sybase/%s/ASE*/%s.cfg" % (sid, sid))
def setup(self):
self.collect_list_instances()
self.collect_list_dbs()
# run sapconf in check mode
self.add_cmd_output("sapconf -n",
suggest_filename="sapconf_checkmode")
# vim: et ts=4 sw=4
sosreport-3.5/sos/plugins/foreman.py 0000644 0001750 0001750 00000002376 13203300002 017530 0 ustar caribou caribou # Copyright (C) 2013 Red Hat, Inc., Lukas Zapletal
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, RedHatPlugin
class Foreman(Plugin, RedHatPlugin):
"""Foreman/Satellite 6 systems management
"""
plugin_name = 'foreman'
profiles = ('sysmgmt',)
packages = ('foreman-debug',)
def setup(self):
cmd = "foreman-debug"
path = self.get_cmd_output_path(name="foreman-debug")
self.add_cmd_output("%s -g -q -a -d %s" % (cmd, path),
chroot=self.tmp_in_sysroot(), timeout=900)
# vim: set et ts=4 sw=4 :
sosreport-3.5/sos/plugins/openstack_manila.py 0000644 0001750 0001750 00000006444 13203300002 021411 0 ustar caribou caribou # Copyright (C) 2016 Red Hat, Inc.,Poornima M. Kshirsagar
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
class OpenStackManila(Plugin):
"""OpenStack Manila
"""
plugin_name = "openstack_manila"
profiles = ('openstack', 'openstack_controller')
option_list = []
var_puppet_gen = "/var/lib/config-data/puppet-generated/manila"
def setup(self):
self.add_copy_spec([
"/etc/manila/",
self.var_puppet_gen + "/etc/manila/",
self.var_puppet_gen + "/etc/my.cnf.d/tripleo.cnf",
self.var_puppet_gen + "/etc/httpd/conf/",
self.var_puppet_gen + "/etc/httpd/conf.d/",
self.var_puppet_gen + "/etc/httpd/conf.modules.d/*.conf",
])
self.limit = self.get_option("log_size")
if self.get_option("all_logs"):
self.add_copy_spec([
"/var/log/manila/*",
"/var/log/containers/manila/*",
"/var/log/containers/httpd/manila-api/*"
], sizelimit=self.limit)
else:
self.add_copy_spec([
"/var/log/manila/*.log",
"/var/log/containers/manila/*.log",
"/var/log/containers/httpd/manila-api/*log"
], sizelimit=self.limit)
def postproc(self):
protect_keys = [
"nova_admin_password", "rabbit_password", "qpid_password",
"password", "netapp_nas_password", "cinder_admin_password",
"neutron_admin_password", "service_instance_password",
"connection", "sql_connection"
]
regexp = r"((?m)^\s*(%s)\s*=\s*)(.*)" % "|".join(protect_keys)
self.do_path_regex_sub("/etc/manila/*", regexp, r"\1*********")
self.do_path_regex_sub(
self.var_puppet_gen + "/etc/manila/*",
regexp, r"\1*********"
)
class DebianManila(OpenStackManila, DebianPlugin, UbuntuPlugin):
"""OpenStackManila related information for Debian based distributions."""
packages = (
'python-manila',
'manila-common',
'manila-api',
'manila-share',
'manila-scheduler'
)
class RedHatManila(OpenStackManila, RedHatPlugin):
"""OpenStackManila related information for Red Hat distributions."""
packages = (
'puppet-manila',
'openstack-manila',
'openstack-manila-share',
'python-manila',
'python-manilaclient',
'python-manila-tests'
)
def setup(self):
super(RedHatManila, self).setup()
self.add_copy_spec("/etc/sudoers.d/manila")
# vim: et ts=4 sw=4
sosreport-3.5/sos/plugins/logrotate.py 0000644 0001750 0001750 00000002612 13203300002 020072 0 ustar caribou caribou # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
class LogRotate(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
"""LogRotate service
"""
plugin_name = 'logrotate'
profiles = ('system',)
var_puppet_gen = "/var/lib/config-data/puppet-generated/crond"
def setup(self):
self.add_cmd_output("logrotate --debug /etc/logrotate.conf",
suggest_filename="logrotate_debug")
self.add_copy_spec([
"/etc/logrotate*",
"/var/lib/logrotate.status",
self.var_puppet_gen + "/etc/logrotate-crond.conf",
self.var_puppet_gen + "/var/spool/cron/root"
])
# vim: set et ts=4 sw=4 :
sosreport-3.5/sos/plugins/udev.py 0000644 0001750 0001750 00000002175 13203300002 017041 0 ustar caribou caribou # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
class Udev(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
"""udev dynamic device management
"""
plugin_name = 'udev'
profiles = ('system', 'hardware', 'boot')
def setup(self):
self.add_copy_spec([
"/etc/udev/udev.conf",
"/lib/udev/rules.d",
"/etc/udev/rules.d/*"
])
# vim: set et ts=4 sw=4 :
sosreport-3.5/sos/plugins/ntb.py 0000644 0001750 0001750 00000002403 13203300002 016653 0 ustar caribou caribou # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, RedHatPlugin
class Ntb(Plugin, RedHatPlugin):
"""Linux PCI-Express Non-Transparent Bridge
"""
plugin_name = 'ntb'
profiles = ('hardware', )
def setup(self):
# NTB is hardwired at PCI Bus 0, device 3, function 0 on Intel
# processors (see page 8 in
# http://download.intel.com/design/intarch/papers/323328.pdf).
self.add_copy_spec([
'/sys/kernel/debug/ntb_hw_intel/0000:*/info',
'/sys/kernel/debug/ntb_transport/0000:*/qp*/stats'
])
# vim: set et ts=4 sw=4 :
sosreport-3.5/sos/plugins/gluster_block.py 0000644 0001750 0001750 00000002624 13203300002 020734 0 ustar caribou caribou # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
import glob
from sos.plugins import Plugin, RedHatPlugin
class GlusterBlock(Plugin, RedHatPlugin):
"""Gluster Block"""
plugin_name = 'gluster_block'
profiles = ('storage',)
packages = ("gluster-block",)
files = ("/usr/sbin/gluster-block",)
def setup(self):
# collect logs - apply log_size for any individual file
# all_logs takes precedence over logsize
if not self.get_option("all_logs"):
limit = self.get_option("log_size")
else:
limit = 0
if limit:
for f in glob.glob("/var/log/gluster-block/*.log"):
self.add_copy_spec(f, limit)
else:
self.add_copy_spec("/var/log/gluster-block")
sosreport-3.5/sos/plugins/cgroups.py 0000644 0001750 0001750 00000002736 13203300002 017563 0 ustar caribou caribou # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
class Cgroups(Plugin, DebianPlugin, UbuntuPlugin):
"""Control groups subsystem
"""
plugin_name = "cgroups"
profiles = ('system',)
files = ('/proc/cgroups',)
def setup(self):
self.add_copy_spec([
"/proc/cgroups",
"/sys/fs/cgroup"
])
self.add_cmd_output("systemd-cgls")
return
class RedHatCgroups(Cgroups, RedHatPlugin):
def setup(self):
super(RedHatCgroups, self).setup()
self.add_copy_spec([
"/etc/sysconfig/cgconfig",
"/etc/sysconfig/cgred",
"/etc/cgsnapshot_blacklist.conf",
"/etc/cgconfig.conf",
"/etc/cgrules.conf"
])
# vim: set et ts=4 sw=4 :
sosreport-3.5/sos/plugins/java.py 0000644 0001750 0001750 00000002365 13203300002 017020 0 ustar caribou caribou # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, RedHatPlugin, UbuntuPlugin, DebianPlugin
class Java(Plugin, RedHatPlugin, UbuntuPlugin, DebianPlugin):
"""Java runtime"""
plugin_name = "java"
profiles = ('webserver', 'java')
verify_packages = ('java.*',)
def setup(self):
self.add_copy_spec("/etc/java")
self.add_forbidden_path("/etc/java/security")
self.add_cmd_output("alternatives --display java",
root_symlink="java")
self.add_cmd_output("readlink -f /usr/bin/java")
# vim: set et ts=4 sw=4 :
sosreport-3.5/sos/plugins/vhostmd.py 0000644 0001750 0001750 00000004224 13203300002 017557 0 ustar caribou caribou # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, RedHatPlugin
import os
class vhostmd(Plugin, RedHatPlugin):
"""vhostmd virtualization metrics collection
"""
plugin_name = 'vhostmd'
profiles = ['sap', 'virt', 'system']
packages = ['virt-what']
def setup(self):
vw = self.get_command_output("virt-what")['output'].splitlines()
if not vw:
return
if "vmware" in vw or "kvm" in vw or "xen" in vw:
if self.is_installed("vm-dump-metrics"):
# if vm-dump-metrics is installed use it
self.add_cmd_output("vm-dump-metrics",
suggest_filename="virt_metrics")
else:
# otherwise use the raw vhostmd disk presented (256k size)
sysblock = "/sys/block"
if not os.path.isdir(sysblock):
return
for disk in os.listdir(sysblock):
if "256K" in disk:
dev = disk.split()[0]
check = self.get_command_output(
"dd if=/dev/%s bs=25 count=1" % dev)
if 'metric' in check['output']:
self.add_cmd_output("dd if=/dev/%s bs=256k count=1"
% dev,
suggest_filename="virt_\
metrics")
# vim: et ts=4 sw=4
sosreport-3.5/sos/plugins/ipsec.py 0000644 0001750 0001750 00000002621 13203300002 017175 0 ustar caribou caribou # Copyright (C) 2007 Sadique Puthen
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
class IPSec(Plugin):
"""Internet protocol security
"""
plugin_name = "ipsec"
profiles = ('network',)
packages = ('ipsec-tools',)
class RedHatIpsec(IPSec, RedHatPlugin):
files = ('/etc/racoon/racoon.conf',)
def setup(self):
self.add_copy_spec("/etc/racoon")
class DebianIPSec(IPSec, DebianPlugin, UbuntuPlugin):
files = ('/etc/ipsec-tools.conf',)
def setup(self):
self.add_copy_spec([
"/etc/ipsec-tools.conf",
"/etc/ipsec-tools.d",
"/etc/default/setkey"
])
# vim: set et ts=4 sw=4 :
sosreport-3.5/sos/plugins/dhcp.py 0000644 0001750 0001750 00000002623 13203300002 017012 0 ustar caribou caribou # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, RedHatPlugin, UbuntuPlugin
class Dhcp(Plugin):
"""DHCP daemon
"""
plugin_name = "dhcp"
profiles = ('network',)
class RedHatDhcp(Dhcp, RedHatPlugin):
files = ('/etc/rc.d/init.d/dhcpd',)
packages = ('dhcp',)
def setup(self):
super(RedHatDhcp, self).setup()
self.add_copy_spec([
"/etc/dhcpd.conf",
"/etc/dhcp"
])
class UbuntuDhcp(Dhcp, UbuntuPlugin):
files = ('/etc/init.d/udhcpd',)
packages = ('udhcpd',)
def setup(self):
super(UbuntuDhcp, self).setup()
self.add_copy_spec([
"/etc/default/udhcpd",
"/etc/udhcpd.conf"
])
# vim: set et ts=4 sw=4 :
sosreport-3.5/sos/plugins/devicemapper.py 0000644 0001750 0001750 00000002310 13203300002 020531 0 ustar caribou caribou # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
class DeviceMapper(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
"""device-mapper framework
"""
plugin_name = 'devicemapper'
profiles = ('storage',)
packages = ('device-mapper',)
files = ('/dev/mapper',)
def setup(self):
self.add_cmd_output([
"dmsetup info -c",
"dmsetup table",
"dmsetup status",
"dmsetup ls --tree"
])
# vim: set et ts=4 sw=4 :
sosreport-3.5/sos/plugins/infiniband.py 0000644 0001750 0001750 00000003151 13203300002 020172 0 ustar caribou caribou # Copyright (C) 2011, 2012 Red Hat, Inc., Bryn M. Reeves
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
class Infiniband(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
"""Infiniband data
"""
plugin_name = 'infiniband'
profiles = ('hardware',)
packages = ('libibverbs-utils', 'opensm', 'rdma', 'infiniband-diags')
def setup(self):
self.add_copy_spec([
"/etc/ofed/openib.conf",
"/etc/ofed/opensm.conf",
"/etc/rdma"
])
self.add_copy_spec("/var/log/opensm*",
sizelimit=self.get_option("log_size"))
self.add_cmd_output([
"ibv_devices",
"ibv_devinfo",
"ibstat",
"ibstatus",
"ibhosts",
"iblinkinfo",
"sminfo",
"perfquery"
])
return
# vim: set et ts=4 sw=4 :
sosreport-3.5/sos/plugins/openstack_aodh.py 0000644 0001750 0001750 00000007064 13203300002 021062 0 ustar caribou caribou # Copyright (C) 2017 Red Hat, Inc., Sachin Patil
# Copyright (C) 2017 Red Hat, Inc., Martin Schuppert
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
import os
from sos.plugins import Plugin, RedHatPlugin
class OpenStackAodh(Plugin, RedHatPlugin):
"""OpenStack Alarm service"""
plugin_name = "openstack_aodh"
profiles = ('openstack', 'openstack_controller')
packages = (
'openstack-aodh-api',
'openstack-aodh-listener',
'openstack-aodh-notifier',
'openstack-aodh-evaluator,'
'openstack-aodh-common'
)
requires_root = False
var_puppet_gen = "/var/lib/config-data/puppet-generated/aodh"
def setup(self):
self.add_copy_spec([
"/etc/aodh/",
self.var_puppet_gen + "/etc/aodh/*",
self.var_puppet_gen + "/etc/httpd/conf/*",
self.var_puppet_gen + "/etc/httpd/conf.d/*",
self.var_puppet_gen + "/etc/httpd/conf.modules.d/wsgi.conf",
self.var_puppet_gen + "/etc/my.cnf.d/tripleo.cnf"
])
self.limit = self.get_option("log_size")
if self.get_option("all_logs"):
self.add_copy_spec([
"/var/log/aodh/*",
"/var/log/containers/aodh/*",
"/var/log/containers/httpd/aodh-api/*"
], sizelimit=self.limit)
else:
self.add_copy_spec([
"/var/log/aodh/*.log",
"/var/log/containers/aodh/*.log",
"/var/log/containers/httpd/aodh-api/*log"
], sizelimit=self.limit)
vars_all = [p in os.environ for p in [
'OS_USERNAME', 'OS_PASSWORD', 'OS_AUTH_TYPE'
]]
vars_any = [p in os.environ for p in [
'OS_TENANT_NAME', 'OS_PROJECT_NAME'
]]
if not (all(vars_all) and any(vars_any)):
self.soslog.warning("Not all environment variables set. Source "
"the environment file for the user intended "
"to connect to the OpenStack environment.")
else:
self.add_cmd_output([
"aodh --version",
"aodh capabilities list",
"aodh alarm list"
])
def postproc(self):
self.do_file_sub(
"/etc/aodh/aodh.conf",
r"(password[\t\ ]*=[\t\ ]*)(.+)",
r"\1********"
)
self.do_file_sub(
"/etc/aodh/aodh.conf",
r"(rabbit_password[\t\ ]*=[\t\ ]*)(.+)",
r"\1********",
)
self.do_file_sub(
self.var_puppet_gen + "/etc/aodh/aodh.conf",
r"(password[\t\ ]*=[\t\ ]*)(.+)",
r"\1********"
)
self.do_file_sub(
self.var_puppet_gen + "/etc/aodh/aodh.conf",
r"(rabbit_password[\t\ ]*=[\t\ ]*)(.+)",
r"\1********",
)
# vim: set et ts=4 sw=4 :
sosreport-3.5/sos/plugins/snappy.py 0000644 0001750 0001750 00000002441 13203300002 017404 0 ustar caribou caribou # Copyright (c) 2017 Bryan Quigley
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, UbuntuPlugin, DebianPlugin, RedHatPlugin
class Snappy(Plugin, UbuntuPlugin, DebianPlugin, RedHatPlugin):
"""Snap packages
"""
plugin_name = 'snappy'
profiles = ('system', 'sysmgmt', 'packagemanager')
files = ('/usr/bin/snap')
def setup(self):
self.add_cmd_output([
"systemctl status snapd.service",
"snap list --all",
"snap --version",
"snap changes"
])
self.add_journal(units="snapd")
# vim: set et ts=4 sw=4 :
sosreport-3.5/sos/plugins/lilo.py 0000644 0001750 0001750 00000002045 13203300002 017031 0 ustar caribou caribou # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, RedHatPlugin, UbuntuPlugin
class Lilo(Plugin, RedHatPlugin, UbuntuPlugin):
"""Lilo bootloader
"""
plugin_name = 'lilo'
profiles = ('system', 'boot')
packages = ('lilo',)
def setup(self):
self.add_copy_spec("/etc/lilo.conf")
self.add_cmd_output("lilo -q")
# vim: set et ts=4 sw=4 :
sosreport-3.5/sos/plugins/sunrpc.py 0000644 0001750 0001750 00000003214 13203300002 017403 0 ustar caribou caribou # Copyright (C) 2012 Red Hat, Inc., Bryn M. Reeves
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, RedHatPlugin
class SunRPC(Plugin):
"""Sun RPC service
"""
plugin_name = "sunrpc"
profiles = ('system', 'storage', 'network', 'nfs')
service = None
def check_enabled(self):
if self.policy().default_runlevel() in \
self.policy().runlevel_by_service(self.service):
return True
return False
def setup(self):
self.add_cmd_output("rpcinfo -p localhost")
return
class RedHatSunRPC(SunRPC, RedHatPlugin):
service = 'rpcbind'
# FIXME: depends on addition of runlevel_by_service (or similar)
# in Debian/Ubuntu policy classes
# class DebianSunRPC(SunRPC, DebianPlugin, UbuntuPlugin):
# """Sun RPC related information
# """
#
# service = 'rpcbind-boot'
#
# def setup(self):
# self.add_cmd_output("rpcinfo -p localhost")
# return
# vim: set et ts=4 sw=4 :
sosreport-3.5/sos/plugins/nfsganesha.py 0000644 0001750 0001750 00000003003 13203300002 020202 0 ustar caribou caribou # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
class NfsGanesha(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
"""NFS-Ganesha file server information
"""
plugin_name = 'nfsganesha'
profiles = ('storage', 'network', 'nfs')
packages = ('nfs-ganesha')
def setup(self):
self.add_copy_spec([
"/etc/ganesha",
"/etc/sysconfig/ganesha",
"/var/run/sysconfig/ganesha",
"/var/log/ganesha.log",
"/var/log/ganesha-gfapi.log"
])
self.add_cmd_output([
"dbus-send --type=method_call --print-reply"
" --system --dest=org.ganesha.nfsd "
"/org/ganesha/nfsd/ExportMgr "
"org.ganesha.nfsd.exportmgr.ShowExports"
])
return
# vim: set et ts=4 sw=4 :
sosreport-3.5/sos/plugins/kubernetes.py 0000644 0001750 0001750 00000012774 13203300002 020253 0 ustar caribou caribou # Copyright (C) 2014 Red Hat, Inc. Neependra Khare
# Copyright (C) 2014 Red Hat, Inc. Bryn M. Reeves
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, RedHatPlugin
from os import path
class kubernetes(Plugin, RedHatPlugin):
"""Kubernetes plugin
"""
# Red Hat Atomic Platform and OpenShift Enterprise use the
# atomic-openshift-master package to provide kubernetes
packages = ('kubernetes', 'kubernetes-master', 'atomic-openshift-master')
files = ("/etc/origin/master/master-config.yaml",)
option_list = [
("all", "also collect all namespaces output separately",
'slow', False),
("describe", "capture descriptions of all kube resources",
'fast', False),
("podlogs", "capture logs for pods", 'slow', False),
]
def check_is_master(self):
if any([
path.exists("/var/run/kubernetes/apiserver.key"),
path.exists("/etc/origin/master/master-config.yaml")
]):
return True
return False
def setup(self):
self.add_copy_spec("/etc/kubernetes")
self.add_copy_spec("/var/run/flannel")
svcs = [
'kubelet',
'kube-apiserver',
'kube-proxy',
'kube-scheduler',
'kube-controller-manager'
]
for svc in svcs:
self.add_journal(units=svc)
# We can only grab kubectl output from the master
if self.check_is_master():
kube_cmd = "kubectl "
if path.exists('/etc/origin/master/admin.kubeconfig'):
kube_cmd += "--config=/etc/origin/master/admin.kubeconfig"
kube_get_cmd = "get -o json "
for subcmd in ['version', 'config view']:
self.add_cmd_output('%s %s' % (kube_cmd, subcmd))
# get all namespaces in use
kn = self.get_command_output('%s get namespaces' % kube_cmd)
knsps = [n.split()[0] for n in kn['output'].splitlines()[1:] if n]
resources = [
'limitrange',
'pods',
'pvc',
'rc',
'resourcequota',
'services'
]
# nodes and pvs are not namespaced, must pull separately
self.add_cmd_output([
"{} get -o json nodes".format(kube_cmd),
"{} get -o json pv".format(kube_cmd)
])
if self.get_option('all'):
for n in knsps:
knsp = '--namespace=%s' % n
k_cmd = '%s %s %s' % (kube_cmd, kube_get_cmd, knsp)
self.add_cmd_output('%s events' % k_cmd)
for res in resources:
self.add_cmd_output('%s %s' % (k_cmd, res))
if self.get_option('describe'):
# need to drop json formatting for this
k_cmd = '%s get %s' % (kube_cmd, knsp)
for res in resources:
r = self.get_command_output(
'%s %s' % (k_cmd, res))
if r['status'] == 0:
k_list = [k.split()[0] for k in
r['output'].splitlines()[1:]]
for k in k_list:
k_cmd = '%s %s' % (kube_cmd, knsp)
self.add_cmd_output(
'%s describe %s %s' % (k_cmd, res, k))
if self.get_option('podlogs'):
k_cmd = '%s get %s' % (kube_cmd, knsp)
r = self.get_command_output('%s get pods' % k_cmd)
if r['status'] == 0:
pods = [p.split()[0] for p in
r['output'].splitlines()[1:]]
for pod in pods:
self.add_cmd_output('%s logs %s' % (k_cmd, pod))
k_cmd = '%s get --all-namespaces=true' % kube_cmd
for res in resources:
self.add_cmd_output('%s %s' % (k_cmd, res))
def postproc(self):
# First, clear sensitive data from the json output collected.
# This will mask values when the "name" looks susceptible of
# values worth obfuscating, i.e. if the name contains strings
# like "pass", "pwd", "key" or "token"
env_regexp = r'(?P{\s*"name":\s*[^,]*' \
r'(pass|pwd|key|token|cred|PASS|PWD|KEY)[^,]*,\s*"value":)[^}]*'
self.do_cmd_output_sub('kubectl', env_regexp,
r'\g "********"')
# Next, we need to handle the private keys and certs in some
# output that is not hit by the previous iteration.
self.do_cmd_private_sub('kubectl')
# vim: et ts=5 sw=4
sosreport-3.5/sos/plugins/apt.py 0000644 0001750 0001750 00000003257 13203300002 016664 0 ustar caribou caribou # Copyright (C) 2013 Louis Bouchard
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, UbuntuPlugin, DebianPlugin
class Apt(Plugin, DebianPlugin, UbuntuPlugin):
""" APT - advanced packaging tool
"""
plugin_name = 'apt'
profiles = ('system', 'sysmgmt', 'packagemanager')
def setup(self):
self.add_copy_spec([
"/etc/apt", "/var/log/apt"
])
self.add_cmd_output([
"apt-get check",
"apt-config dump",
"apt-cache stats",
"apt-cache policy"
])
dpkg_result = self.call_ext_prog(
"dpkg-query -W -f='${binary:Package}\t${status}\n'")
dpkg_output = dpkg_result['output'].splitlines()
pkg_list = ' '.join(
[v.split('\t')[0] for v in dpkg_output if 'ok installed' in v])
self.add_cmd_output(
"apt-cache policy {}".format(pkg_list),
suggest_filename="apt-cache_policy_details"
)
# vim: set et ts=4 sw=4 :
sosreport-3.5/sos/plugins/openstack_trove.py 0000644 0001750 0001750 00000005200 13203300002 021274 0 ustar caribou caribou # Copyright (C) 2015 Red Hat, Inc., Lee Yarwood
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
class OpenStackTrove(Plugin):
"""OpenStack Trove
"""
plugin_name = "openstack_trove"
profiles = ('openstack', 'openstack_controller')
option_list = []
var_puppet_gen = "/var/lib/config-data/puppet-generated/trove"
def setup(self):
self.limit = self.get_option("log_size")
if self.get_option("all_logs"):
self.add_copy_spec([
"/var/log/trove/",
"/var/log/containers/trove/"
], sizelimit=self.limit)
else:
self.add_copy_spec([
"/var/log/trove/*.log",
"/var/log/containers/trove/*.log"
], sizelimit=self.limit)
self.add_copy_spec([
'/etc/trove/',
self.var_puppet_gen + '/etc/trove/'
])
if self.get_option("verify"):
self.add_cmd_output("rpm -V %s" % ' '.join(self.packages))
def postproc(self):
protect_keys = [
"default_password_length", "notifier_queue_password",
"rabbit_password", "replication_password", "connection",
"admin_password", "dns_passkey"
]
regexp = r"((?m)^\s*(%s)\s*=\s*)(.*)" % "|".join(protect_keys)
self.do_path_regex_sub("/etc/trove/*", regexp, r"\1*********")
self.do_path_regex_sub(
self.var_puppet_gen + "/etc/trove/*",
regexp, r"\1*********"
)
class DebianTrove(OpenStackTrove, DebianPlugin, UbuntuPlugin):
packages = [
'python-trove',
'trove-common',
'trove-api',
'trove-taskmanager'
]
def setup(self):
super(DebianTrove, self).setup()
class RedHatTrove(OpenStackTrove, RedHatPlugin):
packages = ['openstack-trove']
def setup(self):
super(RedHatTrove, self).setup()
# vim: set et ts=4 sw=4 :
sosreport-3.5/sos/plugins/system.py 0000644 0001750 0001750 00000002371 13203300002 017420 0 ustar caribou caribou # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
class System(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
"""core system information
"""
plugin_name = "system"
profiles = ('system', 'kernel')
verify_packages = ('glibc', 'initscripts', 'zlib')
def setup(self):
self.add_copy_spec("/proc/sys")
self.add_forbidden_path(
"/proc/sys/net/ipv6/neigh/*/retrans_time")
self.add_forbidden_path(
"/proc/sys/net/ipv6/neigh/*/base_reachable_time")
# vim: set et ts=4 sw=4 :
sosreport-3.5/sos/plugins/smartcard.py 0000644 0001750 0001750 00000002606 13203300002 020055 0 ustar caribou caribou # Copyright (C) 2007 Sadique Puthen
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, RedHatPlugin
class Smartcard(Plugin, RedHatPlugin):
"""PKCS#11 smart cards
"""
plugin_name = 'smartcard'
profiles = ('security', 'identity', 'hardware')
files = ('/etc/pam_pkcs11/pam_pkcs11.conf',)
packages = ('pam_pkcs11',)
def setup(self):
self.add_copy_spec([
"/etc/reader.conf",
"/etc/reader.conf.d/",
"/etc/pam_pkcs11/"])
self.add_cmd_output([
"pklogin_finder debug",
"ls -nl /usr/lib*/pam_pkcs11/"
])
self.add_forbidden_path("/etc/pam_pkcs11/nssdb/key[3-4].db")
# vim: set et ts=4 sw=4 :
sosreport-3.5/sos/plugins/powerpc.py 0000644 0001750 0001750 00000005733 13203300002 017560 0 ustar caribou caribou # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
# This plugin enables collection of logs for Power systems and more
# specific logs for Pseries, PowerNV platforms.
import os
from sos.plugins import Plugin, RedHatPlugin, UbuntuPlugin, DebianPlugin
class PowerPC(Plugin, RedHatPlugin, UbuntuPlugin, DebianPlugin):
"""IBM Power systems
"""
plugin_name = 'powerpc'
profiles = ('system', 'hardware')
def check_enabled(self):
return "ppc64" in self.policy().get_arch()
def setup(self):
try:
with open('/proc/cpuinfo', 'r') as fp:
contents = fp.read()
ispSeries = "pSeries" in contents
isPowerNV = "PowerNV" in contents
except:
ispSeries = False
isPowerNV = False
if ispSeries or isPowerNV:
self.add_copy_spec([
"/proc/device-tree/",
"/proc/loadavg",
"/proc/locks",
"/proc/misc",
"/proc/swaps",
"/proc/version",
"/dev/nvram",
"/var/lib/lsvpd/"
])
self.add_cmd_output([
"ppc64_cpu --smt",
"ppc64_cpu --cores-present",
"ppc64_cpu --cores-on",
"ppc64_cpu --run-mode",
"ppc64_cpu --frequency",
"ppc64_cpu --dscr",
"diag_encl -v"
])
if ispSeries:
self.add_copy_spec([
"/proc/ppc64/lparcfg",
"/proc/ppc64/eeh",
"/proc/ppc64/systemcfg",
"/var/log/platform"
])
self.add_cmd_output([
"servicelog --dump",
"servicelog_notify --list",
"usysattn",
"usysident",
"serv_config -l",
"bootlist -m both -r",
"lparstat -i"
])
if isPowerNV:
self.add_copy_spec([
"/proc/ppc64/eeh",
"/proc/ppc64/systemcfg",
"/proc/ppc64/topology_updates",
"/sys/firmware/opal/msglog",
"/var/log/opal-elog/"
])
if os.path.isdir("/var/log/dump"):
self.add_cmd_output("ls -l /var/log/dump")
# vim: set et ts=4 sw=4 :
sosreport-3.5/sos/plugins/services.py 0000644 0001750 0001750 00000003620 13203300002 017715 0 ustar caribou caribou # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
class Services(Plugin):
"""System services
"""
plugin_name = "services"
profiles = ('system', 'boot')
option_list = [("servicestatus", "get a status of all running services",
"slow", False)]
def setup(self):
self.add_copy_spec([
"/etc/inittab",
"/etc/rc.d"
])
if self.get_option('servicestatus'):
self.add_cmd_output("/sbin/service --status-all")
self.add_cmd_output([
"/sbin/runlevel",
"ls /var/lock/subsys"
])
class RedHatServices(Services, RedHatPlugin):
def setup(self):
super(RedHatServices, self).setup()
self.add_cmd_output("/sbin/chkconfig --list", root_symlink="chkconfig")
class DebianServices(Services, DebianPlugin, UbuntuPlugin):
def setup(self):
super(DebianServices, self).setup()
self.add_copy_spec("/etc/rc*.d")
self.add_cmd_output("/sbin/initctl show-config",
root_symlink="initctl")
if self.get_option('servicestatus'):
self.add_cmd_output("/sbin/initctl list")
# vim: set et ts=4 sw=4 :
sosreport-3.5/sos/plugins/ipvs.py 0000644 0001750 0001750 00000002203 13203300002 017047 0 ustar caribou caribou # Copyright (C) 2014 Red Hat, Inc. Bryn M. Reeves
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin
class Ipvs(Plugin, RedHatPlugin, DebianPlugin):
"""Linux IP virtual server
"""
plugin_name = 'ipvs'
profiles = ('cluster', 'network')
packages = ('ipvsadm',)
def setup(self):
self.add_cmd_output([
"ipvsadm -Ln",
"ipvsadm -Lc"
])
# vim: set et ts=4 sw=4 :
sosreport-3.5/sos/plugins/dnf.py 0000644 0001750 0001750 00000005361 13203300002 016645 0 ustar caribou caribou # Copyright (C) 2016 Red Hat, Inc., Sachin Patil
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, RedHatPlugin
class DNFPlugin(Plugin, RedHatPlugin):
"""dnf package manager"""
plugin_name = "dnf"
profiles = ('system', 'packagemanager', 'sysmgmt')
files = ('/etc/dnf/dnf.conf',)
packages = ('dnf',)
option_list = [
("history", "captures transaction history", "fast", False),
("history-info", "detailed transaction history", "slow", False),
]
def setup(self):
self.add_copy_spec([
"/etc/dnf/dnf.conf",
"/etc/dnf/plugins/*",
"/etc/dnf/protected.d/*",
])
self.limit = self.get_option("log_size")
if self.get_option("all_logs"):
self.add_copy_spec("/var/log/dnf.*", sizelimit=self.limit)
else:
self.add_copy_spec("/var/log/dnf.log", sizelimit=self.limit)
self.add_copy_spec("/var/log/dnf.librepo.log",
sizelimit=self.limit)
self.add_copy_spec("/var/log/dnf.rpm.log", sizelimit=self.limit)
self.add_cmd_output("dnf --version",
suggest_filename="dnf_version")
self.add_cmd_output("dnf list installed *dnf*",
suggest_filename="dnf_installed_plugins")
self.add_cmd_output("dnf list extras",
suggest_filename="dnf_extra_packages")
if self.get_option("history"):
self.add_cmd_output("dnf history")
if self.get_option("history-info"):
history = self.call_ext_prog("dnf history")
transactions = -1
if history['output']:
for line in history['output'].splitlines():
try:
transactions = int(line.split('|')[0].strip())
break
except ValueError:
pass
for tr_id in range(1, transactions+1):
self.add_cmd_output("dnf history info %d" % tr_id)
# vim: set et ts=4 sw=4 :
sosreport-3.5/sos/plugins/boom.py 0000755 0001750 0001750 00000002507 13203300002 017034 0 ustar caribou caribou # Copyright (C) 2017 Red Hat, Inc., Bryn M. Reeves
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
from sos.plugins import Plugin, RedHatPlugin
class Boom(Plugin, RedHatPlugin):
"""Configuration data for the boom boot manager.
"""
plugin_name = 'boom'
profiles = ('boot', 'system')
packages = ('python-boom', 'python2-boom', 'python3-boom')
def setup(self):
self.add_copy_spec([
"/boot/boom/profiles",
"/boot/loader/entries",
"/etc/default/boom",
"/etc/grub.d/42_boom"
])
self.add_cmd_output([
"boom list -VV",
"boom profile list -VV"
])
# vim: set et ts=4 sw=4 :
sosreport-3.5/sos/plugins/virsh.py 0000644 0001750 0001750 00000005426 13203300002 017233 0 ustar caribou caribou # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, RedHatPlugin, UbuntuPlugin, DebianPlugin
import glob
import os
class LibvirtClient(Plugin, RedHatPlugin, UbuntuPlugin, DebianPlugin):
"""client for libvirt virtualization API
"""
plugin_name = 'virsh'
profiles = ('system', 'virt')
packages = ('libvirt-client',)
def setup(self):
# virt-manager logs
if not self.get_option("all_logs"):
self.add_copy_spec("/root/.virt-manager/*", sizelimit=5)
else:
self.add_copy_spec("/root/.virt-manager/*")
cmd = 'virsh -r'
# get host information
subcmds = [
'list --all',
'domcapabilities',
'capabilities',
'nodeinfo',
'freecell',
'node-memory-tune',
'version'
]
for subcmd in subcmds:
self.add_cmd_output('%s %s' % (cmd, subcmd))
# get network, pool and nwfilter elements
for k in ['net', 'nwfilter', 'pool']:
self.add_cmd_output('%s %s-list' % (cmd, k))
k_list = self.get_command_output('%s %s-list' % (cmd, k))
if k_list and k_list['status'] == 0:
k_lines = k_list['output'].splitlines()
# the 'Name' column position changes between virsh cmds
pos = k_lines[0].split().index('Name')
for j in filter(lambda x: x, k_lines[2:]):
n = j.split()[pos]
self.add_cmd_output('%s %s-dumpxml %s' % (cmd, k, n))
# cycle through the VMs/domains list, ignore 2 header lines and latest
# empty line, and dumpxml domain name in 2nd column
domains_output = self.get_command_output('%s list --all' % cmd)
if domains_output and domains_output['status'] == 0:
domains_lines = domains_output['output'].splitlines()[2:]
for domain in filter(lambda x: x, domains_lines):
d = domain.split()[1]
for x in ['dumpxml', 'dominfo', 'domblklist']:
self.add_cmd_output('%s %s %s' % (cmd, x, d))
# vim: et ts=4 sw=4
sosreport-3.5/sos/plugins/scsi.py 0000644 0001750 0001750 00000002475 13203300002 017042 0 ustar caribou caribou # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, RedHatPlugin, UbuntuPlugin, DebianPlugin
class Scsi(Plugin, RedHatPlugin, UbuntuPlugin, DebianPlugin):
"""SCSI devices
"""
plugin_name = 'scsi'
profiles = ('storage', 'hardware')
def setup(self):
self.add_copy_spec([
"/proc/scsi",
"/etc/stinit.def",
"/sys/bus/scsi",
"/sys/class/scsi_host",
"/sys/class/scsi_disk",
"/sys/class/scsi_device",
"/sys/class/scsi_generic"
])
self.add_cmd_output([
"lsscsi",
"sg_map"
])
# vim: set et ts=4 sw=4 :
sosreport-3.5/sos/plugins/squid.py 0000644 0001750 0001750 00000003720 13203300002 017220 0 ustar caribou caribou # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
class Squid(Plugin):
"""Squid caching proxy
"""
plugin_name = 'squid'
profiles = ('webserver', 'services', 'sysmgmt')
class RedHatSquid(Squid, RedHatPlugin):
files = ('/etc/squid/squid.conf',)
packages = ('squid',)
def setup(self):
log_size = self.get_option('log_size')
log_path = "/var/log/squid/"
self.add_copy_spec("/etc/squid/squid.conf")
self.add_copy_spec(log_path + "access.log", sizelimit=log_size)
self.add_copy_spec(log_path + "cache.log", sizelimit=log_size)
self.add_copy_spec(log_path + "squid.out", sizelimit=log_size)
class DebianSquid(Squid, DebianPlugin, UbuntuPlugin):
plugin_name = 'squid'
files = ('/etc/squid3/squid.conf',)
packages = ('squid3',)
def setup(self):
self.add_copy_spec("/etc/squid3/squid.conf",
sizelimit=self.get_option('log_size'))
self.add_copy_spec("/var/log/squid3/*",
sizelimit=self.get_option('log_size'))
self.add_copy_spec(['/etc/squid-deb-proxy'])
self.add_copy_spec("/var/log/squid-deb-proxy/*",
sizelimit=self.get_option('log_size'))
# vim: set et ts=4 sw=4 :
sosreport-3.5/sos/plugins/quagga.py 0000644 0001750 0001750 00000002114 13203300002 017334 0 ustar caribou caribou # Copyright (C) 2007 Ranjith Rajaram
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, RedHatPlugin
class Quagga(Plugin, RedHatPlugin):
"""Quagga routing service
"""
plugin_name = 'quagga'
profiles = ('network',)
files = ('/etc/quagga/zebra.conf',)
packages = ('quagga',)
def setup(self):
self.add_copy_spec("/etc/quagga/")
# vim: set et ts=4 sw=4 :
sosreport-3.5/sos/plugins/Makefile 0000644 0001750 0001750 00000001104 13073155336 017202 0 ustar caribou caribou PYTHON=python
PACKAGE = $(shell basename `pwd`)
PYFILES = $(wildcard *.py)
PYVER := $(shell $(PYTHON) -c 'import sys; print("%.3s" %(sys.version))')
PYSYSDIR := $(shell $(PYTHON) -c 'import sys; print(sys.prefix)')
PYLIBDIR = $(PYSYSDIR)/lib/python$(PYVER)
PKGDIR = $(PYLIBDIR)/site-packages/sos/$(PACKAGE)
all:
echo "nada"
clean:
rm -f *.pyc *.pyo *~
install:
mkdir -p $(DESTDIR)/$(PKGDIR)
for p in $(PYFILES) ; do \
install -m 644 $$p $(DESTDIR)/$(PKGDIR)/$$p; \
done
$(PYTHON) -c "import compileall; compileall.compile_dir('$(DESTDIR)/$(PKGDIR)', 1, '$(PYDIR)', 1)"
sosreport-3.5/sos/plugins/kvm.py 0000644 0001750 0001750 00000004075 13203300002 016674 0 ustar caribou caribou # Copyright (C) 2009 Red Hat, Inc., Joey Boggs
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
import os
class Kvm(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
"""Kernel virtual machine
"""
plugin_name = 'kvm'
profiles = ('system', 'virt')
debugfs_path = "/sys/kernel/debug"
_debugfs_cleanup = False
def check_enabled(self):
return os.access("/sys/module/kvm", os.R_OK)
def setup(self):
self.add_copy_spec([
"/sys/module/kvm/srcversion",
"/sys/module/kvm_intel/srcversion",
"/sys/module/kvm_amd/srcversion",
"/sys/module/ksm/srcversion"
])
if not os.path.ismount(self.debugfs_path):
self._debugfs_cleanup = True
r = self.call_ext_prog("mount -t debugfs debugfs %s"
% self.debugfs_path)
if r['status'] != 0:
self._log_error("debugfs not mounted and mount attempt failed")
self._debugfs_cleanup = False
return
self.add_cmd_output("kvm_stat --once")
def postproc(self):
if self._debugfs_cleanup and os.path.ismount(self.debugfs_path):
self.call_ext_prog("umount %s" % self.debugfs_path)
self._log_error("could not unmount %s" % self.debugfs_path)
# vim: set et ts=4 sw=4 :
sosreport-3.5/sos/plugins/opencl.py 0000644 0001750 0001750 00000002073 13203300002 017353 0 ustar caribou caribou # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
class OpenCL(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
"""OpenCL
"""
plugin_name = 'opencl'
profiles = ('hardware', 'desktop', 'gpu')
files = ('/usr/bin/clinfo',)
def setup(self):
self.add_cmd_output([
"clinfo",
])
# vim: set et ts=4 sw=4 :
sosreport-3.5/sos/plugins/openstack_glance.py 0000644 0001750 0001750 00000010056 13203300002 021373 0 ustar caribou caribou # Copyright (C) 2013 Red Hat, Inc., Flavio Percoco
# Copyright (C) 2012 Rackspace US, Inc.,
# Justin Shepherd
# Copyright (C) 2009 Red Hat, Inc., Joey Boggs
# Copyright (C) 2017 Red Hat, Inc., Martin Schuppert
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
import os
class OpenStackGlance(Plugin):
"""OpenStack Glance"""
plugin_name = "openstack_glance"
profiles = ('openstack', 'openstack_controller')
option_list = []
var_puppet_gen = "/var/lib/config-data/puppet-generated/glance_api"
def setup(self):
self.limit = self.get_option("log_size")
if self.get_option("all_logs"):
self.add_copy_spec([
"/var/log/glance/",
"/var/log/containers/glance/",
"/var/log/containers/httpd/glance-api/"
], sizelimit=self.limit)
else:
self.add_copy_spec([
"/var/log/glance/*.log",
"/var/log/containers/glance/*.log",
"/var/log/containers/httpd/glance-api/*log"
], sizelimit=self.limit)
self.add_copy_spec([
"/etc/glance/",
self.var_puppet_gen + "/etc/glance/",
self.var_puppet_gen + "/etc/my.cnf.d/tripleo.cnf"
])
if self.get_option("verify"):
self.add_cmd_output("rpm -V %s" % ' '.join(self.packages))
vars_all = [p in os.environ for p in [
'OS_USERNAME', 'OS_PASSWORD']]
vars_any = [p in os.environ for p in [
'OS_TENANT_NAME', 'OS_PROJECT_NAME']]
# collect commands output only if the openstack-glance-api service
# is running
service_status = self.get_command_output(
"systemctl status openstack-glance-api.service"
)
if service_status['status'] == 0:
self.add_cmd_output(
"glance-manage db_version",
suggest_filename="glance_db_version"
)
if not (all(vars_all) and any(vars_any)):
self.soslog.warning("Not all environment variables set. "
"Source the environment file for the user "
"intended to connect to the OpenStack "
"environment.")
else:
self.add_cmd_output("openstack image list --long")
def postproc(self):
protect_keys = [
"admin_password", "password", "qpid_password", "rabbit_password",
"s3_store_secret_key", "ssl_key_password", "connection",
"vmware_server_password"
]
regexp = r"((?m)^\s*(%s)\s*=\s*)(.*)" % "|".join(protect_keys)
self.do_path_regex_sub("/etc/glance/*", regexp, r"\1*********")
self.do_path_regex_sub(
self.var_puppet_gen + "/etc/glance/*",
regexp, r"\1*********"
)
class DebianGlance(OpenStackGlance, DebianPlugin, UbuntuPlugin):
packages = (
'glance',
'glance-api',
'glance-client',
'glance-common',
'glance-registry',
'python-glance'
)
class RedHatGlance(OpenStackGlance, RedHatPlugin):
packages = (
'openstack-glance',
'python-glanceclient'
)
# vim: set et ts=4 sw=4 :
sosreport-3.5/sos/plugins/sanlock.py 0000644 0001750 0001750 00000002541 13203300002 017525 0 ustar caribou caribou # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, RedHatPlugin
class SANLock(Plugin):
"""SANlock daemon
"""
plugin_name = "sanlock"
profiles = ('cluster', 'virt')
packages = ["sanlock"]
def setup(self):
self.add_copy_spec("/var/log/sanlock.log*")
self.add_cmd_output([
"sanlock client status -D",
"sanlock client host_status -D",
"sanlock client log_dump"
])
return
class RedHatSANLock(SANLock, RedHatPlugin):
files = ["/etc/sysconfig/sanlock"]
def setup(self):
super(RedHatSANLock, self).setup()
self.add_copy_spec("/etc/sysconfig/sanlock")
# vim: set et ts=4 sw=4 :
sosreport-3.5/sos/plugins/apport.py 0000644 0001750 0001750 00000003340 13203300002 017376 0 ustar caribou caribou # Copyright (c) 2012 Adam Stokes
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, DebianPlugin, UbuntuPlugin
class Apport(Plugin, DebianPlugin, UbuntuPlugin):
"""Apport crash reporting tool
"""
plugin_name = 'apport'
profiles = ('debug',)
def setup(self):
if not self.get_option("all_logs"):
limit = self.get_option("log_size")
self.add_copy_spec("/var/log/apport.log", sizelimit=limit)
self.add_copy_spec("/var/log/apport.log.1", sizelimit=limit)
else:
self.add_copy_spec("/var/log/apport*")
self.add_copy_spec("/etc/apport/*")
self.add_copy_spec("/var/lib/whoopsie/whoopsie-id")
self.add_cmd_output(
"gdbus call -y -d com.ubuntu.WhoopsiePreferences \
-o /com/ubuntu/WhoopsiePreferences \
-m com.ubuntu.WhoopsiePreferences.GetIdentifier")
self.add_cmd_output("ls -alh /var/crash/")
self.add_cmd_output("bash -c 'grep -B 50 -m 1 ProcMaps /var/crash/*'")
# vim: set et ts=4 sw=4 :
sosreport-3.5/sos/plugins/openstack_heat.py 0000644 0001750 0001750 00000012033 13203300002 021060 0 ustar caribou caribou # Copyright (C) 2013 Red Hat, Inc.
# Copyright (C) 2017 Red Hat, Inc., Martin Schuppert
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
import os
class OpenStackHeat(Plugin):
"""OpenStack Heat
"""
plugin_name = "openstack_heat"
profiles = ('openstack', 'openstack_controller')
option_list = []
var_puppet_gen = "/var/lib/config-data/puppet-generated/heat"
def setup(self):
# collect commands output only if the openstack-heat-api service
# is running
service_status = self.get_command_output("systemctl status "
"openstack-heat-api.service")
if service_status['status'] == 0:
self.add_cmd_output(
"heat-manage db_version",
suggest_filename="heat_db_version"
)
vars_all = [p in os.environ for p in [
'OS_USERNAME', 'OS_PASSWORD']]
vars_any = [p in os.environ for p in [
'OS_TENANT_NAME', 'OS_PROJECT_NAME']]
if not (all(vars_all) and any(vars_any)):
self.soslog.warning("Not all environment variables set. "
"Source the environment file for the user "
"intended to connect to the OpenStack "
"environment.")
else:
self.add_cmd_output("openstack stack list")
self.limit = self.get_option("log_size")
if self.get_option("all_logs"):
self.add_copy_spec([
"/var/log/heat/",
"/var/log/containers/heat/",
"/var/log/containers/httpd/heat-api/",
"/var/log/containers/httpd/heat-api-cfn"
], sizelimit=self.limit)
else:
self.add_copy_spec([
"/var/log/heat/*.log",
"/var/log/containers/heat/*.log",
"/var/log/containers/httpd/heat-api/*log",
"/var/log/containers/httpd/heat-api-cfn/*log"
], sizelimit=self.limit)
self.add_copy_spec([
"/etc/heat/",
self.var_puppet_gen + "/etc/heat/",
self.var_puppet_gen + "/etc/my.cnf.d/tripleo.cnf",
self.var_puppet_gen + "_api/etc/heat/",
self.var_puppet_gen + "_api/etc/httpd/conf/",
self.var_puppet_gen + "_api/etc/httpd/conf.d/",
self.var_puppet_gen + "_api/etc/httpd/conf.modules.d/*.conf",
self.var_puppet_gen + "_api/var/spool/cron/heat",
self.var_puppet_gen + "_api_cfn/etc/heat/",
self.var_puppet_gen + "_api_cfn/etc/httpd/conf/",
self.var_puppet_gen + "_api_cfn/etc/httpd/conf.d/",
self.var_puppet_gen + "_api_cfn/etc/httpd/conf.modules.d/*.conf",
self.var_puppet_gen + "_api_cfn/var/spool/cron/heat",
])
if self.get_option("verify"):
self.add_cmd_output("rpm -V %s" % ' '.join(self.packages))
def postproc(self):
protect_keys = [
"admin_password", "memcache_secret_key", "password", "connection",
"qpid_password", "rabbit_password", "stack_domain_admin_password",
]
regexp = r"((?m)^\s*(%s)\s*=\s*)(.*)" % "|".join(protect_keys)
self.do_path_regex_sub(
"/etc/heat/*",
regexp, r"\1*********")
self.do_path_regex_sub(
self.var_puppet_gen + "/etc/heat/*",
regexp, r"\1*********"
)
self.do_path_regex_sub(
self.var_puppet_gen + "_api/etc/heat/*",
regexp, r"\1*********"
)
self.do_path_regex_sub(
self.var_puppet_gen + "_api_cfn/etc/heat/*",
regexp, r"\1*********"
)
class DebianHeat(OpenStackHeat, DebianPlugin, UbuntuPlugin):
packages = (
'heat-api',
'heat-api-cfn',
'heat-api-cloudwatch',
'heat-common',
'heat-engine',
'python-heat',
'python-heatclient'
)
class RedHatHeat(OpenStackHeat, RedHatPlugin):
packages = (
'openstack-heat-api',
'openstack-heat-api-cfn',
'openstack-heat-api-cloudwatch',
'openstack-heat-cli',
'openstack-heat-common',
'openstack-heat-engine',
'python-heatclient'
)
# vim: set et ts=4 sw=4 :
sosreport-3.5/sos/plugins/qpid.py 0000644 0001750 0001750 00000007241 13203300002 017032 0 ustar caribou caribou # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, RedHatPlugin
class Qpid(Plugin, RedHatPlugin):
"""Qpid messaging
"""
plugin_name = 'qpid'
profiles = ('services',)
packages = ('qpidd', 'qpid-cpp-server', 'qpid-tools')
option_list = [("port", "listening port to connect to", '', ""),
("ssl-certificate",
"Path to file containing client SSL certificate", '', ""),
("ssl-key",
"Path to file containing client SSL private key", '', ""),
("ssl", "enforce SSL / amqps connection", '', False)]
def setup(self):
""" performs data collection for qpid broker """
options = ""
amqps_prefix = "" # set amqps:// when SSL is used
if self.get_option("ssl"):
amqps_prefix = "amqps://"
# for either present option, add --option=value to 'options' variable
for option in ["ssl-certificate", "ssl-key"]:
if self.get_option(option):
amqps_prefix = "amqps://"
options = (options + " --%s=" % (option) +
self.get_option(option))
if self.get_option("port"):
options = (options + " -b " + amqps_prefix +
"localhost:%s" % (self.get_option("port")))
self.add_cmd_output([
"qpid-stat -g" + options, # applies since 0.18 version
"qpid-stat -b" + options, # applies to pre-0.18 versions
"qpid-stat -c" + options,
"qpid-stat -e" + options,
"qpid-stat -q" + options,
"qpid-stat -u" + options,
"qpid-stat -m" + options, # applies since 0.18 version
"qpid-config exchanges" + options,
"qpid-config queues" + options,
"qpid-config exchanges -b" + options, # applies to pre-0.18 vers.
"qpid-config queues -b" + options, # applies to pre-0.18 versions
"qpid-config exchanges -r" + options, # applies since 0.18 version
"qpid-config queues -r" + options, # applies since 0.18 version
"qpid-route link list" + options,
"qpid-route route list" + options,
"qpid-cluster" + options, # applies to pre-0.22 versions
"qpid-ha query" + options, # applies since 0.22 version
"ls -lanR /var/lib/qpidd"
])
self.add_copy_spec([
"/etc/qpidd.conf", # applies to pre-0.22 versions
"/etc/qpid/qpidd.conf", # applies since 0.22 version
"/var/lib/qpid/syslog",
"/etc/ais/openais.conf",
"/var/log/cumin.log",
"/var/log/mint.log",
"/etc/sasl2/qpidd.conf",
"/etc/qpid/qpidc.conf",
"/etc/sesame/sesame.conf",
"/etc/cumin/cumin.conf",
"/etc/corosync/corosync.conf",
"/var/lib/sesame",
"/var/log/qpidd.log",
"/var/log/sesame",
"/var/log/cumin"
])
# vim: set et ts=4 sw=4 :
sosreport-3.5/sos/plugins/upstart.py 0000644 0001750 0001750 00000003355 13203300002 017601 0 ustar caribou caribou # Copyright (C) 2012 Red Hat, Inc., Bryn M. Reeves
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
class Upstart(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
"""Upstart init system
"""
plugin_name = 'upstart'
profiles = ('system', 'services', 'boot')
packages = ('upstart',)
def setup(self):
self.add_cmd_output([
'initctl --system list',
'initctl --system version',
'init --version',
"ls -l /etc/init/"
])
# Job Configuration Files
self.add_copy_spec([
'/etc/init.conf',
'/etc/event.d/*',
'/etc/init/*.conf'
])
# State file
self.add_copy_spec('/var/log/upstart/upstart.state')
# Log files
self.add_copy_spec('/var/log/upstart/*',
sizelimit=self.get_option('log_size'))
# Session Jobs (running Upstart as a Session Init)
self.add_copy_spec('/usr/share/upstart/')
# vim: set et ts=4 sw=4 :
sosreport-3.5/sos/plugins/subscription_manager.py 0000644 0001750 0001750 00000003156 13203300002 022314 0 ustar caribou caribou # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, RedHatPlugin
class SubscriptionManager(Plugin, RedHatPlugin):
"""subscription-manager information
"""
plugin_name = 'subscription_manager'
profiles = ('system', 'packagemanager', 'sysmgmt')
files = ('/etc/rhsm/rhsm.conf',)
packages = ('subscription-manager',)
def setup(self):
# rhsm config and logs
self.add_copy_spec([
"/etc/rhsm/",
"/var/lib/rhsm/",
"/var/log/rhsm/rhsm.log",
"/var/log/rhsm/rhsmcertd.log"])
self.add_cmd_output([
"subscription-manager list --installed",
"subscription-manager list --consumed",
"subscription-manager identity"
])
self.add_cmd_output("rhsm-debug system --sos --no-archive "
"--no-subscriptions --destination %s"
% self.get_cmd_output_path())
# vim: et ts=4 sw=4
sosreport-3.5/sos/plugins/mpt.py 0000644 0001750 0001750 00000002144 13203300002 016672 0 ustar caribou caribou # Copyright (C) 2015 Red Hat, Inc., Bryn M. Reeves
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
class Mpt(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
""" LSI Message Passing Technology
"""
files = ('/proc/mpt',)
profiles = ('storage', )
plugin_name = 'mpt'
def setup(self):
self.add_copy_spec("/proc/mpt")
# vim: set et ts=4 sw=4 :
sosreport-3.5/sos/plugins/openstack_instack.py 0000644 0001750 0001750 00000014320 13203300002 021574 0 ustar caribou caribou # Copyright (C) 2015 Red Hat, Inc., Lee Yarwood
# Copyright (C) 2017 Red Hat, Inc., Martin Schuppert
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, RedHatPlugin
import os
class OpenStackInstack(Plugin):
"""OpenStack Instack
"""
plugin_name = "openstack_instack"
profiles = ('openstack', 'openstack_undercloud')
def setup(self):
self.add_copy_spec("/home/stack/.instack/install-undercloud.log")
self.add_copy_spec("/home/stack/instackenv.json")
self.add_copy_spec("/home/stack/undercloud.conf")
if self.get_option("verify"):
self.add_cmd_output("rpm -V %s" % ' '.join(self.packages))
self.limit = self.get_option("log_size")
if self.get_option("all_logs"):
self.add_copy_spec(["/var/log/mistral/",
"/var/log/containers/mistral/"],
sizelimit=self.limit)
self.add_copy_spec(["/var/log/zaqar/",
"/var/log/containers/zaqar/"],
sizelimit=self.limit)
else:
self.add_copy_spec(["/var/log/mistral/*.log",
"/var/log/containers/mistral/*.log"],
sizelimit=self.limit)
self.add_copy_spec(["/var/log/zaqar/*.log",
"/var/log/containers/zaqar/*.log"],
sizelimit=self.limit)
vars_all = [p in os.environ for p in [
'OS_USERNAME', 'OS_PASSWORD']]
vars_any = [p in os.environ for p in [
'OS_TENANT_NAME', 'OS_PROJECT_NAME']]
if not (all(vars_all) and any(vars_any)):
self.soslog.warning("Not all environment variables set. Source "
"the environment file for the user intended "
"to connect to the OpenStack environment.")
else:
# get status of overcloud stack and resources
self.add_cmd_output("openstack stack show overcloud")
self.add_cmd_output(
"openstack stack resource list -n 10 overcloud",
timeout=600)
# get details on failed deployments
cmd = "openstack stack resource list -f value -n 5 overcloud"
deployments = self.call_ext_prog(cmd, timeout=600)['output']
for deployment in deployments.splitlines():
if 'FAILED' in deployment:
check = [
"OS::Heat::StructuredDeployment",
"OS::Heat::SoftwareDeployment"]
if any(x in deployment for x in check):
deployment = deployment.split()[1]
cmd = "openstack software deployment show " \
"--long %s" % (deployment)
self.add_cmd_output(
cmd,
suggest_filename="failed-deployment-" +
deployment + ".log",
timeout=600)
self.add_cmd_output("openstack object save "
"tripleo-ui-logs tripleo-ui.logs --file -")
def postproc(self):
protected_keys = [
"UNDERCLOUD_TUSKAR_PASSWORD", "UNDERCLOUD_ADMIN_PASSWORD",
"UNDERCLOUD_CEILOMETER_METERING_SECRET",
"UNDERCLOUD_CEILOMETER_PASSWORD",
"UNDERCLOUD_CEILOMETER_SNMPD_PASSWORD",
"UNDERCLOUD_DB_PASSWORD", "UNDERCLOUD_GLANCE_PASSWORD",
"UNDERCLOUD_HEAT_PASSWORD",
"UNDERCLOUD_HEAT_STACK_DOMAIN_ADMIN_PASSWORD",
"UNDERCLOUD_HORIZON_SECRET_KEY", "UNDERCLOUD_IRONIC_PASSWORD",
"UNDERCLOUD_NEUTRON_PASSWORD", "UNDERCLOUD_NOVA_PASSWORD",
"UNDERCLOUD_RABBIT_PASSWORD", "UNDERCLOUD_SWIFT_PASSWORD",
"UNDERCLOUD_TUSKAR_PASSWORD", "OS_PASSWORD",
"undercloud_db_password", "undercloud_admin_password",
"undercloud_glance_password", "undercloud_heat_password",
"undercloud_neutron_password", "undercloud_nova_password",
"undercloud_ironic_password", "undercloud_tuskar_password",
"undercloud_ceilometer_password",
"undercloud_ceilometer_metering_secret",
"undercloud_ceilometer_snmpd_password",
"undercloud_swift_password", "undercloud_rabbit_password",
"undercloud_heat_stack_domain_admin_password"
]
regexp = r"((?m)(%s)=)(.*)" % "|".join(protected_keys)
self.do_file_sub("/home/stack/.instack/install-undercloud.log",
regexp, r"\1*********")
self.do_file_sub("/home/stack/undercloud.conf", regexp, r"\1*********")
protected_json_keys = ["pm_password", "ssh-key", "password"]
json_regexp = r'((?m)"(%s)": )(".*?")' % "|".join(protected_json_keys)
self.do_file_sub("/home/stack/instackenv.json", json_regexp,
r"\1*********")
class RedHatRDOManager(OpenStackInstack, RedHatPlugin):
packages = [
'instack',
'instack-undercloud',
'openstack-tripleo',
'openstack-tripleo-common',
'openstack-tripleo-heat-templates',
'openstack-tripleo-image-elements',
'openstack-tripleo-puppet-elements',
'openstack-tripleo-ui',
'openstack-tripleo-validations',
'puppet-tripleo',
'python-tripleoclient'
]
def setup(self):
super(RedHatRDOManager, self).setup()
# vim: set et ts=4 sw=4 :
sosreport-3.5/sos/plugins/targetcli.py 0000644 0001750 0001750 00000002574 13203300002 020057 0 ustar caribou caribou # Copyright (C) 2015 Red Hat, Inc., Bryn M. Reeves
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
class TargetCli(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
"""TargetCLI TCM/LIO configuration
"""
packages = ('targetcli', 'python-rtslib')
profiles = ('storage', )
plugin_name = 'targetcli'
def setup(self):
self.add_cmd_output([
"targetcli ls",
"targetcli status",
"systemctl status target.service"
])
self.add_journal(units="targetcli")
self.add_copy_spec("/sys/kernel/config/target")
self.add_copy_spec("/etc/target")
# vim: set et ts=4 sw=4 :
sosreport-3.5/sos/plugins/oddjob.py 0000644 0001750 0001750 00000002300 13203300002 017325 0 ustar caribou caribou # Copyright (C) 2007 Sadique Puthen
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, RedHatPlugin
class Oddjob(Plugin, RedHatPlugin):
"""OddJob task scheduler
"""
plugin_name = 'oddjob'
profiles = ('services', 'sysmgmt')
files = ('/etc/oddjobd.conf',)
packages = ('oddjob',)
def setup(self):
self.add_copy_spec([
"/etc/oddjobd.conf",
"/etc/oddjobd.conf.d",
"/etc/dbus-1/system.d/oddjob.conf"
])
# vim: set et ts=4 sw=4 :
sosreport-3.5/sos/plugins/ds.py 0000644 0001750 0001750 00000005652 13203300002 016507 0 ustar caribou caribou # Copyright (C) 2007 Red Hat, Inc., Kent Lamb
# Copyright (C) 2014 Red Hat, Inc., Bryn M. Reeves
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, RedHatPlugin
import os
class DirectoryServer(Plugin, RedHatPlugin):
"""Directory Server
"""
plugin_name = 'ds'
profiles = ('identity',)
files = ('/etc/dirsrv', '/opt/redhat-ds')
packages = ('redhat-ds-base', 'redhat-ds-7')
def check_version(self):
if self.is_installed("redhat-ds-base") or \
os.path.exists("/etc/dirsrv"):
return "ds8"
elif self.is_installed("redhat-ds-7") or \
os.path.exists("/opt/redhat-ds"):
return "ds7"
return False
def setup(self):
self.add_forbidden_path("/etc/dirsrv/slapd*/pin.txt")
self.add_forbidden_path("/etc/dirsrv/slapd*/key3.db")
self.add_forbidden_path("/etc/dirsrv/slapd*/pwfile.txt")
self.add_forbidden_path("/etc/dirsrv/slapd*/*passw*")
self.add_forbidden_path("/etc/dirsrv/admin-serv/key[3-4].db")
self.add_forbidden_path("/etc/dirsrv/admin-serv/admpw")
self.add_forbidden_path("/etc/dirsrv/admin-serv/password.conf")
try:
for d in os.listdir("/etc/dirsrv"):
if d[0:5] == 'slapd':
certpath = os.path.join("/etc/dirsrv", d)
self.add_cmd_output("certutil -L -d %s" % certpath)
except:
self._log_warn("could not list /etc/dirsrv")
if not self.check_version():
self.add_alert("Directory Server not found.")
elif "ds8" in self.check_version():
self.add_copy_spec([
"/etc/dirsrv/slapd*/cert8.db",
"/etc/dirsrv/slapd*/certmap.conf",
"/etc/dirsrv/slapd*/dse.ldif",
"/etc/dirsrv/slapd*/dse.ldif.startOK",
"/etc/dirsrv/slapd*/secmod.db",
"/etc/dirsrv/slapd*/schema/*.ldif",
"/etc/dirsrv/admin-serv",
"/var/log/dirsrv/*"
])
elif "ds7" in self.check_version():
self.add_copy_spec([
"/opt/redhat-ds/slapd-*/config",
"/opt/redhat-ds/slapd-*/logs"
])
# vim: set et ts=4 sw=4 :
sosreport-3.5/sos/plugins/openswan.py 0000644 0001750 0001750 00000003217 13203300002 017726 0 ustar caribou caribou # Copyright (C) 2007 Sadique Puthen
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
class Openswan(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
"""Openswan IPsec
"""
plugin_name = 'openswan'
profiles = ('network', 'security')
option_list = [("ipsec-barf",
"collect the output of the ipsec barf command",
"slow", False)]
files = ('/etc/ipsec.conf',)
packages = ('openswan', 'libreswan')
def setup(self):
self.add_copy_spec([
"/etc/ipsec.conf",
"/etc/ipsec.d"
])
# although this is 'verification' it's normally a very quick
# operation so is not conditional on --verify
self.add_cmd_output("ipsec verify")
if self.get_option("ipsec-barf"):
self.add_cmd_output("ipsec barf")
self.add_forbidden_path("/etc/ipsec.d/key[3-4].db")
# vim: set et ts=4 sw=4 :
sosreport-3.5/sos/plugins/kernel.py 0000644 0001750 0001750 00000006163 13203300002 017357 0 ustar caribou caribou # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
import os
import glob
class Kernel(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
"""Linux kernel
"""
plugin_name = 'kernel'
profiles = ('system', 'hardware', 'kernel')
verify_packages = ('kernel$',)
sys_module = '/sys/module'
def setup(self):
# compat
self.add_cmd_output("uname -a", root_symlink="uname")
self.add_cmd_output("lsmod", root_symlink="lsmod")
self.add_cmd_output("ls -lt /sys/kernel/slab")
try:
modules = os.listdir(self.sys_module)
self.add_cmd_output("modinfo " + " ".join(modules))
except OSError:
self._log_warn("could not list %s" % self.sys_module)
# find /lib/modules/*/{extras,updates,weak-updates} -ls
extra_mod_patterns = [
"/lib/modules/*/extra",
"/lib/modules/*/updates",
"/lib/modules/*/weak-updates",
]
extra_mod_paths = []
for pattern in extra_mod_patterns:
extra_mod_paths.extend(glob.glob(pattern))
self.add_cmd_output([
"dmesg",
"sysctl -a",
"dkms status",
"find %s -ls" % " ".join(extra_mod_paths)
])
clocksource_path = "/sys/devices/system/clocksource/clocksource0/"
self.add_copy_spec([
"/proc/modules",
"/proc/sys/kernel/random/boot_id",
"/sys/module/*/parameters",
"/sys/module/*/initstate",
"/sys/module/*/refcnt",
"/sys/module/*/taint",
"/sys/firmware/acpi/*",
"/proc/kallsyms",
"/proc/buddyinfo",
"/proc/slabinfo",
"/proc/zoneinfo",
"/lib/modules/%s/modules.dep" % self.policy().kernel_version(),
"/etc/conf.modules",
"/etc/modules.conf",
"/etc/modprobe.conf",
"/etc/modprobe.d",
"/etc/sysctl.conf",
"/etc/sysctl.d",
"/lib/sysctl.d",
"/proc/cmdline",
"/proc/driver",
"/proc/sys/kernel/tainted",
"/proc/softirqs",
"/proc/timer*",
"/proc/lock*",
"/proc/misc",
"/var/log/dmesg",
"/sys/fs/pstore",
clocksource_path + "available_clocksource",
clocksource_path + "current_clocksource"
])
# vim: set et ts=4 sw=4 :
sosreport-3.5/sos/plugins/grafana.py 0000644 0001750 0001750 00000003666 13203300002 017503 0 ustar caribou caribou # Copyright (C) 2016 Red Hat, Inc., Pratik Bandarkar
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, RedHatPlugin
class Grafana(Plugin, RedHatPlugin):
"""Fetch Grafana configuration, logs and CLI output
"""
plugin_name = "grafana"
profiles = ('services', 'openstack', 'openstack_controller')
packages = ('graphana',)
def setup(self):
if self.get_option("all_logs"):
self.add_copy_spec("/var/log/grafana/*.log",
sizelimit=self.get_option("log_size"))
else:
self.add_copy_spec("/var/log/grafana/*.log",
sizelimit=self.get_option("log_size"))
self.add_cmd_output([
"grafana-cli plugins ls",
"grafana-cli plugins list-remote",
"grafana-cli -v",
"grafana-server -v",
])
self.add_copy_spec([
"/etc/grafana/",
"/etc/sysconfig/grafana-server",
])
def postproc(self):
protect_keys = [
"admin_password", "secret_key"
]
regexp = r"((?m)^\s*(%s)\s*=\s*)(.*)" % "|".join(protect_keys)
self.do_path_regex_sub("/etc/grafana/grafana.ini",
regexp, r"\1*********")
sosreport-3.5/sos/plugins/ctdb.py 0000644 0001750 0001750 00000003244 13203300002 017010 0 ustar caribou caribou # Copyright (C) 2014 Red Hat, Inc., Bryn M. Reeves
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
class Ctdb(Plugin, DebianPlugin, UbuntuPlugin):
"""Samba Clustered TDB
"""
packages = ('ctdb',)
profiles = ('cluster', 'storage')
plugin_name = "ctdb"
def setup(self):
self.add_copy_spec([
"/etc/ctdb/nodes",
"/etc/ctdb/public_addresses",
"/etc/ctdb/static-routes",
"/etc/ctdb/multipathd",
"/var/log/log.ctdb"
])
self.add_cmd_output([
"ctdb ip",
"ctdb ping",
"ctdb status",
"ctdb ifaces",
"ctdb listnodes",
"ctdb listvars",
"ctdb statistics",
"ctdb getdbmap"
])
class RedHatCtdb(Ctdb, RedHatPlugin):
def setup(self):
super(RedHatCtdb, self).setup()
self.add_copy_spec("/etc/sysconfig/ctdb")
# vim: set et ts=4 sw=4 :
sosreport-3.5/sos/plugins/dlm.py 0000644 0001750 0001750 00000005340 13203300002 016647 0 ustar caribou caribou # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
import os.path
import re
class Dlm(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
"""DLM (Distributed lock manager)"""
plugin_name = "dlm"
profiles = ("cluster", )
packages = ["cman", "dlm", "pacemaker"]
option_list = [
("lockdump", "capture lock dumps for DLM", "slow", False),
]
debugfs_path = "/sys/kernel/debug"
_debugfs_cleanup = False
def setup(self):
self.add_copy_spec([
"/etc/sysconfig/dlm"
])
self.add_cmd_output([
"dlm_tool log_plock",
"dlm_tool dump",
"dlm_tool ls -n"
])
if self.get_option("lockdump"):
self.do_lockdump()
def do_lockdump(self):
if self._mount_debug():
dlm_tool = "dlm_tool ls"
result = self.call_ext_prog(dlm_tool)
if result["status"] != 0:
return
lock_exp = r'^name\s+([^\s]+)$'
lock_re = re.compile(lock_exp, re.MULTILINE)
for lockspace in lock_re.findall(result["output"]):
self.add_cmd_output(
"dlm_tool lockdebug -svw '%s'" % lockspace,
suggest_filename="dlm_locks_%s" % lockspace
)
def _mount_debug(self):
if not os.path.ismount(self.debugfs_path):
self._debugfs_cleanup = True
r = self.call_ext_prog("mount -t debugfs debugfs %s"
% self.debugfs_path)
if r["status"] != 0:
self._log_error("debugfs not mounted and mount attempt failed")
self._debugfs_cleanup = False
return os.path.ismount(self.debugfs_path)
def postproc(self):
if self._debugfs_cleanup and os.path.ismount(self.debugfs_path):
r = self.call_ext_prog("umount %s" % self.debugfs_path)
if r["status"] != 0:
self._log_error("could not unmount %s" % self.debugfs_path)
return
# vim: et ts=4 sw=4
sosreport-3.5/sos/plugins/landscape.py 0000644 0001750 0001750 00000006017 13203300002 020027 0 ustar caribou caribou # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, UbuntuPlugin
class Landscape(Plugin, UbuntuPlugin):
"""Ubuntu Landscape client
"""
plugin_name = 'landscape'
profiles = ('sysmgmt',)
files = ('/etc/landscape/client.conf', '/etc/landscape/service.conf')
packages = ('landscape-client', 'landscape-server')
def setup(self):
self.add_copy_spec("/etc/landscape/client.conf")
self.add_copy_spec("/etc/default/landscape-client")
self.add_copy_spec("/etc/landscape/service.conf")
self.add_copy_spec("/etc/landscape/service.conf.old")
self.add_copy_spec("/etc/default/landscape-server")
if not self.get_option("all_logs"):
limit = self.get_option("log_size")
self.add_copy_spec("/var/log/landscape/*.log", sizelimit=limit)
self.add_copy_spec("/var/log/landscape-server/*.log",
sizelimit=limit)
else:
self.add_copy_spec("/var/log/landscape")
self.add_copy_spec("/var/log/landscape-server")
self.add_cmd_output("gpg --verify /etc/landscape/license.txt")
self.add_cmd_output("head -n 5 /etc/landscape/license.txt")
self.add_cmd_output("lsctl status")
def postproc(self):
self.do_file_sub(
"/etc/landscape/client.conf",
r"registration_password(.*)",
r"registration_password[********]"
)
self.do_file_sub(
"/etc/landscape/service.conf",
r"password = (.*)",
r"password = [********]"
)
self.do_file_sub(
"/etc/landscape/service.conf",
r"store_password = (.*)",
r"store_password = [********]"
)
self.do_file_sub(
"/etc/landscape/service.conf",
r"secret-token = (.*)",
r"secret-token = [********]"
)
self.do_file_sub(
"/etc/landscape/service.conf.old",
r"password = (.*)",
r"password = [********]"
)
self.do_file_sub(
"/etc/landscape/service.conf.old",
r"store_password = (.*)",
r"store_password = [********]"
)
self.do_file_sub(
"/etc/landscape/service.conf.old",
r"secret-token = (.*)",
r"secret-token = [********]"
)
# vim: set et ts=4 sw=4 :
sosreport-3.5/sos/plugins/nscd.py 0000644 0001750 0001750 00000002725 13203300002 017026 0 ustar caribou caribou # Copyright (C) 2007 Shijoe George
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
class Nscd(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
"""Name service caching daemon
"""
plugin_name = 'nscd'
profiles = ('services', 'identity', 'system')
files = ('/etc/nscd.conf',)
packages = ('nscd',)
def setup(self):
self.add_copy_spec("/etc/nscd.conf")
self.limit = (None if self.get_option("all_logs")
else self.get_option("log_size"))
opt = self.file_grep(r"^\s*logfile", "/etc/nscd.conf")
if (len(opt) > 0):
for o in opt:
f = o.split()
self.add_copy_spec(f[1], sizelimit=self.limit)
# vim: set et ts=4 sw=4 :
sosreport-3.5/sos/plugins/mrggrid.py 0000644 0001750 0001750 00000002005 13203300002 017521 0 ustar caribou caribou # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, RedHatPlugin
class MrgGrid(Plugin, RedHatPlugin):
"""MRG GRID engine
"""
plugin_name = 'mrggrid'
profiles = ('mrg',)
def setup(self):
self.add_copy_spec([
"/etc/condor/condor_config",
"condor_status"
])
# vim: set et ts=4 sw=4 :
sosreport-3.5/sos/plugins/ntp.py 0000644 0001750 0001750 00000003012 13203300002 016666 0 ustar caribou caribou # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
class Ntp(Plugin):
"""Network time protocol
"""
plugin_name = "ntp"
profiles = ('system', 'services')
packages = ('ntp',)
def setup(self):
self.add_copy_spec([
"/etc/ntp.conf",
"/etc/ntp/step-tickers",
"/etc/ntp/ntpservers"
])
self.add_cmd_output([
"ntptime",
"ntpq -p"
])
class RedHatNtp(Ntp, RedHatPlugin):
def setup(self):
super(RedHatNtp, self).setup()
self.add_copy_spec("/etc/sysconfig/ntpd")
self.add_cmd_output("ntpstat")
class DebianNtp(Ntp, DebianPlugin, UbuntuPlugin):
def setup(self):
super(DebianNtp, self).setup()
self.add_copy_spec('/etc/default/ntp')
# vim: set et ts=4 sw=4 :
sosreport-3.5/sos/plugins/navicli.py 0000644 0001750 0001750 00000007262 13203300002 017525 0 ustar caribou caribou # Copyright (C) 2008 EMC Corporation. Keith Kearnan
# Copyright (C) 2014 Red Hat, Inc., Bryn M. Reeves
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, RedHatPlugin, os
from sos.utilities import is_executable
# Just for completeness sake.
from six.moves import input
class Navicli(Plugin, RedHatPlugin):
""" EMC Navicli
"""
plugin_name = 'navicli'
profiles = ('storage', 'hardware')
def check_enabled(self):
return is_executable("navicli")
def get_navicli_config(self):
""" EMC Navisphere Host Agent NAVICLI specific information - files
"""
self.add_copy_spec([
"/etc/Navisphere/agent.config",
"/etc/Navisphere/Navimon.cfg",
"/etc/Navisphere/Quietmode.cfg",
"/etc/Navisphere/messages/[a-z]*",
"/etc/Navisphere/log/[a-z]*"
])
def get_navicli_SP_info(self, SP_address):
""" EMC Navisphere Host Agent NAVICLI specific
information - CLARiiON - commands
"""
self.add_cmd_output([
"navicli -h %s getall" % SP_address,
"navicli -h %s getsptime -spa" % SP_address,
"navicli -h %s getsptime -spb" % SP_address,
"navicli -h %s getlog" % SP_address,
"navicli -h %s getdisk" % SP_address,
"navicli -h %s getcache" % SP_address,
"navicli -h %s getlun" % SP_address,
"navicli -h %s getlun -rg -type -default -owner -crus "
"-capacity" % SP_address,
"navicli -h %s lunmapinfo" % SP_address,
"navicli -h %s getcrus" % SP_address,
"navicli -h %s port -list -all" % SP_address,
"navicli -h %s storagegroup -list" % SP_address,
"navicli -h %s spportspeed -get" % SP_address
])
def setup(self):
self.get_navicli_config()
CLARiiON_IP_address_list = []
CLARiiON_IP_loop = "stay_in"
while CLARiiON_IP_loop == "stay_in":
try:
ans = input("CLARiiON SP IP Address or [Enter] to exit: ")
except:
return
if self.check_ext_prog("navicli -h %s getsptime" % (ans,)):
CLARiiON_IP_address_list.append(ans)
else:
if ans != "":
print("The IP address you entered, %s, is not to an "
"active CLARiiON SP." % ans)
if ans == "":
CLARiiON_IP_loop = "get_out"
# Sort and dedup the list of CLARiiON IP Addresses
CLARiiON_IP_address_list.sort()
for SP_address in CLARiiON_IP_address_list:
if CLARiiON_IP_address_list.count(SP_address) > 1:
CLARiiON_IP_address_list.remove(SP_address)
for SP_address in CLARiiON_IP_address_list:
if SP_address != "":
print(" Gathering NAVICLI information for %s..." %
SP_address)
self.get_navicli_SP_info(SP_address)
# vim: set et ts=4 sw=4 :
sosreport-3.5/sos/plugins/procenv.py 0000644 0001750 0001750 00000002037 13203300002 017547 0 ustar caribou caribou # Copyright (c) 2012 Adam Stokes
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, DebianPlugin, UbuntuPlugin
class Procenv(Plugin, DebianPlugin, UbuntuPlugin):
"""Process environment
"""
plugin_name = 'procenv'
profiles = ('system',)
def setup(self):
self.add_cmd_output('procenv')
# vim: set et ts=4 sw=4 :
sosreport-3.5/sos/plugins/process.py 0000644 0001750 0001750 00000003222 13203300002 017546 0 ustar caribou caribou # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
class Process(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
"""process information
"""
plugin_name = 'process'
profiles = ('system',)
def setup(self):
ps_axo = "ps axo"
# process group and thread options
ps_group_opts = "pid,ppid,user,group,lwp,nlwp,start_time,comm,cgroup"
ps_sched_opts = "flags,state,uid,pid,ppid,pgid,sid,cls,pri,addr,sz,"
ps_sched_opts += "wchan,stime,tty,time,cmd"
self.add_copy_spec("/proc/sched_debug")
self.add_cmd_output("ps auxwww", root_symlink="ps")
self.add_cmd_output("pstree", root_symlink="pstree")
self.add_cmd_output("lsof -b +M -n -l", root_symlink="lsof")
self.add_cmd_output([
"ps auxwwwm",
"ps alxwww",
"%s %s" % (ps_axo, ps_group_opts),
"%s %s" % (ps_axo, ps_sched_opts)
])
# vim: set et ts=4 sw=4 :
sosreport-3.5/sos/plugins/libvirt.py 0000644 0001750 0001750 00000006123 13203300002 017546 0 ustar caribou caribou # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, RedHatPlugin, UbuntuPlugin, DebianPlugin
import glob
import os
class Libvirt(Plugin, RedHatPlugin, UbuntuPlugin, DebianPlugin):
"""libvirt virtualization API
"""
plugin_name = 'libvirt'
profiles = ('system', 'virt')
def setup(self):
libvirt_keytab = "/etc/libvirt/krb5.tab"
# authentication databases used for libvirt SASL authentication
self.add_forbidden_path("/etc/libvirt/passwd.db")
self.add_forbidden_path("/etc/libvirt/krb5.tab")
self.add_forbidden_path("/var/lib/libvirt/qemu/*/master-key.aes")
self.add_forbidden_path("/etc/libvirt/secrets")
self.add_copy_spec([
"/etc/libvirt/libvirt.conf",
"/etc/libvirt/libvirtd.conf",
"/etc/libvirt/lxc.conf",
"/etc/libvirt/nwfilter/*.xml",
"/etc/libvirt/qemu/*.xml",
"/var/run/libvirt/",
"/etc/libvirt/qemu/networks/*.xml",
"/etc/libvirt/qemu/networks/autostart/*.xml",
"/etc/libvirt/storage/*.xml",
"/etc/libvirt/storage/autostart/*.xml",
"/etc/libvirt/qemu-lockd.conf",
"/etc/libvirt/virtlockd.conf"
])
if not self.get_option("all_logs"):
self.add_copy_spec("/var/log/libvirt/libvirtd.log", sizelimit=5)
self.add_copy_spec("/var/log/libvirt/qemu/*.log", sizelimit=5)
self.add_copy_spec("/var/log/libvirt/lxc/*.log", sizelimit=5)
self.add_copy_spec("/var/log/libvirt/uml/*.log", sizelimit=5)
else:
self.add_copy_spec("/var/log/libvirt")
if os.path.exists(self.join_sysroot(libvirt_keytab)):
self.add_cmd_output("klist -ket %s" % libvirt_keytab)
self.add_cmd_output("ls -lR /var/lib/libvirt/qemu")
# get details of processes of KVM hosts
for pidfile in glob.glob("/var/run/libvirt/*/*.pid"):
pid = open(pidfile).read().splitlines()[0]
for pf in ["environ", "cgroup", "maps", "numa_maps", "limits"]:
self.add_copy_spec("/proc/%s/%s" % (pid, pf))
def postproc(self):
for loc in ["/etc/", "/var/run/"]:
for xmlfile in glob.glob(loc + "libvirt/qemu/*.xml"):
self.do_file_sub(
xmlfile,
r"(\s*passwd=\s*')([^']*)('.*)",
r"\1******\3"
)
# vim: set et ts=4 sw=4 :
sosreport-3.5/sos/plugins/numa.py 0000644 0001750 0001750 00000003416 13203300002 017035 0 ustar caribou caribou # Copyright (C) 2014 Red Hat, Inc. Bryn M. Reeves
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
import os.path
class Numa(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
"""NUMA state and configuration
"""
plugin_name = 'numa'
profiles = ('hardware', 'system', 'memory', 'performance')
packages = ('numad', 'numactl')
def setup(self):
self.add_copy_spec([
"/etc/numad.conf",
"/etc/logrotate.d/numad"
])
self.add_copy_spec(
"/var/log/numad.log*",
sizelimit=self.get_option("log_size")
)
self.add_cmd_output([
"numastat",
"numastat -m",
"numastat -n",
"numactl --show",
"numactl --hardware",
])
numa_path = "/sys/devices/system/node"
self.add_copy_spec([
os.path.join(numa_path, "node*/meminfo"),
os.path.join(numa_path, "node*/cpulist"),
os.path.join(numa_path, "node*/distance")
])
# vim: set et ts=4 sw=4 :
sosreport-3.5/sos/plugins/boot.py 0000644 0001750 0001750 00000003371 13203300002 017040 0 ustar caribou caribou # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
from glob import glob
class Boot(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
"""Bootloader information
"""
plugin_name = 'boot'
profiles = ('system', 'boot')
packages = ('grub', 'grub2', 'zipl')
option_list = [
("all-images", "collect lsinitrd for all images", "slow", False)
]
def setup(self):
self.add_copy_spec([
# legacy / special purpose bootloader configs
"/etc/milo.conf",
"/etc/silo.conf",
"/boot/efi/efi/redhat/elilo.conf",
"/etc/yaboot.conf",
"/boot/yaboot.conf"
])
self.add_cmd_output([
"ls -lanR /boot",
"lsinitrd"
])
self.add_cmd_output("efibootmgr")
if self.get_option("all-images"):
for image in glob('/boot/initr*.img'):
if image[-9:] == "kdump.img":
continue
self.add_cmd_output("lsinitrd %s" % image)
# vim: set et ts=4 sw=4 :
sosreport-3.5/sos/plugins/snmp.py 0000644 0001750 0001750 00000002533 13203300002 017051 0 ustar caribou caribou # Copyright (C) 2007 Sadique Puthen
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
class Snmp(Plugin):
"""Simple network management protocol
"""
plugin_name = "snmp"
profiles = ('system', 'sysmgmt')
files = ('/etc/snmp/snmpd.conf',)
def setup(self):
self.add_copy_spec("/etc/snmp")
class RedHatSnmp(Snmp, RedHatPlugin):
packages = ('net-snmp',)
def setup(self):
super(RedHatSnmp, self).setup()
class DebianSnmp(Snmp, DebianPlugin, UbuntuPlugin):
packages = ('snmp',)
def setup(self):
super(DebianSnmp, self).setup()
# vim: set et ts=4 sw=4 :
sosreport-3.5/sos/plugins/haproxy.py 0000644 0001750 0001750 00000004611 13203300044 017573 0 ustar caribou caribou # Copyright (C) 2014 Red Hat, Inc. Bryn M. Reeves
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin
from re import match
try:
from urllib.parse import urlparse
except ImportError:
from urlparse import urlparse
class HAProxy(Plugin, RedHatPlugin, DebianPlugin):
"""HAProxy load balancer
"""
plugin_name = 'haproxy'
profiles = ('webserver',)
packages = ('haproxy',)
def setup(self):
var_puppet_gen = "/var/lib/config-data/puppet-generated/haproxy"
self.add_copy_spec([
"/etc/haproxy/haproxy.cfg",
var_puppet_gen + "/etc/haproxy/haproxy.cfg"
])
self.add_copy_spec("/etc/haproxy/conf.d/*")
self.add_cmd_output("haproxy -f /etc/haproxy/haproxy.cfg -c")
self.add_copy_spec("/var/log/haproxy.log")
# collect haproxy overview - curl to IP address taken from haproxy.cfg
# as 2nd word on line below "haproxy.stats"
# so parse haproxy.cfg until "haproxy.stats" read, and take 2nd word
# from the next line
matched = None
provision_ip = None
for line in open("/etc/haproxy/haproxy.cfg").read().splitlines():
if matched:
provision_ip = line.split()[1]
break
matched = match(".*haproxy\.stats.*", line)
if not provision_ip:
return
# check if provision_ip contains port - if not, add default ":1993"
if urlparse("http://"+provision_ip).port is None:
provision_ip = provision_ip + ":1993"
self.add_cmd_output("curl http://"+provision_ip+"/\;csv",
suggest_filename="haproxy_overview.txt")
# vim: set et ts=4 sw=4 :
sosreport-3.5/sos/plugins/redis.py 0000644 0001750 0001750 00000005064 13203300002 017204 0 ustar caribou caribou # Copyright (C) 2015 Red Hat, Inc., Abhijeet Kasurde
# Copyright (C) 2017 Red Hat, Inc., Martin Schuppert
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, RedHatPlugin
class Redis(Plugin, RedHatPlugin):
"""Redis, in-memory data structure store
"""
plugin_name = 'redis'
profiles = ('services',)
packages = ('redis',)
var_puppet_gen = "/var/lib/config-data/puppet-generated/redis"
files = (
'/etc/redis.conf',
'/var/log/redis',
var_puppet_gen + '/etc/redis.conf'
)
def setup(self):
self.add_copy_spec([
"/etc/redis.conf",
self.var_puppet_gen + "/etc/redis*",
self.var_puppet_gen + "/etc/redis/",
self.var_puppet_gen + "/etc/security/limits.d/"
])
self.limit = self.get_option("log_size")
self.add_cmd_output("redis-cli info")
if self.get_option("all_logs"):
self.add_copy_spec([
"/var/log/redis/redis.log*",
"/var/log/containers/redis/redis.log*"
], sizelimit=self.limit)
else:
self.add_copy_spec([
"/var/log/redis/redis.log",
"/var/log/containers/redis/redis.log"
], sizelimit=self.limit)
def postproc(self):
self.do_file_sub(
"/etc/redis.conf",
r"(masterauth\s).*",
r"\1********"
)
self.do_file_sub(
"/etc/redis.conf",
r"(requirepass\s).*",
r"\1********"
)
self.do_path_regex_sub(
self.var_puppet_gen + "/etc/redis.conf*",
r"(masterauth\s).*",
r"\1*********"
)
self.do_path_regex_sub(
self.var_puppet_gen + "/etc/redis.conf*",
r"(requirepass\s).*",
r"\1*********"
)
# vim: set et ts=4 sw=4 :
sosreport-3.5/sos/plugins/symcli.py 0000644 0001750 0001750 00000007470 13203300002 017401 0 ustar caribou caribou # Copyright (C) 2008 EMC Corporation. Keith Kearnan
# Copyright (C) 2014 Red Hat, Inc. Bryn M. Reeves
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, RedHatPlugin, os
from sos.utilities import is_executable
class Symcli(Plugin, RedHatPlugin):
""" EMC Symcli
"""
plugin_name = 'symcli'
profiles = ('storage', 'hardware')
def get_symcli_files(self):
""" EMC Solutions Enabler SYMCLI specific information - files
"""
self.add_copy_spec([
"/var/symapi/db/symapi_db.bin",
"/var/symapi/config/[a-z]*",
"/var/symapi/log/[a-z]*"
])
def get_symcli_config(self):
""" EMC Solutions Enabler SYMCLI specific information
- Symmetrix/DMX - commands
"""
self.add_cmd_output([
"/usr/symcli/bin/symcli -def",
"/usr/symcli/bin/symdg list",
"/usr/symcli/bin/symdg -v list",
"/usr/symcli/bin/symcg list",
"/usr/symcli/bin/symcg -v list",
"/usr/symcli/bin/symcfg list",
"/usr/symcli/bin/symcfg -v list",
"/usr/symcli/bin/symcfg -db",
"/usr/symcli/bin/symcfg -semaphores list",
"/usr/symcli/bin/symcfg -dir all -v list",
"/usr/symcli/bin/symcfg -connections list",
"/usr/symcli/bin/symcfg -app -v list",
"/usr/symcli/bin/symcfg -fa all -port list",
"/usr/symcli/bin/symcfg -ra all -port list",
"/usr/symcli/bin/symcfg -sa all -port list",
"/usr/symcli/bin/symcfg list -lock",
"/usr/symcli/bin/symcfg list -lockn all",
"/usr/symcli/bin/syminq",
"/usr/symcli/bin/syminq -v",
"/usr/symcli/bin/syminq -symmids",
"/usr/symcli/bin/syminq hba -fibre",
"/usr/symcli/bin/syminq hba -scsi",
"/usr/symcli/bin/symhost show -config",
"/usr/symcli/bin/stordaemon list",
"/usr/symcli/bin/stordaemon -v list",
"/usr/symcli/bin/sympd list",
"/usr/symcli/bin/sympd list -vcm",
"/usr/symcli/bin/symdev list",
"/usr/symcli/bin/symdev -v list",
"/usr/symcli/bin/symdev -rdfa list",
"/usr/symcli/bin/symdev -rdfa -v list",
"/usr/symcli/bin/symbcv list",
"/usr/symcli/bin/symbcv -v list",
"/usr/symcli/bin/symrdf list",
"/usr/symcli/bin/symrdf -v list",
"/usr/symcli/bin/symrdf -rdfa list",
"/usr/symcli/bin/symrdf -rdfa -v list",
"/usr/symcli/bin/symsnap list",
"/usr/symcli/bin/symsnap list -savedevs",
"/usr/symcli/bin/symclone list",
"/usr/symcli/bin/symevent list",
"/usr/symcli/bin/symmask list hba",
"/usr/symcli/bin/symmask list logins",
"/usr/symcli/bin/symmaskdb list database",
"/usr/symcli/bin/symmaskdb -v list database"
])
def check_enabled(self):
return is_executable("/usr/symcli/bin/symcli")
def setup(self):
self.get_symcli_files()
self.get_symcli_config()
# vim: set et ts=4 sw=4 :
sosreport-3.5/sos/plugins/vmware.py 0000644 0001750 0001750 00000002212 13203300002 017367 0 ustar caribou caribou # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, RedHatPlugin
class VMWare(Plugin, RedHatPlugin):
"""VMWare client information
"""
plugin_name = 'vmware'
profiles = ('virt',)
files = ('vmware', '/usr/init.d/vmware-tools')
def setup(self):
self.add_cmd_output("vmware -v")
self.add_copy_spec([
"/etc/vmware/locations",
"/etc/vmware/config",
"/proc/vmmemctl"
])
# vim: set et ts=4 sw=4 :
sosreport-3.5/sos/plugins/satellite.py 0000644 0001750 0001750 00000006104 13203300002 020060 0 ustar caribou caribou # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, RedHatPlugin
class Satellite(Plugin, RedHatPlugin):
"""RHN Satellite and Spacewalk
"""
plugin_name = 'satellite'
profiles = ('sysmgmt',)
verify_packages = ('spacewalk.*',)
satellite = False
proxy = False
option_list = [("log", 'gathers all apache logs', 'slow', False)]
def rhn_package_check(self):
self.satellite = self.is_installed("rhns-satellite-tools") \
or self.is_installed("spacewalk-java") \
or self.is_installed("rhn-base")
self.proxy = self.is_installed("rhns-proxy-tools") \
or self.is_installed("spacewalk-proxy-management") \
or self.is_installed("rhn-proxy-management")
return self.satellite or self.proxy
def check_enabled(self):
# enable if any related package is installed
return self.rhn_package_check()
def setup(self):
self.rhn_package_check()
self.add_copy_spec([
"/etc/httpd/conf*",
"/etc/rhn",
"/var/log/rhn*"
])
if self.get_option("log"):
self.add_copy_spec("/var/log/httpd")
# all these used to go in $DIR/mon-logs/
self.add_copy_spec([
"/opt/notification/var/*.log*",
"/var/tmp/ack_handler.log*",
"/var/tmp/enqueue.log*"
])
# monitoring scout logs
self.add_copy_spec([
"/home/nocpulse/var/*.log*",
"/home/nocpulse/var/commands/*.log*",
"/var/tmp/ack_handler.log*",
"/var/tmp/enqueue.log*",
"/var/log/nocpulse/*.log*",
"/var/log/notification/*.log*",
"/var/log/nocpulse/TSDBLocalQueue/TSDBLocalQueue.log"
])
self.add_copy_spec("/root/ssl-build")
self.add_cmd_output("rhn-schema-version",
root_symlink="database-schema-version")
self.add_cmd_output("rhn-charsets",
root_symlink="database-character-sets")
if self.satellite:
self.add_copy_spec([
"/etc/tnsnames.ora",
"/etc/jabberd"
])
self.add_cmd_output(
"spacewalk-debug --dir %s"
% self.get_cmd_output_path(name="spacewalk-debug"))
if self.proxy:
self.add_copy_spec(["/etc/squid", "/var/log/squid"])
# vim: set et ts=4 sw=4 :
sosreport-3.5/sos/plugins/rhui.py 0000644 0001750 0001750 00000002572 13203300002 017046 0 ustar caribou caribou # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, RedHatPlugin
class Rhui(Plugin, RedHatPlugin):
"""Red Hat Update Infrastructure
"""
plugin_name = 'rhui'
profiles = ('sysmgmt',)
rhui_debug_path = "/usr/share/rh-rhua/rhui-debug.py"
packages = ["rh-rhui-tools"]
files = [rhui_debug_path]
def setup(self):
if self.is_installed("pulp-cds"):
cds = "--cds"
else:
cds = ""
rhui_debug_dst_path = self.get_cmd_output_path()
self.add_cmd_output(
"python %s %s --dir %s"
% (self.rhui_debug_path, cds, rhui_debug_dst_path),
suggest_filename="rhui-debug")
return
# vim: set et ts=4 sw=4 :
sosreport-3.5/sos/plugins/psacct.py 0000644 0001750 0001750 00000003216 13203300002 017350 0 ustar caribou caribou # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
class Psacct(Plugin):
"""Process accounting information
"""
plugin_name = "psacct"
profiles = ('system',)
option_list = [("all", "collect all process accounting files",
"slow", False)]
packages = ["psacct"]
class RedHatPsacct(Psacct, RedHatPlugin):
packages = ["psacct"]
def setup(self):
super(RedHatPsacct, self).setup()
self.add_copy_spec("/var/account/pacct")
if self.get_option("all"):
self.add_copy_spec("/var/account/pacct*.gz")
class DebianPsacct(Psacct, DebianPlugin, UbuntuPlugin):
plugin_name = "acct"
packages = ["acct"]
def setup(self):
super(DebianPsacct, self).setup()
self.add_copy_spec(["/var/log/account/pacct", "/etc/default/acct"])
if self.get_option("all"):
self.add_copy_spec("/var/log/account/pacct*.gz")
# vim: set et ts=4 sw=4 :
sosreport-3.5/sos/plugins/openstack_nova.py 0000644 0001750 0001750 00000017307 13203300002 021113 0 ustar caribou caribou # Copyright (C) 2009 Red Hat, Inc., Joey Boggs
# Copyright (C) 2012 Rackspace US, Inc.,
# Justin Shepherd
# Copyright (C) 2013 Red Hat, Inc., Jeremy Agee
# Copyright (C) 2015 Red Hat, Inc., Abhijeet Kasurde
# Copyright (C) 2017 Red Hat, Inc., Martin Schuppert
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
import os
class OpenStackNova(Plugin):
"""OpenStack Nova
"""
plugin_name = "openstack_nova"
profiles = ('openstack', 'openstack_controller', 'openstack_compute')
var_puppet_gen = "/var/lib/config-data/puppet-generated/nova"
def setup(self):
# commands we do not need to source the environment file
self.add_cmd_output("nova-manage db version")
self.add_cmd_output("nova-manage fixed list")
self.add_cmd_output("nova-manage floating list")
vars_all = [p in os.environ for p in [
'OS_USERNAME', 'OS_PASSWORD']]
vars_any = [p in os.environ for p in [
'OS_TENANT_NAME', 'OS_PROJECT_NAME']]
if not (all(vars_all) and any(vars_any)):
self.soslog.warning("Not all environment variables set. Source "
"the environment file for the user intended "
"to connect to the OpenStack environment.")
else:
self.add_cmd_output("nova service-list")
self.add_cmd_output("openstack flavor list --long")
self.add_cmd_output("nova network-list")
self.add_cmd_output("nova list")
self.add_cmd_output("nova agent-list")
self.add_cmd_output("nova version-list")
self.add_cmd_output("nova host-list")
self.add_cmd_output("openstack quota show")
self.add_cmd_output("openstack hypervisor stats show")
# get details for each nova instance
cmd = "openstack server list -f value"
nova_instances = self.call_ext_prog(cmd)['output']
for instance in nova_instances.splitlines():
instance = instance.split()[0]
cmd = "openstack server show %s" % (instance)
self.add_cmd_output(
cmd,
suggest_filename="instance-" + instance + ".log")
self.limit = self.get_option("log_size")
if self.get_option("all_logs"):
self.add_copy_spec([
"/var/log/nova/",
"/var/log/containers/nova/",
"/var/log/containers/httpd/nova-api/",
"/var/log/containers/httpd/nova-placement/"
], sizelimit=self.limit)
else:
self.add_copy_spec([
"/var/log/nova/*.log",
"/var/log/containers/nova/*.log",
"/var/log/containers/httpd/nova-api/*log",
"/var/log/containers/httpd/nova-placement/*log"
], sizelimit=self.limit)
self.add_copy_spec([
"/etc/nova/",
self.var_puppet_gen + "/etc/nova/",
self.var_puppet_gen + "/etc/my.cnf.d/tripleo.cnf",
self.var_puppet_gen + "_placement/var/spool/cron/nova",
self.var_puppet_gen + "_placement/etc/nova/",
self.var_puppet_gen + "_placement/etc/httpd/conf/",
self.var_puppet_gen + "_placement/etc/httpd/conf.d/",
self.var_puppet_gen + "_placement/etc/httpd/conf.modules.d/*.conf",
self.var_puppet_gen + "_placement/etc/my.cnf.d/tripleo.cnf",
self.var_puppet_gen + "/../memcached/etc/sysconfig/memcached",
self.var_puppet_gen + "_libvirt/etc/libvirt/",
self.var_puppet_gen + "_libvirt/etc/my.cnf.d/tripleo.cnf",
self.var_puppet_gen + "_libvirt/etc/nova/migration/"
"authorized_keys",
self.var_puppet_gen + "_libvirt/var/lib/nova/.ssh/config",
])
if self.get_option("verify"):
self.add_cmd_output("rpm -V %s" % ' '.join(self.packages))
def postproc(self):
protect_keys = [
"ldap_dns_password", "neutron_admin_password", "rabbit_password",
"qpid_password", "powervm_mgr_passwd", "virtual_power_host_pass",
"xenapi_connection_password", "password", "host_password",
"vnc_password", "connection", "sql_connection", "admin_password",
"connection_password", "memcache_secret_key", "s3_secret_key",
"metadata_proxy_shared_secret"
]
regexp = r"((?m)^\s*(%s)\s*=\s*)(.*)" % "|".join(protect_keys)
self.do_path_regex_sub("/etc/nova/*", regexp, r"\1*********")
self.do_path_regex_sub(
self.var_puppet_gen + "/etc/nova/*",
regexp, r"\1*********"
)
self.do_path_regex_sub(
self.var_puppet_gen + "_placement/etc/nova/*",
regexp, r"\1*********"
)
self.do_path_regex_sub(
self.var_puppet_gen + "_libvirt/etc/nova/*",
regexp, r"\1*********"
)
class DebianNova(OpenStackNova, DebianPlugin, UbuntuPlugin):
nova = False
packages = (
'nova-api-ec2',
'nova-api-metadata',
'nova-api-os-compute',
'nova-api-os-volume',
'nova-common',
'nova-compute',
'nova-compute-kvm',
'nova-compute-lxc',
'nova-compute-qemu',
'nova-compute-uml',
'nova-compute-xcp',
'nova-compute-xen',
'nova-xcp-plugins',
'nova-consoleauth',
'nova-network',
'nova-scheduler',
'nova-volume',
'novnc',
'python-nova',
'python-novaclient',
'python-novnc'
)
def check_enabled(self):
self.nova = self.is_installed("nova-common")
return self.nova
def setup(self):
super(DebianNova, self).setup()
self.add_copy_spec([
"/etc/sudoers.d/nova_sudoers",
"/usr/share/polkit-1/rules.d/60-libvirt.rules",
])
class RedHatNova(OpenStackNova, RedHatPlugin):
nova = False
packages = (
'openstack-nova-common',
'openstack-nova-network',
'openstack-nova-conductor',
'openstack-nova-conductor',
'openstack-nova-scheduler',
'openstack-nova-console',
'openstack-nova-novncproxy',
'openstack-nova-compute',
'openstack-nova-api',
'openstack-nova-cert',
'openstack-nova-cells',
'openstack-nova-objectstore',
'python-nova',
'python-novaclient',
'novnc'
)
def check_enabled(self):
self.nova = self.is_installed("openstack-nova-common")
return self.nova
def setup(self):
super(RedHatNova, self).setup()
self.add_copy_spec([
"/etc/logrotate.d/openstack-nova",
"/etc/polkit-1/localauthority/50-local.d/50-nova.pkla",
"/etc/sudoers.d/nova",
"/etc/security/limits.d/91-nova.conf",
"/etc/sysconfig/openstack-nova-novncproxy"
])
# vim: set et ts=4 sw=4 :
sosreport-3.5/sos/plugins/grub.py 0000644 0001750 0001750 00000002543 13203300002 017034 0 ustar caribou caribou # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
class Grub(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
"""GRUB bootloader
"""
plugin_name = 'grub'
profiles = ('boot',)
packages = ('grub',)
def setup(self):
self.add_copy_spec([
"/boot/efi/EFI/*/grub.conf",
"/boot/grub/grub.conf",
"/boot/grub/device.map",
"/etc/grub.conf",
"/etc/grub.d"
])
def postproc(self):
self.do_path_regex_sub(
r".*\/grub.conf",
r"(password\s*)(--md5\s*|\s*)(.*)",
r"\1\2********"
)
# vim: set et ts=4 sw=4 :
sosreport-3.5/sos/plugins/hts.py 0000644 0001750 0001750 00000002025 13203300002 016666 0 ustar caribou caribou # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, RedHatPlugin
class HardwareTestSuite(Plugin, RedHatPlugin):
"""Red Hat Hardware Test Suite
"""
plugin_name = 'hts'
profiles = ('debug',)
def setup(self):
self.add_copy_spec([
"/etc/httpd/conf.d/hts.conf",
"/var/hts"
])
# vim: set et ts=4 sw=4 :
sosreport-3.5/sos/plugins/pacemaker.py 0000644 0001750 0001750 00000010156 13203300002 020024 0 ustar caribou caribou # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
from datetime import datetime, timedelta
import re
import os.path
class Pacemaker(Plugin, DebianPlugin, UbuntuPlugin):
"""HA Cluster resource manager"""
plugin_name = "pacemaker"
profiles = ("cluster", )
packages = ["pacemaker"]
defaults = "/etc/default/pacemaker"
option_list = [
("crm_from", "specify the start time for crm_report", "fast", False),
("crm_scrub", "enable password scrubbing for crm_report", "", True),
]
def setup(self):
self.add_copy_spec([
"/var/lib/pacemaker/cib/cib.xml",
self.defaults,
"/var/log/pacemaker.log",
"/var/log/pcsd/pcsd.log",
"/var/log/pacemaker/bundles/*/",
])
self.add_cmd_output([
"crm_mon -1 -A -n -r -t",
"crm status",
"crm configure show",
"pcs config",
"pcs status",
"pcs property list --all"
])
# crm_report needs to be given a --from "YYYY-MM-DD HH:MM:SS" start
# time in order to collect data.
crm_from = (datetime.today() -
timedelta(hours=72)).strftime("%Y-%m-%d %H:%m:%S")
if self.get_option("crm_from") is not False:
if re.match(r'\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}',
str(self.get_option("crm_from"))):
crm_from = self.get_option("crm_from")
else:
self._log_error(
"crm_from parameter '%s' is not a valid date: using "
"default" % self.get_option("crm_from"))
crm_dest = self.get_cmd_output_path(name="crm_report", make=False)
crm_scrub = '-p "passw.*"'
if not self.get_option("crm_scrub"):
crm_scrub = ""
self._log_warn("scrubbing of crm passwords has been disabled:")
self._log_warn("data collected by crm_report may contain"
" sensitive values.")
self.add_cmd_output('crm_report --sos-mode %s -S -d '
' --dest %s --from "%s"' %
(crm_scrub, crm_dest, crm_from),
chroot=self.tmp_in_sysroot())
# collect user-defined logfiles, matching pattern:
# PCMK_loggfile=filename
# specified in the pacemaker defaults file.
pattern = '^\s*PCMK_logfile=[\'\"]?(\S+)[\'\"]?\s*(\s#.*)?$'
if os.path.isfile(self.defaults):
with open(self.defaults) as f:
for line in f:
if re.match(pattern, line):
# remove trailing and leading quote marks, in case the
# line is e.g. PCMK_logfile="/var/log/pacemaker.log"
logfile = re.search(pattern, line).group(1)
for regexp in [r'^"', r'"$', r'^\'', r'\'$']:
logfile = re.sub(regexp, '', logfile)
self.add_copy_spec(logfile)
def postproc(self):
self.do_cmd_output_sub(
"pcs config",
r"(passwd=|incoming_password=)\S+",
r"\1********"
)
class RedHatPacemaker(Pacemaker, RedHatPlugin):
""" Handle alternate location of pacemaker defaults file.
"""
def setup(self):
self.defaults = "/etc/sysconfig/pacemaker"
super(RedHatPacemaker, self).setup()
# vim: et ts=4 sw=4
sosreport-3.5/sos/plugins/chrony.py 0000644 0001750 0001750 00000002422 13203300002 017373 0 ustar caribou caribou # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, RedHatPlugin
class Chrony(Plugin, RedHatPlugin):
"""Chrony clock (for Network time protocol)
"""
plugin_name = "chrony"
profiles = ('system', 'services')
packages = ('chrony',)
def setup(self):
self.add_copy_spec([
"/etc/chrony.conf",
"/var/lib/chrony/drift"
])
self.add_cmd_output([
"chronyc tracking",
"chronyc sources",
"chronyc sourcestats",
"chronyc clients"
])
self.add_journal(units="chronyd")
# vim: et ts=4 sw=4
sosreport-3.5/sos/plugins/sssd.py 0000644 0001750 0001750 00000004035 13203300002 017047 0 ustar caribou caribou # Copyright (C) 2007 Red Hat, Inc., Pierre Carrier
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
class Sssd(Plugin):
"""System security service daemon
"""
plugin_name = "sssd"
profiles = ('services', 'security', 'identity')
packages = ('sssd',)
def setup(self):
self.add_copy_spec([
"/etc/sssd/sssd.conf",
"/var/log/sssd/*",
"/var/lib/sss/pubconf/krb5.include.d/*",
# SSSD 1.14
"/etc/sssd/conf.d/*.conf"
])
self.add_cmd_output("sssctl config-check")
domain_file = self.get_cmd_output_now("sssctl domain-list")
if domain_file:
for domain_name in open(domain_file).read().splitlines():
self.add_cmd_output("sssctl domain-status -o "+domain_name)
def postproc(self):
regexp = r"(\s*ldap_default_authtok\s*=\s*)\S+"
self.do_file_sub("/etc/sssd/sssd.conf", regexp, r"\1********")
self.do_path_regex_sub("/etc/sssd/conf.d/*", regexp, r"\1********")
class RedHatSssd(Sssd, RedHatPlugin):
def setup(self):
super(RedHatSssd, self).setup()
class DebianSssd(Sssd, DebianPlugin, UbuntuPlugin):
def setup(self):
super(DebianSssd, self).setup()
self.add_copy_spec("/etc/default/sssd")
# vim: set et ts=4 sw=4 :
sosreport-3.5/sos/plugins/nfsserver.py 0000644 0001750 0001750 00000003507 13203300002 020113 0 ustar caribou caribou # Copyright (C) 2007 Red Hat, Inc., Eugene Teo
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, RedHatPlugin
import os
from stat import ST_SIZE
class NfsServer(Plugin, RedHatPlugin):
"""NFS server information
"""
plugin_name = 'nfsserver'
profiles = ('storage', 'network', 'services', 'nfs')
def check_enabled(self):
default_runlevel = self.policy().default_runlevel()
nfs_runlevels = self.policy().runlevel_by_service("nfs")
if default_runlevel in nfs_runlevels:
return True
try:
exports = os.stat("/etc/exports")[ST_SIZE]
xtab = os.stat("/var/lib/nfs/xtab")[ST_SIZE]
if exports or xtab:
return True
except:
pass
return False
def setup(self):
self.add_copy_spec([
"/etc/exports",
"/etc/exports.d",
"/var/lib/nfs/etab",
"/var/lib/nfs/xtab",
"/var/lib/nfs/rmtab"
])
self.add_cmd_output([
"rpcinfo -p localhost",
"nfsstat -o all",
"exportfs -v"
])
# vim: set et ts=4 sw=4 :
sosreport-3.5/sos/plugins/abrt.py 0000644 0001750 0001750 00000003130 13203300002 017016 0 ustar caribou caribou # Copyright (C) 2010 Red Hat, Inc., Tomas Smetana
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, RedHatPlugin
class Abrt(Plugin, RedHatPlugin):
"""Automatic Bug Reporting Tool
"""
plugin_name = "abrt"
profiles = ('system', 'debug')
packages = ('abrt-cli', 'abrt-gui', 'abrt')
files = ('/var/spool/abrt',)
option_list = [
("detailed", 'collect detailed info for every report', 'slow', False)
]
def info_detailed(self, list_file):
for line in open(list_file).read().splitlines():
if line.startswith("Directory:"):
self.add_cmd_output("abrt-cli info -d '%s'" % line.split()[1])
def setup(self):
self.add_cmd_output("abrt-cli status")
list_file = self.get_cmd_output_now("abrt-cli list")
if self.get_option('detailed') and list_file:
self.info_detailed(list_file)
# vim: set et ts=4 sw=4 :
sosreport-3.5/sos/plugins/virtwho.py 0000644 0001750 0001750 00000002241 13203300002 017572 0 ustar caribou caribou # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, RedHatPlugin
class VirtWho(Plugin, RedHatPlugin):
"""Virt-Who agent
"""
plugin_name = 'virtwho'
profiles = ('virt', 'system')
packages = ('virt-who',)
def setup(self):
self.add_copy_spec("/etc/virt-who.d/*")
def postproc(self):
self.do_path_regex_sub(r"\/etc\/virt-who\.d",
r"(.*password=)(\S*)",
r"\1********")
# vim: set et ts=4 sw=4 :
sosreport-3.5/sos/plugins/selinux.py 0000644 0001750 0001750 00000003426 13203300002 017565 0 ustar caribou caribou # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, RedHatPlugin
class SELinux(Plugin, RedHatPlugin):
"""SELinux access control
"""
plugin_name = 'selinux'
profiles = ('system', 'security', 'openshift')
option_list = [("fixfiles", 'Print incorrect file context labels',
'slow', False),
("list", 'List objects and their context', 'slow', False)]
packages = ('libselinux',)
def setup(self):
self.add_copy_spec("/etc/selinux")
self.add_cmd_output([
"sestatus -b",
"semodule -l",
"selinuxdefcon root",
"selinuxconlist root",
"selinuxexeccon /bin/passwd",
"semanage -o -",
"ps axuZww"
])
if self.get_option('fixfiles'):
self.add_cmd_output("restorecon -Rvn /", stderr=False)
if self.get_option('list'):
self.add_cmd_output([
"semanage fcontext -l",
"semanage user -l",
"semanage login -l",
"semanage port -l"
])
# vim: set et ts=4 sw=4 :
sosreport-3.5/sos/plugins/pxe.py 0000644 0001750 0001750 00000003303 13203300002 016664 0 ustar caribou caribou # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
class Pxe(Plugin):
"""PXE service
"""
plugin_name = "pxe"
profiles = ('sysmgmt', 'network')
option_list = [("tftpboot", 'gathers content from the tftpboot path',
'slow', False)]
class RedHatPxe(Pxe, RedHatPlugin):
files = ('/usr/sbin/pxeos',)
packages = ('system-config-netboot-cmd',)
def setup(self):
super(RedHatPxe, self).setup()
self.add_cmd_output("/usr/sbin/pxeos -l")
self.add_copy_spec("/etc/dhcpd.conf")
if self.get_option("tftpboot"):
self.add_copy_spec("/tftpboot")
class DebianPxe(Pxe, DebianPlugin, UbuntuPlugin):
packages = ('tftpd-hpa',)
def setup(self):
super(DebianPxe, self).setup()
self.add_copy_spec([
"/etc/dhcp/dhcpd.conf",
"/etc/default/tftpd-hpa"
])
if self.get_option("tftpboot"):
self.add_copy_spec("/var/lib/tftpboot")
# vim: set et ts=4 sw=4 :
sosreport-3.5/sos/plugins/os_net_config.py 0000644 0001750 0001750 00000002062 13203300002 020705 0 ustar caribou caribou # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, RedHatPlugin, UbuntuPlugin, DebianPlugin
class OsNetConfig(Plugin, RedHatPlugin, UbuntuPlugin, DebianPlugin):
"""OpenStack Net Config"""
plugin_name = "os_net_config"
profiles = ('openstack')
packages = ('os-net-config')
def setup(self):
self.add_copy_spec("/etc/os-net-config")
# vim: set et ts=4 sw=4 :
sosreport-3.5/sos/plugins/filesys.py 0000644 0001750 0001750 00000004242 13203300002 017551 0 ustar caribou caribou # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
class Filesys(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
"""Local file systems
"""
plugin_name = 'filesys'
profiles = ('storage',)
option_list = [("lsof", 'gathers information on all open files', 'slow',
False),
("dumpe2fs", 'dump filesystem information', 'slow', False)]
def setup(self):
self.add_copy_spec([
"/proc/filesystems",
"/etc/fstab",
"/proc/self/mounts",
"/proc/self/mountinfo",
"/proc/self/mountstats",
"/proc/mounts"
])
self.add_cmd_output("mount -l", root_symlink="mount")
self.add_cmd_output("df -al -x autofs", root_symlink="df")
self.add_cmd_output([
"df -ali -x autofs",
"findmnt"
])
if self.get_option('lsof'):
self.add_cmd_output("lsof -b +M -n -l -P", root_symlink="lsof")
dumpe2fs_opts = '-h'
if self.get_option('dumpe2fs'):
dumpe2fs_opts = ''
mounts = '/proc/mounts'
ext_fs_regex = r"^(/dev/.+).+ext[234]\s+"
for dev in self.do_regex_find_all(ext_fs_regex, mounts):
self.add_cmd_output("dumpe2fs %s %s" % (dumpe2fs_opts, dev))
def postproc(self):
self.do_file_sub(
"/etc/fstab",
r"(password=)[^\s]*",
r"\1********"
)
# vim: set et ts=4 sw=4 :
sosreport-3.5/sos/plugins/usb.py 0000644 0001750 0001750 00000002142 13203300002 016661 0 ustar caribou caribou # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, RedHatPlugin, UbuntuPlugin, DebianPlugin
class Usb(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
"""USB devices
"""
plugin_name = "usb"
profiles = ('hardware',)
def setup(self):
self.add_copy_spec("/sys/bus/usb")
self.add_cmd_output([
"lsusb",
"lsusb -v",
"lsusb -t"
])
# vim: set et ts=4 sw=4 :
sosreport-3.5/sos/plugins/openstack_ironic.py 0000644 0001750 0001750 00000012042 13203300002 021422 0 ustar caribou caribou # Copyright (C) 2015 Red Hat, Inc., Lee Yarwood
# Copyright (C) 2017 Red Hat, Inc., Martin Schuppert
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
import os
class OpenStackIronic(Plugin):
"""OpenStack Ironic
"""
plugin_name = "openstack_ironic"
profiles = ('openstack', 'openstack_undercloud')
var_puppet_gen = "/var/lib/config-data/puppet-generated/ironic"
def setup(self):
self.conf_list = [
"/etc/ironic/*",
self.var_puppet_gen + "/etc/ironic/*",
self.var_puppet_gen + "_api/etc/ironic/*"
]
self.add_copy_spec([
"/etc/ironic/",
self.var_puppet_gen + "/etc/xinetd.conf",
self.var_puppet_gen + "/etc/xinetd.d/",
self.var_puppet_gen + "/etc/ironic/",
self.var_puppet_gen + "/etc/httpd/conf/",
self.var_puppet_gen + "/etc/httpd/conf.d/",
self.var_puppet_gen + "/etc/httpd/conf.modules.d/*.conf",
self.var_puppet_gen + "/etc/my.cnf.d/tripleo.cnf",
self.var_puppet_gen + "_api/etc/ironic/",
self.var_puppet_gen + "_api/etc/httpd/conf/",
self.var_puppet_gen + "_api/etc/httpd/conf.d/",
self.var_puppet_gen + "_api/etc/httpd/conf.modules.d/*.conf",
self.var_puppet_gen + "_api/etc/my.cnf.d/tripleo.cnf"
])
self.limit = self.get_option("log_size")
if self.get_option("all_logs"):
self.add_copy_spec([
"/var/log/ironic/",
"/var/log/containers/ironic/",
"/var/log/containers/httpd/ironic-api/"
], sizelimit=self.limit)
else:
self.add_copy_spec([
"/var/log/ironic/*.log",
"/var/log/containers/ironic/*.log",
"/var/log/containers/httpd/ironic-api/*log"
], sizelimit=self.limit)
self.add_cmd_output('ls -laRt /var/lib/ironic/')
self.add_cmd_output(
'ls -laRt ' + self.var_puppet_gen + '/var/lib/ironic/'
)
if self.get_option("verify"):
self.add_cmd_output("rpm -V %s" % ' '.join(self.packages))
vars_all = [p in os.environ for p in [
'OS_USERNAME', 'OS_PASSWORD']]
vars_any = [p in os.environ for p in [
'OS_TENANT_NAME', 'OS_PROJECT_NAME']]
if not (all(vars_all) and any(vars_any)):
self.soslog.warning("Not all environment variables set. Source "
"the environment file for the user intended "
"to connect to the OpenStack environment.")
else:
self.add_cmd_output("openstack baremetal node list --long")
self.add_cmd_output("openstack baremetal port list")
def postproc(self):
protect_keys = [
"dns_passkey", "memcache_secret_key", "rabbit_password",
"password", "qpid_password", "connection", "sql_connection",
"admin_password", "ssl_key_password", "os_password"
]
regexp = r"((?m)^\s*#*(%s)\s*=\s*)(.*)" % "|".join(protect_keys)
for conf in self.conf_list:
self.do_path_regex_sub(conf, regexp, r"\1*********")
class DebianIronic(OpenStackIronic, DebianPlugin, UbuntuPlugin):
packages = [
'ironic-api',
'ironic-common',
'ironic-conductor',
]
def setup(self):
super(DebianIronic, self).setup()
class RedHatIronic(OpenStackIronic, RedHatPlugin):
packages = [
'openstack-ironic-api',
'openstack-ironic-common',
'openstack-ironic-conductor',
]
discoverd_packages = [
'openstack-ironic-discoverd',
'openstack-ironic-discoverd-ramdisk'
]
def setup(self):
super(RedHatIronic, self).setup()
# is the optional ironic-discoverd service installed?
if any([self.is_installed(p) for p in self.discoverd_packages]):
self.conf_list.append('/etc/ironic-discoverd/*')
self.add_copy_spec('/etc/ironic-discoverd/')
self.add_copy_spec('/var/lib/ironic-discoverd/')
self.add_copy_spec('/var/log/ironic-discoverd/')
self.add_journal(units="openstack-ironic-discoverd")
self.add_journal(units="openstack-ironic-discoverd-dnsmasq")
# vim: set et ts=4 sw=4 :
sosreport-3.5/sos/plugins/cron.py 0000644 0001750 0001750 00000002543 13203300002 017036 0 ustar caribou caribou # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
class Cron(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
"""Cron job scheduler
"""
plugin_name = "cron"
profiles = ('system',)
packages = ('cron', 'anacron', 'chronie')
files = ('/etc/crontab')
def setup(self):
self.add_copy_spec([
"/etc/cron*",
"/var/log/cron",
"/var/spool/cron"
])
if self.get_option("all_logs"):
self.add_copy_spec("/var/log/cron*")
self.add_cmd_output("crontab -l -u root",
suggest_filename="root_crontab")
# vim: set et ts=4 sw=4 :
sosreport-3.5/sos/plugins/memory.py 0000644 0001750 0001750 00000002742 13203300002 017406 0 ustar caribou caribou # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
class Memory(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
"""Memory configuration and use
"""
plugin_name = 'memory'
profiles = ('system', 'hardware', 'memory')
def setup(self):
self.add_copy_spec([
"/proc/pci",
"/proc/meminfo",
"/proc/vmstat",
"/proc/swaps",
"/proc/slabinfo",
"/proc/pagetypeinfo",
"/proc/vmallocinfo",
"/sys/kernel/mm/ksm",
"/sys/kernel/mm/transparent_hugepage/enabled"
])
self.add_cmd_output("free", root_symlink="free")
self.add_cmd_output([
"free -m",
"swapon --bytes --show"
])
# vim: set et ts=4 sw=4 :
sosreport-3.5/sos/plugins/grub2.py 0000644 0001750 0001750 00000004654 13203300002 017123 0 ustar caribou caribou # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
class Grub2(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
"""GRUB2 bootloader
"""
plugin_name = 'grub2'
profiles = ('boot',)
packages = ('grub2', 'grub2-efi')
def setup(self):
self.add_copy_spec([
"/boot/efi/EFI/*/grub.cfg",
"/boot/grub2/grub.cfg",
"/boot/grub2/grubenv",
"/boot/grub/grub.cfg",
"/etc/default/grub",
"/etc/grub2.cfg",
"/etc/grub.d"
])
self.add_cmd_output("ls -lanR /boot")
# call grub2-mkconfig with GRUB_DISABLE_OS_PROBER=true to prevent
# possible unwanted loading of some kernel modules
env = {}
env['GRUB_DISABLE_OS_PROBER'] = 'true'
self.add_cmd_output("grub2-mkconfig", env=env)
def postproc(self):
# the trailing space is required; python treats '_' as whitespace
# causing the passwd_exp to match pbkdf2 passwords and mangle them.
passwd_exp = r"(password )\s*(\S*)\s*(\S*)"
passwd_pbkdf2_exp = r"(password_pbkdf2)\s*(\S*)\s*(\S*)"
passwd_sub = r"\1 \2 ********"
passwd_pbkdf2_sub = r"\1 \2 grub.pbkdf2.********"
self.do_cmd_output_sub(
"grub2-mkconfig",
passwd_pbkdf2_exp,
passwd_pbkdf2_sub
)
self.do_cmd_output_sub(
"grub2-mkconfig",
passwd_exp,
passwd_sub
)
self.do_path_regex_sub(
r".*\/grub\.",
passwd_exp,
passwd_sub
)
self.do_path_regex_sub(
r".*\/grub\.",
passwd_pbkdf2_exp,
passwd_pbkdf2_sub
)
# vim: set et ts=4 sw=4 :
sosreport-3.5/sos/plugins/acpid.py 0000644 0001750 0001750 00000002351 13203300002 017152 0 ustar caribou caribou # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
class Acpid(Plugin):
"""ACPI daemon information"""
plugin_name = "acpid"
profiles = ('hardware',)
packages = ('acpid',)
class RedHatAcpid(Acpid, RedHatPlugin):
def setup(self):
self.add_copy_spec([
"/var/log/acpid*",
"/etc/acpi/events/power.conf"])
class DebianAcpid(Acpid, DebianPlugin, UbuntuPlugin):
def setup(self):
self.add_copy_spec([
"/etc/acpi/events/powerbtn*"])
# vim: set et ts=4 sw=4 :
sosreport-3.5/sos/plugins/activemq.py 0000644 0001750 0001750 00000004037 13203300002 017706 0 ustar caribou caribou # Copyright (C) 2014 Red Hat, Inc., Bryn M. Reeves
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
class ActiveMq(Plugin, DebianPlugin):
"""ActiveMQ message broker
"""
plugin_name = 'activemq'
profiles = ('openshift',)
packages = ('activemq', 'activemq-core')
files = ('/var/log/activemq',)
def setup(self):
if self.get_option("all_logs"):
self.add_copy_spec(list(self.files))
else:
self.add_copy_spec([
"/var/log/activemq/activemq.log",
"/var/log/activemq/wrapper.log"
])
def postproc(self):
# activemq.xml contains credentials in this form:
#
self.do_file_sub(
'/etc/activemq/activemq.xml',
r'(\s*password=")[^"]*(".*)',
r"\1******\2"
)
class RedHatActiveMq(ActiveMq, RedHatPlugin):
def setup(self):
super(RedHatActiveMq, self).setup()
self.add_copy_spec([
'/etc/sysconfig/activemq',
'/etc/activemq/activemq.xml'
])
class UbuntuActiveMq(ActiveMq, UbuntuPlugin):
def setup(self):
super(UbuntuActiveMq, self).setup()
self.add_copy_spec([
'/etc/activemq',
'/etc/default/activemq'
])
sosreport-3.5/sos/plugins/ldap.py 0000644 0001750 0001750 00000006552 13203300002 017021 0 ustar caribou caribou # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
class Ldap(Plugin):
"""LDAP configuration
"""
plugin_name = "ldap"
profiles = ('identity', 'sysmgmt', 'system')
ldap_conf = "/etc/openldap/ldap.conf"
def setup(self):
super(Ldap, self).setup()
self.add_copy_spec("/etc/ldap.conf")
def postproc(self):
self.do_file_sub("/etc/ldap.conf", r"(\s*bindpw\s*)\S+", r"\1******")
class RedHatLdap(Ldap, RedHatPlugin):
packages = ('openldap', 'nss-pam-ldapd')
files = ('/etc/ldap.conf', '/etc/pam_ldap.conf')
def setup(self):
super(RedHatLdap, self).setup()
self.add_forbidden_path("/etc/openldap/certs/password")
self.add_forbidden_path("/etc/openldap/certs/pwfile.txt")
self.add_forbidden_path("/etc/openldap/certs/pin.txt")
self.add_forbidden_path("/etc/openldap/certs/*passw*")
self.add_forbidden_path("/etc/openldap/certs/key3.db")
self.add_copy_spec([
self.ldap_conf,
"/etc/openldap/certs/cert8.db",
"/etc/openldap/certs/secmod.db",
"/etc/nslcd.conf",
"/etc/pam_ldap.conf"
])
self.add_cmd_output("certutil -L -d /etc/openldap")
def postproc(self):
super(RedHatLdap, self).postproc()
self.do_file_sub(
"/etc/nslcd.conf",
r"(\s*bindpw\s*)\S+",
r"\1********"
)
self.do_file_sub(
"/etc/pam_ldap.conf",
r"(\s*bindpw\s*)\S+",
r"\1********"
)
class DebianLdap(Ldap, DebianPlugin, UbuntuPlugin):
ldap_conf = "/etc/ldap/ldap.conf"
packages = ('slapd', 'ldap-utils')
def setup(self):
super(DebianLdap, self).setup()
ldap_search = "ldapsearch -Q -LLL -Y EXTERNAL -H ldapi:/// "
self.add_copy_spec([
self.ldap_conf,
"/etc/slapd.conf",
"/etc/ldap/slapd.d"
])
self.add_cmd_output("ldapsearch -x -b '' -s base 'objectclass=*'")
self.add_cmd_output(
ldap_search + "-b cn=config '(!(objectClass=olcSchemaConfig))'",
suggest_filename="configuration_minus_schemas")
self.add_cmd_output(
ldap_search + "-b cn=schema,cn=config dn",
suggest_filename="loaded_schemas")
self.add_cmd_output(
ldap_search + "-b cn=config '(olcAccess=*)' olcAccess olcSuffix",
suggest_filename="access_control_lists")
def postproc(self):
super(DebianLdap, self).postproc()
self.do_cmd_output_sub(
"ldapsearch",
r"(olcRootPW\: \s*)\S+",
r"\1********"
)
# vim: set et ts=4 sw=4 :
sosreport-3.5/sos/plugins/kimchi.py 0000644 0001750 0001750 00000003006 13203300002 017334 0 ustar caribou caribou # Copyright IBM, Corp. 2014, Christy Perez
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, RedHatPlugin, UbuntuPlugin, DebianPlugin
class Kimchi(Plugin, RedHatPlugin, UbuntuPlugin, DebianPlugin):
"""kimchi-related information
"""
plugin_name = 'kimchi'
packages = ('kimchi',)
def setup(self):
log_limit = self.get_option('log_size')
self.add_copy_spec('/etc/kimchi/')
if not self.get_option('all_logs'):
self.add_copy_spec('/var/log/kimchi/*.log', sizelimit=log_limit)
self.add_copy_spec('/etc/kimchi/kimchi*', sizelimit=log_limit)
self.add_copy_spec('/etc/kimchi/distros.d/*.json',
sizelimit=log_limit)
else:
self.add_copy_spec('/var/log/kimchi/')
# vim: expandtab tabstop=4 shiftwidth=4
sosreport-3.5/sos/plugins/ovirt_hosted_engine.py 0000644 0001750 0001750 00000006204 13203300002 022131 0 ustar caribou caribou # Copyright (C) 2014 Red Hat, Inc., Sandro Bonazzola
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
import glob
from sos.plugins import Plugin, RedHatPlugin
class OvirtHostedEngine(Plugin, RedHatPlugin):
"""oVirt Hosted Engine"""
packages = (
'ovirt-hosted-engine-setup',
'ovirt-hosted-engine-ha',
)
plugin_name = 'ovirt_hosted_engine'
profiles = ('virt',)
SETUP_LOG_GLOB = '/var/log/ovirt-hosted-engine-setup/*.log'
HA_LOG_GLOB = '/var/log/ovirt-hosted-engine-ha/*.log'
def setup(self):
self.limit = self.get_option('log_size')
# Add configuration files
# Collecting the whole directory since it may contain branding
# configuration files or third party plugins configuration files
self.add_copy_spec(['/etc/ovirt-hosted-engine-setup.env.d/'])
self.add_copy_spec([
'/etc/ovirt-hosted-engine/answers.conf',
'/etc/ovirt-hosted-engine/hosted-engine.conf',
'/etc/ovirt-hosted-engine/vm.conf',
'/etc/ovirt-hosted-engine-ha/agent.conf',
'/etc/ovirt-hosted-engine-ha/agent-log.conf',
'/etc/ovirt-hosted-engine-ha/broker.conf',
'/etc/ovirt-hosted-engine-ha/broker-log.conf',
'/etc/ovirt-hosted-engine-ha/notifications/state_transition.txt',
'/var/run/ovirt-hosted-engine-ha/vm.conf',
'/var/lib/ovirt-hosted-engine-ha/broker.conf',
])
all_setup_logs = glob.glob(self.SETUP_LOG_GLOB)
all_setup_logs.sort(reverse=True)
if len(all_setup_logs):
# Add latest ovirt-hosted-engine-setup log file
self.add_copy_spec(all_setup_logs[0])
# Add older ovirt-hosted-engine-setup log files only if requested
if self.get_option('all_logs'):
self.add_copy_spec(
self.SETUP_LOG_GLOB,
sizelimit=self.limit
)
self.add_copy_spec([
'/var/log/ovirt-hosted-engine-ha/agent.log',
'/var/log/ovirt-hosted-engine-ha/broker.log',
])
# Add older ovirt-hosted-engine-ha log files only if requested
if self.get_option('all_logs'):
self.add_copy_spec(
self.HA_LOG_GLOB,
sizelimit=self.limit,
)
# Add run-time status
self.add_cmd_output([
'hosted-engine --vm-status',
'hosted-engine --check-liveliness',
])
# vim: expandtab tabstop=4 shiftwidth=4
sosreport-3.5/sos/plugins/cman.py 0000644 0001750 0001750 00000004375 13203300002 017020 0 ustar caribou caribou # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, RedHatPlugin
import re
from glob import glob
class Cman(Plugin, RedHatPlugin):
"""cman based Red Hat Cluster High Availability
"""
plugin_name = "cman"
profiles = ("cluster",)
packages = [
"luci",
"cman",
"clusterlib",
]
files = ["/etc/cluster/cluster.conf"]
debugfs_path = "/sys/kernel/debug"
_debugfs_cleanup = False
def setup(self):
self.add_copy_spec([
"/etc/cluster.conf",
"/etc/cluster",
"/etc/sysconfig/cluster",
"/etc/sysconfig/cman",
"/var/log/cluster",
"/etc/fence_virt.conf",
"/var/lib/luci/data/luci.db",
"/var/lib/luci/etc",
"/var/log/luci"
])
self.add_cmd_output([
"cman_tool services",
"cman_tool nodes",
"cman_tool status",
"ccs_tool lsnode",
"mkqdisk -L",
"group_tool dump",
"fence_tool dump",
"fence_tool ls -n",
"clustat",
"rg_test test /etc/cluster/cluster.conf"
])
def postproc(self):
for cluster_conf in glob("/etc/cluster/cluster.conf*"):
self.do_file_sub(
cluster_conf,
r"(\s*\