the timer isnt working
Posted: Thu Jun 19, 2025 7:43 am
i have it set to not send an event if its been less than 300 seconds.. yet it ignores that and just keeps sending events back to back.
it has to be something in this part that is broken.
my tokens.txt has the correct numbers
"intlist":"300,300,300,300,300,300,300,300,300,300"
the debug doesnt mention the should send out message.. so its failing at the first if and just ignoring everything.
it has to be something in this part that is broken.
my tokens.txt has the correct numbers
"intlist":"300,300,300,300,300,300,300,300,300,300"
the debug doesnt mention the should send out message.. so its failing at the first if and just ignoring everything.
Code: Select all
if ( isInList( $monlist, $alarm->{MonitorId} ) ) {
my $mint = getInterval( $intlist, $monlist, $alarm->{MonitorId} );
if ( $last_sent->{ $alarm->{MonitorId} } ) {
my $elapsed = time() - $last_sent->{ $alarm->{MonitorId} };
if ( $elapsed >= $mint ) {
Debug(1, 'Monitor ' . $alarm->{MonitorId} . " event: should send out as $elapsed is >= interval of $mint");
$retVal = 1;
} else {
Debug(1, 'Monitor ' . $alarm->{MonitorId} . " event: should NOT send this out as $elapsed is less than interval of $mint");
$retVal = 0;
}
} else {
# This means we have no record of sending any event to this monitor
#$last_sent->{$_->{MonitorId}} = time();
Debug(1, 'Monitor '.$alarm->{MonitorId}.' event: last time not found, so should send');
$retVal = 1;
}
} else {
# monitorId not in list
Debug(1, 'should NOT send alarm as Monitor '.$alarm->{MonitorId}.' is excluded');
$retVal = 0;
}
return $retVal;
}