summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 170e81a)
raw | patch | inline | side by side (parent: 170e81a)
author | Florian Forster <octo@leeloo.lan.home.verplant.org> | |
Sun, 6 Sep 2009 09:00:27 +0000 (11:00 +0200) | ||
committer | Florian Forster <octo@leeloo.lan.home.verplant.org> | |
Sun, 6 Sep 2009 09:00:27 +0000 (11:00 +0200) |
contrib/cussh.pl | patch | blob | history |
diff --git a/contrib/cussh.pl b/contrib/cussh.pl
index 3f1f7c80e14bdeae93519cbefb2ba9ed4373e3dc..b2a44eeb160de289c557cb8f21bf8d3464615639 100755 (executable)
--- a/contrib/cussh.pl
+++ b/contrib/cussh.pl
HELP => \&cmd_help,
PUTVAL => \&putval,
GETVAL => \&getval,
+ GETTHRESHOLD => \&getthreshold,
FLUSH => \&flush,
LISTVAL => \&listval,
PUTNOTIF => \&putnotif,
HELP
PUTVAL
GETVAL
+ GETTHRESHOLD
FLUSH
LISTVAL
PUTNOTIF
return 1;
}
+=item B<GETTHRESHOLD> I<Identifier>
+
+=cut
+
+sub getthreshold {
+ my $sock = shift || return;
+ my $line = shift || return;
+
+ my @line = tokenize($line);
+
+ my $id;
+ my $vals;
+
+ if (! @line) {
+ return;
+ }
+
+ if (scalar(@line) < 1) {
+ print STDERR "Synopsis: GETTHRESHOLD <id>" . $/;
+ return;
+ }
+
+ $id = getid($line[0]);
+
+ if (! $id) {
+ print STDERR "Invalid id \"$line[0]\"." . $/;
+ return;
+ }
+
+ $vals = $sock->getthreshold(%$id);
+
+ if (! $vals) {
+ print STDERR "socket error: " . $sock->{'error'} . $/;
+ return;
+ }
+
+ foreach my $key (keys %$vals) {
+ print "\t$key: $vals->{$key}\n";
+ }
+ return 1;
+}
+
=item B<FLUSH> [B<timeout>=I<$timeout>] [B<plugin>=I<$plugin>[ ...]]
=cut