网站建设属于移动互联网,德宏企业网站建设公司6,做网站用最新软件,什么是跨境电商怎么做本文介绍几款 Linux 运维比较实用的工具#xff0c;希望对 Linux 运维人员有所帮助。 查看进程占用带宽情况 – Nethogs
Nethogs 是一个终端下的网络流量监控工具可以直观的显示每个进程占用的带宽。
下载#xff1a;
http://sourceforge.net/projects/nethogs/files/ne…本文介绍几款 Linux 运维比较实用的工具希望对 Linux 运维人员有所帮助。 查看进程占用带宽情况 – Nethogs
Nethogs 是一个终端下的网络流量监控工具可以直观的显示每个进程占用的带宽。
下载
http://sourceforge.net/projects/nethogs/files/nethogs/0.8/nethogs-0.8.0.tar.gz/download
[rootlocalhost ~]# yum
y install libpcap
devel ncurses
devel [ rootlocalhost ~]# tar zxvf nethogs
0.8 . 0.tar . gz [ rootlocalhost ~]# cd nethogs [ rootlocalhost nethogs ]# make make install [ rootlocalhost nethogs ]# nethogs eth0
硬盘读取性能测试 – IOZone
IOZone 是一款 Linux 文件系统性能测试工具 可以测试不同的操作系统中文件系统的读写性能。
下载http://www.iozone.org/src/current/
[ rootlocalhost current ]# tar xvf iozone3_420 . tar [ rootlocalhost ~]# cd iozone3_420 / src / current /
[ rootlocalhost current ]# make linux [ rootlocalhost current ]#
./ iozone
a
n 512m g 16g i 0 i 1 i 5 f / mnt / iozone
Rb
./ iozone . xls -a 使用全自动模式 -n 为自动模式设置最小文件大小 (Kbytes)。 -g 设置自动模式可使用的最大文件大小 Kbytes。 -i 用来指定运行哪个测试。 -f 指定测试文件的名字完成后自动删除 -R 产生 Excel 到标准输出 -b 指定输出到指定文件上
3.实时监控磁盘 IO-IOTop
IOTop 命令是专门显示硬盘 IO 的命令, 界面风格类似 top 命令。
[ rootlocalhost ~]# yum
y install iotop
网络流量监控 – IPtraf
IPtraf 是一个运行在 Linux 下的简单的网络状况分析工具。
[ rootlocalhost ~]# yum
y install iptraf
5.网络流量监控 – IFTop
iftop 是类似于 linux 下面 top 的实时流量监控工具。比 iptraf 直观些。
下载http://www.ex-parrot.com/~pdw/iftop/
[ rootlocalhost ~]# tar zxvf iftop
0.17 . tar . gz [ rootlocalhost ~]# cd iftop
0.17
[ rootlocalhost iftop
0.17 ]#
./ configure [ rootlocalhost iftop
0.17 ]# make make install [ rootlocalhost iftop
0.17 ]# iftop [ rootlocalhost iftop
0.17 ]# iftop
i eth0
指定监控网卡接口
TX发送流量 RX接收流量 TOTAL总流量 Cumm运行 iftop 到目前时间的总流量 peak流量峰值 rates分别表示过去 2s 10s 40s 的平均流量
进程实时监控 – HTop
HTop 是一个 Linux 下的交互式的进程浏览器可以用来替换 Linux 下的 top 命令。
rpm -ivh http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm安装第三方 YUM 源
[ rootlocalhost ~]# yum
y install htop
7,系统资源监控 – NMON
NMON 是一种在 AIX 与各种 Linux 操作系统上广泛使用的监控与分析工具
下载
http://sourceforge.jp/projects/sfnet_nmon/releases/
[ rootlocalhost ~]# chmod x nmon_x86_64_rhel6 [ rootlocalhost ~]# mv nmon_x86_64_rhel6 / usr / sbin / nmon [ rootlocalhost ~]# nmon
监控多个日志 – MultiTail
MultiTail 是在控制台打开多个窗口用来实现同时监控多个日志文档、类似 tail 命令的功能的软件。
rpm -ivh http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm 安装第三方 YUM 源
[ rootlocalhost ~]# yum
y install multitail [ rootlocalhost ~]# multitail
e “fail”
/ var / log / secure #筛选关键字进行监控 [ rootlocalhost ~]# multitail
l “ping baidu.com”
#监控后面的命令 - l 将要执行的命令 [ rootlocalhost ~]# multitail
i / var / log / messages
i / var / log / secure #-i 指定一个文件名
SSH 暴力破解防护 – Fail2ban
Fail2ban 可以监视你的系统日志然后匹配日志的错误信息正则式匹配执行相应的屏蔽动作一般情况下是调用防火墙屏蔽
下载
http://www.fail2ban.org/wiki/index.php/Downloads
[ rootlocalhost ~]# cd fail2ban
0.8 . 11
[ rootlocalhost fail2ban
0.8 . 11 ]# python setup . py install [ rootlocalhost fail2ban
0.8 . 11 ]# cd files /
[ rootlocalhost files ]# cp ./ redhat
initd / etc / init . d / fail2ban [ rootlocalhost files ]# service fail2ban start [ rootlocalhost files ]# chkconfig
add fail2ban [ rootlocalhost files ]# chkconfig fail2ban on
注需要配置 iptables 实用如果重启 iptables 了也要重启 fail2ban因为 fail2ban 的原理是调用 iptables 实时阻挡外界的攻击。
[ rootlocalhost ~]# grep
v “^#”
/ etc / fail2ban / jail . conf | grep
v “^$”
[ DEFAULT ]
ignoreip
127.0 . 0.1 / 8
忽略本机 IP
bantime
600
#符合规则后封锁时间 findtime
600
在多长时间内符合规则执行封锁如 600 秒达到 3 次则执行
maxretry
3
最大尝试次数
backend
auto
#日志修改检测日志 gamin、polling 和 auto 这三种 usedns
warn [ ssh
iptables ]
enabled
true
默认是禁用 false
filter
sshd action
iptables [ name
SSH , port
ssh , protocol
tcp ]
sendmail-whois[nameSSH,dest 收件人邮箱, sender 发件人邮箱, sendername“Fail2Ban”]
logpath
/var/ log / sshd . log
响应的错误日志一般在 / var/log/secure
maxretry
5
尝试错误次数覆盖全局中的 maxretry
注默认所有的应用防护都是关闭的需要我们手动开启。fail2ban.conf 文件是日志信息jail.conf 文件是保护的具体服务和动作配置信息。
[ rootlocalhost ~]# touch / var / log / sshd . log [ rootlocalhost ~]# service fail2ban restart [ rootlocalhost ~]# fail2ban
client status
查看监控已经开启
Status
|-
Number of jail :
1
- Jail list: ssh-iptables [rootlocalhost ~]# iptables -L #iptables 过滤表有 fail2ban 一条规则 fail2ban-SSH tcp – anywhere anywhere tcp dpt:ssh
连接会话终端持续化 – Tmux
Tmux 是一个优秀的终端复用软件类似 GNU Screen 比 Screen 更加方面、灵活和高效。为了确保连接 SSH 时掉线不影响任务运行。
rpm -ivh http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm安装第三方 YUM 源
页面显示磁盘空间使用情况 – Agedu
下载
http://www.chiark.greenend.org.uk/~sgtatham/agedu/
[ rootlocalhost ~]# tar zxvf agedu
r9723 . tar . gz [ rootlocalhost ~]# cd agedu
r9723 [ rootlocalhost ~]#
./ configure [ rootlocalhost ~]# make make install [ rootlocalhost ~]# agedu
s /
#-s 扫描 [ rootlocalhost ~]# agedu
w
address 192.168 . 0.10 : 80
#-w 输入一个网页链接 [ rootlocalhost ~]# agedu
w
address 192.168 . 0.108080
– auth none #–auth 关闭认证如果不加端口号会生成一个随机的用浏览器访问
安全扫描工具 – NMap
NMap 是 Linux 下的网络连接扫描和嗅探工具包用来扫描网上电脑开放的网络连接端。
下载http://nmap.org/download.html
[ rootlocalhost ~]# tar jxvf nmap
6.40 . tar . bz2 [ rootlocalhost nmap
6.40 ]#
./ configure [ rootlocalhost nmap
6.40 ]# make make install [ rootlocalhost ~]# nmap 192.168 . 0.10
#获取基本信息 [ rootlocalhost ~]# nmap
O 192.168 . 0.10
#获取系统版本信息 [ rootlocalhost ~]# nmap
A 192.168 . 0.10
#获取系统综合信息 [ rootlocalhost ~]# nmap 192.168 . 0.0 / 24
获取一个网段工作设备基本信息
-sSTCP 扫描 -sV 系统版本检测
13.Web 压力测试 – Httperf
Httperf 比 ab 更强大能测试出 web 服务能承载的最大服务量及发现潜在问题比如内存使用、稳定性。最大优势可以指定规律进行压力测试模拟真实环境。
下载
http://code.google.com/p/httperf/downloads/list
[ rootlocalhost ~]# tar zxvf httperf
0.9 . 0.tar . gz [ rootlocalhost ~]# cd httperf
0.9 . 0
[ rootlocalhost httperf
0.9 . 0 ]#
./ configure [ rootlocalhost httperf
0.9 . 0 ]# make make install [ rootlocalhost ~]# httperf
hog
server
192.168 . 0.202
– uri / index . html
num
conns
10000
– wsess 10 , 10 , 0.1
参数说明
–hog让 httperf 尽可能多产生连接httperf 会根据硬件配置有规律的产生访问连接
–num-conns连接数量总发起 10000 请求
–wsess用户打开网页时间规律模拟第一个 10 表示产生 10 个会话连接第二个 10 表示每个会话连接进行 10 次请求0.1 表示每个会话连接请求之间的间隔时间 / s