Merge branch '3137-Pete_jquery_en_tree_view_metaconsola' into 'develop'
fixed error events graphs See merge request artica/pandorafms!2013
This commit is contained in:
commit
9fef25c9a4
|
@ -3188,16 +3188,14 @@ 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, $from_agent_view = false) {
|
||||
function graph_graphic_agentevents ($id_agent, $width, $height, $period = 0, $homeurl, $return = false, $from_agent_view = false, $widgets=false) {
|
||||
global $config;
|
||||
global $graphic_type;
|
||||
|
||||
$data = array ();
|
||||
|
||||
//$resolution = $config['graph_res'] * ($period * 2 / $width); // Number of "slices" we want in graph
|
||||
$resolution = 5 * ($period * 2 / $width); // Number of "slices" we want in graph
|
||||
|
||||
$interval = (int) ($period / $resolution);
|
||||
//TODO interval
|
||||
$interval = 24;
|
||||
$date = get_system_time ();
|
||||
$datelimit = $date - $period;
|
||||
$periodtime = floor ($period / $interval);
|
||||
|
@ -3206,7 +3204,7 @@ function graph_graphic_agentevents ($id_agent, $width, $height, $period = 0, $ho
|
|||
$legend = array();
|
||||
$full_legend = array();
|
||||
$full_legend_date = array();
|
||||
|
||||
|
||||
$cont = 0;
|
||||
for ($i = 0; $i < $interval; $i++) {
|
||||
$bottom = $datelimit + ($periodtime * $i);
|
||||
|
@ -3216,24 +3214,24 @@ function graph_graphic_agentevents ($id_agent, $width, $height, $period = 0, $ho
|
|||
else {
|
||||
$name = $bottom;
|
||||
}
|
||||
|
||||
|
||||
// Show less values in legend
|
||||
if ($cont == 0 or $cont % 2)
|
||||
$legend[$cont] = $name;
|
||||
|
||||
|
||||
if ($from_agent_view) {
|
||||
$full_date = date('Y/m/d', $bottom);
|
||||
$full_legend_date[$cont] = $full_date;
|
||||
}
|
||||
|
||||
$full_legend[$cont] = $name;
|
||||
|
||||
|
||||
$top = $datelimit + ($periodtime * ($i + 1));
|
||||
$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']) {
|
||||
|
@ -3258,7 +3256,7 @@ function graph_graphic_agentevents ($id_agent, $width, $height, $period = 0, $ho
|
|||
$colors = array(1 => COL_NORMAL, 2 => COL_WARNING, 3 => COL_CRITICAL, 4 => COL_UNKNOWN);
|
||||
|
||||
// Draw slicebar graph
|
||||
$out = flot_slicesbar_graph($data, $period, 100, 40, $full_legend, $colors, $config['fontpath'], $config['round_corner'], $homeurl, '', '', false, $id_agent, $full_legend_date);
|
||||
$out = flot_slicesbar_graph($data, $period, $width, $height, $full_legend, $colors, $config['fontpath'], $config['round_corner'], $homeurl, '', '', false, $id_agent, $full_legend_date, 0, 1, $widgets);
|
||||
|
||||
if ($return) {
|
||||
return $out;
|
||||
|
|
|
@ -714,20 +714,15 @@ function treeview_printTable($id_agente, $server_data = array(), $no_head = fals
|
|||
|
||||
ui_toggle($table_advanced, __('Advanced information'));
|
||||
|
||||
// Blank space below title, DONT remove this, this
|
||||
// Breaks the layout when Flash charts are enabled :-o
|
||||
//echo '<div id="id_div" style="height: 10px"> </div>';
|
||||
|
||||
if ($config["agentaccess"]) {
|
||||
$access_graph = '<div style="width:100%; height:130px;">';
|
||||
$access_graph .= graphic_agentaccess($id_agente, 380, 120, SECONDS_1DAY, true, true);
|
||||
$access_graph .= graphic_agentaccess ($id_agente, 380, 120, SECONDS_1DAY, true, true);
|
||||
$access_graph .= '</div>';
|
||||
ui_toggle($access_graph, __('Agent access rate (24h)'));
|
||||
}
|
||||
|
||||
$events_graph = '<div style="margin-left: 10px;">';
|
||||
$events_graph .= graph_graphic_agentevents ($id_agente, 290, 15,
|
||||
SECONDS_1DAY, '', true);
|
||||
$events_graph = '<div style="margin-left:10px; width:100%;">';
|
||||
$events_graph .= graph_graphic_agentevents ($id_agente, 375, 45, SECONDS_1DAY, '', true, false, true);
|
||||
$events_graph .= '</div><br>';
|
||||
|
||||
ui_toggle($events_graph, __('Events (24h)'));
|
||||
|
|
|
@ -645,7 +645,7 @@ $data[0][0] .=
|
|||
__('Events (24h)') .
|
||||
'</th></tr>' .
|
||||
'<tr><td style="text-align:center;padding-left:20px;padding-right:20px;"><br />' .
|
||||
graph_graphic_agentevents ($id_agente, 450, 40, SECONDS_1DAY, '', true, true) .
|
||||
graph_graphic_agentevents ($id_agente, 100, 45, SECONDS_1DAY, '', true, true) .
|
||||
'<br /></td></tr>' .
|
||||
'</table>';
|
||||
|
||||
|
|
Loading…
Reference in New Issue