Cómo instalar y usar sosreport en Ubuntu 18.04 LTS

Cómo instalar y usar sosreport en Ubuntu 18.04 LTS

SOS es una herramienta de recopilación de datos gratuita y de código abierto que se puede utilizar para recopilar detalles de configuración del sistema e información de diagnóstico de un sistema operativo similar a Unix. Funciona al recopilar la configuración del sistema y la información de registros y archivarlos en un solo archivo. Generalmente se usa para que los ingenieros de soporte técnico encuentren cuál es el problema en el sistema.

En este tutorial, aprenderemos a usar SOS en el servidor Ubuntu 18.04.

Requisitos

  • Un servidor con Ubuntu 18.04.
  • Una contrase√Īa de root est√° configurada para su servidor.

Generar informe Sos

De forma predeterminada, la herramienta SOS est√° disponible en el servidor Ubuntu 18.04. Por lo tanto, no necesita instalarlo en su servidor.

Para recopilar los detalles de configuración de su sistema y otra información de diagnóstico, simplemente ejecute el siguiente comando:

sosreport

Producción:

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.

El comando anterior recopilará la configuración del sistema y la información de diagnóstico de este sistema y la almacenará en el directorio /tmp.

También puede generar sosreport y guardarlo en otra ubicación ejecutando el siguiente comando:

sosreport --tmp-dir /opt

Por defecto, sosreport est√° comprimido en tipo xz. Para comprimir sosreport en gzip con el siguiente comando:

sosreport --compression-type gzip

Generar sosreport para complementos específicos

De forma predeterminada, sosreport viene con muchos complementos. Puede enumerar todos los complementos con el siguiente comando:

sosreport -l

Debería ver el siguiente resultado:

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
 networking           network 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
 conntrackd           inactive       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
 infiniband           inactive       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
 nfsganesha           inactive       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
 postgresql           inactive       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
 saltmaster           inactive       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-images           off             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-am           off             attempt to collect an lvmdump with advanced options and raw metadata collection
 mysql.dbuser              mysql           username 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

Si desea generar sosreport solo para complementos específicos como apache, ejecute el siguiente comando:

sosreport -o apache --batch

Debería ver el siguiente resultado:

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-20190130103821.tar.xz

The checksum is: 27dea53416ae1fae56ad4448a5cf6189

Please send this file to your support representative.

El comando anterior generar√° sosreport para apache y lo guardar√° en el archivo /tmp/sosreport-ubuntu1804-20190130103821.tar.xz.

Puede extraer el archivo con el siguiente comando:

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

Ahora, cambie el directorio a sosreport-ubuntu1804-20190130103821 con el siguiente comando:

cd sosreport-ubuntu1804-20190130103821

A continuación, ejecute el siguiente comando para enumerar todos los archivos generados por sosreport:

tree

Producción:

.
??? 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

También puede ver diferentes opciones disponibles con el comando sosreport con el siguiente comando:

sosreport -h

Debería ver el siguiente resultado:

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-report           disable 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

Eso es todo. Espero que ahora tenga suficiente conocimiento sobre sosreport. Para obtener más información, consulte la página man de sosreport.

Deja una respuesta

Tu dirección de correo electrónico no será publicada. Los campos obligatorios están marcados con *