mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-28 16:24:54 +02:00
Merge branch 'ent-9662-second-round' of brutus.artica.es:artica/pandorafms into ent-9662-second-round
This commit is contained in:
commit
1a82056039
@ -1,5 +1,5 @@
|
||||
package: pandorafms-agent-unix
|
||||
Version: 7.0NG.770-230328
|
||||
Version: 7.0NG.770-230329
|
||||
Architecture: all
|
||||
Priority: optional
|
||||
Section: admin
|
||||
|
@ -14,7 +14,7 @@
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
pandora_version="7.0NG.770-230328"
|
||||
pandora_version="7.0NG.770-230329"
|
||||
|
||||
echo "Test if you has the tools for to make the packages."
|
||||
whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null
|
||||
|
@ -1023,7 +1023,7 @@ my $Sem = undef;
|
||||
my $ThreadSem = undef;
|
||||
|
||||
use constant AGENT_VERSION => '7.0NG.770';
|
||||
use constant AGENT_BUILD => '230328';
|
||||
use constant AGENT_BUILD => '230329';
|
||||
|
||||
# Agent log default file size maximum and instances
|
||||
use constant DEFAULT_MAX_LOG_SIZE => 600000;
|
||||
|
@ -4,7 +4,7 @@
|
||||
%global __os_install_post %{nil}
|
||||
%define name pandorafms_agent_linux
|
||||
%define version 7.0NG.770
|
||||
%define release 230328
|
||||
%define release 230329
|
||||
|
||||
Summary: Pandora FMS Linux agent, PERL version
|
||||
Name: %{name}
|
||||
|
@ -4,7 +4,7 @@
|
||||
%global __os_install_post %{nil}
|
||||
%define name pandorafms_agent_linux
|
||||
%define version 7.0NG.770
|
||||
%define release 230328
|
||||
%define release 230329
|
||||
|
||||
Summary: Pandora FMS Linux agent, PERL version
|
||||
Name: %{name}
|
||||
|
@ -10,7 +10,7 @@
|
||||
# **********************************************************************
|
||||
|
||||
PI_VERSION="7.0NG.770"
|
||||
PI_BUILD="230328"
|
||||
PI_BUILD="230329"
|
||||
OS_NAME=`uname -s`
|
||||
|
||||
FORCE=0
|
||||
|
@ -186,7 +186,7 @@ UpgradeApplicationID
|
||||
{}
|
||||
|
||||
Version
|
||||
{230328}
|
||||
{230329}
|
||||
|
||||
ViewReadme
|
||||
{Yes}
|
||||
|
@ -30,7 +30,7 @@ using namespace Pandora;
|
||||
using namespace Pandora_Strutils;
|
||||
|
||||
#define PATH_SIZE _MAX_PATH+1
|
||||
#define PANDORA_VERSION ("7.0NG.770 Build 230328")
|
||||
#define PANDORA_VERSION ("7.0NG.770 Build 230329")
|
||||
|
||||
string pandora_path;
|
||||
string pandora_dir;
|
||||
|
@ -11,7 +11,7 @@ BEGIN
|
||||
VALUE "LegalCopyright", "Artica ST"
|
||||
VALUE "OriginalFilename", "PandoraAgent.exe"
|
||||
VALUE "ProductName", "Pandora FMS Windows Agent"
|
||||
VALUE "ProductVersion", "(7.0NG.770(Build 230328))"
|
||||
VALUE "ProductVersion", "(7.0NG.770(Build 230329))"
|
||||
VALUE "FileVersion", "1.0.0.0"
|
||||
END
|
||||
END
|
||||
|
@ -1,5 +1,5 @@
|
||||
package: pandorafms-console
|
||||
Version: 7.0NG.770-230328
|
||||
Version: 7.0NG.770-230329
|
||||
Architecture: all
|
||||
Priority: optional
|
||||
Section: admin
|
||||
|
@ -14,7 +14,7 @@
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
pandora_version="7.0NG.770-230328"
|
||||
pandora_version="7.0NG.770-230329"
|
||||
|
||||
package_pear=0
|
||||
package_pandora=1
|
||||
|
@ -729,6 +729,7 @@ function mainAgentsModules()
|
||||
if (isset($modules_selected[0]) === true && $modules_selected[0]) {
|
||||
$all_modules = [];
|
||||
foreach ($modules_selected as $key => $value) {
|
||||
if (is_int($value)) {
|
||||
$name = modules_get_agentmodule_name($value);
|
||||
$sql = "SELECT id_agente_modulo
|
||||
FROM tagente_modulo
|
||||
@ -741,6 +742,20 @@ function mainAgentsModules()
|
||||
$all_modules[$value['id_agente_modulo']] = io_safe_output($name);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$name = $value;
|
||||
$sql = "SELECT id_agente_modulo
|
||||
FROM tagente_modulo
|
||||
WHERE nombre = '".$name."';";
|
||||
|
||||
$result_sql = db_get_all_rows_sql($sql);
|
||||
|
||||
if (is_array($result_sql)) {
|
||||
foreach ($result_sql as $key => $value) {
|
||||
$all_modules[$value['id_agente_modulo']] = io_safe_output($name);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$all_modules = agents_get_modules(
|
||||
@ -838,7 +853,7 @@ function mainAgentsModules()
|
||||
|
||||
echo '<tr>';
|
||||
|
||||
echo "<th width='140px' class='pdd_r_10px align_right'>".__('Agents').' / '.__('Modules').'</th>';
|
||||
echo "<th width='40px' class='pdd_r_10px align_left'>".__('Agents').' / '.__('Modules').'</th>';
|
||||
|
||||
if ($hor_offset > 0) {
|
||||
$new_hor_offset = ($hor_offset - $block);
|
||||
@ -958,7 +973,7 @@ function mainAgentsModules()
|
||||
|
||||
foreach ($module['id'] as $module_id) {
|
||||
if (!$match && array_key_exists($module_id, $agent_modules)) {
|
||||
echo "<td class='center'>";
|
||||
echo "<td class='center' style='text-align:left;'>";
|
||||
$win_handle = dechex(crc32($module_id.$module['name']));
|
||||
$graph_type = return_graphtype(modules_get_agentmodule_type($module_id));
|
||||
$link = "winopeng_var('".'operation/agentes/stat_win.php?'."type=$graph_type&".'period='.SECONDS_1DAY.'&'.'id='.$module_id.'&'.'refresh='.SECONDS_10MINUTES."', 'day_".$win_handle."', 800, 480)";
|
||||
|
@ -1,5 +1,19 @@
|
||||
START TRANSACTION;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `tconsole` (
|
||||
`id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`id_console` BIGINT NOT NULL DEFAULT 0,
|
||||
`description` TEXT,
|
||||
`version` TINYTEXT,
|
||||
`last_execution` INT UNSIGNED NOT NULL DEFAULT 0,
|
||||
`console_type` TINYINT NOT NULL DEFAULT 0,
|
||||
`timezone` TINYTEXT,
|
||||
`public_url` TEXT,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4;
|
||||
|
||||
ALTER TABLE `tuser_task_scheduled` ADD COLUMN `id_console` BIGINT NOT NULL DEFAULT 0;
|
||||
|
||||
ALTER TABLE `tdatabase` ADD COLUMN `ssh_status` TINYINT UNSIGNED DEFAULT 0;
|
||||
ALTER TABLE `tdatabase` ADD COLUMN `db_status` TINYINT UNSIGNED DEFAULT 0;
|
||||
ALTER TABLE `tdatabase` ADD COLUMN `replication_status` TINYINT UNSIGNED DEFAULT 0;
|
||||
|
69
pandora_console/godmode/consoles/consoles.php
Normal file
69
pandora_console/godmode/consoles/consoles.php
Normal file
@ -0,0 +1,69 @@
|
||||
<?php
|
||||
/**
|
||||
* Consoles manager.
|
||||
*
|
||||
* @category Tools
|
||||
* @package Pandora FMS
|
||||
* @subpackage Enterprise
|
||||
* @version 1.0.0
|
||||
* @license See below
|
||||
*
|
||||
* ______ ___ _______ _______ ________
|
||||
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
|
||||
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
|
||||
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
||||
*
|
||||
* ============================================================================
|
||||
* Copyright (c) 2005-2021 Artica Soluciones Tecnologicas
|
||||
* Please see http://pandorafms.org for full contribution list
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation for version 2.
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
* ============================================================================
|
||||
*/
|
||||
|
||||
use PandoraFMS\Console;
|
||||
use PandoraFMS\View;
|
||||
|
||||
// Begin.
|
||||
global $config;
|
||||
check_login();
|
||||
|
||||
if (check_acl($config['id_user'], 0, 'PM') === false
|
||||
&& is_user_admin($config['id_user']) === false
|
||||
) {
|
||||
db_pandora_audit(
|
||||
AUDIT_LOG_ACL_VIOLATION,
|
||||
'Trying to access Consoles Management'
|
||||
);
|
||||
include 'general/noaccess.php';
|
||||
exit;
|
||||
}
|
||||
|
||||
$ajax_url = ui_get_full_url('ajax.php');
|
||||
|
||||
$message = '';
|
||||
$error = false;
|
||||
|
||||
// Check is any consoles are registered.
|
||||
$results = db_get_all_rows_in_table('tconsole');
|
||||
|
||||
$message = '';
|
||||
|
||||
if ($results === false) {
|
||||
$message = ui_print_info_message(
|
||||
__('If you want to have your consoles registered, you must define them by editing config.php in each individual console and wait for cron to run in order to be registered.')
|
||||
);
|
||||
}
|
||||
|
||||
View::render(
|
||||
'consoles/list',
|
||||
[
|
||||
'ajax_url' => $ajax_url,
|
||||
'message' => $message,
|
||||
]
|
||||
);
|
@ -308,6 +308,13 @@ if ($access_console_node === true) {
|
||||
$sub['godmode/servers/modificar_server']['id'] = 'Manage_servers';
|
||||
}
|
||||
|
||||
if ((bool) check_acl($config['id_user'], 0, 'PM') === true
|
||||
|| is_user_admin($config['id_user']) === true
|
||||
) {
|
||||
$sub['godmode/consoles/consoles']['text'] = __('Manage consoles');
|
||||
$sub['godmode/consoles/consoles']['id'] = 'Manage consoles';
|
||||
}
|
||||
|
||||
// This subtabs are only for Pandora Admin.
|
||||
if ((bool) check_acl($config['id_user'], 0, 'PM') === true) {
|
||||
enterprise_hook('ha_cluster');
|
||||
|
96
pandora_console/include/ajax/consoles.ajax.php
Normal file
96
pandora_console/include/ajax/consoles.ajax.php
Normal file
@ -0,0 +1,96 @@
|
||||
<?php
|
||||
/**
|
||||
* Ajax script for Consoles' List view.
|
||||
*
|
||||
* @category Consoles
|
||||
* @package Community
|
||||
* @subpackage Software agents repository
|
||||
* @version 1.0.0
|
||||
* @license See below
|
||||
*
|
||||
* ______ ___ _______ _______ ________
|
||||
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
|
||||
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
|
||||
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
||||
*
|
||||
* ==========================================================
|
||||
* Copyright (c) 2005-2022 Artica Soluciones Tecnológicas S.L
|
||||
* This code is NOT free software. This code is NOT licenced under GPL2 licence
|
||||
* You cannot redistribute it without written permission of copyright holder.
|
||||
* ============================================================================
|
||||
*/
|
||||
|
||||
// Begin.
|
||||
global $config;
|
||||
|
||||
// Login check.
|
||||
check_login();
|
||||
|
||||
require_once $config['homedir'].'/include/functions_ui.php';
|
||||
|
||||
use PandoraFMS\Console;
|
||||
|
||||
if (check_acl($config['id_user'], 0, 'PM') === false
|
||||
&& is_user_admin($config['id_user']) === false
|
||||
) {
|
||||
db_pandora_audit(
|
||||
AUDIT_LOG_ACL_VIOLATION,
|
||||
'Trying to access Consoles Management'
|
||||
);
|
||||
include 'general/noaccess.php';
|
||||
exit;
|
||||
}
|
||||
|
||||
$get_all_datatables_formatted = (bool) get_parameter('get_all_datatables_formatted');
|
||||
$delete = (bool) get_parameter('delete');
|
||||
|
||||
if ($get_all_datatables_formatted === true) {
|
||||
$results = db_get_all_rows_in_table('tconsole', 'id_console');
|
||||
|
||||
if ($results === false) {
|
||||
$results = [];
|
||||
}
|
||||
|
||||
$count = count($results);
|
||||
|
||||
if ($results) {
|
||||
$data = array_reduce(
|
||||
$results,
|
||||
function ($carry, $item) {
|
||||
$item['last_execution'] = ui_print_timestamp($item['last_execution'], true);
|
||||
$item['console_type'] = ((int) $item['console_type'] === 1) ? __('Reporting').'  '.html_print_image('images/report_list.png', true) : __('Standard');
|
||||
// Transforms array of arrays $data into an array
|
||||
// of objects, making a post-process of certain fields.
|
||||
$tmp = (object) $item;
|
||||
$carry[] = $tmp;
|
||||
return $carry;
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
// Datatables format: RecordsTotal && recordsfiltered.
|
||||
echo json_encode(
|
||||
[
|
||||
'data' => $data,
|
||||
'recordsTotal' => $count,
|
||||
'recordsFiltered' => $count,
|
||||
]
|
||||
);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if ($delete === true) {
|
||||
$id = get_parameter('id');
|
||||
|
||||
try {
|
||||
$console = new Console($id);
|
||||
$console->delete();
|
||||
$console->save();
|
||||
echo json_encode(['result' => __('Console successfully deleted')]);
|
||||
} catch (Exception $e) {
|
||||
echo json_encode(['result' => $e->getMessage()]);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
@ -393,6 +393,10 @@ function process_user_login_remote($login, $pass, $api=false)
|
||||
$user_info['metaconsole_access_node'] = $config['ldap_adv_user_node'];
|
||||
}
|
||||
|
||||
if (isset($config['timezonevisual']) === true) {
|
||||
$user_info['timezone'] = $config['timezonevisual'];
|
||||
}
|
||||
|
||||
$permissions = fill_permissions_ldap($sr);
|
||||
if (empty($permissions) === true) {
|
||||
$config['auth_error'] = __('User not found in database or incorrect password');
|
||||
|
@ -20,7 +20,7 @@
|
||||
/**
|
||||
* Pandora build version and version
|
||||
*/
|
||||
$build_version = 'PC230328';
|
||||
$build_version = 'PC230329';
|
||||
$pandora_version = 'v7.0NG.770';
|
||||
|
||||
// Do not overwrite default timezone set if defined.
|
||||
|
@ -579,6 +579,10 @@ function config_update_config()
|
||||
$error_update[] = __('Automatically assigned no hierarchy');
|
||||
}
|
||||
|
||||
if (config_update_value('timezonevisual', (string) get_parameter('timezonevisual'), true) === false) {
|
||||
$error_update[] = __('Automatically timezone visual');
|
||||
}
|
||||
|
||||
if (config_update_value('autocreate_blacklist', get_parameter('autocreate_blacklist'), true) === false) {
|
||||
$error_update[] = __('Autocreate blacklist');
|
||||
}
|
||||
|
@ -4387,12 +4387,53 @@ function events_page_details($event, $server_id=0)
|
||||
|
||||
$data = [];
|
||||
$data[0] = '<div class="normal_weight mrgn_lft_20px">'.__('Last contact').'</div>';
|
||||
$data[1] = ($agent['ultimo_contacto'] == '1970-01-01 00:00:00') ? '<i>'.__('N/A').'</i>' : ui_print_timestamp($agent['ultimo_contacto'], true);
|
||||
|
||||
$user_timezone = users_get_user_by_id($_SESSION['id_usuario'])['timezone'];
|
||||
if (!$user_timezone) {
|
||||
$timezone = timezone_open(date_default_timezone_get());
|
||||
$datetime_eur = date_create('now', timezone_open($config['timezone']));
|
||||
$dif = timezone_offset_get($timezone, $datetime_eur);
|
||||
date($config['date_format'], $dif);
|
||||
if (!date('I')) {
|
||||
// For summer -3600sec.
|
||||
$dif -= 3600;
|
||||
}
|
||||
|
||||
$total_sec = strtotime($agent['ultimo_contacto']);
|
||||
$total_sec += $dif;
|
||||
$last_contact = date($config['date_format'], $total_sec);
|
||||
$last_contact_value = ui_print_timestamp($last_contact, true);
|
||||
} else {
|
||||
$user_timezone = users_get_user_by_id($_SESSION['id_usuario'])['timezone'];
|
||||
date_default_timezone_set($user_timezone);
|
||||
|
||||
$last_contact_value = human_time_comparation(strtotime($agent['ultimo_contacto']), 'large');
|
||||
}
|
||||
|
||||
$data[1] = ($agent['ultimo_contacto'] == '1970-01-01 00:00:00') ? '<i>'.__('N/A').'</i>' : $last_contact_value;
|
||||
$table_details->data[] = $data;
|
||||
|
||||
$user_timezone = users_get_user_by_id($_SESSION['id_usuario'])['timezone'];
|
||||
if (!$user_timezone) {
|
||||
$timezone = timezone_open(date_default_timezone_get());
|
||||
$datetime_eur = date_create('now', timezone_open($config['timezone']));
|
||||
$dif = timezone_offset_get($timezone, $datetime_eur);
|
||||
date($config['date_format'], $dif);
|
||||
if (!date('I')) {
|
||||
// For summer -3600sec.
|
||||
$dif -= 3600;
|
||||
}
|
||||
|
||||
$total_sec = strtotime($agent['ultimo_contacto_remoto']);
|
||||
$total_sec += $dif;
|
||||
$lr_contact = date($config['date_format'], $total_sec);
|
||||
} else {
|
||||
$lr_contact = date($config['date_format'], strtotime($agent['ultimo_contacto_remoto']));
|
||||
}
|
||||
|
||||
$data = [];
|
||||
$data[0] = '<div class="normal_weight mrgn_lft_20px">'.__('Last remote contact').'</div>';
|
||||
$data[1] = ($agent['ultimo_contacto_remoto'] == '1970-01-01 00:00:00') ? '<i>'.__('N/A').'</i>' : date_w_fixed_tz($agent['ultimo_contacto_remoto']);
|
||||
$data[1] = ($agent['ultimo_contacto_remoto'] == '1970-01-01 00:00:00') ? '<i>'.__('N/A').'</i>' : $lr_contact;
|
||||
$table_details->data[] = $data;
|
||||
|
||||
$data = [];
|
||||
@ -4879,6 +4920,13 @@ function events_page_general($event)
|
||||
$data[1] .= __('Last event').': ';
|
||||
$data[1] .= date($config['date_format'], $event['timestamp_last']);
|
||||
} else {
|
||||
$user_timezone = users_get_user_by_id($_SESSION['id_usuario'])['timezone'];
|
||||
if ($user_timezone) {
|
||||
date_default_timezone_set($user_timezone);
|
||||
} else {
|
||||
date_default_timezone_set($config['timezone']);
|
||||
}
|
||||
|
||||
$data[1] = date($config['date_format'], $event['utimestamp']);
|
||||
}
|
||||
|
||||
|
@ -751,7 +751,7 @@ function filemanager_file_explorer(
|
||||
&& ($readOnly === false)
|
||||
) {
|
||||
$data[4] .= '<form method="post" action="'.$url.'" style="">';
|
||||
$data[4] .= '<input type="image" style="margin-top: 2px;height:21px" class="invert_filter main_menu_icon" src="../../images/delete.svg" onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">';
|
||||
$data[4] .= '<input type="image" style="margin-top: 2px;height:21px" class="invert_filter main_menu_icon" src="images/delete.svg" onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">';
|
||||
$data[4] .= html_print_input_hidden('filename', $fileinfo['realpath'], true);
|
||||
$data[4] .= html_print_input_hidden('hash', md5($fileinfo['realpath'].$config['server_unique_identifier']), true);
|
||||
$data[4] .= html_print_input_hidden('delete_file', 1, true);
|
||||
|
138
pandora_console/include/lib/Console.php
Normal file
138
pandora_console/include/lib/Console.php
Normal file
@ -0,0 +1,138 @@
|
||||
<?php
|
||||
// phpcs:disable Squiz.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* Console entity class.
|
||||
*
|
||||
* @category Class
|
||||
* @package Pandora FMS
|
||||
* @subpackage OpenSource
|
||||
* @version 1.0.0
|
||||
* @license See below
|
||||
*
|
||||
* ______ ___ _______ _______ ________
|
||||
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
|
||||
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
|
||||
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
||||
*
|
||||
* ============================================================================
|
||||
* Copyright (c) 2005-2021 Artica Soluciones Tecnologicas
|
||||
* Please see http://pandorafms.org for full contribution list
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation for version 2.
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
* ============================================================================
|
||||
*/
|
||||
|
||||
// Begin.
|
||||
namespace PandoraFMS;
|
||||
|
||||
/**
|
||||
* PandoraFMS console entity.
|
||||
*/
|
||||
class Console extends Entity
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* Builds a PandoraFMS\Console object from given id.
|
||||
*
|
||||
* @param integer $id Id console.
|
||||
*/
|
||||
public function __construct(?int $id=null)
|
||||
{
|
||||
$table = 'tconsole';
|
||||
$filter = ['id' => $id];
|
||||
|
||||
$this->existsInDB = false;
|
||||
|
||||
if (is_numeric($id) === true
|
||||
&& $id > 0
|
||||
) {
|
||||
parent::__construct(
|
||||
$table,
|
||||
$filter,
|
||||
null,
|
||||
false
|
||||
);
|
||||
$this->existsInDB = true;
|
||||
} else {
|
||||
// Create empty skel.
|
||||
parent::__construct($table, null);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Saves current definition of a Console to database.
|
||||
*
|
||||
* @return mixed Affected rows of false in case of error.
|
||||
* @throws \Exception On error.
|
||||
*/
|
||||
public function save()
|
||||
{
|
||||
if ($this->fields['id'] > 0) {
|
||||
// Update.
|
||||
$updates = $this->fields;
|
||||
|
||||
$rs = \db_process_sql_update(
|
||||
$this->table,
|
||||
$updates,
|
||||
['id' => $this->fields['id']]
|
||||
);
|
||||
|
||||
if ($rs === false) {
|
||||
global $config;
|
||||
throw new \Exception(
|
||||
__METHOD__.' error: '.$config['dbconnection']->error
|
||||
);
|
||||
}
|
||||
} else {
|
||||
// Creation.
|
||||
$inserts = $this->fields;
|
||||
|
||||
// Clean null fields.
|
||||
foreach ($inserts as $k => $v) {
|
||||
if ($v === null) {
|
||||
unset($inserts[$k]);
|
||||
}
|
||||
}
|
||||
|
||||
$rs = \db_process_sql_insert(
|
||||
$this->table,
|
||||
$inserts
|
||||
);
|
||||
|
||||
if ($rs === false) {
|
||||
global $config;
|
||||
throw new \Exception(
|
||||
__METHOD__.' error: '.$config['dbconnection']->error
|
||||
);
|
||||
}
|
||||
|
||||
$this->fields['id'] = $rs;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Remove this Console.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function delete()
|
||||
{
|
||||
if ($this->existsInDB === true) {
|
||||
\db_process_delete_temp(
|
||||
$this->table,
|
||||
'id',
|
||||
$this->fields['id']
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
@ -5885,7 +5885,12 @@ div.switch_radio_button label:last-of-type {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.switch_radio_button input:checked + label,
|
||||
.switch_radio_button input:checked + label {
|
||||
background-color: var(--primary-color);
|
||||
box-shadow: none;
|
||||
color: var(--secondary-color) !important;
|
||||
}
|
||||
|
||||
.switch_radio_button input:checked:has(.custom_checkbox) {
|
||||
background-color: var(--primary-color);
|
||||
box-shadow: none;
|
||||
|
@ -131,7 +131,7 @@
|
||||
<div style='padding-bottom: 50px'>
|
||||
<?php
|
||||
$version = '7.0NG.770';
|
||||
$build = '230328';
|
||||
$build = '230329';
|
||||
$banner = "v$version Build $build";
|
||||
error_reporting(0);
|
||||
|
||||
|
@ -536,10 +536,31 @@ if (is_ajax() === true) {
|
||||
(empty($tmp->ack_utimestamp) === true) ? 0 : $tmp->ack_utimestamp,
|
||||
true
|
||||
);
|
||||
$tmp->timestamp = ui_print_timestamp(
|
||||
$tmp->utimestamp,
|
||||
true
|
||||
);
|
||||
|
||||
$user_timezone = users_get_user_by_id($_SESSION['id_usuario'])['timezone'];
|
||||
if (!$user_timezone) {
|
||||
$timezone = timezone_open(date_default_timezone_get());
|
||||
$datetime_eur = date_create('now', timezone_open($config['timezone']));
|
||||
$dif = timezone_offset_get($timezone, $datetime_eur);
|
||||
date($config['date_format'], $dif);
|
||||
if (!date('I')) {
|
||||
// For summer -3600sec.
|
||||
$dif -= 3600;
|
||||
}
|
||||
|
||||
$total_sec = strtotime($tmp->timestamp);
|
||||
$total_sec += $dif;
|
||||
$last_contact = date($config['date_format'], $total_sec);
|
||||
$last_contact_value = ui_print_timestamp($last_contact, true);
|
||||
} else {
|
||||
$user_timezone = users_get_user_by_id($_SESSION['id_usuario'])['timezone'];
|
||||
date_default_timezone_set($user_timezone);
|
||||
$title = date($config['date_format'], strtotime($tmp->timestamp));
|
||||
$value = human_time_comparation(strtotime($tmp->timestamp), 'large');
|
||||
$last_contact_value = '<span title="'.$title.'">'.$value.'</span>';
|
||||
}
|
||||
|
||||
$tmp->timestamp = $last_contact_value;
|
||||
|
||||
if (is_numeric($tmp->data) === true) {
|
||||
$tmp->data = format_numeric(
|
||||
|
@ -3,7 +3,7 @@
|
||||
#
|
||||
%define name pandorafms_console
|
||||
%define version 7.0NG.770
|
||||
%define release 230328
|
||||
%define release 230329
|
||||
|
||||
# User and Group under which Apache is running
|
||||
%define httpd_name httpd
|
||||
|
@ -3,7 +3,7 @@
|
||||
#
|
||||
%define name pandorafms_console
|
||||
%define version 7.0NG.770
|
||||
%define release 230328
|
||||
%define release 230329
|
||||
|
||||
# User and Group under which Apache is running
|
||||
%define httpd_name httpd
|
||||
|
@ -3,7 +3,7 @@
|
||||
#
|
||||
%define name pandorafms_console
|
||||
%define version 7.0NG.770
|
||||
%define release 230328
|
||||
%define release 230329
|
||||
%define httpd_name httpd
|
||||
# User and Group under which Apache is running
|
||||
%define httpd_name apache2
|
||||
|
@ -3769,6 +3769,7 @@ CREATE TABLE IF NOT EXISTS `tuser_task_scheduled` (
|
||||
`flag_delete` TINYINT UNSIGNED NOT NULL DEFAULT 0,
|
||||
`id_grupo` INT UNSIGNED NOT NULL DEFAULT 0,
|
||||
`enabled` TINYINT UNSIGNED NOT NULL DEFAULT 1,
|
||||
`id_console` BIGINT NOT NULL DEFAULT 0,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4;
|
||||
|
||||
@ -4189,6 +4190,21 @@ CREATE TABLE IF NOT EXISTS `tmonitor_filter` (
|
||||
PRIMARY KEY (`id_filter`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4;
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Table `tconsole`
|
||||
-- ---------------------------------------------------------------------
|
||||
CREATE TABLE IF NOT EXISTS `tconsole` (
|
||||
`id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`id_console` BIGINT NOT NULL DEFAULT 0,
|
||||
`description` TEXT,
|
||||
`version` TINYTEXT,
|
||||
`last_execution` INT UNSIGNED NOT NULL DEFAULT 0,
|
||||
`console_type` TINYINT NOT NULL DEFAULT 0,
|
||||
`timezone` TINYTEXT,
|
||||
`public_url` TEXT,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4;
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Table `tagent_filter`
|
||||
-- ---------------------------------------------------------------------
|
||||
@ -4207,6 +4223,7 @@ CREATE TABLE IF NOT EXISTS `tagent_filter` (
|
||||
PRIMARY KEY (`id_filter`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4;
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Table `tevent_sound`
|
||||
-- ---------------------------------------------------------------------
|
||||
CREATE TABLE `tevent_sound` (
|
||||
|
217
pandora_console/views/consoles/list.php
Normal file
217
pandora_console/views/consoles/list.php
Normal file
@ -0,0 +1,217 @@
|
||||
<?php
|
||||
/**
|
||||
* Console: Consoles list page.
|
||||
*
|
||||
* @category View
|
||||
* @package Pandora FMS
|
||||
* @subpackage Alert
|
||||
* @version 1.0.0
|
||||
* @license See below
|
||||
*
|
||||
* ______ ___ _______ _______ ________
|
||||
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
|
||||
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
|
||||
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
||||
*
|
||||
* ============================================================================
|
||||
* Copyright (c) 2005-2021 Artica Soluciones Tecnologicas
|
||||
* Please see http://pandorafms.org for full contribution list
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation for version 2.
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
* ============================================================================
|
||||
*/
|
||||
|
||||
// Header.
|
||||
\ui_print_page_header(
|
||||
// Title.
|
||||
__('%s registered consoles', $config['rb_product_name']),
|
||||
// Icon.
|
||||
'',
|
||||
// Return.
|
||||
false,
|
||||
// Help.
|
||||
'',
|
||||
// Godmode.
|
||||
true,
|
||||
// Options.
|
||||
''
|
||||
);
|
||||
|
||||
if (empty($message) === false) {
|
||||
echo $message;
|
||||
}
|
||||
|
||||
// Auxiliar to display deletion modal.
|
||||
echo '<div id="delete_modal" class="invisible"></div>';
|
||||
echo '<div id="msg" class="invisible"></div>';
|
||||
|
||||
|
||||
// Consoles list.
|
||||
try {
|
||||
$columns = [
|
||||
'id_console',
|
||||
'description',
|
||||
'version',
|
||||
'last_execution',
|
||||
'console_type',
|
||||
'timezone',
|
||||
'public_url',
|
||||
'options',
|
||||
];
|
||||
|
||||
$column_names = [
|
||||
__('Console ID'),
|
||||
__('Description'),
|
||||
__('Version'),
|
||||
__('Last Execution'),
|
||||
__('Console type'),
|
||||
__('Timezone'),
|
||||
__('Public URL'),
|
||||
[
|
||||
'text' => __('Options'),
|
||||
'class' => 'action_buttons',
|
||||
],
|
||||
];
|
||||
|
||||
|
||||
$tableId = 'consoles_list';
|
||||
// Load datatables user interface.
|
||||
ui_print_datatable(
|
||||
[
|
||||
'id' => $tableId,
|
||||
'class' => 'info_table',
|
||||
'style' => 'width: 99%',
|
||||
'columns' => $columns,
|
||||
'column_names' => $column_names,
|
||||
'ajax_url' => 'include/ajax/consoles.ajax',
|
||||
'ajax_data' => ['get_all_datatables_formatted' => 1],
|
||||
'ajax_postprocess' => 'process_datatables_item(item)',
|
||||
'no_sortable_columns' => [-1],
|
||||
'order' => [
|
||||
'field' => 'id',
|
||||
'direction' => 'asc',
|
||||
],
|
||||
]
|
||||
);
|
||||
} catch (Exception $e) {
|
||||
echo $e->getMessage();
|
||||
}
|
||||
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
/**
|
||||
* Process datatable item before draw it.
|
||||
*/
|
||||
function process_datatables_item(item) {
|
||||
item.options = '<a href="javascript:" onclick="delete_key(\'';
|
||||
item.options += item.id;
|
||||
item.options += '\')" ><?php echo html_print_image('images/cross.png', true, ['title' => __('Delete'), 'class' => 'invert_filter']); ?></a>';
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete selected key
|
||||
*/
|
||||
function delete_key(id) {
|
||||
$('#delete_modal').empty();
|
||||
$('#delete_modal').html('<?php echo __('<span>Are you sure?</span><br><br><i>WARNING: you also need to delete config.php options in your console or delete the whole console.</i>'); ?>');
|
||||
$('#delete_modal').dialog({
|
||||
title: '<?php echo __('Delete'); ?>',
|
||||
buttons: [
|
||||
{
|
||||
class: 'ui-widget ui-state-default ui-corner-all ui-button-text-only sub upd submit-cancel',
|
||||
text: '<?php echo __('Cancel'); ?>',
|
||||
click: function(e) {
|
||||
$(this).dialog('close');
|
||||
cleanupDOM();
|
||||
|
||||
}
|
||||
},
|
||||
{
|
||||
text: 'Delete',
|
||||
class: 'ui-widget ui-state-default ui-corner-all ui-button-text-only sub ok submit-next',
|
||||
click: function(e) {
|
||||
$.ajax({
|
||||
method: 'post',
|
||||
url: '<?php echo ui_get_full_url('ajax.php', false, false, false); ?>',
|
||||
data: {
|
||||
page: 'include/ajax/consoles.ajax',
|
||||
delete: 1,
|
||||
id
|
||||
},
|
||||
datatype: "json",
|
||||
success: function (data) {
|
||||
showMsg(data);
|
||||
},
|
||||
error: function(e) {
|
||||
showMsg(e);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Process ajax responses and shows a dialog with results.
|
||||
*/
|
||||
function showMsg(data) {
|
||||
var title = "<?php echo __('Success'); ?>";
|
||||
var dt_satellite_agents = $("#<?php echo $tableId; ?>").DataTable();
|
||||
dt_<?php echo $tableId; ?>.draw(false);
|
||||
|
||||
var text = '';
|
||||
var failed = 0;
|
||||
try {
|
||||
data = JSON.parse(data);
|
||||
text = data['result'];
|
||||
} catch (err) {
|
||||
title = "<?php echo __('Failed'); ?>";
|
||||
text = err.message;
|
||||
failed = 1;
|
||||
}
|
||||
if (!failed && data['error'] != undefined) {
|
||||
title = "<?php echo __('Failed'); ?>";
|
||||
text = data['error'];
|
||||
failed = 1;
|
||||
}
|
||||
if (data['report'] != undefined) {
|
||||
data['report'].forEach(function (item){
|
||||
text += '<br>'+item;
|
||||
});
|
||||
}
|
||||
|
||||
$('#msg').empty();
|
||||
$('#msg').html(text);
|
||||
$('#msg').dialog({
|
||||
width: 450,
|
||||
position: {
|
||||
my: 'center',
|
||||
at: 'center',
|
||||
of: window,
|
||||
collision: 'fit'
|
||||
},
|
||||
title: title,
|
||||
buttons: [
|
||||
{
|
||||
class: "ui-widget ui-state-default ui-corner-all ui-button-text-only sub ok submit-next",
|
||||
text: 'OK',
|
||||
click: function(e) {
|
||||
if (!failed) {
|
||||
$(".ui-dialog-content").dialog("close");
|
||||
$('.info').hide();
|
||||
} else {
|
||||
$(this).dialog('close');
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
</script>
|
@ -1,5 +1,5 @@
|
||||
package: pandorafms-server
|
||||
Version: 7.0NG.770-230328
|
||||
Version: 7.0NG.770-230329
|
||||
Architecture: all
|
||||
Priority: optional
|
||||
Section: admin
|
||||
|
@ -14,7 +14,7 @@
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
pandora_version="7.0NG.770-230328"
|
||||
pandora_version="7.0NG.770-230329"
|
||||
|
||||
package_cpan=0
|
||||
package_pandora=1
|
||||
|
@ -46,7 +46,7 @@ our @EXPORT = qw(
|
||||
|
||||
# version: Defines actual version of Pandora Server for this module only
|
||||
my $pandora_version = "7.0NG.770";
|
||||
my $pandora_build = "230328";
|
||||
my $pandora_build = "230329";
|
||||
our $VERSION = $pandora_version." ".$pandora_build;
|
||||
|
||||
# Setup hash
|
||||
|
@ -34,7 +34,7 @@ our @ISA = qw(Exporter);
|
||||
|
||||
# version: Defines actual version of Pandora Server for this module only
|
||||
my $pandora_version = "7.0NG.770";
|
||||
my $pandora_build = "230328";
|
||||
my $pandora_build = "230329";
|
||||
our $VERSION = $pandora_version." ".$pandora_build;
|
||||
|
||||
our %EXPORT_TAGS = ( 'all' => [ qw() ] );
|
||||
|
@ -4,7 +4,7 @@
|
||||
%global __os_install_post %{nil}
|
||||
%define name pandorafms_server
|
||||
%define version 7.0NG.770
|
||||
%define release 230328
|
||||
%define release 230329
|
||||
|
||||
Summary: Pandora FMS Server
|
||||
Name: %{name}
|
||||
|
@ -4,7 +4,7 @@
|
||||
%global __os_install_post %{nil}
|
||||
%define name pandorafms_server
|
||||
%define version 7.0NG.770
|
||||
%define release 230328
|
||||
%define release 230329
|
||||
|
||||
Summary: Pandora FMS Server
|
||||
Name: %{name}
|
||||
|
@ -9,7 +9,7 @@
|
||||
# **********************************************************************
|
||||
|
||||
PI_VERSION="7.0NG.770"
|
||||
PI_BUILD="230328"
|
||||
PI_BUILD="230329"
|
||||
|
||||
MODE=$1
|
||||
if [ $# -gt 1 ]; then
|
||||
|
@ -35,7 +35,7 @@ use PandoraFMS::Config;
|
||||
use PandoraFMS::DB;
|
||||
|
||||
# version: define current version
|
||||
my $version = "7.0NG.770 Build 230328";
|
||||
my $version = "7.0NG.770 Build 230329";
|
||||
|
||||
# Pandora server configuration
|
||||
my %conf;
|
||||
|
@ -36,7 +36,7 @@ use Encode::Locale;
|
||||
Encode::Locale::decode_argv;
|
||||
|
||||
# version: define current version
|
||||
my $version = "7.0NG.770 Build 230328";
|
||||
my $version = "7.0NG.770 Build 230329";
|
||||
|
||||
# save program name for logging
|
||||
my $progname = basename($0);
|
||||
|
Loading…
x
Reference in New Issue
Block a user