Linux基础命令-sosreport
一、sosreport的安装
在默认使用linux发行版的源进行安装时,由于在不同的系统上包名称也会有差异,所以使用的命令也不同,如redhat和ubuntu平台的安装如下:
1 // redhat/centos下的安装
2 # yum -y insatll sos
3 // ubuntu下的安装
4 # sudo apt-get install sosreport
二、sosreport用法
可以使用sosreport --help或man sosreport 获取使用帮助手册,如下:
1 [root@361way ~]# sosreport --help
2 Usage: sosreport [options]
3 Options:
4 -h, --help show this help message and exit
5 -l, --list-plugins list plugins and available plugin options
6 -n NOPLUGINS, --skip-plugins=NOPLUGINS
7 disable these plugins
8 -e ENABLEPLUGINS, --enable-plugins=ENABLEPLUGINS
9 enable these plugins
10 -o ONLYPLUGINS, --only-plugins=ONLYPLUGINS
11 enable these plugins only
12 -k PLUGOPTS, --plugin-option=PLUGOPTS
13 plugin options in plugname.option=value format (see
14 -l)
15 -a, --alloptions enable all options for loaded plugins
16 --batch batch mode - do not prompt interactively
17 --build keep sos tree available and dont package results
18 -v, --verbose increase verbosity
19 --quiet only print fatal errors
20 --debug enable interactive debugging using the python debugger
21 --ticket-number=TICKET_NUMBER
22 specify ticket number
23 --name=CUSTOMER_NAME specify report name
24 --config-file=CONFIG_FILE
25 specify alternate configuration file
26 --tmp-dir=TMP_DIR specify alternate temporary directory
27 --report Enable HTML/XML reporting
28 --profile turn on profiling
29 -z COMPRESSION_TYPE, --compression-type=COMPRESSION_TYPE
30 compression technology to use [auto, zip, gzip, bzip2,
31 xz] (default=auto)
32 Some examples:
33 enable cluster plugin only and collect dlm lockdumps:
34 # sosreport -o cluster -k cluster.lockdump
35 disable memory and samba plugins, turn off rpm -Va collection:
36 # sosreport -n memory,samba -k rpm.rpmva=off
上面也列出了具体操作的示例。其中-l 参数会列出当前enable和disable的所有服务插件及当前available的所有插件。
1 [root@361way log]# sosreport -a --report
2
3 sosreport (version 3.0)
4
5 This command will collect diagnostic and configuration information from
6
7 this CentOS Linux system and installed applications.
8
9 An archive containing the collected information will be generated in
10
11 /var/tmp and may be provided to a CentOS support representative.
12
13 Any information provided to CentOS will be treated in accordance with
14
15 the published support policies at:
16
17 https://www.centos.org/
18
19
20 The generated archive may contain data considered sensitive and its
21
22 content should be reviewed by the originating organization before being
23
24 passed to any third party.
25
26 No changes will be made to system configuration.
27
28 Press ENTER to continue, or CTRL-C to quit.
29
30 Please enter your first initial and last name [361way.com]:
31
32 Please enter the case number that you are generating this report for:
33
34 Running plugins. Please wait ...
35
36 Running 68/68: yum...
37
38 Creating compressed archive...
39
40 Your sosreport has been generated and saved in:
41
42 /var/tmp/sosreport-361way.com-20140912204339.tar.xz
43
44 The checksum is: eaf5b2cbb1e9be68d41be5e5a60a61b6
45
46 Please send this file to your support representative.
如上所示,我使用-A 启用所有的模块,--report是开启所有的结果以html /xml 的格式一个总的报告。生成的包需要通过下面的命令进行解包。
1 # xz -d ***.tar.xz
2 # tar -xvf ***.tar
3 或直接使用下面的命令一步完成解压
4 tar xvJf ***.tar.xz
在解包后的sos_reports 目录会有report的结果sos.html文件生成,同时会有sos.txt文件生成,该文件内列出了具体执行的命令及copy 文件的一些信息。html 打开的内容如下:
由于页面较大,这里只截出了最上面的部分,列出了所有的收集模块,下面alerts 给出了报警模块的信息。再往下就是具体到每一个模块的信息。
三、sosreport配置文件
sosreport的配置文件是/etc/sos.conf ,默认内容如下:
1 [root@361way ~]# cat /etc/sos.conf
2 [general]
3 #ftp_upload_url = ftp://example.com/incoming
4 #gpg_keyring = /usr/share/sos/rhsupport.pub
5 #gpg_recipient = support@redhat.com
6 smtp_server = None
7 [plugins] //此处可以设置默认enable和disable的模块
8 #disable = rpm, selinux, dovecot
9 [tunables] //可调参数
10 #rpm.rpmva = off
11 #general.syslogsize = 15
从配置文件上可以看出,sosreport同样将收集的结果上传到server 上,可以通过man sos.conf 查看配置文件的帮助信息,不过man给出的并没有太多信息,想在了解更多的信息可以查看 sosreport在github上的wiki页 。
四、sosreport总结
相于supportconfig,由于sosreport是由python语言进行编写的,所以其在功能扩展上更有优势,但由于在不同的发行版本上的python版本不同,在进行功能扩展时,对不同版本间的异常处理相对麻烦。而supportconfig由于是shell 语言编写的一个工具,对版本的依赖相对少些 ,但对一些工具的依赖相对多些 ,如在获取进程相关的信息时,shell 需要将ps 工具或处理proc的结果,而sosreport则可以直接import psutil 模块,两者之间的区别,归根到底就是shell 和python的区别。
最新发布
-
试析新闻框架的层次与类型
2025-07-11 16:26:05 -
相机一般快门寿命是多少钱(佳能m6快门寿命?)
2025-07-04 16:38:34 -
大专选择什么专业前景好?2025年专科生选专业避坑指南
2025-07-27 18:19:25 -
京东白条人工客服电话多少?怎么联系人工客服?
2025-06-08 17:42:33 -
闲鱼买东西发货时间有规定吗?闲鱼发货最晚可以几天
2025-07-24 23:03:35 -
探究古代宫廷中真实的冷宫,真实面貌是什么样的?
2025-07-28 00:44:46 -
书旗小说怎么写作 书旗小说创作小说步骤一览
2025-07-03 13:13:40 -
精子在哪里储存
2025-08-03 11:28:34 -
合肥联想厂上班怎么样(合肥联想公司怎么样)
2025-07-13 11:27:15 -
全球女排世界杯赛事直播 女排精彩对决实时呈现助力球迷热情激增2025-05-30 11:15:40返回列表
2025-05-30 16:05:49