ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/i-scream/projects/cms/source/host/ihost-perl/ihost.pl
(Generate patch)

Comparing projects/cms/source/host/ihost-perl/ihost.pl (file contents):
Revision 1.36 by tdb, Wed Nov 14 16:41:30 2001 UTC vs.
Revision 1.38 by tdb, Mon Nov 19 15:07:56 2001 UTC

# Line 33 | Line 33 | use vars qw (
33               $fqdn
34               $pidfile
35               $retry_wait
36 <             @statgrab
36 >             @data
37              );
38  
39   if (@ARGV != 2) {
# Line 257 | Line 257 | sub tcp_configure() {
257   #-----------------------------------------------------------------------
258   sub send_udp_packet() {
259  
260 <    @statgrab = `./statgrab.pl`;
260 >    my($plugins_dir) = "plugins";
261      
262 +    opendir PLUGINS, $plugins_dir;
263 +    my(@plugins) = readdir PLUGINS;
264 +    foreach my $plugin (@plugins) {
265 +        push @data, `$plugins_dir/$plugin` if -x "$plugins_dir/$plugin" && -f "$plugins_dir/$plugin";
266 +    }
267 +    
268      # get some extra data
269      my($date) = time;
270      my($ip);
271      $ip = inet_ntoa(scalar(gethostbyname(hostname())) || 'localhost') or $ip = 'localhost';
272      
273      # add some extra data to the array
274 <    push(@statgrab, "packet.attributes.seq_no=$seq_no");
275 <    push(@statgrab, "packet.attributes.machine_name=$fqdn");
276 <    push(@statgrab, "packet.attributes.date=$date");
277 <    push(@statgrab, "packet.attributes.type=data");
278 <    push(@statgrab, "packet.attributes.ip=$ip");
274 >    push(@data, "packet.attributes.seq_no=$seq_no");
275 >    push(@data, "packet.attributes.machine_name=$fqdn");
276 >    push(@data, "packet.attributes.date=$date");
277 >    push(@data, "packet.attributes.type=data");
278 >    push(@data, "packet.attributes.ip=$ip");
279      
280      # turn the array into some nice XML
281      my($xml) = &make_xml("", "");
# Line 388 | Line 394 | sub write_pid() {
394  
395   #-----------------------------------------------------------------------
396   # make_xml
397 < # Turns an array of statgrab data into an XML string.
397 > # Turns an array of plugins data into an XML string.
398   #-----------------------------------------------------------------------
399   sub make_xml() {
400      my($curlevel, $curline) = @_;
401      my($xmltemp) = ""; my($curtag) = ""; my($attributes) = "";
402      while(true) {
403 <        $curline = shift(@statgrab) if $curline eq ""; chomp $curline;
403 >        $curline = shift(@data) if $curline eq ""; chomp $curline;
404          if($curline =~ /^$curlevel([^\.\s]+\.)/) {
405              $curtag=$1;
406          }
# Line 407 | Line 413 | sub make_xml() {
413          else {
414              $xmltemp .= &make_xml("$curlevel$curtag", $curline);
415          }
416 <        my($nextline) = $statgrab[0]; chomp $nextline if defined $nextline;
416 >        my($nextline) = $data[0]; chomp $nextline if defined $nextline;
417          $curtag =~ s/(.*)\./$1/;                
418          if(defined $nextline && $nextline =~ /^$curlevel$curtag\./) {
419              $curline = "";

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines