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:
parent
c5a2e297d5
commit
86927bf5c7
|
@ -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>
|
2009-03-17 Esteban Sanchez <estebans@artica.es>
|
||||||
|
|
||||||
* reporting/fgraph.php: Fixed a bug on graphic_error() which always
|
* reporting/fgraph.php: Fixed a bug on graphic_error() which always
|
||||||
|
|
|
@ -252,10 +252,10 @@ foreach ($simple_alerts as $alert) {
|
||||||
$data[1] .= '</a>';
|
$data[1] .= '</a>';
|
||||||
}
|
}
|
||||||
$data[2] = get_agentmodule_name ($alert['id_agent_module']);
|
$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'].'">
|
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']);
|
$actions = get_alert_agent_module_actions ($alert['id']);
|
||||||
$data[4] = '<ul class="action_list">';
|
$data[4] = '<ul class="action_list">';
|
||||||
|
|
|
@ -703,7 +703,7 @@ function print_checkbox_extended ($name, $value, $checked, $disabled, $script, $
|
||||||
$idcounter[$name] = 0;
|
$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 = '<input name="'.$name.'" type="checkbox" value="'.$value.'" '. ($checked ? 'checked="checked"': '');
|
||||||
$output .= ' id="checkbox-'.$id.'"';
|
$output .= ' id="checkbox-'.$id.'"';
|
||||||
|
|
|
@ -94,8 +94,8 @@
|
||||||
jQuery.each (data, function (i, value) {
|
jQuery.each (data, function (i, value) {
|
||||||
config.callbackPre ();
|
config.callbackPre ();
|
||||||
option = $("<option></option>")
|
option = $("<option></option>")
|
||||||
.attr ("value", value['id'])
|
.attr ("value", value['id_agente_modulo'])
|
||||||
.html (html_entity_decode (value['template']['name']));
|
.html (html_entity_decode (value['nombre']));
|
||||||
config.callbackPost (i, value, option);
|
config.callbackPost (i, value, option);
|
||||||
$(config.moduleSelect).append (option);
|
$(config.moduleSelect).append (option);
|
||||||
});
|
});
|
||||||
|
|
|
@ -339,9 +339,10 @@ if ($agents !== false) {
|
||||||
|| give_acl ($config['id_user'], 0, "DM")
|
|| give_acl ($config['id_user'], 0, "DM")
|
||||||
|| give_acl ($config['id_user'], 0, "UM")) {
|
|| give_acl ($config['id_user'], 0, "UM")) {
|
||||||
|
|
||||||
echo " <form method='post' action='index.php?sec=gagente&
|
echo '<form method="post" action="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente">';
|
||||||
sec2=godmode/agentes/configurar_agente&create_agent=1'><input type='submit' class='sub next' name='crt'
|
print_input_hidden ('new_agent', 1);
|
||||||
value='".__('Create agent')."'></form>";
|
print_submit_button (__('Create agent'), 'crt', false, 'class="sub next"');
|
||||||
|
echo '</form>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,16 +26,14 @@
|
||||||
-- Dumping data for table `talert_commands`
|
-- 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 (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,'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,'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 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 (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,'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 (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,'Sound Alert','/usr/bin/play /usr/share/sounds/alarm.wav','', 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,'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 (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);
|
|
||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
|
|
|
@ -428,38 +428,59 @@ function graphic_agentmodules ($id_agent, $width, $height) {
|
||||||
generic_pie_graph ($width, $height, $data);
|
generic_pie_graph ($width, $height, $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
function graphic_agentaccess ($id_agent, $period, $width, $height) {
|
function graphic_agentaccess ($id_agent, $width, $height) {
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
$interval = 24;
|
$interval = 24;
|
||||||
$datelimit = get_system_time () - $period;
|
$date = get_system_time ();
|
||||||
$hours = $period / $interval;
|
$period = 1440;
|
||||||
|
$datelimit = $date - $period;
|
||||||
|
|
||||||
|
$time = array ();
|
||||||
|
$data = array ();
|
||||||
for ($i = 0; $i < $interval; $i++) {
|
for ($i = 0; $i < $interval; $i++) {
|
||||||
$time[$i]['timestamp_bottom'] = $datelimit + ($interval * $i);
|
$time[$i]['timestamp_bottom'] = $datelimit + ($interval * $i);
|
||||||
$time[$i]['timestamp_top'] = $datelimit + ($interval * ($i + 1));
|
$time[$i]['timestamp_top'] = $datelimit + ($interval * ($i + 1));
|
||||||
|
$data[$time[$i]['timestamp_bottom']] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql = sprintf ('SELECT UNIX_TIMESTAMP(timestamp) utimestamp
|
$result = get_db_all_rows_filter ('tagent_access',
|
||||||
FROM tagent_access
|
array ('id_agent' => $id_agent,
|
||||||
WHERE id_agent = %d AND UNIX_TIMESTAMP(timestamp) > %d',
|
"utimestamp > $datelimit",
|
||||||
$id_agent, $datelimit);
|
"utimestamp < $date"),
|
||||||
$result = get_db_all_rows_sql ($sql);
|
array ('utimestamp'));
|
||||||
|
|
||||||
if ($result === false)
|
if ($result === false)
|
||||||
$result = array ();
|
$result = array ();
|
||||||
|
|
||||||
$start = 0;
|
$start = 0;
|
||||||
$data = array_pad (array (), $interval, 0);
|
$max_value = 0;
|
||||||
|
|
||||||
foreach ($result as $access) {
|
foreach ($result as $access) {
|
||||||
|
$utimestamp = $access['utimestamp'];
|
||||||
for ($i = $start; $i < $interval; $i++) {
|
for ($i = $start; $i < $interval; $i++) {
|
||||||
if ($access['utimestamp'] < $time[$i]['timestamp_bottom'] && $access['utimestamp'] >= $time[$i]['timestamp_top']) {
|
if ($utimestamp <= $time[$i]['timestamp_top'] && $utimestamp >= $time[$i]['timestamp_bottom']) {
|
||||||
$data[$access['utimestamp']] = 1;
|
$data[$time[$i]['timestamp_bottom']] = 1;
|
||||||
$start = $i;
|
$start = $i;
|
||||||
|
$max_value = 1;
|
||||||
break;
|
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 () {
|
function graph_incidents_status () {
|
||||||
|
@ -1144,11 +1165,11 @@ if ($graphic_type) {
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case "agentaccess":
|
case "agentaccess":
|
||||||
graphic_agentaccess ($_GET["id"], $_GET["periodo"], $width, $height);
|
graphic_agentaccess ($id, $width, $height);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case "agentmodules":
|
case "agentmodules":
|
||||||
graphic_agentmodules ($_GET["id"], $width, $height);
|
graphic_agentmodules ($id, $width, $height);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case "progress":
|
case "progress":
|
||||||
|
|
Loading…
Reference in New Issue