- Las macros dinámicas tendrán un formato especial que empieza por @ y tendrán estas posibles sustituciones:
+Dynamic macros will have a special format starting with @ and will have these possible substitutions:
- @DATE_FORMAT (fecha/hora actual con formato definido por el usuario)
+ @DATE_FORMAT (current date/time with user-defined format)
- Donde “n” puede ser un numero sin signo (positivo) o negativo.
+Where "n" can be a number without a sign (positive) or negative.
- Y FORMAT sigue el standard de strftime de perl:
+And FORMAT follows the standard of perl's strftime:
http://search.cpan.org/~dexter/POSIX-strftime-GNU-0.02/lib/POSIX/strftime/GNU.pm
Pandora FMS is an OpenSource software project licensed under the GPL2 licence. Pandora FMS includes, as well, another software also licensed under LGPL and BSD licenses. Before continue, you must accept the licence terms..
-
For more information, please refer to our website at http://pandorafms.org and contact us if you have any kind of question about the usage of Pandora FMS
-
If you dont accept the licence terms, please, close your browser and delete Pandora FMS files.
- ";
-
- if (!file_exists("COPYING")) {
- echo "
Licence file 'COPYING' is not present in your distribution. This means you have some 'partial' Pandora FMS distribution. We cannot continue without accepting the licence file.";
- echo "
";
- }
- else {
- echo "
";
-
- echo "
-
-
- Pandora FMS is an OpenSource Software project registered at
- SourceForge
-
You have some incomplete
- dependencies. Please correct them or this installer
- will not be able to finish your installation.
-
-
- Remember, if you install any PHP module to comply
- with these dependences, you need to restart
- your HTTP/Apache server after it to use the new
- modules.
-
- This wizard will create your Pandora FMS database,
- and populate it with all the data needed to run for the first time.
-
-
- You need a privileged user to create database schema, this is usually root user.
- Information about root user will not be used or stored anymore.
-
-
- You can also deploy the scheme into an existing Database.
- In this case you need a privileged Database user and password of that instance.
-
-
- Now, please, complete all details to configure your database and environment setup.
-
-
- Warning: This installer will overwrite and destroy your existing
- Pandora FMS configuration and Database. Before continue,
- please be sure that you have no valuable Pandora FMS data in your Database.
-
-
";
-
- if (extension_loaded("oci8")) {
- echo "
For Oracle installation an existing Database with a privileged user is needed.
";
- }
- if (!$error) {
- echo "
";
-
- echo "";
-
- echo "";
- echo "
-
- Pandora FMS is an OpenSource Software project registered at
- SourceForge
-
';
}
else {
- $comments_form = ui_print_message(__( 'If event replication is ongoing, it won\'t be possible to enter comments here. This option is only to allow local pandora users to see comments, but not to operate with them. The operation, when event replication is enabled, must be done only in the Metaconsole.'));
+ $comments_form = '';
}
$comments = '
";
+
+ return $header;
+}
+
+//
+// This function adjusts path settings in pandora db for FreeBSD.
+//
+// All packages and configuration files except operating system's base files
+// are installed under /usr/local in FreeBSD. So, path settings in pandora db
+// for some programs should be changed from the Linux default.
+//
+function adjust_paths_for_freebsd($engine, $connection = false) {
+
+ $adjust_sql = array(
+ "update trecon_script set script = REPLACE(script,'/usr/share','/usr/local/share');",
+ "update tconfig set value = REPLACE(value,'/usr/bin','/usr/local/bin') where token='netflow_daemon' OR token='netflow_nfdump' OR token='netflow_nfexpire';",
+ "update talert_commands set command = REPLACE(command,'/usr/bin','/usr/local/bin');",
+ "update talert_commands set command = REPLACE(command,'/usr/share', '/usr/local/share');",
+ "update tplugin set execute = REPLACE(execute,'/usr/share','/usr/local/share');",
+ "update tevent_response set target = REPLACE(target,'/usr/share','/usr/local/share');",
+ "insert into tconfig (token, value) VALUES ('graphviz_bin_dir', '/usr/local/bin');"
+ );
+
+ for ($i = 0; $i < count ($adjust_sql); $i++) {
+ switch ($engine) {
+ case 'mysql':
+ $result = mysql_query($adjust_sql[$i]);
+ break;
+ case 'mysqli':
+ $result = mysqli_query($connection, $adjust_sql[$i]);
+ break;
+ case 'oracle':
+ //Delete the last semicolon from current query
+ $query = substr($adjust_sql[$i], 0, strlen($adjust_sql[$i]) - 1);
+ $sql = oci_parse($connection, $query);
+ $result = oci_execute($sql);
+ break;
+ case 'pgsql':
+ pg_send_query($connection, $adjust_sql[$i]);
+ $result = pg_get_result($connection);
+ break;
+ }
+ if (!$result) {
+ return 0;
+ }
+ }
+
+ return 1;
+}
+
+function install_step1() {
+ global $banner;
+
+ echo "
+
+
+ " . print_logo_status (1,6) . "
+
+
Welcome to Pandora FMS installation Wizard
+
This wizard helps you to quick install Pandora FMS console and main database in your system.
+
In four steps, this installer will check all dependencies and will create your configuration, ready to use.
+
For more information, please refer to documentation.
+ Pandora FMS Development Team
+ ";
+ if (file_exists("include/config.php")) {
+ echo "
Warning: You already have a config.php file.
+ Configuration and database would be overwritten if you continued.
";
+ }
+ echo " ";
+ echo "
";
+ $writable = check_writable ( "include", "Checking if ./include is writable");
+ if (file_exists("include/config.php"))
+ $writable += check_writable ( "include/config.php", "Checking if include/config.php is writable");
+ echo "
";
+
+ echo "
Warning: This installer will overwrite and destroy
+ your existing Pandora FMS configuration and Database. Before continue,
+ please be sure that you have no valuable Pandora FMS data in your Database.
+
";
+
+ echo "
Upgrade:
+ If you want to upgrade from Pandora FMS 4.x to 5.0 version, please use the migration tool inside /extras directory in this setup.
+
Pandora FMS is an OpenSource software project licensed under the GPL2 licence. Pandora FMS includes, as well, another software also licensed under LGPL and BSD licenses. Before continue, you must accept the licence terms..
+
For more information, please refer to our website at http://pandorafms.org and contact us if you have any kind of question about the usage of Pandora FMS
+
If you dont accept the licence terms, please, close your browser and delete Pandora FMS files.
+ ";
+
+ if (!file_exists("COPYING")) {
+ echo "
Licence file 'COPYING' is not present in your distribution. This means you have some 'partial' Pandora FMS distribution. We cannot continue without accepting the licence file.";
+ echo "
";
+ }
+ else {
+ echo "
";
+
+ echo "
+
+
+ Pandora FMS is an OpenSource Software project registered at
+ SourceForge
+
You have some incomplete
+ dependencies. Please correct them or this installer
+ will not be able to finish your installation.
+
+
+ Remember, if you install any PHP module to comply
+ with these dependences, you need to restart
+ your HTTP/Apache server after it to use the new
+ modules.
+
+ This wizard will create your Pandora FMS database,
+ and populate it with all the data needed to run for the first time.
+
+
+ You need a privileged user to create database schema, this is usually root user.
+ Information about root user will not be used or stored anymore.
+
+
+ You can also deploy the scheme into an existing Database.
+ In this case you need a privileged Database user and password of that instance.
+
+
+ Now, please, complete all details to configure your database and environment setup.
+
+
+ Warning: This installer will overwrite and destroy your existing
+ Pandora FMS configuration and Database. Before continue,
+ please be sure that you have no valuable Pandora FMS data in your Database.
+
+
";
+
+ if (extension_loaded("oci8")) {
+ echo "
For Oracle installation an existing Database with a privileged user is needed.
";
+ }
+ if (!$error) {
+ echo "
";
+
+ echo "";
+
+ echo "";
+ echo "
+
+ Pandora FMS is an OpenSource Software project registered at
+ SourceForge
+
';
}
else {
- $comments_form = '';
+ $comments_form = ui_print_message(__( 'If event replication is ongoing, it won\'t be possible to enter comments here. This option is only to allow local pandora users to see comments, but not to operate with them. The operation, when event replication is enabled, must be done only in the Metaconsole.'));
}
$comments = '
";
// Module id
$id = (int) get_parameter ("id", 0);
// Agent id
From 9977f1ddf9b7665104079d0e04a9b54bf5387550 Mon Sep 17 00:00:00 2001
From: "tatiana.llorente@artica.es"
Date: Mon, 1 Oct 2018 09:51:58 +0200
Subject: [PATCH 33/66] Added code for function api_get_agent_alias for the API
of the metaconsole - #2708
---
pandora_console/include/functions_agents.php | 12 ++++++----
pandora_console/include/functions_api.php | 25 +++++++++++++-------
2 files changed, 24 insertions(+), 13 deletions(-)
diff --git a/pandora_console/include/functions_agents.php b/pandora_console/include/functions_agents.php
index 45c72b2b83..5691750c69 100644
--- a/pandora_console/include/functions_agents.php
+++ b/pandora_console/include/functions_agents.php
@@ -28,13 +28,14 @@ require_once($config['homedir'] . '/include/functions_users.php');
*
* @param int $id_agent The agent id.
* @param boolean $show_disabled Show the agent found althought it is disabled. By default false.
+ * @param boolean $force_meta
*
* @return boolean The result to check if the agent is in the DB.
*/
-function agents_check_agent_exists($id_agent, $show_disabled = true) {
+function agents_check_agent_exists($id_agent, $show_disabled = true, $force_meta = false) {
$agent = db_get_value_filter(
'id_agente',
- 'tagente',
+ $force_meta ? 'tmetaconsole_agent' : 'tagente',
array('id_agente' => $id_agent, 'disabled' => !$show_disabled)
);
@@ -2735,17 +2736,18 @@ function agents_count_agents_filter ($filter = array(), $access = "AR") {
*
* @param int Id agent
* @param string ACL access bit
+ * @param boolean $force_meta
*
* @return True if user has access, false if user has not permissions and
* null if id agent does not exist
*/
-function agents_check_access_agent ($id_agent, $access = "AR") {
+function agents_check_access_agent ($id_agent, $access = "AR", $force_meta = false) {
global $config;
- if (users_access_to_agent($id_agent, $access)) return true;
+ if (users_access_to_agent($id_agent, $access, false, $force_meta)) return true;
// If agent exist return false
- if (agents_check_agent_exists($id_agent)) return false;
+ if (agents_check_agent_exists($id_agent, true, $force_meta)) return false;
// Return null otherwise
return null;
}
diff --git a/pandora_console/include/functions_api.php b/pandora_console/include/functions_api.php
index 189cc4203b..ca08e773c0 100644
--- a/pandora_console/include/functions_api.php
+++ b/pandora_console/include/functions_api.php
@@ -9186,18 +9186,27 @@ function api_get_agent_id($trash1, $trash2, $data, $returnType) {
* Agent alias for a given id
*
* @param int $id_agent
+ * @param int $id_node Only for metaconsole
+ * @param $thrash1 Don't use.
+ * @param $returnType
*
**/
-// http://localhost/pandora_console/include/api.php?op=get&op2=agent_name&id=1&apipass=1234&user=admin&pass=pandora
-function api_get_agent_alias($id_agent, $trash1, $trash2, $returnType) {
- if (defined ('METACONSOLE')) {
- return;
+// http://localhost/pandora_console/include/api.php?op=get&op2=agent_alias&id=1&apipass=1234&user=admin&pass=pandora
+// http://localhost/pandora_console/enterprise/meta/include/api.php?op=get&op2=agent_alias&id=1&id2=1&apipass=1234&user=admin&pass=pandora
+function api_get_agent_alias($id_agent, $id_node, $trash1, $returnType) {
+ $table_agent_alias = 'tagente';
+ $force_meta=false;
+
+ if (is_metaconsole()) {
+ $table_agent_alias = 'tmetaconsole_agent';
+ $force_meta = true;
+ $id_agent = db_get_value_sql("SELECT id_agente FROM tmetaconsole_agent WHERE id_tagente = $id_agent AND id_tmetaconsole_setup = $id_node");
}
- if (!util_api_check_agent_and_print_error($id_agent, $returnType)) return;
+ if (!util_api_check_agent_and_print_error($id_agent, $returnType, 'AR', $force_meta)) return;
$sql = sprintf('SELECT alias
- FROM tagente
+ FROM ' . $table_agent_alias . '
WHERE id_agente = %d', $id_agent);
$value = db_get_value_sql($sql);
@@ -11383,10 +11392,10 @@ function api_get_cluster_items ($cluster_id){
// AUX FUNCTIONS
/////////////////////////////////////////////////////////////////////
-function util_api_check_agent_and_print_error($id_agent, $returnType, $access = "AR") {
+function util_api_check_agent_and_print_error($id_agent, $returnType, $access = "AR", $force_meta = false) {
global $config;
- $check_agent = agents_check_access_agent($id_agent, $access);
+ $check_agent = agents_check_access_agent($id_agent, $access, $force_meta);
if ($check_agent === true) return true;
if ($check_agent === false || !check_acl($config['id_user'], 0, $access)) {
From 04226c79402cda4cc449c098a3efb8797affa945 Mon Sep 17 00:00:00 2001
From: "tatiana.llorente@artica.es"
Date: Mon, 1 Oct 2018 12:26:06 +0200
Subject: [PATCH 34/66] Changed styles for the button create_network_component
- #2814
---
pandora_console/operation/snmpconsole/snmp_browser.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pandora_console/operation/snmpconsole/snmp_browser.php b/pandora_console/operation/snmpconsole/snmp_browser.php
index 22fa43e5a6..435aaeade2 100644
--- a/pandora_console/operation/snmpconsole/snmp_browser.php
+++ b/pandora_console/operation/snmpconsole/snmp_browser.php
@@ -50,7 +50,7 @@ if (is_ajax()) {
else {
snmp_browser_print_tree ($snmp_tree);
echo html_print_submit_button(__('Create network components'),'create_network_component',
- false, array('style' => 'display: none; position: fixed; bottom: 55px; right: 80px;', 'class' => 'sub add'), true);
+ false, array('style' => 'display: none; position: absolute; bottom: 0px; right: 35px;', 'class' => 'sub add'), true);
echo '
';
echo "
";
From c4c0e89cbeb3d2b1a51f8cd8bba0435d3ffacecb Mon Sep 17 00:00:00 2001
From: "tatiana.llorente@artica.es"
Date: Mon, 1 Oct 2018 13:24:08 +0200
Subject: [PATCH 35/66] Added class data to the table for last activity - #2846
---
pandora_console/general/logon_ok.php | 1 +
1 file changed, 1 insertion(+)
diff --git a/pandora_console/general/logon_ok.php b/pandora_console/general/logon_ok.php
index c2ecec56da..5cd214304a 100644
--- a/pandora_console/general/logon_ok.php
+++ b/pandora_console/general/logon_ok.php
@@ -210,6 +210,7 @@ if (!empty($all_data)) {
echo '
';
$table = new stdClass();
+ $table->class = "databox data";
$table->width = '100%'; //Don't specify px
$table->data = array ();
$table->size = array ();
From ae4472d5c839da434d5136d30cb69d884ab6d9e6 Mon Sep 17 00:00:00 2001
From: "tatiana.llorente@artica.es"
Date: Mon, 1 Oct 2018 16:59:17 +0200
Subject: [PATCH 36/66] Added align center for the head of the table - #2848
---
pandora_console/operation/snmpconsole/snmp_view.php | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/pandora_console/operation/snmpconsole/snmp_view.php b/pandora_console/operation/snmpconsole/snmp_view.php
index 25dfd563ab..8712406ed9 100755
--- a/pandora_console/operation/snmpconsole/snmp_view.php
+++ b/pandora_console/operation/snmpconsole/snmp_view.php
@@ -708,50 +708,61 @@ $table->head = array ();
$table->size = array ();
$table->data = array ();
$table->align = array ();
+$table->headstyle = array ();
$table->head[0] = __('Status');
$table->align[0] = "center";
$table->size[0] = '5%';
+$table->headstyle[0] = 'text-align: center';
$table->head[1] = __('SNMP Agent');
$table->align[1] = "center";
$table->size[1] = '15%';
+$table->headstyle[1] = 'text-align: center';
$table->head[2] = __('Enterprise String');
$table->align[2] = "center";
$table->size[2] = '18%';
+$table->headstyle[2] = 'text-align: center';
if ($group_by) {
$table->head[3] = __('Count');
$table->align[3] = "center";
$table->size[3] = '5%';
+ $table->headstyle[3] = 'text-align: center';
}
$table->head[4] = __('Trap subtype');
$table->align[4] = "center";
$table->size[4] = '10%';
+$table->headstyle[4] = 'text-align: center';
$table->head[5] = __('User ID');
$table->align[5] = "center";
$table->size[5] = '10%';
+$table->headstyle[5] = 'text-align: center';
$table->head[6] = __('Timestamp');
$table->align[6] = "center";
$table->size[6] = '10%';
+$table->headstyle[6] = 'text-align: center';
$table->head[7] = __('Alert');
$table->align[7] = "center";
$table->size[7] = '5%';
+$table->headstyle[7] = 'text-align: center';
$table->head[8] = __('Action');
$table->align[8] = "center";
$table->size[8] = '10%';
+$table->headstyle[8] = 'text-align: center';
$table->head[9] = html_print_checkbox_extended ("allbox", 1, false,
false, "javascript:CheckAll();",
'class="chk" title="'.__('All').'"', true);
$table->align[9] = "center";
$table->size[9] = '5%';
+$table->headstyle[9] = 'text-align: center';
$table->style[8] = "background: #F3F3F3; color: #111 !important;";
From eba9c58f18db9cea241a82ffbe45a21fa1b9ec7c Mon Sep 17 00:00:00 2001
From: Ramon Novoa
Date: Tue, 2 Oct 2018 12:43:39 +0200
Subject: [PATCH 37/66] Prevent the counter from overflowing often when
server_threshold is low.
---
pandora_server/bin/pandora_server | 2 +-
pandora_server/lib/PandoraFMS/Core.pm | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/pandora_server/bin/pandora_server b/pandora_server/bin/pandora_server
index f26cf3d016..1edb896101 100755
--- a/pandora_server/bin/pandora_server
+++ b/pandora_server/bin/pandora_server
@@ -382,7 +382,7 @@ sub pandora_server_tasks ($) {
}
# Avoid counter overflow
- if ($counter > 10000){
+ if ($counter >= ~0){
$counter = 0;
}
else {
diff --git a/pandora_server/lib/PandoraFMS/Core.pm b/pandora_server/lib/PandoraFMS/Core.pm
index 5ce5614d16..4530493471 100644
--- a/pandora_server/lib/PandoraFMS/Core.pm
+++ b/pandora_server/lib/PandoraFMS/Core.pm
@@ -4882,7 +4882,7 @@ sub pandora_self_monitoring ($$) {
my $filename = $pa_config->{"incomingdir"}."/".$pa_config->{'servername'}.".self.".$utimestamp.".data";
- open (XMLFILE, ">> $filename") or die "[FATAL] Could not open internal monitoring XML file for deploying monitorization at '$filename'";
+ open (XMLFILE, ">", $filename) or die "[FATAL] Could not open internal monitoring XML file for deploying monitorization at '$filename'";
print XMLFILE $xml_output;
close (XMLFILE);
}
From 61a3d147afbada7342ac5c88829aff81d024a1d8 Mon Sep 17 00:00:00 2001
From: "tatiana.llorente@artica.es"
Date: Wed, 3 Oct 2018 16:41:58 +0200
Subject: [PATCH 38/66] Added descriptive error messages - #2858
---
.../godmode/alerts/alert_actions.php | 18 ++++++++++++--
.../godmode/alerts/alert_commands.php | 17 +++++++++++--
pandora_console/godmode/alerts/alert_list.php | 20 ++++++++++++++--
.../godmode/alerts/alert_special_days.php | 24 +++++++++++++++----
.../alerts/configure_alert_template.php | 16 +++++++++++--
5 files changed, 82 insertions(+), 13 deletions(-)
diff --git a/pandora_console/godmode/alerts/alert_actions.php b/pandora_console/godmode/alerts/alert_actions.php
index 3bad38b982..a80ba40a23 100644
--- a/pandora_console/godmode/alerts/alert_actions.php
+++ b/pandora_console/godmode/alerts/alert_actions.php
@@ -179,9 +179,23 @@ if ($create_action) {
db_pandora_audit("Command management", "Fail try to create alert action", false, false);
}
- ui_print_result_message ($result,
+
+ /* Show errors */
+ if (!isset($messageAction)) {
+ $messageAction = __('Could not be created');
+ }
+
+ if ($name == "") {
+ $messageAction = __('No name specified');
+ }
+
+ if ($id_alert_command == "") {
+ $messageAction = __('No command specified');
+ }
+
+ $messageAction = ui_print_result_message ($result,
__('Successfully created'),
- __('Could not be created'));
+ $messageAction);
}
if ($update_action) {
diff --git a/pandora_console/godmode/alerts/alert_commands.php b/pandora_console/godmode/alerts/alert_commands.php
index 09e868f951..9ca4ea501a 100644
--- a/pandora_console/godmode/alerts/alert_commands.php
+++ b/pandora_console/godmode/alerts/alert_commands.php
@@ -307,9 +307,22 @@ if ($create_command) {
db_pandora_audit("Command management", "Fail try to create alert command", false, false);
}
- ui_print_result_message ($result,
+ /* Show errors */
+ if (!isset($messageAction)) {
+ $messageAction = __('Could not be created');
+ }
+
+ if ($name == "") {
+ $messageAction = __('No name specified');
+ }
+
+ if ($command == "") {
+ $messageAction = __('No command specified');
+ }
+
+ $messageAction = ui_print_result_message ($result,
__('Successfully created'),
- __('Could not be created'));
+ $messageAction);
}
diff --git a/pandora_console/godmode/alerts/alert_list.php b/pandora_console/godmode/alerts/alert_list.php
index 9a6badcc24..4d61925550 100644
--- a/pandora_console/godmode/alerts/alert_list.php
+++ b/pandora_console/godmode/alerts/alert_list.php
@@ -126,9 +126,25 @@ if ($create_alert) {
"Fail Added alert '$unsafe_alert_template_name' for module '$unsafe_module_name' in agent '$unsafe_agent_alias'");
}
- $messageAction = ui_print_result_message ($id,
- __('Successfully created'), __('Could not be created'), '', true);
+
+ /* Show errors */
+ if (!isset($messageAction)) {
+ $messageAction = __('Could not be created');
+ }
+ if ($id_alert_template == "") {
+ $messageAction = __('No template specified');
+ }
+
+ if ($id_agent_module == "") {
+ $messageAction = __('No module specified');
+ }
+
+ $messageAction = ui_print_result_message ($id,
+ __('Successfully created'),
+ $messageAction);
+
+
if ($id !== false) {
$action_select = get_parameter('action_select');
diff --git a/pandora_console/godmode/alerts/alert_special_days.php b/pandora_console/godmode/alerts/alert_special_days.php
index c221f963af..0e4ce10a38 100644
--- a/pandora_console/godmode/alerts/alert_special_days.php
+++ b/pandora_console/godmode/alerts/alert_special_days.php
@@ -130,6 +130,7 @@ if ($create_special_day) {
$date_check = db_get_value_filter ('date', 'talert_special_days', $filter);
if ($date_check == $date) {
$result = '';
+ $messageAction = __('Could not be created, it already exists');
}
else {
$result = alerts_create_alert_special_day ($date, $same_day, $values);
@@ -143,10 +144,16 @@ if ($create_special_day) {
else {
db_pandora_audit("Command management", "Fail try to create special day", false, false);
}
-
- ui_print_result_message ($result,
+
+
+ /* Show errors */
+ if (!isset($messageAction)) {
+ $messageAction = __('Could not be created');
+ }
+
+ $messageAction = ui_print_result_message ($result,
__('Successfully created'),
- __('Could not be created'));
+ $messageAction);
}
if ($update_special_day) {
@@ -183,6 +190,7 @@ if ($update_special_day) {
$date_check = db_get_value_filter ('date', 'talert_special_days', $filter);
if ($date_check == $date) {
$result = '';
+ $messageAction = __('Could not be updated, it already exists');
}
else {
$result = alerts_update_alert_special_day ($id, $values);
@@ -202,9 +210,15 @@ if ($update_special_day) {
db_pandora_audit("Command management", "Fail to update special day " . $id, false, false);
}
- ui_print_result_message ($result,
+
+ /* Show errors */
+ if (!isset($messageAction)) {
+ $messageAction = __('Could not be updated');
+ }
+
+ $messageAction = ui_print_result_message ($result,
__('Successfully updated'),
- __('Could not be updated'));
+ $messageAction);
}
if ($delete_special_day) {
diff --git a/pandora_console/godmode/alerts/configure_alert_template.php b/pandora_console/godmode/alerts/configure_alert_template.php
index 5fc232490a..b75b26561f 100644
--- a/pandora_console/godmode/alerts/configure_alert_template.php
+++ b/pandora_console/godmode/alerts/configure_alert_template.php
@@ -428,9 +428,21 @@ if ($create_template) {
json_encode($values));
}
- ui_print_result_message ($result,
+
+ /* Show errors */
+ if (!isset($messageAction)) {
+ $messageAction = __('Could not be created');
+ }
+
+ if ($name == "") {
+ $messageAction = __('No template name specified');
+ }
+
+ $messageAction = ui_print_result_message ($result,
__('Successfully created'),
- __('Could not be created'));
+ $messageAction);
+
+
/* Go to previous step in case of error */
if ($result === false)
$step = $step - 1;
From 0855d091562e16fb3074e3621dd635014f1ce5b5 Mon Sep 17 00:00:00 2001
From: "tatiana.llorente@artica.es"
Date: Wed, 3 Oct 2018 16:46:35 +0200
Subject: [PATCH 39/66] Fixed a minor mistake - #2858
---
pandora_console/godmode/alerts/alert_list.php | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/pandora_console/godmode/alerts/alert_list.php b/pandora_console/godmode/alerts/alert_list.php
index 4d61925550..4df1ec4be5 100644
--- a/pandora_console/godmode/alerts/alert_list.php
+++ b/pandora_console/godmode/alerts/alert_list.php
@@ -141,9 +141,8 @@ if ($create_alert) {
}
$messageAction = ui_print_result_message ($id,
- __('Successfully created'),
- $messageAction);
-
+ __('Successfully created'), $messageAction, '', true);
+
if ($id !== false) {
$action_select = get_parameter('action_select');
From 7766881da623cf3b6ed4718c51cc8606edc0b6c9 Mon Sep 17 00:00:00 2001
From: fbsanchez
Date: Thu, 4 Oct 2018 17:07:34 +0200
Subject: [PATCH 40/66] Added option charset to db_connect Removed unused
function db_get_table_count
---
pandora_console/include/db/mysql.php | 47 +++--------------------
pandora_console/include/db/oracle.php | 36 -----------------
pandora_console/include/db/postgresql.php | 35 -----------------
pandora_console/include/functions_db.php | 26 +++----------
4 files changed, 10 insertions(+), 134 deletions(-)
diff --git a/pandora_console/include/db/mysql.php b/pandora_console/include/db/mysql.php
index 7101f960de..45f0a22db6 100644
--- a/pandora_console/include/db/mysql.php
+++ b/pandora_console/include/db/mysql.php
@@ -14,7 +14,7 @@
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
-function mysql_connect_db($host = null, $db = null, $user = null, $pass = null, $port = null) {
+function mysql_connect_db($host = null, $db = null, $user = null, $pass = null, $port = null, $charset = "utf8") {
global $config;
if ($host === null)
@@ -42,6 +42,8 @@ function mysql_connect_db($host = null, $db = null, $user = null, $pass = null,
}
db_change_cache_id ($db, $host);
+ mysqli_set_charset($connect_id, $charset);
+
mysqli_select_db($connect_id, $db);
}
else {
@@ -52,6 +54,8 @@ function mysql_connect_db($host = null, $db = null, $user = null, $pass = null,
db_change_cache_id ($db, $host);
+ @mysql_set_charset($connect_id, $charset);
+
mysql_select_db($db, $connect_id);
}
@@ -1198,47 +1202,6 @@ function mysql_db_get_type_field_table($table, $field) {
}
}
-/**
- * Get the element count of a table.
- *
- * @param string $sql SQL query to get the element count.
- *
- * @return int Return the number of elements in the table.
- */
-function mysql_db_get_table_count($sql, $search_history_db = false) {
- global $config;
-
- $history_count = 0;
- $count = mysql_db_get_value_sql ($sql);
- if ($count === false) {
- $count = 0;
- }
-
- // Search the history DB for matches
- if ($search_history_db && $config['history_db_enabled'] == 1) {
-
- // Connect to the history DB
- if (! isset ($config['history_db_connection']) || $config['history_db_connection'] === false) {
- if ($config["mysqli"]) {
- $config['history_db_connection'] = mysqli_connect_db ($config['history_db_host'], $config['history_db_user'], io_output_password($config['history_db_pass']), $config['history_db_name'], $config['history_db_port'], false);
- }
- else {
- $config['history_db_connection'] = mysql_connect_db ($config['history_db_host'], $config['history_db_name'], $config['history_db_user'], io_output_password($config['history_db_pass']), $config['history_db_port'], false);
- }
- }
- if ($config['history_db_connection'] !== false) {
- $history_count = mysql_db_get_value_sql ($sql, $config['history_db_connection']);
- if ($history_count === false) {
- $history_count = 0;
- }
- }
- }
-
- $count += $history_count;
-
- return $count;
-}
-
function mysql_get_fields($table) {
global $config;
diff --git a/pandora_console/include/db/oracle.php b/pandora_console/include/db/oracle.php
index a651eeffa7..4e7cec79f4 100644
--- a/pandora_console/include/db/oracle.php
+++ b/pandora_console/include/db/oracle.php
@@ -1476,42 +1476,6 @@ function oracle_list_all_field_table($table_name, $return_mode = 'array') {
}
}
-/**
- * Get the element count of a table.
- *
- * @param string $sql SQL query to get the element count.
- *
- * @return int Return the number of elements in the table.
- */
-function oracle_db_get_table_count($sql, $search_history_db = false) {
- global $config;
-
- $history_count = 0;
- $count = oracle_db_get_value_sql ($sql);
- if ($count === false) {
- $count = 0;
- }
-
- // Search the history DB for matches
- if ($search_history_db && $config['history_db_enabled'] == 1) {
-
- // Connect to the history DB
- if (! isset ($config['history_db_connection']) || $config['history_db_connection'] === false) {
- $config['history_db_connection'] = oracle_connect_db ($config['history_db_host'], $config['history_db_name'], $config['history_db_user'], io_output_password($config['history_db_pass']), $config['history_db_port'], false);
- }
- if ($config['history_db_connection'] !== false) {
- $history_count = oracle_db_get_value_sql ($sql, $config['history_db_connection']);
- if ($history_count === false) {
- $history_count = 0;
- }
- }
- }
-
- $count += $history_count;
-
- return $count;
-}
-
/**
* Process a file with an oracle schema sentences.
* Based on the function which installs the pandoradb.sql schema.
diff --git a/pandora_console/include/db/postgresql.php b/pandora_console/include/db/postgresql.php
index 7b1bd56ec0..1b74f21b07 100644
--- a/pandora_console/include/db/postgresql.php
+++ b/pandora_console/include/db/postgresql.php
@@ -1055,40 +1055,5 @@ function postgresql_db_get_type_field_table($table, $field) {
return pg_field_type($result, $field);
}
-/**
- * Get the element count of a table.
- *
- * @param string $sql SQL query to get the element count.
- *
- * @return int Return the number of elements in the table.
- */
-function postgresql_db_get_table_count($sql, $search_history_db = false) {
- global $config;
-
- $history_count = 0;
- $count = postgresql_db_get_value_sql ($sql);
- if ($count === false) {
- $count = 0;
- }
-
- // Search the history DB for matches
- if ($search_history_db && $config['history_db_enabled'] == 1) {
-
- // Connect to the history DB
- if (! isset ($config['history_db_connection']) || $config['history_db_connection'] === false) {
- $config['history_db_connection'] = postgresql_connect_db ($config['history_db_host'], $config['history_db_name'], $config['history_db_user'], io_output_password($config['history_db_pass']), $config['history_db_port'], false);
- }
- if ($config['history_db_connection'] !== false) {
- $history_count = postgresql_db_get_value_sql ($sql, $config['history_db_connection']);
- if ($history_count === false) {
- $history_count = 0;
- }
- }
- }
-
- $count += $history_count;
-
- return $count;
-}
?>
diff --git a/pandora_console/include/functions_db.php b/pandora_console/include/functions_db.php
index aaf61db8cd..063897ea74 100644
--- a/pandora_console/include/functions_db.php
+++ b/pandora_console/include/functions_db.php
@@ -43,13 +43,13 @@ function db_select_engine() {
}
}
-function db_connect($host = null, $db = null, $user = null, $pass = null, $port = null, $critical = true) {
+function db_connect($host = null, $db = null, $user = null, $pass = null, $port = null, $critical = true, $charset = "utf8") {
global $config;
static $error = 0;
switch ($config["dbtype"]) {
case "mysql":
- $return = mysql_connect_db($host, $db, $user, $pass, $port);
+ $return = mysql_connect_db($host, $db, $user, $pass, $port, $charset);
break;
case "postgresql":
$return = postgresql_connect_db($host, $db, $user, $pass, $port);
@@ -1654,28 +1654,12 @@ function db_get_type_field_table($table, $field) {
}
/**
- * Get the element count of a table.
+ * Get the columns of a table.
*
- * @param string $sql SQL query to get the element count.
+ * @param string $table table to retrieve columns.
*
- * @return int Return the number of elements in the table.
+ * @return array with column names.
*/
-function db_get_table_count($table, $search_history_db = false) {
- global $config;
-
- switch ($config["dbtype"]) {
- case "mysql":
- return mysql_db_get_table_count($table, $search_history_db);
- break;
- case "postgresql":
- return postgresql_db_get_table_count($table, $search_history_db);
- break;
- case "oracle":
- return oracle_db_get_table_count($table, $search_history_db);
- break;
- }
-}
-
function db_get_fields($table) {
global $config;
From 015dcdb032cdc626ccfb89772c800e6fc75ce44a Mon Sep 17 00:00:00 2001
From: samucarc
Date: Thu, 11 Oct 2018 13:07:59 +0200
Subject: [PATCH 41/66] Fixed enterprise ACLs in Agents View
---
pandora_console/operation/agentes/estado_agente.php | 4 ++--
pandora_console/operation/agentes/group_view.php | 10 +++++-----
2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/pandora_console/operation/agentes/estado_agente.php b/pandora_console/operation/agentes/estado_agente.php
index d37cc9396c..20d3f18a47 100644
--- a/pandora_console/operation/agentes/estado_agente.php
+++ b/pandora_console/operation/agentes/estado_agente.php
@@ -623,7 +623,7 @@ foreach ($agents as $agent) {
$data[0] = '
';
$data[0] .= '';
- $data[0] .= ''.$agent["alias"].'';
+ $data[0] .= ''.$agent["alias"].'';
$data[0] .= '';
if ($agent['quiet']) {
@@ -642,7 +642,7 @@ foreach ($agents as $agent) {
$data[0] .= ''.__('View').'';
}
else{
- $data[0] .= ''.__('View').'';
+ $data[0] .= ''.__('View').'';
}
if (check_acl ($config['id_user'], $agent["id_grupo"], "AW")) {
diff --git a/pandora_console/operation/agentes/group_view.php b/pandora_console/operation/agentes/group_view.php
index abc31b4ea4..d80870f334 100644
--- a/pandora_console/operation/agentes/group_view.php
+++ b/pandora_console/operation/agentes/group_view.php
@@ -246,7 +246,7 @@ if (!empty($result_groups)) {
$link = "";
} else {
$deep = groups_get_group_deep ($data['_id_']);
- $link = "";
+ $link = "";
}
$group_name = "" . ui_print_truncate_text($data['_name_'], 50) . "";
@@ -279,7 +279,7 @@ if (!empty($result_groups)) {
href='index.php?sec=monitoring&sec2=operation/tree&tag_id=".$data['_id_']. "'>";
} else {
$link = "";
+ href='index.php?sec=view&sec2=operation/agentes/estado_agente&group_id=".$data['_id_']."'>";
}
if ($data["_id_"] == 0) {
echo $link . $total_agentes . "";
@@ -296,7 +296,7 @@ if (!empty($result_groups)) {
href='index.php?sec=monitoring&sec2=operation/tree&tag_id=".$data['_id_']. "&status=" . AGENT_STATUS_UNKNOWN ."'>";
} else {
$link = "";
+ href='index.php?sec=view&sec2=operation/agentes/estado_agente&group_id=".$data['_id_']."&status=" . AGENT_STATUS_UNKNOWN ."'>";
}
if (($data["_id_"] == 0) && ($agents_unknown != 0)) {
echo $link . $agents_unknown . "";
@@ -313,7 +313,7 @@ if (!empty($result_groups)) {
href='index.php?sec=monitoring&sec2=operation/tree&tag_id=".$data['_id_']. "&status=" . AGENT_STATUS_NOT_INIT ."'>";
} else {
$link = "";
+ href='index.php?sec=view&sec2=operation/agentes/estado_agente&group_id=".$data['_id_']."&status=" . AGENT_STATUS_NOT_INIT ."'>";
}
if (($data["_id_"] == 0) && ($agents_notinit != 0)) {
echo $link . $agents_notinit . "";
@@ -331,7 +331,7 @@ if (!empty($result_groups)) {
href='index.php?sec=monitoring&sec2=operation/tree&tag_id=".$data['_id_']. "&status=" . AGENT_STATUS_CRITICAL ."'>";
} else {
$link = "";
+ href='index.php?sec=view&sec2=operation/agentes/estado_agente&group_id=".$data['_id_']."&status=" . AGENT_STATUS_CRITICAL ."'>";
}
if (($data["_id_"] == 0) && ($agents_critical != 0)) {
echo $link . $agents_critical . "";
From c74e4a3d6ada19dcee3f2188d65cc1443c6e148b Mon Sep 17 00:00:00 2001
From: fermin831
Date: Thu, 11 Oct 2018 15:45:11 +0200
Subject: [PATCH 42/66] Fixed agent filter on agents/module view to see
secondary groups
---
.../operation/agentes/ver_agente.php | 21 +++++++++++++------
1 file changed, 15 insertions(+), 6 deletions(-)
diff --git a/pandora_console/operation/agentes/ver_agente.php b/pandora_console/operation/agentes/ver_agente.php
index f98af59772..438132240e 100644
--- a/pandora_console/operation/agentes/ver_agente.php
+++ b/pandora_console/operation/agentes/ver_agente.php
@@ -68,14 +68,18 @@ if (is_ajax ()) {
}
}
else {
- $groups_orig = users_get_groups(false, $privilege);
+ $groups_orig = users_get_groups(false, $privilege, false);
$groups = array_keys($groups_orig);
}
-
+
// Build filter
$filter = array();
- $filter['id_grupo'] = $groups;
-
+ // Group filter (primary and secondary)
+ $filter[] = "(" .db_format_array_where_clause_sql(
+ array('id_grupo' => $groups, 'id_group' => $groups),
+ 'OR'
+ ) . ")";
+
if (!empty($id_os))
$filter['id_os'] = $id_os;
if (!empty($agent_name))
@@ -158,12 +162,17 @@ if (is_ajax ()) {
}
}
-
+ $filter['group'] = 'id_agente';
+
// Build fields
$fields = array('id_agente', 'alias');
// Perform search
- $agents = db_get_all_rows_filter('tagente', $filter, $fields);
+ $agents = db_get_all_rows_filter(
+ 'tagente LEFT JOIN tagent_secondary_group ON id_agente=id_agent',
+ $filter,
+ $fields
+ );
if (empty($agents)) $agents = array();
foreach ($agents as $k => $v) {
From 0747a5b263f7a8b81487507da0b9331ed6eb4dd1 Mon Sep 17 00:00:00 2001
From: fermin831
Date: Thu, 11 Oct 2018 16:00:49 +0200
Subject: [PATCH 43/66] Fixed secondary groups privileges in agent popup in
tree view
---
pandora_console/include/functions_treeview.php | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/pandora_console/include/functions_treeview.php b/pandora_console/include/functions_treeview.php
index 2f2e899143..544c66b35a 100755
--- a/pandora_console/include/functions_treeview.php
+++ b/pandora_console/include/functions_treeview.php
@@ -468,8 +468,6 @@ function treeview_printTable($id_agente, $server_data = array(), $no_head = fals
enterprise_include_once ('meta/include/functions_ui_meta.php');
include_graphs_dependencies();
- $strict_user = (bool) db_get_value("strict_acl", "tusuario", "id_user", $config['id_user']);
-
$is_extra = enterprise_hook('policies_is_agent_extra_policy', array($id_agente));
if ($is_extra === ENTERPRISE_NOT_HOOK) {
@@ -483,9 +481,13 @@ function treeview_printTable($id_agente, $server_data = array(), $no_head = fals
return;
}
+ // Get the agent info
$agent = db_get_row ("tagente", "id_agente", $id_agente);
-
- if (! check_acl ($config["id_user"], $agent["id_grupo"], "AR") && ! check_acl ($config["id_user"], $agent["id_grupo"], "AW") && !$is_extra) {
+ if ($agent == false) return;
+
+ // Check all groups
+ $groups = agents_get_all_groups_agent($id_agente, $agent["id_grupo"], is_metaconsole());
+ if (! check_acl_one_of_groups ($config["id_user"], $groups, "AR") && ! check_acl_one_of_groups ($config["id_user"], $groups, "AW") && !$is_extra) {
db_pandora_audit("ACL Violation",
"Trying to access Agent General Information");
require_once ("general/noaccess.php");
From 41d104ae2c2e85fb394dca67d2338d0f0ff08263 Mon Sep 17 00:00:00 2001
From: fermin831
Date: Mon, 15 Oct 2018 12:23:51 +0200
Subject: [PATCH 44/66] Improve performance on tactical view with a lot of
events
---
pandora_console/include/functions_events.php | 25 +-
pandora_console/include/functions_graph.php | 59 ++---
.../include/functions_reporting.php | 214 +++++++-----------
.../operation/agentes/tactical.php | 7 +-
4 files changed, 116 insertions(+), 189 deletions(-)
diff --git a/pandora_console/include/functions_events.php b/pandora_console/include/functions_events.php
index 39c5fa59ae..dd4c441b2a 100644
--- a/pandora_console/include/functions_events.php
+++ b/pandora_console/include/functions_events.php
@@ -850,25 +850,14 @@ function events_print_event_table ($filter = "", $limit = 10, $width = 440, $ret
if ($filter == '') {
$filter = '1 = 1';
}
-
- switch ($config["dbtype"]) {
- case "mysql":
- case "postgresql":
- $sql = sprintf ("SELECT DISTINCT tevento.*
- FROM tevento LEFT JOIN tagent_secondary_group tasg ON tevento.id_agente = tasg.id_agent
- WHERE %s %s
- ORDER BY utimestamp DESC LIMIT %d", $agent_condition, $filter, $limit);
- break;
- case "oracle":
- $sql = sprintf ("SELECT *
- FROM tevento
- WHERE %s %s AND rownum <= %d
- ORDER BY utimestamp DESC", $agent_condition, $filter, $limit);
- break;
- }
+
+ $sql = sprintf ("SELECT DISTINCT tevento.*
+ FROM tevento LEFT JOIN tagent_secondary_group tasg ON tevento.id_agente = tasg.id_agent
+ WHERE %s %s
+ ORDER BY utimestamp DESC LIMIT %d", $agent_condition, $filter, $limit);
$result = db_get_all_rows_sql ($sql);
-
+
if ($result === false) {
if ($return) {
$returned = ui_print_info_message (__('No events'), '', true);
@@ -997,8 +986,6 @@ function events_print_event_table ($filter = "", $limit = 10, $width = 440, $ret
$data[4] = "".
agents_get_alias($event["id_agente"]). "";
-
- // ui_print_agent_name ($event["id_agente"], true, 25, '', true);
// for System or SNMP generated alerts
}
elseif ($event["event_type"] == "system") {
diff --git a/pandora_console/include/functions_graph.php b/pandora_console/include/functions_graph.php
index 4bb4a26b47..0de011beb8 100644
--- a/pandora_console/include/functions_graph.php
+++ b/pandora_console/include/functions_graph.php
@@ -2719,10 +2719,8 @@ function graph_events_validated($width = 300, $height = 200, $extra_filters = ar
* @param integer width pie graph width
* @param integer height pie graph height
* @param string url
- * @param bool if the graph required is or not for metaconsole
- * @param bool if the graph required is or not for history table
*/
-function grafico_eventos_grupo ($width = 300, $height = 200, $url = "", $meta = false, $history = false, $noWaterMark = true) {
+function grafico_eventos_grupo ($width = 300, $height = 200, $url = "", $noWaterMark = true, $time_limit = false) {
global $config;
global $graphic_type;
@@ -2752,26 +2750,15 @@ function grafico_eventos_grupo ($width = 300, $height = 200, $url = "", $meta =
$url = str_replace(
'SELECT_id_agente_modulo', 'SELECT id_agente_modulo', $url);
-
- // Choose the table where search if metaconsole or not
- if ($meta) {
- if ($history) {
- $event_table = 'tmetaconsole_event_history';
- }
- else {
- $event_table = 'tmetaconsole_event';
- }
- $field_extra = ', agent_name';
- $groupby_extra = ', server_id';
- }
- else {
- $event_table = 'tevento';
- $field_extra = '';
- $groupby_extra = '';
- }
+ $event_table = 'tevento';
+ $field_extra = '';
+ $groupby_extra = '';
// Add tags condition to filter
$tags_condition = tags_get_acl_tags($config['id_user'], 0, 'ER', 'event_condition', 'AND');
+ if ($time_limit) {
+ $tags_condition .= " AND utimestamp > (UNIX_TIMESTAMP(NOW()) - " . SECONDS_1DAY . ")";
+ }
//This will give the distinct id_agente, give the id_grupo that goes
//with it and then the number of times it occured. GROUP BY statement
@@ -2805,13 +2792,8 @@ function grafico_eventos_grupo ($width = 300, $height = 200, $url = "", $meta =
$system_events += $row["count"];
}
else {
- if ($meta) {
- $name = mb_substr (io_safe_output($row['agent_name']), 0, 25)." (".$row["count"].")";
- }
- else {
- $alias = agents_get_alias($row["id_agente"]);
- $name = mb_substr($alias, 0, 25)." #".$row["id_agente"]." (".$row["count"].")";
- }
+ $alias = agents_get_alias($row["id_agente"]);
+ $name = mb_substr($alias, 0, 25)." #".$row["id_agente"]." (".$row["count"].")";
$data[$name] = $row["count"];
}
}
@@ -2822,14 +2804,7 @@ function grafico_eventos_grupo ($width = 300, $height = 200, $url = "", $meta =
$name = __('SYSTEM')." (".$system_events.")";
$data[$name] = $system_events;
}
-
- /*
- if ($other_events > 0) {
- $name = __('Other')." (".$other_events.")";
- $data[$name] = $other_events;
- }
- */
-
+
// Sort the data
arsort($data);
if ($noWaterMark) {
@@ -2851,7 +2826,7 @@ function grafico_eventos_grupo ($width = 300, $height = 200, $url = "", $meta =
*
* @param string filter Filter for query in DB
*/
-function grafico_eventos_total($filter = "", $width = 320, $height = 200, $noWaterMark = true) {
+function grafico_eventos_total($filter = "", $width = 320, $height = 200, $noWaterMark = true, $time_limit = false) {
global $config;
global $graphic_type;
@@ -2860,23 +2835,25 @@ function grafico_eventos_total($filter = "", $width = 320, $height = 200, $noWat
// Add tags condition to filter
$tags_condition = tags_get_acl_tags($config['id_user'], 0, 'ER', 'event_condition', 'AND');
$filter .= $tags_condition;
-
+ if ($time_limit) {
+ $filter .= " AND utimestamp > (UNIX_TIMESTAMP(NOW()) - " . SECONDS_1DAY . ")";
+ }
+
$data = array ();
$legend = array ();
$total = 0;
-
- $where = '';
+
+ $where = "WHERE 1=1";
if (!users_is_admin()) {
$where = 'WHERE event_type NOT IN (\'recon_host_detected\', \'system\',\'error\', \'new_agent\', \'configuration_change\')';
}
-
+
$sql = sprintf("SELECT criticity, COUNT(id_evento) events
FROM tevento
LEFT JOIN tagent_secondary_group tasg
ON tevento.id_agente = tasg.id_agent
%s %s
GROUP BY criticity ORDER BY events DESC", $where , $filter);
-
$criticities = db_get_all_rows_sql ($sql, false, false);
if (empty($criticities)) {
diff --git a/pandora_console/include/functions_reporting.php b/pandora_console/include/functions_reporting.php
index 668e576c64..015bf1c8bd 100755
--- a/pandora_console/include/functions_reporting.php
+++ b/pandora_console/include/functions_reporting.php
@@ -10065,7 +10065,7 @@ function reporting_get_agentmodule_sla_array ($id_agent_module, $period = 0, $mi
return $data_colors;
}
-function reporting_get_stats_servers($tiny = true) {
+function reporting_get_stats_servers() {
global $config;
$server_performance = servers_get_performance();
@@ -10101,21 +10101,20 @@ function reporting_get_stats_servers($tiny = true) {
$table_srv->rowclass[] = '';
$table_srv->data[] = $tdata;
- if ($tiny) {
+ if (isset($server_performance ["total_network_modules"])) {
$tdata = array();
- $tdata[0] = html_print_image('images/network.png', true, array('title' => __('Remote modules'), 'width' => '25px'));
- $tdata[1] = '' . format_numeric($server_performance ["total_remote_modules"]) . '';
+ $tdata[0] = html_print_image('images/network.png', true, array('title' => __('Network modules'), 'width' => '25px'));
+ $tdata[1] = '' . format_numeric($server_performance ["total_network_modules"]) . '';
- /* Hello there! :)
-We added some of what seems to be "buggy" messages to the openSource version recently. This is not to force open-source users to move to the enterprise version, this is just to inform people using Pandora FMS open source that it requires skilled people to maintain and keep it running smoothly without professional support. This does not imply open-source version is limited in any way. If you check the recently added code, it contains only warnings and messages, no limitations except one: we removed the option to add custom logo in header. In the Update Manager section, it warns about the 'danger’ of applying automated updates without a proper backup, remembering in the process that the Enterprise version comes with a human-tested package. Maintaining an OpenSource version with more than 500 agents is not so easy, that's why someone using a Pandora with 8000 agents should consider asking for support. It's not a joke, we know of many setups with a huge number of agents, and we hate to hear that “its becoming unstable and slow” :(
-You can of course remove the warnings, that's why we include the source and do not use any kind of trick. And that's why we added here this comment, to let you know this does not reflect any change in our opensource mentality of does the last 14 years.
-*/
-
- $tdata[2] = '' . format_numeric($server_performance ["remote_modules_rate"], 2) . '';
+ $tdata[2] = '' .
+ format_numeric($server_performance["network_modules_rate"], 2) .
+ '';
+
+
$tdata[3] = html_print_image('images/module.png', true, array('title' => __('Ratio') . ': ' . __('Modules by second'), 'width' => '16px')) . '/sec ';
if($server_performance ["total_remote_modules"]>10000 && !enterprise_installed()){
- $tdata[4] = "
";
+ $tdata[4] = "
";
}
else{
$tdata[4] = ' ';
@@ -10124,128 +10123,91 @@ You can of course remove the warnings, that's why we include the source and do n
$table_srv->rowclass[] = '';
$table_srv->data[] = $tdata;
}
- else {
- if (isset($server_performance ["total_network_modules"])) {
- $tdata = array();
- $tdata[0] = html_print_image('images/network.png', true, array('title' => __('Network modules'), 'width' => '25px'));
- $tdata[1] = '' . format_numeric($server_performance ["total_network_modules"]) . '';
-
- $tdata[2] = '' .
- format_numeric($server_performance["network_modules_rate"], 2) .
- '';
-
-
- $tdata[3] = html_print_image('images/module.png', true, array('title' => __('Ratio') . ': ' . __('Modules by second'), 'width' => '16px')) . '/sec ';
-
- if($server_performance ["total_remote_modules"]>10000 && !enterprise_installed()){
- $tdata[4] = "
";
- }
- else{
- $tdata[4] = ' ';
- }
-
- $table_srv->rowclass[] = '';
- $table_srv->data[] = $tdata;
- }
-
- if (isset($server_performance ["total_plugin_modules"])) {
- $tdata = array();
- $tdata[0] = html_print_image('images/plugin.png', true, array('title' => __('Plugin modules'), 'width' => '25px'));
- $tdata[1] = '' . format_numeric($server_performance ["total_plugin_modules"]) . '';
-
- $tdata[2] = '' . format_numeric($server_performance ["plugin_modules_rate"], 2) . '';
- $tdata[3] = html_print_image('images/module.png', true, array('title' => __('Ratio') . ': ' . __('Modules by second'), 'width' => '16px')) . '/sec ';
-
- $table_srv->rowclass[] = '';
- $table_srv->data[] = $tdata;
- }
-
- if (isset($server_performance ["total_prediction_modules"])) {
- $tdata = array();
- $tdata[0] = html_print_image('images/chart_bar.png', true, array('title' => __('Prediction modules'), 'width' => '25px'));
- $tdata[1] = '' . format_numeric($server_performance ["total_prediction_modules"]) . '';
-
- $tdata[2] = '' . format_numeric($server_performance ["prediction_modules_rate"], 2) . '';
- $tdata[3] = html_print_image('images/module.png', true, array('title' => __('Ratio') . ': ' . __('Modules by second'), 'width' => '16px')) . '/sec ';
-
- $table_srv->rowclass[] = '';
- $table_srv->data[] = $tdata;
- }
-
- if (isset($server_performance ["total_wmi_modules"])) {
- $tdata = array();
- $tdata[0] = html_print_image('images/wmi.png', true, array('title' => __('WMI modules'), 'width' => '25px'));
- $tdata[1] = '' . format_numeric($server_performance ["total_wmi_modules"]) . '';
-
- $tdata[2] = '' . format_numeric($server_performance ["wmi_modules_rate"], 2) . '';
- $tdata[3] = html_print_image('images/module.png', true, array('title' => __('Ratio') . ': ' . __('Modules by second'), 'width' => '16px')) . '/sec ';
-
- $table_srv->rowclass[] = '';
- $table_srv->data[] = $tdata;
- }
-
- if (isset($server_performance ["total_web_modules"])) {
- $tdata = array();
- $tdata[0] = html_print_image('images/world.png', true, array('title' => __('Web modules'), 'width' => '25px'));
- $tdata[1] = '' .
- format_numeric($server_performance ["total_web_modules"]) .
- '';
-
- $tdata[2] = '' .
- format_numeric($server_performance ["web_modules_rate"], 2) .
- '';
- $tdata[3] = html_print_image('images/module.png', true, array('title' => __('Ratio') . ': ' . __('Modules by second'), 'width' => '16px')) . '/sec ';
-
- $table_srv->rowclass[] = '';
- $table_srv->data[] = $tdata;
- }
-
+
+ if (isset($server_performance ["total_plugin_modules"])) {
$tdata = array();
- $tdata[0] = '';
- $table_srv->colspan[count($table_srv->data)][0] = 4;
- $table_srv->rowclass[] = '';
- $table_srv->data[] = $tdata;
+ $tdata[0] = html_print_image('images/plugin.png', true, array('title' => __('Plugin modules'), 'width' => '25px'));
+ $tdata[1] = '' . format_numeric($server_performance ["total_plugin_modules"]) . '';
+ $tdata[2] = '' . format_numeric($server_performance ["plugin_modules_rate"], 2) . '';
+ $tdata[3] = html_print_image('images/module.png', true, array('title' => __('Ratio') . ': ' . __('Modules by second'), 'width' => '16px')) . '/sec ';
- switch ($config["dbtype"]) {
- case "mysql":
- $system_events = db_get_value_sql(
- 'SELECT SQL_NO_CACHE COUNT(id_evento)
- FROM tevento');
- break;
- case "postgresql":
- case "oracle":
- $system_events = db_get_value_sql(
- 'SELECT COUNT(id_evento)
- FROM tevento');
- break;
- }
-
-
-
- $tdata = array();
- $tdata[0] = html_print_image('images/lightning_go.png', true,
- array('title' => __('Total events'), 'width' => '25px'));
- $tdata[1] = '' .
- format_numeric($system_events) . '';
-
- /* Hello there! :)
-We added some of what seems to be "buggy" messages to the openSource version recently. This is not to force open-source users to move to the enterprise version, this is just to inform people using Pandora FMS open source that it requires skilled people to maintain and keep it running smoothly without professional support. This does not imply open-source version is limited in any way. If you check the recently added code, it contains only warnings and messages, no limitations except one: we removed the option to add custom logo in header. In the Update Manager section, it warns about the 'danger’ of applying automated updates without a proper backup, remembering in the process that the Enterprise version comes with a human-tested package. Maintaining an OpenSource version with more than 500 agents is not so easy, that's why someone using a Pandora with 8000 agents should consider asking for support. It's not a joke, we know of many setups with a huge number of agents, and we hate to hear that “its becoming unstable and slow” :(
-You can of course remove the warnings, that's why we include the source and do not use any kind of trick. And that's why we added here this comment, to let you know this does not reflect any change in our opensource mentality of does the last 14 years.
-*/
-
- if($system_events > 50000 && !enterprise_installed()){
- $tdata[2] = "
";
- }
-
- else{
- $tdata[3] = " ";
- }
- $table_srv->colspan[count($table_srv->data)][1] = 2;
$table_srv->rowclass[] = '';
$table_srv->data[] = $tdata;
}
+ if (isset($server_performance ["total_prediction_modules"])) {
+ $tdata = array();
+ $tdata[0] = html_print_image('images/chart_bar.png', true, array('title' => __('Prediction modules'), 'width' => '25px'));
+ $tdata[1] = '' . format_numeric($server_performance ["total_prediction_modules"]) . '';
+
+ $tdata[2] = '' . format_numeric($server_performance ["prediction_modules_rate"], 2) . '';
+ $tdata[3] = html_print_image('images/module.png', true, array('title' => __('Ratio') . ': ' . __('Modules by second'), 'width' => '16px')) . '/sec ';
+
+ $table_srv->rowclass[] = '';
+ $table_srv->data[] = $tdata;
+ }
+
+ if (isset($server_performance ["total_wmi_modules"])) {
+ $tdata = array();
+ $tdata[0] = html_print_image('images/wmi.png', true, array('title' => __('WMI modules'), 'width' => '25px'));
+ $tdata[1] = '' . format_numeric($server_performance ["total_wmi_modules"]) . '';
+
+ $tdata[2] = '' . format_numeric($server_performance ["wmi_modules_rate"], 2) . '';
+ $tdata[3] = html_print_image('images/module.png', true, array('title' => __('Ratio') . ': ' . __('Modules by second'), 'width' => '16px')) . '/sec ';
+
+ $table_srv->rowclass[] = '';
+ $table_srv->data[] = $tdata;
+ }
+
+ if (isset($server_performance ["total_web_modules"])) {
+ $tdata = array();
+ $tdata[0] = html_print_image('images/world.png', true, array('title' => __('Web modules'), 'width' => '25px'));
+ $tdata[1] = '' .
+ format_numeric($server_performance ["total_web_modules"]) .
+ '';
+
+ $tdata[2] = '' .
+ format_numeric($server_performance ["web_modules_rate"], 2) .
+ '';
+ $tdata[3] = html_print_image('images/module.png', true, array('title' => __('Ratio') . ': ' . __('Modules by second'), 'width' => '16px')) . '/sec ';
+
+ $table_srv->rowclass[] = '';
+ $table_srv->data[] = $tdata;
+ }
+
+ $tdata = array();
+ $tdata[0] = '';
+ $table_srv->colspan[count($table_srv->data)][0] = 4;
+ $table_srv->rowclass[] = '';
+ $table_srv->data[] = $tdata;
+
+ $system_events = db_get_value_sql(
+ 'SELECT SQL_NO_CACHE COUNT(id_evento)
+ FROM tevento
+ WHERE utimestamp > (UNIX_TIMESTAMP(NOW()) - ' . SECONDS_1DAY . ')'
+ );
+
+ $tdata = array();
+ $tdata[0] = html_print_image('images/lightning_go.png', true,
+ array('title' => __('Total events'), 'width' => '25px'));
+ $tdata[1] = '' .
+ format_numeric($system_events) . '';
+
+ /* Hello there! :)
+We added some of what seems to be "buggy" messages to the openSource version recently. This is not to force open-source users to move to the enterprise version, this is just to inform people using Pandora FMS open source that it requires skilled people to maintain and keep it running smoothly without professional support. This does not imply open-source version is limited in any way. If you check the recently added code, it contains only warnings and messages, no limitations except one: we removed the option to add custom logo in header. In the Update Manager section, it warns about the 'danger’ of applying automated updates without a proper backup, remembering in the process that the Enterprise version comes with a human-tested package. Maintaining an OpenSource version with more than 500 agents is not so easy, that's why someone using a Pandora with 8000 agents should consider asking for support. It's not a joke, we know of many setups with a huge number of agents, and we hate to hear that “its becoming unstable and slow” :(
+You can of course remove the warnings, that's why we include the source and do not use any kind of trick. And that's why we added here this comment, to let you know this does not reflect any change in our opensource mentality of does the last 14 years.
+*/
+
+ if($system_events > 50000 && !enterprise_installed()){
+ $tdata[2] = "
$query
"; - return 0; - } - $query = ""; - } - } - } - return 1; - } - else - return 0; -} - -function parse_mysqli_dump($connection, $url) { - if (file_exists($url)) { - $file_content = file($url); - $query = ""; - foreach($file_content as $sql_line) { - if (trim($sql_line) != "" && strpos($sql_line, "-- ") === false) { - $query .= $sql_line; - if(preg_match("/;[\040]*\$/", $sql_line)) { - if (!$result = mysqli_query($connection, $query)) { - echo mysqli_error(); //Uncomment for debug - echo "
$query
"; - return 0; - } - $query = ""; - } - } - } - return 1; - } - else - return 0; -} - -function random_name ($size) { - $temp = ""; - for ($a=0;$a< $size;$a++) - $temp = $temp. chr(rand(122,97)); - - return $temp; -} - -function print_logo_status ($step, $step_total) { - global $banner; - - $header = " -
- $banner -
Welcome to Pandora FMS installation Wizard
-This wizard helps you to quick install Pandora FMS console and main database in your system.
-In four steps, this installer will check all dependencies and will create your configuration, ready to use.
-For more information, please refer to documentation.
- "; - if (file_exists("include/config.php")) { - echo "- Pandora FMS Development Team
"; - echo "
-
"; - - if ($writable == 0) { - echo "
GPL2 Licence terms agreement
-Pandora FMS is an OpenSource software project licensed under the GPL2 licence. Pandora FMS includes, as well, another software also licensed under LGPL and BSD licenses. Before continue, you must accept the licence terms.. -
For more information, please refer to our website at http://pandorafms.org and contact us if you have any kind of question about the usage of Pandora FMS
-If you dont accept the licence terms, please, close your browser and delete Pandora FMS files.
- "; - - if (!file_exists("COPYING")) { - echo "Checking software dependencies
"; - echo "