Skip to content

Instantly share code, notes, and snippets.

View Jerry-Fix's full-sized avatar

Jerry Jerry-Fix

View GitHub Profile
@Jerry-Fix
Jerry-Fix / lld - ss
Created September 26, 2013 14:51
Replace netstat with ss to implement the low level discovery for zabbix
#!/bin/bash
lines=$(sudo ss -lp | grep $1 | awk '{print $3}' | cut -d: -f2 | sort | wc -l)
if [ "$1" == "mongod" ]
then
portarray=(`sudo ss -lp | grep $1 | awk '{print $3}' | cut -d: -f2 | sort | head -n $(($lines/2)) 2>/dev/null`)
else
portarray=(`sudo ss -lp | grep $1 | awk '{print $3}' | cut -d: -f2 | sort 2>/dev/null`)
fi
@Jerry-Fix
Jerry-Fix / IO benchamrk with fio, gnuplot
Last active December 30, 2015 02:49
io benchamrk, using fio, gnuplot
set title "SAS 10K 600G diff ioengine(libaio, mmap, sync) benchmark(bandwidth, IOPS) 100% randread"
set xlabel "blocksize(KB)"
set ylabel "bandwidth(MB/s)"
set y2label "IOPS"
set xtics 200
set y2tics 0,100,1500
set grid
set border 15
plot "raid10_diff_ioengine_randread_bandwidth_iops" using 1:2 with linespoints lt 30 title "libaio bandwidth",\
"raid10_diff_ioengine_randread_bandwidth_iops" using 1:3 with linespoints lt 31 title "mmap bandwidth",\
@Jerry-Fix
Jerry-Fix / megacli build raid automaticly
Last active December 30, 2015 08:39
megacli build raid automaticly ( raid 0, 1, 5, 10) for benchmark
Create raid
# ./MegaCli -CfgLdAdd -rX[E0:S0,E1:S1,...] [WT|WB] [NORA|RA|ADRA] [Direct|Cached]
[CachedBadBBU|NoCachedBadBBU] [-szXXX [-szYYY ...]]
[-strpszM] [-Hsp[E0:S0,...]] [-AfterLdX] | [FDE|CtrlBased]
[-Default| -Automatic| -None| -Maximum| -MaximumWithoutCaching] [-Cache] [-enblPI] [-Force]-aN
Create RAID 0, 1, 5 drive
# ./MegaCli64 -CfgLdAdd -r(0|1|5) [E:S, E:S, ...] -aN
Create RAID 10 drive
@Jerry-Fix
Jerry-Fix / nginx dmesg
Created December 17, 2013 14:20
nginx dmesg
[32799839.603312] swapper/14: page allocation failure: order:4, mode:0x4020
[32799839.603317] Pid: 0, comm: swapper/14 Tainted: G W 3.2.0-34-generic #53-Ubuntu
[32799839.603320] Call Trace:
[32799839.603322] <IRQ> [<ffffffff8111ceb6>] warn_alloc_failed+0xf6/0x150
[32799839.603336] [<ffffffff81120c57>] __alloc_pages_nodemask+0x6d7/0x8f0
[32799839.603341] [<ffffffff8157646c>] ? inet_getpeer+0x17c/0x2b0
[32799839.603346] [<ffffffff8153c74b>] ? secure_ip_id+0x3b/0x40
[32799839.603351] [<ffffffff816474de>] kmalloc_large_node+0x57/0x85
[32799839.603357] [<ffffffff81165ea5>] __kmalloc_node_track_caller+0x195/0x1e0
[32799839.603360] [<ffffffff81534d8b>] ? __alloc_skb+0x4b/0x240
@Jerry-Fix
Jerry-Fix / op1
Created December 20, 2013 09:55
600G x 4(sas, 10k), raid10
Iozone: Performance Test of File I/O
Version $Revision: 3.408 $
Compiled for 64 bit mode.
Build: linux
Contributors:William Norcott, Don Capps, Isom Crawford, Kirby Collins
Al Slater, Scott Rhine, Mike Wisner, Ken Goss
Steve Landherr, Brad Smith, Mark Kelly, Dr. Alain CYR,
Randy Dunlap, Mark Montague, Dan Million, Gavin Brebner,
Jean-Marc Zucconi, Jeff Blomberg, Benny Halevy, Dave Boone,
@Jerry-Fix
Jerry-Fix / op2
Created December 20, 2013 09:56
480G x 12(Intel SSD 3500), raid10
# iozone -Rab output.xls -i 0 -i 1 -i 2 -y 4K -q 2M -n 4K -g 20G -S 8M -+u -f /mnt/10/Bonnie.64999 -z | tee iozone.txt
Iozone: Performance Test of File I/O
Version $Revision: 3.408 $
Compiled for 64 bit mode.
Build: linux
Contributors:William Norcott, Don Capps, Isom Crawford, Kirby Collins
Al Slater, Scott Rhine, Mike Wisner, Ken Goss
Steve Landherr, Brad Smith, Mark Kelly, Dr. Alain CYR,
Randy Dunlap, Mark Montague, Dan Million, Gavin Brebner,
@Jerry-Fix
Jerry-Fix / op3
Created December 20, 2013 09:56
2T x 12(sata, 7.2k), raid10
# iozone -Rb output.xls -r 4K -s 2G
Iozone: Performance Test of File I/O
Version $Revision: 3.408 $
Compiled for 64 bit mode.
Build: linux
Contributors:William Norcott, Don Capps, Isom Crawford, Kirby Collins
Al Slater, Scott Rhine, Mike Wisner, Ken Goss
Steve Landherr, Brad Smith, Mark Kelly, Dr. Alain CYR,
Randy Dunlap, Mark Montague, Dan Million, Gavin Brebner,
@Jerry-Fix
Jerry-Fix / nexus 752
Created January 16, 2014 14:20
nexus 752 step by step
1. 7004_A
开启特性
feature vpc
feature lacp
no ip domain-lookup
建立 VRF 与 peer-keepalive,将建立的 peer-keepalive 成员端口加入到 VRF 中,与 7004 的路由表隔离
interface mgmt0
vrf member management
ip address 10.1.1.1/24
@Jerry-Fix
Jerry-Fix / gist:9047151
Created February 17, 2014 09:02
bonding
RH & CentOS
1. mv /etc/modprobe.d/ipv6.conf /var/tmp
2. cat /etc/modprobe.d/bonding.conf
alias bond0 bonding
options bond0 mode=0 miimon=100 downdelay=200 updelay=200
@Jerry-Fix
Jerry-Fix / ubuntu_rhel_bonding_config_template
Last active August 29, 2015 13:56
Ubuntu&RHEL bonding network config template
# yum install ifenslave iputils
# apt-get install ifenslave
# cat /etc/modprobe.d/bonding.conf
alias bond0 bonding
options bonding mode=6 miimon=100 downdelay=200 updelay=200
Ubuntu
# cat /etc/network/interfaces
auto eth0