[Date Prev]   [Date Next] [Thread Prev]   [Thread Next] [Date Index]   [Thread Index]

 

     [nocol-users] hostmon-client.linux pstat

FYI:

In
## $Header: /home/vikas/src/nocol/perlnocol/hostmon-osclients/RCS/hostmon-client
.linux,v 0.13 1999/11/05 03:23:42 vikas Exp $

Number of open files is calculated incorectlyu on RH6.2 (2.2.14):
it takes the first number from /proc/sys/fs/file-nr instead of the second
see /usr/src/linux-2.2.14/Documentation/proc.txt

$ cat /proc/sys/fs/file-nr
604	155	4096

new code could be like this:

sub pstat {
  local *PSTAT;
  open PSTAT, '/proc/sys/fs/file-nr' or warn $!;
  local($filealloc,$filenr,$filemax) = split(/\s+/,<PSTAT>);
  close PSTAT;
  #local($filemax) = `cat /proc/sys/fs/file-max`;       
  printf "FileTable %d %%used\n", int($filenr * 100 / $filemax);

  local $meminfo = `cat /proc/meminfo`;                               
  $meminfo =~ /SwapFree:\s+(\d+)/;
  printf("SwapSpace %d MBytes\n", int($1/1024) );

}  # end &pstat()


BTW netstat is also broken because it's output differs from the prev versions of RH


-- 
Dmitry Sazonov        <dmitry@bsc.lv>
IT,BankServiss, Riga  ph +371-7092553, mob: +371-9498710