1 | 31 | simandl | package HotSaNICmod::OSdep; |
2 | | | |
3 | | | use RRDs; |
4 | | | |
5 | | | sub version { |
6 | | | ($VERSION = '$Revision: 1.3 $') =~ s/.*(\d+\.\d+).*/$1/; |
7 | | | return "$^O.pm $VERSION"; |
8 | | | } |
9 | | | |
10 | | | sub sample { |
11 | | | my ($drive,$KBt,$xfr,$time,$MBs); |
12 | | | open IOSTAT, "/usr/sbin/iostat -Ix |" |
13 | | | or die time."diskio: $!"; |
14 | | | while (<IOSTAT>) { |
15 | | | chomp; |
16 | | | ($drive,$KBt,$xfr,$time,$MB) = split / +/, $_; |
17 | | | next if ($drive =~ /device/); |
18 | | | #print localtime(time)." diskio: $drive, $KBt, $xfr, $time, $MB\n"; |
19 | | | |
20 | | | if ( ! -e "rrd/$drive.rrd" ) { system("./makerrd","$drive","U") } |
21 | | | RRDs::update "rrd/$drive.rrd",time.":".($KBt*1024).":$xfr:$time:".($MB*1024*1024); |
22 | | | if ($ERROR = RRDs::error) { print time," ",$args{MODNAME},": unable to update `$drive.rrd': $ERROR\n"; } |
23 | | | } |
24 | | | close IOSTAT; |
25 | | | } |
26 | | | |
27 | | | 1; |
28 | | | |