7/31/2013

python write the json and php read it periodically

python part:

#save your data into python dictionary - Ex. testResultsJson
testResultsJson = {}
fjs = open('/var/www/xxx/state.json','w')
fjs.write(json.dumps(testResultsJson))
fjs.close()


php part:

$file = "/var/www/xxx/state.json";
$obj = json_decode(file_get_contents($file));
#Ex. i want to get the timestamp info from this object.
$timestring =  'Last Updated:'.$obj.'timestamp.';

7/26/2013

GTM 常用指令紀錄

create gtm datacenter dc1 dc2

create gtm server ltm1 addresses add { 10.10.100.1 } monitor bigip datacenter dc1 virtual-servers add { 10.10.100.10:80 10.10.100.11:80 10.10.100.12:80 }

create gtm server ltm2 addresses add { 10.10.200.1 } monitor bigip datacenter dc3 virtual-servers add { 10.10.200.10:80 10.10.200.11:80 10.10.200.12:80 }

create gtm pool gpool1 members add { 10.10.100.10:80 {ratio 1} 10.10.100.11:80 {ratio 2} 10.10.100.12:80 {ratio 3} } load-balancing-mode ratio verify-member-availability disabled

create gtm pool gpool2 members add { 10.10.200.10:80 {ratio 1} 10.10.200.11:80 {ratio 2} 10.10.200.12:80 {ratio 3} } load-balancing-mode ratio verify-member-availability disabled

create gtm wideip test.wip.com pool-lb-mode ratio pools add { gpool1 { ratio 1 } gpool2 { ratio 2 } } persistence enabled ttl-persistence 300 rules add { testwip-rule }

如何在 GTM 使用 tmsh 新增多members 到 pool當中

tmsh# gtm pool modify POOLNAME members add { ip1:port ip2.port }

7/25/2013

set static mac address on juniper router

(config)# arp 1.1.1.1 gigabitEthernet x/x/x/x AAAA.BBBB.CCCC

7/23/2013

常忘記但會用到的 shell script while loop

Example:

while true; do ls; sleep 2; done

while true; do [command]; sleep [duration];  done


7/15/2013

紀錄常用protocol header

mac header size: 14 B
ip header size: 20 B
tcp header size: 20 B
udp header size: 8 B