mirror of
https://github.com/Cacti/cacti.git
synced 2026-11-21 20:23:18 +09:00
Merge branch 'develop' of https://github.com/Cacti/cacti into develop
This commit is contained in:
commit
16eeb5613d
32 files changed
+6262
-5379
No files matched your search
@@ -203,19 +203,19 @@ function api_networks_save($post) {
|
||||
if ($save['sched_type'] == '3') {
|
||||
if ($save['day_of_week'] == '') {
|
||||
$save['enabled'] = '';
|
||||
$_SESSION['automation_message'] = __('ERROR: You must specificy the day of the week. Disabling Network %s!.', $net);
|
||||
$_SESSION['automation_message'] = __('ERROR: You must specify the day of the week. Disabling Network %s!.', $net);
|
||||
raise_message('automation_message');
|
||||
}
|
||||
} elseif ($save['sched_type'] == '4') {
|
||||
if ($save['month'] == '' || $save['day_of_month'] == '') {
|
||||
$save['enabled'] = '';
|
||||
$_SESSION['automation_message'] = __('ERROR: You must specificy both the Months and Days of Month. Disabling Network %s!', $net);
|
||||
$_SESSION['automation_message'] = __('ERROR: You must specify both the Months and Days of Month. Disabling Network %s!', $net);
|
||||
raise_message('automation_message');
|
||||
}
|
||||
} elseif ($save['sched_type'] == '5') {
|
||||
if ($save['month'] == '' || $save['monthly_day'] == '' || $save['monthly_week'] == '') {
|
||||
$save['enabled'] = '';
|
||||
$_SESSION['automation_message'] = __('ERROR: You must specificy the Months, Weeks of Months, and Days of Week. Disabling Network %s!', $net);
|
||||
$_SESSION['automation_message'] = __('ERROR: You must specify the Months, Weeks of Months, and Days of Week. Disabling Network %s!', $net);
|
||||
raise_message('automation_message');
|
||||
}
|
||||
}
|
||||
@@ -515,7 +515,7 @@ function network_edit() {
|
||||
'enabled' => array(
|
||||
'method' => 'checkbox',
|
||||
'friendly_name' => __('Enabled'),
|
||||
'description' => __('Enable this Network Range Enabled.'),
|
||||
'description' => __('Enable this Network Range.'),
|
||||
'value' => '|arg1:enabled|'
|
||||
),
|
||||
'enable_netbios' => array(
|
||||
|
||||
+8
-6
@@ -70,12 +70,12 @@ $polling_items = array();
|
||||
/* get poller_item for graph_id */
|
||||
$local_data_ids = db_fetch_assoc_prepared('SELECT DISTINCT dtr.local_data_id, dl.host_id
|
||||
FROM graph_templates_item AS gti
|
||||
LEFT JOIN data_template_rrd AS dtr
|
||||
INNER JOIN data_template_rrd AS dtr
|
||||
ON gti.task_item_id=dtr.id
|
||||
LEFT JOIN data_local AS dl
|
||||
INNER JOIN data_local AS dl
|
||||
ON dl.id=dtr.local_data_id
|
||||
WHERE gti.local_graph_id = ?
|
||||
AND dtr.local_data_id IS NOT NULL',
|
||||
AND dtr.local_data_id > 0',
|
||||
array($graph_id));
|
||||
|
||||
if (!count($local_data_ids)) {
|
||||
@@ -88,10 +88,12 @@ $hosts = array();
|
||||
$idbyhost = array();
|
||||
|
||||
foreach ($local_data_ids as $row) {
|
||||
$ids[$row['local_data_id']] = $row['local_data_id'];
|
||||
$hosts[$row['host_id']] = $row['host_id'];
|
||||
if ($row['local_data_id'] > 0 && $row['host_id'] != '') {
|
||||
$ids[$row['local_data_id']] = $row['local_data_id'];
|
||||
$hosts[$row['host_id']] = $row['host_id'];
|
||||
|
||||
$idbyhost[$row['host_id']][] = $row['local_data_id'];
|
||||
$idbyhost[$row['host_id']][] = $row['local_data_id'];
|
||||
}
|
||||
}
|
||||
|
||||
$print_data_to_stdout = true;
|
||||
|
||||
@@ -756,7 +756,7 @@ function get_span($duration) {
|
||||
}
|
||||
|
||||
function profile() {
|
||||
global $profile_actions, $item_rows, $sampling_intervals, $heartbeats;
|
||||
global $profile_actions, $item_rows, $sampling_intervals, $heartbeats, $config;
|
||||
|
||||
/* ================= input validation and session storage ================= */
|
||||
$filters = array(
|
||||
@@ -967,6 +967,18 @@ function profile() {
|
||||
$readonly = false;
|
||||
}
|
||||
|
||||
if ($profile['data_sources'] > 0) {
|
||||
$ds = '<a class="linkEditMain" href="' . $config['url_path'] . 'data_sources.php?reset=true&profile=' . $profile['id'] . '">' . number_format_i18n($profile['data_sources'], '-1') . '</a>';
|
||||
} else {
|
||||
$ds = number_format_i18n($profile['data_sources'], '-1');
|
||||
}
|
||||
|
||||
if ($profile['templates'] > 0) {
|
||||
$dt = '<a class="linkEditMain" href="' . $config['url_path'] . 'data_templates.php?reset=true&profile=' . $profile['id'] . '">' . number_format_i18n($profile['templates'], '-1') . '</a>';
|
||||
} else {
|
||||
$dt = number_format_i18n($profile['templates'], '-1');
|
||||
}
|
||||
|
||||
form_alternate_row('line' . $profile['id'], false, $disabled);
|
||||
form_selectable_cell(filter_value($profile['name'], get_request_var('filter'), 'data_source_profiles.php?action=edit&id=' . $profile['id']), $profile['id']);
|
||||
form_selectable_cell($profile['default'] == 'on' ? __('Yes'):'', $profile['id'], '', 'text-align:right');
|
||||
@@ -974,8 +986,8 @@ function profile() {
|
||||
form_selectable_cell($readonly ? __('Yes') : __('No'), $profile['id'], '', 'text-align:right');
|
||||
form_selectable_cell($sampling_intervals[$profile['step']], $profile['id'], '', 'text-align:right');
|
||||
form_selectable_cell($heartbeats[$profile['heartbeat']], $profile['id'], '', 'text-align:right');
|
||||
form_selectable_cell(number_format_i18n($profile['data_sources'], '-1'), $profile['id'], '', 'text-align:right');
|
||||
form_selectable_cell(number_format_i18n($profile['templates'], '-1'), $profile['id'], '', 'text-align:right');
|
||||
form_selectable_cell($ds, $profile['id'], '', 'text-align:right');
|
||||
form_selectable_cell($dt, $profile['id'], '', 'text-align:right');
|
||||
form_checkbox_cell($profile['name'], $profile['id'], $disabled);
|
||||
form_end_row();
|
||||
}
|
||||
|
||||
+3
-3
@@ -560,7 +560,7 @@ function template_edit() {
|
||||
} else {
|
||||
$form_array[$field_name]['sub_checkbox'] = array(
|
||||
'name' => 't_' . $field_name,
|
||||
'friendly_name' => __esc('Use Per-Data Source Value (Ignore this Value)'),
|
||||
'friendly_name' => __esc('Check this checkbox if you wish to allow the user to override the value on the right during Data Source creation.'),
|
||||
'value' => (isset($template_data['t_' . $field_name]) ? $template_data['t_' . $field_name] : '')
|
||||
);
|
||||
}
|
||||
@@ -631,7 +631,7 @@ function template_edit() {
|
||||
$form_array[$field_name]['value'] = (isset($template_rrd) ? $template_rrd[$field_name] : '');
|
||||
$form_array[$field_name]['sub_checkbox'] = array(
|
||||
'name' => 't_' . $field_name,
|
||||
'friendly_name' => __('Use Per-Data Source Value (Ignore this Value)'),
|
||||
'friendly_name' => __esc('Check this checkbox if you wish to allow the user to override the value on the right during Data Source creation.'),
|
||||
'value' => (isset($template_rrd) ? $template_rrd['t_' . $field_name] : '')
|
||||
);
|
||||
}
|
||||
@@ -703,7 +703,7 @@ function template_edit() {
|
||||
|
||||
?>
|
||||
<div class='formColumnLeft'>
|
||||
<div class='formFieldName'><?php form_checkbox('t_value_' . $field['data_name'], $old_tvalue, '', '', '', get_request_var('id'), '', __('Use Per-Data Source Value (Ignore this Value)'));?><?php print html_escape($field['name']);?><div class='formTooltip'><?php print display_tooltip($help);?></div>
|
||||
<div class='formFieldName'><?php form_checkbox('t_value_' . $field['data_name'], $old_tvalue, '', '', '', get_request_var('id'), '', __esc('Check this checkbox if you wish to allow the user to override the value on the right during Data Source creation.'));?><?php print html_escape($field['name']);?><div class='formTooltip'><?php print display_tooltip($help);?></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class='formColumnRight'>
|
||||
|
||||
+21
-6
@@ -1,19 +1,34 @@
|
||||
Cacti CHANGELOG
|
||||
1.1.36
|
||||
-issue#1334: Console->Users->(Edit) Permissions checkmark descriptions missing
|
||||
-issue#1336: Fix issue with $config not being defined
|
||||
-issue: Fixed some language string inconsistencies
|
||||
-feature: Updated Dutch translations
|
||||
|
||||
1.1.36
|
||||
-issue#1331: Maintenance time should occur at midnight, not random time in day
|
||||
|
||||
1.1.35
|
||||
-issue#114: *all_max_peak* percentile calculations incorrect
|
||||
-issue#430: Pressing Back often fails to work as expected
|
||||
-issue#564: Fail to move items in graph template as desired
|
||||
-issue#981: Hyperlinks for Data Profile stats
|
||||
-issue#993: Realtime not working on remote pollers for certain data query
|
||||
-issue#1251: Make 3rd mouse button configurable for all zoom modes. Set default to zoom out.
|
||||
-issue#1244: Errors importing templates with deprecated hashes
|
||||
-issue#1251: Allow zoom out through mouse mmiddle button
|
||||
-issue#1281: Max OIDs setting is for bulkget and not bulkwalk operations
|
||||
-issue#1286: Correct CHUNKED_ENCODING error when retrieving graph with some browsers
|
||||
-issue#1306: Fix issue #1306 where multi-value args are not parsing correctly
|
||||
-issue#1306: Graphs are not always refreshed properly
|
||||
-issue#1309: Provide meaningful authentication errors in graph_json.php and graph_image.php
|
||||
-issue#1310: Unable to return to previous page from auth_changepassword.php
|
||||
-issue#1310: Return button fails on change password page
|
||||
-issue#1315: Realtime not working on local data collector
|
||||
-issue#1316: CDEF Item Value dialog doesn't update creating items
|
||||
-issue#1319: FrontEnd + Remote Poller - Connection timeout issue
|
||||
-issue#1321: Use of legacy RRDtool pipelining functions within DSSTATS
|
||||
-issue#1316: CDEF Item Value dialog does not update creating items
|
||||
-issue#1319: Front end + remote poller - connection timeout issue
|
||||
-issue#1321: Use RRDtool pipelining functions within DSSTATS
|
||||
-issue#1323: Enhance form layout for readability
|
||||
-issue#1329: Spelling errors in automation_networks.php
|
||||
-issue: Validate regular expressions if specified in add_graphs.php
|
||||
-issue: Ensure compression levels are consistent when importing package
|
||||
|
||||
1.1.34
|
||||
-issue#1040: PHP version 7.2 - ERROR PHP WARNING: sizeof()
|
||||
|
||||
+1
-1
@@ -522,7 +522,7 @@ function template_edit() {
|
||||
if ($form_array[$field_name]['method'] != 'spacer') {
|
||||
$form_array[$field_name]['sub_checkbox'] = array(
|
||||
'name' => 't_' . $field_name,
|
||||
'friendly_name' => __esc('Use Per-Graph Value (Ignore this Value)'),
|
||||
'friendly_name' => __esc('Check this checkbox if you wish to allow the user to override the value on the right during Graph creation.'),
|
||||
'value' => (isset($template_graph['t_' . $field_name]) ? $template_graph['t_' . $field_name] : '')
|
||||
);
|
||||
}
|
||||
|
||||
@@ -307,12 +307,19 @@ function item_movedown() {
|
||||
|
||||
global $graph_item_types;
|
||||
|
||||
$arr = get_graph_group(get_request_var('id'));
|
||||
$next_id = get_graph_parent(get_request_var('id'), 'next');
|
||||
$arr = get_graph_group(get_request_var('id'));
|
||||
$next_id = get_graph_parent(get_request_var('id'), 'next');
|
||||
|
||||
if ((!empty($next_id)) && (isset($arr{get_request_var('id')}))) {
|
||||
$graph_type = db_fetch_cell_prepared('SELECT graph_type_id
|
||||
FROM graph_templates_item
|
||||
WHERE id = ?',
|
||||
array(get_request_var('id')));
|
||||
|
||||
$text_type = $graph_item_types[$graph_type];
|
||||
|
||||
if (!empty($next_id) && isset($arr[get_request_var('id')])) {
|
||||
move_graph_group(get_request_var('id'), $arr, $next_id, 'next');
|
||||
} elseif (preg_match('/(GPRINT|VRULE|HRULE|COMMENT)/', $graph_item_types{db_fetch_cell_prepared('SELECT graph_type_id FROM graph_templates_item WHERE id = ?', array(get_request_var('id')))})) {
|
||||
} elseif (!preg_match('/(AREA|STACK|LINE)/', $text_type)) {
|
||||
/* this is so we know the "other" graph item to propagate the changes to */
|
||||
$next_item = get_item('graph_templates_item', 'sequence', get_request_var('id'), 'graph_template_id=' . get_request_var('graph_template_id') . ' AND local_graph_id=0', 'next');
|
||||
|
||||
@@ -335,9 +342,16 @@ function item_moveup() {
|
||||
$arr = get_graph_group(get_request_var('id'));
|
||||
$next_id = get_graph_parent(get_request_var('id'), 'previous');
|
||||
|
||||
if ((!empty($next_id)) && (isset($arr{get_request_var('id')}))) {
|
||||
$graph_type = db_fetch_cell_prepared('SELECT graph_type_id
|
||||
FROM graph_templates_item
|
||||
WHERE id = ?',
|
||||
array(get_request_var('id')));
|
||||
|
||||
$text_type = $graph_item_types[$graph_type];
|
||||
|
||||
if (!empty($next_id) && isset($arr[get_request_var('id')])) {
|
||||
move_graph_group(get_request_var('id'), $arr, $next_id, 'previous');
|
||||
} elseif (preg_match('/(GPRINT|VRULE|HRULE|COMMENT)/', $graph_item_types{db_fetch_cell_prepared('SELECT graph_type_id FROM graph_templates_item WHERE id = ?', array(get_request_var('id')))})) {
|
||||
} elseif (!preg_match('/(AREA|STACK|LINE)/', $text_type)) {
|
||||
/* this is so we know the "other" graph item to propagate the changes to */
|
||||
$last_item = get_item('graph_templates_item', 'sequence', get_request_var('id'), 'graph_template_id=' . get_request_var('graph_template_id') . ' AND local_graph_id=0', 'previous');
|
||||
|
||||
|
||||
@@ -416,7 +416,11 @@ function form_actions() {
|
||||
$form_array += array($field_name => $fields_host_edit[$field_name]);
|
||||
|
||||
$form_array[$field_name]['value'] = '';
|
||||
$form_array[$field_name]['description'] = '';
|
||||
|
||||
if (read_config_option('hide_form_description') == 'on') {
|
||||
$form_array[$field_name]['description'] = '';
|
||||
}
|
||||
|
||||
$form_array[$field_name]['form_id'] = 0;
|
||||
$form_array[$field_name]['sub_checkbox'] = array(
|
||||
'name' => 't_' . $field_name,
|
||||
@@ -435,6 +439,8 @@ function form_actions() {
|
||||
|
||||
device_javascript();
|
||||
|
||||
device_change_javascript();
|
||||
|
||||
$save_html = "<input type='button' value='" . __esc('Cancel') . "' onClick='cactiReturnTo()'> <input type='submit' value='" . __esc('Continue') . "' title='" . __esc('Change Device(s) SNMP Options') . "'>";
|
||||
} elseif (get_request_var('drp_action') == '5') { // Clear Statisitics for Selected Devices
|
||||
print "<tr>
|
||||
@@ -963,6 +969,52 @@ function device_reindex_methods($item, $host) {
|
||||
}
|
||||
}
|
||||
|
||||
function device_change_javascript() {
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
function disableField(id) {
|
||||
$('#'+id).prop('disabled', true);
|
||||
|
||||
if ($('#'+id).button('instance')) {
|
||||
console.log('button');
|
||||
$('#'+id).button('disable');
|
||||
} else if ($('#'+id).selectmenu('instance')) {
|
||||
console.log('selectmenu');
|
||||
$('#'+id).selectmenu('disable');
|
||||
}
|
||||
}
|
||||
|
||||
function enableField(id) {
|
||||
$('#'+id).prop('disabled', false);
|
||||
|
||||
if ($('#'+id).button('instance')) {
|
||||
console.log('button');
|
||||
$('#'+id).button('enable');
|
||||
} else if ($('#'+id).selectmenu('instance')) {
|
||||
console.log('selectmenu');
|
||||
$('#'+id).selectmenu('enable');
|
||||
}
|
||||
}
|
||||
|
||||
$(function() {
|
||||
$('input[id^="t_"]').click(function() {
|
||||
id = $(this).attr('id').substring(2);
|
||||
if ($(this).is(':checked')) {
|
||||
enableField(id);
|
||||
} else {
|
||||
disableField(id);
|
||||
}
|
||||
});
|
||||
|
||||
$('input[id^="t_"]').each(function() {
|
||||
id = $(this).attr('id').substring(2);
|
||||
disableField(id);
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<?php
|
||||
}
|
||||
|
||||
function device_javascript() {
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
|
||||
@@ -1 +1 @@
|
||||
1.1.34
|
||||
1.1.35
|
||||
@@ -108,6 +108,7 @@ $cacti_version_codes = array(
|
||||
'1.1.32' => '0101',
|
||||
'1.1.33' => '0101',
|
||||
'1.1.34' => '0101',
|
||||
'1.1.35' => '0101',
|
||||
);
|
||||
|
||||
$messages = array(
|
||||
|
||||
@@ -398,7 +398,7 @@ $settings = array(
|
||||
'hide_form_description' => array(
|
||||
'friendly_name' => __('Show Form/Setting Help Inline'),
|
||||
'description' => __('When checked, Form and Setting Help will be show inline. Otherwise it will be presented when hovering over the help button.'),
|
||||
'default' => 'on',
|
||||
'default' => '',
|
||||
'method' => 'checkbox',
|
||||
),
|
||||
'deletion_verification' => array(
|
||||
@@ -947,6 +947,25 @@ $settings = array(
|
||||
'method' => 'checkbox',
|
||||
'default' => ''
|
||||
),
|
||||
'snmp_bulk_walk_size' => array(
|
||||
'friendly_name' => __('SNMP Bulkwalk Fetch Size'),
|
||||
'description' => __('How many OID\'s should be returned per snmpbulkwalk request? For Devices with large SNMP trees, increasing this size will increase re-index performance over a WAN.'),
|
||||
'method' => 'drop_array',
|
||||
'default' => '10',
|
||||
'array' => array(
|
||||
'10' => '10',
|
||||
'20' => '20',
|
||||
'30' => '30',
|
||||
'40' => '40',
|
||||
'50' => '50',
|
||||
'60' => '60',
|
||||
'70' => '70',
|
||||
'80' => '80',
|
||||
'90' => '90',
|
||||
'100' => '100',
|
||||
'150' => '150',
|
||||
'200' => '200')
|
||||
),
|
||||
'spine_header' => array(
|
||||
'friendly_name' => __('Spine Specific Execution Parameters'),
|
||||
'collapsible' => 'true',
|
||||
|
||||
@@ -483,6 +483,7 @@ label {
|
||||
|
||||
.import_text {
|
||||
opacity: 1;
|
||||
color: #000000;
|
||||
}
|
||||
|
||||
.color-icon {
|
||||
|
||||
@@ -451,6 +451,7 @@ label {
|
||||
|
||||
.import_text {
|
||||
opacity: 1;
|
||||
color: #2d4ca8;
|
||||
}
|
||||
|
||||
.color-icon {
|
||||
|
||||
@@ -182,6 +182,8 @@ function find_best_path($binary_name) {
|
||||
function install_setup_get_templates() {
|
||||
global $config;
|
||||
|
||||
ini_set('zlib.output_compression', '0');
|
||||
|
||||
$templates = array(
|
||||
'Cisco_Router.xml.gz',
|
||||
'Generic_SNMP_Device.xml.gz',
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
/*
|
||||
+-------------------------------------------------------------------------+
|
||||
| Copyright (C) 2004-2018 The Cacti Group |
|
||||
| |
|
||||
| This program is free software; you can redistribute it and/or |
|
||||
| modify it under the terms of the GNU General Public License |
|
||||
| as published by the Free Software Foundation; either version 2 |
|
||||
| of the License, or (at your option) any later version. |
|
||||
| |
|
||||
| This program is distributed in the hope that it will be useful, |
|
||||
| but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
||||
| GNU General Public License for more details. |
|
||||
+-------------------------------------------------------------------------+
|
||||
| Cacti: The Complete RRDtool-based Graphing Solution |
|
||||
+-------------------------------------------------------------------------+
|
||||
| This code is designed, written, and maintained by the Cacti Group. See |
|
||||
| about.php and/or the AUTHORS file for specific developer information. |
|
||||
+-------------------------------------------------------------------------+
|
||||
| http://www.cacti.net/ |
|
||||
+-------------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
function upgrade_to_1_1_35() {
|
||||
db_install_execute("DELETE FROM data_input_data
|
||||
WHERE data_input_field_id=0");
|
||||
|
||||
db_install_execute("DELETE FROM snmp_query_graph_rrd
|
||||
WHERE data_template_id=0 OR data_template_rrd_id=0");
|
||||
|
||||
db_install_execute("DELETE FROM snmp_query_graph_rrd_sv
|
||||
WHERE data_template_id=0");
|
||||
}
|
||||
|
||||
+4
-1
@@ -316,7 +316,10 @@ function data_input_method_to_xml($data_input_id) {
|
||||
|
||||
/* XML Branch: <> */
|
||||
foreach ($fields_data_input_edit as $field_name => $field_array) {
|
||||
if (($field_array['method'] != 'hidden_zero') && ($field_array['method'] != 'hidden')) {
|
||||
if (($field_array['method'] != 'hidden_zero') &&
|
||||
($field_array['method'] != 'hidden') &&
|
||||
($field_array['method'] != 'spacer') &&
|
||||
($field_array['method'] != 'other')) {
|
||||
if ($field_name == 'input_string') {
|
||||
$xml_text .= "\t<$field_name>" . base64_encode($data_input[$field_name]) . "</$field_name>\n";
|
||||
} else {
|
||||
|
||||
+131
-31
@@ -1612,7 +1612,10 @@ function generate_data_input_field_sequences($string, $data_input_id) {
|
||||
@arg $direction - ('next' or 'previous') whether the graph group is to be swapped with
|
||||
group above or below the current group */
|
||||
function move_graph_group($graph_template_item_id, $graph_group_array, $target_id, $direction) {
|
||||
$graph_item = db_fetch_row_prepared('SELECT local_graph_id, graph_template_id FROM graph_templates_item WHERE id = ?', array($graph_template_item_id));
|
||||
$graph_item = db_fetch_row_prepared('SELECT local_graph_id, graph_template_id
|
||||
FROM graph_templates_item
|
||||
WHERE id = ?',
|
||||
array($graph_template_item_id));
|
||||
|
||||
if (empty($graph_item['local_graph_id'])) {
|
||||
$sql_where = 'graph_template_id = ' . $graph_item['graph_template_id'] . ' AND local_graph_id = 0';
|
||||
@@ -1637,8 +1640,12 @@ function move_graph_group($graph_template_item_id, $graph_group_array, $target_i
|
||||
/* start the sequence at '1' */
|
||||
$sequence_counter = 1;
|
||||
|
||||
$graph_items = db_fetch_assoc_prepared("SELECT id, sequence FROM graph_templates_item WHERE $sql_where ORDER BY sequence");
|
||||
if (sizeof($graph_items) > 0) {
|
||||
$graph_items = db_fetch_assoc_prepared("SELECT id, sequence
|
||||
FROM graph_templates_item
|
||||
WHERE $sql_where
|
||||
ORDER BY sequence");
|
||||
|
||||
if (sizeof($graph_items)) {
|
||||
foreach ($graph_items as $item) {
|
||||
/* check to see if we are at the "target" spot in the loop; if we are, update the sequences and move on */
|
||||
if ($target_id == $item['id']) {
|
||||
@@ -1651,22 +1658,34 @@ function move_graph_group($graph_template_item_id, $graph_group_array, $target_i
|
||||
}
|
||||
|
||||
foreach ($group_array1 as $graph_template_item_id) {
|
||||
db_execute_prepared('UPDATE graph_templates_item SET sequence = ? WHERE id = ?', array($sequence_counter, $graph_template_item_id));
|
||||
db_execute_prepared('UPDATE graph_templates_item
|
||||
SET sequence = ?
|
||||
WHERE id = ?',
|
||||
array($sequence_counter, $graph_template_item_id));
|
||||
|
||||
/* propagate to ALL graphs using this template */
|
||||
if (empty($graph_item['local_graph_id'])) {
|
||||
db_execute_prepared('UPDATE graph_templates_item SET sequence = ? WHERE local_graph_template_item_id = ?', array($sequence_counter, $graph_template_item_id));
|
||||
db_execute_prepared('UPDATE graph_templates_item
|
||||
SET sequence = ?
|
||||
WHERE local_graph_template_item_id = ?',
|
||||
array($sequence_counter, $graph_template_item_id));
|
||||
}
|
||||
|
||||
$sequence_counter++;
|
||||
}
|
||||
|
||||
foreach ($group_array2 as $graph_template_item_id) {
|
||||
db_execute_prepared('UPDATE graph_templates_item SET sequence = ? WHERE id = ?', array($sequence_counter, $graph_template_item_id));
|
||||
db_execute_prepared('UPDATE graph_templates_item
|
||||
SET sequence = ?
|
||||
WHERE id = ?',
|
||||
array($sequence_counter, $graph_template_item_id));
|
||||
|
||||
/* propagate to ALL graphs using this template */
|
||||
if (empty($graph_item['local_graph_id'])) {
|
||||
db_execute_prepared('UPDATE graph_templates_item SET sequence = ? WHERE local_graph_template_item_id = ?', array($sequence_counter, $graph_template_item_id));
|
||||
db_execute_prepared('UPDATE graph_templates_item
|
||||
SET sequence = ?
|
||||
WHERE local_graph_template_item_id = ?',
|
||||
array($sequence_counter, $graph_template_item_id));
|
||||
}
|
||||
|
||||
$sequence_counter++;
|
||||
@@ -1675,7 +1694,11 @@ function move_graph_group($graph_template_item_id, $graph_group_array, $target_i
|
||||
|
||||
/* make sure to "ignore" the items that we handled above */
|
||||
if ((!isset($graph_group_array[$item['id']])) && (!isset($target_graph_group_array[$item['id']]))) {
|
||||
db_execute_prepared('UPDATE graph_templates_item SET sequence = ? WHERE id = ?', array($sequence_counter, $item['id']));
|
||||
db_execute_prepared('UPDATE graph_templates_item
|
||||
SET sequence = ?
|
||||
WHERE id = ?',
|
||||
array($sequence_counter, $item['id']));
|
||||
|
||||
$sequence_counter++;
|
||||
}
|
||||
}
|
||||
@@ -1689,7 +1712,10 @@ function move_graph_group($graph_template_item_id, $graph_group_array, $target_i
|
||||
function get_graph_group($graph_template_item_id) {
|
||||
global $graph_item_types;
|
||||
|
||||
$graph_item = db_fetch_row_prepared('SELECT graph_type_id, sequence, local_graph_id, graph_template_id FROM graph_templates_item WHERE id = ?', array($graph_template_item_id));
|
||||
$graph_item = db_fetch_row_prepared('SELECT graph_type_id, sequence, local_graph_id, graph_template_id
|
||||
FROM graph_templates_item
|
||||
WHERE id = ?',
|
||||
array($graph_template_item_id));
|
||||
|
||||
if (empty($graph_item['local_graph_id'])) {
|
||||
$sql_where = 'graph_template_id = ' . $graph_item['graph_template_id'] . ' AND local_graph_id = 0';
|
||||
@@ -1697,8 +1723,8 @@ function get_graph_group($graph_template_item_id) {
|
||||
$sql_where = 'local_graph_id = ' . $graph_item['local_graph_id'];
|
||||
}
|
||||
|
||||
/* a parent must NOT be the following graph item types */
|
||||
if (preg_match('/(GPRINT|VRULE|HRULE|COMMENT)/', $graph_item_types[$graph_item['graph_type_id']])) {
|
||||
/* parents are LINE%, AREA%, and STACK%. If not return */
|
||||
if (!preg_match('/(LINE|AREA|STACK)/', $graph_item_types[$graph_item['graph_type_id']])) {
|
||||
return array();
|
||||
}
|
||||
|
||||
@@ -1707,15 +1733,36 @@ function get_graph_group($graph_template_item_id) {
|
||||
/* put the parent item in the array as well */
|
||||
$graph_item_children_array[$graph_template_item_id] = $graph_template_item_id;
|
||||
|
||||
$graph_items = db_fetch_assoc("SELECT id, graph_type_id FROM graph_templates_item WHERE sequence > " . $graph_item['sequence'] . " AND $sql_where ORDER BY sequence");
|
||||
$graph_items = db_fetch_assoc("SELECT id, graph_type_id, text_format, hard_return
|
||||
FROM graph_templates_item
|
||||
WHERE sequence > " . $graph_item['sequence'] . "
|
||||
AND $sql_where
|
||||
ORDER BY sequence");
|
||||
|
||||
if (sizeof($graph_items) > 0) {
|
||||
$is_hard = false;
|
||||
|
||||
if (sizeof($graph_items)) {
|
||||
foreach ($graph_items as $item) {
|
||||
if ($graph_item_types[$item['graph_type_id']] == 'GPRINT') {
|
||||
if ($is_hard) {
|
||||
return $graph_item_children_array;
|
||||
} elseif (strstr($graph_item_types[$item['graph_type_id']], 'GPRINT') !== false) {
|
||||
/* a child must be a GPRINT */
|
||||
$graph_item_children_array[$item['id']] = $item['id'];
|
||||
|
||||
if ($item['hard_return'] == 'on') {
|
||||
$is_hard = true;
|
||||
}
|
||||
} elseif (strstr($graph_item_types[$item['graph_type_id']], 'COMMENT') !== false) {
|
||||
if (preg_match_all('/\|([0-9]{1,2}):(bits|bytes):(\d):(current|total|max|total_peak|all_max_current|all_max_peak|aggregate_max|aggregate_sum|aggregate_current|aggregate):(\d)?\|/', $item['text_format'], $matches, PREG_SET_ORDER)) {
|
||||
$graph_item_children_array[$item['id']] = $item['id'];
|
||||
} elseif (preg_match_all('/\|sum:(\d|auto):(current|total|atomic):(\d):(\d+|auto)\|/', $item['text_format'], $matches, PREG_SET_ORDER)) {
|
||||
$graph_item_children_array[$item['id']] = $item['id'];
|
||||
} else {
|
||||
/* if not a GPRINT or special COMMENT then get out */
|
||||
return $graph_item_children_array;
|
||||
}
|
||||
} else {
|
||||
/* if not a GPRINT then get out */
|
||||
/* if not a GPRINT or special COMMENT then get out */
|
||||
return $graph_item_children_array;
|
||||
}
|
||||
}
|
||||
@@ -1729,7 +1776,10 @@ function get_graph_group($graph_template_item_id) {
|
||||
@arg $direction - ('next' or 'previous') whether to find the next or previous parent
|
||||
@returns - (int) the ID of the next or previous parent graph item id */
|
||||
function get_graph_parent($graph_template_item_id, $direction) {
|
||||
$graph_item = db_fetch_row_prepared('SELECT sequence, local_graph_id, graph_template_id FROM graph_templates_item WHERE id = ?', array($graph_template_item_id));
|
||||
$graph_item = db_fetch_row_prepared('SELECT sequence, local_graph_id, graph_template_id
|
||||
FROM graph_templates_item
|
||||
WHERE id = ?',
|
||||
array($graph_template_item_id));
|
||||
|
||||
if (empty($graph_item['local_graph_id'])) {
|
||||
$sql_where = 'graph_template_id = ' . $graph_item['graph_template_id'] . ' AND local_graph_id = 0';
|
||||
@@ -1745,7 +1795,13 @@ function get_graph_parent($graph_template_item_id, $direction) {
|
||||
$sql_order = 'DESC';
|
||||
}
|
||||
|
||||
$next_parent_id = db_fetch_cell("SELECT id FROM graph_templates_item WHERE sequence $sql_operator " . $graph_item['sequence'] . " AND graph_type_id != 9 AND $sql_where ORDER BY sequence $sql_order LIMIT 1");
|
||||
$next_parent_id = db_fetch_cell("SELECT id
|
||||
FROM graph_templates_item
|
||||
WHERE sequence $sql_operator " . $graph_item['sequence'] . "
|
||||
AND graph_type_id IN (4, 5, 6, 7, 8, 20)
|
||||
AND $sql_where
|
||||
ORDER BY sequence $sql_order
|
||||
LIMIT 1");
|
||||
|
||||
if (empty($next_parent_id)) {
|
||||
return 0;
|
||||
@@ -1770,8 +1826,16 @@ function get_item($tblname, $field, $startid, $lmt_query, $direction) {
|
||||
$sql_order = 'DESC';
|
||||
}
|
||||
|
||||
$current_sequence = db_fetch_cell_prepared("SELECT $field FROM $tblname WHERE id = ?", array($startid));
|
||||
$new_item_id = db_fetch_cell("SELECT id FROM $tblname WHERE $field $sql_operator $current_sequence " . ($lmt_query != '' ? " AND $lmt_query":"") . " ORDER BY $field $sql_order LIMIT 1");
|
||||
$current_sequence = db_fetch_cell_prepared("SELECT $field
|
||||
FROM $tblname
|
||||
WHERE id = ?",
|
||||
array($startid));
|
||||
|
||||
$new_item_id = db_fetch_cell("SELECT id
|
||||
FROM $tblname
|
||||
WHERE $field $sql_operator $current_sequence " . ($lmt_query != '' ? " AND $lmt_query":"") . "
|
||||
ORDER BY $field $sql_order
|
||||
LIMIT 1");
|
||||
|
||||
if (empty($new_item_id)) {
|
||||
return $startid;
|
||||
@@ -1788,7 +1852,9 @@ function get_item($tblname, $field, $startid, $lmt_query, $direction) {
|
||||
@returns - (int) the next available sequence id */
|
||||
function get_sequence($id, $field, $table_name, $group_query) {
|
||||
if (empty($id)) {
|
||||
$data = db_fetch_row("SELECT max($field)+1 AS seq FROM $table_name WHERE $group_query");
|
||||
$data = db_fetch_row("SELECT max($field)+1 AS seq
|
||||
FROM $table_name
|
||||
WHERE $group_query");
|
||||
|
||||
if ($data['seq'] == '') {
|
||||
return 1;
|
||||
@@ -1796,7 +1862,11 @@ function get_sequence($id, $field, $table_name, $group_query) {
|
||||
return $data['seq'];
|
||||
}
|
||||
} else {
|
||||
$data = db_fetch_row_prepared("SELECT $field FROM $table_name WHERE id = ?", array($id));
|
||||
$data = db_fetch_row_prepared("SELECT $field
|
||||
FROM $table_name
|
||||
WHERE id = ?",
|
||||
array($id));
|
||||
|
||||
return $data[$field];
|
||||
}
|
||||
}
|
||||
@@ -1808,10 +1878,25 @@ function get_sequence($id, $field, $table_name, $group_query) {
|
||||
function move_item_down($table_name, $current_id, $group_query = '') {
|
||||
$next_item = get_item($table_name, 'sequence', $current_id, $group_query, 'next');
|
||||
|
||||
$sequence = db_fetch_cell_prepared("SELECT sequence FROM $table_name WHERE id = ?", array($current_id));
|
||||
$sequence_next = db_fetch_cell_prepared("SELECT sequence FROM $table_name WHERE id = ?", array($next_item));
|
||||
db_execute_prepared("UPDATE $table_name SET sequence = ? WHERE id = ?", array($sequence_next, $current_id));
|
||||
db_execute_prepared("UPDATE $table_name SET sequence = ? WHERE id = ?", array($sequence, $next_item));
|
||||
$sequence = db_fetch_cell_prepared("SELECT sequence
|
||||
FROM $table_name
|
||||
WHERE id = ?",
|
||||
array($current_id));
|
||||
|
||||
$sequence_next = db_fetch_cell_prepared("SELECT sequence
|
||||
FROM $table_name
|
||||
WHERE id = ?",
|
||||
array($next_item));
|
||||
|
||||
db_execute_prepared("UPDATE $table_name
|
||||
SET sequence = ?
|
||||
WHERE id = ?",
|
||||
array($sequence_next, $current_id));
|
||||
|
||||
db_execute_prepared("UPDATE $table_name
|
||||
SET sequence = ?
|
||||
WHERE id = ?",
|
||||
array($sequence, $next_item));
|
||||
}
|
||||
|
||||
/* move_item_up - moves an item down by swapping it with the item above it
|
||||
@@ -1821,10 +1906,25 @@ function move_item_down($table_name, $current_id, $group_query = '') {
|
||||
function move_item_up($table_name, $current_id, $group_query = '') {
|
||||
$last_item = get_item($table_name, 'sequence', $current_id, $group_query, 'previous');
|
||||
|
||||
$sequence = db_fetch_cell_prepared("SELECT sequence FROM $table_name WHERE id = ?", array($current_id));
|
||||
$sequence_last = db_fetch_cell_prepared("SELECT sequence FROM $table_name WHERE id = ?", array($last_item));
|
||||
db_execute_prepared("UPDATE $table_name set sequence = ? WHERE id = ?", array($sequence_last, $current_id));
|
||||
db_execute_prepared("UPDATE $table_name set sequence = ? WHERE id = ?", array($sequence, $last_item));
|
||||
$sequence = db_fetch_cell_prepared("SELECT sequence
|
||||
FROM $table_name
|
||||
WHERE id = ?",
|
||||
array($current_id));
|
||||
|
||||
$sequence_last = db_fetch_cell_prepared("SELECT sequence
|
||||
FROM $table_name
|
||||
WHERE id = ?",
|
||||
array($last_item));
|
||||
|
||||
db_execute_prepared("UPDATE $table_name
|
||||
SET sequence = ?
|
||||
WHERE id = ?",
|
||||
array($sequence_last, $current_id));
|
||||
|
||||
db_execute_prepared("UPDATE $table_name
|
||||
SET sequence = ?
|
||||
WHERE id = ?",
|
||||
array($sequence, $last_item));
|
||||
}
|
||||
|
||||
/* exec_into_array - executes a command and puts each line of its output into
|
||||
@@ -3564,7 +3664,7 @@ function mailer($from, $to, $cc, $bcc, $replyto, $subject, $body, $body_text = '
|
||||
|
||||
include_once($config['include_path'] . '/phpmailer/PHPMailerAutoload.php');
|
||||
|
||||
// Set the to informaiotn
|
||||
// Set the to information
|
||||
if ($to == '') {
|
||||
return __('Mailer Error: No <b>TO</b> address set!!<br>If using the <i>Test Mail</i> link, please set the <b>Alert e-mail</b> setting.');
|
||||
}
|
||||
@@ -3839,7 +3939,7 @@ function mailer($from, $to, $cc, $bcc, $replyto, $subject, $body, $body_text = '
|
||||
}
|
||||
|
||||
if ($mail->send()) {
|
||||
cacti_log("Mail Sucessfully Sent to '" . $toText . "', Subject: '" . $mail->Subject . "'", false, 'MAILER');
|
||||
cacti_log("Mail Successfully Sent to '" . $toText . "', Subject: '" . $mail->Subject . "'", false, 'MAILER');
|
||||
|
||||
return '';
|
||||
} else {
|
||||
|
||||
+60
-7
@@ -30,7 +30,7 @@
|
||||
@arg $percentile - Nth Percentile to calculate, integer between 1 and 99
|
||||
@arg $resolution - the accuracy of the data measured in seconds
|
||||
@returns - (array) an array containing each data source item, and its 95th percentile */
|
||||
function nth_percentile($local_data_id, $start_seconds, $end_seconds, $percentile = 95, $resolution = 0) {
|
||||
function nth_percentile($local_data_id, $start_seconds, $end_seconds, $percentile = 95, $resolution = 0, $peak = false) {
|
||||
global $config;
|
||||
|
||||
include_once($config['library_path'] . '/rrd.php');
|
||||
@@ -43,7 +43,15 @@ function nth_percentile($local_data_id, $start_seconds, $end_seconds, $percentil
|
||||
$i = 0;
|
||||
/* do a fetch for each data source */
|
||||
foreach ($local_data_id as $ldi => $ldi_value) {
|
||||
$fetch_array[$i] = @rrdtool_function_fetch($ldi, $start_seconds, $end_seconds, $resolution);
|
||||
if ($peak) {
|
||||
$fetch_array[$i] = @rrdtool_function_fetch($ldi, $start_seconds, $end_seconds, $resolution, false, 'MAX');
|
||||
|
||||
if (!sizeof($fetch_array[$i])) {
|
||||
$fetch_array[$i] = @rrdtool_function_fetch($ldi, $start_seconds, $end_seconds, $resolution);
|
||||
}
|
||||
} else {
|
||||
$fetch_array[$i] = @rrdtool_function_fetch($ldi, $start_seconds, $end_seconds, $resolution);
|
||||
}
|
||||
/* clean up unwanted data source items */
|
||||
if (!empty($fetch_array[$i])) {
|
||||
foreach ($fetch_array[$i]['data_source_names'] as $id => $name) {
|
||||
@@ -69,7 +77,7 @@ function nth_percentile($local_data_id, $start_seconds, $end_seconds, $percentil
|
||||
$sum_array['data_source_names'] = $fetch_array[0]['data_source_names'];
|
||||
}
|
||||
|
||||
if (sizeof($fetch_array) > 0) {
|
||||
if (sizeof($fetch_array)) {
|
||||
/* Create hash of ds_item_name => array or fetch_array indexes */
|
||||
/* this is used to later sum, max and total the data sources used on the graph */
|
||||
/* Loop fetch array index */
|
||||
@@ -84,10 +92,13 @@ function nth_percentile($local_data_id, $start_seconds, $end_seconds, $percentil
|
||||
/* Sum up the like data sources */
|
||||
$sum_array = array();
|
||||
$i = 0;
|
||||
|
||||
foreach ($dsi_name_to_id as $ds_name => $id_array) {
|
||||
$sum_array['data_source_names'][$i] = $ds_name;
|
||||
|
||||
foreach ($id_array as $id) {
|
||||
$fetch_id = array_search($ds_name,$fetch_array[$id]['data_source_names']);
|
||||
|
||||
/* Sum up like ds names */
|
||||
for ($j=0; $j<count($fetch_array[$id]['values'][$fetch_id]); $j++) {
|
||||
if (isset($fetch_array[$id]['values'][$fetch_id][$j])) {
|
||||
@@ -95,6 +106,7 @@ function nth_percentile($local_data_id, $start_seconds, $end_seconds, $percentil
|
||||
} else {
|
||||
$value = 0;
|
||||
}
|
||||
|
||||
if (isset($sum_array['values'][$i][$j])) {
|
||||
$sum_array['values'][$i][$j] += $value;
|
||||
} else {
|
||||
@@ -102,6 +114,7 @@ function nth_percentile($local_data_id, $start_seconds, $end_seconds, $percentil
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
@@ -110,6 +123,7 @@ function nth_percentile($local_data_id, $start_seconds, $end_seconds, $percentil
|
||||
if (isset($sum_array['values'])) {
|
||||
$num_ds = count($sum_array['values']);
|
||||
$total_ds = count($sum_array['values']);
|
||||
|
||||
for ($j=0; $j<$total_ds; $j++) { /* each data source item */
|
||||
for ($k=0; $k<count($sum_array['values'][$j]); $k++) { /* each rrd row */
|
||||
/* now we must re-calculate the 95th max */
|
||||
@@ -117,11 +131,13 @@ function nth_percentile($local_data_id, $start_seconds, $end_seconds, $percentil
|
||||
if (isset($sum_array['values'][$j][$k])) {
|
||||
$value = $sum_array['values'][$j][$k];
|
||||
}
|
||||
|
||||
if (isset($sum_array['values'][$num_ds][$k])) {
|
||||
$sum_array['values'][$num_ds][$k] = max($value, $sum_array['values'][$num_ds][$k]);
|
||||
} else {
|
||||
$sum_array['values'][$num_ds][$k] = max($value, 0);
|
||||
}
|
||||
|
||||
/* sum of all ds rows */
|
||||
$value = 0;
|
||||
if (isset($sum_array['values'][$j][$k])) {
|
||||
@@ -272,22 +288,33 @@ function variable_nth_percentile(&$regexp_match_array, &$graph, &$graph_item, &$
|
||||
/* Get the Nth percentile values */
|
||||
switch ($regexp_match_array[4]) {
|
||||
case 'current':
|
||||
case 'max':
|
||||
$nth_cache[$graph_item['local_data_id']] = nth_percentile($graph_item['local_data_id'], $graph_start, $graph_end, $regexp_match_array[1]);
|
||||
|
||||
break;
|
||||
case 'max':
|
||||
$nth_cache[$graph_item['local_data_id']] = nth_percentile($graph_item['local_data_id'], $graph_start, $graph_end, $regexp_match_array[1], 0, true);
|
||||
|
||||
break;
|
||||
case 'total':
|
||||
case 'total_peak':
|
||||
case 'all_max_current':
|
||||
case 'all_max_peak':
|
||||
foreach ($graph_items as $graph_element) {
|
||||
if (!empty($graph_element['local_data_id'])) {
|
||||
$nth_cache[$graph_element['local_data_id']] = nth_percentile($graph_element['local_data_id'], $graph_start, $graph_end, $regexp_match_array[1]);
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
case 'total_peak':
|
||||
case 'all_max_peak':
|
||||
foreach ($graph_items as $graph_element) {
|
||||
if (!empty($graph_element['local_data_id'])) {
|
||||
$nth_cache[$graph_element['local_data_id']] = nth_percentile($graph_element['local_data_id'], $graph_start, $graph_end, $regexp_match_array[1], 0, true);
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
case 'aggregate':
|
||||
case 'aggregate_sum':
|
||||
case 'aggregate_max':
|
||||
$local_data_array = array();
|
||||
foreach ($graph_items as $graph_element) {
|
||||
if (!empty($graph_element['data_template_rrd_id']) && preg_match('/(AREA|STACK|LINE[123])/', $graph_item_types[$graph_element['graph_type_id']])) {
|
||||
@@ -295,6 +322,17 @@ function variable_nth_percentile(&$regexp_match_array, &$graph, &$graph_item, &$
|
||||
}
|
||||
}
|
||||
$nth_cache[0] = nth_percentile($local_data_array, $graph_start, $graph_end, $regexp_match_array[1]);
|
||||
|
||||
break;
|
||||
case 'aggregate_max':
|
||||
$local_data_array = array();
|
||||
foreach ($graph_items as $graph_element) {
|
||||
if (!empty($graph_element['data_template_rrd_id']) && preg_match('/(AREA|STACK|LINE[123])/', $graph_item_types[$graph_element['graph_type_id']])) {
|
||||
$local_data_array[$graph_element['local_data_id']][] = $graph_element['data_source_name'];
|
||||
}
|
||||
}
|
||||
$nth_cache[0] = nth_percentile($local_data_array, $graph_start, $graph_end, $regexp_match_array[1], 0, true);
|
||||
|
||||
break;
|
||||
case 'aggregate_current':
|
||||
$local_data_array = array();
|
||||
@@ -308,6 +346,7 @@ function variable_nth_percentile(&$regexp_match_array, &$graph, &$graph_item, &$
|
||||
}
|
||||
$nth_cache[0] = nth_percentile($local_data_array, $graph_start, $graph_end, $regexp_match_array[1]);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -321,6 +360,7 @@ function variable_nth_percentile(&$regexp_match_array, &$graph, &$graph_item, &$
|
||||
$nth = ($regexp_match_array[2] == 'bits') ? $nth * 8 : $nth;
|
||||
$nth /= pow($pow, intval($regexp_match_array[3]));
|
||||
}
|
||||
|
||||
break;
|
||||
case 'total':
|
||||
foreach ($graph_items as $graph_element) {
|
||||
@@ -334,6 +374,7 @@ function variable_nth_percentile(&$regexp_match_array, &$graph, &$graph_item, &$
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
case 'max':
|
||||
if (!empty($nth_cache[$graph_item['local_data_id']]['nth_percentile_maximum'])) {
|
||||
@@ -341,6 +382,7 @@ function variable_nth_percentile(&$regexp_match_array, &$graph, &$graph_item, &$
|
||||
$nth = ($regexp_match_array[2] == 'bits') ? $nth * 8 : $nth;
|
||||
$nth /= pow($pow, intval($regexp_match_array[3]));
|
||||
}
|
||||
|
||||
break;
|
||||
case 'total_peak':
|
||||
foreach ($graph_items as $graph_element) {
|
||||
@@ -354,6 +396,7 @@ function variable_nth_percentile(&$regexp_match_array, &$graph, &$graph_item, &$
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
case 'all_max_current':
|
||||
foreach ($graph_items as $graph_element) {
|
||||
@@ -369,6 +412,7 @@ function variable_nth_percentile(&$regexp_match_array, &$graph, &$graph_item, &$
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
case 'all_max_peak':
|
||||
foreach ($graph_items as $graph_element) {
|
||||
@@ -384,6 +428,7 @@ function variable_nth_percentile(&$regexp_match_array, &$graph, &$graph_item, &$
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
case 'aggregate':
|
||||
case 'aggregate_current':
|
||||
@@ -393,6 +438,7 @@ function variable_nth_percentile(&$regexp_match_array, &$graph, &$graph_item, &$
|
||||
$local_nth /= pow($pow, intval($regexp_match_array[3]));
|
||||
$nth = $local_nth;
|
||||
}
|
||||
|
||||
break;
|
||||
case 'aggregate_max':
|
||||
if (!empty($nth_cache[0]['nth_percentile_aggregate_max'])) {
|
||||
@@ -401,6 +447,7 @@ function variable_nth_percentile(&$regexp_match_array, &$graph, &$graph_item, &$
|
||||
$local_nth /= pow($pow, intval($regexp_match_array[3]));
|
||||
$nth = $local_nth;
|
||||
}
|
||||
|
||||
break;
|
||||
case 'aggregate_sum':
|
||||
if (!empty($nth_cache[0]['nth_percentile_aggregate_sum'])) {
|
||||
@@ -409,6 +456,7 @@ function variable_nth_percentile(&$regexp_match_array, &$graph, &$graph_item, &$
|
||||
$local_nth /= pow($pow, intval($regexp_match_array[3]));
|
||||
$nth = $local_nth;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -468,6 +516,7 @@ function variable_bandwidth_summation(&$regexp_match_array, &$graph, &$graph_ite
|
||||
switch($regexp_match_array[2]) {
|
||||
case 'current':
|
||||
$summation_cache[$graph_item['local_data_id']] = bandwidth_summation($graph_item['local_data_id'], $summation_timespan_start, $graph_end, $rra_step, $ds_step);
|
||||
|
||||
break;
|
||||
case 'total':
|
||||
foreach ($graph_items as $graph_element) {
|
||||
@@ -475,9 +524,11 @@ function variable_bandwidth_summation(&$regexp_match_array, &$graph, &$graph_ite
|
||||
$summation_cache[$graph_element['local_data_id']] = bandwidth_summation($graph_element['local_data_id'], $summation_timespan_start, $graph_end, $rra_step, $ds_step);
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
case 'atomic':
|
||||
$summation_cache[$graph_item['local_data_id']] = bandwidth_summation($graph_item['local_data_id'], $summation_timespan_start, $graph_end, $rra_step, 1);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -490,6 +541,7 @@ function variable_bandwidth_summation(&$regexp_match_array, &$graph, &$graph_ite
|
||||
if (isset($summation_cache[$graph_item['local_data_id']][$graph_item['data_source_name']])) {
|
||||
$summation = $summation_cache[$graph_item['local_data_id']][$graph_item['data_source_name']];
|
||||
}
|
||||
|
||||
break;
|
||||
case 'total':
|
||||
foreach ($graph_items as $graph_element) {
|
||||
@@ -499,6 +551,7 @@ function variable_bandwidth_summation(&$regexp_match_array, &$graph, &$graph_ite
|
||||
$summation += $summation_cache[$graph_element['local_data_id']][$graph_element['data_source_name']];
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -1843,7 +1843,7 @@ function html_spikekill_setting($name) {
|
||||
function html_spikekill_menu($local_graph_id) {
|
||||
$ravgnan = '<li>' . __('Replacement Method') . '<ul>';
|
||||
$ravgnan .= '<li class="skmethod" id="method_avg"><i ' . (html_spikekill_setting('spikekill_avgnan') == 'avg' ? 'class="fa fa-check"':'') . '></i><span></span>' . __('Average') . '</li>';
|
||||
$ravgnan .= '<li class="skmethod" id="method_nan"><i ' . (html_spikekill_setting('spikekill_avgnan') == 'nan' ? 'class="fa fa-check"':'') . '></i><span></span>' . __('Nan\'s') . '</li>';
|
||||
$ravgnan .= '<li class="skmethod" id="method_nan"><i ' . (html_spikekill_setting('spikekill_avgnan') == 'nan' ? 'class="fa fa-check"':'') . '></i><span></span>' . __('NaN\'s') . '</li>';
|
||||
$ravgnan .= '<li class="skmethod" id="method_last"><i ' . (html_spikekill_setting('spikekill_avgnan') == 'last' ? 'class="fa fa-check"':'') . '></i><span></span>' . __('Last Known Good') . '</li>';
|
||||
$ravgnan .= '</ul></li>';
|
||||
|
||||
|
||||
+12
-3
@@ -332,7 +332,8 @@ function draw_edit_control($field_name, &$field_array) {
|
||||
((isset($field_array['default'])) ? $field_array['default'] : ''),
|
||||
((isset($field_array['form_id'])) ? $field_array['form_id'] : ''),
|
||||
((isset($field_array['class'])) ? $field_array['class'] : ''),
|
||||
((isset($field_array['on_change'])) ? $field_array['on_change'] : '')
|
||||
((isset($field_array['on_change'])) ? $field_array['on_change'] : ''),
|
||||
$field_array['friendly_name']
|
||||
);
|
||||
|
||||
break;
|
||||
@@ -346,7 +347,9 @@ function draw_edit_control($field_name, &$field_array) {
|
||||
((isset($check_array['default'])) ? $check_array['default'] : ''),
|
||||
((isset($check_array['form_id'])) ? $check_array['form_id'] : ''),
|
||||
((isset($field_array['class'])) ? $field_array['class'] : ''),
|
||||
((isset($check_array['on_change'])) ? $check_array['on_change'] : (((isset($field_array['on_change'])) ? $field_array['on_change'] : '')))
|
||||
((isset($check_array['on_change'])) ? $check_array['on_change'] : (((isset($field_array['on_change'])) ? $field_array['on_change'] : ''))),
|
||||
'',
|
||||
true
|
||||
);
|
||||
|
||||
print '<br>';
|
||||
@@ -808,8 +811,9 @@ function form_callback($form_name, $classic_sql, $column_display, $column_id, $c
|
||||
@param string $class - specify a css class
|
||||
@param string $on_change - specify a javascript onchange action
|
||||
@param string $title - specify a title for the checkbox on hover
|
||||
@param boolean $show_label - show the form caption in the checkbox
|
||||
*/
|
||||
function form_checkbox($form_name, $form_previous_value, $form_caption, $form_default_value, $current_id = 0, $class = '', $on_change = '', $title = '') {
|
||||
function form_checkbox($form_name, $form_previous_value, $form_caption, $form_default_value, $current_id = 0, $class = '', $on_change = '', $title = '', $show_label = false) {
|
||||
if (($form_previous_value == '') && (empty($current_id))) {
|
||||
$form_previous_value = $form_default_value;
|
||||
}
|
||||
@@ -835,6 +839,11 @@ function form_checkbox($form_name, $form_previous_value, $form_caption, $form_de
|
||||
}
|
||||
|
||||
print "<input " . ($title != "" ? " title='$title'":"") . " class='formCheckbox$class' type='checkbox' id='$form_name' name='$form_name'" . $on_change . $checked . ">";
|
||||
if ($show_label) {
|
||||
print "<label for='$form_name'>" . $form_caption . "</label>";
|
||||
} else {
|
||||
print "<label class='checkboxLabel' for='$form_name'>" . $form_caption . "</label>";
|
||||
}
|
||||
}
|
||||
|
||||
/* form_radio_button - draws a standard html radio button
|
||||
|
||||
+44
-4
@@ -141,6 +141,8 @@ function import_package($xmlfile, $profile_id = 1, $remove_orphans = false, $pre
|
||||
|
||||
$preview_only = $preview;
|
||||
|
||||
ini_set('zlib.output_compression', '0');
|
||||
|
||||
/* set new timeout and memory settings */
|
||||
ini_set('max_execution_time', '50');
|
||||
ini_set('memory_limit', '128M');
|
||||
@@ -737,7 +739,11 @@ function xml_to_data_template($hash, &$xml_array, &$hash_cache, $import_as_new,
|
||||
$save['t_value'] = $item_array['t_value'];
|
||||
$save['value'] = xml_character_decode($item_array['value']);
|
||||
|
||||
sql_save($save, 'data_input_data', array('data_template_data_id', 'data_input_field_id'), false);
|
||||
if (!empty($save['data_input_field_id'])) {
|
||||
sql_save($save, 'data_input_data', array('data_template_data_id', 'data_input_field_id'), false);
|
||||
} else {
|
||||
cacti_log('Import Error: Failed to insert into data_input_data table', false, POLLER_VERBOSITY_HIGH);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -872,7 +878,11 @@ function xml_to_data_query($hash, &$xml_array, &$hash_cache) {
|
||||
$save['data_template_rrd_id'] = resolve_hash_to_id($sub_item_array['data_template_rrd_id'], $hash_cache);
|
||||
$save['snmp_field_name'] = $sub_item_array['snmp_field_name'];
|
||||
|
||||
sql_save($save, 'snmp_query_graph_rrd', array('snmp_query_graph_id', 'data_template_id', 'data_template_rrd_id'), false);
|
||||
if (!empty($save['data_template_id']) && !empty($save['data_template_rrd_id'])) {
|
||||
sql_save($save, 'snmp_query_graph_rrd', array('snmp_query_graph_id', 'data_template_id', 'data_template_rrd_id'), false);
|
||||
} else {
|
||||
cacti_log('Import Error: inserting into snmp_query_graph_rrd', false, POLLER_VERBOSITY_HIGH);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -963,7 +973,11 @@ function xml_to_data_query($hash, &$xml_array, &$hash_cache) {
|
||||
$status += compare_data($save, $previous_data, 'snmp_query_graph_rrd_sv');
|
||||
|
||||
if (!$preview_only) {
|
||||
$data_query_graph_rrd_sv_id = sql_save($save, 'snmp_query_graph_rrd_sv');
|
||||
if (!empty($save['data_template_id'])) {
|
||||
$data_query_graph_rrd_sv_id = sql_save($save, 'snmp_query_graph_rrd_sv');
|
||||
} else {
|
||||
cacti_log('Import Error: Error Importing into snmp_query_graph_rrd_sv table', false, POLLER_VERBOSITY_HIGH);
|
||||
}
|
||||
|
||||
$hash_cache['data_query_sv_data_source'][$parsed_hash['hash']] = $data_query_graph_rrd_sv_id;
|
||||
} else {
|
||||
@@ -1498,6 +1512,13 @@ function xml_to_data_input_method($hash, &$xml_array, &$hash_cache) {
|
||||
/* invalid/wrong hash */
|
||||
if ($parsed_hash == false) { return false; }
|
||||
|
||||
/* bad snmp port hashes */
|
||||
if ($parsed_hash['hash'] == '5240353b8f7f259acaf30e6229bc14e7') {
|
||||
continue;
|
||||
} elseif ($parsed_hash['hash'] == 'd94caa7cc3733bd95ee00a3917fdcbb5') {
|
||||
continue;
|
||||
}
|
||||
|
||||
unset($save);
|
||||
$_data_input_field_id = db_fetch_cell_prepared('SELECT id
|
||||
FROM data_input_fields
|
||||
@@ -1613,7 +1634,7 @@ function hash_to_friendly_name($hash, $display_type_name) {
|
||||
|
||||
/* invalid/wrong hash */
|
||||
if ($parsed_hash == false) {
|
||||
return false;
|
||||
return __('Unknown Field');
|
||||
}
|
||||
|
||||
if ($display_type_name == true) {
|
||||
@@ -1696,7 +1717,19 @@ function resolve_hash_to_id($hash, &$hash_cache_array) {
|
||||
$import_debug_info['dep'][$hash] = 'met';
|
||||
return $hash_cache_array[$parsed_hash['type']][$parsed_hash['hash']];
|
||||
} else {
|
||||
/* bad snmp port hashes */
|
||||
if ($parsed_hash['hash'] == '5240353b8f7f259acaf30e6229bc14e7') {
|
||||
return 0;
|
||||
} elseif ($parsed_hash['hash'] == 'd94caa7cc3733bd95ee00a3917fdcbb5') {
|
||||
return 0;
|
||||
} elseif ($parsed_hash['hash'] == 'cbbe5c1ddfb264a6e5d509ce1c78c95f') {
|
||||
return 0;
|
||||
}
|
||||
|
||||
cacti_log("Import Error: Import found an invalid dependency hash of :" . $parsed_hash['hash'] . ". Please open bug on GitHub.");
|
||||
|
||||
$import_debug_info['dep'][$hash] = 'unmet';
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -1713,6 +1746,13 @@ function parse_xml_hash($hash) {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
/* bad snmp port hashes */
|
||||
if ($hash == '5240353b8f7f259acaf30e6229bc14e7') {
|
||||
return false;
|
||||
} elseif ($hash == 'd94caa7cc3733bd95ee00a3917fdcbb5') {
|
||||
return false;
|
||||
}
|
||||
|
||||
cacti_log(__FUNCTION__ . ' ERROR wrong hash format for hash: ' . $hash, false, 'IMPORT', POLLER_VERBOSITY_LOW);
|
||||
return false;
|
||||
}
|
||||
|
||||
+1
-1
@@ -2741,7 +2741,7 @@ function rrdtool_info2html($info_array, $diff=array()) {
|
||||
array('display' => __('Rows'), 'align' => 'right'),
|
||||
array('display' => __('Cur Row'), 'align' => 'right'),
|
||||
array('display' => __('PDP per Row'), 'align' => 'right'),
|
||||
array('display' => __('X Files Factor'), 'align' => 'right'),
|
||||
array('display' => __('X-Files Factor'), 'align' => 'right'),
|
||||
array('display' => __('CDP Prep Value (0)'), 'align' => 'right'),
|
||||
array('display' => __('CDP Unknown Data points (0)'), 'align' => 'right')
|
||||
);
|
||||
|
||||
@@ -620,6 +620,8 @@ function cacti_snmp_walk($hostname, $community, $oid, $version, $auth_user, $aut
|
||||
$oidCheck = '';
|
||||
}
|
||||
|
||||
$max_oids = read_config_option('snmp_bulk_walk_size');
|
||||
|
||||
if (file_exists($path_snmpbulkwalk) && ($version > 1) && ($max_oids > 1)) {
|
||||
$temp_array = exec_into_array(cacti_escapeshellcmd($path_snmpbulkwalk) .
|
||||
' -O QnU' . ($value_output_format == SNMP_STRING_OUTPUT_HEX ? 'x ':' ') . $snmp_auth .
|
||||
|
||||
Binary file not shown.
+1103
-1091
File diff suppressed because it is too large.
Load diff
+4697
-4202
File diff suppressed because it is too large.
Load diff
+21
-6
@@ -150,12 +150,26 @@ if (read_config_option('logrotate_enabled') == 'on') {
|
||||
if (empty($frequency)) {
|
||||
$frequency = 1;
|
||||
}
|
||||
|
||||
$last = read_config_option('logrotate_lastrun');
|
||||
$now = time();
|
||||
|
||||
if (empty($last)) {
|
||||
set_config_option('logrotate_lastrun', time());
|
||||
} elseif (($last + ($frequency * 86400)) < $now) {
|
||||
$last = time();
|
||||
set_config_option('logrotate_lastrun', $last);
|
||||
}
|
||||
|
||||
$date_now = (new DateTime())->setTimestamp($now);
|
||||
|
||||
// Take the last date/time, set the time to 59 seconds past midnight
|
||||
// then remove one minute to make it the previous evening
|
||||
$date_last = (new DateTime())->setTimestamp($last)->setTime(0,0,59)->modify('-1 minute');
|
||||
|
||||
// Make sure we clone the last date, or we end up modifying the same object!
|
||||
$date_next = clone $date_last;
|
||||
$date_next->modify('+'.$frequency.'day');
|
||||
|
||||
if ($date_next < $date_now) {
|
||||
logrotate_rotatenow();
|
||||
}
|
||||
}
|
||||
@@ -204,8 +218,9 @@ function logrotate_rotatenow () {
|
||||
$log = $config['base_path'] . '/log/cacti.log';
|
||||
}
|
||||
|
||||
set_config_option('logrotate_lastrun', time());
|
||||
|
||||
$run_time = time();
|
||||
set_config_option('logrotate_lastrun', $run_time);
|
||||
$date_log = (new DateTime($run_time))->modify('-1day');
|
||||
clearstatcache();
|
||||
|
||||
if (is_writable(dirname($log) . '/') && is_writable($log)) {
|
||||
@@ -214,10 +229,10 @@ function logrotate_rotatenow () {
|
||||
$group = filegroup($log);
|
||||
|
||||
if ($owner !== false) {
|
||||
$ext = date('Ymd');
|
||||
$ext = $date_log->format('Ymd');
|
||||
|
||||
if (file_exists($log . '-' . $ext)) {
|
||||
$ext = date('YmdHis');
|
||||
$ext = $date_log->format('YmdHis');
|
||||
}
|
||||
|
||||
if (rename($log, $log . '-' . $ext)) {
|
||||
|
||||
Reference in new issue
Block a user