jablonka.czprosek.czf

hotsanic

Subversion Repositories:
[/] [trunk/] [modules/] [diskio/] [platform/] [linux.pm] - Blame information for rev 31

 

Line No. Rev Author Line
131simandlpackage HotSaNICmod::OSdep;
2 
3use RRDs;
4 
5sub version {
6 ($VERSION = '$Revision: 1.8 $') =~ s/.*(\d+\.\d+).*/$1/;
7 return "$^O.pm $VERSION";
8 }
9 
10sub sample {
11 my %args=@_;
12 
13 if ($args{KERNEL} eq "2.4") {
14 # disk_io: (8,0):(985065,41330,436455,943735,13075448) (8,1):(12563,6363,333604,6200,167608) (8,2):(11194,11012,90140,182,3160)
15 open FILE,"/proc/stat";
16 while (<FILE>) { (undef,@stats)=split if /disk_io/; }
17 close FILE;
18 foreach my $entry (@stats) {
19 $entry=~ s/[()]//g;
20 $entry=~ s/:/,/g;
21 my ($num1,$num2,undef,$racc,$rblk,$wacc,$wblk)=split /,/,$entry;
22 $num=$num1."_".$num2;
23 store_values($args{MODNAME},$num,$racc,$wacc,$rblk,$wblk,512);
24 }
25 }
26 elsif ($args{KERNEL} eq "2.2") {
27 # disk 1494755 377215 221577 144318
28 # disk_rio 564538 286941 151189 77490
29 # disk_wio 930217 90274 70388 66828
30 # disk_rblk 1129538 573882 302378 154980
31 # disk_wblk 1860536 180548 140776 133656
32 open FILE,"/proc/stat";
33 while (<FILE>) {
34 (undef,@readacc)=split if /disk_rio/;
35 (undef,@writeacc)=split if /disk_wio/;
36 (undef,@readblk)=split if /disk_rblk/;
37 (undef,@writeblk)=split if /disk_wblk/;
38 }
39 close FILE;
40 $num=0;
41 while (@readacc) {
42 $racc=shift @readacc;
43 $wacc=shift @writeacc;
44 $rblk=shift @readblk;
45 $wblk=shift @writeblk;
46 store_values($args{MODNAME},$num,$racc,$wacc,$rblk,$wblk,512);
47 
48 $num++;
49 }
50 }
51 }
52 
53sub store_values {
54 my ($MODNAME,$drive,$racc,$wacc,$rblk,$wblk,$blksize)=@_;
55 
56 if ( ! -e "rrd/$drive.rrd" ) { system("./makerrd","$drive","U") }
57 RRDs::update "rrd/$drive.rrd",time.":$racc:".($rblk*$blksize).":$wacc:".($wblk*$blksize);
58 if ($ERROR = RRDs::error) { print time," ","$MODNAME: unable to update `$drive.rrd': $ERROR\n"; }
59 }
60 
611;
62 
63# TODO:
64# adapt module to use new kernel structure
65#
66# ($major,$minor,$blocks,$name,$rio;$rmerge,$rsect,$wio;$wmerge,$wsect,$wuse,$running,$aveq) = split / +/,$line;
67#
68# cat /proc/partitions
69# major minor #blocks name rio rmerge rsect ruse wio wmerge wsect wuse running use aveq
70#
71# 104 0 35561280 cciss/c0d0 68909 724405 6336824 419050 6956600 6890686 111366402 19464860 0 1497410 19883670
72# 104 1 24464 cciss/c0d0p1 27 607 1268 80 7 2 18 20 0 80 100
73# 104 2 1052640 cciss/c0d0p2 5 6 64 30 265 1049 10984 14060 0 2210 14090
74# 104 3 4198320 cciss/c0d0p3 9254 5869 120470 60170 2145618 2006052 33214056 1824850 0 283200 1885000
75# 104 4 1 cciss/c0d0p4 1 0 2 0 0 0 0 0 0 0 0
76# 104 5 19926704 cciss/c0d0p5 58885 714532 6187162 342490 3319747 3243011 52953792 15151870 0 736060 15494290
77# 104 6 10359104 cciss/c0d0p6 714 2582 26194 10440 1490963 1640572 25187552 2474060 0 610740 2484240
78# 104 16 71126640 cciss/c0d1 46332 383183 3435874 228520 20929 467855 3910272 2863240 0 215380 3091720
79# 104 17 71126624 cciss/c0d1p1 46329 383174 3435850 228500 20929 467855 3910272 2863240 0 215360 3091700
80 
81# major minor #blocks name rio rmerge rsect ruse wio wmerge wsect wuse running use aveq
82#
83# 8 0 4233600 sda 87022 52087 1111906 12118020 6330547 2877522 73886304 37324609 0 15697687 6495886
84# 8 1 1 sda1 0 0 0 0 0 0 0 0 0 0 0
85# 8 5 149625 sda5 104 29 890 1280 115 52 1336 1270 0 1940 2550
86# 8 6 303502 sda6 0 0 0 0 0 0 0 0 0 0 0
87# 8 7 1534270 sda7 41 25 354 1020 1 0 8 0 0 350 1020
88# 8 8 511402 sda8 21 25 194 240 1 0 8 0 0 160 240
89# 8 9 715144 sda9 90 50 946 2800 530 254 6272 5850 0 5720 8650
90# 8 10 1018678 sda10 86759 51937 1109466 12112590 6329900 2877216 73878680 37317489 0 15690877 6483336
91# 8 16 8958120 sdb 285 6274 52274 17480 9 3 96 0 0 2750 17480
92# 8 17 8956206 sdb1 284 6271 52266 17470 9 3 96 0 0 2740 17470
93# 3 0 8257032 hda 193726 71233 2119314 2107820 5636704 4987727 85732672 18207224 0 22854840 20323274
94# 3 1 1 hda1 0 0 0 0 0 0 0 0 0 0 0
95# 3 5 253953 hda5 12835 9600 178994 190470 1957032 1611062 28545064 12216960 0 3050380 12407430
96# 3 6 407200 hda6 2898 10253 105216 97710 2766 11599 117920 77040 0 61740 174800
97# 3 7 4092448 hda7 169697 33591 1626610 1580600 2343809 2626912 40498424 31892627 0 13772780 33480437
98# 3 8 1020064 hda8 3100 9909 104066 169050 741238 469447 9686144 15820540 0 5594140 15990550
99# 3 9 508000 hda9 586 7568 65226 13620 1586 1336 23376 22700 0 24530 36320
100# 3 10 1971616 hda10 4603 291 39146 56290 590273 267371 6861744 1127030 0 852560 1183330
101 
102# major minor #blocks name rio rmerge rsect ruse wio wmerge wsect wuse running use aveq
103#
104# 34 0 80043264 ide/host2/bus1/target0/lun0/disc 2368478 1209106 28620666 20372050 2689313 9234680 95391960 22393060 0 26560040 42765110
105# 34 1 80043232 ide/host2/bus1/target0/lun0/part1 2368478 1209106 28620666 20372050 2689313 9234680 95391960 22393060 0 26560040 42765110
106# 33 0 78156288 ide/host2/bus0/target0/lun0/disc 1416844 466054 15063178 5984550 2219955 4829244 56393656 13350050 0 11109670 19334600
107# 33 1 78156256 ide/host2/bus0/target0/lun0/part1 1416844 466054 15063178 5984550 2219955 4829244 56393656 13350050 0 11109670 19334600
108# 22 0 80043264 ide/host0/bus1/target0/lun0/disc 9745143 12845870 180728098 9097001 21289780 13295910 276702960 30294484 0 12317751 39394056
109# 22 1 80043232 ide/host0/bus1/target0/lun0/part1 9745143 12845870 180728098 9097001 21289780 13295910 276702960 30294484 0 12317751 39394056
110# 22 64 80043264 ide/host0/bus1/target1/lun0/disc 1984750 1957415 31537290 22959400 9764772 6543617 130479784 39073688 0 31500000 19091765
111# 22 65 80043232 ide/host0/bus1/target1/lun0/part1 1984749 1957412 31537282 22959400 9764772 6543617 130479784 39073688 0 31500000 19091765
112# 3 0 15007608 ide/host0/bus0/target0/lun0/disc 6632275 5644782 98028258 22654492 70997906 80414575 1213797554 23639842 0 30358495 4784751
113# 3 1 16033 ide/host0/bus0/target0/lun0/part1 1682 29794 62952 19840 651 1699 4712 29320 0 24940 49160
114# 3 2 409657 ide/host0/bus0/target0/lun0/part2 18469 37372 446736 635280 11045 38713 405728 985320 0 520850 1621540
115# 3 3 14578987 ide/host0/bus0/target0/lun0/part3 6612122 5577610 97518554 21998862 70986209 80374163 1213387112 22625202 0 30200585 3113541
116 

Powered by WebSVN 2.2.1