|
Blue Forest http://www.lslnet.com at 11:18 on June 26, 2006
Inside look at the statistics to a server one of three methods Premise : that the machinery is at services, but only provide photo link
Statistics him one day how the flow, it would only need about 300,000, as follows :
1, iptables-L-n-V (with this, first of all, you have to support the Kernel)
From 00:00 to implement at a time of 23:59 for another, and then took his OUTPUT value
[code]#!/bin/bash
#
DATE=$ (date '+%Y%m%d')
HOSTNAME=$ (hostname)
FLUX=$ (iptables-L-n -v|grep "OUTPUT" |awk F, "" The '{print $ 2)' |sed 'depends strongly) 4003rd')
Echo "$HOSTNAME $FLUX" |tee /home/flux.$DATE.log[/code]
2, x with cronolog record daily log, the next shell out pictures of local trails, and bring it into /tmp/pic.tmp table, for example : -2 /tmp/pic.tmp [code]head
/mnt/image/phpauction/uploaded/b4/8a/4e/4f/b48a4e4fbed9e0a62b831f34615c0bf5.jpg_sum.jpg
/mnt/image/phpauction/uploaded/51/10/78/80/9.jpg_sum.jpg[/code]
[code]#!/bin/bash
#
DATE=$ (date '+%Y-%m-%d')
DIR=$ (date +%Y/%m)
Awk-F ' "' '{print $ 2)' $DATE-access_log|awk '{print $ 2)' |\
Awk-F '? '' {print $ Objects' |sed 's/%.*//' |sed n '/^\//p' "/tmp/pic.tmp[/code]
Then the following terms of its total size of the paper
[code]C=0;cat /tmp/pic.tmp|while Read line ;do ii=$ (1s l $line|awk '{print $ 5}') ;C=$ (expr $C + $ii) ;done 2>error.log; echo $C [/code]
Or [code]cat /tmp/pic.tmp |while read line; do cat $line;done|wc -c[/code]
The second very slow to die, we have other ways? Or optimize my shell script |
Inside look at the statistics to a server one of three methods Well, collectors! |
| |