--- netsaint_statd_v2.15/netsaint_statd Mon Apr 8 15:40:18 2002 +++ netsaint_statd_mod Wed Aug 30 09:27:14 2006 @@ -41,7 +41,7 @@ # server in here, for security reasons (not that my program has any # security bugs). :P -my @allowed_hosts; # = ("127.0.0.1","10.20.30.40","123.123.123.123"); +my @allowed_hosts; # = ("10.55.0.18"); my $os = os_uname(); $os = "IRIX" if $os =~ "IRIX64"; # IRIX can have two different unames. @@ -91,6 +91,8 @@ proccommand => "/bin/ps ax", procstates => "RSTDIZ", uptimecommand => "/usr/bin/uptime", + raid3wareunits => "/usr/local/sbin/tw_cli info XXX unitstatus", + raid3ware => "/usr/local/sbin/tw_cli info", }, "NEXTSTEP" => { dfcommand => "/bin/df", @@ -152,7 +154,9 @@ "alldisks" => \&alldisks, "uptime" => \&uptime, "procs" => \&procs, - "named_proc" => \&named_proc + "named_proc" => \&named_proc, + "raid3wareunits" => \&raid3wareunits, + "raid3ware" => \&raid3ware ); ################################################################################ @@ -368,3 +372,54 @@ print Client ++$#_; close(PROCOUT); } + +sub raid3wareunits { + my $controller = shift; + + my $unitlisting; + my $command = "$commandlist{$os}{raid3wareunits}"; + $command =~ s/XXX/$controller/g; + + open(PROCOUT, "$command |") || die; + $_ = ; + while($_ = ) { + if (/^(u\S+)\s+(\S+)\s*(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s*/) { + $unitlisting .= '(' . $1 . ',' . $2 . ',' . $3 .')'; + } + } + if (defined($unitlisting)) { + print Client $unitlisting; + } else { + print Client "no units?"; + } + + $unitlisting = undef; + close(PROCOUT); +} + +sub raid3ware { + my $controller = shift; + + my $controllerlisting; + my $command = "$commandlist{$os}{raid3ware}"; + + open(PROCOUT, "$command |") || die; + $_ = ; + while($_ = ) { + +# Ctl Model Ports Drives Units NotOpt RRate VRate BBU +# ------------------------------------------------------------------------ +# c0 9550SX-8LP 8 8 3 0 4 4 Testing + if (/^(c\d+)\s+(\S+)\s*(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s*/) { + $controllerlisting .= '(' . $1 . ',' . $2 . ',' . $3 . ',' . $4 . ',' . $5 . ',' . $6 . ',' . $7 . ',' . $8 . ',' . $9 . ')'; + } + } + if (defined($controllerlisting)) { + print Client $controllerlisting; + } else { + print Client "no controllers?"; + } + + $controllerlisting = undef; + close(PROCOUT); +}