2009-03-18 Esteban Sanchez <estebans@artica.es>
* godmode/agentes/massive_edit_modules.php: Added to repository. New interface to update modules massively. Should be improved lately. * reporting/pchart_graph.php: Fixed mess with color pallete. * godmode/agentes/massive_operations.php: Fixed sec parameter on links. Changed label. Added link to the new modules editor. * godmode/agentes/module_manager.php: Fixed an error when showing module group titles. * godmode/agentes/module_manager_editor.php: Decode values from components. * godmode/agentes/module_manager_editor_wmi.php: Bigger WMI query input text. * include/functions_db.php: Fixed a bug when using group on format_array_to_where_clause_sql(). * include/functions_modules.php: Fixed an error on get_network_components() which was not filtering fine. Many fixes in get_network_component_groups() so it works better now. Added update_agent_module(). git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1550 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
89f6e57e68
commit
e38b33958d
|
@ -1,3 +1,30 @@
|
||||||
|
2009-03-18 Esteban Sanchez <estebans@artica.es>
|
||||||
|
|
||||||
|
* godmode/agentes/massive_edit_modules.php: Added to repository. New
|
||||||
|
interface to update modules massively. Should be improved lately.
|
||||||
|
|
||||||
|
* reporting/pchart_graph.php: Fixed mess with color pallete.
|
||||||
|
|
||||||
|
* godmode/agentes/massive_operations.php: Fixed sec parameter on
|
||||||
|
links. Changed label. Added link to the new modules editor.
|
||||||
|
|
||||||
|
* godmode/agentes/module_manager.php: Fixed an error when showing
|
||||||
|
module group titles.
|
||||||
|
|
||||||
|
* godmode/agentes/module_manager_editor.php: Decode values from
|
||||||
|
components.
|
||||||
|
|
||||||
|
* godmode/agentes/module_manager_editor_wmi.php: Bigger WMI query
|
||||||
|
input text.
|
||||||
|
|
||||||
|
* include/functions_db.php: Fixed a bug when using group on
|
||||||
|
format_array_to_where_clause_sql().
|
||||||
|
|
||||||
|
* include/functions_modules.php: Fixed an error on
|
||||||
|
get_network_components() which was not filtering fine. Many fixes in
|
||||||
|
get_network_component_groups() so it works better now. Added
|
||||||
|
update_agent_module().
|
||||||
|
|
||||||
2009-03-18 Esteban Sanchez <estebans@artica.es>
|
2009-03-18 Esteban Sanchez <estebans@artica.es>
|
||||||
|
|
||||||
* godmode/alerts/alert_list.php: Put tooltip before the template name
|
* godmode/alerts/alert_list.php: Put tooltip before the template name
|
||||||
|
|
|
@ -0,0 +1,172 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
// Pandora FMS - the Flexible Monitoring System
|
||||||
|
// ============================================
|
||||||
|
// Copyright (c) 2008 Artica Soluciones Tecnologicas, http://www.artica.es
|
||||||
|
// Please see http://pandora.sourceforge.net for full contribution list
|
||||||
|
|
||||||
|
// 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 for version 2.
|
||||||
|
// This program is distributepd 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.
|
||||||
|
// You should have received a copy of the GNU General Public License
|
||||||
|
// along with this program; if not, write to the Free Software
|
||||||
|
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
|
||||||
|
// Load global vars
|
||||||
|
check_login ();
|
||||||
|
|
||||||
|
if (! give_acl ($config['id_user'], 0, "LM")) {
|
||||||
|
audit_db ($config['id_user'], $REMOTE_ADDR, "ACL Violation",
|
||||||
|
"Trying to access Agent Config Management Admin section");
|
||||||
|
require ("general/noaccess.php");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
require_once ('include/functions_modules.php');
|
||||||
|
|
||||||
|
echo '<h3>'.__('Massive alerts deletion').'</h3>';
|
||||||
|
|
||||||
|
function process_manage_edit ($module_name) {
|
||||||
|
if (is_int ($module_name) && $module_name <= 0) {
|
||||||
|
echo '<h3 class="error">'.__('No modules selected').'</h3>';
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$agents = array_keys (get_group_agents (array_keys (get_user_groups ()), false, "none"));
|
||||||
|
|
||||||
|
/* List of fields which can be updated */
|
||||||
|
$fields = array ('min_warning', 'max_warning', 'min_critical', 'max_critical', 'ff_event');
|
||||||
|
$values = array ();
|
||||||
|
foreach ($fields as $field) {
|
||||||
|
$value = get_parameter ($field);
|
||||||
|
if ($value != '')
|
||||||
|
$values[$field] = $value;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$modules = get_db_all_rows_filter ('tagente_modulo',
|
||||||
|
array ('id_agente' => $agents,
|
||||||
|
'nombre' => $module_name),
|
||||||
|
array ('id_agente_modulo'));
|
||||||
|
|
||||||
|
process_sql ('SET AUTOCOMMIT = 0');
|
||||||
|
process_sql ('START TRANSACTION');
|
||||||
|
if ($modules === false)
|
||||||
|
return false;
|
||||||
|
foreach ($modules as $module) {
|
||||||
|
update_agent_module ($module['id_agente_modulo'], $values);
|
||||||
|
}
|
||||||
|
|
||||||
|
echo '<h3 class="suc">'.__('Successfully updated').'</h3>';
|
||||||
|
process_sql ('COMMIT');
|
||||||
|
process_sql ('SET AUTOCOMMIT = 1');
|
||||||
|
}
|
||||||
|
|
||||||
|
$module_name = (string) get_parameter ('module_name');
|
||||||
|
|
||||||
|
$update = (bool) get_parameter_post ('update');
|
||||||
|
|
||||||
|
if ($update) {
|
||||||
|
process_manage_edit ($module_name);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$table->id = 'delete_table';
|
||||||
|
$table->width = '95%';
|
||||||
|
$table->data = array ();
|
||||||
|
$table->style = array ();
|
||||||
|
$table->style[0] = 'font-weight: bold; vertical-align:top';
|
||||||
|
$table->style[2] = 'font-weight: bold';
|
||||||
|
$table->rowstyle = array ();
|
||||||
|
$table->rowstyle['edit1'] = 'display: none';
|
||||||
|
$table->rowstyle['edit2'] = 'display: none';
|
||||||
|
$table->size = array ();
|
||||||
|
$table->size[0] = '15%';
|
||||||
|
$table->size[1] = '85%'; /* Fixed using javascript */
|
||||||
|
$table->size[2] = '15%';
|
||||||
|
$table->size[3] = '35%';
|
||||||
|
$table->colspan = array ();
|
||||||
|
$table->colspan[0][1] = '3';
|
||||||
|
|
||||||
|
$agents = get_group_agents (array_keys (get_user_groups ()), false, "none");
|
||||||
|
$all_modules = get_db_all_rows_filter ('tagente_modulo',
|
||||||
|
array ('id_agente' => array_keys ($agents),
|
||||||
|
'group' => 'nombre',
|
||||||
|
'order' => 'id_tipo_modulo,nombre'),
|
||||||
|
array ('DISTINCT(nombre)', 'id_tipo_modulo'));
|
||||||
|
|
||||||
|
if ($all_modules === false)
|
||||||
|
$all_modules = array ();
|
||||||
|
|
||||||
|
$modules = array ();
|
||||||
|
$latest_type = -1;
|
||||||
|
$i = -1;
|
||||||
|
$prefix = str_repeat (' ', 3);
|
||||||
|
foreach ($all_modules as $module) {
|
||||||
|
if ($latest_type != $module['id_tipo_modulo']) {
|
||||||
|
$modules[$i--] = get_moduletype_description ($module['id_tipo_modulo']);
|
||||||
|
$latest_type = $module['id_tipo_modulo'];
|
||||||
|
}
|
||||||
|
$modules[$module['nombre']] = $prefix.$module['nombre'];
|
||||||
|
}
|
||||||
|
|
||||||
|
$table->data = array ();
|
||||||
|
$table->data[0][0] = __('Module');
|
||||||
|
$table->data[0][0] .= '<span id="agent_loading" class="invisible">';
|
||||||
|
$table->data[0][0] .= '<img src="images/spinner.gif" />';
|
||||||
|
$table->data[0][0] .= '</span>';
|
||||||
|
$table->data[0][1] = print_select ($modules,
|
||||||
|
'module_name', 0, false, __('Select'), 0, true, false, false);
|
||||||
|
|
||||||
|
$table->data['edit1'][0] = __('Warning status');
|
||||||
|
$table->data['edit1'][1] = '<em>'.__('Min.').'</em>';
|
||||||
|
$table->data['edit1'][1] .= print_input_text ('min_warning', '', '', 5, 15, true);
|
||||||
|
$table->data['edit1'][1] .= '<br /><em>'.__('Max.').'</em>';
|
||||||
|
$table->data['edit1'][1] .= print_input_text ('max_warning', '', '', 5, 15, true);
|
||||||
|
$table->data['edit1'][2] = __('Critical status');
|
||||||
|
$table->data['edit1'][3] = '<em>'.__('Min.').'</em>';
|
||||||
|
$table->data['edit1'][3] .= print_input_text ('min_critical', '', '', 5, 15, true);
|
||||||
|
$table->data['edit1'][3] .= '<br /><em>'.__('Max.').'</em>';
|
||||||
|
$table->data['edit1'][3] .= print_input_text ('max_critical', '', '', 5, 15, true);
|
||||||
|
|
||||||
|
/* FF stands for Flip-flop */
|
||||||
|
$table->data['edit2'][0] = __('FF threshold').' '.pandora_help ('ff_threshold', true);
|
||||||
|
$table->data['edit2'][1] = print_input_text ('ff_event', '', '', 5, 15, true);
|
||||||
|
$table->data['edit2'][2] = __('Historical data');
|
||||||
|
$table->data['edit2'][3] = print_checkbox ("history_data", 1, '', true);
|
||||||
|
|
||||||
|
echo '<form method="post" id="form_edit" onsubmit="if (! confirm(\''.__('Are you sure').'\')) return false;">';
|
||||||
|
print_table ($table);
|
||||||
|
|
||||||
|
echo '<div class="action-buttons" style="width: '.$table->width.'" onsubmit="if (!confirm(\' '.__('Are you sure?').'\')) return false;">';
|
||||||
|
print_input_hidden ('update', 1);
|
||||||
|
print_submit_button (__('Update'), 'go', false, 'class="sub upd"');
|
||||||
|
echo '</div>';
|
||||||
|
echo '</form>';
|
||||||
|
|
||||||
|
echo '<h3 class="error invisible" id="message"> </h3>';
|
||||||
|
|
||||||
|
require_jquery_file ('pandora.controls');
|
||||||
|
?>
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
/* <![CDATA[ */
|
||||||
|
$(document).ready (function () {
|
||||||
|
$("#module_name").change (function () {
|
||||||
|
if (this.value <= 0) {
|
||||||
|
$("td#delete_table-0-1").css ("width", "85%");
|
||||||
|
$("tr#delete_table-edit1, tr#delete_table-edit2").hide ();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
$("td#delete_table-0-1, td#delete_table-edit1-1, td#delete_table-edit2-1").css ("width", "35%");
|
||||||
|
$("#form_edit input[type=text]").attr ("value", "");
|
||||||
|
$("#form_edit input[type=checkbox]").removeAttr ("checked");
|
||||||
|
$("tr#delete_table-edit1, tr#delete_table-edit2").show ();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
/* ]]> */
|
||||||
|
</script>
|
|
@ -39,9 +39,15 @@ echo '<div id="menu_tab">';
|
||||||
echo '<ul class="mn">';
|
echo '<ul class="mn">';
|
||||||
|
|
||||||
echo '<li class="'.($tab == 'copy_modules' ? 'nomn_high' : 'nomn').'">';
|
echo '<li class="'.($tab == 'copy_modules' ? 'nomn_high' : 'nomn').'">';
|
||||||
echo '<a href="index.php?sec=estado&sec2=godmode/agentes/massive_operations&tab=copy_modules">';
|
echo '<a href="index.php?sec=gagente&sec2=godmode/agentes/massive_operations&tab=copy_modules">';
|
||||||
print_image ("images/copy.png", false, $img_style);
|
print_image ("images/copy.png", false, $img_style);
|
||||||
echo ' '.__('Copy modules').'</a>';
|
echo ' '.__('Copy').'</a>';
|
||||||
|
echo '</li>';
|
||||||
|
|
||||||
|
echo '<li class="'.($tab == 'edit_modules' || $tab == '' ? 'nomn_high' : 'nomn').'">';
|
||||||
|
echo '<a href="index.php?sec=gagente&sec2=godmode/agentes/massive_operations&tab=edit_modules">';
|
||||||
|
print_image ("images/book_edit.png", false, $img_style);
|
||||||
|
echo ' '.__('Edit modules').'</a>';
|
||||||
echo '</li>';
|
echo '</li>';
|
||||||
|
|
||||||
echo '<li class="'.($tab == 'delete_agents' || $tab == '' ? 'nomn_high' : 'nomn').'">';
|
echo '<li class="'.($tab == 'delete_agents' || $tab == '' ? 'nomn_high' : 'nomn').'">';
|
||||||
|
@ -77,6 +83,9 @@ case 'delete_agents':
|
||||||
case 'delete_modules':
|
case 'delete_modules':
|
||||||
require_once ('godmode/agentes/massive_delete_modules.php');
|
require_once ('godmode/agentes/massive_delete_modules.php');
|
||||||
break;
|
break;
|
||||||
|
case 'edit_modules':
|
||||||
|
require_once ('godmode/agentes/massive_edit_modules.php');
|
||||||
|
break;
|
||||||
case 'copy_modules':
|
case 'copy_modules':
|
||||||
default:
|
default:
|
||||||
require_once ('godmode/agentes/massive_config.php');
|
require_once ('godmode/agentes/massive_config.php');
|
||||||
|
|
|
@ -122,8 +122,8 @@ foreach ($modules as $module) {
|
||||||
|
|
||||||
$data[0] = '<strong>'.get_modulegroup_name ($last_modulegroup).'</strong>';
|
$data[0] = '<strong>'.get_modulegroup_name ($last_modulegroup).'</strong>';
|
||||||
$i = array_push ($table->data, $data);
|
$i = array_push ($table->data, $data);
|
||||||
$table->rowclass[$i] = 'datos3';
|
$table->rowclass[$i - 1] = 'datos3';
|
||||||
$table->colspan[$i][0] = 6;
|
$table->colspan[$i - 1][0] = 7;
|
||||||
|
|
||||||
$data = array ();
|
$data = array ();
|
||||||
}
|
}
|
||||||
|
|
|
@ -294,23 +294,19 @@ $(document).ready (function () {
|
||||||
"id_module_component" : this.value
|
"id_module_component" : this.value
|
||||||
},
|
},
|
||||||
function (data, status) {
|
function (data, status) {
|
||||||
$("#text-name").attr ("value", data["name"]);
|
$("#text-name").attr ("value", html_entity_decode (data["name"]));
|
||||||
$("#textarea_description").attr ("value", data["description"]);
|
$("#textarea_description").attr ("value", html_entity_decode (data["description"]));
|
||||||
$("#id_module_type option[value="+data["type"]+"]").select (1);
|
$("#id_module_type option[value="+data["type"]+"]").select (1);
|
||||||
$("#text-max").attr ("value", data["max"]);
|
$("#text-max").attr ("value", data["max"]);
|
||||||
$("#text-min").attr ("value", data["min"]);
|
$("#text-min").attr ("value", data["min"]);
|
||||||
$("#text-module_interval").attr ("value", data["module_interval"]);
|
$("#text-module_interval").attr ("value", data["module_interval"]);
|
||||||
$("#text-tcp_port").attr ("value", data["tcp_port"]);
|
$("#text-tcp_port").attr ("value", data["tcp_port"]);
|
||||||
$("#textarea_tcp_send").attr ("value", data["tcp_send"]);
|
$("#textarea_tcp_send").attr ("value", html_entity_decode (data["tcp_send"]));
|
||||||
$("#textarea_tcp_rcv").attr ("value", data["tcp_rcv"]);
|
$("#textarea_tcp_rcv").attr ("value", html_entity_decode (data["tcp_rcv"]));
|
||||||
$("#text-snmp_community").attr ("value", data["snmp_community"]);
|
$("#text-snmp_community").attr ("value", html_entity_decode (data["snmp_community"]));
|
||||||
$("#text-snmp_oid").attr ("value", data["snmp_oid"]).show ();
|
$("#text-snmp_oid").attr ("value", html_entity_decode (data["snmp_oid"])).show ();
|
||||||
$("#oid, img#edit_oid").hide ();
|
$("#oid, img#edit_oid").hide ();
|
||||||
$("#id_module_group option["+data["id_group"]+"]").select (1);
|
$("#id_module_group option["+data["id_group"]+"]").select (1);
|
||||||
//$("#id_module_group").attr ("value", data["id_module_group"]);
|
|
||||||
//$("#text_plugin_user").attr ("value", data["plugin_user"]);
|
|
||||||
//$("#text_plugin_pass").attr ("value", data["plugin_pass"]);
|
|
||||||
//$("#text_plugin_parameter").attr ("value", data["plugin_parameter"]);
|
|
||||||
$("#max_timeout").attr ("value", data["max_timeout"]);
|
$("#max_timeout").attr ("value", data["max_timeout"]);
|
||||||
if (data["history_data"])
|
if (data["history_data"])
|
||||||
$("#checkbox-history_data").check ();
|
$("#checkbox-history_data").check ();
|
||||||
|
|
|
@ -52,7 +52,7 @@ push_table_simple ($data, 'user_pass');
|
||||||
$data = array ();
|
$data = array ();
|
||||||
$data[0] = __('WMI Query');
|
$data[0] = __('WMI Query');
|
||||||
$data[0] .= pandora_help ('wmiquery', true);
|
$data[0] .= pandora_help ('wmiquery', true);
|
||||||
$data[1] = print_input_text ('snmp_oid', $snmp_oid, '', 35, 60, true);
|
$data[1] = print_input_text ('snmp_oid', $snmp_oid, '', 35, 255, true);
|
||||||
$table_simple->colspan['wmi_query'][1] = 3;
|
$table_simple->colspan['wmi_query'][1] = 3;
|
||||||
|
|
||||||
push_table_simple ($data, 'wmi_query');
|
push_table_simple ($data, 'wmi_query');
|
||||||
|
|
|
@ -1977,7 +1977,7 @@ function format_array_to_where_clause_sql ($values, $join = 'AND', $prefix = fal
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset ($values['group'])) {
|
if (isset ($values['group'])) {
|
||||||
$group = sprintf (' GROUP BY %s', $values['order']);
|
$group = sprintf (' GROUP BY %s', $values['group']);
|
||||||
unset ($values['group']);
|
unset ($values['group']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -92,7 +92,10 @@ $components = get_network_components ($id_module, 'id_module_group = 10'));
|
||||||
function get_network_components ($id_module, $filter = false, $fields = false) {
|
function get_network_components ($id_module, $filter = false, $fields = false) {
|
||||||
if (empty ($id_module))
|
if (empty ($id_module))
|
||||||
return array ();
|
return array ();
|
||||||
|
if (!is_array ($filter))
|
||||||
|
$filter = array ();
|
||||||
|
|
||||||
|
$filter['id_modulo'] = $id_module;
|
||||||
$components = get_db_all_rows_filter ('tnetwork_component',
|
$components = get_db_all_rows_filter ('tnetwork_component',
|
||||||
$filter, $fields);
|
$filter, $fields);
|
||||||
if ($components === false)
|
if ($components === false)
|
||||||
|
@ -117,8 +120,9 @@ function get_network_component_groups ($id_module_components = 0) {
|
||||||
static $level = 0;
|
static $level = 0;
|
||||||
static $id_parent = 0;
|
static $id_parent = 0;
|
||||||
|
|
||||||
$groups = get_db_all_rows_field_filter ('tnetwork_component_group',
|
$groups = get_db_all_rows_filter ('tnetwork_component_group',
|
||||||
'parent', $id_parent);
|
array ('parent' => $id_parent),
|
||||||
|
array ('id_sg', 'name'));
|
||||||
if ($groups === false)
|
if ($groups === false)
|
||||||
return array ();
|
return array ();
|
||||||
|
|
||||||
|
@ -128,7 +132,7 @@ function get_network_component_groups ($id_module_components = 0) {
|
||||||
foreach ($groups as $group) {
|
foreach ($groups as $group) {
|
||||||
$level++;
|
$level++;
|
||||||
$tmp = $id_parent;
|
$tmp = $id_parent;
|
||||||
$id_parent = $group['id_sg'];
|
$id_parent = (int) $group['id_sg'];
|
||||||
$childs = get_network_component_groups ($id_module_components);
|
$childs = get_network_component_groups ($id_module_components);
|
||||||
$id_parent = $tmp;
|
$id_parent = $tmp;
|
||||||
$level--;
|
$level--;
|
||||||
|
@ -140,12 +144,9 @@ function get_network_component_groups ($id_module_components = 0) {
|
||||||
/* If components id module is provided, only groups with components
|
/* If components id module is provided, only groups with components
|
||||||
that belongs to this id module are returned */
|
that belongs to this id module are returned */
|
||||||
if ($id_module_components) {
|
if ($id_module_components) {
|
||||||
$sql = sprintf ('SELECT COUNT(*)
|
$count = get_db_value_filter ('COUNT(*)', 'tnetwork_component',
|
||||||
FROM tnetwork_component
|
array ('id_group' => (int) $group['id_sg'],
|
||||||
WHERE id_module_group = %d
|
'id_modulo' => $id_module_components));
|
||||||
AND id_modulo = %d',
|
|
||||||
$group['id_sg'], $id_module_components);
|
|
||||||
$count = get_db_sql ($sql);
|
|
||||||
if ($count > 0)
|
if ($count > 0)
|
||||||
$retval[$group['id_sg']] = $prefix.$group['name'];
|
$retval[$group['id_sg']] = $prefix.$group['name'];
|
||||||
}
|
}
|
||||||
|
@ -162,14 +163,14 @@ function get_network_component_groups ($id_module_components = 0) {
|
||||||
*
|
*
|
||||||
* @return True if the module was deleted. False if not.
|
* @return True if the module was deleted. False if not.
|
||||||
*/
|
*/
|
||||||
function delete_agent_module ($id_agent_module) {
|
function delete_agent_module ($id) {
|
||||||
$where = array ('id_agent_module' => $id_agent_module);
|
$where = array ('id_agent_module' => $id);
|
||||||
|
|
||||||
process_sql_delete ('talert_template_modules', $where);
|
process_sql_delete ('talert_template_modules', $where);
|
||||||
process_sql_delete ('tgraph_source', $where);
|
process_sql_delete ('tgraph_source', $where);
|
||||||
process_sql_delete ('treport_content', $where);
|
process_sql_delete ('treport_content', $where);
|
||||||
process_sql_delete ('tevento', array ('id_agentmodule' => $id_agent_module));
|
process_sql_delete ('tevento', array ('id_agentmodule' => $id));
|
||||||
$where = array ('id_agente_modulo' => $id_agent_module);
|
$where = array ('id_agente_modulo' => $id);
|
||||||
process_sql_delete ('tlayout_data', $where);
|
process_sql_delete ('tlayout_data', $where);
|
||||||
process_sql_delete ('tagente_estado', $where);
|
process_sql_delete ('tagente_estado', $where);
|
||||||
process_sql_update ('tagente_modulo',
|
process_sql_update ('tagente_modulo',
|
||||||
|
@ -178,4 +179,20 @@ function delete_agent_module ($id_agent_module) {
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Updates a module from an agent.
|
||||||
|
*
|
||||||
|
* @param mixed Agent module id to be deleted. Accepts an array with ids.
|
||||||
|
* @param array Values to update.
|
||||||
|
*
|
||||||
|
* @return True if the module was updated. False if not.
|
||||||
|
*/
|
||||||
|
function update_agent_module ($id, $values) {
|
||||||
|
if (! is_array ($values))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return (bool) process_sql_update ('tagente_modulo', $values,
|
||||||
|
array ('id_agente_modulo' => $id));
|
||||||
|
}
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -400,7 +400,7 @@ CREATE TABLE IF NOT EXISTS `tevento` (
|
||||||
CREATE TABLE IF NOT EXISTS `tgrupo` (
|
CREATE TABLE IF NOT EXISTS `tgrupo` (
|
||||||
`id_grupo` mediumint(4) unsigned NOT NULL auto_increment,
|
`id_grupo` mediumint(4) unsigned NOT NULL auto_increment,
|
||||||
`nombre` varchar(100) NOT NULL default '',
|
`nombre` varchar(100) NOT NULL default '',
|
||||||
`icon` varchar(50) default NULL,
|
`icon` varchar(50) default NULL default 'world',
|
||||||
`parent` mediumint(4) unsigned NOT NULL default '0',
|
`parent` mediumint(4) unsigned NOT NULL default '0',
|
||||||
`disabled` tinyint(3) unsigned NOT NULL default '0',
|
`disabled` tinyint(3) unsigned NOT NULL default '0',
|
||||||
`custom_id` varchar(255) default '',
|
`custom_id` varchar(255) default '',
|
||||||
|
|
|
@ -163,6 +163,8 @@ class PchartGraph extends PandoraGraphAbstract {
|
||||||
foreach ($this->data as $data) {
|
foreach ($this->data as $data) {
|
||||||
$this->dataset->AddPoint ($data['sum'], "AVG", $data['timestamp_bottom']);
|
$this->dataset->AddPoint ($data['sum'], "AVG", $data['timestamp_bottom']);
|
||||||
}
|
}
|
||||||
|
$color = $this->get_rgb_values ($this->graph_color[2]);
|
||||||
|
$this->graph->setColorPalette (0, $color['r'], $color['g'], $color['b']);
|
||||||
} else {
|
} else {
|
||||||
foreach ($this->data as $data) {
|
foreach ($this->data as $data) {
|
||||||
$this->dataset->AddPoint ($data['sum'], "AVG", $data['timestamp_bottom']);
|
$this->dataset->AddPoint ($data['sum'], "AVG", $data['timestamp_bottom']);
|
||||||
|
@ -170,11 +172,13 @@ class PchartGraph extends PandoraGraphAbstract {
|
||||||
$this->dataset->AddPoint ($data['max'], "MAX");
|
$this->dataset->AddPoint ($data['max'], "MAX");
|
||||||
}
|
}
|
||||||
$this->legend[1] = __("Min. Value");
|
$this->legend[1] = __("Min. Value");
|
||||||
|
$this->legend[0] = __("Avg. Value");
|
||||||
$this->legend[2] = __("Max. Value");
|
$this->legend[2] = __("Max. Value");
|
||||||
$this->dataset->SetSerieName (__("Min. Value"), "MIN");
|
$this->dataset->SetSerieName (__("Min. Value"), "MIN");
|
||||||
|
$this->dataset->SetSerieName (__("Avg. Value"), "AVG");
|
||||||
$this->dataset->SetSerieName (__("Max. Value"), "MAX");
|
$this->dataset->SetSerieName (__("Max. Value"), "MAX");
|
||||||
|
$this->set_colors ();
|
||||||
}
|
}
|
||||||
$this->set_colors ();
|
|
||||||
$this->dataset->SetXAxisFormat ('date');
|
$this->dataset->SetXAxisFormat ('date');
|
||||||
$this->graph->setDateFormat ("Y");
|
$this->graph->setDateFormat ("Y");
|
||||||
$this->dataset->SetYAxisFormat ('metric');
|
$this->dataset->SetYAxisFormat ('metric');
|
||||||
|
@ -314,6 +318,7 @@ class PchartGraph extends PandoraGraphAbstract {
|
||||||
$ratio = (int) $value / 100 * $this->width;
|
$ratio = (int) $value / 100 * $this->width;
|
||||||
|
|
||||||
/* Color stuff */
|
/* Color stuff */
|
||||||
|
$bgcolor = $this->get_rgb_values ($this->background_color);
|
||||||
$r = hexdec (substr ($this->background_color, 1, 2));
|
$r = hexdec (substr ($this->background_color, 1, 2));
|
||||||
$g = hexdec (substr ($this->background_color, 3, 2));
|
$g = hexdec (substr ($this->background_color, 3, 2));
|
||||||
$b = hexdec (substr ($this->background_color, 5, 2));
|
$b = hexdec (substr ($this->background_color, 5, 2));
|
||||||
|
@ -322,13 +327,11 @@ class PchartGraph extends PandoraGraphAbstract {
|
||||||
$this->graph->drawFilledRectangle (0, 0, $this->width,
|
$this->graph->drawFilledRectangle (0, 0, $this->width,
|
||||||
$this->height, 255, 255, 255, false, 0);
|
$this->height, 255, 255, 255, false, 0);
|
||||||
$this->graph->drawFilledRoundedRectangle (0, 0, $this->width,
|
$this->graph->drawFilledRoundedRectangle (0, 0, $this->width,
|
||||||
$this->height, $radius, $r, $g, $b);
|
$this->height, $radius, $bgcolor['r'], $bgcolor['g'], $bgcolor['b']);
|
||||||
|
|
||||||
$r = hexdec (substr ($color, 1, 2));
|
$color = $this->get_rgb_values ($color);
|
||||||
$g = hexdec (substr ($color, 3, 2));
|
|
||||||
$b = hexdec (substr ($color, 5, 2));
|
|
||||||
$this->graph->drawFilledRoundedRectangle (0, 0, $ratio,
|
$this->graph->drawFilledRoundedRectangle (0, 0, $ratio,
|
||||||
$this->height, $radius, $r, $g, $b);
|
$this->height, $radius, $color['r'], $color['g'], $color['b']);
|
||||||
/* Under this value, the rounded rectangle is painted great */
|
/* Under this value, the rounded rectangle is painted great */
|
||||||
if ($ratio <= 16) {
|
if ($ratio <= 16) {
|
||||||
/* Clean a bit of pixels */
|
/* Clean a bit of pixels */
|
||||||
|
@ -481,9 +484,9 @@ class PchartGraph extends PandoraGraphAbstract {
|
||||||
if ($this->graph == NULL)
|
if ($this->graph == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
$color = $this->get_rgb_values ($this->graph_color[2]);
|
|
||||||
$this->graph->setColorPalette (0, $color['r'], $color['g'], $color['b']);
|
|
||||||
$color = $this->get_rgb_values ($this->graph_color[1]);
|
$color = $this->get_rgb_values ($this->graph_color[1]);
|
||||||
|
$this->graph->setColorPalette (0, $color['r'], $color['g'], $color['b']);
|
||||||
|
$color = $this->get_rgb_values ($this->graph_color[2]);
|
||||||
$this->graph->setColorPalette (1, $color['r'], $color['g'], $color['b']);
|
$this->graph->setColorPalette (1, $color['r'], $color['g'], $color['b']);
|
||||||
$color = $this->get_rgb_values ($this->graph_color[3]);
|
$color = $this->get_rgb_values ($this->graph_color[3]);
|
||||||
$this->graph->setColorPalette (2, $color['r'], $color['g'], $color['b']);
|
$this->graph->setColorPalette (2, $color['r'], $color['g'], $color['b']);
|
||||||
|
|
Loading…
Reference in New Issue