__('Duplicate'), AUTOMATION_ACTION_GRAPH_ENABLE => __('Enable'), AUTOMATION_ACTION_GRAPH_EXPORT => __('Export'), AUTOMATION_ACTION_GRAPH_DISABLE => __('Disable'), AUTOMATION_ACTION_GRAPH_DELETE => __('Delete'), ); /* set default action */ set_default_action(); switch (get_request_var('action')) { case 'save': if (isset_request_var('save_component_import')) { automation_import_process(); } else { form_save(); } break; case 'actions': automation_graph_rules_form_actions(); break; case 'import': top_header(); automation_import(); bottom_footer(); break; case 'export': automation_export(); break; case 'item_movedown': automation_graph_rules_item_movedown(); header('Location: automation_graph_rules.php?action=edit&id=' . get_filter_request_var('id')); break; case 'item_moveup': automation_graph_rules_item_moveup(); header('Location: automation_graph_rules.php?action=edit&id=' . get_filter_request_var('id')); break; case 'item_remove': automation_graph_rules_item_remove(); header('Location: automation_graph_rules.php?action=edit&id=' . get_filter_request_var('id')); break; case 'item_edit': top_header(); automation_graph_rules_item_edit(); bottom_footer(); break; case 'qedit': automation_change_query_type(); header('Location: automation_graph_rules.php?action=edit&name=' . get_request_var('name') . '&id=' . get_filter_request_var('id') . '&snmp_query_id=' . get_request_var('snmp_query_id')); break; case 'remove': automation_graph_rules_remove(); header('Location: automation_graph_rules.php'); break; case 'edit': top_header(); automation_graph_rules_edit(); bottom_footer(); break; default: top_header(); automation_graph_rules(); bottom_footer(); break; } function automation_export() { /* if we are to save this form, instead of display it */ if (isset_request_var('selected_items')) { $selected_items = sanitize_unserialize_selected_items(get_nfilter_request_var('selected_items')); if ($selected_items != false) { if(cacti_sizeof($selected_items) == 1) { $export_data = automation_graph_rule_export($selected_items[0]); } else { foreach($selected_items as $id) { $snmp_option_ids[] = $id; } $export_data = automation_graph_rule_export($snmp_option_ids); } if (cacti_sizeof($export_data)) { $export_file_name = $export_data['name']; header('Content-type: application/json'); header('Content-Disposition: attachment; filename=' . $export_file_name); $output = json_encode($export_data, JSON_PRETTY_PRINT); print $output; } } } } function automation_import() { $form_data = array( 'import_file' => array( 'friendly_name' => __('Import Graph Rules from Local File',), 'description' => __('If the JSON file containing the Graph Rules data is located on your local machine, select it here.'), 'method' => 'file', 'accept' => '.json' ), 'import_text' => array( 'method' => 'textarea', 'friendly_name' => __('Import Graph Rules from Text'), 'description' => __('If you have the JSON file containing the Graph Rules data as text, you can paste it into this box to import it.'), 'value' => '', 'default' => '', 'textarea_rows' => '10', 'textarea_cols' => '80', 'class' => 'textAreaNotes' ) ); form_start('automation_graph_rules.php', 'chk', true); if ((isset($_SESSION['import_debug_info'])) && (is_array($_SESSION['import_debug_info']))) { html_start_box(__('Import Results'), '80%', '', '3', 'center', ''); print '' . __('Cacti has Imported the following Graph Rules'). ''; foreach ($_SESSION['import_debug_info'] as $line) { print '' . $line . ''; } html_end_box(); kill_session_var('import_debug_info'); } html_start_box(__('Import Graph Rules'), '80%', false, '3', 'center', ''); draw_edit_form( array( 'config' => array('no_form_tag' => true), 'fields' => $form_data ) ); form_hidden_box('save_component_import', '1', ''); print "
"; html_end_box(); } function automation_import_process() { $json_data = json_decode(get_nfilter_request_var('import_text'), true); // If we have text, then we were trying to import text, otherwise we are uploading a file for import if (empty($json_data)) { $json_data = automation_validate_upload(); } if (is_array($json_data) && cacti_sizeof($json_data) && isset($json_data['graph_rules'])) { foreach($json_data['graph_rules'] as $graph_rule) { $return_data += automation_graph_rule_import($graph_rule); } } if (sizeof($return_data) && isset($return_data['success'])) { foreach ($return_data['success'] as $message) { $debug_data[] = '' . __('NOTE:') . ' ' . $message; cacti_log('NOTE: Automation Graph Rules Import Succeeded!. Message: '. $message, false, 'AUTOM8'); } } if (isset($return_data['errors'])) { foreach ($return_data['errors'] as $error) { $debug_data[] = '' . __('ERROR:') . ' ' . $error; cacti_log('NOTE: Automation Graph Rules Import Error!. Message: '. $message, false, 'AUTOM8'); } } if (isset($return_data['failure'])) { foreach ($return_data['failure'] as $message) { $debug_data[] = '' . __('ERROR:') . ' ' . $message; cacti_log('NOTE: Automation Graph Rules Import Failed!. Message: '. $message, false, 'AUTOM8'); } } if (cacti_sizeof($debug_data)) { $_SESSION['import_debug_info'] = $debug_data; } header('Location: automation_graph_rules.php?action=import'); exit(); } function form_save() { if (isset_request_var('save_component_automation_graph_rule')) { /* ================= input validation ================= */ get_filter_request_var('id'); /* ==================================================== */ $save['id'] = get_nfilter_request_var('id'); $save['hash'] = get_hash_automation(get_request_var('id'), 'automation_graph_rules'); $save['name'] = form_input_validate(get_nfilter_request_var('name'), 'name', '', false, 3); $save['snmp_query_id'] = form_input_validate(get_nfilter_request_var('snmp_query_id'), 'snmp_query_id', '^[0-9]+$', false, 3); $save['graph_type_id'] = (isset_request_var('graph_type_id')) ? form_input_validate(get_nfilter_request_var('graph_type_id'), 'graph_type_id', '^[0-9]+$', false, 3) : 0; $save['enabled'] = (isset_request_var('enabled') ? 'on' : ''); if (!is_error_message()) { $rule_id = sql_save($save, 'automation_graph_rules'); if ($rule_id) { raise_message(1); } else { raise_message(2); } } header('Location: automation_graph_rules.php?action=edit&id=' . (empty($rule_id) ? get_nfilter_request_var('id') : $rule_id)); } elseif (isset_request_var('save_component_automation_graph_rule_item')) { /* ================= input validation ================= */ get_filter_request_var('id'); get_filter_request_var('item_id'); /* ==================================================== */ $save = array(); $save['id'] = form_input_validate(get_request_var('item_id'), 'item_id', '^[0-9]+$', false, 3); $save['hash'] = get_hash_automation(get_request_var('id_item'), 'automation_graph_rule_items'); $save['rule_id'] = form_input_validate(get_request_var('id'), 'id', '^[0-9]+$', false, 3); $save['sequence'] = form_input_validate(get_nfilter_request_var('sequence'), 'sequence', '^[0-9]+$', false, 3); $save['operation'] = form_input_validate(get_nfilter_request_var('operation'), 'operation', '^[-0-9]+$', true, 3); $save['field'] = form_input_validate(((isset_request_var('field') && get_nfilter_request_var('field') != '0') ? get_nfilter_request_var('field') : ''), 'field', '', true, 3); $save['operator'] = form_input_validate((isset_request_var('operator') ? get_nfilter_request_var('operator') : ''), 'operator', '^[0-9]+$', true, 3); $save['pattern'] = form_input_validate((isset_request_var('pattern') ? get_nfilter_request_var('pattern') : ''), 'pattern', '', true, 3); if (!is_error_message()) { $item_id = sql_save($save, 'automation_graph_rule_items'); if ($item_id) { raise_message(1); } else { raise_message(2); } } if (is_error_message()) { header('Location: automation_graph_rules.php?action=item_edit&id=' . get_request_var('id') . '&item_id=' . (empty($item_id) ? get_request_var('item_id') : $item_id) . '&rule_type=' . AUTOMATION_RULE_TYPE_GRAPH_ACTION); } else { header('Location: automation_graph_rules.php?action=edit&id=' . get_request_var('id') . '&rule_type=' . AUTOMATION_RULE_TYPE_GRAPH_ACTION); } } elseif (isset_request_var('save_component_automation_match_item')) { /* ================= input validation ================= */ get_filter_request_var('id'); get_filter_request_var('item_id'); /* ==================================================== */ unset($save); $save['id'] = form_input_validate(get_request_var('item_id'), 'item_id', '^[0-9]+$', false, 3); $save['hash'] = get_hash_automation(get_request_var('item_idid'), 'automation_match_rule_items'); $save['rule_id'] = form_input_validate(get_request_var('id'), 'id', '^[0-9]+$', false, 3); $save['rule_type'] = AUTOMATION_RULE_TYPE_GRAPH_MATCH; $save['sequence'] = form_input_validate(get_nfilter_request_var('sequence'), 'sequence', '^[0-9]+$', false, 3); $save['operation'] = form_input_validate(get_nfilter_request_var('operation'), 'operation', '^[-0-9]+$', true, 3); $save['field'] = form_input_validate(((isset_request_var('field') && get_nfilter_request_var('field') != '0') ? get_nfilter_request_var('field') : ''), 'field', '', true, 3); $save['operator'] = form_input_validate((isset_request_var('operator') ? get_nfilter_request_var('operator') : ''), 'operator', '^[0-9]+$', true, 3); $save['pattern'] = form_input_validate((isset_request_var('pattern') ? get_nfilter_request_var('pattern') : ''), 'pattern', '', true, 3); if (!is_error_message()) { $item_id = sql_save($save, 'automation_match_rule_items'); if ($item_id) { raise_message(1); } else { raise_message(2); } } if (is_error_message()) { header('Location: automation_graph_rules.php?action=item_edit&id=' . get_request_var('id') . '&item_id=' . (empty($item_id) ? get_request_var('item_id') : $item_id) . '&rule_type=' . AUTOMATION_RULE_TYPE_GRAPH_MATCH); } else { header('Location: automation_graph_rules.php?action=edit&id=' . get_request_var('id') . '&rule_type=' . AUTOMATION_RULE_TYPE_GRAPH_MATCH); } } else { raise_message(2); header('Location: automation_graph_rules.php'); } } /* ------------------------ The 'actions' function ------------------------ */ function automation_graph_rules_form_actions() { global $config, $automation_graph_rules_actions; /* ================= input validation ================= */ get_filter_request_var('drp_action'); /* ==================================================== */ /* if we are to save this form, instead of display it */ if (isset_request_var('selected_items')) { $selected_items = sanitize_unserialize_selected_items(get_nfilter_request_var('selected_items')); if ($selected_items != false) { if (get_nfilter_request_var('drp_action') == AUTOMATION_ACTION_GRAPH_DELETE) { /* delete */ db_execute('DELETE FROM automation_graph_rules WHERE ' . array_to_sql_or($selected_items, 'id')); db_execute('DELETE FROM automation_graph_rule_items WHERE ' . array_to_sql_or($selected_items, 'rule_id')); db_execute('DELETE FROM automation_match_rule_items WHERE ' . array_to_sql_or($selected_items, 'rule_id')); } elseif (get_nfilter_request_var('drp_action') == AUTOMATION_ACTION_GRAPH_DUPLICATE) { /* duplicate */ for ($i=0;($i < cacti_count($selected_items));$i++) { cacti_log('form_actions duplicate: ' . $selected_items[$i] . ' name: ' . get_nfilter_request_var('name_format'), true, 'AUTOM8 TRACE', POLLER_VERBOSITY_MEDIUM); duplicate_automation_graph_rules($selected_items[$i], get_nfilter_request_var('name_format')); } } elseif (get_nfilter_request_var('drp_action') == AUTOMATION_ACTION_GRAPH_ENABLE) { /* enable */ for ($i=0;($i < cacti_count($selected_items));$i++) { cacti_log('form_actions enable: ' . $selected_items[$i], true, 'AUTOM8 TRACE', POLLER_VERBOSITY_MEDIUM); db_execute_prepared("UPDATE automation_graph_rules SET enabled='on' WHERE id = ?", array($selected_items[$i])); } } elseif (get_nfilter_request_var('drp_action') == AUTOMATION_ACTION_GRAPH_DISABLE) { /* disable */ for ($i=0;($i < cacti_count($selected_items));$i++) { cacti_log('form_actions disable: ' . $selected_items[$i], true, 'AUTOM8 TRACE', POLLER_VERBOSITY_MEDIUM); db_execute_prepared("UPDATE automation_graph_rules SET enabled='' WHERE id = ?", array($selected_items[$i])); } } elseif (get_nfilter_request_var('drp_action') == AUTOMATION_ACTION_GRAPH_EXPORT) { /* export */ top_header(); print ' '; bottom_footer(); exit; } } header('Location: automation_graph_rules.php'); exit; } /* setup some variables */ $automation_graph_rules_list = ''; $i = 0; /* loop through each of the graphs selected on the previous page and get more info about them */ foreach ($_POST as $var => $val) { if (preg_match('/^chk_([0-9]+)$/', $var, $matches)) { /* ================= input validation ================= */ input_validate_input_number($matches[1], 'chk[1]'); /* ==================================================== */ $automation_graph_rules_list .= '
  • ' . html_escape(db_fetch_cell_prepared('SELECT name FROM automation_graph_rules WHERE id = ?', array($matches[1]))) . '
  • '; $automation_graph_rules_array[] = $matches[1]; } } top_header(); form_start('automation_graph_rules.php', 'automation_graph_rules'); html_start_box($automation_graph_rules_actions[get_nfilter_request_var('drp_action')], '60%', '', '3', 'center', ''); if (get_nfilter_request_var('drp_action') == AUTOMATION_ACTION_GRAPH_DELETE) { /* delete */ print "

    " . __('Press \'Continue\' to delete the following Graph Rules.') . "

    "; } elseif (get_nfilter_request_var('drp_action') == AUTOMATION_ACTION_GRAPH_DUPLICATE) { /* duplicate */ print "

    " . __('Click \'Continue\' to duplicate the following Rule(s). You can optionally change the title format for the new Graph Rules.') . "

    " . __('Title Format') . '
    '; form_text_box('name_format', '<' . __('rule_name') . '> (1)', '', '255', '30', 'text'); print "

    \n"; } elseif (get_nfilter_request_var('drp_action') == AUTOMATION_ACTION_GRAPH_ENABLE) { /* enable */ print "

    " . __('Click \'Continue\' to enable the following Rule(s).') . "

    " . __('Make sure, that those rules have successfully been tested!') . "

    \n"; } elseif (get_nfilter_request_var('drp_action') == AUTOMATION_ACTION_GRAPH_DISABLE) { /* disable */ print "

    " . __('Click \'Continue\' to disable the following Rule(s).') . "

    \n"; } elseif (get_nfilter_request_var('drp_action') == AUTOMATION_ACTION_GRAPH_EXPORT) { /* export */ print "

    " . __('Click \'Continue\' to Export the following Rule(s).') . "

    \n"; } if (!isset($automation_graph_rules_array)) { raise_message(40); header('Location: automation_graph_rules.php'); exit; } else { $save_html = " "; } print " $save_html \n"; html_end_box(); form_end(); bottom_footer(); } /* -------------------------- Rule Item Functions -------------------------- */ function automation_graph_rules_item_movedown() { /* ================= input validation ================= */ get_filter_request_var('id'); get_filter_request_var('item_id'); get_filter_request_var('rule_type'); /* ==================================================== */ if (get_request_var('rule_type') == AUTOMATION_RULE_TYPE_GRAPH_MATCH) { move_item_down('automation_match_rule_items', get_request_var('item_id'), 'rule_id=' . get_request_var('id') . ' AND rule_type=' . get_request_var('rule_type')); } elseif (get_request_var('rule_type') == AUTOMATION_RULE_TYPE_GRAPH_ACTION) { move_item_down('automation_graph_rule_items', get_request_var('item_id'), 'rule_id=' . get_request_var('id')); } } function automation_graph_rules_item_moveup() { /* ================= input validation ================= */ get_filter_request_var('id'); get_filter_request_var('item_id'); get_filter_request_var('rule_type'); /* ==================================================== */ if (get_request_var('rule_type') == AUTOMATION_RULE_TYPE_GRAPH_MATCH) { move_item_up('automation_match_rule_items', get_request_var('item_id'), 'rule_id=' . get_request_var('id') . ' AND rule_type=' . get_request_var('rule_type')); } elseif (get_request_var('rule_type') == AUTOMATION_RULE_TYPE_GRAPH_ACTION) { move_item_up('automation_graph_rule_items', get_request_var('item_id'), 'rule_id=' . get_request_var('id')); } } function automation_graph_rules_item_remove() { /* ================= input validation ================= */ get_filter_request_var('item_id'); get_filter_request_var('rule_type'); /* ==================================================== */ if (get_request_var('rule_type') == AUTOMATION_RULE_TYPE_GRAPH_MATCH) { db_execute_prepared('DELETE FROM automation_match_rule_items WHERE id = ?', array(get_request_var('item_id'))); } elseif (get_request_var('rule_type') == AUTOMATION_RULE_TYPE_GRAPH_ACTION) { db_execute_prepared('DELETE FROM automation_graph_rule_items WHERE id = ?', array(get_request_var('item_id'))); } } function automation_graph_rules_item_edit() { global $config; /* ================= input validation ================= */ get_filter_request_var('id'); get_filter_request_var('item_id'); get_filter_request_var('rule_type'); /* ==================================================== */ global_item_edit(get_request_var('id'), get_request_var('item_id'), get_request_var('rule_type')); form_hidden_box('rule_type', get_request_var('rule_type'), get_request_var('rule_type')); form_hidden_box('id', (isset_request_var('id') ? get_request_var('id') : '0'), ''); form_hidden_box('item_id', (isset_request_var('item_id') ? get_request_var('item_id') : '0'), ''); if (get_request_var('rule_type') == AUTOMATION_RULE_TYPE_GRAPH_MATCH) { form_hidden_box('save_component_automation_match_item', '1', ''); } else { form_hidden_box('save_component_automation_graph_rule_item', '1', ''); } form_save_button('automation_graph_rules.php?action=edit&id=' . get_request_var('id') . '&rule_type='. get_request_var('rule_type')); ?> 0) { $snmp_query_id = get_filter_request_var('snmp_query_id'); $name = get_nfilter_request_var('name'); db_execute_prepared('UPDATE automation_graph_rules SET snmp_query_id = ?, name = ? WHERE id = ?', array($snmp_query_id, $name, $id)); $graph_type = db_fetch_cell_prepared('SELECT id FROM snmp_query_graph WHERE snmp_query_id = ? ORDER BY name LIMIT 1', array($snmp_query_id)); db_execute_prepared('UPDATE automation_graph_rules SET graph_type_id = ? WHERE id = ?', array($graph_type, $id)); } elseif (isset_request_var('graph_type_id') && $id > 0) { $snmp_query_id = get_filter_request_var('graph_type_id'); $name = get_nfilter_request_var('name'); db_execute_prepared('UPDATE automation_graph_rules SET graph_type_id = ?, name = ? WHERE id = ?', array($snmp_query_id, $name, $id)); } } function automation_graph_rules_edit() { global $config; global $fields_automation_graph_rules_edit1, $fields_automation_graph_rules_edit2, $fields_automation_graph_rules_edit3; /* ================= input validation ================= */ get_filter_request_var('id'); get_filter_request_var('snmp_query_id'); get_filter_request_var('graph_type_id'); get_filter_request_var('show_graphs'); get_filter_request_var('show_hosts'); get_filter_request_var('show_rule'); /* ==================================================== */ /* clean up rule name */ if (isset_request_var('name')) { set_request_var('name', sanitize_search_string(get_request_var('name'))); } /* handle show_rule mode */ if (isset_request_var('show_rule')) { if (get_request_var('show_rule') == '0') { kill_session_var('automation_graph_rules_show_rule'); $_SESSION['automation_graph_rules_show_rule'] = false; } elseif (get_request_var('show_rule') == '1') { $_SESSION['automation_graph_rules_show_rule'] = true; } } elseif (!isset($_SESSION['automation_graph_rules_show_rule'])) { $_SESSION['automation_graph_rules_show_rule'] = true; } /* handle show_graphs mode */ if (isset_request_var('show_graphs')) { if (get_request_var('show_graphs') == '0') { kill_session_var('automation_graph_rules_show_graphs'); } elseif (get_request_var('show_graphs') == '1') { $_SESSION['automation_graph_rules_show_graphs'] = true; } } /* handle show_hosts mode */ if (isset_request_var('show_hosts')) { if (get_request_var('show_hosts') == '0') { kill_session_var('automation_graph_rules_show_hosts'); } elseif (get_request_var('show_hosts') == '1') { $_SESSION['automation_graph_rules_show_hosts'] = true; } } /* * display the rule ------------------------------------------------------------------------------------- */ $rule = array(); if (!isempty_request_var('id')) { $rule = db_fetch_row_prepared('SELECT * FROM automation_graph_rules where id = ?', array(get_request_var('id'))); if (!isempty_request_var('graph_type_id')) { $rule['graph_type_id'] = get_request_var('graph_type_id'); # set query_type for display } # setup header $header_label = __esc('Rule Selection [edit: %s]', $rule['name']); } else { $rule = array( 'name' => get_request_var('name'), 'snmp_query_id' => get_request_var('snmp_query_id'), ); $header_label = __('Rule Selection [new]'); } /* * show rule? ------------------------------------------------------------------------------------------ */ if (!isempty_request_var('id')) { ?>
    *'>
    *'>
    0) { ?>
    *'>
    array('no_form_tag' => true), 'fields' => inject_form_variables($form_array, (isset($rule) ? $rule : array())) )); html_end_box(true, true); form_hidden_box('id', (isset($rule['id']) ? $rule['id'] : '0'), ''); form_hidden_box('item_id', (isset($rule['item_id']) ? $rule['item_id'] : '0'), ''); form_hidden_box('save_component_automation_graph_rule', '1', ''); /* * display the rule items ------------------------------------------------------------------------------- */ if (!empty($rule['id'])) { # display graph rules for host match display_match_rule_items(__('Device Selection Criteria'), $rule['id'], AUTOMATION_RULE_TYPE_GRAPH_MATCH, 'automation_graph_rules.php'); # fetch graph action rules display_graph_rule_items(__('Graph Creation Criteria'), $rule['id'], AUTOMATION_RULE_TYPE_GRAPH_ACTION, 'automation_graph_rules.php'); } form_save_button('automation_graph_rules.php', 'return'); print '
    '; } if (!empty($rule['id'])) { /* display list of matching hosts */ if (isset($_SESSION['automation_graph_rules_show_hosts'])) { if ($_SESSION['automation_graph_rules_show_hosts']) { display_matching_hosts($rule, AUTOMATION_RULE_TYPE_GRAPH_MATCH, 'automation_graph_rules.php?action=edit&id=' . get_request_var('id')); } } /* display list of new graphs */ if (isset($_SESSION['automation_graph_rules_show_graphs'])) { if ($_SESSION['automation_graph_rules_show_graphs']) { display_new_graphs($rule, 'automation_graph_rules.php?action=edit&id=' . get_request_var('id')); } } } ?> array( 'filter' => FILTER_VALIDATE_INT, 'pageset' => true, 'default' => '-1' ), 'page' => array( 'filter' => FILTER_VALIDATE_INT, 'default' => '1' ), 'filter' => array( 'filter' => FILTER_DEFAULT, 'pageset' => true, 'default' => '' ), 'sort_column' => array( 'filter' => FILTER_CALLBACK, 'default' => 'name', 'options' => array('options' => 'sanitize_search_string') ), 'sort_direction' => array( 'filter' => FILTER_CALLBACK, 'default' => 'ASC', 'options' => array('options' => 'sanitize_search_string') ), 'status' => array( 'filter' => FILTER_VALIDATE_INT, 'pageset' => true, 'default' => '-1' ), 'snmp_query_id' => array( 'filter' => FILTER_VALIDATE_INT, 'pageset' => true, 'default' => '' ) ); validate_store_request_vars($filters, 'sess_autom_gr'); /* ================= input validation ================= */ if (get_request_var('rows') == -1) { $rows = read_config_option('num_rows_table'); } else { $rows = get_request_var('rows'); } if ((!empty($_SESSION['sess_autom_gr_status'])) && (!isempty_request_var('status'))) { if ($_SESSION['sess_autom_gr_status'] != get_nfilter_request_var('status')) { set_request_var('page', 1); } } html_start_box(__('Graph Rules'), '100%', '', '3', 'center', 'automation_graph_rules.php?action=edit'); ?>
    '> '> '> '>
    array('display' => __('Rule Name'), 'align' => 'left', 'sort' => 'ASC', 'tip' => __('The name of this rule.')), 'id' => array('display' => __('ID'), 'align' => 'right', 'sort' => 'ASC', 'tip' => __('The internal database ID for this rule. Useful in performing debugging and automation.')), 'snmp_query_name' => array('display' => __('Data Query'), 'align' => 'left', 'sort' => 'ASC'), 'graph_type_name' => array('display' => __('Graph Type'), 'align' => 'left', 'sort' => 'ASC'), 'enabled' => array('display' => __('Enabled'), 'align' => 'right', 'sort' => 'ASC'), ); html_header_sort_checkbox($display_text, get_request_var('sort_column'), get_request_var('sort_direction'), false); if (cacti_sizeof($automation_graph_rules_list)) { foreach ($automation_graph_rules_list as $automation_graph_rules) { $snmp_query_name = ((empty($automation_graph_rules['snmp_query_name'])) ? __('None') : html_escape($automation_graph_rules['snmp_query_name'])); $graph_type_name = ((empty($automation_graph_rules['graph_type_name'])) ? __('None') : html_escape($automation_graph_rules['graph_type_name'])); form_alternate_row('line' . $automation_graph_rules['id'], true); form_selectable_cell(filter_value($automation_graph_rules['name'], get_request_var('filter'), 'automation_graph_rules.php?action=edit&id=' . $automation_graph_rules['id'] . '&page=1'), $automation_graph_rules['id']); form_selectable_cell($automation_graph_rules['id'], $automation_graph_rules['id'], '', 'text-align:right'); form_selectable_cell(filter_value($snmp_query_name, get_request_var('filter')), $automation_graph_rules['id']); form_selectable_cell(filter_value($graph_type_name, get_request_var('filter')), $automation_graph_rules['id']); form_selectable_cell($automation_graph_rules['enabled'] ? __('Enabled') : __('Disabled'), $automation_graph_rules['id'], '', 'text-align:right'); form_checkbox_cell($automation_graph_rules['name'], $automation_graph_rules['id']); form_end_row(); } } else { print "" . __('No Graph Rules Found') . "\n"; } html_end_box(false); if (cacti_sizeof($automation_graph_rules_list)) { print $nav; } /* draw the dropdown containing a list of available actions for this form */ draw_actions_dropdown($automation_graph_rules_actions); form_end(); }