Linux巡检利器xsos的安装和使用

一、

一般项目基本完成的时候,后期运维工作的重点就是及时的,合理的频率巡检了,巡检的目的主要是及时发现各种各样的问题

那么,自己编写shell脚本是大部分人的第一选择,这里有个比较麻烦的地方,shell脚本可能巡检的指标不够全面,以及shell脚本难以编写的问题

🆗,这里我推荐大家使用xsos这个软件来简化巡检的工作,很多巡检工作可以使用此工具代替了

二、

xsos的下载地址

https://codeload.github.com/ryran/xsos/tar.gz/refs/tags/v0.7.33

下载完毕后,解压,将xsos这个可执行文件移动到/usr/local/bin/目录下并赋予执行权限即可使用,此软件无需任何依赖,无需任何动态链接库,可以直接使用,非常nice的,主要因为它是其实是一个写的非常长的shell脚本!!!!!!!!!!!!!!!!(有4000多行)

[root@centos7 xsos-0.7.33]# ldd /usr/local/bin/xsos not a dynamic executable
[root@centos7 xsos-0.7.33]# file /usr/local/bin/xsos 
/usr/local/bin/xsos: Bourne-Again shell script, UTF-8 Unicode text executable, with very long lines

 

三、

此软件下载只能在github,其它地方没有发现,需要指出的是,此软件和sosreport这个软件比较类似,是可以基于sosreport命令运行所产生的文件来工作的,当然,xsos单独也是可以工作的

单独运行此软件:

1、获取系统的信息和内存信息

xsos --os --mem

输出如下:

OSHostname: centos7Distro:   [redhat-release] CentOS Linux release 7.7.1908 (Core)[centos-release] CentOS Linux release 7.7.1908 (Core)[os-release] CentOS Linux 7 (Core) 7 (Core)RHN:      (missing)RHSM:     (missing)YUM:      2 enabled plugins: fastestmirror, langpacksRunlevel: N 3  (default multi-user)SELinux:  disabled  (default disabled)Arch:     mach=x86_64  cpu=x86_64  platform=x86_64Kernel:Booted kernel:  3.10.0-1062.el7.x86_64GRUB default:   3.10.0-1062.el7.x86_64  Build version:Linux version 3.10.0-1062.el7.x86_64 (mockbuild@kbuilder.bsys.centos.org) (gcc version 4.8.5 20150623 (Red Hat 4.8.5-36) (GCC) ) #1 SMP Wed Aug 7 18:08:02 UTC 2019Booted kernel cmdline:root=/dev/mapper/centos-root ro rd.lvm.lv=centos/root rhgb quiet LANG=en_US.UTF-8GRUB default kernel cmdline:  root=/dev/mapper/centos-root ro rd.lvm.lv=centos/root rhgb quiet LANG=en_US.UTF-8Taint-check: 0  (kernel untainted)- - - - - - - - - - - - - - - - - - -Sys time:  Thu Oct 24 22:28:00 CST 2024Boot time: Thu Oct 24 16:22:10 CST 2024  (epoch: 1729758130)Time Zone: Asia/ShanghaiUptime:    6:05,  2 usersLoadAvg:   [4 CPU] 0.07 (2%), 0.07 (2%), 0.06 (2%)/proc/stat:procs_running: 1   procs_blocked: 0    processes [Since boot]: 19286cpu [Utilization since boot]:us 0%, ni 0%, sys 0%, idle 100%, iowait 0%, irq 0%, sftirq 0%, steal 0%MEMORYStats graphed as percent of MemTotal:MemUsed    ▊▊▊▊▊▊▊▊▊.........................................  17.3%Buffers    ..................................................   0.2%Cached     ▊▊▊▊▊.............................................  10.7%HugePages  ..................................................   0.0%Dirty      ..................................................   0.0%RAM:3.9 GiB total ram0.7 GiB (17%) used0.2 GiB (6%) used excluding Buffers/Cached0 GiB (0%) dirtyHugePages:No ram pre-allocated to HugePagesTHP:0.01 GiB allocated to THP LowMem/Slab/PageTables/Shmem:0.11 GiB (3%) of total ram used for Slab0 GiB (0%) of total ram used for PageTables0.01 GiB (0%) of total ram used for ShmemSwap:No system swap space configured

2、

获取系统的cpu,主板以及网络相关信息

xsos --cpu --lspci --net

输出如下:

[root@centos7 xsos-0.7.33]# xsos --cpu --lspci --net
CPU4 logical processors (4 CPU cores)2 13th Gen Intel Core i7-13700KF (flags: aes,constant_tsc,ht,lm,nx,pae,rdrand,vmx) └─2 threads / 2 cores eachLSPCINet:(1) Advanced Micro Devices, Inc. [AMD] 79c970 [PCnet32 LANCE] (rev 10)Storage:(1) VMware SATA AHCI controllerVGA:VMware SVGA II AdapterETHTOOLInterface Status:ens33  0000:02:01.0  link=up  rx ring 32/512  drv pcnet32 v1.35 / fw UNKNOWNInterface Errors:[None]SOFTIRQBacklog max is sufficient (Current value: net.core.netdev_max_backlog = 1000)Budget is not sufficient, consider reviewing budget tunable. (Current value: net.core.netdev_budget = 300)(see https://access.redhat.com/solutions/1241943)NETDEVInterface  RxMiBytes  RxPackets  RxErrs   RxDrop  RxFifo  RxComp  RxFrame  RxMultCast=========  =========  =========  ======   ======  ======  ======  =======  ==========ens33      11         11 k       11 (0%)  6 (0%)  0       0       0        0 - - - - - - - - - - - - - - - - -Interface  TxMiBytes  TxPackets  TxErrs   TxDrop  TxFifo  TxComp  TxColls  TxCarrier =========  =========  =========  ======   ======  ======  ======  =======  ==========ens33      1          5 k        0        0       0       0       0        0 SOCKSTATsockets: used 189TCP: inuse 4 orphan 0 tw 0 alloc 6 mem 5UDP: inuse 0 mem 0UDPLITE: inuse 0RAW: inuse 0FRAG: inuse 0 memory 0IP4Interface  Master IF  MAC Address        MTU     State  IPv4 Address=========  =========  =================  ======  =====  ==================lo         -          -                  65536   up     127.0.0.1/8ens33      -          00:0c:29:90:91:4e  1500    up     192.168.123.17/24SS CHECKSessions:lost reord_seen back_log retrans_total rq tq sock_drop app_limited dsack_dups %CPU %MEM Proto User Local Command Peer ---- ---------- -------- ------------- -- -- --------- ----------- ---------- ---- ----- ---- ----- ---- ---- ------- FIREWALLServices enabled:No firewall services enabled.Rules loaded:No rules loaded.
IFCFGServices enabled:FILE         TYPE      DEVICE  NAME      HWADDR  ONBOOT  DEFROUTE  GATEWAY        NM_CONTROLLED  BOND/TEAM  MASTER  BRIDGE  ETHTOOL  PHYSDEV  PEERDNS  ZONE  MTUifcfg-ens33  Ethernet  ens33   ens33     -       yes     yes       192.168.123.2  -              -          -       -       -        -        -        -     -    ifcfg-lo     -         lo      loopback  -       yes     -         -              -              -          -       -       -        -        -        -     -    
NET STATSTcp.EstabResets:                            2TcpExt.DelayedACKs:                        40TcpExt.TCPLossProbeRecovery:                3TcpExt.TCPLossProbes:                       3TcpExt.TCPLossUndo:                         1TcpExt.TCPTimeouts:                         1

3、

常用方式

Content options:-a, --all      show everything-b, --bios     show info from dmidecode-o, --os       show hostname, distro, SELinux, kernel info, uptime, etc-k, --kdump    inspect kdump configuration-c, --cpu      show info from /proc/cpuinfo-m, --mem      show info from /proc/meminfo-d, --disks    show info from /proc/partitions + dm-multipath synopsis-t, --mpath    show info from dm-multipath-l, --lspci    show info from lspci-e, --ethtool  show info from ethtool-r, --softirq  show info from /proc/net/softnet_stat-n, --netdev   show info from /proc/net/dev-g, --bonding  show info from /proc/net/bonding-i, --ip       show info from ip addr (BASH v4+ required)--net      alias for: --lspci --ethtool --softirq --netdev --bonding --ip-s, --sysctl   show important kernel sysctls-p, --ps       inspect running processes via psDisplay options:--scrub-ip     remove IP addresses & hostnames from output--scrub-mac    remove HW MAC addresses from outputsee XSOS_SCRUB_IP_HN & XSOS_SCRUB_MACADDR env vars-6, --ipv6         parse ip addr output for IPv6 addresses instead of IPv4-q, --wwid=ID      restrict dm-multipath output to a particular mpath device,where ID is a wwid, friendly name, or LUN identifier-u, --unit=P       change byte display for /proc/meminfo & /proc/net/dev,where P is "b" for byte, or else "k", "m", "g", or "t"-v, --verbose=NUM  specify ps verbosity level (0-4, default: 1)-w, --width=NUM    change fold-width, in columns (positive number, e.g., 80)"0" disables wrapping, "w" autodetects width (default)-x, --nocolor      disable output colorization-y, --less         send output to `less -SR`-z, --more         send output to `more`Special options (BASH v4+ required):--B=FILE  read from FILE containing `dmidecode` dump--C=FILE  read from FILE containing /proc/cpuinfo dump--M=FILE  read from FILE containing /proc/meminfo dump--D=FILE  read from FILE containing /proc/partitions dump--T=FILE  read from FILE containing `multipath -v4 -ll` dump--L=FILE  read from FILE containing `lspci` dump--R=FILE  read from FILE containing /proc/net/softnet_stat dump--N=FILE  read from FILE containing /proc/net/dev dump--G=FILE  read from FILE containing /proc/net/bonding/xxx dump--I=FILE  read from FILE containing `ip addr` dump--P=FILE  read from FILE containing `ps aux` dump

例如,简单的查看网络流量情况:

[root@centos7 xsos-0.7.33]# xsos -n
NETDEVInterface  RxMiBytes  RxPackets  RxErrs   RxDrop  RxFifo  RxComp  RxFrame  RxMultCast=========  =========  =========  ======   ======  ======  ======  =======  ==========ens33      11         11 k       11 (0%)  6 (0%)  0       0       0        0 - - - - - - - - - - - - - - - - -Interface  TxMiBytes  TxPackets  TxErrs   TxDrop  TxFifo  TxComp  TxColls  TxCarrier =========  =========  =========  ======   ======  ======  ======  =======  ==========ens33      1          5 k        0        0       0       0       0        0 SOCKSTATsockets: used 189TCP: inuse 4 orphan 0 tw 0 alloc 6 mem 4UDP: inuse 0 mem 0UDPLITE: inuse 0RAW: inuse 0FRAG: inuse 0 memory 0

简单的查看biso信息:

[root@centos7 xsos-0.7.33]# xsos -b
DMIDECODEBIOS:Vend: Phoenix Technologies LTDVers: 6.00Date: 11/12/2020BIOS Rev: 4.6FW Rev:   0.0System:Mfr:  VMware, Inc.Prod: VMware Virtual PlatformVers: NoneSer:  VMware-56 4d ea a7 9a 71 34 2d-80 fa b4 13 75 90 91 4eUUID: a7ea4d56-719a-2d34-80fa-b4137590914eCPU:4 of 4 CPU sockets populated, 2 cores/0 threads per CPU8 total cores, 0 total threadsMfr:  GenuineIntelFam:  UnknownFreq: 3433 MHzVers: 13th Gen Intel(R) Core(TM) i7-13700KFMemory:Total: 4096 MiB (4 GiB)DIMMs: 1 of 192 populatedMaxCapacity: 5120 MiB (5 GiB / 0.00 TiB)

xsos --bios --ip --lspci --ethtool --net --ps 此命令等于xsos -bilenp

xsos  --disks --mem --unit=m

输出如下:

[root@centos7 xsos-0.7.33]# xsos  --disks --mem --unit=m
MEMORYStats graphed as percent of MemTotal:MemUsed    ▊▊▊▊▊▊▊▊▊.........................................  17.3%Buffers    ..................................................   0.2%Cached     ▊▊▊▊▊.............................................  10.8%HugePages  ..................................................   0.0%Dirty      ..................................................   0.0%RAM:3950 MiB total ram682 MiB (17.3%) used248 MiB (6.3%) used excluding Buffers/Cached0 MiB (0%) dirtyHugePages:No ram pre-allocated to HugePagesTHP:6 MiB allocated to THP LowMem/Slab/PageTables/Shmem:112 MiB (2.8%) of total ram used for Slab4 MiB (0.1%) of total ram used for PageTables9 MiB (0.2%) of total ram used for ShmemSwap:No system swap space configuredSTORAGEWhole Disks from /proc/partitions:1 disks, totaling 100 GiB (0.10 TiB)- - - - - - - - - - - - - - - - - - - - -Disk 	Size in GiB----	-----------sda 	100Disk layout from lsblk:NAME            MAJ:MIN RM  SIZE RO TYPE MOUNTPOINTsda               8:0    0  100G  0 disk ├─sda1            8:1    0    1G  0 part /boot└─sda2            8:2    0   80G  0 part └─centos-root 253:0    0   80G  0 lvm  /sr0              11:0    1  4.4G  0 rom  /mntFilesystem usage from df:Filesystem              1K-blocks    Used Available Use% Mounted on/dev/mapper/centos-root  83845120 1666404  82178716   2% //dev/sr0                  4554702 4554702         0 100% /mnt/dev/sda1                 1038336  139156    899180  14% /boot

查看网络详情:

 xsos --net --unit k
LSPCINet:(1) Advanced Micro Devices, Inc. [AMD] 79c970 [PCnet32 LANCE] (rev 10)Storage:(1) VMware SATA AHCI controllerVGA:VMware SVGA II AdapterETHTOOLInterface Status:ens33  0000:02:01.0  link=up  rx ring 32/512  drv pcnet32 v1.35 / fw UNKNOWNInterface Errors:[None]SOFTIRQBacklog max is sufficient (Current value: net.core.netdev_max_backlog = 1000)Budget is not sufficient, consider reviewing budget tunable. (Current value: net.core.netdev_budget = 300)(see https://access.redhat.com/solutions/1241943)NETDEVInterface  RxKiBytes  RxPackets  RxErrs   RxDrop  RxFifo  RxComp  RxFrame  RxMultCast=========  =========  =========  ======   ======  ======  ======  =======  ==========ens33      11788      11296      11 (0%)  6 (0%)  0       0       0        0 - - - - - - - - - - - - - - - - -Interface  TxKiBytes  TxPackets  TxErrs   TxDrop  TxFifo  TxComp  TxColls  TxCarrier =========  =========  =========  ======   ======  ======  ======  =======  ==========ens33      801        5720       0        0       0       0       0        0 SOCKSTATsockets: used 189TCP: inuse 4 orphan 0 tw 0 alloc 6 mem 3UDP: inuse 0 mem 0UDPLITE: inuse 0RAW: inuse 0FRAG: inuse 0 memory 0IP4Interface  Master IF  MAC Address        MTU     State  IPv4 Address=========  =========  =================  ======  =====  ==================lo         -          -                  65536   up     127.0.0.1/8ens33      -          00:0c:29:90:91:4e  1500    up     192.168.123.17/24SS CHECKSessions:lost reord_seen back_log retrans_total rq tq sock_drop app_limited dsack_dups %CPU %MEM Proto User Local Command Peer ---- ---------- -------- ------------- -- -- --------- ----------- ---------- ---- ----- ---- ----- ---- ---- ------- FIREWALLServices enabled:No firewall services enabled.Rules loaded:No rules loaded.
IFCFGServices enabled:FILE         TYPE      DEVICE  NAME      HWADDR  ONBOOT  DEFROUTE  GATEWAY        NM_CONTROLLED  BOND/TEAM  MASTER  BRIDGE  ETHTOOL  PHYSDEV  PEERDNS  ZONE  MTUifcfg-ens33  Ethernet  ens33   ens33     -       yes     yes       192.168.123.2  -              -          -       -       -        -        -        -     -    ifcfg-lo     -         lo      loopback  -       yes     -         -              -              -          -       -       -        -        -        -     -    
NET STATSTcp.EstabResets:                            2TcpExt.DelayedACKs:                        53TcpExt.TCPLossProbeRecovery:                3TcpExt.TCPLossProbes:                       3TcpExt.TCPLossUndo:                         1TcpExt.TCPTimeouts:                         1

总之,以上参数可以自由搭配组合得出自己喜欢的一个输出内容,从而得到一个自己所期望的巡检结果

该工具还是非常非常nice的哦~~~

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/diannao/57692.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

升级phpcmsV9系统的jquery版本引起的问题处理

前言: 如果jquery文件名修改了,/phpcms/modules/admin/templates/header.tpl.php文件中的jquery名称需要对应修改 一、后台输入框的验证问题 /statics/js/formvalidator.js文件调整为:点击下载 二、后台全选失效问题 1、/phpcms/modules/…

通过 Lighthouse 和 speed-measure-webpack 插件分析优化构建速度与体积

一、Lighthouse Lighthouse是 Google Chrome 推出的一款开源自动化工具,谷歌浏览器中已经集成,它可以搜集多个现代网页性能指标,分析 Web 应用的性能并生成报告,为开发人员进行性能优化的提供了参考方向。 Lighthouse会生成一份报…

Aatrox-Bert-VITS2部署指南

一、模型介绍 【AI 剑魔 ①】在线语音合成(Bert-Vits2),将输入文字转化成暗裔剑魔亚托克斯音色的音频输出。 作者:Xz 乔希 https://space.bilibili.com/5859321 声音归属:Riot Games《英雄联盟》暗裔剑魔亚托克斯 …

分布式IO模拟量模块:多领域应用的高效能解决方案

分布式IO模拟量模块是分布式IO系统中的重要组件,用于实现现场设备或过程的模拟量信号的采集、监视和控制。该模块通常与现场总线耦合器配合使用,能够接收来自现场设备的模拟量信号(如电流、电压等),并将其转换为数字信…

谷歌地图 | 与 Android 版导航 SDK 集成的最佳实践

谷歌最近宣布了导航 SDK,它可以让您将熟悉的 Google 地图逐向导航体验无缝集成到您的 Android 和 iOS 应用程序中。 这篇博文概述了一些最佳实践,您可以使用这些实践为您的 Android 应用程序使用导航 SDK 构建流畅、一致且可靠的导航体验。 与导航地图…

Linux系统安装软件的4种方式【源码配置编译安装、yum安装、rpm包安装、二进制软件包安装(.rpm/.tar.gz/.tgz/.bz2)】

一.源码安装 linux安装软件采用源码安装灵活自由,适用于不同的平台,维护也十分方便。 (一)源码安装流程  源码的安装一般由3个步骤组成: 1.配置(configure) Configure是一个可执行脚本…

5586 直播获奖(live)

经验值:1200 时间限制:1000毫秒 内存限制:256MB 全国2020CSP-J普及组试题 不许抄袭,一旦发现,直接清空经验! 题目描述 Description NOI2130 即将举行。为了增加观赏性,CCF 决定逐一评出每个…

YOLOv11在目标检测中的应用及其与PaddleDetection的对比

近年来,目标检测模型在诸如自动驾驶、安全监控等应用中发挥了关键作用。众多模型中,YOLO(You Only Look Once) 系列凭借其在速度和精度之间的良好平衡脱颖而出。YOLOv11 作为该系列的最新版本之一,凭借其多项创新&…

Vue.js 入门教程

Vue.js 入门教程 一、引言 Vue.js 是一个用于构建用户界面的渐进式 JavaScript 框架。与其他重量级框架不同,Vue 采用自底向上增量开发的设计。Vue 的核心库只关注视图层,并且非常容易上手,同时也很容易与其他库或已有项目整合。本文将引导…

FPGA秋招必看基础 | FPGA设计流程

关注👆 望森FPGA 👆 查看更多FPGA资讯 这是望森的第 30 期分享 作者 | 望森 来源 | 望森FPGA 目录 摘要 1 明确需求、设计系统架构 2 RTL 输入 3 功能仿真(Behavioral Simulation) 4 综合(Synthesis)…

Qgis 开发初级 《符号化》

本章主要简介Qgis 的矢量图层的符号化。Qgis的符号化具体作用于每个图层,图层通过具体的方法设置符号化样式。 1、QgsFeatureRenderer Qgs的符号化类主要是QgsFeatureRenderer,这是一个抽象类,它派生出了许多类,如下所示。常用的…

self-supervised learning(BERT和GPT)

1芝麻街与NLP模型 我們接下來要講的主題呢叫做Self-Supervised Learning,在講self-supervised learning之前呢,就不能不介紹一下芝麻街,為什麼呢因為不知道為什麼self-supervised learning的模型都是以芝麻街的人物命名。 因為Bert是一個非常…

使用Bert+BiLSTM+CRF训练 NER任务

使用的数据集在这里E-Commercial NER Dataset / 电商NER数据集_数据集-阿里云天池 针对面向电商的命名实体识别研究,我们通过爬取搜集了淘宝商品文本的标题,并标注了4大类,9小类的实体类别。具体类型及实体数量如下 针对面向电商的命名实体…

iptables防火墙总结

iptables防火墙总结 四表五链 P 默认策略,-p 协议 出口防火墙,默认配置,使用Forword,采用-P 例题:设置iptables防火墙默认不允许任何数据包进入,相应命令是: Iptables -t filter -P FORWORD -j…

undertow服务器初始化

springboot整合undertow服务器的源码从老生常谈的createWebServer方法谈起。spring会在生成所有bean后到创建web容器,此时会到容器找到ServletWebServerFactory接口bean,spring会根据引入的框架确定生成的ServletWebServerFactory,我们在mave…

【数据结构】五分钟自测主干知识(十一)

上回(半年前)我们讲了二叉树,如果我们要找到二叉树某序遍历下的前驱和后继,我们需要对其作动态遍历求得,比较费时;或者给每个结点增加两个指针域prior和next,但比较费空间。 有没有既能省时间&…

docker部署SQL审核平台Archery

1、概述 Archery 是一个开源的 SQL 审核平台,专为数据库的 SQL 运维和管理而设计,广泛应用于企业的数据库运维工作中。其主要功能是帮助数据库管理员和开发人员实现 SQL 审核、SQL 执行、在线执行、查询、工单管理、权限控制等数据库管理相关的操作。 Archery 的主要功能包括…

网络地址转换——NAT技术详解

网络地址转换——NAT技术详解 一、引言 随着互联网的飞速发展,IP地址资源日益紧张。为了解决IP地址资源短缺的问题,NAT(Network Address Translation,网络地址转换)技术应运而生。NAT技术允许一个私有IP地址的网络通…

为什么我钟情于JPA:优雅数据访问的背后秘密

在Java开发的世界中,选择合适的数据访问框架不仅影响代码的可读性和维护性,更直接关系到项目的成败。虽然MyBatis及其衍生框架在灵活性和性能调优方面有其独特优势,但我更倾向于使用Java持久化API(JPA)。本文将探讨我为…

【K8S系列】Kubernetes Service 基础知识 详细介绍

在 Kubernetes 中,Service 是一种抽象的资源,用于定义一组 Pod 的访问策略。它为这些 Pod 提供了一个稳定的访问入口,解决了 Pod 可能频繁变化的问题。本文将详细介绍 Kubernetes Service 的类型、功能、使用场景、DNS 和负载均衡等方面。 1.…