适应环境 - Linux
curl ip.cn
curl ipinfo.io
curl -s attacker.club/getip #查看出口ip
ping 114.114.114.114 |awk '{print $0"\t" strftime("%H:%M:%S",systime())}'
# 连续ping检测
top --> m #内存
top --> 1 #cpu
top -Hp pid # 看具体线程负载
uptime --> #负载
dstat -ndy --top-mem --top-cpu --top-io -t #查看关键性能io
system:int、csw
netstat -an | awk '/^tcp/ {print $6}'|sort |uniq -c|sort -n
ss -ant | awk '{++s[$1]} END {for(k in s) print k,s[k]}'
#查看当前TCP连接状态;ss更快
ss -an|awk '{print $5}'|awk -F: '{print $1}'|sort|egrep -o '[0-9]{1,3}(\.[0-9]{1,3}){3}'|uniq -c|sort -nr|head -n 10
#查看并发最多的独立IP,取其前10个;sort排序 参数nr中n是按照排序大小,r是反向排序。uniq -c计数显示
netstat -n|grep TIME_WAIT|awk '{print $5}'|awk -F: '{print $1}' |sort|uniq -c|sort -rn|head -n5
#查看后端TIME_WAIT主机
tail -1000 /var/log/httpd/access_log |awk '{print $NF}'|sort |uniq -c|sort -n
#sort -k1n,k1是第一列;列出1000行域名出现次数
watch 'netstat -an | egrep -w "80|443"|grep ESTABLISHED |wc -l'
# 服务并发连接
awk '$4 >="[04/Apr/2017:12:25:00" && $4 <="[04/Apr/2017:12:26:00"' blog.log
#过滤第四列的项,输出大于等于25分,小于等于26分的访问日志
tcpdump -i eth0 host 43.225.180.226 tcp port 8888 -vv -c 3 -w result.pcap #-vv 屏幕显示 -c 抓包次数 -w 写入数据到本地
tcpdump -Z root -r src.pcap "tcp port 22 and (tcp[tcpflags] & tcp-fin != 0)" -w dst.pcap #过滤出端口为22, 且含有 FIN 标记的数据包
tcpdump -i eth0 -s 0 -l -w out.log port 3306 | strings #在数据库服务器是通过tcpdump抓sql语句
java OOM,全称“Out Of Memory”;内存用完了
内存泄露:申请使用完的内存没有释放,导致虚拟机不能再次使用该内存,此时这段内存就泄露了,因为申请者不用了,而又不能被虚拟机分配给别人用。
内存溢出:申请的内存超出了JVM能提供的内存大小,此时称之为溢出。
jmap -heap java_pid #查看资源使用