Code Files

agent-sizes-poa.awk

Generated on Tue Dec 05 17:39:06 Eastern Standard Time 2006 from agent-sizes-poa.awk


# Program	: POA-SIZES.AWK
# Purpose	: Extract space information from directory listing
# Author	: Bob Jonkman <bjonkman@sobac.com>

# Copyright 2008 Bob Jonkman and/or SOBAC Microcomputer Services

#    This program is free software: you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation, either version 3 of the License, or
#    (at your option) any later version.
#
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.

# Date		: 24 June 2005

# Note      : Patterns have been selected for GroupWise POAs

BEGIN   {   Kibi = 1024 
            Mebi = Kibi*Kibi
            Gibi = Mebi*Kibi
            Tebi = Gibi*Kibi
            Pebi = Tebi*Kibi
            Exbi = Pebi*Kibi

            IGNORECASE = 1 ;

		    print("Capacity Index (OFFILES Files * OFUSER Files * PO Size / Exbi),PO stress (OFFILES Files * OFUSER Files * PO Size / Free Space / Mebi),Agent,PO Size (GiB),PO Files,GiBytes Free,OFMSG Files,OFMSG Size (MiB),OFUSER Files,OFUSER Size (MiB),INDEX files,INDEX Size (MiB),INDEX to OFUSER Files ratio,OFFILES Files,OFFILES Size (GiB),PROBLEM Files, PROBLEM Size (MiB),Log Files,Log Size (MiB),Agent Folder") ;
        }

function folderinfo(folder,   geterr) {
                    while ($0 !~ "File\\(s") 
                    {   geterr = getline 
                        if ((geterr == 0) || (geterr == -1))
                            return(ERRNO) ;
                    }
                    folderdata[folder "files"] += $1 ;
                    folderdata[folder "size"]  += $3 ;
                    return("OK") ;
}

            


(FNR==1)		{	agent = $NF ;

                    delete folderdata ;

                    while ($0 !~ "Directory of")
                    {
                        getline ;
                    }

                    link = $3 ;
}

/\\ofmsg/   {       folderinfo("ofmsg") ;
}

/\\ofuser$/  {      folderinfo("ofuser") ;  # Match at the end of a line only
}

/\\index/   {       folderinfo("index") ;
}

/\\offiles/ {       folderinfo("offiles") ;
}

/\\problem/  {      folderinfo("problem") ;
}

/\\OFS$/     {      folderinfo("ofs") ;     # Match at the end of a line only
}
                    

/Total Files Listed/    {   getline ;
                            Agentfiles = $1 ;
                            Agentsize  = $3 ;
                            getline ;
                            Volfree    = $3 ;

                            printf("%12i,",folderdata["offilesfiles"]*folderdata["ofuserfiles"]*Agentsize / Exbi ) | "sort /r" ;
                            printf("%12i,",folderdata["offilesfiles"]*folderdata["ofuserfiles"]*Agentsize / Volfree / Mebi ) | "sort /r" ;
                            printf("%s," , agent) | "sort /r" ;
                            printf("%6.1f,%i,%6.1f,", Agentsize / Gibi, Agentfiles, Volfree / Gibi)                          | "sort /r" ;
                            printf("%i,%6.1f,", folderdata["ofmsgfiles"],   folderdata["ofmsgsize"]   / Mebi ) | "sort /r" ;
                            printf("%i,%6.1f,", folderdata["ofuserfiles"],  folderdata["ofusersize"]  / Mebi ) | "sort /r" ;
                            printf("%i,%6.1f,", folderdata["indexfiles"],   folderdata["indexsize"]   / Mebi ) | "sort /r" ;
                            printf("%6.1f,", folderdata["indexfiles"]/folderdata["ofuserfiles"]           ) | "sort /r" ;
                            printf("%i,%6.1f,", folderdata["offilesfiles"], folderdata["offilessize"] / Gibi ) | "sort /r" ;
                            printf("%i,%6.1f,", folderdata["problemfiles"], folderdata["problemsize"] / Mebi ) | "sort /r" ;
                            printf("%i,%6.1f,", folderdata["ofsfiles"],     folderdata["ofssize"]     / Mebi ) | "sort /r" ;
                            printf("%s\n" , link) | "sort /r" ;

                            for (i in folderdata)
                                foldertotal[i] += folderdata[i] ;

                            Agentfilestotal += Agentfiles ;
                            Agentsizetotal  += Agentsize ;
                            Agentcount++ ;
}

END                     {   print("=====")
                            printf(",,") ;
                            printf("%i,", Agentcount)  ;
                            printf("%6.1f,%i,,", Agentsizetotal /  Gibi, Agentfilestotal)
                            printf("%i,%6.1f,", foldertotal["ofmsgfiles"],   foldertotal["ofmsgsize"]   / Mebi )    
                            printf("%i,%6.1f,", foldertotal["ofuserfiles"],  foldertotal["ofusersize"]  / Mebi )  
                            printf("%i,%6.1f,", foldertotal["indexfiles"],   foldertotal["indexsize"]   / Mebi )
                            printf("%6.1f,", foldertotal["indexfiles"]/foldertotal["ofuserfiles"])  ;
                            printf("%i,%6.1f,", foldertotal["offilesfiles"], foldertotal["offilessize"] / Gibi )  
                            printf("%i,%6.1f,", foldertotal["problemfiles"], foldertotal["problemsize"] / Mebi )  
                            printf("%i,%6.1f,", foldertotal["ofsfiles"],     foldertotal["ofssize"]     / Mebi )  
                            printf("Totals\n")  ;
                
}



# EOF: POA-SIZES.AWK
   

1 files processed.