Tutorial Install dan Menggunakan sosreport di Ubuntu Server

Tutorial Install dan Menggunakan sosreport di Ubuntu Server

SOS adalah alat pengumpulan data yang free dan open-source yang dapat digunakan untuk mengumpulkan detail konfigurasi sistem dan informasi diagnostik dari sistem operasi Unix-like. Ia bekerja dengan mengumpulkan konfigurasi sistem dan mencatat informasi dan mengarsipkannya ke dalam satu file. Umumnya digunakan oleh engineers untuk mencari dukungan teknis untuk menemukan apa masalahnya di sistem.

Dalam tutorial ini, kita akan belajar cara menggunakan SOS di server Ubuntu 18.04.

Persyaratan

Cara Menggunakan Sosreport

Secara default, SOS tool tersedia di Ubuntu 18.04 server. Jadi Anda tidak perlu menginstalnya ke server Anda.

Untuk mengumpulkan detail konfigurasi sistem Anda dan informasi diagnostik lainnya, jalankan perintah berikut:

sosreport

Output:

sosreport (version 3.5)

This command will collect system configuration and diagnostic
information from this Ubuntu system. An archive containing the collected
information will be generated in /tmp/sos.91hh07wb.

For more information on Ubuntu visit:

  http://www.ubuntu.com/

The generated archive may contain data considered sensitive and its
content should be reviewed by the originating organization before being
passed to any third party.

No changes will be made to system configuration.

Press ENTER to continue, or CTRL-C to quit.

Please enter your first initial and last name [ubuntu1804]: 
Please enter the case id that you are generating this report for []: 

 Setting up archive ...
 Setting up plugins ...
 Running plugins. Please wait ...

  Running 61/61: xfs...      
Creating compressed archive...

Your sosreport has been generated and saved in:
  /tmp/sosreport-ubuntu1804-20190130103134.tar.xz

The checksum is: 180c9e539b00c626d84fc055df5fb864

Please send this file to your support representative.

Perintah di atas akan mengumpulkan konfigurasi sistem dan informasi diagnostik dari sistem ini dan menyimpannya di direktori /tmp.

Anda juga dapat membuat sosreport dan menyimpannya ke lokasi lain dengan menjalankan perintah berikut:

sosreport --tmp-dir /opt

Secara default, sosreport dikompres dalam tipe xz. Untuk mengompres sosreport di gzip dengan perintah berikut:

sosreport --compression-type gzip

Hasilkan sosreport untuk plugin tertentu

Secara default, sosreport hadir dengan banyak plugin. Anda dapat melihat list semua plugin dengan perintah berikut:

sosreport -l

Anda akan melihat output berikut:

sosreport (version 3.5)

The following plugins are currently enabled:

 acpid     ACPI daemon information
 apache    Apache http daemon
 apparmor  Apparmor mandatory access control
 apport    Apport crash reporting tool
 apt       APT - advanced packaging tool
 ata       ATA and IDE information
 block     Block device information
 boot      Bootloader information
 btrfs     Btrfs filesystem
 cgroups   Control groups subsystem
 cron      Cron job scheduler
 crypto    System crypto services information
 date      Basic system time information
 dbus      D-Bus message bus
 devicemapper         device-mapper framework
 devices   devices specific commands
 dpkg      Debian Package Management
 filesys   Local file systems
 hardware  General hardware information
 host      Host information
 i18n      Internationalization
 iscsi     iSCSI initiator
 java      Java runtime
 kernel    Linux kernel
 last      login information
 libraries Dynamic shared libraries
 libvirt   libvirt virtualization API
 logrotate LogRotate service
 logs      System logs
 lvm2      LVM2 volume manager
 lxd       LXD is a containers hypervisor.
 md        MD RAID subsystem
 memory    Memory configuration and use
 multipath Device-mapper multipath tools
 mysql     MySQL and MariaDB RDBMS
 networkingnetwork and device configuration
 openssl   openssl related information for Debian distributions
 pam       Pluggable Authentication Modules
 pci       PCI devices
 perl      Perl runtime
 procenv   Process environment
 process   process information
 processor CPU information
 release   Linux release information
 scsi      SCSI devices
 services  System services
 snappy    Snap packages
 soundcard Sound devices
 ssh       Secure shell service
 system    core system information
 systemd   System management daemon
 sysvipc   SysV IPC
 ubuntu    Ubuntu specific information
 udev      udev dynamic device management
 usb       USB devices
 wireless  Wireless
 x11       X windowing system
 xfs       XFS filesystem

The following plugins are currently disabled:

 activemq  inactive       ActiveMQ message broker
 anacron   inactive       Anacron job scheduling service
 ansible   inactive       Ansible configuration management
 auditd    inactive       Audit daemon information
 autofs    inactive       Autofs on-demand automounter
 azure     inactive       Microsoft Azure client
 canonical_livepatch  inactive       Canonical Livepatch Service
 ceph      inactive       CEPH distributed storage
 ceph_ansible         inactive       CEPH distributed storage - Ansible installer
 clear_containers     inactive       Intel(R) Clear Containers configuration
 cobbler   inactive       
 collectd  inactive       Collectd config collector
 conntrackdinactive       conntrackd - netfilter connection tracking user-space daemon
 corosync  inactive       Corosync cluster engine
 ctdb      inactive       Samba Clustered TDB
 cups      inactive       CUPS IPP print service
 dhcp      inactive       DHCP daemon
 dlm       inactive       DLM (Distributed lock manager)
 dmraid    inactive       dmraid software RAID
 docker    inactive       Docker containers
 dovecot   inactive       dovecot server related information for Debian based distribution
 elastic   inactive       ElasticSearch service
 gdm       inactive       GNOME display manager
 gfs2      inactive       GFS2 (Global Filesystem 2)
 grub      inactive       GRUB bootloader
 grub2     inactive       GRUB2 bootloader
 haproxy   inactive       HAProxy load balancer
 hpasm     inactive       HP Advanced Server Management
 infinibandinactive       Infiniband data
 ipmitool  inactive       IpmiTool hardware information.
 iprconfig inactive       IBM Power RAID storage adapter configuration information
 ipsec     inactive       Internet protocol security
 ipvs      inactive       Linux IP virtual server
 iscsitarget          inactive       iSCSI target
 juju      inactive       Juju orchestration tool
 kata_containers      inactive       Kata Containers configuration
 kdump     inactive       Kdump crash dumps
 kimchi    inactive       kimchi-related information
 krb5      inactive       Kerberos authentication
 kvm       inactive       Kernel virtual machine
 landscape inactive       Ubuntu Landscape client
 ldap      inactive       LDAP configuration
 lightdm   inactive       Light Display Manager
 lilo      inactive       Lilo bootloader
 lstopo    inactive       lstopo / machine topology/numa node information
 maas      inactive       Ubuntu Metal-As-A-Service
 memcached inactive       memcached distributed memory caching system
 mongodb   inactive       MongoDB document database
 mpt       inactive       LSI Message Passing Technology
 named     inactive       BIND named server
 networkmanager       inactive       NetworkManager service configuration
 nfs       inactive       Network file system information
 nfsganeshainactive       NFS-Ganesha file server information
 nis       inactive       Network information service
 nodejs    inactive       Ubuntu/Debian require nodejs-legacy package in order to
    have a node executable
 npm       inactive       Get info about available npm modules
 nscd      inactive       Name service caching daemon
 nss       inactive       Network Security Services configuration
 ntp       inactive       Network time protocol
 numa      inactive       NUMA state and configuration
 nvme      inactive       Collect config and system information about NVMe devices
 omsa      inactive       Dell OpenManage Server Administrator (OMSA)
 opencl    inactive       OpenCL
 opengl    inactive       OpenGL
 openstack_ansible    inactive       OpenStack-Ansible sos plugin.
 openstack_ceilometer inactive       Openstack Ceilometer
 openstack_cinder     inactive       OpenStack cinder
 openstack_glance     inactive       OpenStack Glance
 openstack_heat       inactive       OpenStack Heat
 openstack_horizon    inactive       OpenStack Horizon
 openstack_ironic     inactive       OpenStack Ironic
 openstack_keystone   inactive       OpenStack Keystone
 openstack_manila     inactive       OpenStackManila related information for Debian based distributions.
 openstack_neutron    inactive       OpenStack Networking
 openstack_nova       inactive       OpenStack Nova
 openstack_octavia    inactive       Openstack Octavia
 openstack_sahara     inactive       OpenStackSahara related information for Debian based distributions.
 openstack_swift      inactive       OpenStack Swift
 openstack_trove      inactive       OpenStack Trove
 openswan  inactive       Openswan IPsec
 openvswitch          inactive       OpenVSwitch networking
 os_net_config        inactive       OpenStack Net Config
 ovn_central          inactive       OVN Northd
 ovn_host  inactive       OVN Controller
 pacemaker inactive       Pacemaker high-availability cluster resource manager
 pcp       inactive       Performance Co-Pilot data
 postfix   inactive       Postfix smtp server
 postgresqlinactive       PostgreSQL RDBMS
 powerpc   inactive       IBM Power systems
 ppp       inactive       Point-to-point protocol
 acct      inactive       Process accounting information
 ptp       inactive       Precision time protocol
 puppet    inactive       Puppet service
 pxe       inactive       PXE service
 python    inactive       Python runtime
 rabbitmq  inactive       RabbitMQ messaging service
 radius    inactive       RADIUS service information
 s390      inactive       IBM S/390
 salt      inactive       Salt
 saltmasterinactive       Salt Master
 samba     inactive       Samba Windows interoperability
 sar       inactive       System Activity Reporter
 sas3ircu  inactive       SAS-3 Integrated RAID adapter information
 sendmail  inactive       sendmail service
 snmp      inactive       Simple network management protocol
 squid     inactive       Squid caching proxy
 sssd      inactive       System security service daemon
 storageconsole       inactive       Red Hat Storage Console
 sunrpc    inactive       Sun RPC service
 systemtap inactive       SystemTap dynamic instrumentation
 targetcli inactive       TargetCLI TCM/LIO configuration
 teamd     inactive       Network interface teaming
 unity     inactive       Unity
 upstart   inactive       Upstart init system
 virsh     inactive       client for libvirt virtualization API
 vulkan    inactive       Vulkan
 xinetd    inactive       xinetd information
 zfs       inactive       ZFS filesystem

The following plugin options are available:

 apache.log     off  gathers all apache logs
 boot.all-imagesoff  collect lsinitrd for all images
 filesys.lsof   off  gathers information on all open files
 filesys.dumpe2fs          off  dump filesystem information
 filesys.frag   off  filesystem fragmentation status
 kernel.with-timer         off  gather /proc/timer* statistics
 libraries.ldconfigv       off  collect verbose ldconfig output
 lvm2.lvmdump   off  collect an lvmdump tarball
 lvm2.lvmdump-amoff  attempt to collect an lvmdump with advanced options and raw metadata collection
 mysql.dbuser   mysqlusername for database dumps
 mysql.dbpass   off  password for database dumps (password visible in process listings)
 mysql.dbdump   off  collect a database dump
 networking.traceroute     off  collect a traceroute to www.example.com
 process.lsof-threads      off  gathers threads' open file info if supported
 services.servicestatus    off  get a status of all running services

 Profiles: boot, container, debug, desktop, hardware, identity, java, 
kernel, memory, network, openshift, packagemanager, perl, 
security, services, storage, sysmgmt, system, virt, 
webserver

 20 profiles, 58 plugins


Jika Anda ingin membuat sosreport hanya untuk plugin tertentu, misal apache, jalankan perintah berikut:

sosreport -o apache --batch

Anda akan melihat output berikut:

sosreport (version 3.5)

This command will collect system configuration and diagnostic
information from this Ubuntu system. An archive containing the collected
information will be generated in /tmp/sos.uwazci0o.

For more information on Ubuntu visit:

  http://www.ubuntu.com/

The generated archive may contain data considered sensitive and its
content should be reviewed by the originating organization before being
passed to any third party.

No changes will be made to system configuration.


 Setting up archive ...
 Setting up plugins ...
 Running plugins. Please wait ...

  Running 1/1: apache...        

Creating compressed archive...

Your sosreport has been generated and saved in:
  /tmp/sosreport-ubuntu1804-20190130103921.tar.xz

The checksum is: 27dea53416ae1fae56ad4448a5cf6189

Please send this file to your support representative.

Perintah di atas akan menghasilkan sosreport untuk apache dan menyimpannya di file :  /tmp/sosreport-ubuntu1804-20190130103921.tar.xz.

Anda dapat mengekstrak file tar dengan perintah berikut:

tar -xvf /tmp/sosreport-ubuntu1804-20190130103921.tar.xz

Sekarang, masuk ke direktori sosreport-ubuntu1804-20190130103921 dengan perintah berikut:

cd sosreport-ubuntu1804-20190130103821

Selanjutnya, jalankan perintah berikut untuk list semua file yang dihasilkan oleh sosreport:

tree

Output:

.
??? etc
?   ??? apache2
?       ??? apache2.conf
?       ??? conf-available
?       ?   ??? charset.conf
?       ?   ??? javascript-common.conf
?       ?   ??? localized-error-pages.conf
?       ?   ??? other-vhosts-access-log.conf
?       ?   ??? security.conf
?       ?   ??? serve-cgi-bin.conf
?       ??? conf-enabled
?       ?   ??? charset.conf -> ../conf-available/charset.conf
?       ?   ??? localized-error-pages.conf -> ../conf-available/localized-error-pages.conf
?       ?   ??? other-vhosts-access-log.conf -> ../conf-available/other-vhosts-access-log.conf
?       ?   ??? security.conf -> ../conf-available/security.conf
?       ?   ??? serve-cgi-bin.conf -> ../conf-available/serve-cgi-bin.conf
?       ??? envvars
?       ??? magic
?       ??? mods-available
?       ?   ??? access_compat.load
?       ?   ??? actions.conf
?       ?   ??? actions.load
?       ?   ??? alias.conf
?       ?   ??? alias.load
?       ?   ??? allowmethods.load
?       ?   ??? asis.load
?       ?   ??? auth_basic.load
?       ?   ??? auth_digest.load
?       ?   ??? auth_form.load
?       ?   ??? authn_anon.load
?       ?   ??? authn_core.load
?       ?   ??? authn_dbd.load
?       ?   ??? authn_dbm.load
?       ?   ??? authn_file.load
?       ?   ??? authn_socache.load
?       ?   ??? authnz_fcgi.load
?       ?   ??? authnz_ldap.load
?       ?   ??? authz_core.load
?       ?   ??? authz_dbd.load
?       ?   ??? authz_dbm.load
?       ?   ??? authz_groupfile.load
?       ?   ??? authz_host.load
?       ?   ??? authz_owner.load
?       ?   ??? authz_user.load
?       ?   ??? autoindex.conf
?       ?   ??? autoindex.load
?       ?   ??? buffer.load
?       ?   ??? cache_disk.conf
?       ?   ??? cache_disk.load
?       ?   ??? cache.load
?       ?   ??? cache_socache.load
?       ?   ??? cern_meta.load
?       ?   ??? cgid.conf
?       ?   ??? cgid.load
?       ?   ??? cgi.load
?       ?   ??? charset_lite.load
?       ?   ??? data.load
?       ?   ??? dav_fs.conf
?       ?   ??? dav_fs.load
?       ?   ??? dav.load
?       ?   ??? dav_lock.load
?       ?   ??? dbd.load
?       ?   ??? deflate.conf
?       ?   ??? deflate.load
?       ?   ??? dialup.load
?       ?   ??? dir.conf
?       ?   ??? dir.load
?       ?   ??? dump_io.load
?       ?   ??? echo.load
?       ?   ??? env.load
?       ?   ??? expires.load
?       ?   ??? ext_filter.load
?       ?   ??? file_cache.load
?       ?   ??? filter.load
?       ?   ??? headers.load
?       ?   ??? heartbeat.load
?       ?   ??? heartmonitor.load
?       ?   ??? http2.load
?       ?   ??? ident.load
?       ?   ??? imagemap.load
?       ?   ??? include.load
?       ?   ??? info.conf
?       ?   ??? info.load
?       ?   ??? lbmethod_bybusyness.load
?       ?   ??? lbmethod_byrequests.load
?       ?   ??? lbmethod_bytraffic.load
?       ?   ??? lbmethod_heartbeat.load
?       ?   ??? ldap.conf
?       ?   ??? ldap.load
?       ?   ??? log_debug.load
?       ?   ??? log_forensic.load
?       ?   ??? lua.load
?       ?   ??? macro.load
?       ?   ??? mime.conf
?       ?   ??? mime.load
?       ?   ??? mime_magic.conf
?       ?   ??? mime_magic.load
?       ?   ??? mpm_event.conf
?       ?   ??? mpm_event.load
?       ?   ??? mpm_prefork.conf
?       ?   ??? mpm_prefork.load
?       ?   ??? mpm_worker.conf
?       ?   ??? mpm_worker.load
?       ?   ??? negotiation.conf
?       ?   ??? negotiation.load
?       ?   ??? proxy_ajp.load
?       ?   ??? proxy_balancer.conf
?       ?   ??? proxy_balancer.load
?       ?   ??? proxy.conf
?       ?   ??? proxy_connect.load
?       ?   ??? proxy_express.load
?       ?   ??? proxy_fcgi.load
?       ?   ??? proxy_fdpass.load
?       ?   ??? proxy_ftp.conf
?       ?   ??? proxy_ftp.load
?       ?   ??? proxy_hcheck.load
?       ?   ??? proxy_html.conf
?       ?   ??? proxy_html.load
?       ?   ??? proxy_http2.load
?       ?   ??? proxy_http.load
?       ?   ??? proxy.load
?       ?   ??? proxy_scgi.load
?       ?   ??? proxy_wstunnel.load
?       ?   ??? ratelimit.load
?       ?   ??? reflector.load
?       ?   ??? remoteip.load
?       ?   ??? reqtimeout.conf
?       ?   ??? reqtimeout.load
?       ?   ??? request.load
?       ?   ??? rewrite.load
?       ?   ??? sed.load
?       ?   ??? session_cookie.load
?       ?   ??? session_crypto.load
?       ?   ??? session_dbd.load
?       ?   ??? session.load
?       ?   ??? setenvif.conf
?       ?   ??? setenvif.load
?       ?   ??? slotmem_plain.load
?       ?   ??? slotmem_shm.load
?       ?   ??? socache_dbm.load
?       ?   ??? socache_memcache.load
?       ?   ??? socache_shmcb.load
?       ?   ??? speling.load
?       ?   ??? ssl.conf
?       ?   ??? ssl.load
?       ?   ??? status.conf
?       ?   ??? status.load
?       ?   ??? substitute.load
?       ?   ??? suexec.load
?       ?   ??? unique_id.load
?       ?   ??? userdir.conf
?       ?   ??? userdir.load
?       ?   ??? usertrack.load
?       ?   ??? vhost_alias.load
?       ?   ??? xml2enc.load
?       ??? mods-enabled
?       ?   ??? access_compat.load -> ../mods-available/access_compat.load
?       ?   ??? alias.conf -> ../mods-available/alias.conf
?       ?   ??? alias.load -> ../mods-available/alias.load
?       ?   ??? auth_basic.load -> ../mods-available/auth_basic.load
?       ?   ??? authn_core.load -> ../mods-available/authn_core.load
?       ?   ??? authn_file.load -> ../mods-available/authn_file.load
?       ?   ??? authz_core.load -> ../mods-available/authz_core.load
?       ?   ??? authz_host.load -> ../mods-available/authz_host.load
?       ?   ??? authz_user.load -> ../mods-available/authz_user.load
?       ?   ??? autoindex.conf -> ../mods-available/autoindex.conf
?       ?   ??? autoindex.load -> ../mods-available/autoindex.load
?       ?   ??? deflate.conf -> ../mods-available/deflate.conf
?       ?   ??? deflate.load -> ../mods-available/deflate.load
?       ?   ??? dir.conf -> ../mods-available/dir.conf
?       ?   ??? dir.load -> ../mods-available/dir.load
?       ?   ??? env.load -> ../mods-available/env.load
?       ?   ??? filter.load -> ../mods-available/filter.load
?       ?   ??? mime.conf -> ../mods-available/mime.conf
?       ?   ??? mime.load -> ../mods-available/mime.load
?       ?   ??? mpm_event.conf -> ../mods-available/mpm_event.conf
?       ?   ??? mpm_event.load -> ../mods-available/mpm_event.load
?       ?   ??? negotiation.conf -> ../mods-available/negotiation.conf
?       ?   ??? negotiation.load -> ../mods-available/negotiation.load
?       ?   ??? reqtimeout.conf -> ../mods-available/reqtimeout.conf
?       ?   ??? reqtimeout.load -> ../mods-available/reqtimeout.load
?       ?   ??? setenvif.conf -> ../mods-available/setenvif.conf
?       ?   ??? setenvif.load -> ../mods-available/setenvif.load
?       ?   ??? status.conf -> ../mods-available/status.conf
?       ?   ??? status.load -> ../mods-available/status.load
?       ??? ports.conf
?       ??? sites-available
?       ?   ??? 000-default.conf
?       ?   ??? default-ssl.conf
?       ??? sites-enabled
?           ??? 000-default.conf -> ../sites-available/000-default.conf
??? sos_commands
?   ??? apache
?       ??? apachectl_-M
??? sos_logs
?   ??? sos.log
?   ??? ui.log
??? sos_reports
?   ??? sos.html
?   ??? sos.txt
??? version.txt

12 directories, 189 files

Anda juga dapat melihat berbagai opsi yang tersedia dengan perintah sosreport dengan perintah berikut:

sosreport -h

Anda akan melihat output berikut:

Usage: sosreport [options]

Options:
  -h, --help show this help message and exit
  -l, --list-plugins    list plugins and available plugin options
  -n NOPLUGINS, --skip-plugins=NOPLUGINS
  disable these plugins
  --experimental        enable experimental plugins
  -e ENABLEPLUGINS, --enable-plugins=ENABLEPLUGINS
  enable these plugins
  -o ONLYPLUGINS, --only-plugins=ONLYPLUGINS
  enable these plugins only
  -k PLUGOPTS, --plugin-option=PLUGOPTS
  plugin options in plugname.option=value format (see
  -l)
  --log-size=LOG_SIZE   set a limit on the size of collected logs (in MiB)
  -a, --alloptions      enable all options for loaded plugins
  --all-logs collect all available logs regardless of size
  --batch    batch mode - do not prompt interactively
  --build    preserve the temporary directory and do not package
  results
  -v, --verbose         increase verbosity
  --verify   perform data verification during collection
  --quiet    only print fatal errors
  --debug    enable interactive debugging using the python debugger
  --ticket-number=CASE_ID
  specify ticket number
  --case-id=CASE_ID     specify case identifier
  -p PROFILES, --profile=PROFILES
  enable plugins selected by the given profiles
  --list-profiles       display a list of available profiles and plugins that
  they include
  --name=CUSTOMER_NAME  specify report name
  --config-file=CONFIG_FILE
  specify alternate configuration file
  --tmp-dir=TMP_DIR     specify alternate temporary directory
  --no-reportdisable HTML/XML reporting
  -s SYSROOT, --sysroot=SYSROOT
  system root directory path (default="/")
  -c CHROOT, --chroot=CHROOT
  chroot executed commands to SYSROOT [auto, always,
  never] (default=auto)
  -z COMPRESSION_TYPE, --compression-type=COMPRESSION_TYPE
  compression technology to use [auto, gzip, bzip2, xz]
  (default=auto)

Some examples:

 enable dlm plugin only and collect dlm lockdumps:
   # sosreport -o dlm -k dlm.lockdump

 disable memory and samba plugins, turn off rpm -Va collection:
   # sosreport -n memory,samba -k rpm.rpmva=off

Saya harap Anda sekarang memiliki pengetahuan yang cukup tentang sosreport. Untuk menemukan informasi lebih lanjut lihat halaman manual sosreport dengan mengetik man sosreport di terminal Anda.