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

* godmode/alerts/alert_list.php: Put tooltip before the template name
	so it's always in the same place.

	* include/javascript/jquery.pandora.controls.js: Fixed a bug on
	pandoraSelectAgentModule which was getting wrong fields.

	* include/functions_html.php: Do not add id counter on checkboxes if
	it's 0.

	* operation/agentes/estado_agente.php: Create agent button was going
	to a wrong place.

	* reporting/fgraph.php: Fixed graphic_agentaccess() which was not
	showing anything.

	* pandoradb_data.sql: Removed Compound only from talert_commands.



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1546 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
Esteban Sanchez 2009-03-18 09:37:31 +00:00
parent 79d5149f72
commit 89f6e57e68
7 changed files with 72 additions and 33 deletions

View File

@ -1,3 +1,22 @@
2009-03-18 Esteban Sanchez <estebans@artica.es>
* godmode/alerts/alert_list.php: Put tooltip before the template name
so it's always in the same place.
* include/javascript/jquery.pandora.controls.js: Fixed a bug on
pandoraSelectAgentModule which was getting wrong fields.
* include/functions_html.php: Do not add id counter on checkboxes if
it's 0.
* operation/agentes/estado_agente.php: Create agent button was going
to a wrong place.
* reporting/fgraph.php: Fixed graphic_agentaccess() which was not
showing anything.
* pandoradb_data.sql: Removed Compound only from talert_commands.
2009-03-17 Esteban Sanchez <estebans@artica.es>
* reporting/fgraph.php: Fixed a bug on graphic_error() which always

View File

@ -252,10 +252,10 @@ foreach ($simple_alerts as $alert) {
$data[1] .= '</a>';
}
$data[2] = get_agentmodule_name ($alert['id_agent_module']);
$data[3] = get_alert_template_name ($alert['id_alert_template']);
$data[3] .= ' <a class="template_details"
$data[3] = ' <a class="template_details"
href="ajax.php?page=godmode/alerts/alert_templates&get_template_tooltip=1&id_template='.$alert['id_alert_template'].'">
<img id="template-details-'.$alert['id_alert_template'].'" class="img_help" src="images/zoom.png"/></a>';
<img id="template-details-'.$alert['id_alert_template'].'" class="img_help" src="images/zoom.png"/></a> ';
$data[3] .= get_alert_template_name ($alert['id_alert_template']);
$actions = get_alert_agent_module_actions ($alert['id']);
$data[4] = '<ul class="action_list">';

View File

@ -703,7 +703,7 @@ function print_checkbox_extended ($name, $value, $checked, $disabled, $script, $
$idcounter[$name] = 0;
}
$id = preg_replace('/[^a-z0-9\:\;\-\_]/i', '', $name.$idcounter[$name]);
$id = preg_replace('/[^a-z0-9\:\;\-\_]/i', '', $name.($idcounter[$name] ? $idcounter[$name] : ''));
$output = '<input name="'.$name.'" type="checkbox" value="'.$value.'" '. ($checked ? 'checked="checked"': '');
$output .= ' id="checkbox-'.$id.'"';

View File

@ -94,8 +94,8 @@
jQuery.each (data, function (i, value) {
config.callbackPre ();
option = $("<option></option>")
.attr ("value", value['id'])
.html (html_entity_decode (value['template']['name']));
.attr ("value", value['id_agente_modulo'])
.html (html_entity_decode (value['nombre']));
config.callbackPost (i, value, option);
$(config.moduleSelect).append (option);
});

View File

@ -339,9 +339,10 @@ if ($agents !== false) {
|| give_acl ($config['id_user'], 0, "DM")
|| give_acl ($config['id_user'], 0, "UM")) {
echo "&nbsp;<form method='post' action='index.php?sec=gagente&
sec2=godmode/agentes/configurar_agente&create_agent=1'><input type='submit' class='sub next' name='crt'
value='".__('Create agent')."'></form>";
echo '<form method="post" action="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente">';
print_input_hidden ('new_agent', 1);
print_submit_button (__('Create agent'), 'crt', false, 'class="sub next"');
echo '</form>';
}
}

View File

@ -26,16 +26,14 @@
-- Dumping data for table `talert_commands`
--
INSERT INTO `talert_commands` VALUES (1,'Compound only', 'Internal type', 'This alert will not be executed individually', 1);
INSERT INTO `talert_commands` VALUES (2,'eMail','Internal type', 'This alert send an email using internal Pandora FMS Server SMTP capabilities (defined in each server, using:\r\n_field1_ as destination email address, and\r\n_field2_ as subject for message. \r\n_field3_ as text of message.', 1);
INSERT INTO `talert_commands` VALUES (3,'Internal Audit','Internal type','This alert save alert in Pandora interal audit system. Fields are static and only _field1_ is used.', 1);
INSERT INTO `talert_commands` VALUES (4,'Pandora FMS Event','Internal type','This alert create an special event into Pandora FMS event manager.', 1);
INSERT INTO `talert_commands` VALUES (5,'Pandora FMS Alertlog','echo _timestamp_ pandora _agent_ _data_ _field1_ _field2_ >> /var/log/pandora/pandora_alert.log','This is a default alert to write alerts in a standard ASCII plaintext log file in /var/log/pandora/pandora_alert.log\r\n', 0);
INSERT INTO `talert_commands` VALUES (6,'SNMP Trap','/usr/bin/snmptrap -v 1 -c trap_public 192.168.0.4 1.1.1.1.1.1.1.1 _agent_ _field1_','Send a SNMPTRAP to 192.168.0.4. Please review config and adapt to your needs, this is only a sample, not functional itself.', 0);
INSERT INTO `talert_commands` VALUES (7,'Syslog','logger -p daemon.alert Pandora Alert _agent_ _data_ _field1_ _field2_','Uses field1 and field2 to generate Syslog alert in facility daemon with "alert" level.', 0);
INSERT INTO `talert_commands` VALUES (8,'Sound Alert','/usr/bin/play /usr/share/sounds/alarm.wav','', 0);
INSERT INTO `talert_commands` VALUES (9,'Jabber Alert','echo _field3_ | sendxmpp -r _field1_ --chatroom _field2_','Send jabber alert to chat room in a predefined server (configure first .sendxmpprc file). Uses field3 as text message, field1 as useralias for source message, and field2 for chatroom name', 0);
INSERT INTO `talert_commands` VALUES (1,'eMail','Internal type', 'This alert send an email using internal Pandora FMS Server SMTP capabilities (defined in each server, using:\r\n_field1_ as destination email address, and\r\n_field2_ as subject for message. \r\n_field3_ as text of message.', 1);
INSERT INTO `talert_commands` VALUES (2,'Internal Audit','Internal type','This alert save alert in Pandora interal audit system. Fields are static and only _field1_ is used.', 1);
INSERT INTO `talert_commands` VALUES (3,'Pandora FMS Event','Internal type','This alert create an special event into Pandora FMS event manager.', 1);
INSERT INTO `talert_commands` VALUES (4,'Pandora FMS Alertlog','echo _timestamp_ pandora _agent_ _data_ _field1_ _field2_ >> /var/log/pandora/pandora_alert.log','This is a default alert to write alerts in a standard ASCII plaintext log file in /var/log/pandora/pandora_alert.log\r\n', 0);
INSERT INTO `talert_commands` VALUES (5,'SNMP Trap','/usr/bin/snmptrap -v 1 -c trap_public 192.168.0.4 1.1.1.1.1.1.1.1 _agent_ _field1_','Send a SNMPTRAP to 192.168.0.4. Please review config and adapt to your needs, this is only a sample, not functional itself.', 0);
INSERT INTO `talert_commands` VALUES (6,'Syslog','logger -p daemon.alert Pandora Alert _agent_ _data_ _field1_ _field2_','Uses field1 and field2 to generate Syslog alert in facility daemon with "alert" level.', 0);
INSERT INTO `talert_commands` VALUES (7,'Sound Alert','/usr/bin/play /usr/share/sounds/alarm.wav','', 0);
INSERT INTO `talert_commands` VALUES (8,'Jabber Alert','echo _field3_ | sendxmpp -r _field1_ --chatroom _field2_','Send jabber alert to chat room in a predefined server (configure first .sendxmpprc file). Uses field3 as text message, field1 as useralias for source message, and field2 for chatroom name', 0);
--

View File

@ -428,38 +428,59 @@ function graphic_agentmodules ($id_agent, $width, $height) {
generic_pie_graph ($width, $height, $data);
}
function graphic_agentaccess ($id_agent, $period, $width, $height) {
function graphic_agentaccess ($id_agent, $width, $height) {
global $config;
$interval = 24;
$datelimit = get_system_time () - $period;
$hours = $period / $interval;
$date = get_system_time ();
$period = 1440;
$datelimit = $date - $period;
$time = array ();
$data = array ();
for ($i = 0; $i < $interval; $i++) {
$time[$i]['timestamp_bottom'] = $datelimit + ($interval * $i);
$time[$i]['timestamp_top'] = $datelimit + ($interval * ($i + 1));
$data[$time[$i]['timestamp_bottom']] = 0;
}
$sql = sprintf ('SELECT UNIX_TIMESTAMP(timestamp) utimestamp
FROM tagent_access
WHERE id_agent = %d AND UNIX_TIMESTAMP(timestamp) > %d',
$id_agent, $datelimit);
$result = get_db_all_rows_sql ($sql);
$result = get_db_all_rows_filter ('tagent_access',
array ('id_agent' => $id_agent,
"utimestamp > $datelimit",
"utimestamp < $date"),
array ('utimestamp'));
if ($result === false)
$result = array ();
$start = 0;
$data = array_pad (array (), $interval, 0);
$max_value = 0;
foreach ($result as $access) {
$utimestamp = $access['utimestamp'];
for ($i = $start; $i < $interval; $i++) {
if ($access['utimestamp'] < $time[$i]['timestamp_bottom'] && $access['utimestamp'] >= $time[$i]['timestamp_top']) {
$data[$access['utimestamp']] = 1;
if ($utimestamp <= $time[$i]['timestamp_top'] && $utimestamp >= $time[$i]['timestamp_bottom']) {
$data[$time[$i]['timestamp_bottom']] = 1;
$start = $i;
$max_value = 1;
break;
}
}
}
generic_single_graph ($width, $height, $data, (int) $interval / 7);
$engine = get_graph_engine ($period);
$engine->width = $width;
$engine->height = $height;
$engine->data = &$data;
$engine->max_value = $max_value;
$engine->show_title = false;
$engine->fontpath = $config['fontpath'];
$engine->xaxis_interval = 4;
$engine->yaxis_interval = 1;
$engine->xaxis_format = 'date';
$engine->single_graph ();
}
function graph_incidents_status () {
@ -1144,11 +1165,11 @@ if ($graphic_type) {
break;
case "agentaccess":
graphic_agentaccess ($_GET["id"], $_GET["periodo"], $width, $height);
graphic_agentaccess ($id, $width, $height);
break;
case "agentmodules":
graphic_agentmodules ($_GET["id"], $width, $height);
graphic_agentmodules ($id, $width, $height);
break;
case "progress":