summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: e77d585)
raw | patch | inline | side by side (parent: e77d585)
author | Florian Forster <octo@leeloo.lan.home.verplant.org> | |
Sat, 19 May 2007 11:59:10 +0000 (13:59 +0200) | ||
committer | Florian Forster <octo@leeloo.lan.home.verplant.org> | |
Sat, 19 May 2007 11:59:10 +0000 (13:59 +0200) |
contrib/PerlLib/Collectd/Unixsock.pm | patch | blob | history |
index b6814f8db271823595229b586e49ab0ea775161a..92e8772c02dbe42a9b5d8f3245230ac945f7c54a 100644 (file)
$host = $args->{'host'};
$plugin = $args->{'plugin'};
- $plugin .= '-' . $args->{'plugin_instance'} if ($args->{'plugin_instance'});
+ $plugin .= '-' . $args->{'plugin_instance'} if (defined ($args->{'plugin_instance'}));
$type = $args->{'type'};
- $type .= '-' . $args->{'type_instance'} if ($args->{'type_instance'});
+ $type .= '-' . $args->{'type_instance'} if (defined ($args->{'type_instance'}));
return ("$host/$plugin/$type");
} # _create_identifier
$identifier = _create_identifier (\%args) or return;
$msg = "GETVAL $identifier\n";
+ #print "-> $msg";
send ($fh, $msg, 0) or confess ("send: $!");
$msg = undef;
recv ($fh, $msg, 1024, 0) or confess ("recv: $!");
+ #print "<- $msg";
($status, $msg) = split (' ', $msg, 2);
if ($status <= 0)
for (split (' ', $msg))
{
my $entry = $_;
- if ($entry =~ m/^(\w+)=($RE{num}{real})$/)
+ if ($entry =~ m/^(\w+)=NaN$/)
+ {
+ $ret->{$1} = undef;
+ }
+ elsif ($entry =~ m/^(\w+)=($RE{num}{real})$/)
{
$ret->{$1} = 0.0 + $2;
}
}
$msg = "PUTVAL $identifier $values\n";
+ #print "-> $msg";
send ($fh, $msg, 0) or confess ("send: $!");
$msg = undef;
recv ($fh, $msg, 1024, 0) or confess ("recv: $!");
+ #print "<- $msg";
($status, $msg) = split (' ', $msg, 2);
return (1) if ($status == 0);