summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: e9d54bc)
raw | patch | inline | side by side (parent: e9d54bc)
author | Matthias Bethke <mbe@financial.com> | |
Tue, 22 Nov 2016 16:53:30 +0000 (23:53 +0700) | ||
committer | Matthias Bethke <mbe@financial.com> | |
Tue, 22 Nov 2016 16:53:30 +0000 (23:53 +0700) |
bindings/perl/lib/Collectd/MockDaemon.pm | patch | blob | history | |
bindings/perl/lib/Collectd/Unixsock.pm | patch | blob | history |
index abf058f6d7e116779bd0a8d37edbefd1ab6e1802..9d784b7c353e8a52d466b93d20faaf1187e1f6f2 100644 (file)
sub listval {
my $trunc_now = substr(time, 0, -1);
+ my $toggle;
return print_nvalues(scalar @metrics) .
- join('', map { sprintf("%s%d.%d %s\n", $trunc_now, rand(10), rand(1000), $_) } @metrics);
+ join('', map { $trunc_now . int(rand(10)) . ($toggle=!$toggle ? ".".int(rand(1000)) : '') . " $_\n" } @metrics);
}
sub getval {
index 96287eb4967f090ec6f9a4450ce20736fa2e9346..f9db922ce77a7bc8a24bf03c0abf7a5809c94459 100644 (file)
(exists $args{plugin_instance} ? "-$args{plugin_instance}" : '(?:-[^/]+)?') .
(exists $args{type} ? "/$args{type}" : '/[^/-]+') .
(exists $args{type_instance} ? "-$args{type_instance}" : '(?:-[^/]+)?');
- $pattern = qr/^\d+\.\d+ $pattern$/;
+ $pattern = qr/^\d+(?:\.\d+)? $pattern$/;
my $msg = $self->_socket_command('LISTVAL') or return;
($nresults, $msg) = split / /, $msg, 2;