Skip to content

Commit c59b6b9

Browse files
authored
Fixing #5475 - Issue with ss_fping.php and PHP8 strict typing (#5477)
* QA: Broken Function * QA: Two additional QA Items - Do a check for IP address as dns_get_records() does not have a timeout and I don't use DNS - Properly display information about MariaDB 11. * Fixing #5475 - Ping Issues with Advanced Ping an PHP8 PHP 8.x error - Unsupported operand types: float + string * QA: Fix two typos
1 parent 67a2649 commit c59b6b9

File tree

4 files changed

+24
-6
lines changed

4 files changed

+24
-6
lines changed

CHANGELOG

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ Cacti CHANGELOG
7878
-issue#5462: Package preview aparantely making changes to Cacti Templates or there is a Caching issue
7979
-issue#5466: When enabling boost on a fresh install, we get a single error in the Cacti log
8080
-issue#5467: Cacti logging throws error when attempting to generate a log message from empty log string in PHP 8.x
81+
-issue#5475: PHP 8.x error - Unsupported operand types: float + string
8182
-feature#5375: Add template for Fortinet firewall and Aruba Instant cluster
8283
-feature#5393: Add template for SNMP printer
8384
-feature#5418: Display device class before package import

include/global_settings.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2289,12 +2289,12 @@
22892289
)
22902290
),
22912291
'extended_paths_header' => array(
2292-
'friendly_name' => __('Structured RRDfile Paths'),
2292+
'friendly_name' => __('Structure RRDfile Paths'),
22932293
'method' => 'spacer',
22942294
'collapsible' => 'true'
22952295
),
22962296
'extended_paths' => array(
2297-
'friendly_name' => __('Method'),
2297+
'friendly_name' => __('Enable Structured Paths'),
22982298
'description' => __('Use a separate subfolder for each hosts RRD files. The naming of the RRDfiles will be one of the following:<br><ul><li>&lt;path_cacti&gt;/rra/host_id/local_data_id.rrd,</li><li>&lt;path_cacti&gt;/rra/device_id/data_query_id/local_data_id.rrd,</li><li>&lt;path_cacti&gt;/rra/device_hash/device_id/local_data_id.rrd,</li><li>&lt;path_cacti&gt;/rra/device_hash/device_id/data_query_id/local_data_id.rrd.</li></ul><br>You can make this change after install by running the CLI script <b>structure_rra_paths.php</b> after you make the change. NOTE: If you change Max Directories value to decrease the number of directories, or if you change the Directory Pattern, empty directories will not be pruned after you rerun the <b>structure_rra_paths.php</b> script.'),
22992299
'method' => 'checkbox'
23002300
),
104 Bytes
Binary file not shown.

scripts/ss_fping.php

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,15 +84,32 @@ function ss_fping($hostname = '', $ping_sweeps = 6, $ping_type = 'ICMP', $port =
8484

8585
$i = 0;
8686
while ($i < $ping_sweeps) {
87+
$start = microtime(true);
8788
$result = $ping->ping(AVAIL_PING, $method, $ping_timeout, 1);
89+
$end = microtime(true);
8890

8991
if (!$result) {
92+
// Error response
9093
$failed_results++;
91-
} else {
92-
$time[$i] = $ping->ping_status;
94+
95+
$time[$i] = $end - $start;
96+
$total_time += $end - $start;
97+
} elseif (is_numeric($ping->ping_status)) {
98+
$time[$i] = $ping->ping_status;
9399
$total_time += $ping->ping_status;
94-
if ($ping->ping_status < $min) $min = $ping->ping_status;
95-
if ($ping->ping_status > $max) $max = $ping->ping_status;
100+
if ($ping->ping_status < $min) {
101+
$min = $ping->ping_status;
102+
}
103+
104+
if ($ping->ping_status > $max) {
105+
$max = $ping->ping_status;
106+
}
107+
} else {
108+
// Down response
109+
$failed_results++;
110+
111+
$time[$i] = $end - $start;
112+
$total_time += $end - $start;
96113
}
97114

98115
$i++;

0 commit comments

Comments
 (0)