jablonka.czprosek.czf

hotsanic

Subversion Repositories:
[/] [trunk/] [modules/] [diskio/] [platform/] [netbsd.pm] - Rev 31

Compare with Previous - Blame - Download


package HotSaNICmod::OSdep;

use RRDs;

sub version {
  ($VERSION = '$Revision: 1.3 $') =~ s/.*(\d+\.\d+).*/$1/;
  return "$^O.pm $VERSION";
  }

sub sample {
  my ($drive,$KBt,$xfr,$time,$MBs);
  open IOSTAT, "/usr/sbin/iostat -Ix |"
    or die time."diskio: $!";
  while (<IOSTAT>) {
    chomp;
    ($drive,$KBt,$xfr,$time,$MB) = split / +/, $_;
    next if ($drive =~ /device/);
    #print localtime(time)." diskio: $drive, $KBt, $xfr, $time, $MB\n";
 
    if ( ! -e "rrd/$drive.rrd" ) { system("./makerrd","$drive","U") }
    RRDs::update "rrd/$drive.rrd",time.":".($KBt*1024).":$xfr:$time:".($MB*1024*1024);
    if ($ERROR = RRDs::error) { print time," ",$args{MODNAME},": unable to update `$drive.rrd': $ERROR\n"; }
    }
  close IOSTAT;
  }

1;


Powered by WebSVN 2.2.1