Merge remote-tracking branch 'origin/develop' into ent-10849-cambiar-modo-del-servidor-un-solo-proceso-muchos-hilos-varios-procesos-algunos-hilos

This commit is contained in:
Ramon Novoa 2024-01-23 11:36:58 +01:00
commit a3b1470025
65 changed files with 516 additions and 246 deletions

View File

@ -1,5 +1,5 @@
package: pandorafms-agent-unix
Version: 7.0NG.775-240122
Version: 7.0NG.775-240123
Architecture: all
Priority: optional
Section: admin

View File

@ -14,7 +14,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
pandora_version="7.0NG.775-240122"
pandora_version="7.0NG.775-240123"
echo "Test if you has the tools for to make the packages."
whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null

View File

@ -1039,7 +1039,7 @@ my $Sem = undef;
my $ThreadSem = undef;
use constant AGENT_VERSION => '7.0NG.775';
use constant AGENT_BUILD => '240122';
use constant AGENT_BUILD => '240123';
# Agent log default file size maximum and instances
use constant DEFAULT_MAX_LOG_SIZE => 600000;

View File

@ -4,7 +4,7 @@
%global __os_install_post %{nil}
%define name pandorafms_agent_linux
%define version 7.0NG.775
%define release 240122
%define release 240123
Summary: Pandora FMS Linux agent, PERL version
Name: %{name}

View File

@ -5,7 +5,7 @@
%define name pandorafms_agent_linux_bin
%define source_name pandorafms_agent_linux
%define version 7.0NG.775
%define release 240122
%define release 240123
%define debug_package %{nil}
Summary: Pandora FMS Linux agent, binary version

View File

@ -5,7 +5,7 @@
%define name pandorafms_agent_linux_bin
%define source_name pandorafms_agent_linux
%define version 7.0NG.775
%define release 240122
%define release 240123
%define debug_package %{nil}
Summary: Pandora FMS Linux agent, binary version

View File

@ -5,7 +5,7 @@
%define name pandorafms_agent_linux_bin
%define source_name pandorafms_agent_linux
%define version 7.0NG.775
%define release 240122
%define release 240123
Summary: Pandora FMS Linux agent, binary version
Name: %{name}

View File

@ -4,7 +4,7 @@
%global __os_install_post %{nil}
%define name pandorafms_agent_linux
%define version 7.0NG.775
%define release 240122
%define release 240123
Summary: Pandora FMS Linux agent, PERL version
Name: %{name}

View File

@ -10,7 +10,7 @@
# **********************************************************************
PI_VERSION="7.0NG.775"
PI_BUILD="240122"
PI_BUILD="240123"
OS_NAME=`uname -s`
FORCE=0

View File

@ -186,7 +186,7 @@ UpgradeApplicationID
{}
Version
{240122}
{240123}
ViewReadme
{Yes}

View File

@ -30,7 +30,7 @@ using namespace Pandora;
using namespace Pandora_Strutils;
#define PATH_SIZE _MAX_PATH+1
#define PANDORA_VERSION ("7.0NG.775 Build 240122")
#define PANDORA_VERSION ("7.0NG.775 Build 240123")
string pandora_path;
string pandora_dir;

View File

@ -11,7 +11,7 @@ BEGIN
VALUE "LegalCopyright", "Pandora FMS"
VALUE "OriginalFilename", "PandoraAgent.exe"
VALUE "ProductName", "Pandora FMS Windows Agent"
VALUE "ProductVersion", "(7.0NG.775(Build 240122))"
VALUE "ProductVersion", "(7.0NG.775(Build 240123))"
VALUE "FileVersion", "1.0.0.0"
END
END

View File

@ -1,5 +1,5 @@
package: pandorafms-console
Version: 7.0NG.775-240122
Version: 7.0NG.775-240123
Architecture: all
Priority: optional
Section: admin

View File

@ -14,7 +14,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
pandora_version="7.0NG.775-240122"
pandora_version="7.0NG.775-240123"
package_pear=0
package_pandora=1

View File

@ -3,7 +3,7 @@
// Allow Grafana proxy
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Methods: GET, POST, OPTIONS');
header('Access-Control-Allow-Headers: Origin, Content-Type, Accept, X-Grafana-Org-Id, X-Grafana-NoCache, X-DS-Authorization');
header('Access-Control-Allow-Headers: Origin, Content-Type, Accept, X-Grafana-Org-Id, X-Grafana-NoCache, X-DS-Authorization, Authorization');
// Get all request headers
$headers = apache_request_headers();
@ -23,7 +23,10 @@ if ($headers['X-DS-Authorization']) {
list($user, $password) = explode(':', base64_decode($headers['X-DS-Authorization']));
// Check user login
// Prevent sql injection.
$user = mysqli_real_escape_string($config['dbconnection'], $user);
// Check user login.
$user_in_db = process_user_login($user, $password, true);
if ($user_in_db !== false) {

View File

@ -2,7 +2,7 @@
// Allow Grafana proxy.
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Methods: GET, POST, OPTIONS');
header('Access-Control-Allow-Headers: Origin, Content-Type, Accept, X-Grafana-Org-Id, X-Grafana-NoCache, X-DS-Authorization');
header('Access-Control-Allow-Headers: Origin, Content-Type, Accept, X-Grafana-Org-Id, X-Grafana-NoCache, X-DS-Authorization, Authorization');
// Get all request headers.
$headers = apache_request_headers();
@ -38,7 +38,7 @@ if ($headers['Authorization']) {
$result_data = [];
// Decode target data sent by datasource plugin in Grafana
$target_data = json_decode($target['target'], true);
$target_data = $target['target'];
if ($target_data['module']) {
// Get module name as target if not defined in Grafana.

View File

@ -3,7 +3,7 @@
// Allow Grafana proxy
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Methods: GET, POST, OPTIONS');
header('Access-Control-Allow-Headers: Origin, Content-Type, Accept, X-Grafana-Org-Id, X-Grafana-NoCache, X-DS-Authorization');
header('Access-Control-Allow-Headers: Origin, Content-Type, Accept, X-Grafana-Org-Id, X-Grafana-NoCache, X-DS-Authorization, Authorization');
// Get all request headers
$headers = apache_request_headers();

View File

@ -1,11 +1,11 @@
pandorafms.vmware=248788e0fb2cd4e11623e4a52ee7d05b
pandorafms.mysql=fadb4750d18285c0eca34f47c6aa3cfe
pandorafms.mssql=1cc215409741d19080269ffba112810e
pandorafms.oracle=2d9320a514d1e48a0b2804e1653c31c6
pandorafms.oracle=abdfd7280f76276f696115cabdac731e
pandorafms.db2=122f2abff0ec1d668c35ee0911483021
pandorafms.sap.deset=9bb72b7f7497a8b543f25cd71f96878f
pandorafms.gcp.ce=6743d39452f8e1ad85d0d56a30843973
pandorafms.aws.ec2=07416081f11d92a7d5d9441dabb5c5cb
pandorafms.aws.s3=eff053a212ea112e2a37efd9debbe6a0
pandorafms.aws.rds=47d7b02019329e1698f96db4959f9516
pandorafms.azure.mc=04a1072d1ece8583645ad88204fbeed3
pandorafms.azure.mc=04a1072d1ece8583645ad88204fbeed3

View File

@ -1,5 +1,8 @@
START TRANSACTION;
-- Update version for plugin oracle
UPDATE `tdiscovery_apps` SET `version` = '1.2' WHERE `short_name` = 'pandorafms.oracle';
ALTER TABLE `tncm_agent_data`
ADD COLUMN `id_agent_data` int not null default 0 AFTER `script_type`;

View File

@ -131,9 +131,13 @@ if ($add_inventory_module) {
}
}
// Load inventory module data for updating
// Load inventory module data for updating.
if ($load_inventory_module) {
$sql = 'SELECT * FROM tagent_module_inventory WHERE id_module_inventory = '.$load_inventory_module;
$sql = sprintf(
'SELECT * FROM tagent_module_inventory WHERE id_module_inventory = %s AND id_agente = %d',
$load_inventory_module,
$id_agente
);
$row = db_get_row_sql($sql);
if (!empty($row)) {

View File

@ -15,7 +15,7 @@ check_login();
global $config;
if (! check_acl($config['id_user'], 0, 'PM')) {
if (users_is_admin($config['id_user']) === false) {
db_pandora_audit(
AUDIT_LOG_ACL_VIOLATION,
'Trying to access extensions list'

View File

@ -68,7 +68,7 @@ foreach ($layer_ids as $layer_id) {
$layer_list[] = [
'id' => (strpos($layer_id, 'new_') === false) ? (int) $layer_id : null,
'layer_name' => $trimmed_name,
'layer_visible' => ($layers[$layer_id]['visible'] === 'true'),
'layer_visible' => ($layers[$layer_id]['visible'] == 'true' || $layers[$layer_id]['visible'] === '1'),
'layer_group' => (int) $layers[$layer_id]['agents_from_group'],
'layer_agent_list' => $layers[$layer_id]['agents'],
'layer_group_list' => $layers[$layer_id]['groups'],
@ -562,8 +562,6 @@ $table->data[9][1] = html_print_input_text('map_default_altitude', $map_default_
html_print_table($table);
$user_groups = users_get_groups($config['user'], 'AR', false);
echo '<fieldset class="margin-bottom-10"><legend>'.__('Layers').'</legend>';
$table->width = '100%';
@ -589,7 +587,7 @@ $table->data[1][0] = '<div id="form_layer" class="invisible">
</tr>
<tr>
<td>'.__('Show agents from group').':</td>
<td colspan="3">'.html_print_select($user_groups, 'layer_group_form', '-1', '', __('none'), '-1', true).'</td>
<td colspan="3">'.html_print_select_groups($config['id_user'], 'AR', true, 'layer_group_form', '', '', __('none'), '-1', true).'</td>
</tr>
<tr>
<td colspan="4"><hr /></td>
@ -923,11 +921,25 @@ function setLayerEditorData (data) {
var $layerFormAgentsListItems = $("tr.agents_list_item");
var $layerFormGroupsListItems = $("tr.groups_list_item");
$.ajax({
url: 'ajax.php',
data: {
page: 'operation/gis_maps/ajax',
opt: 'get_group_name',
id_group: data.agentsFromGroup
},
type: 'POST',
async: false,
dataType: 'json',
success: function (name) {
var newOption = new Option(name, data.agentsFromGroup, true, true);
$layerFormAgentsFromGroupSelect.append(newOption).trigger('change');
},
});
$layerFormIdInput.val(data.id);
$layerFormNameInput.val(data.name);
$layerFormVisibleCheckbox.prop("checked", data.visible);
$(`#layer_group_form option[value=${data.agentsFromGroup}]`).attr('selected', 'selected');
$(`#layer_group_form`).trigger('change');
$layerFormAgentInput.val("");
$layerFormAgentButton.prop("disabled", true);
$layerFormAgentsListItems.remove();

View File

@ -46,6 +46,7 @@ require_once $config['homedir'].'/include/functions_alerts.php';
require_once $config['homedir'].'/include/functions_modules.php';
require_once $config['homedir'].'/include/functions_users.php';
require_once $config['homedir'].'/include/functions_massive_operations.php';
enterprise_include_once('include/functions_agents.php');
/**
@ -71,12 +72,15 @@ function process_manage_delete($id_agents)
$array_id = explode('|', $id_agent);
try {
$node = new Node((int) $array_id[0]);
$node->connect();
$agent = new Agent((int) $array_id[1]);
$success = $agent->delete();
$node->disconnect();
$api_call_delete = $node->callApi(
'delete_agent',
'set',
(int) $array_id[1],
null,
['2'],
null,
true
);
$success = agent_delete_from_metaconsole(
$array_id[1],

View File

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="20px" height="20px" viewBox="0 0 20 20" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>F911E81E-C05E-4E17-B88A-07CFEEBD0229</title>
<g id="Support" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="Pandora-ITSM---Soporte---4d2-Contact-info-popup" transform="translate(-410, -34)">
<g id="Content" transform="translate(10, 10)">
<g id="popup-close" transform="translate(400, 24)">
<rect id="Rectangle" x="0" y="0" width="20" height="20"></rect>
<path d="M2.46745396,2.46745396 C3.09072592,1.84418201 4.10124942,1.84418201 4.72452137,2.46745396 L10,7.743 L15.2754786,2.46745396 C15.8987506,1.84418201 16.9092741,1.84418201 17.532546,2.46745396 C18.1168635,3.05177142 18.1533833,3.97644668 17.6421056,4.60330886 L17.532546,4.72452137 L12.257,10 L17.532546,15.2754786 L17.6421056,15.3966911 C18.1533833,16.0235533 18.1168635,16.9482286 17.532546,17.532546 C16.9092741,18.155818 15.8987506,18.155818 15.2754786,17.532546 L10,12.257 L4.72452137,17.532546 C4.10124942,18.155818 3.09072592,18.155818 2.46745396,17.532546 C1.88313651,16.9482286 1.84661667,16.0235533 2.35789444,15.3966911 L2.46745396,15.2754786 L7.743,10 L2.46745396,4.72452137 L2.35789444,4.60330886 C1.84661667,3.97644668 1.88313651,3.05177142 2.46745396,2.46745396 Z" id="Path-6" fill="#FFFFFF"></path>
</g>
</g>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

@ -301,6 +301,18 @@ class ConsoleSupervisor
*/
$this->checkLogAlerts();
/*
* Check total modules in system
*/
$this->checkTotalModules();
/*
* Check total modules by agent
*/
$this->checkTotalModulesByAgent();
}
@ -591,8 +603,21 @@ class ConsoleSupervisor
* Check MYSQL Support Version
*
*/
$this->checkMYSQLSettings();
/*
* Check total modules in system
*/
$this->checkTotalModules();
/*
* Check total modules by agent
*/
$this->checkTotalModulesByAgent();
}
@ -3199,4 +3224,65 @@ class ConsoleSupervisor
}
/**
* Check if the total number of modules in Pandora is greater than 80000.
*
* @return void
*/
public function checkTotalModules()
{
$total_modules = db_get_num_rows('select * from tagente_modulo');
if ($total_modules > 80000) {
$this->notify(
[
'type' => 'NOTIF.MODULES.ALERT',
'title' => __('Your system has a total of %s modules', $total_modules),
'message' => __('This is higher than the recommended maximum 80,000 modules per node. This may result in poor performance of your system.'),
'icon_notification' => self::ICON_HEADSUP,
'url' => '__url__index.php?sec=gagente&sec2=godmode/agentes/modificar_agente',
]
);
} else {
$this->cleanNotifications('NOTIF.MODULES.ALERT');
}
}
/**
* Check if the total number of modules by agent is greater than 200
*
* @return void
*/
public function checkTotalModulesByAgent()
{
$modules_by_agent = db_process_sql(
'SELECT count(*) AS modules_by_agent
FROM tagente a
LEFT JOIN tagente_modulo m ON a.id_agente = m.id_agente
GROUP BY m.id_agente'
);
$show_warning = false;
foreach ($modules_by_agent as $key => $total_modules) {
if ($total_modules['modules_by_agent'] > 200) {
$this->notify(
[
'type' => 'NOTIF.MODULES_AGENT.ALERT',
'title' => __('Your system has an average of %s modules per agent', $total_modules['modules_by_agent']),
'message' => __('This is higher than the recommended maximum (200). This may result in poor performance of your system.'),
'icon_notification' => self::ICON_HEADSUP,
'url' => '__url__index.php?sec=gagente&sec2=godmode/agentes/modificar_agente',
]
);
$show_warning = true;
break;
}
}
if ($show_warning === false) {
$this->cleanNotifications('NOTIF.MODULES_AGENT.ALERT');
}
}
}

View File

@ -265,7 +265,7 @@ class WebServerModuleDebug extends Wizard
);
// Set execution timeout.
$executionForPerform .= sprintf(
$executionForPerform.' -m %d',
' -m %d',
$this->requestTimeout
);

View File

@ -20,7 +20,7 @@
/**
* Pandora build version and version
*/
$build_version = 'PC240122';
$build_version = 'PC240123';
$pandora_version = 'v7.0NG.775';
// Do not overwrite default timezone set if defined.

View File

@ -2266,9 +2266,12 @@ function api_set_delete_agent($id, $thrash1, $other, $returnType)
}
$agent_by_alias = false;
$agent_by_id = false;
if ($other['data'][0] === '1') {
$agent_by_alias = true;
} else if ($other['data'][0] === '2') {
$agent_by_id = true;
}
if (is_metaconsole()) {
@ -2331,7 +2334,12 @@ function api_set_delete_agent($id, $thrash1, $other, $returnType)
}
}
} else {
$idAgent = agents_get_agent_id($id, false);
if ($agent_by_id === true) {
$idAgent = $id;
} else {
$idAgent = agents_get_agent_id($id, false);
}
if (!util_api_check_agent_and_print_error($idAgent, 'string', 'AD')) {
return;
}
@ -13174,6 +13182,12 @@ function api_set_create_event($id, $trash1, $other, $returnType)
$values['id_extra'] = '';
}
if ($other['data'][21] != '') {
$values['event_custom_id'] = $other['data'][21];
}else{
$values['event_custom_id'] = '';
}
$custom_data = base64_decode($values['custom_data']);
$custom_data = mysql_escape_string_sql($custom_data);
@ -13196,7 +13210,7 @@ function api_set_create_event($id, $trash1, $other, $returnType)
$values['server_id'],
$values['id_extra'],
$ack_utimestamp,
$values['event_custom_id'] ?? null
$values['event_custom_id']
);
if ($other['data'][12] != '') {

View File

@ -5261,7 +5261,8 @@ function graph_so_by_group($id_group, $width=300, $height=200, $recursive=true,
FROM tagente a
LEFT JOIN tagent_secondary_group g ON g.id_agent = a.id_agente
LEFT JOIN tconfig_os os ON a.id_os = os.id_os
WHERE a.id_grupo IN (%s) OR g.id_group IN (%s)
WHERE (a.id_grupo IN (%s) OR g.id_group IN (%s))
AND a.disabled = 0
GROUP BY os.id_os',
implode(',', $id_groups),
implode(',', $id_groups)
@ -5351,13 +5352,14 @@ function graph_events_agent_by_group($id_group, $width=300, $height=200, $noWate
// with it and then the number of times it occured. GROUP BY statement
// is required if both DISTINCT() and COUNT() are in the statement.
$sql = sprintf(
'SELECT DISTINCT(id_agente) AS id_agente,
COUNT(id_agente) AS count
'SELECT DISTINCT(te.id_agente) AS id_agente,
COUNT(te.id_agente) AS count
FROM tevento te
LEFT JOIN tagente a ON a.id_agente = te.id_agente
LEFT JOIN tagent_secondary_group g ON g.id_agent = te.id_agente
WHERE 1=1 AND estado = 0
%s %s
GROUP BY id_agente
%s %s AND a.disabled = 0
GROUP BY te.id_agente
ORDER BY count DESC LIMIT 8',
$tags_condition,
$filter_groups

View File

@ -2503,7 +2503,8 @@ function groups_get_heat_map_agents(array $id_group, float $width=0, float $heig
$sql = 'SELECT * FROM tagente a
LEFT JOIN tagent_secondary_group g ON g.id_agent = a.id_agente
WHERE a.id_grupo IN ('.implode(',', $id_group).') OR g.id_group IN ('.implode(',', $id_group).')';
WHERE (a.id_grupo IN ('.implode(',', $id_group).') OR g.id_group IN ('.implode(',', $id_group).'))
AND a.disabled = 0';
$all_agents = db_get_all_rows_sql($sql);
if (empty($all_agents)) {

View File

@ -153,6 +153,12 @@ function menu_print_menu(&$menu)
if (empty($operation) === false) {
$sec2 = $sec2.'&operation='.$operation;
}
} else if ($sec2 === 'godmode/users/configure_user') {
$sec2 = 'godmode/users/user_list';
} else if ($sec2 === 'godmode/groups/configure_group') {
$sec2 = 'godmode/groups/group_list';
} else if ($sec2 === 'godmode/users/configure_profile') {
$sec2 = 'godmode/users/profile_list';
} else {
$sec2 = (string) get_parameter('sec2');
}

View File

@ -293,7 +293,7 @@ function show_configuration_wizard() {
buttons: [
{
"text": "No",
"class": 'submit-cancel',
"class": 'submit-cancel secondaryButton',
"click" : function() {
$(this).dialog("close");
}

View File

@ -50,14 +50,14 @@ function update_dashboard(data) {
*/
// eslint-disable-next-line no-unused-vars
function showGroup() {
$("#li-group").removeClass("hidden");
$("#li-group_form").removeClass("hidden");
var private = $("#private").prop("checked");
if (private) {
$("#id_group").removeAttr("required");
$("#li-group").hide();
$("#li-group_form").hide();
} else {
$("#id_group").attr("required", true);
$("#li-group").show();
$("#li-group_form").show();
}
}

View File

@ -166,7 +166,7 @@ function load_modal(settings) {
required_buttons.push({
class:
"ui-widget ui-state-default ui-corner-all ui-button-text-only sub upd submit-cancel",
"ui-widget ui-state-default ui-corner-all ui-button-text-only sub upd submit-cancel secondaryButton",
id: settings.modal.cancel_button_id,
text: settings.modal.cancel,
click: function() {
@ -592,7 +592,7 @@ function confirmDialog(settings, idDialog = uniqId()) {
: settings.strCancelButton,
class:
hideCancelButton +
"ui-widget ui-state-default ui-corner-all ui-button-text-only sub upd submit-cancel",
"ui-widget ui-state-default ui-corner-all ui-button-text-only sub upd submit-cancel secondaryButton",
click: function() {
if (typeof settings.notCloseOnDeny == "undefined") {
$(this).dialog("close");

View File

@ -352,6 +352,7 @@ class Agents extends Element
*/
public function getStatusGraph():string
{
$data = [];
$agents = agents_get_agents(
false,
[

View File

@ -45,6 +45,7 @@ class Groups extends Element
parent::__construct();
include_once $config['homedir'].'/include/functions_users.php';
include_once $config['homedir'].'/include/functions_groupview.php';
include_once $config['homedir'].'/include/functions_graph.php';
$this->ajaxMethods = ['getStatusHeatMap'];
ui_require_css_file('heatmap');
$this->title = __('Groups');
@ -113,117 +114,119 @@ class Groups extends Element
$id_groups = implode(',', $id_groups);
$modules = modules_get_modules_in_group($id_groups);
$total_groups = ($modules !== false) ? count($modules) : 0;
if ($total_groups === 0) {
include_once $config['homedir'].'/include/functions_graph.php';
return graph_nodata_image(['width' => '400']);
}
// Best square.
$high = (float) max($width, $height);
$low = 0.0;
while (abs($high - $low) > 0.000001) {
$mid = (($high + $low) / 2.0);
$midval = (floor($width / $mid) * floor($height / $mid));
if ($midval >= $total_groups) {
$low = $mid;
} else {
$high = $mid;
}
}
$square_length = min(($width / floor($width / $low)), ($height / floor($height / $low)));
// Print starmap.
$heatmap = sprintf(
'<svg id="svg" style="width: %spx; height: %spx;">',
$width,
$height
);
$heatmap .= '<g>';
$row = 0;
$column = 0;
$x = 0;
$y = 0;
$cont = 1;
foreach ($modules as $key => $value) {
$module_id = $value['id_agente_modulo'];
$module_status = db_get_row(
'tagente_estado',
'id_agente_modulo',
$module_id,
);
$module_value = modules_get_last_value($module_id);
$status = '';
$title = '';
modules_get_status($module_id, $module_status['estado'], $module_value, $status, $title);
switch ($status) {
case STATUS_MODULE_NO_DATA:
// Not init status.
$status = 'notinit';
break;
case STATUS_MODULE_CRITICAL:
// Critical status.
$status = 'critical';
break;
case STATUS_MODULE_WARNING:
// Warning status.
$status = 'warning';
break;
case STATUS_MODULE_OK:
// Normal status.
$status = 'normal';
break;
case 3:
case -1:
default:
// Unknown status.
$status = 'unknown';
break;
$heatmap = '';
if (is_array($modules) === true) {
$total_groups = count($modules);
if ($total_groups === 0) {
return graph_nodata_image(['width' => '400']);
}
$redirect = '';
if (check_acl($config['id_user'], 0, 'AW')) {
$redirect = 'onclick="redirectHeatmap(\'module\', '.$module_id.', '.$value['id_agente'].')"';
// Best square.
$high = (float) max($width, $height);
$low = 0.0;
while (abs($high - $low) > 0.000001) {
$mid = (($high + $low) / 2.0);
$midval = (floor($width / $mid) * floor($height / $mid));
if ($midval >= $total_groups) {
$low = $mid;
} else {
$high = $mid;
}
}
$square_length = min(($width / floor($width / $low)), ($height / floor($height / $low)));
// Print starmap.
$heatmap .= sprintf(
'<rect id="%s" x="%s" onmousemove="showLabel(this, event, \'%s\')" onmouseleave="hideLabel()" '.$redirect.' style="stroke-width:1;stroke:#ffffff" y="%s" row="%s" rx="3" ry="3" col="%s" width="%s" height="%s" class="scuare-status %s_%s"></rect>',
'rect_'.$cont,
$x,
$value['nombre'],
$y,
$row,
$column,
$square_length,
$square_length,
$status,
random_int(1, 10)
'<svg id="svg" style="width: %spx; height: %spx;">',
$width,
$height
);
$y += $square_length;
$row++;
if ((int) ($y + $square_length) > (int) $height) {
$y = 0;
$x += $square_length;
$row = 0;
$column++;
}
$heatmap .= '<g>';
$row = 0;
$column = 0;
$x = 0;
$y = 0;
$cont = 1;
foreach ($modules as $key => $value) {
$module_id = $value['id_agente_modulo'];
$module_status = db_get_row(
'tagente_estado',
'id_agente_modulo',
$module_id,
);
$module_value = modules_get_last_value($module_id);
$status = '';
$title = '';
modules_get_status($module_id, $module_status['estado'], $module_value, $status, $title);
switch ($status) {
case STATUS_MODULE_NO_DATA:
// Not init status.
$status = 'notinit';
break;
case STATUS_MODULE_CRITICAL:
// Critical status.
$status = 'critical';
break;
case STATUS_MODULE_WARNING:
// Warning status.
$status = 'warning';
break;
case STATUS_MODULE_OK:
// Normal status.
$status = 'normal';
break;
case 3:
case -1:
default:
// Unknown status.
$status = 'unknown';
break;
}
$redirect = '';
if (check_acl($config['id_user'], 0, 'AW')) {
$redirect = 'onclick="redirectHeatmap(\'module\', '.$module_id.', '.$value['id_agente'].')"';
}
$heatmap .= sprintf(
'<rect id="%s" x="%s" onmousemove="showLabel(this, event, \'%s\')" onmouseleave="hideLabel()" '.$redirect.' style="stroke-width:1;stroke:#ffffff" y="%s" row="%s" rx="3" ry="3" col="%s" width="%s" height="%s" class="scuare-status %s_%s"></rect>',
'rect_'.$cont,
$x,
$value['nombre'],
$y,
$row,
$column,
$square_length,
$square_length,
$status,
random_int(1, 10)
);
if ((int) ($x + $square_length) > (int) $width) {
$x = 0;
$y += $square_length;
$column = 0;
$row++;
}
if ((int) ($y + $square_length) > (int) $height) {
$y = 0;
$x += $square_length;
$row = 0;
$column++;
}
$cont++;
if ((int) ($x + $square_length) > (int) $width) {
$x = 0;
$y += $square_length;
$column = 0;
$row++;
}
$cont++;
}
}
$heatmap .= '<script type="text/javascript">
@ -290,7 +293,8 @@ class Groups extends Element
$sql = 'SELECT * FROM tagente a
LEFT JOIN tagent_secondary_group g ON g.id_agent = a.id_agente
WHERE g.id_group IN ('.$id_groups.') OR a.id_grupo IN ('.$id_groups.')';
WHERE (g.id_group IN ('.$id_groups.') OR a.id_grupo IN ('.$id_groups.'))
AND a.disabled = 0';
$all_agents = db_get_all_rows_sql($sql);
if (empty($all_agents)) {
return null;

View File

@ -255,7 +255,7 @@ ul.wizard li > textarea {
}
.hidden {
display: none;
display: none !important;
}
form.modal-dashboard ul.wizard li.hidden,

View File

@ -865,7 +865,7 @@ body .ui-tooltip {
color: #333;
}
.ui-dialog .ui-widget-header {
margin: -3px -3px 0px -3px;
/* margin: -3px -3px 0px -3px; */
}
.ui-state-default,
.ui-widget-content .ui-state-default,

View File

@ -9,16 +9,19 @@
}
.ui-dialog .ui-dialog-titlebar {
background-color: transparent;
background: linear-gradient(to right, #161628, #1b6a66);
border-radius: 0;
margin: 0;
display: inherit;
text-align: left;
padding: 0.4em 33px 0.4em 12px;
padding: 1.2em 33px 1.2em 12px !important;
height: 30px;
position: relative;
overflow: hidden;
text-overflow: ellipsis;
color: #fff;
border-top-left-radius: 10px !important;
border-top-right-radius: 10px !important;
}
/*center ui dialog center*/
@ -35,14 +38,14 @@
color: #111;
}
.ui-dialog .ui-dialog-title {
color: rgb(51, 51, 51);
color: #fff;
white-space: nowrap;
width: 100%;
overflow: hidden;
text-overflow: ellipsis;
position: relative;
font-size: 11pt;
top: 2px;
font-size: 13pt;
/* top: 2px; */
}
.ui-dialog .ui-dialog-titlebar-minimize {
@ -99,6 +102,36 @@
border: 1px solid #82b92e;
height: 30px;
width: 90px;
border: 2px solid var(--primary-color) !important;
}
button.secondaryButton {
background-color: #fff !important;
color: var(--primary-color) !important;
border: 2px solid var(--primary-color) !important;
box-shadow: none;
}
button.secondaryButton > div {
background-color: var(--primary-color) !important;
}
button.secondaryButton:hover {
color: #1d7873 !important;
border-color: #1d7873 !important;
}
button.secondaryButton:hover > div {
background-color: #1d7873 !important;
}
button.secondaryButton:active {
color: #0d312f !important;
border-color: #0d312f !important;
}
button.secondaryButton:active > div {
background-color: #0d312f !important;
}
.ui-datepicker-prev {
@ -214,7 +247,7 @@ a.ui-state-default > span:hover {
height: fit-content !important;
}
.ui-dialog .ui-widget-header {
margin: 3px 3px 0px 3px;
/* margin: 3px 3px 0px 3px; */
}
.ui_tpicker_hour,
.ui_tpicker_minute,
@ -243,13 +276,13 @@ a.ui-state-default > span:hover {
border-radius: 16px;
}
.ui-dialog {
border-top-left-radius: 16px !important;
border-top-right-radius: 16px !important;
border-bottom-left-radius: 16px !important;
border-bottom-right-radius: 16px !important;
border-top-left-radius: 10px !important;
border-top-right-radius: 10px !important;
border-bottom-left-radius: 10px !important;
border-bottom-right-radius: 10px !important;
box-shadow: 0 10px 6px 0 rgb(0 0 0 / 13%);
border: 1px solid #e5e9ed;
padding: 0;
padding: 0 !important;
}
.ui-dialog-titlebar {
border: 0px;
@ -266,9 +299,9 @@ a.ui-state-default > span:hover {
}
.ui-button.ui-corner-all.ui-widget.ui-button-icon-only.ui-dialog-titlebar-close,
.ui-button.ui-corner-all.ui-widget.ui-button-icon-only.ui-dialog-titlebar-close:hover {
background-color: rgb(51, 51, 51);
mask: url(../../../images/close@svg.svg) no-repeat right / contain;
-webkit-mask: url(../../../images/close@svg.svg) no-repeat right / contain;
background-color: #fff;
mask: url(../../../images/close_dialog.svg) no-repeat right / contain;
-webkit-mask: url(../../../images/close_dialog.svg) no-repeat right / contain;
}
.ui-dialog-title {

View File

@ -988,6 +988,10 @@ select:-internal-list-box {
display: flex;
}
.flex_important {
display: flex !important;
}
.flex-row-important {
display: flex !important;
flex-direction: row !important;
@ -10486,7 +10490,7 @@ button.submitButton {
display: flex;
justify-content: space-between;
flex-direction: row;
min-width: 110px;
/* min-width: 110px; */
height: 45px;
font-size: 14px;
/*font-family: "lato";*/

View File

@ -23,12 +23,15 @@
justify-content: space-between;
height: fit-content !important;
background-color: white;
color: #161628;
border-top-left-radius: 25px !important;
border-top-right-radius: 25px !important;
color: #fff;
border-top-left-radius: 10px !important;
border-top-right-radius: 10px !important;
}
.tips_header .title {
font-size: 15px;
font-size: 13pt !important;
color: #fff;
padding: 1em 33px 1em 12px !important;
margin: 0;
}
.description {
padding: 0px 20px 20px 20px;
@ -89,6 +92,10 @@
width: 100%;
justify-content: space-between;
}
.ui-dialog-titlebar > p {
display: flex;
}
#tips_window_modal .ui-dialog-buttonset button.submit-cancel-tips,
#tips_window_modal_preview .ui-dialog-buttonset button.submit-cancel-tips {
border-radius: 6px;

View File

@ -131,7 +131,7 @@
<div style='padding-bottom: 50px'>
<?php
$version = '7.0NG.775';
$build = '240122';
$build = '240123';
$banner = "v$version Build $build";
error_reporting(0);

View File

@ -535,6 +535,21 @@ echo '</div>';
ui_require_css_file('cluetip', 'include/styles/js/');
ui_require_jquery_file('cluetip');
$system_higher = false;
$modules_agent = db_get_all_rows_sql(sprintf('SELECT id_agente FROM tagente_modulo WHERE id_agente = %s', $id_agente));
if (is_array($modules_agent)) {
$all_modules = db_get_all_rows_sql('SELECT id_agente FROM tagente_modulo');
$all_agents = db_get_all_rows_sql('SELECT id_agente FROM tagente');
if (is_array($all_modules) && is_array($all_agents)) {
if ((count($all_modules) / count($all_agents)) >= 200) {
$system_higher = true;
}
}
}
echo '<div id="system_higher" class="invisible_important agent_details_agent_data flex_important"><img src="images/alert-yellow@svg.svg" width="10%" class="mrgn_right_20px">'.__('Your system has a much higher rate of modules per agent than recommended (200 modules per agent). This implies performance problems in the system, please consider reducing the number of modules in this agent.').'</div>';
?>
<script type="text/javascript">
@ -607,6 +622,36 @@ $('table.alert-status-filter #ag_group').change (function () {
}
}).change();
<?php if ($system_higher === true) { ?>
$("#system_higher").dialog({
title: "<?php echo __('Warning'); ?>",
resizable: true,
draggable: true,
modal: true,
width: 500,
height: 150,
buttons: [{
text: "OK",
click: function() {
$(this).dialog("close");
},
class: 'invisible_important',
}],
overlay: {
opacity: 0.5,
background: "black"
},
closeOnEscape: false,
open: function(event, ui) {
$(".ui-dialog-titlebar-close").hide();
$("#system_higher").removeClass('invisible_important');
setTimeout(() => {
$(".ui-dialog-buttonset").find('button').removeClass('invisible_important');
}, 4000);
}
});
<?php } ?>
function validateAlerts() {
var alert_ids = [];

View File

@ -541,4 +541,14 @@ switch ($opt) {
echo json_encode($returnJSON);
break;
case 'get_group_name':
$id_group = (int) get_parameter('id_group', -1);
if ($id_group === -1) {
echo json_encode(__('None'));
} else {
$result = groups_get_name($id_group, true);
echo json_encode($result);
}
break;
}

View File

@ -901,7 +901,7 @@ if ($edit_capable === true) {
draggable: true,
modal: true,
close: false,
height: 200,
height: 210,
width: 480,
overlay: {
opacity: 0.5,

View File

@ -6,7 +6,7 @@
%define debug_package %{nil}
%define name pandorafms_console
%define version 7.0NG.775
%define release 240122
%define release 240123
# User and Group under which Apache is running
%define httpd_name httpd

View File

@ -6,7 +6,7 @@
%define debug_package %{nil}
%define name pandorafms_console
%define version 7.0NG.775
%define release 240122
%define release 240123
# User and Group under which Apache is running
%define httpd_name httpd

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_console
%define version 7.0NG.775
%define release 240122
%define release 240123
%define httpd_name httpd
# User and Group under which Apache is running
%define httpd_name apache2

View File

@ -2913,7 +2913,7 @@ SET @short_name = 'pandorafms.oracle';
SET @name = 'Oracle';
SET @section = 'app';
SET @description = 'Monitor&#x20;Oracle&#x20;databases';
SET @version = '1.1';
SET @version = '1.2';
INSERT IGNORE INTO `tdiscovery_apps` (`id_app`, `short_name`, `name`, `section`, `description`, `version`) VALUES ('', @short_name, @name, @section, @description, @version);
SELECT @id_app := `id_app` FROM `tdiscovery_apps` WHERE `short_name` = @short_name;

View File

@ -321,9 +321,6 @@ a.update_manager_button:after {
margin: 20px;
}
.ui-widget.ui-widget-content {
border: none;
}
#um-update-details {
display: none;
background: #fff;

View File

@ -156,7 +156,7 @@ $("#submit-cancel_registration").click(function(e) {
buttons: [
{
text: "No",
class: "submit-cancel",
class: "submit-cancel secondaryButton",
click: function() {
$(this).dialog("close");
}

View File

@ -84,7 +84,7 @@ $inputs = [
],
],
[
'block_id' => 'group',
'block_id' => 'group_form',
'direct' => 1,
'hidden' => $private,
'block_content' => [

View File

@ -41,7 +41,7 @@ $output .= '<p>'.html_print_checkbox(
false,
'',
($preview === true) ? '' : 'checkbox_tips_startup'
).__('Show usage tips at startup').'</p>';
).'&nbsp;'.__('Show usage tips at startup').'</p>';
$output .= '</div>';
$output .= '<div class="carousel '.((empty($files) === true && empty($files64) === true) ? 'invisible' : '').'">';
$output .= '<div class="images">';

View File

@ -1,5 +1,5 @@
package: pandorafms-server
Version: 7.0NG.775-240122
Version: 7.0NG.775-240123
Architecture: all
Priority: optional
Section: admin

View File

@ -14,7 +14,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
pandora_version="7.0NG.775-240122"
pandora_version="7.0NG.775-240123"
package_cpan=0
package_pandora=1

View File

@ -46,7 +46,7 @@ our @EXPORT = qw(
# version: Defines actual version of Pandora Server for this module only
my $pandora_version = "7.0NG.775";
my $pandora_build = "240122";
my $pandora_build = "240123";
our $VERSION = $pandora_version." ".$pandora_build;
# Setup hash

View File

@ -4273,13 +4273,15 @@ Generate an event.
=cut
##########################################################################
#sub pandora_event ($$$$$$$$$$;$$$$$$$$$$$$) {
#sub pandora_event ($$$$$$$$$$;$$$$$$$$$$$$$) {
sub pandora_event {
my ($pa_config, $evento, $id_grupo, $id_agente, $severity,
$id_alert_am, $id_agentmodule, $event_type, $event_status, $dbh,
$source, $user_name, $comment, $id_extra, $tags,
$critical_instructions, $warning_instructions, $unknown_instructions, $custom_data,
$module_data, $module_status, $server_id) = @_;
$module_data, $module_status, $server_id, $event_custom_id) = @_;
$event_custom_id //= "";
my $agent = undef;
if (defined($id_agente) && $id_agente != 0) {
@ -4332,7 +4334,7 @@ sub pandora_event {
my $utimestamp = time ();
my $timestamp = strftime ("%Y-%m-%d %H:%M:%S", localtime ($utimestamp));
my $event_custom_id = undef;
$id_agentmodule = 0 unless defined ($id_agentmodule);
# Validate events with the same event id

View File

@ -34,7 +34,7 @@ our @ISA = qw(Exporter);
# version: Defines actual version of Pandora Server for this module only
my $pandora_version = "7.0NG.775";
my $pandora_build = "240122";
my $pandora_build = "240123";
our $VERSION = $pandora_version." ".$pandora_build;
our %EXPORT_TAGS = ( 'all' => [ qw() ] );

View File

@ -269,7 +269,7 @@ sub data_producer ($$$$$) {
print STDERR $@;
}
}
$task_sem->up($self->getNumThreads ());
db_disconnect ($dbh);
exit 0;
@ -286,7 +286,6 @@ sub data_consumer ($$$$$) {
my $sem_timeout = $pa_config->{'self_monitoring_interval'} > 0 ?
$pa_config->{'self_monitoring_interval'} :
300;
while ($RUN == 1) {
eval {
# Connect to the DB

View File

@ -58,6 +58,36 @@ sub new ($$;$) {
return undef unless defined ($config->{'webserver'}) and ($config->{'webserver'} == 1);
# Use Goliat with CURL
if ($config->{'web_engine'} eq 'curl') {
require PandoraFMS::Goliat::GoliatCURL;
PandoraFMS::Goliat::GoliatCURL->import;
# Check for CURL binary
if (system ("curl -V >/dev/null 2>&1") >> 8 != 0) {
logger ($config, ' [E] CURL binary not found. Install CURL or uncomment the web_engine configuration token to use LWP.', 1);
print_message ($config, ' [E] CURL binary not found. Install CURL or uncomment the web_engine configuration token to use LWP.', 1);
return undef;
}
# Check for pandora_exec binary
if (system ("\"" . $config->{'plugin_exec'} . "\" 10 echo >/dev/null 2>&1") >> 8 != 0) {
logger ($config, ' [E] ' . $config->{'plugin_exec'} . ' not found. Please install it or add it to the PATH.', 1);
print_message ($config, ' [E] ' . $config->{'plugin_exec'} . ' not found. Please install it or add it to the PATH.', 1);
return undef;
}
}
# Use LWP by default
else {
require PandoraFMS::Goliat::GoliatLWP;
PandoraFMS::Goliat::GoliatLWP->import;
if (! LWP::UserAgent->can('ssl_opts')) {
logger($config, "LWP version $LWP::VERSION does not support SSL. Make sure version 6.0 or higher is installed.", 1);
print_message ($config, " [W] LWP version $LWP::VERSION does not support SSL. Make sure version 6.0 or higher is installed.", 1);
}
}
# Initialize semaphores and queues
@TaskQueue = ();
%PendingTasks = ();
@ -80,35 +110,6 @@ sub run ($) {
print_message ($pa_config, " [*] Starting " . $pa_config->{'rb_product_name'} . " Web Server.", 1);
# Use Goliat with CURL
if ($pa_config->{'web_engine'} eq 'curl') {
require PandoraFMS::Goliat::GoliatCURL;
PandoraFMS::Goliat::GoliatCURL->import;
# Check for CURL binary
if (system ("curl -V >$DEVNULL 2>&1") >> 8 != 0) {
logger ($pa_config, ' [E] CURL binary not found. Install CURL or uncomment the web_engine configuration token to use LWP.', 1);
print_message ($pa_config, ' [E] CURL binary not found. Install CURL or uncomment the web_engine configuration token to use LWP.', 1);
return undef;
}
# Check for pandora_exec binary
if (system ("\"" . $pa_config->{'plugin_exec'} . "\" 10 echo >$DEVNULL 2>&1") >> 8 != 0) {
logger ($pa_config, ' [E] ' . $pa_config->{'plugin_exec'} . ' not found. Please install it or add it to the PATH.', 1);
print_message ($pa_config, ' [E] ' . $pa_config->{'plugin_exec'} . ' not found. Please install it or add it to the PATH.', 1);
return undef;
}
}
# Use LWP by default
else {
require PandoraFMS::Goliat::GoliatLWP;
PandoraFMS::Goliat::GoliatLWP->import;
if (! LWP::UserAgent->can('ssl_opts')) {
logger($pa_config, "LWP version $LWP::VERSION does not support SSL. Make sure version 6.0 or higher is installed.", 1);
print_message ($pa_config, " [W] LWP version $LWP::VERSION does not support SSL. Make sure version 6.0 or higher is installed.", 1);
}
}
$self->setNumThreads ($pa_config->{'web_threads'});
$self->SUPER::run (\@TaskQueue, \%PendingTasks, $Sem, $TaskSem);
}

View File

@ -7,7 +7,7 @@
%define debug_package %{nil}
%define name pandorafms_server
%define version 7.0NG.775
%define release 240122
%define release 240123
Summary: Pandora FMS Server
Name: %{name}

View File

@ -4,7 +4,7 @@
%global __os_install_post %{nil}
%define name pandorafms_server
%define version 7.0NG.775
%define release 240122
%define release 240123
Summary: Pandora FMS Server
Name: %{name}

View File

@ -9,7 +9,7 @@
# **********************************************************************
PI_VERSION="7.0NG.775"
PI_BUILD="240122"
PI_BUILD="240123"
MODE=$1
if [ $# -gt 1 ]; then

View File

@ -38,7 +38,7 @@ use PandoraFMS::Config;
use PandoraFMS::DB;
# version: define current version
my $version = "7.0NG.775 Build 240122";
my $version = "7.0NG.775 Build 240123";
# Pandora server configuration
my %conf;
@ -79,6 +79,15 @@ sub log_message ($$;$) {
}
}
########################################################################
# Print the given message and writes on error log.
########################################################################
sub log_error_message ($$) {
my ($conf, $message) = @_;
log_message('',,"$message\n\n");
log_error_writter($conf, "$message\n");
}
########################################################################
# Delete old data from the database.
########################################################################
@ -1289,9 +1298,6 @@ sub pandoradb_main {
# Maintain Referential integrity and other stuff
pandora_checkdb_integrity ($conf, $dbh);
# Close and open error log blocks
handle_error_log_block($conf, $dbh);
# Move old data to the history DB
if (defined ($history_dbh)) {
undef ($history_dbh) unless defined (enterprise_hook ('pandora_historydb', [$dbh, $history_dbh, $conf->{'_history_db_days'}, $conf->{'_history_db_step'}, $conf->{'_history_db_delay'}, $conf->{'_history_db_string_days'}, $conf->{'_history_db_adv'}]));
@ -1372,15 +1378,23 @@ sub pandora_check_forgotten_discovery_tasks {
sub handle_error_log_block {
my ($conf, $dbh) = @_;
my $is_open = get_db_value ($dbh,"SELECT `value` FROM `tconfig` WHERE `token` = 'open_error_log'");
open (STDERR, ">> " . $conf->{'errorlog_file'}) or die " [ERROR] " . pandora_get_initial_product_name() . " can't write to Errorlog. Aborting : \n $! \n";
if (!defined ($is_open)) {
db_do($dbh, "INSERT INTO `tconfig`(`token`, `value`) VALUES ('open_error_log', 1)");
} elsif ($is_open eq 1){
print STDERR strftime ("%Y-%m-%d %H:%M:%S", localtime()) . ' - ' . $conf->{'servername'} . " pandora_db: pandora_db maintenance tasks ends\n";
log_error_writter($conf, strftime ("%Y-%m-%d %H:%M:%S", localtime()) . ' - ' . $conf->{'servername'} . " pandora_db: pandora_db maintenance tasks ends\n");
}
print STDERR strftime ("%Y-%m-%d %H:%M:%S", localtime()) . ' - ' . $conf->{'servername'} . " pandora_db: pandora_db maintenance tasks starts\n";
log_error_writter($conf, strftime ("%Y-%m-%d %H:%M:%S", localtime()) . ' - ' . $conf->{'servername'} . " pandora_db: pandora_db maintenance tasks starts\n");
}
###############################################################################
# Print messages on error log file
###############################################################################
sub log_error_writter($$){
my ($conf, $message) = @_;
open (STDERR, ">> " . $conf->{'errorlog_file'}) or die " [ERROR] " . pandora_get_initial_product_name() . " can't write to Errorlog. Aborting : \n $! \n";
print STDERR $message;
close (STDERR);
}
@ -1417,17 +1431,20 @@ if (defined($conf{'_history_db_enabled'}) && $conf{'_history_db_enabled'} eq '1'
}
}
# Close and open error log blocks
handle_error_log_block(\%conf, $dbh);
# Only run on master servers.
pandora_set_master(\%conf, $dbh);
if ($conf{'_force'} == 0 && pandora_is_master(\%conf) == 0) {
log_message ('', " [*] Not a master server.\n\n");
log_error_message (\%conf, " [*] Not a master server.");
exit 1;
}
# Get a lock on the main database.
my $db_lock = db_get_lock ($dbh, $conf{'dbname'} . '_pandora_db', $LOCK_TIMEOUT, 1);
if ($db_lock == 0) {
log_message ('', " [*] Another instance of DB Tool seems to be running on the main database.\n\n");
log_error_message (\%conf, " [*] Another instance of DB Tool seems to be running on the main database.");
exit 1;
}
@ -1435,7 +1452,7 @@ if ($db_lock == 0) {
if (defined($history_dbh)) {
my $history_lock = db_get_lock ($history_dbh, $conf{'_history_db_name'} . '_pandora_db', $LOCK_TIMEOUT, 1);
if ($history_lock == 0) {
log_message ('', " [*] Another instance of DB Tool seems to be running on the history database.\n\n");
log_error_message (\%conf, " [*] Another instance of DB Tool seems to be running on the history database.");
exit 1;
}
}
@ -1443,14 +1460,14 @@ if (defined($history_dbh)) {
# Get a lock merging.
my $lock_merge = db_get_lock ($dbh, 'merge-working', $LOCK_TIMEOUT, 1);
if ($lock_merge == 0) {
log_message ('', " [*] Merge is running.\n\n");
log_error_message (\%conf, " [*] Merge is running.");
exit 1;
}
# Get a lock on merging events.
my $lock_merge_events = db_get_lock ($dbh, 'merging-events', $LOCK_TIMEOUT, 1);
if ($lock_merge_events == 0) {
log_message ('', " [*] Merge events is running.\n\n");
log_error_message (\%conf, " [*] Merge events is running.");
exit 1;
}

View File

@ -36,7 +36,7 @@ use Encode::Locale;
Encode::Locale::decode_argv;
# version: define current version
my $version = "7.0NG.775 Build 240122";
my $version = "7.0NG.775 Build 240123";
# save program name for logging
my $progname = basename($0);
@ -200,7 +200,7 @@ sub help_screen{
help_screen_line('--enable_eacl', '', 'Enable enterprise ACL system');
help_screen_line('--disable_double_auth', '<user_name>', 'Disable the double authentication for the specified user');
print "\nEVENTS:\n\n" unless $param ne '';
help_screen_line('--create_event', "<event> <event_type> <group_name> [<agent_name> <module_name>\n\t <event_status> <severity> <template_name> <user_name> <comment> \n\t <source> <id_extra> <tags> <custom_data_json> <force_create_agent> \n\t <critical_instructions> <warning_instructions> <unknown_instructions> <use_alias>]", 'Add event');
help_screen_line('--create_event', "<event> <event_type> <group_name> [<agent_name> <module_name>\n\t <event_status> <severity> <template_name> <user_name> <comment> <source> \n\t <id_extra> <tags> <custom_data_json> <force_create_agent> <critical_instructions> \n\t <warning_instructions> <unknown_instructions> <use_alias> <event_custom_id>]", 'Add event');
help_screen_line('--update_event_custom_id', "<event> <event_custom_id>", 'Update Event Custom ID');
help_screen_line('--validate_event', "<agent_name> <module_name> <datetime_min> <datetime_max>\n\t <user_name> <criticity> <template_name> [<use_alias>]", 'Validate events');
help_screen_line('--validate_event_id', '<event_id>', 'Validate event given a event id');
@ -4454,7 +4454,7 @@ sub cli_delete_profile() {
##############################################################################
sub cli_create_event() {
my ($event,$event_type,$group_name,$agent_name,$module_name,$event_status,$severity,$template_name, $user_name, $comment, $source, $id_extra, $tags, $custom_data,$force_create_agent,$c_instructions,$w_instructions,$u_instructions,$use_alias,$server_id) = @ARGV[2..21];
my ($event,$event_type,$group_name,$agent_name,$module_name,$event_status,$severity,$template_name, $user_name, $comment, $source, $id_extra, $tags, $custom_data,$force_create_agent,$c_instructions,$w_instructions,$u_instructions,$use_alias,$server_id,$event_custom_id) = @ARGV[2..22];
$event_status = 0 unless defined($event_status);
$severity = 0 unless defined($severity);
@ -4513,7 +4513,7 @@ sub cli_create_event() {
print_log "[INFO] Adding event '$event' for agent '$agent_name' \n\n";
pandora_event ($conf, $event, $id_group, $id_agent, $severity,
$id_alert_agent_module, $id_agentmodule, $event_type, $event_status, $dbh, safe_input($source), $user_name, safe_input($comment), safe_input($id_extra), safe_input($tags), safe_input($c_instructions), safe_input($w_instructions), safe_input($u_instructions), $custom_data, undef, undef, $server_id);
$id_alert_agent_module, $id_agentmodule, $event_type, $event_status, $dbh, safe_input($source), $user_name, safe_input($comment), safe_input($id_extra), safe_input($tags), safe_input($c_instructions), safe_input($w_instructions), safe_input($u_instructions), $custom_data, undef, undef, $server_id, safe_input($event_custom_id));
}
} else {
if (! $agent_name) {
@ -4562,7 +4562,7 @@ sub cli_create_event() {
print_log "[INFO] Adding event '$event' for agent '$agent_name' \n\n";
pandora_event ($conf, $event, $id_group, $id_agent, $severity,
$id_alert_agent_module, $id_agentmodule, $event_type, $event_status, $dbh, safe_input($source), $user_name, $comment, safe_input($id_extra), safe_input($tags), safe_input($c_instructions), safe_input($w_instructions), safe_input($u_instructions), $custom_data, undef, undef, $server_id);
$id_alert_agent_module, $id_agentmodule, $event_type, $event_status, $dbh, safe_input($source), $user_name, $comment, safe_input($id_extra), safe_input($tags), safe_input($c_instructions), safe_input($w_instructions), safe_input($u_instructions), $custom_data, undef, undef, $server_id, safe_input($event_custom_id));
}
}
@ -7943,10 +7943,11 @@ sub pandora_manage_main ($$$) {
{'name' => 'warning_instructions'},
{'name' => 'unknown_instructions'},
{'name' => 'use_alias'},
{'name' => 'metaconsole'}
{'name' => 'metaconsole'},
{'name' => 'event_custom_id'}
);
param_check($ltotal, 20, 17);
param_check($ltotal, 21, 18);
check_values(\@fields);