Linux 监控体系 [精]

本文详细介绍了Linux监控体系,从硬件监控、系统监控到应用服务监控。讲解了IPMI、SNMP的相关知识,以及如何利用zabbix进行监控。同时,提到了CPU、内存、硬盘、网络的监控工具和指标,强调了监控的重要性和基准线设定。此外,还分享了net-snmp的使用和系统监控工具如top、sysstat、mpstat的命令行用法。
摘要由CSDN通过智能技术生成

监控体系

zabbix

博客:www.abcdocker.com
微信公众号:abcdocker
笔者QQ:381493251
Abcdocker交流群:454666672
如果遇到什么问题可以进群询问,我们是一个乐于帮助的集体!


监控对象:
    1. 监控对象的理解:CPU是怎么工作的,原理
    2. 监控对象的指标:CPU使用率 CPU负载 CPU个数 上下文切换
    3. 确定性能基准线:怎么样才算故障?CPU负载多上才算高
监控范围:
    1.硬件监控服务器的硬件故障
    2.操作系统监控 CPU、内存、硬盘、IO、进程
    3.应用服务监控 nginx、MySQL、等服务
    4.业务监控


硬件监控:

  1.使用IPMI
  2.机房巡检
远程控制卡:
    DELL服务器:iDRAC
    HP服务器:ILO ————-Linux就可以使用IPMI(依赖于BMC控制器)
    IBM服务器:IMM |
    Linux是管理IPMI工具
    ipmitool(监控和控制)
1.硬件要支持
2.操作系统 Linux IPMI
ipmitool安装:

[root@localhost ~]# yum install OpenIPMI ipmitool -y
[root@localhost ~]# rpm -qa OpenIPMI ipmitool
ipmitool-1.8.13-8.el7_1.x86_64
OpenIPMI-2.0.19-11.el7.x86_64

使用IPMI有两种方式
1、本地进行调用
2、远程调用 (IP地址 用户名和密码)

[root@localhost ~]# systemctl start ipmi  #启动
本次以Centos7进行演示

IPMI相关命令

[root@localhost ~]# ipmitool --help
ipmitool: invalid option -- '-'
ipmitool version 1.8.13
usage: ipmitool [options...] <command>
       -h             This help
       -V             Show version information
       -v             Verbose (can use multiple times)
       -c             Display output in comma separated format
       -d N           Specify a /dev/ipmiN device to use (default=0)
       -I intf        Interface to use
       -H hostname    Remote host name for LAN interface
       -p port        Remote RMCP port [default=623]
       -U username    Remote session username
       -f file        Read remote session password from file
       -z size        Change Size of Communication Channel (OEM)
       -S sdr         Use local file for remote SDR cache
       -D tty:b[:s]   Specify the serial device, baud rate to use
                      and, optionally, specify that interface is the system one
       -a             Prompt for remote password
       -Y             Prompt for the Kg key for IPMIv2 authentication
       -e char        Set SOL escape character
       -C ciphersuite Cipher suite to be used by lanplus interface
       -k key         Use Kg key for IPMIv2 authentication
       -y hex_key     Use hexadecimal-encoded Kg key for IPMIv2 authentication
       -L level       Remote session privilege level [default=ADMINISTRATOR]
                      Append a '+' to use name/privilege lookup in RAKP1
       -A authtype    Force use of auth type NONE, PASSWORD, MD2, MD5 or OEM
       -P password    Remote session password
       -E             Read password from IPMI_PASSWORD environment variable
       -K             Read kgkey from IPMI_KGKEY environment variable
       -m address     Set local IPMB address
       -b channel     Set destination channel for bridged request
       -t address     Bridge request to remote target address
       -B channel     Set transit channel for bridged request (dual bridge)
       -T address     Set transit address for bridge request (dual bridge)
       -l lun         Set destination lun for raw commands
       -o oemtype     Setup for OEM (use 'list' to see available OEM types)
       -O seloem      Use file for OEM SEL event descriptions
       -N seconds     Specify timeout for lan [default=2] / lanplus [default=1] interface
       -R retry       Set the number of retries for lan/lanplus interface [default=4]
Interfaces:
    open          Linux OpenIPMI Interface [default]
    imb           Intel IMB Interface 
    lan           IPMI v1.5 LAN Interface 
    lanplus       IPMI v2.0 RMCP+ LAN Interface 
    serial-terminal  Serial Interface, Terminal Mode 
    serial-basic  Serial Interface, Basic Mode 
Commands:
    raw           Send a RAW IPMI request and print response
    i2c           Send an I2C Master Write-Read command and print response
    spd           Print SPD info from remote I2C device
    lan           Configure LAN Channels
    chassis       Get chassis status and set power state
    power         Shortcut to chassis power commands
    event         Send pre-defined events to MC
    mc            Management Controller status and global enables
    sdr           Print Sensor Data Repository entries and readings
    sensor        Print detailed sensor information
    fru           Print built-in FRU and scan SDR for FRU locators
    gendev        Read/Write Device associated with Generic Device locators sdr
    sel           Print System Event Log (SEL)
    pef           Configure Platform Event Filtering (PEF)
    sol           Configure and connect IPMIv2.0 Serial-over-LAN
    tsol          Configure and connect with Tyan IPMIv1.5 Serial-over-LAN
    isol          Configure IPMIv1.5 Serial-over-LAN
    user          Configure Management Controller users
    channel       Configure Management Controller channels
    session       Print session information
    dcmi          Data Center Management Interface
    sunoem        OEM Commands for Sun servers
    kontronoem    OEM Commands for Kontron devices
    picmg         Run a PICMG/ATCA extended cmd
    fwum          Update IPMC using Kontron OEM Firmware Update Manager
    firewall      Configure Firmware Firewall
    delloem       OEM Commands for Dell systems
    shell         Launch interactive IPMI shell
    exec          Run list of commands from file
    set           Set runtime variable for shell and exec
    hpm           Update HPM components using PICMG HPM.1 file
    ekanalyzer    run FRU-Ekeying analyzer using FRU files
    ime           Update Intel Manageability Engine Firmware

IPMI配置网络,有两种方式:
ipmi over lan(大体意思是通过网卡来进行连接)
独立 (给服务器单独插一个网线) DELL服务器可以在小面板中设置ipmi 云主机我们不需要考虑IPMI

对于路由器和交换机:SNMP(简单网络管理协议) 监控
配置SNMP:(监控我们可以参考监控宝来讲进行监控)

[root@localhost ~]# yum -y install net-snmp net-snmp-utils
[root@localhost ~]# rpm -qa net-snmp net-snmp-utils
net-snmp-5.7.2-24.el7_2.1.x86_64
net-snmp-utils-5.7.2-24.el7_2.1.x86_64
#如果不知道要安装什么软件包,可以使用yum list|grep snmp

SNMP配置文件路径

[root@localhost ~]# ll /etc/snmp/
total 24
-rw------- 1 root root 18861 May 12 09:14 snmpd.conf
-rw------- 1 root root   220 May 12 09:14 snmptrapd.conf

为了安全性,我们将配置文件移动并修改

[root@localhost snmp]# mv snmpd.conf snmpd.conf.org
[root@localhost snmp]# vim snmpd.conf
rocommunity abcdocker 192.168.56.11
#第二个为团体名,IP是要监控的服务端

我们被采集的服务器要开启snmp
#提示 被采集服务器要允许snmp访问

iptables设置如下:
iptables -I INPUT -p udp -s 192.168.56.11 --dport 161 -j ACCEPT
iptables -I INPUT -p udp -s [要采集的IP地址] --dport 161 -j ACCEPT

开启服务

[root@localhost snmp]# systemctl start snmpd
[root@localhost snmp]# netstat -lntup       #snmp默认监听的是udp161端口
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      1062/sshd           
tcp        0      0 127.0.0.1:25            0.0.0.0:*               LISTEN      2208/master         
tcp        0      0 127.0.0.1:199           0.0.0.0:*               LISTEN      2692/snmpd          
tcp6       0      0 :::22                   :::*                    LISTEN      1062/sshd           
tcp6       0
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值