Well, first off, it's not my template set - It's MarkRound's. I just finished porting it to Solaris. I have been talking with Mark, but haven't heard from him in several days. I'd rather submit my changes to him, get them approved, and integrated into his set posted in the first forum post. I've seen too many threads stretch on for pages with revisions scattered here and there....
To port it to Solaris, I changed sub_process in iostat.pl as follows:
Code: Select all
sub process {
my $uname = `/bin/uname -a`;
my $ostype = "other";
if ($uname =~ /SunOS/) {
$ostype = "solaris";
}
if ($uname =~ /Linux/) {
$ostype = "linux";
}
$devices = 1;
open( IOSTAT, $iostat_cache )
or die("Could not open iostat cache $iostat_cache : $!");
my $header_seen = 0;
while (<IOSTAT>) {
if (/^[D|d]evice/) {
$header_seen++;
next;
}
next if ( $header_seen < 2 );
next if (/^$/);
if ($ostype eq 'linux') {
/^([a-z0-9\-\/]+)\s+(\d+[\.,]\d+)\s+(\d+[\.,]\d+)\s+(\d+[\.,]\d+)\s+(\d+[\.,]\d+)\s+(\d+[\.,]\d+)\s+(\d+[\.,]\d+)\s+(\d+[\.,]\d+)\s+(\d+[\.,]\
d+)\s+(\d+[\.,]\d+)\s+(\d+[\.,]\d+)\s+(\d+[\.,]\d+)/;
$stats{"$base_oid.1.$devices"} = $devices; # index
$stats{"$base_oid.2.$devices"} = $1; # device name
$stats{"$base_oid.3.$devices"} = $2; # rrqm/s
$stats{"$base_oid.4.$devices"} = $3; # wrqm/s
$stats{"$base_oid.5.$devices"} = $4; # r/s
$stats{"$base_oid.6.$devices"} = $5; # w/s
$stats{"$base_oid.7.$devices"} = $6; # rkB/s
$stats{"$base_oid.8.$devices"} = $7; # wkB/s
$stats{"$base_oid.9.$devices"} = $8; # avgrq-sz
$stats{"$base_oid.10.$devices"} = $9; # avgqu-sz
$stats{"$base_oid.11.$devices"} = $10; # await
$stats{"$base_oid.12.$devices"} = $11; # svctm
$stats{"$base_oid.13.$devices"} = $12; # %util
}
if ($ostype eq 'solaris') {
/^([a-z0-9\-\/]+)\s+(\d+\.\d+)\s+(\d+\.\d+)\s+(\d+\.\d+)\s+(\d+\.\d+)\s+(\d+\.\d+)\s+(\d+\.\d+)\s+(\d+\.\d+)\s+(\d+)\s+(\d+)/;
$stats{"$base_oid.1.$devices"} = $devices; # index
$stats{"$base_oid.2.$devices"} = $1; # device name
$stats{"$base_oid.3.$devices"} = $2; # r/s
$stats{"$base_oid.4.$devices"} = $3; # w/s
$stats{"$base_oid.5.$devices"} = $4; # kr/s
$stats{"$base_oid.6.$devices"} = $5; # kw/s
$stats{"$base_oid.7.$devices"} = $6; # wait
$stats{"$base_oid.8.$devices"} = $7; # actv
$stats{"$base_oid.9.$devices"} = $8; # svc_t
$stats{"$base_oid.10.$devices"} = $9; # %w
$stats{"$base_oid.11.$devices"} = $10; # %b
}
$devices++;
}
}
To summarize, I simply cut back the fields from 13 to 11. I also had to change 'Device' to '[D|d]evice' since the capitalization was different in Solaris <g> Someone else on my team came up with the regex, using a tool called KRegExpEditor.
Then I created a new iostat-solaris.xml, data query, data templates and graph templates, and named them "Solaris - X - X" instead of "Linux - X - X".
I think the best way to handle this moving forward is to export the Data Queries separately, thus allowing an end user to import only the templates they need for their given architecture, but everyone should be able to use the same iostat.pl.
So, I imagine you could take the same approach, but if it uses something other than iostat, it might be worth taking what's been done here, hacking it up a bit, and re-branding it as an entirely different template.