linux运维:熟悉确认你的服务器

作为运维要确认的事情很多,但首先要熟悉你的服务器.
一 硬件指标
cpu

cat /proc/cpuinfo |grep "physical id"       #物理cpu
cat /proc/cpuinfo |grep "cpu cores"       #物理内核
cat /proc/cpuinfo |grep "processor"       #逻辑处理器

memory

free -m
dmidecode -t memory                          #物理内存规格,大小,插槽,时钟频率

Raid

cat /proc/mdstat                                       #软raid
系统自带raid,可查看Bios Raid或用以下命令
dmesg |grep -i raid
cat /proc/scsi/scsi
外购Raid卡,请用厂方工具查看

硬盘

fdisk -l                                                 # 当前挂载的硬盘
smartctl -a /dev/***                             #硬盘读写参数
# smartctl具体参数意义可参看我的[另一篇文章](https://blog.csdn.net/CSDN1887/article/details/82706410)

网卡

ifconfig -a                                         #能查看网卡ip              
cat   /proc/net/dev                            #能看网卡流量
netstat -r                                           # 路由信息

二 文件系统
逻辑卷

pvdisplay
vgdisplay
lvdisplay

文件系统

df -h											          #文件系统使用情况
du -sh                                                #目录大小
mount                                                #文件系统当前挂载情况
cat /etc/fstab                                     #文件系统启动挂载情况
其他iscsi,nfs,可查看/etc下相应配置文件
cat /proc/cmdline                              #系统启动参数

cron

cat /etc/crontab                                 #自启动服务                    

三 服务和端口

防火墙

systemctl start iptables
systemctl start firewalld

服务端口

cat /etc/issue                                                                              #当前发行版本
uname -r                                                                                     #内核版本 
cat /proc/version                                                                        #内核版本                    
systemctl list-units --type service | grep active | grep running   #当前活动运行的服务
netstat -atlp                                                                                 #当前监听的进程 
nmap 127.0.0.1                                                                           # 开放的端口
iptables -L -n                                                                               #防火墙当前开放的端口      
       

四 性能监控

top ,htop,glances                                                 #cpu ,memory,负载,进程运行情况
uptime,w																#负载情况
iostat -x 1 5                                                          #硬盘读写
sar 1 5																    #每个cpu开销, io排队,等待情况
vmstat                                                                 # 内存使用情况
sar -n DEV 2 5                                                    #每个网卡上的网络流速
netstat -s 															#协议统计信息
ss -pl    | ss-l                                                       #进程使用的socket     #socket 摘要

服务器间网速
iptraf -d eth0
server端 iperf -s  /      客户端  iperf -d  eth0
server端 netserver      客户端  netperf -H server  -l 10
tcpdump 和 tcptrace                                            #具体每个进程网络连接状况

五 日志
日志记录在/var/log . 以前是syslog服务管理,现在是rsyslog(增强)
RHEL 或 CentOS 则在 /var/log/messages 中存储它们

主要日志如下:
/var/log/boot.log:录了系统在引导过程中发生的事件,就是Linux系统开机自检过程显示的信息

/var/log/lastlog :记录最后一次用户成功登陆的时间、登陆IP等信息

/var/log/messages :记录Linux操作系统常见的系统和服务错误信息

/var/log/secure :Linux系统安全日志,记录用户和工作组变坏情况、用户登陆认证情况

/var/log/btmp :记录Linux登陆失败的用户、时间以及远程IP地址

/var/log/syslog:只记录警告信息,常常是系统出问题的信息,使用lastlog查看

/var/log/wtmp:该日志文件永久记录每个用户登录、注销及系统的启动、停机的事件,使用last命令查看

/var/run/utmp:该日志文件记录有关当前登录的每个用户的信息。如 who、w、users、finger等就需要访问这个文件

猜你喜欢

转载自blog.csdn.net/CSDN1887/article/details/82894300