¿ù°£ Àα⠰Խù°

°Ô½Ã¹° 256°Ç
   
IIS ·Î±×¸¦ ÀÌ¿ëÇؼ­ Æ®·¡ÇÈ IN/OUT ¼öÄ¡È®ÀÎ
±Û¾´ÀÌ : ÃÖ°í°ü¸®ÀÚ ³¯Â¥ : 2011-07-29 (±Ý) 10:30 Á¶È¸ : 7709
±ÛÁÖ¼Ò :
                                
Ãâó : http://svrstudy.tistory.com/58

# ·Î±× ÆÄÀÏ °æ·Î¸¦ ÀÔ·Â ¹Þ½À´Ï´Ù. 
Param (
  [String] $Path="C:\inetpub\logs\LogFiles\test_url\W3SVC2\u_ex110729.log"
)
# ÇÊ¿äÇÑ º¯¼öµéÀ» ¹Ì¸® ÁöÁ¤ ÇÕ´Ï´Ù.
[INT]$RECV_TOTAL="0"
[INT]$SEND_TOTAL="0"
[INT]$CS_NUM=0;
[INT]$SC_NUM=0;
 
$KB=1024
$MB=1024*1024
$GB=1024*1024*1024
get-content $Path | %{
    #Pattern Check
    if ( $_ | Select-String -Pattern "#Fields" ) {
        # Fields °ª¿¡ ´ëÇÑ ¸¶À̳ʽº °ª ó¸®.
        [INT]$CNT=-1;
        foreach ($element in $_.Split(' '))
        {
           if ( $element -eq "sc-bytes" ){
             $SC_NUM=$CNT;
           }elseif ( $element -eq "cs-bytes" ) {
             $CS_NUM=$CNT;
           }
           $CNT+=1;
        }
     }
     elseif ( $_ | Select-String -Pattern "^[^#]" )
     {
# ½ÇÁ¦ ¼Û/¼ö½ÅµÈ °ªÀ» Split ¸í·ÉÀ» ÅëÇØ ÀúÀåÇÕ´Ï´Ù.
 [int]$SEND_BYTE=$_.Split(' ')[$SC_NUM];
 [int]$RECV_BYTE=$_.Split(' ')[$CS_NUM];
 [int]$RECV_TOTAL+=$RECV_BYTE;
 [int]$SEND_TOTAL+=$SEND_BYTE;
    }
}
If ( $RECV_TOTAL -gt $GB ){
 $RECV_TOTAL = $RECV_TOTAL / $GB
 Write-Host "Total  In : $RECV_TOTAL GByte"
} elseif ( $RECV_TOTAL -gt $MB){
        $RECV_TOTAL = $RECV_TOTAL / $MB
 Write-Host "Total  In : $RECV_TOTAL MByte"
}elseif ( $RECV_TOTAL -gt  $KB){
 $RECV_TOTAL = $RECV_TOTAL / $KB
 Write-Host "Total  In : $RECV_TOTAL KByte"
}else{
 Write-Host "Total  In : $RECV_TOTAL Byte"
}
If ( $SEND_TOTAL -gt $GB ){
 $SEND_TOTAL = $SEND_TOTAL / $GB
 Write-Host "Total Out : $SEND_TOTAL GByte"
} elseif ( $SEND_TOTAL -gt $MB){
        $SEND_TOTAL = $SEND_TOTAL / $MB
 Write-Host "Total Out : $SEND_TOTAL MByte"
}elseif ( $SEND_TOTAL -gt  $KB){
 $SEND_TOTAL = $SEND_TOTAL / $KB
 Write-Host "Total Out : $SEND_TOTAL KByte"
}else{
 Write-Host "Total Out : $SEND_TOTAL Byte"
}








À̸§ Æнº¿öµå
ºñ¹Ð±Û (üũÇÏ¸é ±Û¾´À̸¸ ³»¿ëÀ» È®ÀÎÇÒ ¼ö ÀÖ½À´Ï´Ù.)
¿ÞÂÊÀÇ ±ÛÀÚ¸¦ ÀÔ·ÂÇϼ¼¿ä.
   

 



 
»çÀÌÆ®¸í : ¸ðÁö¸®³× | ´ëÇ¥ : ÀÌ°æÇö | °³ÀÎÄ¿¹Â´ÏƼ : ·©Å°´åÄÄ ¿î¿µÃ¼Á¦(OS) | °æ±âµµ ¼º³²½Ã ºÐ´ç±¸ | ÀüÀÚ¿ìÆí : mojily°ñ¹ðÀÌchonnom.com Copyright ¨Ï www.chonnom.com www.kyunghyun.net www.mojily.net. All rights reserved.