Skip to content

Commit

Permalink
Fixing Issue #5013 - Auto-Detect bulk size
Browse files Browse the repository at this point in the history
Cacti Bulk Walk Size of 'Auto-detect at First Reindex' not working
  • Loading branch information
TheWitness committed Nov 20, 2022
1 parent 0231786 commit 10895f4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
1 change: 1 addition & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ Cacti CHANGELOG
-issue#4996: Graph Name in Graph Management shows the same name multiple times
-issue#5001: Data Debug Troubleshooter Reports False Positive Issues with Missing Data Sources
-issue#5006: Cannot delete vdef and cdef item (in theme paw) - php error
-issue#5013: Cacti Bulk Walk Size of 'Auto-detect at First Reindex' not working
-feature#1100: Structured path not created when using remote poller and Update On-Demand
-feature#1392: AJAX handled errors do not notify Admins that page errors exist
-feature#2239: Allow Import and Export to be more controlled
Expand Down
17 changes: 9 additions & 8 deletions lib/data_query.php
Original file line number Diff line number Diff line change
Expand Up @@ -797,6 +797,7 @@ function query_snmp_host($host_id, $snmp_query_id) {
}

if ($host['bulk_walk_size'] <= 0) {
$walk_size = 5;
$walk_sizes = array(1, 5, 10, 15, 20, 25, 30, 40, 50, 60);
$low_total = 999;
$selected = -1;
Expand Down Expand Up @@ -837,12 +838,12 @@ function query_snmp_host($host_id, $snmp_query_id) {
if ($host['bulk_walk_size'] == 0) {
query_debug_timer_offset('data_query', __('Saving Bulk Walk Size to Device.'));

$host['bulk_walk_size'] = $size;
$host['bulk_walk_size'] = $walk_size;

db_execute_prepared('UPDATE host
SET bulk_walk_size = ?
WHERE id = ?',
array($size, $host_id));
array($walk_size, $host_id));
}
} else {
$walk_size = $host['bulk_walk_size'];
Expand Down Expand Up @@ -906,7 +907,7 @@ function query_snmp_host($host_id, $snmp_query_id) {
query_debug_timer_offset('data_query', __('Filtered Index by value found at OID: \'%s\' value: \'%s\'', $oid , $value));
}
}

/* parse the index if required */
if (isset($snmp_queries['oid_index_parse'])) {
$index_parse_regexp = '/' . str_replace('OID/REGEXP:', '', $snmp_queries['oid_index_parse']) . '/';
Expand Down Expand Up @@ -1211,15 +1212,15 @@ function query_snmp_host($host_id, $snmp_query_id) {
}

$snmp_index = preg_replace($index_regex,"\\1", $oid);

if (isset($snmp_queries['value_index_parse'])) {
if (!in_array($snmp_index, $snmp_indexes)) {
debug_log_insert('data_query', __('No index[%s] in value_index_parse, skipping.', $snmp_index));
unset($snmp_data[$oid]);
continue;
}
}

$oid = $field_array['oid'] . ".$snmp_index" . (isset($field_array['oid_suffix']) ? ('.' . $field_array['oid_suffix']) : '');
if ($field_name == 'ifOperStatus' || $field_name == 'ifAdminStatus') {
switch(true) {
Expand Down Expand Up @@ -1277,7 +1278,7 @@ function query_snmp_host($host_id, $snmp_query_id) {
continue;
}
}

$oid = $field_array['oid'] . '.' . $parse_value;

/* rewrite octet strings */
Expand Down Expand Up @@ -1326,7 +1327,7 @@ function query_snmp_host($host_id, $snmp_query_id) {
continue;
}
}

$oid = $field_array['oid'] . '.' . $parse_value;
$ip_value = '';

Expand Down Expand Up @@ -1373,7 +1374,7 @@ function query_snmp_host($host_id, $snmp_query_id) {
continue;
}
}

$oid = $field_array['oid'];

debug_log_insert('data_query', __('Found item [%s=\'%s\'] index: %s [from regexp oid value parse]', $field_name, $parse_value, $snmp_index));
Expand Down

0 comments on commit 10895f4

Please sign in to comment.