2011-08-25 Miguel de Dios <miguel.dedios@artica.es>
* ggodmode/modules/manage_network_templates.php, godmode/modules/manage_network_components.php, godmode/modules/manage_nc_groups.php: added checkboxes in the elements in the list and main checkbox to select all checkboxes, for to multiple delete. Fixes: #3390017 git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4826 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
2fbbc7241b
commit
c74fea610e
|
@ -1,3 +1,12 @@
|
|||
2011-08-25 Miguel de Dios <miguel.dedios@artica.es>
|
||||
|
||||
* ggodmode/modules/manage_network_templates.php,
|
||||
godmode/modules/manage_network_components.php,
|
||||
godmode/modules/manage_nc_groups.php: added checkboxes in the elements in
|
||||
the list and main checkbox to select all checkboxes, for to multiple delete.
|
||||
|
||||
Fixes: #3390017
|
||||
|
||||
2011-08-25 Juan Manuel Ramon <juanmanuel.ramon@artica.es>
|
||||
|
||||
* include/styles/pandora.css: Fixes style in notify css element.
|
||||
|
|
|
@ -36,6 +36,7 @@ $update = (bool) get_parameter ('update');
|
|||
$delete = (bool) get_parameter ('delete');
|
||||
$new = (bool) get_parameter ('new');
|
||||
$id = (int) get_parameter ('id');
|
||||
$multiple_delete = (bool)get_parameter('multiple_delete', 0);
|
||||
|
||||
if ($create) {
|
||||
$name = (string) get_parameter ('name');
|
||||
|
@ -75,12 +76,43 @@ if ($update) {
|
|||
if ($delete) {
|
||||
$result = db_process_sql_delete ('tnetwork_component_group',
|
||||
array ('id_sg' => $id));
|
||||
|
||||
if ($result !== false) $result = true;
|
||||
else $result = false;
|
||||
|
||||
ui_print_result_message ($result,
|
||||
__('Successfully deleted'),
|
||||
__('Not deleted. Error deleting data'));
|
||||
}
|
||||
|
||||
if (($id || $new) && !$delete) {
|
||||
if ($multiple_delete) {
|
||||
$ids = (array)get_parameter('delete_multiple', array());
|
||||
|
||||
db_process_sql_begin();
|
||||
|
||||
foreach ($ids as $id) {
|
||||
$result = db_process_sql_delete ('tnetwork_component_group',
|
||||
array ('id_sg' => $id));
|
||||
|
||||
if ($result === false) {
|
||||
db_process_sql_rollback();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ($result !== false) {
|
||||
db_process_sql_commit();
|
||||
}
|
||||
|
||||
if ($result !== false) $result = true;
|
||||
else $result = false;
|
||||
|
||||
ui_print_result_message ($result,
|
||||
__('Successfully multiple deleted'),
|
||||
__('Not deleted. Error deleting multiple data'));
|
||||
}
|
||||
|
||||
if (($id || $new) && !$delete && !$multiple_delete) {
|
||||
require_once ('manage_nc_groups_form.php');
|
||||
return;
|
||||
}
|
||||
|
@ -107,15 +139,16 @@ $table->width = '98%';
|
|||
$table->head = array ();
|
||||
$table->head[0] = __('Name');
|
||||
$table->head[1] = __('Parent');
|
||||
$table->head[2] = __('Action');
|
||||
$table->head[2] = __('Action') .
|
||||
html_print_checkbox('all_delete', 0, false, true, false, 'check_all_checkboxes();');
|
||||
$table->style = array ();
|
||||
$table->style[0] = 'font-weight: bold';
|
||||
$table->align = array ();
|
||||
$table->align[2] = 'center';
|
||||
$table->size = array ();
|
||||
$table->size[0] = '50%';
|
||||
$table->size[1] = '50%';
|
||||
$table->size[2] = '40px';
|
||||
$table->size[1] = '40%';
|
||||
$table->size[2] = '80px';
|
||||
$table->data = array ();
|
||||
|
||||
$total_groups = db_get_all_rows_filter ('tnetwork_component_group', false, 'COUNT(*) AS total');
|
||||
|
@ -130,19 +163,22 @@ foreach ($groups as $group) {
|
|||
|
||||
$data[1] = network_components_get_group_name ($group['parent']);
|
||||
|
||||
$data[2] = '<form method="post" onsubmit="if (! confirm (\''.__('Are you sure?').'\')) return false" style="display: inline">';
|
||||
$data[2] .= html_print_input_hidden ('delete', 1, true);
|
||||
$data[2] .= html_print_input_hidden ('id', $group['id_sg'], true);
|
||||
$data[2] .= html_print_input_hidden ('offset', 0, true);
|
||||
$data[2] .= html_print_input_image ('del', 'images/cross.png', 1, '', true,
|
||||
array ('title' => __('Delete')));
|
||||
$data[2] .= '</form>';
|
||||
$data[2] = "<a onclick='if(confirm('" . __('Are you sure?') . "')) return true; else return false;'
|
||||
href='index.php?sec=gmodules&sec2=godmode/modules/manage_nc_groups&delete=1&id=".$group['id_sg']."&offset=0'>" .
|
||||
html_print_input_image ('del', 'images/cross.png', 1, '', true, array ('title' => __('Delete'))) . "</a>" .
|
||||
html_print_checkbox_extended ('delete_multiple[]', $group['id_sg'], false, false, '', 'class="check_delete"', true);
|
||||
|
||||
array_push ($table->data, $data);
|
||||
}
|
||||
|
||||
if(isset($data)) {
|
||||
echo "<form method='post' action='index.php?sec=gmodules&sec2=godmode/modules/manage_nc_groups'>";
|
||||
html_print_input_hidden('multiple_delete', 1);
|
||||
html_print_table ($table);
|
||||
echo "<div style='padding-bottom: 20px; text-align: right; width:" . $table->width . "'>";
|
||||
html_print_submit_button(__('Delete'), 'delete_btn', false, 'class="sub delete"');
|
||||
echo "</div>";
|
||||
echo "</form>";
|
||||
}
|
||||
else {
|
||||
echo "<div class='nf'>".__('There are no defined component groups')."</div>";
|
||||
|
@ -156,3 +192,13 @@ html_print_submit_button (__('Create'), 'crt', false, 'class="sub next"');
|
|||
echo '</div>';
|
||||
echo '</form>';
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
function check_all_checkboxes() {
|
||||
if ($("input[name=all_delete]").attr('checked')) {
|
||||
$(".check_delete").attr('checked', true);
|
||||
}
|
||||
else {
|
||||
$(".check_delete").attr('checked', false);
|
||||
}
|
||||
}
|
||||
</script>
|
|
@ -74,6 +74,7 @@ $delete_component = (bool) get_parameter ('delete_component');
|
|||
$new_component = (bool) get_parameter ('new_component');
|
||||
$duplicate_network_component = (bool) get_parameter ('duplicate_network_component');
|
||||
$delete_multiple = (bool) get_parameter('delete_multiple');
|
||||
$multiple_delete = (bool)get_parameter('multiple_delete', 0);
|
||||
|
||||
if ($duplicate_network_component) {
|
||||
$source_id = (int) get_parameter ('source_id');
|
||||
|
@ -228,6 +229,31 @@ if ($delete_component) {
|
|||
$id = 0;
|
||||
}
|
||||
|
||||
if ($multiple_delete) {
|
||||
$ids = (array)get_parameter('delete_multiple', array());
|
||||
|
||||
db_process_sql_begin();
|
||||
|
||||
foreach ($ids as $id) {
|
||||
$result = network_components_delete_network_component ($id);
|
||||
|
||||
if ($result === false) {
|
||||
db_process_sql_rollback();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ($result !== false) {
|
||||
db_process_sql_commit();
|
||||
}
|
||||
|
||||
ui_print_result_message ($result,
|
||||
__('Successfully multiple deleted'),
|
||||
__('Not deleted. Error deleting multiple data'));
|
||||
|
||||
$id = 0;
|
||||
}
|
||||
|
||||
if ($id || $new_component) {
|
||||
include_once ('godmode/modules/manage_network_components_form.php');
|
||||
return;
|
||||
|
@ -322,9 +348,10 @@ $table->head[2] = __('Interval');
|
|||
$table->head[3] = __('Description');
|
||||
$table->head[4] = __('Group');
|
||||
$table->head[5] = __('Max/Min');
|
||||
$table->head[6] = __('Action');
|
||||
$table->head[6] = __('Action') .
|
||||
html_print_checkbox('all_delete', 0, false, true, false, 'check_all_checkboxes();');
|
||||
$table->size = array ();
|
||||
$table->size[6] = '50px';
|
||||
$table->size[6] = '60px';
|
||||
$table->align[6] = 'center';
|
||||
$table->data = array ();
|
||||
|
||||
|
@ -350,13 +377,20 @@ foreach ($components as $component) {
|
|||
$data[6] .= ' <a href="' . $url . '&delete_component=1&id=' . $component['id_nc'] . '&search_id_group=' . $search_id_group .
|
||||
'search_string=' . $search_string .
|
||||
'" onclick="if (! confirm (\''.__('Are you sure?').'\')) return false" >' .
|
||||
html_print_image('images/cross.png', true, array('alt' => __('Delete'), 'title' => __('Delete'))) . '</a>';
|
||||
html_print_image('images/cross.png', true, array('alt' => __('Delete'), 'title' => __('Delete'))) . '</a>' .
|
||||
html_print_checkbox_extended ('delete_multiple[]', $component['id_nc'], false, false, '', 'class="check_delete"', true);
|
||||
|
||||
array_push ($table->data, $data);
|
||||
}
|
||||
|
||||
if(isset($data)) {
|
||||
echo "<form method='post' action='index.php?sec=gmodules&sec2=godmode/modules/manage_network_components&search_id_group=0search_string='>";
|
||||
html_print_input_hidden('multiple_delete', 1);
|
||||
html_print_table ($table);
|
||||
echo "<div style='padding-bottom: 20px; text-align: right; width:" . $table->width . "'>";
|
||||
html_print_submit_button(__('Delete'), 'delete_btn', false, 'class="sub delete"');
|
||||
echo "</div>";
|
||||
echo "</form>";
|
||||
}
|
||||
else {
|
||||
echo "<div class='nf'>".__('There are no defined network components')."</div>";
|
||||
|
@ -374,3 +408,13 @@ html_print_submit_button (__('Create'), 'crt', false, 'class="sub next" style="m
|
|||
echo '</div>';
|
||||
echo '</form>'
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
function check_all_checkboxes() {
|
||||
if ($("input[name=all_delete]").attr('checked')) {
|
||||
$(".check_delete").attr('checked', true);
|
||||
}
|
||||
else {
|
||||
$(".check_delete").attr('checked', false);
|
||||
}
|
||||
}
|
||||
</script>
|
|
@ -34,6 +34,7 @@ require_once ('include/functions_network_profiles.php');
|
|||
|
||||
$delete_profile = (bool) get_parameter ('delete_profile');
|
||||
$export_profile = (bool) get_parameter ('export_profile');
|
||||
$multiple_delete = (bool)get_parameter('multiple_delete', 0);
|
||||
|
||||
if ($delete_profile) { // if delete
|
||||
$id = (int) get_parameter ('delete_profile');
|
||||
|
@ -44,6 +45,29 @@ if ($delete_profile) { // if delete
|
|||
__('Error deleting template'));
|
||||
}
|
||||
|
||||
if ($multiple_delete) {
|
||||
$ids = (array)get_parameter('delete_multiple', array());
|
||||
|
||||
db_process_sql_begin();
|
||||
|
||||
foreach ($ids as $id) {
|
||||
$result = network_profiles_delete_network_profile ($id);
|
||||
|
||||
if ($result === false) {
|
||||
db_process_sql_rollback();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ($result !== false) {
|
||||
db_process_sql_commit();
|
||||
}
|
||||
|
||||
ui_print_result_message ($result,
|
||||
__('Successfully multiple deleted'),
|
||||
__('Not deleted. Error deleting multiple data'));
|
||||
}
|
||||
|
||||
if ($export_profile) {
|
||||
$id = (int) get_parameter("export_profile");
|
||||
$profile_info = network_profiles_get_network_profile ($id);
|
||||
|
@ -146,10 +170,11 @@ $table->class = "databox";
|
|||
$table->head = array ();
|
||||
$table->head[0] = __('Name');
|
||||
$table->head[1] = __('Description');
|
||||
$table->head[2] = __('Action');
|
||||
$table->head[2] = __('Action') .
|
||||
html_print_checkbox('all_delete', 0, false, true, false, 'check_all_checkboxes();');
|
||||
$table->size = array ();
|
||||
$table->size[1] = '65%';
|
||||
$table->size[2] = '10%';
|
||||
$table->size[2] = '15%';
|
||||
|
||||
$table->align = array ();
|
||||
$table->align[2] = "center";
|
||||
|
@ -169,15 +194,20 @@ foreach ($result as $row) {
|
|||
'&delete_profile=1&delete_profile=' . $row['id_np'] . '" ' .
|
||||
'onclick="if (!confirm(\''.__('Are you sure?').'\')) return false;">' . html_print_image("images/cross.png", true) . '</a>';
|
||||
$data[2] .= ' <a href="index.php?sec=gmodules&sec2=godmode/modules/manage_network_templates' .
|
||||
'&export_profile=' . $row['id_np'] . '">' . html_print_image("images/lightning_go.png", true) . '</a>';
|
||||
'&export_profile=' . $row['id_np'] . '">' . html_print_image("images/lightning_go.png", true) . '</a>' .
|
||||
html_print_checkbox_extended ('delete_multiple[]', $row['id_np'], false, false, '', 'class="check_delete"', true);
|
||||
|
||||
array_push ($table->data, $data);
|
||||
}
|
||||
|
||||
if (!empty ($table->data)) {
|
||||
echo '<form method="post" action="index.php?sec=gmodules&sec2=godmode/modules/manage_network_templates">';
|
||||
html_print_input_hidden('multiple_delete', 1);
|
||||
html_print_table ($table);
|
||||
echo '</form>';
|
||||
echo "<div style='padding-bottom: 20px; text-align: right; width:" . $table->width . "'>";
|
||||
html_print_submit_button(__('Delete'), 'delete_btn', false, 'class="sub delete"');
|
||||
echo "</div>";
|
||||
echo "</form>";
|
||||
} else {
|
||||
echo '<div class="nf" style="width:'.$table->width.'">'.__('There are no defined network profiles').'</div>';
|
||||
}
|
||||
|
@ -188,3 +218,13 @@ html_print_submit_button (__('Create'), "crt", '', 'class="sub next"');
|
|||
echo '</div></form>';
|
||||
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
function check_all_checkboxes() {
|
||||
if ($("input[name=all_delete]").attr('checked')) {
|
||||
$(".check_delete").attr('checked', true);
|
||||
}
|
||||
else {
|
||||
$(".check_delete").attr('checked', false);
|
||||
}
|
||||
}
|
||||
</script>
|
|
@ -0,0 +1,128 @@
|
|||
Pandora FMS XML Stress
|
||||
======================
|
||||
|
||||
This is a small script that generates XML data files like the ones sent by
|
||||
Pandora FMS agents.
|
||||
|
||||
The scripts reads agent names from a text file and generates XML data files for
|
||||
each agent according to a configuration file, where modules are defined as
|
||||
templates.
|
||||
|
||||
Modules are filled with random data. An initial value and the probability of
|
||||
the module data changing may be specified.
|
||||
|
||||
Run the script like this:
|
||||
|
||||
./pandora_xml_stress <configuration file>
|
||||
|
||||
Sample configuration file
|
||||
=========================
|
||||
|
||||
# Maximum number of threads, by default 10.
|
||||
max_threads 10
|
||||
|
||||
# File containing a list of agent names (one per line).
|
||||
agent_file agent_names.txt
|
||||
|
||||
# Directory where XML data files will be placed, by default /tmp.
|
||||
temporal /var/spool/pandora/data_in
|
||||
|
||||
# Pandora FMS XML Stress log file, logs to stdout by default.
|
||||
log_file pandora_xml_stress.log
|
||||
|
||||
# XML version, by default 1.0.
|
||||
xml_version 1.0
|
||||
|
||||
# XML encoding, by default ISO-8859-1.
|
||||
encoding ISO-8859-1
|
||||
|
||||
# Operating system (shared by all agents), by default Linux.
|
||||
os_name Linux
|
||||
|
||||
# Operating system version (shared by all agents), by default 2.6.
|
||||
os_version 2.6
|
||||
|
||||
# Agent interval, by default 300.
|
||||
agent_interval 300
|
||||
|
||||
# Data file generation start date, by default now.
|
||||
time_from 2009-06-01 00:00:00
|
||||
|
||||
# Data file generation end date, by default now.
|
||||
time_to 2009-06-05 00:00:00
|
||||
|
||||
# Get conf from Pandora Server
|
||||
get_and_send_conf_from_server 1
|
||||
|
||||
# Delay after generating the first data file for each agent to avoid
|
||||
# race conditions when auto-creating the agent, by default 2.
|
||||
startup_delay 2
|
||||
|
||||
# Timezone offset: Difference with the server timezone
|
||||
timezone_offset 0
|
||||
|
||||
# Timezone offset range (to set a randomnuber of hours of difference with the
|
||||
# server so timezone_offset can go from timezone_offset-timezone_offset_range
|
||||
# to timezone_offset+timezone_offset_range
|
||||
timezone_offset_range 0
|
||||
|
||||
# Agent position paramters
|
||||
# Those parameters define the center and the zone where the agents will be
|
||||
# randomly located.
|
||||
# The base parameters define the central point of the sistem and the radius
|
||||
# defines how far from that point the agents will be placed in any direction
|
||||
|
||||
# Base latitude reference for all agents
|
||||
latitude_base 40.42056
|
||||
# Base longitude reference for all agents
|
||||
longitude_base -3.708187
|
||||
# Base altitude reference for all agents
|
||||
altitude_base 0
|
||||
# This amount divided by 100 defines how far from each reference coordinate
|
||||
# the agents will go
|
||||
position_radius 10
|
||||
|
||||
# Address of the Tentacle server where XML files will be sent (optional).
|
||||
# server_ip 192.168.50.1
|
||||
|
||||
# Port of the Tentacle server, by default 41121.
|
||||
# server_port 41121
|
||||
|
||||
# Module definitions. Similar to pandora_agent.conf.
|
||||
|
||||
module_begin
|
||||
module_name Module 1
|
||||
module_type generic_data
|
||||
module_description A long description.
|
||||
module_max 100
|
||||
module_min 10
|
||||
module_exec type=RANDOM;variation=60;min=20;max=80
|
||||
module_end
|
||||
|
||||
module_begin
|
||||
module_name Module 2
|
||||
module_type generic_data
|
||||
module_description A long description.
|
||||
module_max 80
|
||||
module_min 20
|
||||
module_exec type=SCATTER;prob=1;avg=40;min=0;max=80
|
||||
module_end
|
||||
|
||||
|
||||
module_begin
|
||||
module_name Module 3
|
||||
module_type generic_data
|
||||
module_description A long description.
|
||||
module_max 80
|
||||
module_min 20
|
||||
module_exec type=CURVE;min=20;max=80;time_wave_length=3600;time_offset=0
|
||||
module_end
|
||||
|
||||
module_begin
|
||||
module_name Module 4
|
||||
module_type generic_data_string
|
||||
module_description A long description.
|
||||
module_max 100
|
||||
module_min 10
|
||||
module_exec type=RANDOM;variation=60;min=20;max=80
|
||||
module_end
|
Loading…
Reference in New Issue