Skip to content

Commit

Permalink
Fixing #63 - Graphs and PHP8.1
Browse files Browse the repository at this point in the history
ERROR PHP DEPRECATED in Plugin 'mikrotik': str_replace() in poller_graphs.php on line: 386
  • Loading branch information
TheWitness committed Jan 3, 2023
1 parent b7a8331 commit f5a1006
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@

* issue#62: PHP DEPRECATED warnings in mikrotik plugin

* issue#63: ERROR PHP DEPRECATED in Plugin 'mikrotik': str_replace() in poller_graphs.php on line: 386

* feature: Add Device ID's to MikroTik API stats to track password failures

* feature: Add DNS Cache to MikroTik Plugin
Expand Down
24 changes: 23 additions & 1 deletion poller_graphs.php
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,29 @@ function mikrotik_dq_graphs($host_id, $query_id, $graph_template_id, $query_type
" --snmp-query-id=$query_id --snmp-field=$field" .
" --snmp-value=" . cacti_escapeshellarg($field_value);

print "NOTE: Adding item: '$field_value' " . str_replace("\n", " ", passthru($command)) . "\n";
$return = 0;
$output = array();

$lline = exec($command, $output, $return);

if ($return != 0) {
print "WARNING: Error for Graph command and item '$field_value' Error Code:'$return'. Results below." . PHP_EOL;

if (sizeof($output)) {
foreach($output as $l) {
print trim("WARNING DATA: " . $l) . PHP_EOL;
}
}
} else {
print trim("NOTE: Graph command for item: '$field_value' succeded. Results relow") . PHP_EOL;

if (sizeof($output)) {
foreach($output as $l) {
print trim("WARNING DATA: " . $l) . PHP_EOL;
}
}
}

}
}
}
Expand Down

0 comments on commit f5a1006

Please sign in to comment.