mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-31 01:35:36 +02:00
2009-01-20 Esteban Sanchez <estebans@artica.es>
* ChangeLog: Fixed tabs. Removed some conflict markups and a bit of style here and there. * index.php, godmode/setup/setup.php, include/styles/menu.css, operation/agentes/estado_agente.php, operation/agentes/estado_monitores.php, operation/agentes/estado_ultimopaquete.php, include/functions.php: Tab and spaces style correction. * godmode/reporting/map_builder.php: Use generic database functions for the insert. Now a node can represent a whole agent, changing to bad if any module has failed. * include/config_process.php: Use generic databse functions for inserts. Fixed an error when inserting loginhash_pwd token. Make the token a bit more complicated by multiplying two numbers. * include/functions_visual_map.php: Add support to agent nodes that will turn to bad icon when any module fails. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1363 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
bf3c748df2
commit
5664538516
@ -1,3 +1,25 @@
|
||||
2009-01-20 Esteban Sanchez <estebans@artica.es>
|
||||
|
||||
* ChangeLog: Fixed tabs. Removed some conflict markups and a bit of
|
||||
style here and there.
|
||||
|
||||
* index.php, godmode/setup/setup.php, include/styles/menu.css,
|
||||
operation/agentes/estado_agente.php,
|
||||
operation/agentes/estado_monitores.php,
|
||||
operation/agentes/estado_ultimopaquete.php,
|
||||
include/functions.php: Tab and spaces style correction.
|
||||
|
||||
* godmode/reporting/map_builder.php: Use generic database functions
|
||||
for the insert. Now a node can represent a whole agent, changing to
|
||||
bad if any module has failed.
|
||||
|
||||
* include/config_process.php: Use generic databse functions for
|
||||
inserts. Fixed an error when inserting loginhash_pwd token. Make the
|
||||
token a bit more complicated by multiplying two numbers.
|
||||
|
||||
* include/functions_visual_map.php: Add support to agent nodes that
|
||||
will turn to bad icon when any module fails.
|
||||
|
||||
2009-01-20 Esteban Sanchez <estebans@artica.es>
|
||||
|
||||
* include/javascript/jquery.js: Downgraded to 1.2. It was causing some
|
||||
|
@ -147,18 +147,19 @@ if ($create_layout_data) {
|
||||
$layout_data_width = (int) get_parameter ("width");
|
||||
$layout_data_height = (int) get_parameter ("height");
|
||||
|
||||
$sql = sprintf ('INSERT INTO tlayout_data (id_layout, label, id_layout_linked,
|
||||
label_color, image, type, id_agente_modulo, parent_item, period, no_link_color,
|
||||
width, height)
|
||||
VALUES (%d, "%s", %d, "%s", "%s", %d, %d, %d, %d, 1, %d, %d)',
|
||||
$id_layout, $layout_data_label,
|
||||
$layout_data_map_linked,
|
||||
$layout_data_label_color,
|
||||
$layout_data_image, $layout_data_type,
|
||||
$layout_data_id_agent_module,
|
||||
$layout_data_parent_item, $layout_data_period * 3600,
|
||||
$layout_data_width, $layout_data_height);
|
||||
$result = process_sql ($sql, 'insert_id');
|
||||
$values = array ('id_layout' => $id_layout,
|
||||
'label' => $layout_data_label,
|
||||
'id_layout_linked' => $layout_data_map_linked,
|
||||
'label_color' => $layout_data_label_color,
|
||||
'image' => $layout_data_image,
|
||||
'type' => $layout_data_type,
|
||||
'id_agente_modulo' => $layout_data_id_agent_module,
|
||||
'parent_item' => $layout_data_parent_item,
|
||||
'period' => $layout_data_period * 3600,
|
||||
'no_link_color' => 1,
|
||||
'width' => $layout_data_width,
|
||||
'height' => $layout_data_height);
|
||||
$result = process_sql_insert ('tlayout_data', $values);
|
||||
|
||||
if ($result !== false) {
|
||||
echo '<h3 class="suc">'.__('Created successfully').'</h3>';
|
||||
@ -446,7 +447,7 @@ function agent_changed (event, id_agent, selected) {
|
||||
},
|
||||
function (data) {
|
||||
$('#form_layout_data_editor #module').empty ();
|
||||
$('#form_layout_data_editor #module').append ($('<option></option>').html ("--").attr ("value", 0));
|
||||
$('#form_layout_data_editor #module').append ($('<option></option>').html ("<?php echo __('Any')?>").attr ("value", 0));
|
||||
jQuery.each (data, function (i, val) {
|
||||
s = html_entity_decode (val['nombre']);
|
||||
$('#form_layout_data_editor #module').append ($('<option></option>').html (s).attr ("value", val['id_agente_modulo']));
|
||||
|
@ -17,20 +17,20 @@
|
||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
//Pandora Version
|
||||
$build_version = "PC090115";
|
||||
$pandora_version = "v2.1-dev";
|
||||
$build_version = 'PC090120';
|
||||
$pandora_version = 'v2.1-dev';
|
||||
|
||||
// This is directory where placed "/attachment" directory, to upload files stores.
|
||||
// This MUST be writtable by http server user, and should be in pandora root.
|
||||
// By default, Pandora adds /attachment to this, so by default is the pandora console home dir
|
||||
|
||||
$config["attachment_store"] = $config["homedir"]."/attachment";
|
||||
$config['attachment_store'] = $config['homedir'].'/attachment';
|
||||
|
||||
// Default font used for graphics (a Free TrueType font included with Pandora FMS)
|
||||
$config["fontpath"] = $config["homedir"]."/reporting/FreeSans.ttf";
|
||||
$config['fontpath'] = $config['homedir'].'/reporting/FreeSans.ttf';
|
||||
|
||||
// Style (pandora by default)
|
||||
$config["style"] = "pandora";
|
||||
$config['style'] = 'pandora';
|
||||
|
||||
// Read remaining config tokens from DB
|
||||
if (! mysql_connect ($config["dbhost"], $config["dbuser"], $config["dbpass"])) {
|
||||
@ -58,7 +58,7 @@ mysql_select_db ($config["dbname"]);
|
||||
require_once ('functions_db.php');
|
||||
$configs = get_db_all_rows_in_table ('tconfig');
|
||||
|
||||
if (sizeof ($configs) == 0) {
|
||||
if (empty ($configs)) {
|
||||
exit ('<html><head><title>Pandora FMS Error</title>
|
||||
<link rel="stylesheet" href="./include/styles/pandora.css" type="text/css">
|
||||
</head><body><div align="center">
|
||||
@ -76,18 +76,19 @@ if (sizeof ($configs) == 0) {
|
||||
</div></body></html>');
|
||||
}
|
||||
|
||||
/* Compatibility fix */
|
||||
foreach ($configs as $c) {
|
||||
switch ($c["token"]) {
|
||||
case "language_code":
|
||||
$config["language"] = $c["value"];
|
||||
$config['language'] = $c['value'];
|
||||
|
||||
break;
|
||||
default:
|
||||
$config[$c["token"]] = $c["value"];
|
||||
$config[$c['token']] = $c['value'];
|
||||
}
|
||||
}
|
||||
|
||||
if ($config["language"] == 'ast_es') {
|
||||
if ($config['language'] == 'ast_es') {
|
||||
$help_code = 'ast';
|
||||
} else {
|
||||
$help_code = substr ($config["language"], 0, 2);
|
||||
@ -112,47 +113,54 @@ if (file_exists ('./include/languages/'.$config["language"].'.mo')) {
|
||||
$l10n->load_tables();
|
||||
}
|
||||
|
||||
if (!isset ($config['date_format'])) {
|
||||
$config['date_format'] = 'F j, Y, g:i a';
|
||||
process_sql ("INSERT INTO tconfig (token,value) VALUES ('date_format', '".$config['date_format']."')");
|
||||
}
|
||||
|
||||
if (!isset($config["event_view_hr"])){
|
||||
$config["event_view_hr"] = 8;
|
||||
process_sql ("INSERT INTO tconfig (token,value) VALUES ('event_view_hr', ".$config["event_view_hr"].")");
|
||||
}
|
||||
|
||||
if (!isset($config["loginhash_pwd"])){
|
||||
$config["loginhash_pwd"] = rand(0,1000)."pandorahash";
|
||||
process_sql ("INSERT INTO tconfig (token,value) VALUES ('loginhash_pwd', ".$config["loginhash_pwd"].")");
|
||||
}
|
||||
|
||||
if (isset ($config['homeurl']) && $config['homeurl'][0] != '/') {
|
||||
$config['homeurl'] = '/'.$config['homeurl'];
|
||||
}
|
||||
|
||||
if (!isset ($config['date_format'])) {
|
||||
$config['date_format'] = 'F j, Y, g:i a';
|
||||
process_sql_insert ('tconfig', array ('token' => 'date_format',
|
||||
'value' => $config['date_format']));
|
||||
}
|
||||
|
||||
if (! isset ($config['event_view_hr'])) {
|
||||
$config['event_view_hr'] = 8;
|
||||
process_sql_insert ('tconfig', array ('token' => 'event_view_hr',
|
||||
'value' => $config['event_view_hr']));
|
||||
}
|
||||
|
||||
if (! isset ($config['loginhash_pwd'])) {
|
||||
$config['loginhash_pwd'] = rand (0, 1000) * rand (0, 1000)."pandorahash";
|
||||
process_sql_insert ('tconfig', array ('token' => 'loginhash_pwd',
|
||||
'value' => $config["loginhash_pwd"]));
|
||||
}
|
||||
|
||||
// If first time, make the trap2agent disable in DB
|
||||
if (!isset($config["trap2agent"])){
|
||||
$config["trap2agent"] = 0;
|
||||
process_sql ("INSERT INTO tconfig (token,value) VALUES ('trap2agent', 0)");
|
||||
process_sql_insert ('tconfig', array ('token' => 'trap2agent',
|
||||
'value' => $config['trap2agent']));
|
||||
}
|
||||
|
||||
if (!isset ($config["sla_period"]) || empty ($config["sla_period"])) {
|
||||
// Default period (in secs) for auto SLA calculation (for monitors)
|
||||
$config["sla_period"] = 604800;
|
||||
process_sql ("INSERT INTO tconfig (token,value) VALUES ('sla_period',604800)");
|
||||
process_sql_insert ('tconfig', array ('token' => 'sla_period',
|
||||
'value' => $config['sla_period']));
|
||||
}
|
||||
|
||||
if (!isset ($config["prominent_time"])) {
|
||||
// Prominent time tells us what to show prominently when a timestamp is displayed. The comparation (... days ago) or the timestamp (full date)
|
||||
// Prominent time tells us what to show prominently when a timestamp is
|
||||
// displayed. The comparation (... days ago) or the timestamp (full date)
|
||||
$config["prominent_time"] = "comparation";
|
||||
process_sql ("INSERT INTO tconfig (token,value) VALUES ('prominent_time','comparation')");
|
||||
process_sql_insert ('tconfig', array ('token' => 'prominent_time',
|
||||
'value' => $config['prominent_time']));
|
||||
}
|
||||
|
||||
if (!isset ($config["timesource"])) {
|
||||
// Prominent time tells us what to show prominently when a timestamp is displayed. The comparation (... days ago) or the timestamp (full date)
|
||||
// Prominent time tells us what to show prominently when a timestamp is
|
||||
// displayed. The comparation (... days ago) or the timestamp (full date)
|
||||
$config["timesource"] = "system";
|
||||
process_sql ("INSERT INTO tconfig (token,value) VALUES ('timesource','system')");
|
||||
process_sql_insert ('tconfig', array ('token' => 'timesource',
|
||||
'value' => $config['timesource']));
|
||||
}
|
||||
?>
|
||||
|
@ -990,8 +990,8 @@ if (!function_exists ("mb_strtoupper")) {
|
||||
*/
|
||||
|
||||
function unsafe_string ($string) {
|
||||
if (get_magic_quotes_gpc () == 1)
|
||||
$string = stripslashes ($string);
|
||||
if (get_magic_quotes_gpc ())
|
||||
return stripslashes ($string);
|
||||
return $string;
|
||||
}
|
||||
|
||||
@ -1003,7 +1003,7 @@ function unsafe_string ($string) {
|
||||
|
||||
function safe_sql_string ($string) {
|
||||
if (get_magic_quotes_gpc () == 0)
|
||||
$string = mysql_escape_string ($string);
|
||||
return $string;
|
||||
return mysql_escape_string ($string);
|
||||
}
|
||||
?>
|
||||
|
@ -34,13 +34,13 @@ function print_pandora_visual_map ($id_layout, $show_links = true, $draw_lines =
|
||||
$lines = array ();
|
||||
|
||||
if ($layout_datas !== false) {
|
||||
|
||||
foreach ($layout_datas as $layout_data) {
|
||||
// Linked to other layout ?? - Only if not module defined
|
||||
if (($layout_data['id_layout_linked'] != 0) && ($layout_data['id_agente_modulo'] == 0)) {
|
||||
if ($layout_data['id_layout_linked'] != 0) {
|
||||
$status = return_status_layout ($layout_data['id_layout_linked']);
|
||||
} else {
|
||||
$id_agent = get_db_value ("id_agente", "tagente_estado", "id_agente_modulo", $layout_data['id_agente_modulo']);
|
||||
if ($layout_data['id_agente_modulo'] != 0) {
|
||||
$id_agent_module_parent = get_db_value ("id_agente_modulo", "tlayout_data", "id", $layout_data["parent_item"]);
|
||||
// Item value
|
||||
$status = return_status_agent_module ($layout_data['id_agente_modulo']);
|
||||
@ -48,11 +48,23 @@ function print_pandora_visual_map ($id_layout, $show_links = true, $draw_lines =
|
||||
$status_parent = -1;
|
||||
else
|
||||
$status_parent = return_status_agent_module ($id_agent_module_parent);
|
||||
} else {
|
||||
$interval = get_agent_interval ($id_agent);
|
||||
$sql = sprintf ('SELECT COUNT(*)
|
||||
FROM tagente_estado, tagente_modulo
|
||||
WHERE tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo
|
||||
AND tagente_modulo.disabled = 0
|
||||
AND tagente_modulo.id_agente = %d
|
||||
AND (utimestamp >= UNIX_TIMESTAMP() - module_interval * 2
|
||||
OR (module_interval = 0
|
||||
AND utimestamp >= UNIX_TIMESTAMP() - %d))',
|
||||
$id_agent, $interval * 2);
|
||||
$status = get_db_sql ($sql);
|
||||
}
|
||||
}
|
||||
|
||||
// STATIC IMAGE (type = 0)
|
||||
if ($layout_data['type'] == 0) {
|
||||
|
||||
// Link image
|
||||
//index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=1
|
||||
if ($status == 0) // Bad monitor
|
||||
@ -88,7 +100,7 @@ function print_pandora_visual_map ($id_layout, $show_links = true, $draw_lines =
|
||||
echo "</a>";
|
||||
|
||||
// Draw label
|
||||
echo "<br>";
|
||||
echo "<br />";
|
||||
echo $layout_data['label'];
|
||||
echo "</div>";
|
||||
}
|
||||
|
@ -248,7 +248,7 @@ if ($agents !== false) {
|
||||
echo $nombre_agente;
|
||||
echo "</strong></a></td>";
|
||||
|
||||
// Show SO icon :)
|
||||
// Show SO icon
|
||||
echo "<td class='$tdcolor' align='center'>";
|
||||
print_os_icon ($id_os, false);
|
||||
echo "</td>";
|
||||
@ -285,8 +285,7 @@ if ($agents !== false) {
|
||||
if ($numero_modulos > 0){
|
||||
if ($agent_down > 0) {
|
||||
echo '<img src="images/pixel_fucsia.png" width="40" height="18" title="'.__('Agent down').'" />';
|
||||
}
|
||||
elseif ($monitor_critical > 0){
|
||||
} elseif ($monitor_critical > 0){
|
||||
echo '<img src="images/pixel_red.png" width="40" height="18" title="'.__('At least one module in CRITICAL status').'" />';
|
||||
} elseif ($monitor_warning > 0) {
|
||||
echo '<img src="images/pixel_yellow.png" width="40" height="18" title="'.__('At least one module in WARNING status').'" />';
|
||||
|
@ -86,8 +86,6 @@ foreach ($modules as $module) {
|
||||
$data[4] .= substr(salida_limpia($module["datos"]),0,42) . '">';
|
||||
}
|
||||
|
||||
|
||||
|
||||
if ($module["module_interval"] > 0) {
|
||||
$data[5] = $module["module_interval"];
|
||||
} else {
|
||||
|
Loading…
x
Reference in New Issue
Block a user