2009-03-17 Esteban Sanchez <estebans@artica.es>

* godmode/agentes/massive_operations.php: Added to repository. New
	page to group massive operations in a single page.

	* godmode/agentes/massive_config.php: Renamed from manage_config.php.

	* godmode/agentes/massive_delete_agents.php: Renamed from
	manage_delete.php.
	
	* godmode/agentes/massive_delete_modules.php: Added to repository.
	Interface to delete modules.

	* godmode/agentes/massive_delete_alerts.php: Added to repository.
	Interface to delete alerts.

	* godmode/agentes/agent_manager.php: Fixed table width to make it
	variable.

	* godmode/agentes/module_manager.php: Rewritten to use Pandora
	functions.

	* include/javascript/jquery.pandora.controls.js: Added
	pandoraSelectAgentAlert. Renamed pandoraSelectAgent to
	pandoraSelectAgentModule. Get only needed fields to make it quicker
	and avoid showing disabled modules.

	* godmode/alerts/alert_list.php: Adapted to changes in
	jquery.pandora.controls.js.

	* godmode/menu.php: Group some pages into new "Massive operation"
	submenu.

	* images/copy.png: Replaced with a better icon.

	* images/delete_agents.png, images/delete_alerts.php,
	images/delete_modules.php: Added to repository.

	* include/styles/pandora.css: Set color on input.sub

	* include/styles/pandora_width.css: Make menu_tab_frame wider.

	* include/functions_db.php: Removed deprecated
	dame_nombre_grupomodulo(). Added support to __() to receive multiple
	parameters so translatable strings can handle now printf format
	characters.

	* include/functions_modules.php: Added delete_agent_module().

	* operation/agentes/ver_agente.php: Allow fields to be passed to
	get_agent_modules_json AJAX operation.

	* reporting/fgraph.php: Replaced sprintf() with __(). Some casts
	added. Show a sparse chart even if it has no max/min value.

	* godmode/modules/manage_network_components_form_network.php,
	operation/agentes/estado_ultimopaquete.php,
	godmode/modules/manage_network_components_form_wmi.php: Use
	get_modulegroup_name().

	* godmode/agentes/configurar_agente.php,
	godmode/modules/manage_network_components.php: Style correction.



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1544 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
esanchezm 2009-03-17 15:15:55 +00:00
parent 6609d4d6bb
commit 9ce6d69b4a
27 changed files with 735 additions and 223 deletions

View File

@ -1,3 +1,66 @@
2009-03-17 Esteban Sanchez <estebans@artica.es>
* godmode/agentes/massive_operations.php: Added to repository. New
page to group massive operations in a single page.
* godmode/agentes/massive_config.php: Renamed from manage_config.php.
* godmode/agentes/massive_delete_agents.php: Renamed from
manage_delete.php.
* godmode/agentes/massive_delete_modules.php: Added to repository.
Interface to delete modules.
* godmode/agentes/massive_delete_alerts.php: Added to repository.
Interface to delete alerts.
* godmode/agentes/agent_manager.php: Fixed table width to make it
variable.
* godmode/agentes/module_manager.php: Rewritten to use Pandora
functions.
* include/javascript/jquery.pandora.controls.js: Added
pandoraSelectAgentAlert. Renamed pandoraSelectAgent to
pandoraSelectAgentModule. Get only needed fields to make it quicker
and avoid showing disabled modules.
* godmode/alerts/alert_list.php: Adapted to changes in
jquery.pandora.controls.js.
* godmode/menu.php: Group some pages into new "Massive operation"
submenu.
* images/copy.png: Replaced with a better icon.
* images/delete_agents.png, images/delete_alerts.php,
images/delete_modules.php: Added to repository.
* include/styles/pandora.css: Set color on input.sub
* include/styles/pandora_width.css: Make menu_tab_frame wider.
* include/functions_db.php: Removed deprecated
dame_nombre_grupomodulo(). Added support to __() to receive multiple
parameters so translatable strings can handle now printf format
characters.
* include/functions_modules.php: Added delete_agent_module().
* operation/agentes/ver_agente.php: Allow fields to be passed to
get_agent_modules_json AJAX operation.
* reporting/fgraph.php: Replaced sprintf() with __(). Some casts
added. Show a sparse chart even if it has no max/min value.
* godmode/modules/manage_network_components_form_network.php,
operation/agentes/estado_ultimopaquete.php,
godmode/modules/manage_network_components_form_wmi.php: Use
get_modulegroup_name().
* godmode/agentes/configurar_agente.php,
godmode/modules/manage_network_components.php: Style correction.
2009-03-17 Evi Vanoost <vanooste@rcbi.rochester.edu>
* operation/snmpconsole/snmp_view.php: Fixes bug #2661421

View File

@ -59,7 +59,7 @@ if (isset($_GET["disk_conf_delete"])) {
echo '<form name="conf_agent" method="post" action="index.php?sec=gagente&amp;sec2=godmode/agentes/configurar_agente">';
$table->width = 650;
$table->width = '95%';
$table->cellpadding = 4;
$table->cellspacing = 4;
$table->class = "databox_color";
@ -161,9 +161,8 @@ if (file_exists ($filename['md5'])) {
}
print_table ($table);
unset ($table);
echo '<div style="width: 650px; text-align: right;">';
echo '<div class="action-buttons" style="width: '.$table->width.'">';
if ($new_agent) {
print_submit_button (__('Create'), 'crtbutton', false, 'class="sub wand"');
print_input_hidden ('create_agent', 1);

View File

@ -187,37 +187,37 @@ if ($create_agent) {
}
// Show tabs
$img_arr = array ("class" => "top", "width" => 16);
$img_style = array ("class" => "top", "width" => 16);
echo '<div id="menu_tab_frame"><div id="menu_tab_left"><ul class="mn">';
echo '<li class="nomn"><a href="index.php?sec=gagente&amp;sec2=godmode/agentes/configurar_agente&amp;id_agente='.$id_agente.'">';
print_image ("images/setup.png", false, $img_arr);
print_image ("images/setup.png", false, $img_style);
echo '&nbsp; '.mb_substr (get_agent_name ($id_agente),0,21).'</a>';
echo "</li></ul></div>";
echo '<div id="menu_tab"><ul class="mn"><li class="nomn">';
echo '<a href="index.php?sec=estado&amp;sec2=operation/agentes/ver_agente&amp;id_agente='.$id_agente.'">';
print_image ("images/zoom.png", false, $img_arr);
print_image ("images/zoom.png", false, $img_style);
echo '&nbsp;'.__('View').'</a></li>';
echo '<li class="'.($tab == "main" ? 'nomn_high' : 'nomn').'">';
echo '<a href="index.php?sec=gagente&amp;sec2=godmode/agentes/configurar_agente&amp;tab=main&amp;id_agente='.$id_agente.'">';
print_image ("images/cog.png", false, $img_arr);
print_image ("images/cog.png", false, $img_style);
echo '&nbsp; '.__('Setup').'</a></li>';
echo '<li class="'.($tab == "module" ? 'nomn_high' : 'nomn').'">';
echo '<a href="index.php?sec=gagente&amp;sec2=godmode/agentes/configurar_agente&amp;tab=module&amp;id_agente='.$id_agente.'">';
print_image ("images/lightbulb.png", false, $img_arr);
print_image ("images/lightbulb.png", false, $img_style);
echo '&nbsp; '.__('Modules').'</a></li>';
echo '<li class="'.($tab == "alert" ? 'nomn_high' : 'nomn').'">';
echo '<a href="index.php?sec=gagente&amp;sec2=godmode/agentes/configurar_agente&amp;tab=alert&amp;id_agente='.$id_agente.'">';
print_image ("images/bell.png", false, $img_arr);
print_image ("images/bell.png", false, $img_style);
echo '&nbsp; '.__('Alerts').'</a></li>';
echo '<li class="'.($tab == "template" ? 'nomn_high' : 'nomn').'">';
echo '<a href="index.php?sec=gagente&amp;sec2=godmode/agentes/configurar_agente&amp;tab=template&amp;id_agente='.$id_agente.'">';
print_image ("images/network.png", false, $img_arr);
print_image ("images/network.png", false, $img_style);
echo '&nbsp; '.__('Net. Templates').'</a></li>';
enterprise_hook ('inventory_tab');

View File

@ -202,7 +202,8 @@ $(document).ready (function () {
{"page" : "operation/agentes/ver_agente",
"get_agent_modules_json" : 1,
"id_agent" : this.value,
"filter" : "disabled = 0"
"filter" : "disabled = 0",
"fields" : "id_agente_modulo,nombre"
},
function (data, status) {
if (data.length == 0) {

View File

@ -30,7 +30,7 @@ require_once ('include/functions_agents.php');
require_once ('include/functions_alerts.php');
require_once ('include/functions_modules.php');
echo '<h2>'.__('Massive agent deletion').'</h2>';
echo '<h3>'.__('Massive agent deletion').'</h3>';
function process_manage_delete ($id_agents) {
if (empty ($id_agents)) {
@ -116,7 +116,7 @@ require_jquery_file ('pandora.controls');
<script type="text/javascript">
$(document).ready (function () {
$("#id_group").pandoraSelectGroup ({
agentSelect: "select#id_agents\\[\\]"
agentSelect: "select#id_agents"
});
});
</script>

View File

@ -0,0 +1,137 @@
<?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_agents.php');
require_once ('include/functions_alerts.php');
echo '<h3>'.__('Massive alerts deletion').'</h3>';
function process_manage_delete ($id_alerts) {
if (empty ($id_alerts)) {
echo '<h3 class="error">'.__('No alerts selected').'</h3>';
return false;
}
process_sql ('SET AUTOCOMMIT = 0');
process_sql ('START TRANSACTION');
foreach ($id_alerts as $id_alert) {
$success = delete_alert_agent_module ($id_alert);
if (! $success)
break;
}
if (! $success) {
echo '<h3 class="error">'.__('There was an error deleting the alert, the operation has been cancelled').'</h3>';
echo '<h4>'.__('Could not delete alert').' '.get_agentmodule_name ($id_module).'</h4>';
process_sql ('ROLLBACK');
} else {
echo '<h3 class="suc">'.__('Successfully deleted').'</h3>';
process_sql ('COMMIT');
}
process_sql ('SET AUTOCOMMIT = 1');
}
$id_group = (int) get_parameter ('id_group');
$id_agent = (int) get_parameter ('id_agent');
$id_alerts = get_parameter ('id_alerts');
$delete = (bool) get_parameter_post ('delete');
if ($delete) {
process_manage_delete ($id_alerts);
}
$groups = get_user_groups ();
$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->size = array ();
$table->size[0] = '15%';
$table->size[1] = '85%';
$table->data = array ();
$table->data[0][0] = __('Group');
$table->data[0][1] = print_select ($groups, 'id_group', $id_group,
false, '', '', true);
$table->data[1][0] = __('Agent');
$table->data[1][0] .= '<span id="agent_loading" class="invisible">';
$table->data[1][0] .= '<img src="images/spinner.gif" />';
$table->data[1][0] .= '</span>';
$table->data[1][1] = print_select (get_group_agents ($id_group, false, "none"),
'id_agent', $id_agent, false, __('None'), 0, true);
$table->data[2][0] = __('Alerts');
$table->data[2][0] .= '<span id="alert_loading" class="invisible">';
$table->data[2][0] .= '<img src="images/spinner.gif" />';
$table->data[2][0] .= '</span>';
$alerts = array ();
if ($id_agent) {
$simple_alerts = get_agent_alerts_simple ($id_agent, '', false);
if ($simple_alerts !== false) {
foreach ($simple_alerts as $alert) {
$name = get_alert_template_name ($alert['id_alert_template']);
$name .= ' ('.get_agentmodule_name ($alert['id_agent_module']).')';
$alerts[$alert['id']] = $name;
}
}
}
$table->data[2][1] = print_select ($alerts,
'id_alerts[]', 0, false, '', '', true, true);
echo '<form method="post" 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 ('delete', 1);
print_submit_button (__('Delete'), 'go', false, 'class="sub delete"');
echo '</div>';
echo '</form>';
echo '<h3 class="error invisible" id="message"> </h3>';
require_jquery_file ('form');
require_jquery_file ('pandora.controls');
?>
<script type="text/javascript">
/* <![CDATA[ */
$(document).ready (function () {
$("#id_group").pandoraSelectGroup ();
$("#id_agent").pandoraSelectAgentAlert ({
alertSelect: "select#id_alerts"
});
});
/* ]]> */
</script>

View File

@ -0,0 +1,129 @@
<?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_agents.php');
require_once ('include/functions_modules.php');
echo '<h3>'.__('Massive modules deletion').'</h3>';
function process_manage_delete ($id_modules) {
if (empty ($id_modules)) {
echo '<h3 class="error">'.__('No modules selected').'</h3>';
return false;
}
process_sql ('SET AUTOCOMMIT = 0');
process_sql ('START TRANSACTION');
foreach ($id_modules as $id_module) {
$success = delete_agent_module ($id_module);
if (! $success)
break;
}
if (! $success) {
echo '<h3 class="error">'.__('There was an error deleting the module, the operation has been cancelled').'</h3>';
echo '<h4>'.__('Could not delete module').' '.get_agentmodule_name ($id_module).'</h4>';
process_sql ('ROLLBACK');
} else {
echo '<h3 class="suc">'.__('Successfully deleted').'</h3>';
process_sql ('COMMIT');
}
process_sql ('SET AUTOCOMMIT = 1');
}
$id_group = (int) get_parameter ('id_group');
$id_agent = (int) get_parameter ('id_agent');
$id_modules = get_parameter ('id_modules');
$delete = (bool) get_parameter_post ('delete');
if ($delete) {
process_manage_delete ($id_modules);
}
$groups = get_user_groups ();
$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->size = array ();
$table->size[0] = '15%';
$table->size[1] = '85%';
$table->data = array ();
$table->data[0][0] = __('Group');
$table->data[0][1] = print_select ($groups, 'id_group', $id_group,
false, '', '', true);
$table->data[1][0] = __('Agent');
$table->data[1][0] .= '<span id="agent_loading" class="invisible">';
$table->data[1][0] .= '<img src="images/spinner.gif" />';
$table->data[1][0] .= '</span>';
$table->data[1][1] = print_select (get_group_agents ($id_group, false, "none"),
'id_agent', $id_agent, false, __('None'), 0, true);
$table->data[2][0] = __('Modules');
$table->data[2][0] .= '<span id="module_loading" class="invisible">';
$table->data[2][0] .= '<img src="images/spinner.gif" />';
$table->data[2][0] .= '</span>';
$modules = array ();
if ($id_agent)
$modules = get_agent_modules ($id_agent, false, array ('disabled' => 0));
$table->data[2][1] = print_select ($modules,
'id_modules[]', 0, false, '', '', true, true);
echo '<form method="post" 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 ('delete', 1);
print_submit_button (__('Delete'), 'go', false, 'class="sub delete"');
echo '</div>';
echo '</form>';
echo '<h3 class="error invisible" id="message"> </h3>';
require_jquery_file ('form');
require_jquery_file ('pandora.controls');
?>
<script type="text/javascript">
/* <![CDATA[ */
$(document).ready (function () {
$("#id_group").pandoraSelectGroup ();
$("#id_agent").pandoraSelectAgentModule ({
moduleSelect: "select#id_modules"
});
});
/* ]]> */
</script>

View File

@ -0,0 +1,84 @@
<?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 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.
// 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_agents.php');
require_once ('include/functions_alerts.php');
require_once ('include/functions_modules.php');
$tab = (string) get_parameter ('tab');
$img_style = array ("class" => "top", "width" => 16);
echo '<div id="menu_tab_frame">';
echo '<div id="menu_tab">';
echo '<ul class="mn">';
echo '<li class="'.($tab == 'copy_modules' ? 'nomn_high' : 'nomn').'">';
echo '<a href="index.php?sec=estado&sec2=godmode/agentes/massive_operations&tab=copy_modules">';
print_image ("images/copy.png", false, $img_style);
echo '&nbsp;'.__('Copy modules').'</a>';
echo '</li>';
echo '<li class="'.($tab == 'delete_agents' || $tab == '' ? 'nomn_high' : 'nomn').'">';
echo '<a href="index.php?sec=gagente&sec2=godmode/agentes/massive_operations&tab=delete_agents">';
print_image ("images/delete_agents.png", false, $img_style);
echo '&nbsp; '.__('Delete agents').'</a>';
echo '</li>';
echo '<li class="'.($tab == 'delete_modules' || $tab == '' ? 'nomn_high' : 'nomn').'">';
echo '<a href="index.php?sec=gagente&sec2=godmode/agentes/massive_operations&tab=delete_modules">';
print_image ("images/delete_modules.png", false, $img_style);
echo '&nbsp; '.__('Delete modules').'</a>';
echo '</li>';
echo '<li class="'.($tab == 'delete_alerts' || $tab == '' ? 'nomn_high' : 'nomn').'">';
echo '<a href="index.php?sec=gagente&sec2=godmode/agentes/massive_operations&tab=delete_alerts">';
print_image ("images/delete_alerts.png", false, $img_style);
echo '&nbsp; '.__('Delete alerts').'</a>';
echo '</li>';
echo "</ul></div></div>";
echo '<div style="height: 25px;">&nbsp;</div>';
echo '<h2>'.__('Agent configuration'). ' &raquo; '. __('Massive operations').'</h2>';
switch ($tab) {
case 'delete_alerts':
require_once ('godmode/agentes/massive_delete_alerts.php');
break;
case 'delete_agents':
require_once ('godmode/agentes/massive_delete_agents.php');
break;
case 'delete_modules':
require_once ('godmode/agentes/massive_delete_modules.php');
break;
case 'copy_modules':
default:
require_once ('godmode/agentes/massive_config.php');
}
?>

View File

@ -70,98 +70,114 @@ echo "</table>";
// ==========================
echo "<h3>".__('Assigned modules')."</h3>";
$sql1='SELECT * FROM tagente_modulo WHERE delete_pending = 0 AND id_agente = "'.$id_agente.'"
ORDER BY id_module_group, nombre ';
$result=mysql_query($sql1);
if ($row=mysql_num_rows($result)){
echo '<table width="750" cellpadding="4" cellspacing="4" class="databox">';
echo '<tr>';
echo "<th>".__('Module name')."</th>";
echo '<th>'.__('S').'</th>';
echo '<th>'.__('Type').'</th>';
echo "<th>".__('Interval')."</th>";
echo "<th>".__('Description')."</th>";
echo "<th>".__('Max/Min')."</th>";
echo "<th width=65>".__('Action')."</th>";
$color=1; $last_modulegroup = "0";
while ($row = mysql_fetch_array($result)){
if ($color == 1){
$tdcolor = "datos";
$color = 0;
} else {
$tdcolor = "datos2";
$color = 1;
}
$id_tipo = $row["id_tipo_modulo"];
$id_module = $row["id_modulo"];
$nombre_modulo = $row["nombre"];
$descripcion = $row["descripcion"];
$module_max = $row["max"];
$module_min = $row["min"];
$module_interval2 = $row["module_interval"];
$module_group2 = $row["id_module_group"];
if ($module_group2 != $last_modulegroup ){
// Render module group names (fixed code)
$nombre_grupomodulo = dame_nombre_grupomodulo ($module_group2);
$last_modulegroup = $module_group2;
echo "<tr><td class='datos3' align='center' colspan='9'><b>".$nombre_grupomodulo."</b></td></tr>";
}
if ($row["disabled"] == 0)
echo "<tr><td class='".$tdcolor."_id'>".$nombre_modulo."</td>";
else
echo "<tr><td class='$tdcolor'><i>$nombre_modulo</i></td>";
// Module type (by server type )
echo "<td class='".$tdcolor."f9'>";
if ($id_module > 0) {
echo show_server_type ($id_module);
echo '&nbsp;';
}
// Module type (by data type)
echo "<td class='".$tdcolor."f9'>";
if ($id_tipo > 0) {
echo "<img src='images/".show_icon_type($id_tipo)."' border=0>";
}
echo "</td>";
$modules = get_db_all_rows_filter ('tagente_modulo',
array ('delete_pending' => 0,
'id_agente' => $id_agente,
'order' => 'id_module_group, nombre'),
array ('id_agente_modulo', 'id_tipo_modulo', 'descripcion', 'nombre',
'max', 'min', 'module_interval', 'id_modulo', 'id_module_group',
'disabled',));
// Module interval
if ($module_interval2!=0){
echo "<td class='$tdcolor'>".$module_interval2."</td>";
} else {
echo "<td class='$tdcolor'> N/A </td>";
}
echo "<td class='$tdcolor' title='$descripcion'>".substr($descripcion,0,30)."</td>";
// MAX / MIN values
echo "<td class='$tdcolor'>";
if ($module_max == $module_min) {
$module_max = "N/A";
$module_min = "N/A";
}
echo $module_max." / ".$module_min;
echo "</td>";
// Delete module
echo "<td class='$tdcolor'>";
echo "<a href='index.php?sec=gagente&tab=module&sec2=godmode/agentes/configurar_agente&id_agente=$id_agente&delete_module=".$row["id_agente_modulo"]."'".' onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">';
echo "<img src='images/cross.png' border=0 title='".__('Delete')."'>";
echo "</b></a>&nbsp;";
// Update module
echo "<a href='index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&id_agente=$id_agente&tab=module&edit_module=1&id_agent_module=".$row["id_agente_modulo"]."'>";
echo "<img src='images/config.png' border=0 title='".__('Update')."'></b></a>";
// Make a data normalization
if (($id_tipo == 22) OR ($id_tipo == 1) OR ($id_tipo == 4) OR ($id_tipo == 7) OR
($id_tipo == 8) OR ($id_tipo == 11) OR ($id_tipo == 16) OR ($id_tipo == 22)) {
echo "&nbsp;";
echo "<a href='index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&id_agente=$id_agente&tab=module&fix_module=".$row["id_agente_modulo"]."'".' onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">';
echo "<img src='images/chart_curve.png' border=0 title='Normalize'></b></a>";
}
}
echo "</table>";
} else {
if ($modules === false) {
echo "<div class='nf'>".__('No available data to show')."</div>";
return;
}
$table->width = '95%';
$table->head = array ();
$table->head[0] = __('Name');
/* S stands for "Server" */;
$table->head[1] = __('S');
$table->head[2] = __('Type');
$table->head[3] = __('Interval');
$table->head[4] = __('Description');
$table->head[5] = __('Max/Min');
$table->head[6] = __('Action');
$table->style = array ();
$table->style[0] = 'font-weight: bold';
$table->size = array ();
$table->size[6] = '65px';
$table->align = array ();
$table->align[1] = 'center';
$table->align[6] = 'center';
$table->data = array ();
$agent_interval = get_agent_interval ($id_agente);
$last_modulegroup = "0";
foreach ($modules as $module) {
$type = $module["id_tipo_modulo"];
$id_module = $module["id_modulo"];
$nombre_modulo = $module["nombre"];
$descripcion = $module["descripcion"];
$module_max = $module["max"];
$module_min = $module["min"];
$module_interval2 = $module["module_interval"];
$module_group2 = $module["id_module_group"];
$data = array ();
if ($module['id_module_group'] != $last_modulegroup) {
$last_modulegroup = $module['id_module_group'];
$data[0] = '<strong>'.get_modulegroup_name ($last_modulegroup).'</strong>';
$i = array_push ($table->data, $data);
$table->rowclass[$i] = 'datos3';
$table->colspan[$i][0] = 6;
$data = array ();
}
$data[0] = '<a href="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&id_agente='.$id_agente.'&tab=module&edit_module=1&id_agent_module='.$module['id_agente_modulo'].'">';
if ($module["disabled"])
$data[0] .= '<em>'.$module['nombre'].'</em>';
else
$data[0] .= $module['nombre'];
$data[0] .= '</a>';
// Module type (by server type )
$data[1] = '';
if ($module['id_modulo'] > 0) {
$data[1] = show_server_type ($module['id_modulo']);
}
// Module type (by data type)
$data[2] = '';
if ($type) {
$data[2] = print_image ('images/'.show_icon_type ($type), true);
}
// Module interval
if ($module['module_interval']) {
$data[3] = $module['module_interval'];
} else {
$data[3] = $agent_interval;
}
$data[4] = substr ($module['descripcion'], 0, 30);
// MAX / MIN values
$data[5] = $module["max"] ? $module["max"] : __('N/A');
$data[5] .= ' / '.($module["min"] != $module['max']? $module["min"] : __('N/A'));
// Delete module
$data[6] = '<a href="index.php?sec=gagente&tab=module&sec2=godmode/agentes/configurar_agente&id_agente='.$id_agente.'&delete_module='.$module['id_agente_modulo'].'"
onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">';
$data[6] .= print_image ('images/cross.png', true,
array ('title' => __('Delete')));
$data[6] .= '</a> ';
// Make a data normalization
if (($type == 22) OR ($type == 1) OR ($type == 4) OR ($type == 7) OR
($type == 8) OR ($type == 11) OR ($type == 16) OR ($type == 22)) {
$data[6] .= '<a href="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&id_agente='.$id_agente.'&tab=module&fix_module='.$module['id_agente_modulo'].'" onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">';
$data[6] .= print_image ('images/chart_curve.png', true,
array ('title' => __('Normalize')));
$data[6] .= '</a>';
}
array_push ($table->data, $data);
}
print_table ($table);
?>

View File

@ -419,7 +419,7 @@ $(document).ready (function () {
}
});
$("#id_agent").pandoraSelectAgent ();
$("#id_agent").pandoraSelectAgentModule ();
<?php endif; ?>
$("a.template_details").cluetip ({
arrows: true,

View File

@ -36,12 +36,10 @@ if (give_acl ($config['id_user'], 0, "AW")) {
$menu["gagente"]["id"] = "god-agents";
$sub = array ();
$sub["godmode/agentes/manage_config"]["text"] = __('Manage config');
$sub["godmode/agentes/massive_operations"]["text"] = __('Massive operations');
$sub["godmode/agentes/manage_config_remote"]["text"] = __('Duplicate config');
$sub["godmode/agentes/manage_delete"]["text"] = __('Massive delete');
if (give_acl ($config["id_user"], 0, "PM")) {
$sub["godmode/groups/group_list"]["text"] = __('Manage groups');
}

View File

@ -219,8 +219,6 @@ if ( $row = mysql_num_rows ($result)){
echo "</td>";
echo "<td class='$tdcolor'>".substr($descripcion,0,30)."</td>";
echo "<td class='$tdcolor'>".give_network_component_group_name($id_group)."</td>";
//echo "<td class='$tdcolor'>".
//substr(dame_nombre_grupomodulo($module_group2),0,15)."</td>";
echo "<td class='$tdcolor'>";
if ($module_max == $module_min) {
$module_max = "N/A";

View File

@ -224,7 +224,7 @@ echo "<td class='datos'>".__('Module group')."</td>";
echo '<td class="datos">';
echo '<select name="id_module_group">';
if ($id_nc != -1 )
echo "<option value='".$id_module_group."'>".dame_nombre_grupomodulo($id_module_group);
echo "<option value='".$id_module_group."'>".get_modulegroup_name($id_module_group);
$sql1='SELECT * FROM tmodule_group';
$result=mysql_query($sql1);
while ($row=mysql_fetch_array($result))

View File

@ -121,7 +121,7 @@ echo '<td class="datos">' . __('Module group') . '</td>';
echo '<td class="datos">';
echo '<select name="id_module_group">';
if ($id_nc != -1 ) {
echo '<option value="' . $id_module_group . '">' . dame_nombre_grupomodulo($id_module_group);
echo '<option value="' . $id_module_group . '">' . get_modulegroup_name($id_module_group);
}
$result = mysql_query('SELECT * FROM tmodule_group');
while ($row = mysql_fetch_array($result))

Binary file not shown.

Before

Width:  |  Height:  |  Size: 395 B

After

Width:  |  Height:  |  Size: 498 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 896 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 866 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 882 B

View File

@ -521,17 +521,6 @@ function get_alert_type ($id_type) {
return (string) get_db_value ('name', 'talert_templates', 'id', (int) $id_type);
}
/**
* Get name of a module group.
*
* @param int $id_module_group Module group id.
*
* @return string Name of the given module group.
*/
function dame_nombre_grupomodulo ($id_module_group) {
return (string) get_db_value ('name', 'tmodule_group', 'id_mg', (int) $id_module_group);
}
/**
* Get the name of an exporting server
*
@ -2299,17 +2288,32 @@ function get_agentmodule_data_sum ($id_agent_module, $period, $date = 0) {
/**
* Get a translated string
*
* @param string String to translate
* @param string String to translate. It can have special format characters like
* a printf
* @param mixed Optional parameters to be replaced in string. Example:
<code>
echo __('Hello!');
echo __('Hello, %s!', $user);
</code>
*
* @return string The translated string. If not defined, the same string will be returned
*/
function __ ($string) {
global $l10n;
if (func_num_args () == 1) {
if (is_null ($l10n))
return $string;
return $l10n->translate ($string);
}
$args = func_get_args ();
$string = array_shift ($args);
if (is_null ($l10n))
return $string;
return $l10n->translate ($string);
return vsprintf ($string, $args);
return vsprintf ($l10n->translate ($string), $args);
}
/**

View File

@ -35,6 +35,7 @@ function copy_agent_module_to_agent ($id_agent_module, $id_destiny_agent) {
$modules = get_agent_modules ($id_destiny_agent, false,
array ('nombre' => $module['nombre']));
if (! empty ($modules))
return array_pop (array_keys ($modules));
@ -154,4 +155,27 @@ function get_network_component_groups ($id_module_components = 0) {
return $retval;
}
/**
* Deletes a module from an agent.
*
* @param mixed Agent module id to be deleted. Accepts an array with ids.
*
* @return True if the module was deleted. False if not.
*/
function delete_agent_module ($id_agent_module) {
$where = array ('id_agent_module' => $id_agent_module);
process_sql_delete ('talert_template_modules', $where);
process_sql_delete ('tgraph_source', $where);
process_sql_delete ('treport_content', $where);
process_sql_delete ('tevento', array ('id_agentmodule' => $id_agent_module));
$where = array ('id_agente_modulo' => $id_agent_module);
process_sql_delete ('tlayout_data', $where);
process_sql_delete ('tagente_estado', $where);
process_sql_update ('tagente_modulo',
array ('delete_pending' => 1, 'disabled' => 1),
$where);
return true;
}
?>

View File

@ -56,14 +56,15 @@
});
$.extend ({
pandoraSelectAgent: new function() {
pandoraSelectAgentModule: new function() {
this.defaults = {
moduleSelect: "select#id_agent_module",
loading: "module_loading",
loading: "#module_loading",
callbackBefore: dummyFunc,
callbackPre: dummyFunc,
callbackPost: dummyFunc,
callbackAfter: dummyFunc,
moduleFilter: 'disabled=0',
debug: false
};
@ -72,7 +73,7 @@
return this.each (function() {
this.config = {};
this.config = $.extend (this.config, $.pandoraSelectAgent.defaults, settings);
this.config = $.extend (this.config, $.pandoraSelectAgentModule.defaults, settings);
var config = this.config;
@ -85,14 +86,16 @@
jQuery.post ('ajax.php',
{"page": "operation/agentes/ver_agente",
"get_agent_modules_json": 1,
"id_agent": this.value
"id_agent": this.value,
"filter" : config.moduleFilter,
"fields" : "id_agente_modulo,nombre"
},
function (data) {
jQuery.each (data, function (i, value) {
config.callbackPre ();
option = $("<option></option>")
.attr ("value", value['id_agente_modulo'])
.html (html_entity_decode (value['nombre']));
.attr ("value", value['id'])
.html (html_entity_decode (value['template']['name']));
config.callbackPost (i, value, option);
$(config.moduleSelect).append (option);
});
@ -107,8 +110,63 @@
};
}
});
$.extend ({
pandoraSelectAgentAlert: new function() {
this.defaults = {
alertSelect: "select#id_agent_module",
loading: "#alert_loading",
callbackBefore: dummyFunc,
callbackPre: dummyFunc,
callbackPost: dummyFunc,
callbackAfter: dummyFunc,
debug: false
};
/* public methods */
this.construct = function (settings) {
return this.each (function() {
this.config = {};
this.config = $.extend (this.config, $.pandoraSelectAgentAlert.defaults, settings);
var config = this.config;
$(this).change (function () {
var $select = $(config.alertSelect).disable ();
$(config.loading).show ();
$("option[value!=0]", $select).remove ();
config.callbackBefore (this);
jQuery.post ('ajax.php',
{"page": "godmode/alerts/alert_list",
"get_agent_alerts_simple": 1,
"id_agent": this.value
},
function (data) {
jQuery.each (data, function (i, value) {
config.callbackPre ();
option = $("<option></option>")
.attr ("value", value['id'])
.html (html_entity_decode (value['template']['name']))
.append (" ("+html_entity_decode (value['module_name'])+")");
config.callbackPost (i, value, option);
$(config.alertSelect).append (option);
});
$(config.loading).hide ();
$select.enable ();
config.callbackAfter ();
},
"json"
);
});
});
};
}
});
$.fn.extend({
pandoraSelectGroup: $.pandoraSelectGroup.construct,
pandoraSelectAgent: $.pandoraSelectAgent.construct
pandoraSelectAgentModule: $.pandoraSelectAgentModule.construct,
pandoraSelectAgentAlert: $.pandoraSelectAgentAlert.construct
});
}) (jQuery);

View File

@ -253,9 +253,10 @@ input.sub {
Percentage values are invalid here but .4em seems big enough */
-moz-border-radius: .4em;
-webkit-border-radius: .4em;
border-radius: .4em;
border-radius: .4em;
font-size: 8pt;
background-color: #e5e5e5;
color: #000;
}
input.next, input.upd, input.ok, input.wand, input.delete, input.search,
input.copy, input.add {

View File

@ -57,3 +57,6 @@ ol.steps {
div#steps_clean {
display:none;
}
div#menu_tab_frame {
width: 100%;
}

View File

@ -72,7 +72,7 @@ if (mysql_num_rows ($result3)) {
if ($row3["id_module_group"] != $last_modulegroup ){
// Render module group names (fixed code)
$nombre_grupomodulo = dame_nombre_grupomodulo ($row3["id_module_group"]);
$nombre_grupomodulo = get_modulegroup_name ($row3["id_module_group"]);
$last_modulegroup = $row3["id_module_group"];
echo "<tr><td class='datos3' align='center' colspan='9'>
<b>".$nombre_grupomodulo."</b></td></tr>";
@ -92,10 +92,10 @@ if (mysql_num_rows ($result3)) {
} else {
echo "<a href='index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=".$id_agente."&id_agente_modulo=".$row3["id_agente_modulo"]."&tab=data&refr=60'><img src='images/refresh.png' border='0'></a>";
}
}
}
}
echo "</td>";
$nombre_grupomodulo = dame_nombre_grupomodulo ($row3["id_module_group"]);
$nombre_grupomodulo = get_modulegroup_name ($row3["id_module_group"]);
if ($nombre_grupomodulo != ""){
if (($label_group == 0) || ($last_label != $nombre_grupomodulo)){ // Show label module group
$label_group = -1;

View File

@ -40,8 +40,10 @@ if (is_ajax ()) {
if ($get_agent_modules_json) {
$id_agent = (int) get_parameter ('id_agent');
$filter = (string) get_parameter ('filter');
$fields = (string) get_parameter ('fields');
$agent_modules = get_agent_modules ($id_agent, "*",
$agent_modules = get_agent_modules ($id_agent,
($fields != '' ? explode (',', $fields) : "*"),
($filter != '' ? $filter : false));
echo json_encode ($agent_modules);

View File

@ -244,7 +244,7 @@ function graphic_combined_module ($module_list, $weight_list, $period, $width, $
elseif ($period <= 2419200)
$title_period = __('Last month');
else
$title_period = sprintf (__('Last %s days'), format_numeric (($period / (3600 * 24)), 2));
$title_period = __('Last %s days', format_numeric (($period / (3600 * 24)), 2));
if ($max_value <= 0) {
graphic_error ();
@ -299,8 +299,8 @@ function grafico_modulo_sparse ($id_agente_modulo, $period, $show_event,
}
$all_data = get_db_all_rows_filter ('tagente_datos',
array ('id_agente' => $id_agente,
'id_agente_modulo' => $id_agente_modulo,
array ('id_agente' => (int) $id_agente,
'id_agente_modulo' => (int) $id_agente_modulo,
"utimestamp > $datelimit",
"utimestamp < $date",
'order' => 'utimestamp ASC'),
@ -366,11 +366,6 @@ function grafico_modulo_sparse ($id_agente_modulo, $period, $show_event,
}
}
if ($max_value <= $min_value) {
graphic_error ();
return;
}
// Get the first data outsite (to the left---more old) of the interval given
$previous = (float) get_previous_data ($id_agente_modulo, $datelimit);
for ($i = 0; $i <= $resolution; $i++) {
@ -394,7 +389,7 @@ function grafico_modulo_sparse ($id_agente_modulo, $period, $show_event,
elseif ($period <= 2419200)
$title_period = __('Last month');
else
$title_period = sprintf (__('Last %s days'), format_numeric (($period / (3600 * 24)), 2));
$title_period = __('Last %s days', format_numeric (($period / (3600 * 24)), 2));
$engine = get_graph_engine ($period);
$engine->width = $width;
@ -1019,7 +1014,7 @@ function grafico_modulo_boolean ($id_agente_modulo, $period, $show_event,
elseif ($period <= 2419200)
$title_period = __('Last month');
else
$title_period = sprintf (__('Last %s days'), format_numeric (($period / (3600 * 24)), 2));
$title_period = __('Last %s days', format_numeric (($period / (3600 * 24)), 2));
$engine = get_graph_engine ($period);

View File

@ -16,7 +16,7 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
require_once ('pChart/pData.class');
require_once ('pChart/pData.class');
require_once ('pChart/pChart.class');
class PchartGraph extends PandoraGraphAbstract {
@ -33,23 +33,23 @@ class PchartGraph extends PandoraGraphAbstract {
}
public function pie_graph () {
// dataset definition
$this->dataset = new pData;
$this->dataset->AddPoint ($this->data, "Serie1", $this->legend);
$this->dataset->AddPoint ($this->legend, "Serie2");
$this->dataset->AddAllSeries ();
// dataset definition
$this->dataset = new pData;
$this->dataset->AddPoint ($this->data, "Serie1", $this->legend);
$this->dataset->AddPoint ($this->legend, "Serie2");
$this->dataset->AddAllSeries ();
$this->dataset->SetAbsciseLabelSerie ("Serie2");
// Initialise the graph
$this->graph = new pChart ($this->width, $this->height);
$this->graph->setFontProperties ($this->fontpath, 8);
// Initialise the graph
$this->graph = new pChart ($this->width, $this->height);
$this->graph->setFontProperties ($this->fontpath, 8);
if ($this->palette_path) {
$this->graph->loadColorPalette ($this->palette_path);
}
}
$this->add_background ();
// Draw the pie chart
if ($this->three_dimensions) {
if ($this->three_dimensions) {
$this->graph->drawPieGraph ($this->dataset->GetData (),
$this->dataset->GetDataDescription (),
$this->width / 2,
@ -76,43 +76,43 @@ class PchartGraph extends PandoraGraphAbstract {
$this->dataset = new pData;
foreach ($this->data as $x => $y) {
$this->dataset->AddPoint ($y, "Serie1", $x);
}
}
$this->dataset->AddAllSeries ();
$this->dataset->SetXAxisFormat ("label");
$this->dataset->SetYAxisFormat ($this->yaxis_format);
// Initialise the graph
$this->dataset->SetYAxisFormat ($this->yaxis_format);
// Initialise the graph
$this->graph = new pChart ($this->width, $this->height);
if ($this->palette_path) {
$this->graph->loadColorPalette ($this->palette_path);
}
$this->graph->setFontProperties ($this->fontpath, 8);
$this->add_background ();
$this->graph->drawGraphArea (255, 255, 255, true);
}
$this->graph->setFontProperties ($this->fontpath, 8);
$this->add_background ();
$this->graph->drawGraphArea (255, 255, 255, true);
$this->graph->drawGrid (4, true, 230, 230, 230, 50);
// Draw the bar graph
$this->graph->setFontProperties ($this->fontpath, 8);
$this->graph->setFixedScale (0, max ($this->data));
$this->graph->setFixedScale (0, max ($this->data));
$this->graph->drawOverlayBarGraphH ($this->dataset->GetData (),
$this->dataset->GetDataDescription (), 50);
// Finish the graph
$this->dataset->GetDataDescription (), 50);
// Finish the graph
$this->add_legend ();
$this->graph->Stroke ();
}
public function single_graph () {
// Dataset definition
$this->dataset = new pData;
// Dataset definition
$this->dataset = new pData;
$this->graph = new pChart ($this->width, $this->height);
foreach ($this->data as $x => $y) {
$this->dataset->AddPoint ($y, "Serie1", $x);
}
$color = $this->get_rgb_values ($this->graph_color[2]);
$this->graph->setColorPalette (0, $color['r'], $color['g'], $color['b']);
$this->graph->setColorPalette (0, $color['r'], $color['g'], $color['b']);
$this->dataset->AddAllSeries ();
if ($this->legend !== false) {
$this->dataset->SetSerieName ($this->legend[0], "Serie1");
@ -120,41 +120,41 @@ class PchartGraph extends PandoraGraphAbstract {
if ($this->palette_path) {
$this->graph->loadColorPalette ($this->palette_path);
}
$this->graph->setFontProperties ($this->fontpath, 8);
}
$this->graph->setFontProperties ($this->fontpath, 8);
$this->add_background ();
$this->dataset->SetXAxisFormat ($this->xaxis_format);
$this->dataset->SetYAxisFormat ($this->yaxis_format);
$this->dataset->SetYAxisFormat ($this->yaxis_format);
$this->graph->drawGraphArea (255, 255, 255, true);
if ($this->max_value == 0 || $this->max_value == 1)
$this->graph->setFixedScale (0, 1, 1);
$this->graph->drawScale ($this->dataset->GetData (),
$this->dataset->GetDataDescription (),
SCALE_START0, 80, 80, 80, true,
0, 0, false,
$this->xaxis_interval);
$this->graph->drawGrid (4, false, 0, 0, 0);
if ($this->max_value > 0) {
// Draw the graph
$this->graph->drawGrid (4, false, 0, 0, 0);
if ($this->max_value > 0) {
// Draw the graph
$this->graph->drawFilledLineGraph ($this->dataset->GetData (),
$this->dataset->GetDataDescription (),
50, true);
}
// Finish the graph
// Finish the graph
$this->add_legend ();
$this->add_events ();
$this->add_alert_levels ();
$this->graph->Stroke ();
}
public function sparse_graph ($period, $avg_only, $min_value, $max_value, $unit_name) {
// Dataset definition
$this->dataset = new pData;
// Dataset definition
$this->dataset = new pData;
$this->graph = new pChart ($this->width, $this->height);
$this->graph->setFontProperties ($this->fontpath, 8);
$this->legend = array ();
@ -170,39 +170,39 @@ class PchartGraph extends PandoraGraphAbstract {
$this->dataset->AddPoint ($data['max'], "MAX");
}
$this->legend[1] = __("Min. Value");
$this->legend[2] = __("Max. Value");
$this->legend[2] = __("Max. Value");
$this->dataset->SetSerieName (__("Min. Value"), "MIN");
$this->dataset->SetSerieName (__("Max. Value"), "MAX");
}
$this->set_colors ();
$this->dataset->SetXAxisFormat ('date');
$this->graph->setDateFormat ("Y");
$this->dataset->SetYAxisFormat ('metric');
$this->dataset->AddAllSeries ();
$this->dataset->SetYAxisFormat ('metric');
$this->dataset->AddAllSeries ();
$this->dataset->SetSerieName (__("Avg. Value"), "AVG");
$this->legend[0] = __("Avg. Value");
if ($this->palette_path) {
$this->graph->loadColorPalette ($this->palette_path);
}
$this->add_background ();
$this->add_background ();
$this->graph->drawGraphArea (255, 255, 255, true);
$this->xaxis_interval = ($this->xaxis_interval / 7 >= 1) ? ($this->xaxis_interval / 7) : 10;
$this->xaxis_interval = ($this->xaxis_interval / 7 >= 1) ? ($this->xaxis_interval / 7) : 10;
$this->graph->drawScale ($this->dataset->GetData (),
$this->dataset->GetDataDescription (), SCALE_START0,
80, 80, 80, true, 0, 0, false,
$this->xaxis_interval);
/* NOTICE: The final "false" is a Pandora modificaton of pChart to avoid showing vertical lines. */
$this->graph->drawGrid (1, true, 225, 225, 225, 100, false);
// Draw the graph
/* NOTICE: The final "false" is a Pandora modificaton of pChart to avoid showing vertical lines. */
$this->graph->drawGrid (1, true, 225, 225, 225, 100, false);
// Draw the graph
$this->graph->drawFilledLineGraph ($this->dataset->GetData(), $this->dataset->GetDataDescription(), 50, true);
$this->add_legend ();
$this->add_events ("AVG");
$this->add_alert_levels ();
$this->graph->Stroke ();
}
@ -211,43 +211,43 @@ class PchartGraph extends PandoraGraphAbstract {
$this->dataset = new pData;
foreach ($this->data as $x => $y) {
$this->dataset->AddPoint ($y, "Serie1", $x);
}
$this->dataset->AddAllSeries ();
}
$this->dataset->AddAllSeries ();
$this->dataset->SetAbsciseLabelSerie ();
$this->dataset->SetXAxisFormat ($this->xaxis_format);
$this->dataset->SetYAxisFormat ($this->yaxis_format);
// Initialise the graph
// Initialise the graph
$this->graph = new pChart ($this->width, $this->height);
if ($this->palette_path) {
$this->graph->loadColorPalette ($this->palette_path);
}
$this->graph->setFontProperties ($this->fontpath, 8);
$this->add_background ();
$this->graph->drawGraphArea (255, 255, 255, true);
$this->graph->drawGrid (4, true, 230, 230, 230, 50);
}
$this->graph->setFontProperties ($this->fontpath, 8);
$this->add_background ();
$this->graph->drawGraphArea (255, 255, 255, true);
$this->graph->drawGrid (4, true, 230, 230, 230, 50);
// Draw the bar graph
$this->graph->setFontProperties ($this->fontpath, 8);
$this->graph->drawScale ($this->dataset->GetData (),
$this->dataset->GetDataDescription (),
SCALE_START0, 80, 80, 80,
true, 0, 0, false,
$this->xaxis_interval);
$this->xaxis_interval);
$this->graph->drawOverlayBarGraph ($this->dataset->GetData (),
$this->dataset->GetDataDescription (),
50);
50);
$this->add_events ("Serie1");
$this->add_alert_levels ();
// Finish the graph
// Finish the graph
$this->graph->Stroke ();
}
public function combined_graph ($values, $events, $alerts, $unit_name, $max_value, $stacked) {
set_time_limit (0);
// Dataset definition
$this->dataset = new pData;
// Dataset definition
$this->dataset = new pData;
$this->graph = new pChart ($this->width, $this->height);
foreach ($this->data as $i => $data) {
@ -265,9 +265,9 @@ class PchartGraph extends PandoraGraphAbstract {
$this->dataset->SetXAxisFormat ('date');
$this->dataset->SetYAxisFormat ('metric');
$this->dataset->AddAllSeries ();
$this->add_background ();
$this->add_background ();
$this->graph->drawGraphArea (255, 255, 255, true);
// Draw the graph
if ($stacked == 1) {
$this->graph->drawScale ($this->dataset->GetData (),
@ -305,7 +305,7 @@ class PchartGraph extends PandoraGraphAbstract {
public function progress_bar ($value, $color) {
set_time_limit (0);
// Dataset definition
// Dataset definition
$this->graph = new pChart ($this->width, $this->height);
$this->graph->setFontProperties ($this->fontpath, 8);
@ -471,7 +471,7 @@ class PchartGraph extends PandoraGraphAbstract {
/* Add legend */
$this->graph->setFontProperties ($this->fontpath, 6);
$size = $this->graph->getLegendBoxSize ($this->dataset->GetDataDescription ());
$size = $this->graph->getLegendBoxSize ($this->dataset->GetDataDescription ());
$this->graph->drawLegend ($this->width - $size[0] - 32, 5,
$this->dataset->GetDataDescription (),
240, 240, 240);