sub NixNodes(@) { my @nixnodes = @_; my ($display, $chkbo_separator, $index, @threads, @header, @host_data, @hosts) = ("", hr, 0, (), (), (), ()); my @thr_output : shared; foreach my $entry (@nixnodes) { next unless $entry; my ($host,$os,$tasks) = (split(/,/, $entry, 3)); $hosts[$index] = $host; $header[$index] = a({name=>$host}); if (&CheckVersion($host, VERSION) == -1) { warn "$host: Version mismatch or /usr/local/bin/report_agent.pl is not in (x)inetd config"; } else { foreach my $task ((split(/,/,$tasks))) { print "Host: $host, Task: $task\n"; no strict 'refs'; my $command="parse_".$task; my @chkbo = (); if ($task eq 'top20') { # $threads[$index] = threads->create("parse_top20",$os,&RunCommand($host, 'top20')); $threads[$index] = async {&parse_top20($os,&RunCommand($host, 'top20'))}; } elsif ($task eq 'chkfs') { # $threads[$index] = threads->create("parse_chkfs","",&RunCommand($host, 'chkfs')); $threads[$index] = async {&parse_chkfs("",&RunCommand($host, 'chkfs'))}; } elsif ($task eq 'chkbo') { $/ = "\n****************************************\n"; if ($hour >= 14) { @chkbo = &RunCommand($host,'chkbo -d1'); } else { @chkbo = &RunCommand($host,'chkbo'); } if (scalar(@chkbo) > 1) { shift @chkbo if (defined $chkbo[0] and $chkbo[0] =~ /^\s*$/); } # $threads[$index] = threads->create("parse_chkbo","$host","@chkbo"); $threads[$index] = async {&parse_chkbo("$host","@chkbo")}; } else { # $threads[$index] = threads->create("$command",&RunCommand($host, $task)); $threads[$index] = async{&$command(&RunCommand($host, $task))}; } } } $index++; } my $index2 = 0; for my $thr (threads->list) { if ($thr->tid && !threads::equal($thr, threads->self)) { print "Thread ID is ".$thr->tid." of $index\n"; $host_data[$index2] = $thr->join; $display .= $header[$index2] if ($header[$index2]); $display .= table({-width=>'100%',-border=>'1',-class=>'main'}, Tr(th({-class=>'nodename'},b(uc($hosts[$index2])))), Tr(td($host_data[$index2]))). a({-href=>'#top'},font({-class=>'top'},"Top")); $index2++; } } return $display; }