Merge branch 'collectd-4.4'
authorFlorian Forster <octo@leeloo.lan.home.verplant.org>
Tue, 13 May 2008 14:58:41 +0000 (16:58 +0200)
committerFlorian Forster <octo@leeloo.lan.home.verplant.org>
Tue, 13 May 2008 14:58:41 +0000 (16:58 +0200)
1  2 
contrib/cussh.pl

diff --combined contrib/cussh.pl
@@@ -113,7 -113,7 +113,7 @@@ sub getid 
  
        print $$string . $/;
        my ($h, $p, $pi, $t, $ti) =
-               $$string =~ m/^(\w+)\/(\w+)(?:-(\w+))?\/(\w+)(?:-(\w+))?\s*/;
+               $$string =~ m#^([^/]+)/([^/-]+)(?:-([^/]+))?/([^/-]+)(?:-([^/]+))?\s*#;
        $$string = $';
  
        return if ((! $h) || (! $p) || (! $t));
  
        ($id{'host'}, $id{'plugin'}, $id{'type'}) = ($h, $p, $t);
  
-       $id{'plugin_instance'} = $pi if ($pi);
-       $id{'type_instance'} = $ti if ($ti);
+       $id{'plugin_instance'} = $pi if defined ($pi);
+       $id{'type_instance'} = $ti if defined ($ti);
        return \%id;
  }
  
@@@ -223,15 -223,6 +223,15 @@@ sub flush 
                        elsif ($option eq "timeout") {
                                $args{"timeout"} = $value;
                        }
 +                      elsif ($option eq "identifier") {
 +                              my $id = getid (\$value);
 +                              if (!$id)
 +                              {
 +                                      print STDERR "Not a valid identifier: \"$value\"\n";
 +                                      next;
 +                              }
 +                              push @{$args{"identifier"}}, $id;
 +                      }
                        else {
                                print STDERR "Invalid option \"$option\".\n";
                                return;