diff --git a/pandora_console/include/functions_graph.php b/pandora_console/include/functions_graph.php
index ec3b2d7477..aff6ce4c7c 100644
--- a/pandora_console/include/functions_graph.php
+++ b/pandora_console/include/functions_graph.php
@@ -3565,7 +3565,7 @@ function graph_custom_sql_graph ($id, $width, $height,
* @param string homeurl
* @param bool return or echo the result
*/
-function graph_graphic_agentevents ($id_agent, $width, $height, $period = 0, $homeurl, $return = false, $id_module = 0) {
+function graph_graphic_agentevents ($id_agent, $width, $height, $period = 0, $homeurl, $return = false) {
global $config;
global $graphic_type;
@@ -3605,20 +3605,113 @@ function graph_graphic_agentevents ($id_agent, $width, $height, $period = 0, $ho
$full_legend[$cont] = $name;
$top = $datelimit + ($periodtime * ($i + 1));
- if ($id_module != 0) {
- $event = db_get_row_filter ('tevento',
- array ('id_agente' => $id_agent,
- 'utimestamp > '.$bottom,
- 'utimestamp < '.$top), 'criticity, utimestamp');
+ $event = db_get_row_filter ('tevento',
+ array ('id_agente' => $id_agent,
+ 'utimestamp > '.$bottom,
+ 'utimestamp < '.$top), 'criticity, utimestamp');
+
+ if (!empty($event['utimestamp'])) {
+ $data[$cont]['utimestamp'] = $periodtime;
+ switch ($event['criticity']) {
+ case EVENT_CRIT_WARNING:
+ $data[$cont]['data'] = 2;
+ break;
+ case EVENT_CRIT_CRITICAL:
+ $data[$cont]['data'] = 3;
+ break;
+ default:
+ $data[$cont]['data'] = 1;
+ break;
+ }
}
else {
- $event = db_get_row_filter ('tevento',
- array ('id_agente' => $id_agent,
- 'id_agentmodule' => $id_module,
- 'utimestamp > '.$bottom,
- 'utimestamp < '.$top), 'criticity, utimestamp');
+ $data[$cont]['utimestamp'] = $periodtime;
+ $data[$cont]['data'] = 1;
+ }
+ $cont++;
+ }
+
+ $colors = array(1 => COL_NORMAL, 2 => COL_WARNING, 3 => COL_CRITICAL, 4 => COL_UNKNOWN);
+
+ // Draw slicebar graph
+ if ($config['flash_charts']) {
+ $out = flot_slicesbar_graph($data, $period, $width, $height, $full_legend, $colors, $config['fontpath'], $config['round_corner'], $homeurl, '', '', false, $id_agent);
+ }
+ else {
+ $out = slicesbar_graph($data, $period, $width, $height, $colors, $config['fontpath'], $config['round_corner'], $homeurl);
+
+ // Draw legend
+ $out .= "
";
+ $out .= " ";
+ foreach ($legend as $hour) {
+ $out .= "" . $hour . "";
+ $out .= " ";
+ }
+ }
+
+ if ($return) {
+ return $out;
+ }
+ else {
+ echo $out;
+ }
+}
+
+/**
+ * Print a static graph with event data of agents
+ *
+ * @param integer id_agent Agent ID
+ * @param integer width pie graph width
+ * @param integer height pie graph height
+ * @param integer period time period
+ * @param string homeurl
+ * @param bool return or echo the result
+ */
+function graph_graphic_moduleevents ($id_agent, $id_module, $width, $height, $period = 0, $homeurl, $return = false) {
+ global $config;
+ global $graphic_type;
+
+ $data = array ();
+
+ $resolution = $config['graph_res'] * ($period * 2 / $width); // Number of "slices" we want in graph
+ $interval = (int) ($period / $resolution);
+ $date = get_system_time ();
+ $datelimit = $date - $period;
+ $periodtime = floor ($period / $interval);
+ $time = array ();
+ $data = array ();
+ $legend = array();
+ $full_legend = array();
+
+ $cont = 0;
+ for ($i = 0; $i < $interval; $i++) {
+ $bottom = $datelimit + ($periodtime * $i);
+ if (! $graphic_type) {
+ if ($config['flash_charts']) {
+ $name = date('H:i:s', $bottom);
+ }
+ else {
+ $name = date('H\h', $bottom);
+ }
+ }
+ else {
+ $name = $bottom;
}
+ // Show less values in legend
+ if ($cont == 0 or $cont % 2)
+ $legend[$cont] = $name;
+
+ $full_legend[$cont] = $name;
+
+ $top = $datelimit + ($periodtime * ($i + 1));
+
+ $event = db_get_row_filter ('tevento',
+ array ('id_agente' => $id_agent,
+ 'id_agentmodule' => $id_module,
+ 'utimestamp > '.$bottom,
+ 'utimestamp < '.$top), 'criticity, utimestamp');
+
if (!empty($event['utimestamp'])) {
$data[$cont]['utimestamp'] = $periodtime;
switch ($event['criticity']) {
diff --git a/pandora_console/include/functions_visual_map.php b/pandora_console/include/functions_visual_map.php
index 8bed46cbcc..d2ff9a643c 100755
--- a/pandora_console/include/functions_visual_map.php
+++ b/pandora_console/include/functions_visual_map.php
@@ -1097,27 +1097,27 @@ function visual_map_print_item($mode = "read", $layoutData,
if ($width == 0 || $height == 0) {
if ($layoutData['label_position']=='left') {
$img = '