<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
<channel>
<title><![CDATA[Ops运维 | Mr`kang Blog｜小豆子]]></title> 
<link>https://www.cnmysql.com/index.php</link> 
<description><![CDATA[关注服务器运维技术、DB优化、Docker虚拟化、自动化运维、工作积累]]></description> 
<language>zh-cn</language> 
<copyright><![CDATA[Ops运维 | Mr`kang Blog｜小豆子]]></copyright>
<item>
<link>https://www.cnmysql.com/post//</link>
<title><![CDATA[Linux运维实用工具集合]]></title> 
<author>kangyang &lt;kangyang315@qq.com&gt;</author>
<category><![CDATA[LINUX系统管理]]></category>
<pubDate>Wed, 20 Aug 2014 06:46:05 +0000</pubDate> 
<guid>https://www.cnmysql.com/post//</guid> 
<description>
<![CDATA[ 
	<span style="font-size: 14px;"><span style="font-family: 宋体;">1、查看进程占用带宽情况-Nethogs<br/>Nethogs 是一个终端下的网络流量监控工具可以直观的显示每个进程占用的带宽。<br/>下载：<a href="http://sourceforge.net/projects/nethogs/files/nethogs/0.8/nethogs-0.8.0.tar.gz/download" target="_blank">http://sourceforge.net/projects/nethogs/files/nethogs/0.8/nethogs-0.8.0.tar.gz/download</a><br/><br/>2、硬盘读取性能测试-IOZone<br/>IOZone是一款Linux文件系统性能测试工具 可以测试不同的操作系统中文件系统的读写性能。<br/>下载：<a href="http://www.iozone.org/src/current/" target="_blank">http://www.iozone.org/src/current/</a><br/>&nbsp;&nbsp;&nbsp;&nbsp;-a使用全自动模式<br/>&nbsp;&nbsp;&nbsp;&nbsp;-n为自动模式设置最小文件大小(Kbytes)。<br/>&nbsp;&nbsp;&nbsp;&nbsp;-g设置自动模式可使用的最大文件大小Kbytes。<br/>&nbsp;&nbsp;&nbsp;&nbsp;-i用来指定运行哪个测试。<br/>&nbsp;&nbsp;&nbsp;&nbsp;-f指定测试文件的名字完成后自动删除<br/>&nbsp;&nbsp;&nbsp;&nbsp;-R产生Excel到标准输出<br/>&nbsp;&nbsp;&nbsp;&nbsp;-b指定输出到指定文件上<br/><br/>3、实时监控磁盘IO-IOTop<br/>IOTop命令是专门显示硬盘IO的命令,界面风格类似top命令。<br/>[root@localhost ~]# yum -y install iotop <br/><br/>4、网络流量监控-IPtraf<br/>IPtraf是一个运行在Linux下的简单的网络状况分析工具。<br/>[root@localhost ~]# yum -y install iptraf <br/><br/>5、网络流量监控-IFTop<br/>iftop是类似于linux下面top的实时流量监控工具。比iptraf直观些。<br/>下载：<a href="http://www.ex-parrot.com/~pdw/iftop/" target="_blank">http://www.ex-parrot.com/~pdw/iftop/</a><br/>&nbsp;&nbsp;&nbsp;&nbsp;TX：发送流量<br/>&nbsp;&nbsp;&nbsp;&nbsp;RX：接收流量<br/>&nbsp;&nbsp;&nbsp;&nbsp;TOTAL：总流量<br/>&nbsp;&nbsp;&nbsp;&nbsp;Cumm：运行iftop到目前时间的总流量<br/>&nbsp;&nbsp;&nbsp;&nbsp;peak：流量峰值<br/>&nbsp;&nbsp;&nbsp;&nbsp;rates：分别表示过去 2s 10s 40s 的平均流量<br/><br/>6、进程实时监控-HTop<br/>HTop是一个 Linux 下的交互式的进程浏览器可以用来替换Linux下的top命令。<br/>rpm -ivh <a href="http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm" target="_blank">http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm</a>（安装第三方YUM源）<br/>[root@localhost ~]# yum -y install htop <br/><br/>7、系统资源监控-NMON<br/>NMON是一种在AIX与各种Linux操作系统上广泛使用的监控与分析工具<br/>下载：<a href="http://sourceforge.jp/projects/sfnet_nmon/releases/" target="_blank">http://sourceforge.jp/projects/sfnet_nmon/releases/</a><br/>[root@localhost ~]# chmod +x nmon_x86_64_rhel6 <br/>[root@localhost ~]# mv nmon_x86_64_rhel6 /usr/sbin/nmon <br/>[root@localhost ~]# nmon <br/><br/>8、监控多个日志-MultiTail<br/>MultiTail是在控制台打开多个窗口用来实现同时监控多个日志文档、类似tail命令的功能的软件。<br/>rpm -ivh <a href="http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm" target="_blank">http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm</a> （安装第三方YUM源）<br/>[root@localhost ~]# yum -y install&nbsp;&nbsp;multitail <br/>[root@localhost ~]# multitail -e ”fail” /var/log/secure&nbsp;&nbsp; #筛选关键字进行监控 <br/>[root@localhost ~]# multitail -l ”ping baidu.com”&nbsp;&nbsp; #监控后面的命令-l将要执行的命令 <br/>[root@localhost ~]# multitail -i /var/log/messages -i /var/log/secure&nbsp;&nbsp; #-i指定一个文件名 <br/><br/>9、SSH暴力破解防护-Fail2ban<br/>Fail2ban可以监视你的系统日志然后匹配日志的错误信息正则式匹配执行相应的屏蔽动作一般情况下是调用防火墙屏蔽<br/>下载：<a href="http://www.fail2ban.org/wiki/index.php/Downloads" target="_blank">http://www.fail2ban.org/wiki/index.php/Downloads</a><br/>[root@localhost ~]# cd fail2ban-0.8.11 <br/>[root@localhost fail2ban-0.8.11]# python setup.py install <br/>[root@localhost fail2ban-0.8.11]# cd files/ <br/>[root@localhost files]# cp ./redhat-initd /etc/init.d/fail2ban <br/>[root@localhost files]# service fail2ban start <br/>[root@localhost files]# chkconfig –add fail2ban <br/>[root@localhost files]# chkconfig fail2ban on <br/>注：需要配置iptables实用，如果重启iptables了也要重启fail2ban，因为fail2ban的原理是调用iptables实时阻挡外界的攻击。<br/>[root@localhost ~]# grep -v ”^#” /etc/fail2ban/jail.conf &#124; grep -v ”^$” <br/>[DEFAULT] <br/>ignoreip = 127.0.0.1/8#忽略本机IP <br/>bantime&nbsp;&nbsp;= 600&nbsp;&nbsp; #符合规则后封锁时间 <br/>findtime&nbsp;&nbsp;= 600&nbsp;&nbsp;#在多长时间内符合规则执行封锁如600秒达到3次则执行 <br/>maxretry = 3&nbsp;&nbsp;&nbsp;&nbsp;#最大尝试次数 <br/>backend = auto&nbsp;&nbsp; #日志修改检测日志gamin、polling和auto这三种 <br/>usedns = warn&nbsp;&nbsp;<br/>[ssh-iptables] <br/>enabled&nbsp;&nbsp;= true#默认是禁用false <br/>filter&nbsp;&nbsp; = sshd <br/>action&nbsp;&nbsp; = iptables[name=SSH, port=ssh, protocol=tcp] <br/># sendmail-whois[name=SSH,dest=收件人邮箱, sender=发件人邮箱, sendername="Fail2Ban"] <br/>logpath&nbsp;&nbsp;= /var/log/sshd.log&nbsp;&nbsp;#响应的错误日志一般在/var/log/secure <br/>maxretry = 5&nbsp;&nbsp;&nbsp;&nbsp;#尝试错误次数覆盖全局中的maxretry <br/>注：默认所有的应用防护都是关闭的，需要我们手动开启。fail2ban.conf文件是日志信息，jail.conf文件是保护的具体服务和动作配置信息。<br/>[root@localhost ~]# touch /var/log/sshd.log <br/>[root@localhost ~]# service fail2ban restart <br/>[root@localhost ~]# fail2ban-client status&nbsp;&nbsp;&nbsp;&nbsp;#查看监控已经开启 <br/>Status <br/>&#124;- Number of jail:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1 <br/>`- Jail list:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ssh-iptables <br/>[root@localhost ~]# iptables -L&nbsp;&nbsp;#iptables过滤表有fail2ban一条规则 <br/>fail2ban-SSH&nbsp;&nbsp;tcp&nbsp;&nbsp;–&nbsp;&nbsp;anywhere&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; anywhere&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;tcp dpt:ssh <br/><br/>10、连接会话终端持续化-Tmux<br/>Tmux是一个优秀的终端复用软件类似GNU Screen比Screen更加方面、灵活和高效。为了确保连接SSH时掉线不影响任务运行。<br/>rpm -ivh <a href="http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm" target="_blank">http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm</a>（安装第三方YUM源）<br/><br/>11、页面显示磁盘空间使用情况-Agedu<br/>下载：<a href="http://www.chiark.greenend.org.uk/~sgtatham/agedu/" target="_blank">http://www.chiark.greenend.org.uk/~sgtatham/agedu/</a><br/>[root@localhost ~]# tar zxvf agedu-r9723.tar.gz <br/>[root@localhost ~]# cd agedu-r9723 <br/>[root@localhost ~]# ./configure <br/>[root@localhost ~]# make && make install <br/>[root@localhost ~]# agedu -s /&nbsp;&nbsp;&nbsp;&nbsp;#-s扫描 <br/>[root@localhost ~]# agedu -w –address 192.168.0.10:80&nbsp;&nbsp;#-w输入一个网页链接 <br/>[root@localhost ~]# agedu -w –address 192.168.0.108080 –auth none&nbsp;&nbsp;#–auth关闭认证如果不加端口号会生成一个随机的用浏览器访问 <br/><br/>12、安全扫描工具-NMap<br/>NMap是Linux下的网络连接扫描和嗅探工具包用来扫描网上电脑开放的网络连接端。<br/>下载：<a href="http://nmap.org/download.html" target="_blank">http://nmap.org/download.html</a><br/>[root@localhost ~]# tar jxvf nmap-6.40.tar.bz2 <br/>[root@localhost nmap-6.40]# ./configure <br/>[root@localhost nmap-6.40]# make && make install <br/>[root@localhost ~]# nmap 192.168.0.10&nbsp;&nbsp; #获取基本信息 <br/>[root@localhost ~]# nmap -O 192.168.0.10 #获取系统版本信息 <br/>[root@localhost ~]# nmap -A 192.168.0.10 #获取系统综合信息 <br/>[root@localhost ~]# nmap 192.168.0.0/24&nbsp;&nbsp;#获取一个网段工作设备基本信息 <br/>&nbsp;&nbsp;&nbsp;&nbsp;-sSTCP扫描<br/>&nbsp;&nbsp;&nbsp;&nbsp;-sV系统版本检测<br/><br/>13、Web压力测试-Httperf<br/>Httperf比ab更强大，能测试出web服务能承载的最大服务量及发现潜在问题；比如：内存使用、稳定性。最大优势：可以指定规律进行压力测试，模拟真实环境。<br/>下载：<a href="http://code.google.com/p/httperf/downloads/list" target="_blank">http://code.google.com/p/httperf/downloads/list</a><br/>[root@localhost ~]# tar zxvf httperf-0.9.0.tar.gz <br/>[root@localhost ~]# cd httperf-0.9.0 <br/>[root@localhost httperf-0.9.0]# ./configure <br/>[root@localhost httperf-0.9.0]# make && make install <br/>[root@localhost ~]# httperf –hog –server=192.168.0.202 –uri=/index.html –num-conns=10000 –wsess=10,10,0.1 <br/>参数说明：<br/>–hog：让httperf尽可能多产生连接，httperf会根据硬件配置，有规律的产生访问连接<br/>–num-conns：连接数量，总发起10000请求<br/>–wsess： 用户打开网页时间规律模拟，第一个10表示产生10个会话连接，第二个10表示每个会话连接进行10次请求，0.1表示每个会话连接请求之间的间隔时间/s</span></span><br/>Tags - <a href="https://www.cnmysql.com/tags/linux/" rel="tag">linux</a> , <a href="https://www.cnmysql.com/tags/%25E5%25AE%259E%25E7%2594%25A8/" rel="tag">实用</a> , <a href="https://www.cnmysql.com/tags/%25E5%25B7%25A5%25E5%2585%25B7/" rel="tag">工具</a> , <a href="https://www.cnmysql.com/tags/iotop/" rel="tag">iotop</a> , <a href="https://www.cnmysql.com/tags/nethogs/" rel="tag">nethogs</a> , <a href="https://www.cnmysql.com/tags/iftop/" rel="tag">iftop</a>
]]>
</description>
</item><item>
<link>https://www.cnmysql.com/post//#blogcomment</link>
<title><![CDATA[[评论] Linux运维实用工具集合]]></title> 
<author> &lt;user@domain.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Thu, 01 Jan 1970 00:00:00 +0000</pubDate> 
<guid>https://www.cnmysql.com/post//#blogcomment</guid> 
<description>
<![CDATA[ 
	
]]>
</description>
</item>
</channel>
</rss>