您现在的位置是:网站首页> 编程资料编程资料
Linux中安装sosreport和supportconfig来收集系统信息_LINUX_操作系统_
2024-01-20
330人已围观
简介 Linux中安装sosreport和supportconfig来收集系统信息_LINUX_操作系统_
sosreport
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
从配置文件上可以看出,sosreport同样将收集的结果上传到server 上,可以通过man sos.conf 查看配置文件的帮助信息,不过man给出的并没有太多信息,想在了解更多的信息可以查看 sosreport在github上的wiki页 。
四、sosreport总结
相于supportconfig,由于sosreport是由python语言进行编写的,所以其在功能扩展上更有优势,但由于在不同的发行版本上的python版本不同,在进行功能扩展时,对不同版本间的异常处理相对麻烦。而supportconfig由于是shell 语言编写的一个工具,对版本的依赖相对少些 ,但对一些工具的依赖相对多些 ,如在获取进程相关的信息时,shell 需要将ps 工具或处理proc的结果,而sosreport则可以直接import psutil 模块,两者之间的区别,归根到底就是shell 和python的区别。
supportconfig
一、supportconfig的安装
可以通过yast进行安装,也可以通过zypper命令进行安装,安装命令如下:
直接使用源进行安装
也可以将rpm包下载下来使用yast进行安装或者在yast的管理界面里查找安装
注:根据系统的版本不同,包名也可能是supportconfig 。
安装完成后可以使用rpm -ql supportutils 查看包中具体包含的文件信息,如下:
# rpm -ql supportutils
/etc/schealth.conf
/etc/supportconfig.conf
/sbin/chkbin
/sbin/supportconfig
/usr/bin/schealth
/usr/share/man/man5/supportconfig.conf.5.gz
/usr/share/man/man8/chkbin.8.gz
/usr/share/man/man8/supportconfig.8.gz
注:上面的结果是在 suse11 sp1企业版上的测试的结果,在opensuse 13上目录结构会略有不同,其上使用的是新版本的supportconfig。
二、supportconfig用法
以下是supportconfig的帮助输出
# supportconfig -h
=============================================================================
Support Utilities - Supportconfig
Script Version: 2.25-197
Script Date: 2010 04 02
=============================================================================
Usage: supportconfig [OPTION [OPTION ...]]
-h This screen
-A Activates all supportconfig functions with additional logging and full
rpm verification.
-B
-C Creates a new default /etc/supportconfig.conf
-D Use defaults; ignore /etc/supportconfig.conf
-E
-F Display available supportconfig feature keywords (case-sensitive) used
with -i and -x
-G
-H
-I
-L Create a full file listing from '/'
-M
-N
-O
-P
-Q Run in silent mode
-R
-S
-T
-U
services include: ftp, scp, http, https
-M
-X
-a Upload the tar ball to the specified alternate target VAR_OPTION_UPLOAD_ALT
-b Screen buffer mode
-d Exclude detailed disk info and scans
-e Search root file system for eDirectory instances; -L implied. Be patient.
-f From directory. Don't collect report files, just use files in that
directory.
-g Use gzip instead of the default bzip2 compression.
-i
Include keywords. A comma separated list of feature keywords that specify
which features to include. Use -F to see a list of valid keywords.
-l Gathers additional rotated logs
-m Only gather a minimum amount of info: basic env, basic health, hardware,
rpm, messages, y2logs
-o Toggle listed features on or off
-p Disable all plugins
-q Add a uuid to the tar ball filename to ensure uniqueness
-r
Includes the Novell 11 digit service request number when uploading
the tar ball to Novell
-s Include full SLP service lists
-t Target directory. Just save log files here, do not create tarball.
-u Upload the tar ball to the specified VAR_OPTION_UPLOAD_TARGET.
-v Performs an rpm -V for each installed rpm NOTE: This takes a long time
to complete
-x
Exclude keywords. A comma separated list of feature keywords that specify
which features to exclude. Use -F to see a list of valid keywords.
-y Only gather the minimum y2log files.
Use Ctrl- to try an
相关内容
- Linux系统下将txt转换为mobi格式电子书的方法_LINUX_操作系统_
- Linux环境中远程开启ssh端口和更改ssh用户根目录_LINUX_操作系统_
- SWAT—Samba WEB管理工具介绍_LINUX_操作系统_
- Linux系统的电脑上调整屏幕亮度的方法_LINUX_操作系统_
- 乱斗西游地藏菩萨阵容搭配装备属性全面攻略_手机游戏_游戏攻略_
- 刀塔传奇树精卫士属性技能详细分析_手机游戏_游戏攻略_
- 刀塔传奇剑圣觉醒阵容搭配推荐_手机游戏_游戏攻略_
- 刀塔传奇凤凰阵容搭配推荐_手机游戏_游戏攻略_
- 乱斗西游阎王搭配地藏效果详解_手机游戏_游戏攻略_
- 刀塔传奇猴子全面分析 我是万金油_手机游戏_游戏攻略_
点击排行
本栏推荐
