久久96国产精品久久久-久久发布国产伦子伦精品-久久精品国产精品青草-久久天天躁夜夜躁狠狠85麻豆

技術員聯盟提供win764位系統下載,win10,win7,xp,裝機純凈版,64位旗艦版,綠色軟件,免費軟件下載基地!

當前位置:主頁 > 教程 > 服務器類 >

Linux中安裝sosreport和supportconfig來收集系統信息

來源:技術員聯盟┆發布時間:2018-02-23 00:07┆點擊:

  sosreport是一個類型于supportconfig 的工具,sosreport是python編寫的一個工具,適用于centos(和redhat一樣,包名為sos)、ubuntu(其下包名為sosreport)等大多數版本的linux 。sosreport在github上的托管頁面為:https://github.com/sosreport/sos ,而且默認在很多系統的源里都已經集成有。如果使用的是正版redhat,在出現系統問題,尋求官方支持時,官方一般也會通過sosreport將收集的信息進行分析查看。需要注意的是在一些老的redhat發行版中叫sysreport ------ 如redhat4.5之前的版本中。

  一、sosreport的安裝

  在默認使用linux發行版的源進行安裝時,由于在不同的系統上包名稱也會有差異,所以使用的命令也不同,如redhat和ubuntu平臺的安裝如下:

  代碼如下:

  // redhat/centos下的安裝

  # yum -y insatll sos

  // ubuntu下的安裝

  # sudo apt-get install sosreport

  二、sosreport用法

  可以使用sosreport --help或man sosreport 獲取使用幫助手冊,如下:

  代碼如下:

  [root@361way ~]# sosreport --help

  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

  -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)

  -a, --alloptions enable all options for loaded plugins

  --batch batch mode - do not prompt interactively

  --build keep sos tree available and dont package results

  -v, --verbose increase verbosity

  --quiet only print fatal errors

  --debug enable interactive debugging using the python debugger

  --ticket-number=TICKET_NUMBER

  specify ticket number

  --name=CUSTOMER_NAME specify report name

  --config-file=CONFIG_FILE

  specify alternate configuration file

  --tmp-dir=TMP_DIR specify alternate temporary directory

  --report Enable HTML/XML reporting

  --profile turn on profiling

  -z COMPRESSION_TYPE, --compression-type=COMPRESSION_TYPE

  compression technology to use [auto, zip, gzip, bzip2,

  xz] (default=auto)

  Some examples:

  enable cluster plugin only and collect dlm lockdumps:

  # sosreport -o cluster -k cluster.lockdump

  disable memory and samba plugins, turn off rpm -Va collection:

  # sosreport -n memory,samba -k rpm.rpmva=off

  上面也列出了具體操作的示例。其中-l 參數會列出當前enable和disable的所有服務插件及當前available的所有插件。

  代碼如下:

  [root@361way log]# sosreport -a --report

  sosreport (version 3.0)

  This command will collect diagnostic and configuration information from

  this CentOS Linux system and installed applications.

  An archive containing the collected information will be generated in

  /var/tmp and may be provided to a CentOS support representative.

  Any information provided to CentOS will be treated in accordance with

  the published support policies at:

  https://www.centos.org/

  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 [361way.com]:

  Please enter the case number that you are generating this report for:

  Running plugins. Please wait ...

  Running 68/68: yum...

  Creating compressed archive...

  Your sosreport has been generated and saved in:

  /var/tmp/sosreport-361way.com-20140912204339.tar.xz

  The checksum is: eaf5b2cbb1e9be68d41be5e5a60a61b6

  Please send this file to your support representative.

  如上所示,我使用-A 啟用所有的模塊,--report是開啟所有的結果以html /xml 的格式一個總的報告。生成的包需要通過下面的命令進行解包。

  代碼如下:

  # xz -d ***.tar.xz

  # tar -xvf ***.tar

  或直接使用下面的命令一步完成解壓

  代碼如下:

  tar xvJf ***.tar.xz

  在解包后的sos_reports 目錄會有report的結果sos.html文件生成,同時會有sos.txt文件生成,該文件內列出了具體執行的命令及copy 文件的一些信息。

  由于頁面較大,這里只截出了最上面的部分,列出了所有的收集模塊,下面alerts 給出了報警模塊的信息。再往下就是具體到每一個模塊的信息。

  三、sosreport配置文件

  sosreport的配置文件是/etc/sos.conf ,默認內容如下:

  代碼如下:

  [root@361way ~]# cat /etc/sos.conf

  [general]

  #ftp_upload_url = ftp://example.com/incoming

  #gpg_keyring = /usr/share/sos/rhsupport.pub

  #gpg_recipient = support@redhat.com

  smtp_server = None

  [plugins] //此處可以設置默認enable和disable的模塊

  #disable = rpm, selinux, dovecot

  [tunables] //可調參數

  #rpm.rpmva = off

  #general.syslogsize = 15