From: Olaf W. <ow...@us...> - 2007-01-28 17:02:04
|
Update of /cvsroot/ipcop/ipcop/html/cgi-bin In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv30028/html/cgi-bin Modified Files: Tag: IPCOP_v1_4_0 status.cgi Log Message: Display used and available Inodes on system status page. Index: status.cgi =================================================================== RCS file: /cvsroot/ipcop/ipcop/html/cgi-bin/status.cgi,v retrieving revision 1.6.2.8 retrieving revision 1.6.2.9 diff -C2 -d -r1.6.2.8 -r1.6.2.9 *** status.cgi 19 Dec 2006 20:37:49 -0000 1.6.2.8 --- status.cgi 28 Jan 2007 17:01:59 -0000 1.6.2.9 *************** *** 74,77 **** --- 74,78 ---- <a href='#memory'>$Lang::tr{'memory'}</a> | <a href='#disk'>$Lang::tr{'disk usage'}</a> | + <a href='#inodes'>$Lang::tr{'inodes usage'}</a> | <a href='#uptime'>$Lang::tr{'uptime and users'}</a> | <a href='#modules'>$Lang::tr{'loaded modules'}</a> | *************** *** 254,257 **** --- 255,318 ---- &Header::closebox(); + print "<a name='inodes'/>\n"; + &Header::openbox('100%', 'left', $Lang::tr{'inodes usage'}); + print "<table>\n"; + + print <<END + <tr> + <td align='left' class='boldbase'><b>$Lang::tr{'device'}</b></td> + <td align='left' class='boldbase'><b>$Lang::tr{'mounted on'}</b></td> + <td align='center' class='boldbase'><b>Inodes</b></td> + <td align='center' class='boldbase'><b>$Lang::tr{'used'}</b></td> + <td align='center' class='boldbase'><b>$Lang::tr{'free'}</b></td> + <td align='left' class='boldbase' colspan='2'><b>$Lang::tr{'percentage'}</b></td> + </tr> + END + ; + + open(DF,'/bin/df -i -x rootfs|'); + my @df = <DF>; + close DF; + + # skip first line: + # Filesystem Inodes IUsed IFree IUse% Mounted on + shift(@df); + chomp(@df); + # merge all lines to one single line seperated by spaces + my $all_inOneLine=join(' ',@df); + + # now get all entries in an array + my @all_entries=split(' ',$all_inOneLine); + + # loop over all entries. Six entries belong together. + while (@all_entries > 0) { + my $device=shift(@all_entries); + my $size=shift(@all_entries); + my $used=shift(@all_entries); + my $free=shift(@all_entries); + my $percent=shift(@all_entries); + my $mount=shift(@all_entries); + print <<END + <tr> + <td>$device</td> + <td>$mount</td> + <td align='right'>$size</td> + <td align='right'>$used</td> + <td align='right'>$free</td> + <td> + END + ; + &percentbar($percent); + print <<END + </td> + <td align='right'>$percent</td> + </tr> + END + ; + + } + print "</table>\n"; + &Header::closebox(); + print "<a name='uptime'/>\n"; &Header::openbox('100%', 'left', $Lang::tr{'uptime and users'}); |