2009-08-05 Sancho Lerena <slerena@artica.es>

* include/styles/pandora.css: Adjusted head and removed small heigh 
	problems in some tabs (agent and search sections).
		
	* include/javascript/pandora.js: winopeng call for module graph is now 
	widther.
	
	* index.php: Now defined a default search for agents().
	
	* general/header.php: Redesign of header.
	
	* general/pandora_help.php: Some visual changes in background and footer.
	
	* godmode/modificar_agente.php: Create button replaced.
	
	* fgraph.php: Fixed the string graphs and fixed a lot other issues.
	
	* include/functions_visual_map.php: Module images are shown in pure mode 
	(without title) and adding the title defined by user in map definition.
	
	* include/pandora_graph.php: Added default colors (up to 9) for combined
	graphs.

	* include/pchart_graph.php: Created a new method to render datetime
	data in X axis legend. Reformatted combined and static graph to remove
	transparent background, title and other issues reported. Also combined
	stack graph now works adding data from one series to another. 
	
	* include/help/en/help_agent_status.php: new help file for agent status.
	
	* include/pChart/pChart.class: Added new method for format datetime in two 
	lines with full date and time information.
	
	* operation/search_results.php: reformatted tabs.
	
	* operation/agentes/estado_agente.php: removed status information legend 
	and added a help icon.
	
	* godmode/reporting/graph_builder.php,
	  operation/reporting/graph_viewer.php: Added new graph mode: stacked line.
	


git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1829 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
slerena 2009-08-06 18:55:54 +00:00
parent 6ef05e688f
commit 99812a16f0
21 changed files with 393 additions and 275 deletions

View File

@ -1,3 +1,46 @@
2009-08-05 Sancho Lerena <slerena@artica.es>
* include/styles/pandora.css: Adjusted head and removed small heigh
problems in some tabs (agent and search sections).
* include/javascript/pandora.js: winopeng call for module graph is now
widther.
* index.php: Now defined a default search for agents().
* general/header.php: Redesign of header.
* general/pandora_help.php: Some visual changes in background and footer.
* godmode/modificar_agente.php: Create button replaced.
* fgraph.php: Fixed the string graphs and fixed a lot other issues.
* include/functions_visual_map.php: Module images are shown in pure mode
(without title) and adding the title defined by user in map definition.
* include/pandora_graph.php: Added default colors (up to 9) for combined
graphs.
* include/pchart_graph.php: Created a new method to render datetime
data in X axis legend. Reformatted combined and static graph to remove
transparent background, title and other issues reported. Also combined
stack graph now works adding data from one series to another.
* include/help/en/help_agent_status.php: new help file for agent status.
* include/pChart/pChart.class: Added new method for format datetime in two
lines with full date and time information.
* operation/search_results.php: reformatted tabs.
* operation/agentes/estado_agente.php: removed status information legend
and added a help icon.
* godmode/reporting/graph_builder.php,
operation/reporting/graph_viewer.php: Added new graph mode: stacked line.
2009-07-29 Miguel de Dios <miguel.dedios@artica.es> 2009-07-29 Miguel de Dios <miguel.dedios@artica.es>
* operation/search_results.php: fix a query for search alerts. And changed * operation/search_results.php: fix a query for search alerts. And changed

View File

@ -17,7 +17,7 @@ require_once ("include/functions_messages.php");
?> ?>
<table width="100%" cellpadding="0" cellspacing="0" style="margin:0px; padding:0px;" border="0"> <table width="100%" cellpadding="0" cellspacing="0" style="margin:0px; padding:0px;" border="0">
<tr> <tr>
<td><div id="pandora_logo_header"></div></td> <td rowspan=2><div id="pandora_logo_header"></div></td>
<td width="20%"> <td width="20%">
<img src="images/user_<?=((is_user_admin ($config["id_user"]) == 1) ? 'suit' : 'green' );?>.png" class="bot" alt="user" /> <img src="images/user_<?=((is_user_admin ($config["id_user"]) == 1) ? 'suit' : 'green' );?>.png" class="bot" alt="user" />
<a href="index.php?sec=usuarios&sec2=operation/users/user_edit" class="white"><?=__('You are');?> [<b><?=$config["id_user"];?></b>]</a> <a href="index.php?sec=usuarios&sec2=operation/users/user_edit" class="white"><?=__('You are');?> [<b><?=$config["id_user"];?></b>]</a>
@ -35,14 +35,11 @@ require_once ("include/functions_messages.php");
echo '</a>'; echo '</a>';
} }
?> ?>
<br /> &nbsp;
<br /> <a class="white_bold" href="index.php?bye=bye"><img src="images/log-out.png" alt="<?=__('Logout');?>" class="bot" /></a>
<a class="white_bold" href="index.php?bye=bye"><img src="images/log-out.png" alt="<?=__('Logout');?>" class="bot" /> <?=__('Logout');?></a>
</td> </td>
<td width="20%"> <td width="20%">
<a class="white_bold" href="index.php?sec=main"><img src="images/information.png" alt="info" class="bot" /><?=__('General information');?></a>
<br />
<br />
<a class="white_bold" href="index.php?sec=estado_server&sec2=operation/servers/view_server&refr=60"> <a class="white_bold" href="index.php?sec=estado_server&sec2=operation/servers/view_server&refr=60">
<?php <?php
$servers["all"] = (int) get_db_value ('COUNT(id_server)','tserver'); $servers["all"] = (int) get_db_value ('COUNT(id_server)','tserver');
@ -93,26 +90,21 @@ require_once ("include/functions_messages.php");
unset ($values); unset ($values);
echo '</span>'; echo '</span>';
} }
?> echo "</td>";
<br /> echo "<td width='20%' rowspan=2>";
<br /> echo "<a href='index.php?sec=main'>";
<a class="white_bold" href="index.php?sec=eventos&sec2=operation/events/events&refr=5"> echo "<div id='head_r'><span id='logo_text1'>Pandora</span> <span id='logo_text2'>FMS</span></div>";
<img src="images/lightning_go.png" alt="lightning_go" class="bot" /> <?=__('Events');?> if (file_exists (ENTERPRISE_DIR."/load_enterprise.php"))
</a> echo '<div id="logo_text3">Enterprise</div>';
</td> else
<td width="20%"> echo '<div id="logo_text3">OpenSource</div>';
<div id="head_r"><span id="logo_text1">Pandora</span> <span id="logo_text2">FMS</span></div> echo "</A>";
<?php ?>
if (file_exists (ENTERPRISE_DIR."/load_enterprise.php"))
echo '<div id="logo_text3">Enterprise</div>';
else
echo '<div id="logo_text3">OpenSource</div>';
?>
</td> </td>
</tr> </tr>
<tr> <tr>
<td colspan="5" style="padding: 0; height: 20px;"> <td colspan=2>
<form method="get" style="" valign="middle"> <form method="get" style="" valign="middle" name="quicksearch">
<script type="text/javascript" language="javascript"> <script type="text/javascript" language="javascript">
var fieldKeyWordEmpty = true; var fieldKeyWordEmpty = true;
</script> </script>
@ -125,36 +117,13 @@ require_once ("include/functions_messages.php");
else echo "value='" . $config['search_keywords'] . "'"; else echo "value='" . $config['search_keywords'] . "'";
?> ?>
onfocus="javascript: if (fieldKeyWordEmpty) $('#keywords').val('');" onfocus="javascript: if (fieldKeyWordEmpty) $('#keywords').val('');"
size="119" style="background: white url('images/lupa_15x15.png') no-repeat left; padding: 0; padding-left:15px; margin: 0; width: 70%; margin-left: 2px;" /> size="100" style="background: white url('images/lupa_15x15.png') no-repeat right; padding: 0; padding-left:0px; margin: 0; width: 90%; height: 19px; margin-bottom: 5px; margin-left: 2px;" />
<?php <!-- onClick="javascript: document.quicksearch.submit()" -->
if (isset($config['search_category'])) <input type='hidden' name='head_search_keywords' value='abc'>
$selected = $config['search_category']; </form>
else <td>
$selected = 'all'; <a class="white_bold" href="index.php?sec=eventos&sec2=operation/events/events&refr=5"><img src="images/lightning_go.png" alt="lightning_go" class="bot">&nbsp;Events</a>
$values = array ( </td>
//'adsf' => ((strlen(__("Search")) > 12) ? (substr(__("0123456789AB"), 0, 12) . "&hellip;") : __("0123456789AB")),
'all' => ((strlen(__("All")) > 12) ? (substr(__("All"), 0, 12) . "&hellip;") : __("All")),
'users' => ((strlen(__("Users")) > 12) ? (substr(__("Users"), 0, 12) . "&hellip;") : __("Users")),
'alerts' => ((strlen(__("Alerts")) > 12) ? (substr(__("Alerts"), 0, 12) . "&hellip;") : __("Alerts")),
'reports' => ((strlen(__("Reports")) > 12) ? (substr(__("Reports"), 0, 12) . "&hellip;") : __("Reports"))
);
//INI SECURITY ACL
if (check_acl ($config['id_user'], 0, "AW") || check_acl ($config['id_user'], 0, "AR")) {
$values['agents'] = ((strlen(__("Agents")) > 12) ? (substr(__("Agents"), 0, 12) . "&hellip;") : __("Agents"));
$values['graphs'] = ((strlen(__("Graphs")) > 12) ? (substr(__("Graphs"), 0, 12) . "&hellip;") : __("Graphs"));
}
if (give_acl ($config["id_user"], 0, "AR"))
$values['maps'] = ((strlen(__("Maps")) > 12) ? (substr(__("Maps"), 0, 12) . "&hellip;") : __("Maps"));;
//END SECURITY ACL
print_select_style ($values, 'search_category', $selected, "min-width: 12em;");
?>
<input id="submit-srcbutton" name="head_search_keywords"
value="<?=((strlen(__("Search")) > 12) ? (substr(__("0123456789ABCD"), 0, 12) . "&hellip;") : __("Search")); ?>"
class="sub" type="submit" style="min-width: 12em; height: 23px;" />
</form>
</td>
</tr> </tr>
</table> </table>
<?php <?php

View File

@ -19,7 +19,7 @@ require_once ("../include/functions.php");
echo '<html><head><title>'.__('Pandora FMS help system').'</title></head>'; echo '<html><head><title>'.__('Pandora FMS help system').'</title></head>';
echo '<link rel="stylesheet" href="../include/styles/'.$config['style'].'.css" type="text/css">'; echo '<link rel="stylesheet" href="../include/styles/'.$config['style'].'.css" type="text/css">';
echo '<body>'; echo '<body style="background-color: #fff;">';
$id = get_parameter ('id'); $id = get_parameter ('id');
@ -62,7 +62,7 @@ echo '<div style="font-size: 12px; margin-left: 30px; margin-right:25px;">';
require_once ($help_file); require_once ($help_file);
echo '</div>'; echo '</div>';
echo '<br /><br /><hr width="100%" size="1" />'; echo '<br /><br /><hr width="100%" size="1" />';
echo '<div style="font-family: verdana, arial; font-size: 11px;">'; echo '<div style="background-color: #CCC; font-family: verdana, arial; font-size: 11px;">';
include ('footer.php'); include ('footer.php');
?> ?>
</body> </body>

View File

@ -185,7 +185,7 @@ if ($id_agente) {
echo '<div id="menu_tab_frame"><div id="menu_tab_left"><ul class="mn">'; 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.'">'; 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_style); print_image ("images/setup.png", false, $img_style);
echo '&nbsp; '.mb_substr (get_agent_name ($id_agente), 0, 21).'</a>'; echo '&nbsp; '.mb_substr(get_agent_name ($id_agente), 0, 15) .'</a>';
echo "</li></ul></div>"; echo "</li></ul></div>";
echo '<div id="menu_tab"><ul class="mn"><li class="nomn">'; echo '<div id="menu_tab"><ul class="mn"><li class="nomn">';

View File

@ -63,7 +63,7 @@ if (isset($_POST["ag_group"])){
action='index.php?sec=gagente&sec2=godmode/agentes/modificar_agente'>"; action='index.php?sec=gagente&sec2=godmode/agentes/modificar_agente'>";
} }
echo "<table cellpadding='4' cellspacing='4' class='databox' width=700><tr>"; echo "<table cellpadding='4' cellspacing='4' class='databox' width=770><tr>";
echo "<td valign='top'>".__('Group')."</td>"; echo "<td valign='top'>".__('Group')."</td>";
echo "<td valign='top'>"; echo "<td valign='top'>";
echo "<select name='ag_group' onChange='javascript:this.form.submit();' echo "<select name='ag_group' onChange='javascript:this.form.submit();'
@ -99,6 +99,12 @@ echo "<input type=text name='search' size='15' >";
echo "</td><td valign='top'>"; echo "</td><td valign='top'>";
echo "<input name='srcbutton' type='submit' class='sub' value='".__('Search')."'>"; echo "<input name='srcbutton' type='submit' class='sub' value='".__('Search')."'>";
echo "</form>"; echo "</form>";
echo "<td>";
echo '<form method="post" action="index.php?sec=gagente&amp;sec2=godmode/agentes/configurar_agente">';
print_input_hidden ('new_agent', 1);
print_submit_button (__('Create agent'), 'crt', false, 'class="sub next"');
echo "</form>";
echo "</td></table>"; echo "</td></table>";
$search_sql = ''; $search_sql = '';
@ -148,13 +154,6 @@ echo "<div style='height: 20px'> </div>";
if ($agents !== false) { if ($agents !== false) {
// Create agent button
echo "<table width='95%'><tr><td align='right'>";
echo '<form method="post" action="index.php?sec=gagente&amp;sec2=godmode/agentes/configurar_agente">';
print_input_hidden ('new_agent', 1);
print_submit_button (__('Create agent'), 'crt', false, 'class="sub next"');
echo "</form></td></tr></table>";
echo "<table cellpadding='4' id='agent_list' cellspacing='4' width='95%' class='databox'>"; echo "<table cellpadding='4' id='agent_list' cellspacing='4' width='95%' class='databox'>";
echo "<th>".__('Agent name')."</th>"; echo "<th>".__('Agent name')."</th>";
echo "<th title='".__('Remote agent configuration')."'>".__('R')."</th>"; echo "<th title='".__('Remote agent configuration')."'>".__('R')."</th>";
@ -184,7 +183,7 @@ if ($agents !== false) {
echo '<span class="left">'; echo '<span class="left">';
echo "<strong><a href='index.php?sec=gagente& echo "<strong><a href='index.php?sec=gagente&
sec2=godmode/agentes/configurar_agente&tab=main& sec2=godmode/agentes/configurar_agente&tab=main&
id_agente=".$agent["id_agente"]."'>".substr(strtoupper($agent["nombre"]),0,20)."</a></strong>"; id_agente=".$agent["id_agente"]."'>".substr(salida_limpia($agent["nombre"]),0,20)."</a></strong>";
if ($agent["disabled"]) { if ($agent["disabled"]) {
echo "</em>"; echo "</em>";
} }
@ -241,6 +240,7 @@ if ($agents !== false) {
} }
// Create agent button // Create agent button
echo '<a name="bottom">';
echo '<form method="post" action="index.php?sec=gagente&amp;sec2=godmode/agentes/configurar_agente">'; echo '<form method="post" action="index.php?sec=gagente&amp;sec2=godmode/agentes/configurar_agente">';
print_input_hidden ('new_agent', 1); print_input_hidden ('new_agent', 1);
print_submit_button (__('Create agent'), 'crt', false, 'class="sub next"'); print_submit_button (__('Create agent'), 'crt', false, 'class="sub next"');

View File

@ -396,6 +396,7 @@ echo "<option value=21600>"."6 ".__('hours')."</option>";
echo "<option value=43200>"."12 ".__('hours')."</option>"; echo "<option value=43200>"."12 ".__('hours')."</option>";
echo "<option value=86400>".__('Last day')."</option>"; echo "<option value=86400>".__('Last day')."</option>";
echo "<option value=172800>"."2 ".__('days')."</option>"; echo "<option value=172800>"."2 ".__('days')."</option>";
echo "<option value=345600>"."4 ".__('days')."</option>";
echo "<option value=604800>".__('Last week')."</option>"; echo "<option value=604800>".__('Last week')."</option>";
echo "<option value=1296000>"."15 ".__('15 days')."</option>"; echo "<option value=1296000>"."15 ".__('15 days')."</option>";
echo "<option value=2592000>".__('Last month')."</option>"; echo "<option value=2592000>".__('Last month')."</option>";
@ -425,6 +426,7 @@ echo "<td class='datos2'>";
$stackeds[0] = __('Area'); $stackeds[0] = __('Area');
$stackeds[1] = __('Stacked area'); $stackeds[1] = __('Stacked area');
$stackeds[2] = __('Line'); $stackeds[2] = __('Line');
$stackeds[3] = __('Stacked line');
print_select ($stackeds, 'stacked', $stacked, '', '', 0); print_select ($stackeds, 'stacked', $stacked, '', '', 0);
echo "</td>"; echo "</td>";

View File

@ -15,7 +15,7 @@
if ($config) { if (isset($config)) {
require_once ($config['homedir'].'/include/config.php'); require_once ($config['homedir'].'/include/config.php');
require_once ($config['homedir'].'/include/pandora_graph.php'); require_once ($config['homedir'].'/include/pandora_graph.php');
require_once ($config['homedir'].'/include/functions_fsgraph.php'); require_once ($config['homedir'].'/include/functions_fsgraph.php');
@ -277,7 +277,7 @@ function graphic_combined_module ($module_list, $weight_list, $period, $width, $
$engine->data = &$real_data; $engine->data = &$real_data;
$engine->legend = $module_list_name; $engine->legend = $module_list_name;
$engine->fontpath = $config['fontpath']; $engine->fontpath = $config['fontpath'];
$engine->title = ' '.strtoupper ($nombre_agente)." - ".__('Module').' '.$title; $engine->title = "";
$engine->subtitle = ' '.__('Period').': '.$title_period; $engine->subtitle = ' '.__('Period').': '.$title_period;
$engine->show_title = !$pure; $engine->show_title = !$pure;
$engine->stacked = $stacked; $engine->stacked = $stacked;
@ -1046,7 +1046,7 @@ function grafico_db_agentes_purge ($id_agent, $width, $height) {
function progress_bar ($progress, $width, $height, $mode = 1) { function progress_bar ($progress, $width, $height, $mode = 1) {
global $config; global $config;
if ($progress > 100 || $progress < 0) { if ($progress > 100 || $progress < 0) {
graphic_error ('outof.png'); graphic_error ('outof.png');
} }
@ -1254,120 +1254,58 @@ function grafico_modulo_string ($id_agente_modulo, $period, $show_event,
global $config; global $config;
global $graphic_type; global $graphic_type;
$resolution = $config['graph_res'] * 50; // Number of "slices" we want in graph // This code has been rewritten, taking code from 2.x and adjusted to work
// with new code for flash and new pchart functions. (slerena/ago09)
if (! $date)
$date = get_system_time ();
$datelimit = $date - $period; // limit date
$interval = (int) ($period / $resolution); // Each interval is $interval seconds length
$nombre_agente = get_agentmodule_agent_name ($id_agente_modulo);
$id_agente = get_agent_id ($nombre_agente);
$nombre_modulo = get_agentmodule_name ($id_agente_modulo);
if ($show_event == 1) if ($date == "")
$real_event = array (); $date = time ();
$resolution = $config["graph_res"] * 5; // Number of "slices" we want in graph
$fechatope = $date - $period;
$horasint = $period / $resolution; // Each intervalo is $horasint seconds length
if ($show_alert == 1) { // Creamos la tabla (array) con los valores para el grafico. Inicializacion
$alert_high = false; for ($i = 0; $i <$resolution; $i++) {
$alert_low = false; $valores[$i][0] = 0; // [0] Valor (contador)
// If we want to show alerts limits $valores[$i][1] = $fechatope + ($horasint * $i);
$valores[$i][2] = $fechatope + ($horasint * $i); // [2] Top limit for this range
$valores[$i][3] = $fechatope + ($horasint * ($i + 1)); // [3] Botom limit
}
$sql1="SELECT utimestamp FROM tagente_datos_string WHERE id_agente_modulo = ".$id_agente_modulo." and utimestamp > '".$fechatope."'";
$result=mysql_query($sql1);
while ($row=mysql_fetch_array($result)){
for ($i = 0; $i < $resolution; $i++){
if (($row[0] < $valores[$i][3]) and ($row[0] >= $valores[$i][2]) ){
// entra en esta fila
$valores[$i][0]++;
}
}
$alert_high = get_db_value ('MAX(max_value)', 'talert_template_modules', 'id_agent_module', (int) $id_agente_modulo); }
$alert_low = get_db_value ('MIN(min_value)', 'talert_template_modules', 'id_agent_module', (int) $id_agente_modulo); $valor_maximo = 0;
for ($i = 0; $i < $resolution; $i++) { // 30 entries in graph, one by day
// if no valid alert defined to render limits, disable it $grafica[$valores[$i][1]]=$valores[$i][0];
if (($alert_low === false || $alert_low === NULL) && if ($valores[$i][0] > $valor_maximo)
($alert_high === false || $alert_high === NULL)) { $valor_maximo = $valores[$i][0];
$show_alert = 0;
}
} }
// interval - This is the number of "rows" we are divided the time // Rewrite data in format understable by flash charts
// to fill data. more interval, more resolution, and slower.
// periodo - Gap of time, in seconds. This is now to (now-periodo) secs
// Init tables for ($i = 0; $i < $resolution; $i++) { // 30 entries in graph, one by day
for ($i = 0; $i <= $resolution; $i++) { $data[$i]['sum'] = $valores[$i][0];
$data[$i]['sum'] = 0; // SUM of all values for this interval $data[$i]['count'] = $valores[$i][0];
$data[$i]['count'] = 0; // counter $data[$i]['timestamp_bottom'] = $valores[$i][2];
$data[$i]['timestamp_bottom'] = $datelimit + ($interval * $i); // [2] Top limit for this range $data[$i]['timestamp_top'] = $valores[$i][3];
$data[$i]['timestamp_top'] = $datelimit + ($interval * ($i + 1)); // [3] Botom limit $data[$i]['min'] = 0; // MIN
$data[$i]['min'] = 1; // MIN $data[$i]['max'] = $valores[$i][0];
$data[$i]['max'] = 0; // MAX
$data[$i]['last'] = 0; // Last value
$data[$i]['events'] = 0; // Event $data[$i]['events'] = 0; // Event
} }
// Init other general variables
if ($show_event == 1) { if ($valor_maximo <= 0) {
// If we want to show events in graphs graphic_error ();
$sql = "SELECT utimestamp FROM tevento WHERE id_agente = $id_agente AND utimestamp > $datelimit"; return;
$result = get_db_all_rows_sql ($sql);
foreach ($result as $row) {
$utimestamp = $row['utimestamp'];
for ($i = 0; $i <= $resolution; $i++) {
if ($utimestamp <= $data[$i]['timestamp_top'] && $utimestamp >= $data[$i]['timestamp_bottom']) {
$data['events']++;
}
}
}
}
// Init other general variables
$max_value = 0;
$all_data = get_db_all_rows_filter ('tagente_datos_string',
array ('id_agente_modulo' => $id_agente_modulo,
"utimestamp > $datelimit",
"utimestamp < $date",
'order' => 'utimestamp ASC'),
array ('datos', 'utimestamp'));
if ($all_data === false) {
$all_data = array ();
}
foreach ($all_data as $module_data) {
$real_data = 1;
$utimestamp = $module_data["utimestamp"];
for ($i = 0; $i <= $resolution; $i++) {
if ($utimestamp <= $data[$i]['timestamp_top'] && $utimestamp >= $data[$i]['timestamp_bottom']) {
$data[$i]['sum'] += $real_data;
$data[$i]['count']++;
$data[$i]['last'] = $real_data;
$data[$i]['min'] = min ($data[$i]['min'], $real_data);
$data[$i]['max'] = max ($data[$i]['max'], $real_data);
}
}
}
$previous = (float) get_previous_data ($id_agente_modulo, $datelimit);
// Calculate Average value for $data[][0]
for ($i = 0; $i <= $resolution; $i++) {
if ($data[$i]['count'] == 0) {
$data[$i]['sum'] = $previous;
$data[$i]['min'] = $previous;
$data[$i]['max'] = $previous;
$data[$i]['last'] = $previous;
$previous = $data[$i]['sum'];
} else {
$previous = $data[$i]['sum'];
if ($data[$i]['count'] > 1) {
$previous = $data[$i]['last'];
$data[$i]['sum'] = floor ($data[$i]['sum'] / $data[$i]['count']);
}
}
// Get max value for all graph
$max_value = max ($max_value, $data[$i]['max']);
}
$grafica = array ();
foreach ($data as $d) {
$grafica[$d['timestamp_bottom']] = $d['sum'];
} }
if ($period <= 3600) { if ($period <= 3600) {
@ -1396,7 +1334,12 @@ function grafico_modulo_string ($id_agente_modulo, $period, $show_event,
$engine->width = $width; $engine->width = $width;
$engine->height = $height; $engine->height = $height;
$engine->data = &$grafica; $engine->data = &$grafica;
$engine->max_value = $max_value; $engine->max_value = $valor_maximo;
$nombre_agente = get_agentmodule_agent_name ($id_agente_modulo);
$nombre_modulo = get_agentmodule_name ($id_agente_modulo);
$id_agente = get_agent_id ($nombre_agente);
$engine->legend = array ($nombre_modulo); $engine->legend = array ($nombre_modulo);
$engine->title = ' '.strtoupper ($nombre_agente)." - ".__('Module').' '.$title; $engine->title = ' '.strtoupper ($nombre_agente)." - ".__('Module').' '.$title;
$engine->subtitle = ' '.__('Period').': '.$title_period; $engine->subtitle = ' '.__('Period').': '.$title_period;
@ -1406,15 +1349,11 @@ function grafico_modulo_string ($id_agente_modulo, $period, $show_event,
$engine->alert_top = $show_alert ? $alert_high : false; $engine->alert_top = $show_alert ? $alert_high : false;
$engine->alert_bottom = $show_alert ? $alert_low : false;; $engine->alert_bottom = $show_alert ? $alert_low : false;;
if ($period < 10000) $engine->xaxis_interval = $resolution/5;
$engine->xaxis_interval = 20;
else
$engine->xaxis_interval = $resolution * 4;
$engine->yaxis_interval = 1; $engine->yaxis_interval = 1;
$engine->xaxis_format = 'date'; $engine->xaxis_format = 'datetime';
$engine->single_graph (); $engine->single_graph ();
return; return;
} }
@ -1555,6 +1494,10 @@ if ($graphic_type) {
generic_pie_graph ($width, $height, $data); generic_pie_graph ($width, $height, $data);
break; break;
case 'string':
grafico_modulo_string ($id, $period, $draw_events, $width, $height, $label, $unit_name, $draw_alerts, $avg_only, $pure, $date);
break;
default: default:
graphic_error (); graphic_error ();
} }

View File

@ -117,7 +117,7 @@ function safe_int ($value, $min = false, $max = false) {
} }
/** /**
* @deprecated Use get_parameter or safe_input functions * Use to clean HTML entities when get_parameter or safe_input functions dont work
* *
* @param string String to be cleaned * @param string String to be cleaned
* *
@ -1002,4 +1002,6 @@ function index_array ($array, $index = 'id', $value = 'name') {
return $retval; return $retval;
} }
?> ?>

View File

@ -222,6 +222,10 @@ function print_pandora_visual_map ($id_layout, $show_links = true, $draw_lines =
else else
echo '<div style="z-index: 1; color: '.$layout_data['label_color'].'; position: absolute; margin-left: '.$layout_data['pos_x'].'px; margin-top:'.$layout_data['pos_y'].'px;" id="layout-data-'.$layout_data['id'].'" class="layout-data">'; echo '<div style="z-index: 1; color: '.$layout_data['label_color'].'; position: absolute; margin-left: '.$layout_data['pos_x'].'px; margin-top:'.$layout_data['pos_y'].'px;" id="layout-data-'.$layout_data['id'].'" class="layout-data">';
echo $layout_data['label'];
echo "<br>";
if ($show_links) { if ($show_links) {
if (($layout_data['id_layout_linked'] == "") || ($layout_data['id_layout_linked'] == 0)) { if (($layout_data['id_layout_linked'] == "") || ($layout_data['id_layout_linked'] == 0)) {
echo '<a href="index.php?sec=estado&amp;sec2=operation/agentes/ver_agente&amp;id_agente='.$id_agent.'&amp;tab=data">'; echo '<a href="index.php?sec=estado&amp;sec2=operation/agentes/ver_agente&amp;id_agente='.$id_agent.'&amp;tab=data">';
@ -230,9 +234,9 @@ function print_pandora_visual_map ($id_layout, $show_links = true, $draw_lines =
} }
} }
if ($resizedMap) if ($resizedMap)
print_image ("include/fgraph.php?tipo=sparse&amp;id=".$layout_data['id_agente_modulo']."&amp;label=".safe_input ($layout_data['label'])."&amp;height=".((integer)($proportion * $layout_data['height']))."&amp;width=".((integer)($proportion * $layout_data['width']))."&amp;period=".$layout_data['period'], false, array ("title" => $layout_data['label'], "border" => 0)); print_image ("include/fgraph.php?tipo=sparse&amp;id=".$layout_data['id_agente_modulo']."&amp;label=".safe_input ($layout_data['label'])."&amp;height=".((integer)($proportion * $layout_data['height']))."&pure=1&amp;width=".((integer)($proportion * $layout_data['width']))."&amp;period=".$layout_data['period'], false, array ("title" => $layout_data['label'], "border" => 0));
else else
print_image ("include/fgraph.php?tipo=sparse&amp;id=".$layout_data['id_agente_modulo']."&amp;label=".safe_input ($layout_data['label'])."&amp;height=".$layout_data['height']."&amp;width=".$layout_data['width']."&amp;period=".$layout_data['period'], false, array ("title" => $layout_data['label'], "border" => 0)); print_image ("include/fgraph.php?tipo=sparse&amp;id=".$layout_data['id_agente_modulo']."&amp;label=".safe_input ($layout_data['label'])."&amp;height=".$layout_data['height']."&pure=1&amp;width=".$layout_data['width']."&amp;period=".$layout_data['period'], false, array ("title" => $layout_data['label'], "border" => 0));
echo "</a>"; echo "</a>";
echo "</div>"; echo "</div>";
break; break;

View File

@ -0,0 +1,24 @@
<h1>Agent status view </h1>
Possible values of an agent status are:
<br><br>
<table width=750px><tr>
<td class="f9i"><img src="../images/status_sets/default/agent_ok.png" title="All Monitors OK" alt="All Monitors OK"><td>All Monitors OK</td>
<td class="f9i"><img src="../images/status_sets/default/module_critical.png" title="At least one monitor fails" alt="At least one monitor fails"><td>At least one monitor fails</td>
<td class="f9i"><img src="../images/status_sets/default/module_warning.png" title="Change between Green/Red state" alt="Change between Green/Red state"><td>Change between Green/Red state</td>
<td class="f9i"><img src="../images/status_sets/default/alert_fired.png" title="Alert fired" alt="Alert fired"><td>Alert fired</td>
<td class="f9i"><img src="../images/status_sets/default/alert_disabled.png" title="Alert disabled" alt="Alert disabled"><td>Alerts disabled</td>
</tr><tr>
<td class="f9i"><img src="../images/status_sets/default/agent_no_monitors.png" title="Agent without monitors" alt="Agent without monitors"><td>Agent without monitors</td>
<td class="f9i"><img src="../images/status_sets/default/agent_no_data.png" title="Agent without data" alt="Agent without data"><td>Agent without data</td>
<td class="f9i"><img src="../images/status_sets/default/agent_down.png" title="Agent down" alt="Agent down"><td>Agent down</td>
<td class="f9i"><img src="../images/status_sets/default/alert_not_fired.png" title="Alert not fired" alt="Alert not fired"><td>Alert not fired</td>
</tr>
</table>

View File

@ -10,7 +10,7 @@ function toggleDiv (divid){
} }
function winopeng (url, wid) { function winopeng (url, wid) {
open (url, wid,"width=570,height=310,status=no,toolbar=no,menubar=no,scrollbar=no"); open (url, wid,"width=590,height=310,status=no,toolbar=no,menubar=no,scrollbar=no");
// WARNING !! Internet Explorer DOESNT SUPPORT "-" CARACTERS IN WINDOW HANDLE VARIABLE // WARNING !! Internet Explorer DOESNT SUPPORT "-" CARACTERS IN WINDOW HANDLE VARIABLE
status =wid; status =wid;
} }

View File

@ -561,6 +561,9 @@
$Value = $this->ToMetric($Value); $Value = $this->ToMetric($Value);
if ( $DataDescription["Format"]["Y"] == "currency" ) if ( $DataDescription["Format"]["Y"] == "currency" )
$Value = $this->ToCurrency($Value); $Value = $this->ToCurrency($Value);
if ( $DataDescription["Format"]["Y"] == "datetime" )
$Value = $this->ToDateTime($Value);
$Position = imageftbbox($this->FontSize,0,$this->FontName,$Value); $Position = imageftbbox($this->FontSize,0,$this->FontName,$Value);
$TextWidth = $Position[2]-$Position[0]; $TextWidth = $Position[2]-$Position[0];
@ -611,7 +614,9 @@
$Value = $this->ToMetric($Value); $Value = $this->ToMetric($Value);
if ( $DataDescription["Format"]["X"] == "currency" ) if ( $DataDescription["Format"]["X"] == "currency" )
$Value = $this->ToCurrency($Value); $Value = $this->ToCurrency($Value);
if ( $DataDescription["Format"]["X"] == "datetime" )
$Value = $this->ToDateTime($Value);
$Position = imageftbbox($this->FontSize,$Angle,$this->FontName,$Value); $Position = imageftbbox($this->FontSize,$Angle,$this->FontName,$Value);
$TextWidth = abs($Position[2])+abs($Position[0]); $TextWidth = abs($Position[2])+abs($Position[0]);
$TextHeight = abs($Position[1])+abs($Position[3]); $TextHeight = abs($Position[1])+abs($Position[3]);
@ -753,7 +758,11 @@
if ( $DataDescription["Format"]["Y"] == "metric" ) if ( $DataDescription["Format"]["Y"] == "metric" )
$Value = $this->ToMetric($Value); $Value = $this->ToMetric($Value);
if ( $DataDescription["Format"]["Y"] == "currency" ) if ( $DataDescription["Format"]["Y"] == "currency" )
$Value = $this->ToCurrency($Value); $Value = $this->ToCurrency($Value);
if ( $DataDescription["Format"]["Y"] == "datetime" )
$Value = $this->ToDateTime($Value);
$Position = imageftbbox($this->FontSize,0,$this->FontName,$Value); $Position = imageftbbox($this->FontSize,0,$this->FontName,$Value);
$TextWidth = $Position[2]-$Position[0]; $TextWidth = $Position[2]-$Position[0];
@ -863,6 +872,8 @@
$Value = $this->ToMetric($Value); $Value = $this->ToMetric($Value);
if ( $DataDescription["Format"]["Y"] == "currency" ) if ( $DataDescription["Format"]["Y"] == "currency" )
$Value = $this->ToCurrency($Value); $Value = $this->ToCurrency($Value);
if ( $DataDescription["Format"]["Y"] == "datetime" )
$Value = $this->ToDateTime($Value);
$Position = imageftbbox($this->FontSize,$Angle,$this->FontName,$Value); $Position = imageftbbox($this->FontSize,$Angle,$this->FontName,$Value);
$TextWidth = abs($Position[2])+abs($Position[0]); $TextWidth = abs($Position[2])+abs($Position[0]);
@ -907,7 +918,7 @@
} }
/* Compute and draw the scale */ /* Compute and draw the scale */
function drawGrid($LineWidth,$Mosaic=TRUE,$R=220,$G=220,$B=220,$Alpha=100,$DrawVerticals=FALSE) function drawGrid($LineWidth,$Mosaic=TRUE,$R=220,$G=220,$B=220,$Alpha=100, $DrawVerticals=FALSE)
{ {
/* Draw mosaic */ /* Draw mosaic */
if ( $Mosaic ) if ( $Mosaic )
@ -3550,6 +3561,13 @@
return(date($this->DateFormat,$Value)); return(date($this->DateFormat,$Value));
} }
/* Convert TS to a datetime format string */
/* Added for PandoraFMS, slerena@Ago09 */
function ToDateTime($Value)
{
return(date("Y/m/d\nh:m:s",$Value));
}
/* Check if a number is a full integer (for scaling) */ /* Check if a number is a full integer (for scaling) */
function isRealInt($Value) function isRealInt($Value)
{ {

View File

@ -66,10 +66,18 @@ function get_graph_engine ($period = 3600) {
} else { } else {
exit; exit;
} }
$engine->graph_color[1] = $config['graph_color1']; $engine->graph_color[1] = $config['graph_color1'];
$engine->graph_color[2] = $config['graph_color2']; $engine->graph_color[2] = $config['graph_color2'];
$engine->graph_color[3] = $config['graph_color3']; $engine->graph_color[3] = $config['graph_color3'];
$engine->graph_color[4] = "#FED000"; // Yellow
$engine->graph_color[5] = "#00FEF0"; // Cyan
$engine->graph_color[6] = "#FF81EC"; // Pink
$engine->graph_color[7] = "#FF8D00"; // Orange
$engine->graph_color[8] = "#7E7E7E"; // Grey
$engine->graph_color[9] = "#000000"; // Black
if ($period <= 86400) if ($period <= 86400)
$engine->date_format = 'g:iA'; $engine->date_format = 'g:iA';
elseif ($period <= 604800) elseif ($period <= 604800)

View File

@ -106,7 +106,7 @@ class PchartGraph extends PandoraGraphAbstract {
public function single_graph () { public function single_graph () {
// Dataset definition // Dataset definition
$this->dataset = new pData; $this->dataset = new pData;
$this->graph = new pChart ($this->width, $this->height); $this->graph = new pChart ($this->width, $this->height+2);
foreach ($this->data as $x => $y) { foreach ($this->data as $x => $y) {
$this->dataset->AddPoint ($y, "Serie1", $x); $this->dataset->AddPoint ($y, "Serie1", $x);
@ -121,10 +121,13 @@ class PchartGraph extends PandoraGraphAbstract {
$this->graph->loadColorPalette ($this->palette_path); $this->graph->loadColorPalette ($this->palette_path);
$this->graph->setFontProperties ($this->fontpath, 8); $this->graph->setFontProperties ($this->fontpath, 8);
// White background
$this->graph->drawFilledRoundedRectangle(1,1,$this->width,$this->height,0,254,254,254);
$this->add_background (); $this->add_background ();
$this->dataset->SetXAxisFormat ($this->xaxis_format); $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); $this->graph->drawGraphArea (254, 254, 254, true);
if ($this->max_value == 0 || $this->max_value == 1) if ($this->max_value == 0 || $this->max_value == 1)
$this->graph->setFixedScale (0, 1, 1); $this->graph->setFixedScale (0, 1, 1);
@ -136,7 +139,7 @@ class PchartGraph extends PandoraGraphAbstract {
$this->xaxis_interval); $this->xaxis_interval);
if ($this->show_grid) if ($this->show_grid)
$this->graph->drawGrid (4, false, 0, 0, 0); $this->graph->drawGrid (1, false, 200, 200, 200);
if ($this->max_value > 0) { if ($this->max_value > 0) {
// Draw the graph // Draw the graph
$this->graph->drawFilledLineGraph ($this->dataset->GetData (), $this->graph->drawFilledLineGraph ($this->dataset->GetData (),
@ -145,7 +148,7 @@ class PchartGraph extends PandoraGraphAbstract {
} }
// Finish the graph // Finish the graph
$this->add_legend (); // $this->add_legend ();
$this->add_events (); $this->add_events ();
$this->add_alert_levels (); $this->add_alert_levels ();
@ -155,7 +158,7 @@ class PchartGraph extends PandoraGraphAbstract {
public function sparse_graph ($period, $avg_only, $min_value, $max_value, $unit_name) { public function sparse_graph ($period, $avg_only, $min_value, $max_value, $unit_name) {
// Dataset definition // Dataset definition
$this->dataset = new pData; $this->dataset = new pData;
$this->graph = new pChart ($this->width, $this->height); $this->graph = new pChart ($this->width, $this->height+5);
$this->graph->setFontProperties ($this->fontpath, 8); $this->graph->setFontProperties ($this->fontpath, 8);
$this->legend = array (); $this->legend = array ();
@ -179,7 +182,7 @@ class PchartGraph extends PandoraGraphAbstract {
$this->dataset->SetSerieName (__("Max. Value"), "MAX"); $this->dataset->SetSerieName (__("Max. Value"), "MAX");
$this->set_colors (); $this->set_colors ();
} }
$this->dataset->SetXAxisFormat ('date'); $this->dataset->SetXAxisFormat ('datetime');
$this->graph->setDateFormat ("Y"); $this->graph->setDateFormat ("Y");
$this->dataset->SetYAxisFormat ('metric'); $this->dataset->SetYAxisFormat ('metric');
$this->dataset->AddAllSeries (); $this->dataset->AddAllSeries ();
@ -189,21 +192,30 @@ class PchartGraph extends PandoraGraphAbstract {
if ($this->palette_path) { if ($this->palette_path) {
$this->graph->loadColorPalette ($this->palette_path); $this->graph->loadColorPalette ($this->palette_path);
} }
// White background
$this->graph->drawFilledRoundedRectangle(1,1,$this->width,$this->height,0,254,254,254);
$this->add_background (); // Graph border
$this->graph->drawGraphArea (255, 255, 255, true); $this->graph->drawRoundedRectangle(1,1,$this->width-1,$this->height+4,5,230,230,230);
$this->add_background ();
$this->graph->drawGraphArea (254, 254, 254, false);
$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->graph->drawScale ($this->dataset->GetData (),
$this->dataset->GetDataDescription (), SCALE_START0, $this->dataset->GetDataDescription (), SCALE_START0,
80, 80, 80, $this->show_axis, 0, 0, false, 80, 80, 80, $this->show_axis, 0, 50, false,
$this->xaxis_interval); $this->xaxis_interval);
/* NOTICE: The final "false" is a Pandora modificaton of pChart to avoid showing vertical lines. */ /* NOTICE: The final "false" is a Pandora modificaton of pChart to avoid showing vertical lines. */
if ($this->show_grid) if ($this->show_grid)
$this->graph->drawGrid (1, true, 225, 225, 225, 100, false); $this->graph->drawGrid (1, true, 225, 225, 225, 100, false);
// Draw the graph // Draw the graph
$this->graph->drawFilledLineGraph ($this->dataset->GetData(), $this->dataset->GetDataDescription(), 50, true); $this->graph->drawFilledLineGraph ($this->dataset->GetData(), $this->dataset->GetDataDescription(), 50, true);
$this->add_legend (); $this->add_legend ();
$this->add_events ("AVG"); $this->add_events ("AVG");
$this->add_alert_levels (); $this->add_alert_levels ();
@ -254,54 +266,95 @@ class PchartGraph extends PandoraGraphAbstract {
set_time_limit (0); set_time_limit (0);
// Dataset definition // Dataset definition
$this->dataset = new pData; $this->dataset = new pData;
$this->graph = new pChart ($this->width, $this->height); $this->graph = new pChart ($this->width, $this->height+5);
// $previo stores values from last series to made the stacked graph
foreach ($this->data as $i => $data) { foreach ($this->data as $i => $data) {
foreach ($data as $j => $value) { foreach ($data as $j => $value) {
$this->dataset->AddPoint ($value, $this->legend[$i], // New code for stacked. Due pchart doesnt not support stacked
// area graph, we "made it", adding to a series the values of the
// previous one consecutive sum.
if ((($stacked == 1) OR ($stacked==3)) AND ($i >0)){
$this->dataset->AddPoint ($value+$previo[$j], $this->legend[$i],
$values[$j]['timestamp_bottom']); $values[$j]['timestamp_bottom']);
} } else {
$this->dataset->AddPoint ($value, $this->legend[$i],
$values[$j]['timestamp_bottom']);
}
if ($i == 0)
$previo[$j] = $value;
else
$previo[$j] = $previo[$j] + $value;
}
} }
foreach ($this->legend as $name) { foreach ($this->legend as $name) {
$this->dataset->setSerieName ($name, $name); $this->dataset->setSerieName ($name, $name);
$this->dataset->AddSerie ($name); $this->dataset->AddSerie ($name);
} }
// Set different colors for combined graphs because need to be
// very different.
$this->graph_color[1] = "#FF0000"; // Red
$this->graph_color[2] = "#00FF00"; // Green
$this->graph_color[3] = "#0000FF"; // Blue
// White background
$this->graph->drawFilledRoundedRectangle(1,1,$this->width,$this->height,0,254,254,254);
$this->set_colors (); $this->set_colors ();
$this->graph->setFontProperties ($this->fontpath, 8); $this->graph->setFontProperties ($this->fontpath, 8);
$this->dataset->SetXAxisFormat ('date'); $this->dataset->SetXAxisFormat ('datetime');
$this->dataset->SetYAxisFormat ('metric'); $this->dataset->SetYAxisFormat ('metric');
$this->dataset->AddAllSeries (); $this->dataset->AddAllSeries ();
$this->add_background (); $this->add_background ();
$this->graph->drawGraphArea (255, 255, 255, true); $this->graph->drawGraphArea (254, 254, 254, false);
// Fixed missing X-labels (6Ago09)
$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, $this->show_axis, 0, 50, false,
$this->xaxis_interval);
$this->graph->drawGrid (1, true, 225, 225, 225, 100, false);
// Draw the graph // Draw the graph
if ($stacked == 1) { if ($stacked == 1) { // Stacked solid
$this->graph->drawScale ($this->dataset->GetData (), $this->graph->drawScale ($this->dataset->GetData (),
$this->dataset->GetDataDescription (), $this->dataset->GetDataDescription (),
SCALE_ADDALL, 80, 80, 80, $this->show_axis, SCALE_START0, 80, 80, 80, $this->show_axis, 0, 0, false,
0, 0, false,
$this->xaxis_interval); $this->xaxis_interval);
/* Stacked mode are only supported in bar charts */ $this->graph->drawFilledCubicCurve ($this->dataset->GetData(),
//$this->graph->DivisionWidth = ($this->x2 - $this->x1) / sizeof ($this->data[0]); $this->dataset->GetDataDescription(), 1, 30, true);
$this->graph->drawStackedBarGraph ($this->dataset->GetData (), }
elseif ($stacked == 3) { // Stacked wired
$this->graph->drawScale ($this->dataset->GetData (),
$this->dataset->GetDataDescription (), $this->dataset->GetDataDescription (),
50); SCALE_START0, 80, 80, 80, $this->show_axis, 0, 0, false,
} else if ($stacked == 2) { $this->xaxis_interval);
$this->graph->drawFilledCubicCurve ($this->dataset->GetData(),
$this->dataset->GetDataDescription(), 1, 0, true);
} else if ($stacked == 2) { // Wired mode
$this->graph->drawScale ($this->dataset->GetData (), $this->graph->drawScale ($this->dataset->GetData (),
$this->dataset->GetDataDescription (), $this->dataset->GetDataDescription (),
SCALE_START0, 80, 80, 80, $this->show_axis, 0, 0, false, SCALE_START0, 80, 80, 80, $this->show_axis, 0, 0, false,
$this->xaxis_interval); $this->xaxis_interval);
$this->graph->drawLineGraph ($this->dataset->GetData (), $this->graph->drawLineGraph ($this->dataset->GetData (),
$this->dataset->GetDataDescription ()); $this->dataset->GetDataDescription ());
} else { } else { // Non-stacked, area overlapped
$this->graph->drawScale ($this->dataset->GetData (), $this->graph->drawScale ($this->dataset->GetData (),
$this->dataset->GetDataDescription (), $this->dataset->GetDataDescription (),
SCALE_START0, 80, 80, 80, $this->show_axis, 0, 0, false, SCALE_START0, 80, 80, 80, $this->show_axis, 0, 0, false,
$this->xaxis_interval); $this->xaxis_interval);
$this->graph->drawFilledCubicCurve ($this->dataset->GetData(), $this->graph->drawFilledCubicCurve ($this->dataset->GetData(),
$this->dataset->GetDataDescription(), 0.1, 50, true); $this->dataset->GetDataDescription(), 1, 30, true);
} }
$this->add_legend (); $this->add_legend ();
$this->add_events ($this->legend[0]); $this->add_events ($this->legend[0]);
@ -312,7 +365,6 @@ class PchartGraph extends PandoraGraphAbstract {
public function progress_bar ($value, $color) { public function progress_bar ($value, $color) {
set_time_limit (0); set_time_limit (0);
// Dataset definition // Dataset definition
$this->graph = new pChart ($this->width, $this->height); $this->graph = new pChart ($this->width, $this->height);
$this->graph->setFontProperties ($this->fontpath, 8); $this->graph->setFontProperties ($this->fontpath, 8);
@ -438,76 +490,95 @@ class PchartGraph extends PandoraGraphAbstract {
$this->graph->setDateFormat ($this->date_format); $this->graph->setDateFormat ($this->date_format);
$this->x1 = ($this->width > 300) ? 30 : 35; $this->x1 = ($this->width > 300) ? 30 : 35;
$this->y1 = ($this->height > 200) ? 25 : 10; // $this->y1 = ($this->height > 200) ? 25 : 10;
$this->x2 = ($this->width > 300) ? $this->width - 30 : $this->width - 15; $this->x2 = ($this->width > 300) ? $this->width - 15 : $this->width - 15;
$this->y2 = ($this->height > 200) ? $this->height - 25 : $this->height - 25; $this->y2 = ($this->height > 200) ? $this->height - 25 : $this->height - 25;
if ($this->max_value > 10000 && $this->show_axis) if ($this->max_value > 10000 && $this->show_axis)
$this->x1 += 20; $this->x1 += 20;
if ($this->background_gradient) $this->graph->drawGraphArea (255, 255, 255, true);
$this->graph->drawGraphAreaGradient (233, 243, 210, 50, TARGET_BACKGROUND);
else $this->graph->setFontProperties ($this->fontpath, 7);
$this->graph->drawGraphArea (255, 255, 255, true);
if ($this->show_title) {
$this->y1 += 30;
}
$this->graph->setFontProperties ($this->fontpath, 6);
$size = $this->graph->getLegendBoxSize ($this->dataset->GetDataDescription ()); $size = $this->graph->getLegendBoxSize ($this->dataset->GetDataDescription ());
/* Old resize code for graph area, discard, we need all area in pure mode
if (is_array ($size)) { if (is_array ($size)) {
while ($size[1] > $this->y1) while ($size[1] > $this->y1)
$this->y1 += (int) $size[1] / 2; $this->y1 += (int) $size[1] / 2;
if ($this->y1 > $this->y2) if ($this->y1 > $this->y2)
$this->y1 = $this->y2; $this->y1 = $this->y2;
} }
*/
if ($this->show_title == 1){
$this->y1=40;
} else {
$this->y1=10;
}
// No title for combined
if ($this->stacked !== false){
$this->y1=10;
}
$this->graph->setGraphArea ($this->x1, $this->y1, $this->x2, $this->y2); $this->graph->setGraphArea ($this->x1, $this->y1, $this->x2, $this->y2);
if ($this->show_title) { if ($this->show_title) {
$this->graph->setFontProperties ($this->fontpath, 10); $this->graph->setFontProperties ($this->fontpath, 12);
$this->graph->drawTextBox (0, 0, $this->width, 20, $this->title, 0, $this->graph->drawTextBox (2, 7, $this->width, 20, $this->title, 0, 0, 0, 0, ALIGN_LEFT, false);
255, 255, 255, ALIGN_LEFT, true, 0, 0, 0, 30);
$this->graph->setFontProperties ($this->fontpath, 9); $this->graph->setFontProperties ($this->fontpath, 9);
$this->graph->drawTextBox (0, 20, $this->width, 40, $this->subtitle, $this->graph->drawTextBox ($this->width-150, 10, $this->width, 20, $this->subtitle,
0, 255, 255, 255, ALIGN_LEFT, true, 0, 0, 0, 0); 0, 0, 0, 0, ALIGN_LEFT, false);
$this->graph->setFontProperties ($this->fontpath, 8);
$this->graph->setFontProperties ($this->fontpath, 6);
} }
/* This is a tiny watermark. Remove safely */ /* This is a tiny watermark */
if ($this->watermark) { if ($this->watermark) {
$this->graph->setFontProperties ($this->fontpath, 7); if ($this->show_title){
$this->graph->drawTextBox ($this->width - 5, $this->height - 0, $this->graph->setFontProperties ($this->fontpath, 6);
$this->width - 240, $this->height - 0, 'Pandora FMS', 90, $this->graph->drawTextBox ($this->width - 5, 40,
154, 154, 154, ALIGN_BOTTOM_LEFT, false); $this->width - 240, 90, 'PandoraFMS', 90,
214, 214, 214, ALIGN_BOTTOM_LEFT, false);
} else {
$this->graph->setFontProperties ($this->fontpath, 6);
$this->graph->drawTextBox ($this->width - 5, 50,
$this->width - 240, 60, 'PandoraFMS', 90,
214, 214, 214, ALIGN_BOTTOM_LEFT, false);
}
} }
} }
private function add_legend () { private function add_legend () {
if (! $this->show_title || $this->legend === false) { if ((! $this->show_title || $this->legend === false) && ($this->stacked === false)) {
return; return;
} }
/* Add legend */ /* Add legend */
$this->graph->setFontProperties ($this->fontpath, 6); $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,
// No title for combined, so legends goes up
if ($this->stacked !== false)
$this->graph->drawLegend ( 35, 12,
$this->dataset->GetDataDescription (), $this->dataset->GetDataDescription (),
240, 240, 240); 245, 245, 245);
else
$this->graph->drawLegend ( 35, 52,
$this->dataset->GetDataDescription (),
245, 245, 245);
} }
private function set_colors () { private function set_colors () {
if ($this->graph == NULL) if ($this->graph == NULL)
return; return;
$color = $this->get_rgb_values ($this->graph_color[1]); for ($a = 0; $a<9; $a++){
$this->graph->setColorPalette (0, $color['r'], $color['g'], $color['b']); $color = $this->get_rgb_values ($this->graph_color[$a+1]);
$color = $this->get_rgb_values ($this->graph_color[2]); $this->graph->setColorPalette ($a, $color['r'], $color['g'], $color['b']);
$this->graph->setColorPalette (1, $color['r'], $color['g'], $color['b']); }
$color = $this->get_rgb_values ($this->graph_color[3]);
$this->graph->setColorPalette (2, $color['r'], $color['g'], $color['b']);
} }
} }
?> ?>

View File

@ -209,9 +209,10 @@ div#menu {
div#head { div#head {
font-size: 8pt; font-size: 8pt;
width: 960px; width: 960px;
height: 87px;/*84px;*/ /*height: 60px;*/ height: 60px;/*84px;*/ /*height: 60px;*/
padding-top: 1px;
background: url(../../images/header.jpg); background: url(../../images/header.jpg);
border-bottom: solid 2px #555; border-bottom: solid 1px #000;
} }
div#foot { div#foot {
@ -361,7 +362,7 @@ td.datos_id {
font-style: italic; font-style: italic;
} }
.tit { .tit {
padding: 3px 1px; padding: 3px 1px;
} }
.tit, .titb { .tit, .titb {
font-weight: bold; font-weight: bold;
@ -490,7 +491,7 @@ div.title_line {
color: #333; color: #333;
border-left: 2px solid #778866; border-left: 2px solid #778866;
font-weight: bold; font-weight: bold;
line-height: 19px; line-height: 18px;
} }
#menu_tab li.nomn_high a { #menu_tab li.nomn_high a {
background: #799E48; background: #799E48;

View File

@ -115,7 +115,8 @@ $searchPage = false;
$search = get_parameter_get("head_search_keywords"); $search = get_parameter_get("head_search_keywords");
if (strlen($search) > 0) { if (strlen($search) > 0) {
$config['search_keywords'] = trim(get_parameter('keywords')); $config['search_keywords'] = trim(get_parameter('keywords'));
$config['search_category'] = get_parameter('search_category'); // If not search category providad, we'll use an agent search
$config['search_category'] = get_parameter('search_category', 'agents');
if (($config['search_keywords'] != 'Enter keywords to search') && (strlen($config['search_keywords']) > 0)) if (($config['search_keywords'] != 'Enter keywords to search') && (strlen($config['search_keywords']) > 0))
$searchPage = true; $searchPage = true;
} }

View File

@ -50,7 +50,9 @@ if (is_ajax ()) {
$group_id = get_parameter ("group_id", 0); $group_id = get_parameter ("group_id", 0);
$search = get_parameter ("search", ""); $search = get_parameter ("search", "");
echo "<h2>".__('Pandora agents')." &raquo; ".__('Summary')."</h2>"; echo "<h2>".__('Pandora agents')." &raquo; ".__('Summary').
print_help_icon ("agent_status", true);
echo "</h2>";
if ($group_id > 1) { if ($group_id > 1) {
echo '<form method="post" action="'.get_url_refresh (array ('group_id' => $group_id)).'">'; echo '<form method="post" action="'.get_url_refresh (array ('group_id' => $group_id)).'">';
@ -192,11 +194,12 @@ foreach ($agents as $agent) {
if (!empty ($table->data)) { if (!empty ($table->data)) {
print_table ($table); print_table ($table);
unset ($table); unset ($table);
require ("bulbs.php");
} else { } else {
echo '<div class="nf">'.__('There are no agents included in this group').'</div>'; echo '<div class="nf">'.__('There are no agents included in this group').'</div>';
} }
/* Godmode controls SHOULD NOT BE HERE
if (give_acl ($config['id_user'], 0, "LM") || give_acl ($config['id_user'], 0, "AW") if (give_acl ($config['id_user'], 0, "LM") || give_acl ($config['id_user'], 0, "AW")
|| give_acl ($config['id_user'], 0, "PM") || give_acl ($config['id_user'], 0, "DM") || give_acl ($config['id_user'], 0, "PM") || give_acl ($config['id_user'], 0, "DM")
|| give_acl ($config['id_user'], 0, "UM")) { || give_acl ($config['id_user'], 0, "UM")) {
@ -206,4 +209,5 @@ if (give_acl ($config['id_user'], 0, "LM") || give_acl ($config['id_user'], 0, "
print_submit_button (__('Create agent'), 'crt', false, 'class="sub next"'); print_submit_button (__('Create agent'), 'crt', false, 'class="sub next"');
echo '</form>'; echo '</form>';
} }
*/
?> ?>

View File

@ -30,10 +30,7 @@ if (! isset($_SESSION["id_user"])) {
require_once ($config["homedir"] . '/include/functions.php'); require_once ($config["homedir"] . '/include/functions.php');
require_once ($config["homedir"] . '/include/functions_db.php'); require_once ($config["homedir"] . '/include/functions_db.php');
require_once ($config["homedir"] . '/include/fgraph.php');
if ($config['flash_charts']) {
require_once ($config["homedir"] . '/include/fgraph.php');
}
check_login (); check_login ();
@ -97,7 +94,7 @@ function getTermEle(ele) {
} }
//--> //-->
</script> </script>
</head><body> </head><body bgcolor="#ffffff">
<?php <?php
// Get input parameters // Get input parameters

View File

@ -111,6 +111,7 @@ if ($view_graph) {
$stackeds[0] = __('Area'); $stackeds[0] = __('Area');
$stackeds[1] = __('Stacked area'); $stackeds[1] = __('Stacked area');
$stackeds[2] = __('Line'); $stackeds[2] = __('Line');
$stackeds[3] = __('Stacked line');
print_select ($stackeds, 'stacked', $stacked , '', '', -1, false, false); print_select ($stackeds, 'stacked', $stacked , '', '', -1, false, false);
echo "<td class='datos'>"; echo "<td class='datos'>";

View File

@ -144,7 +144,7 @@ foreach ($contents as $content) {
} }
$data = array (); $data = array ();
$data[0] = '<img src="include/fgraph.php?tipo=sparse&id='.$content['id_agent_module'].'&height=230&width=720&period='.$content['period'].'&date='.$datetime.'&avg_only=1&pure=1" border="0" alt="">'; $data[0] = '<img src="include/fgraph.php?tipo=sparse&id='.$content['id_agent_module'].'&height=230&width=750&period='.$content['period'].'&date='.$datetime.'&avg_only=1&pure=1" border="0" alt="">';
array_push ($table->data, $data); array_push ($table->data, $data);
break; break;
@ -159,7 +159,7 @@ foreach ($contents as $content) {
// Put description at the end of the module (if exists) // Put description at the end of the module (if exists)
if ($content["description"] != ""){ if ($content["description"] != ""){
$table->colspan[0][0] = 4; $table->colspan[1][0] = 3;
$data_desc = array(); $data_desc = array();
$data_desc[0] = $content["description"]; $data_desc[0] = $content["description"];
array_push ($table->data, $data_desc); array_push ($table->data, $data_desc);
@ -180,11 +180,11 @@ foreach ($contents as $content) {
$graph_height= get_db_sql ("SELECT height FROM tgraph WHERE id_graph = ".$content["id_gs"]); $graph_height= get_db_sql ("SELECT height FROM tgraph WHERE id_graph = ".$content["id_gs"]);
$table->colspan[1][0] = 4; $table->colspan[2][0] = 3;
$data = array (); $data = array ();
$data[0] = '<img src="include/fgraph.php?tipo=combined&id='.implode (',', $modules).'&weight_l='.implode (',', $weights).'&height='.$graph_height.'&width='.$graph_width.'&period='.$content['period'].'&date='.$datetime.'&stacked='.$graph["stacked"].'&pure=1" border="1" alt="">'; $data[0] = '<img src="include/fgraph.php?tipo=combined&id='.implode (',', $modules).'&weight_l='.implode (',', $weights).'&height=235&width=750&period='.$content['period'].'&date='.$datetime.'&stacked='.$graph["stacked"].'&pure=1" border="1" alt="">';
array_push ($table->data, $data); array_push ($table->data, $data);
break; break;
case 3: case 3:
case 'SLA': case 'SLA':

View File

@ -153,6 +153,24 @@ if (($config['search_category'] == 'all') || ($config['search_category'] == 'map
///////// INI MENU AND TABS ///////////// ///////// INI MENU AND TABS /////////////
$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_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_style);
echo '&nbsp;'.__('View').'</a></li>';
*/
echo " echo "
<div id='menu_tab_frame_view'> <div id='menu_tab_frame_view'>
<div id='menu_tab_left'> <div id='menu_tab_left'>
@ -169,7 +187,9 @@ if ($searchAgents)
echo "<li class='nomn_high'>"; echo "<li class='nomn_high'>";
else else
echo "<li class='nomn'>"; echo "<li class='nomn'>";
echo "<a href='?search_category=agents&keywords=".$config['search_keywords']."&head_search_keywords=Search'>".__('Agents')." <img src='images/bricks.png' /></a>"; echo "<a href='?search_category=agents&keywords=".$config['search_keywords']."&head_search_keywords=Search'>";
print_image ("images/bricks.png", false, $img_style);
echo "&nbsp;".__('Agents')."</a>";
echo "</li>"; echo "</li>";
} }
@ -177,14 +197,18 @@ if ($searchTab == "users")
echo "<li class='nomn_high'>"; echo "<li class='nomn_high'>";
else else
echo "<li class='nomn'>"; echo "<li class='nomn'>";
echo "<a href='?search_category=users&keywords=".$config['search_keywords']."&head_search_keywords=Search'>".__('Users')." <img src='images/group.png' /></a>"; echo "<a href='?search_category=users&keywords=".$config['search_keywords']. "&head_search_keywords=Search'> ";
print_image ("images/group.png", false, $img_style);
echo "&nbsp;".__('Users')."</a>";
echo "</li>"; echo "</li>";
if ($searchTab == "alerts") if ($searchTab == "alerts")
echo "<li class='nomn_high'>"; echo "<li class='nomn_high'>";
else else
echo "<li class='nomn'>"; echo "<li class='nomn'>";
echo "<a href='?search_category=alerts&keywords=".$config['search_keywords']."&head_search_keywords=Search'>".__('Alerts')." <img src='images/god2.png' /></a>"; echo "<a href='?search_category=alerts&keywords=".$config['search_keywords']."&head_search_keywords=Search'> ";
print_image ("images/god2.png", false, $img_style);
echo "&nbsp;".__('Alerts')."</a>";
echo "</li>"; echo "</li>";
if ($searchGraphs) if ($searchGraphs)
@ -193,7 +217,9 @@ if ($searchGraphs)
echo "<li class='nomn_high'>"; echo "<li class='nomn_high'>";
else else
echo "<li class='nomn'>"; echo "<li class='nomn'>";
echo "<a href='?search_category=graphs&keywords=".$config['search_keywords']."&head_search_keywords=Search'>".__('Graphs')." <img src='images/chart_curve.png' /></a>"; echo "<a href='?search_category=graphs&keywords=".$config['search_keywords']."&head_search_keywords=Search'> ";
print_image ("images/chart_curve.png", false, $img_style);
echo "&nbsp;".__('Graphs'). "</a>";
echo "</li>"; echo "</li>";
} }
@ -202,7 +228,9 @@ if ($searchTab == "reports")
echo "<li class='nomn_high'>"; echo "<li class='nomn_high'>";
else else
echo "<li class='nomn'>"; echo "<li class='nomn'>";
echo "<a href='?search_category=reports&keywords=".$config['search_keywords']."&head_search_keywords=Search'>".__('Reports')." <img src='images/reporting.png' /></a>"; echo "<a href='?search_category=reports&keywords=".$config['search_keywords']."&head_search_keywords=Search'> ";
print_image ("images/reporting.png", false, $img_style);
echo "&nbsp;".__('Reports')."</a>";
echo "</li>"; echo "</li>";
if ($searchMaps) if ($searchMaps)
@ -211,7 +239,9 @@ if ($searchMaps)
echo "<li class='nomn_high'>"; echo "<li class='nomn_high'>";
else else
echo "<li class='nomn'>"; echo "<li class='nomn'>";
echo "<a href='?search_category=maps&keywords=".$config['search_keywords']."&head_search_keywords=Search'>".__('Maps')." <img src='images/camera.png' /></a>"; echo "<a href='?search_category=maps&keywords=".$config['search_keywords']."&head_search_keywords=Search'> ";
print_image ("images/camera.png", false, $img_style);
echo "&nbsp;".__('Maps')."</a>";
echo "</li>"; echo "</li>";
} }