summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Agent.pm25
1 files changed, 19 insertions, 6 deletions
diff --git a/src/Agent.pm b/src/Agent.pm
index 740d58e..de46360 100644
--- a/src/Agent.pm
+++ b/src/Agent.pm
@@ -12,15 +12,15 @@ use strict;
#
#----------------------------------------------------------------------
my ($x0, $y0, $wmax, $dx, $dy, $cmin, $rmax, @matrix, @hosts, $tempo_id,
- $mw, $bg, $fg, $selcolor, $pbcolor, $hlbg, $darkbg, $fontspec, @fontspec,
- $on_img, $off_img, $pb_img, %instances, @instances, $bus, $coef,
+ $mw, $bg, $fg, $selcolor, $pbcolor, $timeoutcolor, $hlbg, $darkbg, $fontspec, @fontspec,
+ $on_img, $off_img, $pb_img, $timeout_img, %instances, @instances, $bus, $coef,
$hosts_tl, $selected_host, $preselected_host, $pingThreshold);
# configure the class : graphic parameters, geometry and ivy bus
sub configure {
shift;
- ($mw, $bg, $fg, $selcolor, $pbcolor, $hlbg, $darkbg,
+ ($mw, $bg, $fg, $selcolor, $pbcolor, $timeoutcolor, $hlbg, $darkbg,
$fontspec, $x0, $y0, $wmax, $dy, $cmin, $rmax, $bus, $coef, $pingThreshold) = @_;
@fontspec = @$fontspec if $fontspec;
@@ -30,6 +30,8 @@ sub configure {
-foreground => $pbcolor);
$on_img = $mw->Bitmap('on', -file => Tk::findINC('led.bmp'),
-foreground => $selcolor);
+ $timeout_img = $mw->Bitmap('timeout', -file => Tk::findINC('led.bmp'),
+ -foreground => $timeoutcolor);
&_resetmatrix;
} # end configure
@@ -100,10 +102,14 @@ sub pingcb {
my ($class, $appname, $host, $pingtime) = @_;
#print "pingtime=$pingtime\n";
if ($instances{$appname}) {
- # if pingtime > $pingThreshold status is changed
- if ($pingtime > $pingThreshold) {
+ # pingtime < 0 means pong exceeded timeout
+ if ($pingtime == -1) {
+ $instances{$appname}->timeout;
+ # pingtime > $pingThreshold means pong exceeded threshold
+ } elsif ($pingtime > $pingThreshold) {
$instances{$appname}->pb;
- } elsif ($instances{$appname}->{status} == 2) {
+ # previous pbm detected
+ } elsif ($instances{$appname}->{status} >= 2) {
$instances{$appname}->nopb;
}
}
@@ -234,6 +240,13 @@ sub nopb {
} # end pb
+sub timeout {
+ my $self = shift;
+ $self->{status} = 3;
+ $self->{led}->configure(-image => $timeout_img);
+
+} # end timeout
+
# label placement
sub setposition {
my $self = shift;