Skip to content

Commit

Permalink
When poller first runs, time since last run produces an error (#4254)
Browse files Browse the repository at this point in the history
When a poller first runs, there is no previous run timestamp but the code was trying to round on the default value which is a string.

Closes #4254
  • Loading branch information
netniV committed May 8, 2021
1 parent 39e337a commit a2febc0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG
@@ -1,5 +1,8 @@
Cacti CHANGELOG

1.2.18
-issue#4254: When poller first runs, time since last run produces an error

1.2.17
-security#4019: Incorrect handling of fields led to potential XSS issues
-security#4022: SQL Injection was possible due to incorrect validation order (CVE-2020-35701)
Expand Down
6 changes: 3 additions & 3 deletions poller.php
Expand Up @@ -332,12 +332,12 @@ function sig_handler($signo) {
$level = POLLER_VERBOSITY_MEDIUM;
}

$poller_seconds_sincerun = 'never';
$poller_seconds_sincerun = 'Never';
if (isset($poller_lastrun)) {
$poller_seconds_sincerun = $poller_start - $poller_lastrun;
$poller_seconds_sincerun = round($poller_start - $poller_lastrun, 2);
}

cacti_log("NOTE: Poller Int: '$poller_interval', $task_type Int: '$cron_interval', Time Since Last: '" . round($poller_seconds_sincerun,2) . "', Max Runtime '" . MAX_POLLER_RUNTIME. "', Poller Runs: '$poller_runs'", true, 'POLLER', $level);
cacti_log("NOTE: Poller Int: '$poller_interval', $task_type Int: '$cron_interval', Time Since Last: '$poller_seconds_sincerun', Max Runtime '" . MAX_POLLER_RUNTIME. "', Poller Runs: '$poller_runs'", true, 'POLLER', $level);

// our cron can run at either 1 or 5 minute intervals
if ($poller_interval <= 60) {
Expand Down

0 comments on commit a2febc0

Please sign in to comment.