mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-30 17:25:26 +02:00
Merge branch 'ent-8365-ncm-fase-3' of https://brutus.artica.es:8081/artica/pandorafms into ent-8365-ncm-fase-3
This commit is contained in:
commit
ad81b26556
@ -1,5 +1,5 @@
|
||||
package: pandorafms-agent-unix
|
||||
Version: 7.0NG.773.3-231024
|
||||
Version: 7.0NG.773.3-231030
|
||||
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.773.3-231024"
|
||||
pandora_version="7.0NG.773.3-231030"
|
||||
|
||||
echo "Test if you has the tools for to make the packages."
|
||||
whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null
|
||||
|
@ -1031,7 +1031,7 @@ my $Sem = undef;
|
||||
my $ThreadSem = undef;
|
||||
|
||||
use constant AGENT_VERSION => '7.0NG.773.3';
|
||||
use constant AGENT_BUILD => '231024';
|
||||
use constant AGENT_BUILD => '231030';
|
||||
|
||||
# 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.773.3
|
||||
%define release 231024
|
||||
%define release 231030
|
||||
|
||||
Summary: Pandora FMS Linux agent, PERL version
|
||||
Name: %{name}
|
||||
|
@ -5,7 +5,7 @@
|
||||
%define name pandorafms_agent_linux_bin
|
||||
%define source_name pandorafms_agent_linux
|
||||
%define version 7.0NG.773.3
|
||||
%define release 231024
|
||||
%define release 231030
|
||||
|
||||
Summary: Pandora FMS Linux agent, binary version
|
||||
Name: %{name}
|
||||
|
@ -4,7 +4,7 @@
|
||||
%global __os_install_post %{nil}
|
||||
%define name pandorafms_agent_linux
|
||||
%define version 7.0NG.773.3
|
||||
%define release 231024
|
||||
%define release 231030
|
||||
|
||||
Summary: Pandora FMS Linux agent, PERL version
|
||||
Name: %{name}
|
||||
|
@ -10,7 +10,7 @@
|
||||
# **********************************************************************
|
||||
|
||||
PI_VERSION="7.0NG.773.3"
|
||||
PI_BUILD="231024"
|
||||
PI_BUILD="231030"
|
||||
OS_NAME=`uname -s`
|
||||
|
||||
FORCE=0
|
||||
|
@ -186,7 +186,7 @@ UpgradeApplicationID
|
||||
{}
|
||||
|
||||
Version
|
||||
{231024}
|
||||
{231030}
|
||||
|
||||
ViewReadme
|
||||
{Yes}
|
||||
|
@ -30,7 +30,7 @@ using namespace Pandora;
|
||||
using namespace Pandora_Strutils;
|
||||
|
||||
#define PATH_SIZE _MAX_PATH+1
|
||||
#define PANDORA_VERSION ("7.0NG.773.3 Build 231024")
|
||||
#define PANDORA_VERSION ("7.0NG.773.3 Build 231030")
|
||||
|
||||
string pandora_path;
|
||||
string pandora_dir;
|
||||
|
@ -11,7 +11,7 @@ BEGIN
|
||||
VALUE "LegalCopyright", "Pandora FMS"
|
||||
VALUE "OriginalFilename", "PandoraAgent.exe"
|
||||
VALUE "ProductName", "Pandora FMS Windows Agent"
|
||||
VALUE "ProductVersion", "(7.0NG.773.3(Build 231024))"
|
||||
VALUE "ProductVersion", "(7.0NG.773.3(Build 231030))"
|
||||
VALUE "FileVersion", "1.0.0.0"
|
||||
END
|
||||
END
|
||||
|
@ -1,5 +1,5 @@
|
||||
package: pandorafms-console
|
||||
Version: 7.0NG.773.3-231024
|
||||
Version: 7.0NG.773.3-231030
|
||||
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.773.3-231024"
|
||||
pandora_version="7.0NG.773.3-231030"
|
||||
|
||||
package_pear=0
|
||||
package_pandora=1
|
||||
|
@ -1,4 +1,4 @@
|
||||
pandorafms.vmware=459175dce8ab811e874ce2e7216f0db4
|
||||
pandorafms.vmware=9959cc3e5cc6bfcfadd6d05b56d4a11b
|
||||
pandorafms.mysql=fadb4750d18285c0eca34f47c6aa3cfe
|
||||
pandorafms.mssql=1cc215409741d19080269ffba112810e
|
||||
pandorafms.oracle=2d9320a514d1e48a0b2804e1653c31c6
|
||||
|
@ -160,6 +160,9 @@ UPDATE tagente_modulo SET `tcp_send` = '2c' WHERE `tcp_send` = '2';
|
||||
UPDATE tpolicy_modules SET `tcp_send` = '2c' WHERE `tcp_send` = '2';
|
||||
UPDATE tnetwork_component SET `tcp_send` = '2c' WHERE `tcp_send` = '2';
|
||||
|
||||
ALTER TABLE tagente_modulo ADD COLUMN `made_enabled` TINYINT UNSIGNED DEFAULT 0;
|
||||
ALTER TABLE tpolicy_modules ADD COLUMN `made_enabled` TINYINT UNSIGNED DEFAULT 0;
|
||||
|
||||
ALTER TABLE talert_templates
|
||||
ADD COLUMN `time_window` ENUM ('thirty_days','this_month','seven_days','this_week','one_day','today'),
|
||||
ADD COLUMN `math_function` ENUM ('avg', 'min', 'max', 'sum'),
|
||||
@ -359,7 +362,13 @@ SET @id_os = 9;
|
||||
INSERT INTO tmodule_inventory (`id_os`, `name`, `description`, `interpreter`, `data_format`, `code`, `block_mode`,`script_mode`)
|
||||
SELECT * FROM (SELECT @id_os id_os, @tmodule_name name, @tmodule_description description, '' interpreter, 'ID:STATUS' data_format, '' code, '0' block_mode, 2 script_mode) AS tmp
|
||||
WHERE NOT EXISTS (SELECT name, description FROM tmodule_inventory WHERE name = @tmodule_name and description = @tmodule_description and id_os = @id_os);
|
||||
INSERT INTO tmodule_group (name) SELECT ('Security') WHERE NOT EXISTS (SELECT name FROM tmodule_group WHERE LOWER(name) = 'security');
|
||||
|
||||
ALTER TABLE tagente_modulo ADD COLUMN `last_compact` TIMESTAMP NOT NULL DEFAULT 0;
|
||||
|
||||
UPDATE `tevent_alert` ea INNER JOIN `tevent_rule` er ON ea.id = er.id_event_alert SET disabled=1 WHERE er.log_agent IS NOT NULL OR er.log_content IS NOT NULL OR er.log_source IS NOT NULL;
|
||||
|
||||
ALTER TABLE `tnetwork_explorer_filter`
|
||||
MODIFY COLUMN `id` INT NOT NULL AUTO_INCREMENT;
|
||||
|
||||
COMMIT;
|
||||
|
@ -1,7 +1,7 @@
|
||||
START TRANSACTION;
|
||||
|
||||
ALTER TABLE `tncm_queue`
|
||||
ADD COLUMN `id_agent_data` INT NOT NULL DEFAULT 0 AFTER `id_script`;
|
||||
ADD COLUMN `id_agent_data` bigint unsigned AFTER `id_script`,
|
||||
ADD CONSTRAINT `fk_tncm_queue_tncm_agent_data` FOREIGN KEY (`id_agent_data`) REFERENCES `tncm_agent_data`(`id`) ON UPDATE CASCADE ON DELETE SET NULL;
|
||||
|
||||
|
||||
COMMIT;
|
||||
COMMIT;
|
||||
|
@ -1326,6 +1326,12 @@ if ($update_module === true || $create_module === true) {
|
||||
*/
|
||||
|
||||
$post_process = (string) get_parameter('post_process', 0.0);
|
||||
if (modules_made_compatible($id_module_type) === true) {
|
||||
$made_enabled = (bool) get_parameter_checkbox('made_enabled', 0);
|
||||
} else {
|
||||
$made_enabled = false;
|
||||
}
|
||||
|
||||
$prediction_module = (int) get_parameter('prediction_module');
|
||||
$max_timeout = (int) get_parameter('max_timeout');
|
||||
$max_retries = (int) get_parameter('max_retries');
|
||||
@ -1348,6 +1354,14 @@ if ($update_module === true || $create_module === true) {
|
||||
}
|
||||
|
||||
$configuration_data = (string) get_parameter('configuration_data');
|
||||
$array_configuration_data = explode(PHP_EOL, io_safe_output($configuration_data));
|
||||
$configuration_data = '';
|
||||
foreach ($array_configuration_data as $value) {
|
||||
$configuration_data .= trim($value).PHP_EOL;
|
||||
}
|
||||
|
||||
$configuration_data = io_safe_input($configuration_data);
|
||||
|
||||
$old_configuration_data = (string) get_parameter('old_configuration_data');
|
||||
$new_configuration_data = '';
|
||||
|
||||
@ -1488,6 +1502,14 @@ if ($update_module === true || $create_module === true) {
|
||||
}
|
||||
|
||||
$plugin_parameter = (string) get_parameter('plugin_parameter');
|
||||
|
||||
$array_plugin_parameter = explode(PHP_EOL, io_safe_output($plugin_parameter));
|
||||
$plugin_parameter = '';
|
||||
foreach ($array_plugin_parameter as $value) {
|
||||
$plugin_parameter .= trim($value).PHP_EOL;
|
||||
}
|
||||
|
||||
$plugin_parameter = io_safe_input($plugin_parameter);
|
||||
}
|
||||
|
||||
$parent_module_id = (int) get_parameter('parent_module_id');
|
||||
@ -1704,6 +1726,7 @@ if ($update_module) {
|
||||
'plugin_parameter' => $plugin_parameter,
|
||||
'id_plugin' => $id_plugin,
|
||||
'post_process' => $post_process,
|
||||
'made_enabled' => $made_enabled,
|
||||
'prediction_module' => $prediction_module,
|
||||
'max_timeout' => $max_timeout,
|
||||
'max_retries' => $max_retries,
|
||||
@ -1902,6 +1925,7 @@ if ($create_module) {
|
||||
'plugin_parameter' => $plugin_parameter,
|
||||
'id_plugin' => $id_plugin,
|
||||
'post_process' => $post_process,
|
||||
'made_enabled' => $made_enabled,
|
||||
'prediction_module' => $prediction_module,
|
||||
'max_timeout' => $max_timeout,
|
||||
'max_retries' => $max_retries,
|
||||
|
@ -294,6 +294,7 @@ if ($id_agent_module) {
|
||||
$plugin_parameter = $module['plugin_parameter'];
|
||||
$id_plugin = $module['id_plugin'];
|
||||
$post_process = $module['post_process'];
|
||||
$made_enabled = $module['made_enabled'];
|
||||
$prediction_module = $module['prediction_module'];
|
||||
$custom_integer_1 = $module['custom_integer_1'];
|
||||
$custom_integer_2 = $module['custom_integer_2'];
|
||||
@ -408,6 +409,7 @@ if ($id_agent_module) {
|
||||
$id_module_group = 1;
|
||||
$id_module_type = 1;
|
||||
$post_process = '';
|
||||
$made_enabled = false;
|
||||
$max_timeout = 0;
|
||||
$max_retries = 0;
|
||||
$min = '';
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -318,7 +318,7 @@ foreach ($texts as $code => $text) {
|
||||
return;
|
||||
}
|
||||
|
||||
$(plugin_parameter).val('task_begin\ncookie 0\nresource 0\ntask_end');
|
||||
$(plugin_parameter).val('task_begin\nget https://demoweb.com/page/\ncheck_string text string or HTML code to search (regexp)\ntask_end\n');
|
||||
|
||||
$('#button-btn_loadbasic').attr('disabled', 'disabled');
|
||||
|
||||
|
@ -916,7 +916,24 @@ $table->data[17][0] = html_print_label_input_block(
|
||||
)
|
||||
);
|
||||
|
||||
$table->data[17][1] = html_print_label_input_block(
|
||||
$table->data['made_enabled'][1] = html_print_label_input_block(
|
||||
__('MADE enabled').ui_print_help_tip(
|
||||
__('By activating this option, the module data will be processed by the MADE engine (if active), and events will be generated automatically by the IA engine'),
|
||||
true
|
||||
),
|
||||
html_print_checkbox_switch(
|
||||
'made_enabled',
|
||||
1,
|
||||
false,
|
||||
true,
|
||||
false,
|
||||
'',
|
||||
false,
|
||||
'wp100 static'
|
||||
)
|
||||
);
|
||||
|
||||
$table->data[17][2] = html_print_label_input_block(
|
||||
__('SNMP community'),
|
||||
html_print_input_text(
|
||||
'snmp_community',
|
||||
@ -1653,7 +1670,8 @@ $(document).ready (function () {
|
||||
"tr#delete_table-36, " +
|
||||
"tr#delete_table-37, " +
|
||||
"tr#delete_table-38, " +
|
||||
"tr#delete_table-39, " +
|
||||
"tr#delete_table-39, " +
|
||||
"tr#delete_table-made_enabled, " +
|
||||
"tr#delete_table-40").hide();
|
||||
|
||||
var params = {
|
||||
@ -1728,7 +1746,8 @@ $(document).ready (function () {
|
||||
"tr#delete_table-36, " +
|
||||
"tr#delete_table-37, " +
|
||||
"tr#delete_table-38, " +
|
||||
"tr#delete_table-39, " +
|
||||
"tr#delete_table-39, " +
|
||||
"tr#delete_table-made_enabled, " +
|
||||
"tr#delete_table-40").show ();
|
||||
|
||||
switch($('#module_type').val()) {
|
||||
@ -1838,7 +1857,8 @@ $(document).ready (function () {
|
||||
"tr#delete_table-36, " +
|
||||
"tr#delete_table-37, " +
|
||||
"tr#delete_table-38, " +
|
||||
"tr#delete_table-39, " +
|
||||
"tr#delete_table-39, " +
|
||||
"tr#delete_table-made_enabled, " +
|
||||
"tr#delete_table-40").hide ();
|
||||
$('input[type=checkbox]').attr('checked', false);
|
||||
$('input[type=checkbox]').attr('disabled', true);
|
||||
@ -1877,7 +1897,8 @@ $(document).ready (function () {
|
||||
"tr#delete_table-36, " +
|
||||
"tr#delete_table-37, " +
|
||||
"tr#delete_table-38, " +
|
||||
"tr#delete_table-39, " +
|
||||
"tr#delete_table-39, " +
|
||||
"tr#delete_table-made_enabled, " +
|
||||
"tr#delete_table-40").show();
|
||||
}
|
||||
else {
|
||||
@ -1908,7 +1929,8 @@ $(document).ready (function () {
|
||||
"tr#delete_table-36, " +
|
||||
"tr#delete_table-37, " +
|
||||
"tr#delete_table-38, " +
|
||||
"tr#delete_table-39, " +
|
||||
"tr#delete_table-39, " +
|
||||
"tr#delete_table-made_enabled, " +
|
||||
"tr#delete_table-40").hide();
|
||||
}
|
||||
}
|
||||
@ -1932,6 +1954,9 @@ $(document).ready (function () {
|
||||
else if (this.id == "checkbox-dynamic_two_tailed") {
|
||||
return; //Do none
|
||||
}
|
||||
else if (this.id == "checkbox-made_enabled") {
|
||||
return; //Do none
|
||||
}
|
||||
else {
|
||||
if (this.id == "checkbox-force_group") {
|
||||
$("#checkbox-recursion").prop("checked", false);
|
||||
@ -1964,7 +1989,7 @@ $(document).ready (function () {
|
||||
"tr#delete_table-36, " +
|
||||
"tr#delete_table-37, " +
|
||||
"tr#delete_table-38, " +
|
||||
"tr#delete_table-39, " +
|
||||
"tr#delete_table-39, " +
|
||||
"tr#delete_table-40").show ();
|
||||
}
|
||||
else {
|
||||
@ -1995,7 +2020,8 @@ $(document).ready (function () {
|
||||
"tr#delete_table-36, " +
|
||||
"tr#delete_table-37, " +
|
||||
"tr#delete_table-38, " +
|
||||
"tr#delete_table-39, " +
|
||||
"tr#delete_table-39, " +
|
||||
"tr#delete_table-made_enabled, " +
|
||||
"tr#delete_table-40").hide();
|
||||
}
|
||||
}
|
||||
@ -2085,7 +2111,8 @@ $(document).ready (function () {
|
||||
"tr#delete_table-36, " +
|
||||
"tr#delete_table-37, " +
|
||||
"tr#delete_table-38, " +
|
||||
"tr#delete_table-39, " +
|
||||
"tr#delete_table-39, " +
|
||||
"tr#delete_table-made_enabled, " +
|
||||
"tr#delete_table-40").hide();
|
||||
|
||||
jQuery.post ("ajax.php",
|
||||
@ -2315,6 +2342,7 @@ function process_manage_edit($module_name, $agents_select=null, $module_status='
|
||||
'module_interval',
|
||||
'disabled',
|
||||
'post_process',
|
||||
'made_enabled',
|
||||
'unit_select',
|
||||
'snmp_community',
|
||||
'snmp_oid',
|
||||
@ -2626,6 +2654,10 @@ function process_manage_edit($module_name, $agents_select=null, $module_status='
|
||||
$values['macros'] = json_encode($module_macros);
|
||||
}
|
||||
|
||||
if (modules_made_compatible($module['id_tipo_modulo']) === false) {
|
||||
$values['made_enabled'] = 0;
|
||||
}
|
||||
|
||||
$result = modules_update_agent_module(
|
||||
$module['id_agente_modulo'],
|
||||
$values,
|
||||
|
@ -151,6 +151,10 @@ if (isset($_GET['server']) === true) {
|
||||
$title .= __('Netflow server').' ID: '.$id_server;
|
||||
break;
|
||||
|
||||
case SERVER_TYPE_MADE:
|
||||
$title .= __('MADE server').' ID: '.$id_server;
|
||||
break;
|
||||
|
||||
default:
|
||||
$title = __('Update server').' ID: '.$id_server;
|
||||
break;
|
||||
|
BIN
pandora_console/images/Anomaly-detection.png
Normal file
BIN
pandora_console/images/Anomaly-detection.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 803 B |
BIN
pandora_console/images/Anomaly-detection@2x.png
Normal file
BIN
pandora_console/images/Anomaly-detection@2x.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.9 KiB |
14
pandora_console/images/Anomaly-detection@svg.svg
Normal file
14
pandora_console/images/Anomaly-detection@svg.svg
Normal 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>Anomaly detection@svg</title>
|
||||
<g id="Anomaly-detection" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
||||
<g id="Dark-/-20-/-details">
|
||||
<g id="Group">
|
||||
<rect id="Rectangle" x="0" y="0" width="20" height="20"></rect>
|
||||
<line x1="14" y1="14" x2="18" y2="18" id="Path-9" stroke="#3F3F3F" stroke-width="4" stroke-linecap="round" stroke-linejoin="round"></line>
|
||||
<circle id="Oval" stroke="#3F3F3F" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" cx="8" cy="8" r="7"></circle>
|
||||
</g>
|
||||
<path d="M2,11 C2,11 3.33333333,11 6,11 C7.33333333,7 8,5 8,5 C8,5 8.66666667,7 10,11 L14,11" id="Path" stroke="#3F3F3F" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></path>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 1013 B |
@ -483,6 +483,13 @@ if (check_login()) {
|
||||
'tagente_modulo',
|
||||
['id_agente_modulo' => $module_id]
|
||||
);
|
||||
|
||||
$made_enabled = db_get_value_filter(
|
||||
'made_enabled',
|
||||
'tagente_modulo',
|
||||
['id_agente_modulo' => $module_id]
|
||||
);
|
||||
|
||||
$unit = db_get_value_filter(
|
||||
'unit',
|
||||
'tagente_modulo',
|
||||
|
@ -20,7 +20,7 @@
|
||||
/**
|
||||
* Pandora build version and version
|
||||
*/
|
||||
$build_version = 'PC231024';
|
||||
$build_version = 'PC231030';
|
||||
$pandora_version = 'v7.0NG.773.3';
|
||||
|
||||
// Do not overwrite default timezone set if defined.
|
||||
|
@ -442,6 +442,7 @@ define('SERVER_TYPE_CORRELATION', 22);
|
||||
define('SERVER_TYPE_NCM', 23);
|
||||
define('SERVER_TYPE_NETFLOW', 24);
|
||||
define('SERVER_TYPE_LOG', 25);
|
||||
define('SERVER_TYPE_MADE', 26);
|
||||
|
||||
// REPORTS.
|
||||
define('REPORT_TOP_N_MAX', 1);
|
||||
|
@ -5409,7 +5409,7 @@ function html_print_link_with_params($text, $params=[], $type='text', $style='',
|
||||
$formStyle = ' style="'.$formStyle.'"';
|
||||
}
|
||||
|
||||
$html = '<form method="POST"'.$formStyle.'>';
|
||||
$html = '<form method="POST"'.$formStyle.' class="link-with-params">';
|
||||
switch ($type) {
|
||||
case 'image':
|
||||
$html .= html_print_input_image($text, $text, $text, $style, true);
|
||||
|
@ -4762,3 +4762,31 @@ function export_agents_module_csv($filters)
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check if modules are compatible with MADE server.
|
||||
*
|
||||
* @param integer $id_tipo_modulo
|
||||
* @retur boolean True if compatible, false otherwise.
|
||||
*/
|
||||
function modules_made_compatible($id_tipo_modulo)
|
||||
{
|
||||
$compatible_types = [
|
||||
1,
|
||||
4,
|
||||
5,
|
||||
8,
|
||||
15,
|
||||
16,
|
||||
22,
|
||||
30,
|
||||
34,
|
||||
];
|
||||
|
||||
if (array_search($id_tipo_modulo, $compatible_types) === false) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -992,6 +992,19 @@ function servers_get_info($id_server=-1, $sql_limit=-1)
|
||||
$id_modulo = 0;
|
||||
break;
|
||||
|
||||
case SERVER_TYPE_MADE:
|
||||
$server['img'] = html_print_image(
|
||||
'images/Anomaly-detection@svg.svg',
|
||||
true,
|
||||
[
|
||||
'title' => __('MADE server'),
|
||||
'class' => 'main_menu_icon invert_filter',
|
||||
]
|
||||
);
|
||||
$server['type'] = 'made';
|
||||
$id_modulo = 0;
|
||||
break;
|
||||
|
||||
default:
|
||||
$server['img'] = '';
|
||||
$server['type'] = 'unknown';
|
||||
|
File diff suppressed because one or more lines are too long
@ -30,6 +30,8 @@ namespace PandoraFMS\Dashboard;
|
||||
|
||||
global $config;
|
||||
|
||||
require_once $config['homedir'].'/include/functions_inventory.php';
|
||||
|
||||
/**
|
||||
* Inventory Widget.
|
||||
*/
|
||||
@ -608,7 +610,7 @@ class InventoryWidget extends Widget
|
||||
}
|
||||
}
|
||||
|
||||
$id_table = 'id_'.$row['id_module_inventory'].'_'.$nodo['server_uid'];
|
||||
$id_table = 'id_'.$row['id_module_inventory'].'_'.uniqid().'_'.$nodo['server_uid'];
|
||||
$table = ui_print_datatable(
|
||||
[
|
||||
'id' => $id_table,
|
||||
@ -619,7 +621,7 @@ class InventoryWidget extends Widget
|
||||
'no_sortable_columns' => [],
|
||||
'data_element' => $data,
|
||||
'searching' => true,
|
||||
'dom_elements' => 'frtilp',
|
||||
'dom_elements' => 'rtilp',
|
||||
'order' => [
|
||||
'field' => $columns[0],
|
||||
'direction' => 'asc',
|
||||
@ -727,7 +729,7 @@ class InventoryWidget extends Widget
|
||||
}
|
||||
}
|
||||
|
||||
$id_table = 'id_'.$row['id_module_inventory'].'_'.$nodo['server_uid'];
|
||||
$id_table = 'id_'.$row['id_module_inventory'].'_'.uniqid().'_'.$nodo['server_uid'];
|
||||
|
||||
$table = ui_print_datatable(
|
||||
[
|
||||
@ -739,7 +741,7 @@ class InventoryWidget extends Widget
|
||||
'no_sortable_columns' => [],
|
||||
'data_element' => $data,
|
||||
'searching' => true,
|
||||
'dom_elements' => 'frtilp',
|
||||
'dom_elements' => 'rtilp',
|
||||
'order' => [
|
||||
'field' => $columns[0],
|
||||
'direction' => 'asc',
|
||||
@ -893,7 +895,7 @@ class InventoryWidget extends Widget
|
||||
}
|
||||
}
|
||||
|
||||
$id_table = 'id_'.$key_row.'_'.$row['id_module_inventory'].'_'.$row['id_agente'];
|
||||
$id_table = 'id_'.$key_row.'_'.$row['id_module_inventory'].'_'.uniqid().'_'.$row['id_agente'];
|
||||
|
||||
$table = ui_print_datatable(
|
||||
[
|
||||
@ -905,7 +907,7 @@ class InventoryWidget extends Widget
|
||||
'no_sortable_columns' => [],
|
||||
'data_element' => $data,
|
||||
'searching' => true,
|
||||
'dom_elements' => 'frtilp',
|
||||
'dom_elements' => 'rtilp',
|
||||
'order' => [
|
||||
'field' => $columns[0],
|
||||
'direction' => 'asc',
|
||||
@ -985,7 +987,7 @@ class InventoryWidget extends Widget
|
||||
array_push($data, $data_tmp);
|
||||
}
|
||||
|
||||
$id_table = 'id_'.$row['id_module_inventory'];
|
||||
$id_table = 'id_'.$row['id_module_inventory'].'_'.uniqid();
|
||||
}
|
||||
|
||||
if ($count_rows > 1) {
|
||||
@ -999,7 +1001,7 @@ class InventoryWidget extends Widget
|
||||
'no_sortable_columns' => [],
|
||||
'data_element' => $data,
|
||||
'searching' => true,
|
||||
'dom_elements' => 'frtilp',
|
||||
'dom_elements' => 'rtilp',
|
||||
'order' => [
|
||||
'field' => $columns[0],
|
||||
'direction' => 'asc',
|
||||
@ -1035,7 +1037,7 @@ class InventoryWidget extends Widget
|
||||
'no_sortable_columns' => [],
|
||||
'data_element' => $data,
|
||||
'searching' => true,
|
||||
'dom_elements' => 'frtilp',
|
||||
'dom_elements' => 'rtilp',
|
||||
'order' => [
|
||||
'field' => $columns[0],
|
||||
'direction' => 'asc',
|
||||
@ -1098,7 +1100,7 @@ class InventoryWidget extends Widget
|
||||
'columns' => $columns,
|
||||
'column_names' => $columns_names,
|
||||
'ordering' => $ordering,
|
||||
'dom_elements' => 'frtilp',
|
||||
'dom_elements' => 'rtilp',
|
||||
'searching' => $searching,
|
||||
'order' => [
|
||||
'field' => $columns[0],
|
||||
|
@ -300,6 +300,10 @@ class SingleGraphWidget extends Widget
|
||||
$values['period'] = SECONDS_1DAY;
|
||||
}
|
||||
|
||||
if (isset($values['period_projection']) === false) {
|
||||
$values['period_projection'] = SECONDS_1DAY;
|
||||
}
|
||||
|
||||
if (isset($values['showLegend']) === false) {
|
||||
$values['showLegend'] = 1;
|
||||
}
|
||||
@ -439,7 +443,7 @@ class SingleGraphWidget extends Widget
|
||||
$trickHight = 0;
|
||||
if ($this->values['showLegend'] === 1) {
|
||||
// Needed for legend.
|
||||
$trickHight = 40;
|
||||
$trickHight = 60;
|
||||
}
|
||||
|
||||
$output = '<div class="container-center widget-mrgn-0px">';
|
||||
@ -448,10 +452,16 @@ class SingleGraphWidget extends Widget
|
||||
'period' => $this->values['period'],
|
||||
'date' => strtotime(date('Y-m-d H:i:s')),
|
||||
'only_image' => false,
|
||||
'homeurl' => ui_get_full_url(false, false, false, false).'/',
|
||||
'height' => ((int) $size['height'] - $trickHight),
|
||||
'landscape' => $content['landscape'],
|
||||
'return_img_base_64' => true,
|
||||
'show_legend' => $this->values['showLegend'],
|
||||
'width' => '100%',
|
||||
'height' => ((int) $size['height'] - $trickHight),
|
||||
'title' => $module_name,
|
||||
'unit' => $units_name,
|
||||
'homeurl' => $config['homeurl'],
|
||||
'menu' => false,
|
||||
];
|
||||
|
||||
$params_combined = [
|
||||
|
@ -949,3 +949,7 @@ input.resize_button {
|
||||
bottom: 3%;
|
||||
right: 6%;
|
||||
}
|
||||
|
||||
.parent_graph > .graph {
|
||||
margin-left: 10px;
|
||||
}
|
||||
|
@ -1292,6 +1292,11 @@ p.center {
|
||||
margin: 0 5px;
|
||||
}
|
||||
|
||||
.loading-text {
|
||||
font-size: 19px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
/* Legacy spinner */
|
||||
#loading {
|
||||
position: fixed;
|
||||
|
@ -131,7 +131,7 @@
|
||||
<div style='padding-bottom: 50px'>
|
||||
<?php
|
||||
$version = '7.0NG.773.3';
|
||||
$build = '231024';
|
||||
$build = '231030';
|
||||
$banner = "v$version Build $build";
|
||||
error_reporting(0);
|
||||
|
||||
|
@ -37,6 +37,7 @@ require_once $config['homedir'].'/include/functions_agents.php';
|
||||
require_once $config['homedir'].'/include/functions_groups.php';
|
||||
require_once $config['homedir'].'/include/functions_modules.php';
|
||||
require_once $config['homedir'].'/include/functions_users.php';
|
||||
require_once $config['homedir'].'/include/functions_inventory.php';
|
||||
enterprise_include_once('include/functions_metaconsole.php');
|
||||
enterprise_include_once('include/functions_omnishell.php');
|
||||
|
||||
|
@ -87,7 +87,7 @@ if (is_ajax() === true) {
|
||||
$filter_id = (int) get_parameter('filter_id', 0);
|
||||
$filter['id_name'] = get_parameter('new_filter_name', '');
|
||||
$filter['id_group'] = (int) get_parameter('assign_group', 0);
|
||||
$filter['aggregate'] = get_parameter('aggregate', '');
|
||||
$filter['aggregate'] = get_parameter('aggregate', 'dstip');
|
||||
$filter['ip_dst'] = get_parameter('ip_dst', '');
|
||||
$filter['ip_src'] = get_parameter('ip_src', '');
|
||||
$filter['dst_port'] = get_parameter('dst_port', '');
|
||||
@ -169,7 +169,8 @@ if ($custom_date === '1') {
|
||||
$date_from = strtotime($date_init);
|
||||
$date_to = strtotime($date_end);
|
||||
// Read buttons.
|
||||
$draw = get_parameter('draw_button', '');
|
||||
// Change default value for not autoload default filter when load view.
|
||||
$draw = get_parameter('draw_button', 1);
|
||||
$save = get_parameter('save_button', '');
|
||||
$update = get_parameter('update_button', '');
|
||||
|
||||
@ -663,6 +664,7 @@ if (empty($draw) === false) {
|
||||
// Draw the netflow chart.
|
||||
html_print_div(
|
||||
[
|
||||
'id' => 'container_netflow',
|
||||
'class' => $netflowContainerClass,
|
||||
'content' => netflow_draw_item(
|
||||
$date_from,
|
||||
@ -677,6 +679,22 @@ if (empty($draw) === false) {
|
||||
),
|
||||
]
|
||||
);
|
||||
$spinner = html_print_div(
|
||||
[
|
||||
'content' => '<span></span>',
|
||||
'class' => 'spinner-fixed inherit',
|
||||
'style' => 'position: initial;',
|
||||
],
|
||||
true
|
||||
);
|
||||
html_print_div(
|
||||
[
|
||||
'id' => 'spinner',
|
||||
'content' => '<p class="loading-text">'.__('Loading netflow data, please wait...').'</p>'.$spinner,
|
||||
'class' => 'invisible',
|
||||
'style' => 'position: initial;',
|
||||
]
|
||||
);
|
||||
}
|
||||
} else {
|
||||
ui_print_info_message(__('No data to show'));
|
||||
@ -934,6 +952,11 @@ ui_include_time_picker();
|
||||
$('#filter_group_color').css('color', '#000000');
|
||||
}
|
||||
});
|
||||
|
||||
$("#button-draw_button").on('click', function(){
|
||||
$("#container_netflow").remove();
|
||||
$("#spinner").removeClass("invisible");
|
||||
});
|
||||
});
|
||||
|
||||
$("#text-time, #text-time_lower").timepicker({
|
||||
|
@ -135,11 +135,53 @@ if ($advanced_filter !== '') {
|
||||
$filter['advanced_filter'] = $advanced_filter;
|
||||
}
|
||||
|
||||
$filter_name = get_parameter('filter_name');
|
||||
|
||||
$order_by = get_parameter('order_by', 'bytes');
|
||||
if (!in_array($order_by, ['bytes', 'pkts', 'flows'])) {
|
||||
$order_by = 'bytes';
|
||||
}
|
||||
|
||||
|
||||
$save = get_parameter('save_button', '');
|
||||
$update = get_parameter('update_button', '');
|
||||
|
||||
// Save user defined filter.
|
||||
if ($save != '' && check_acl($config['id_user'], 0, 'AW')) {
|
||||
// Save filter args.
|
||||
$data['filter_name'] = $filter_name;
|
||||
$data['top'] = $top;
|
||||
$data['action'] = $action;
|
||||
$data['advanced_filter'] = $advanced_filter;
|
||||
|
||||
|
||||
$filter_id = db_process_sql_insert('tnetwork_explorer_filter', $data);
|
||||
if ($filter_id === false) {
|
||||
$filter_id = 0;
|
||||
ui_print_error_message(__('Error creating filter'));
|
||||
} else {
|
||||
ui_print_success_message(__('Filter created successfully'));
|
||||
}
|
||||
} else if ($update != '' && check_acl($config['id_user'], 0, 'AW')) {
|
||||
// Update current filter.
|
||||
// Do not update the filter name and group.
|
||||
$data['top'] = $top;
|
||||
$data['action'] = $action;
|
||||
$data['advanced_filter'] = $advanced_filter;
|
||||
|
||||
$result = db_process_sql_update(
|
||||
'tnetwork_explorer_filter',
|
||||
$data,
|
||||
['id' => $filter_id]
|
||||
);
|
||||
ui_print_result_message(
|
||||
$result,
|
||||
__('Filter updated successfully'),
|
||||
__('Error updating filter')
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// Build the table.
|
||||
$filterTable = new stdClass();
|
||||
$filterTable->id = '';
|
||||
@ -176,6 +218,59 @@ $filterTable->data[0][1] = html_print_label_input_block(
|
||||
html_print_select_date_range('date', true)
|
||||
);
|
||||
|
||||
$filterTable->data[1][0] = html_print_label_input_block(
|
||||
__('Data to show'),
|
||||
html_print_select(
|
||||
network_get_report_actions(),
|
||||
'action',
|
||||
$action,
|
||||
'',
|
||||
'',
|
||||
0,
|
||||
true
|
||||
)
|
||||
);
|
||||
|
||||
$advanced_toggle = new stdClass();
|
||||
$advanced_toggle->class = 'filter-table-adv';
|
||||
$advanced_toggle->size = [];
|
||||
$advanced_toggle->size[0] = '50%';
|
||||
$advanced_toggle->size[1] = '50%';
|
||||
$advanced_toggle->width = '100%';
|
||||
$user_groups = users_get_groups($config['id_user'], 'AR', $own_info['is_admin'], true);
|
||||
$user_groups[0] = 0;
|
||||
// Add all groups.
|
||||
$sql = 'SELECT * FROM tnetwork_explorer_filter';
|
||||
$advanced_toggle->data[0][0] = html_print_label_input_block(
|
||||
__('Load Filter'),
|
||||
html_print_select_from_sql($sql, 'filter_id', $filter_id, '', __('Select a filter'), 0, true, false, true, false, 'width:100%;')
|
||||
);
|
||||
$advanced_toggle->data[0][1] = html_print_label_input_block(
|
||||
__('Filter name'),
|
||||
html_print_input_text('filter_name', $filter_name, false, 40, 45, true, false, false, '', 'w100p')
|
||||
);
|
||||
$advanced_toggle->colspan[1][0] = 2;
|
||||
$advanced_toggle->data[1][0] = html_print_label_input_block(
|
||||
__('Filter').ui_print_help_icon('pcap_filter', true),
|
||||
html_print_textarea('advanced_filter', 4, 10, $advanced_filter, 'style="width:100%"', true)
|
||||
);
|
||||
$filterTable->colspan[2][0] = 3;
|
||||
$filterTable->data[2][0] = html_print_label_input_block(
|
||||
'',
|
||||
ui_toggle(
|
||||
html_print_table($advanced_toggle, true),
|
||||
__('Advanced'),
|
||||
'',
|
||||
'',
|
||||
true,
|
||||
true,
|
||||
'',
|
||||
'white-box-content',
|
||||
'box-flat white_table_graph'
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
$filterInputTable = '<form method="POST">';
|
||||
$filterInputTable .= html_print_input_hidden('order_by', $order_by);
|
||||
$filterInputTable .= html_print_table($filterTable, true);
|
||||
@ -262,12 +357,16 @@ $data = netflow_get_top_summary(
|
||||
|
||||
// Get the params to return the builder.
|
||||
$hidden_main_link = [
|
||||
'time_greater' => $time_greater,
|
||||
'date_greater' => $date_greater,
|
||||
'time_lower' => $time_lower,
|
||||
'date_lower' => $date_lower,
|
||||
'top' => $top,
|
||||
'action' => $action,
|
||||
'custom_date' => get_parameter('custom_date', '0'),
|
||||
'date' => get_parameter('date', SECONDS_1DAY),
|
||||
'date_init' => get_parameter('date_init'),
|
||||
'time_init' => get_parameter('time_init'),
|
||||
'date_end' => get_parameter('date_end'),
|
||||
'time_end' => get_parameter('time_end'),
|
||||
'date_text' => get_parameter('date_text'),
|
||||
'date_units' => get_parameter('date_units'),
|
||||
'top' => $top,
|
||||
'action' => $action,
|
||||
];
|
||||
|
||||
unset($table);
|
||||
@ -449,6 +548,7 @@ if (empty($data)) {
|
||||
// Print results.
|
||||
html_print_div(
|
||||
[
|
||||
'id' => 'content-netflow',
|
||||
'style' => 'max-width: -webkit-fill-available; display: flex',
|
||||
'class' => '',
|
||||
'content' => $resultsTable.$pieGraph,
|
||||
@ -456,11 +556,25 @@ if (empty($data)) {
|
||||
);
|
||||
}
|
||||
|
||||
$spinner = html_print_div(
|
||||
[
|
||||
'content' => '<span></span>',
|
||||
'class' => 'spinner-fixed inherit',
|
||||
'style' => 'position: initial;',
|
||||
],
|
||||
true
|
||||
);
|
||||
html_print_div(
|
||||
[
|
||||
'id' => 'spinner',
|
||||
'content' => '<p class="loading-text">'.__('Loading netflow data, please wait...').'</p>'.$spinner,
|
||||
'class' => 'invisible',
|
||||
'style' => 'position: initial;',
|
||||
]
|
||||
);
|
||||
?>
|
||||
<script>
|
||||
$(document).ready(function(){
|
||||
nf_view_click_period();
|
||||
|
||||
$('#filter_id').change(function(){
|
||||
jQuery.post (
|
||||
"ajax.php",
|
||||
@ -473,9 +587,42 @@ $(document).ready(function(){
|
||||
$('#action').val(data.action).trigger('change');
|
||||
$('#top').val(data.top).trigger('change');
|
||||
$('#textarea_advanced_filter').val(data.advanced_filter);
|
||||
$('#text-filter_name').val(data.filter_name);
|
||||
$('select#filter_id').select2('close');
|
||||
}, 'json');
|
||||
});
|
||||
|
||||
$('#button-update').on('click', function(){
|
||||
if ($('.info_box_information').length > 0) {
|
||||
$('.info_box_information').remove();
|
||||
}
|
||||
if ($('#content-netflow').length > 0) {
|
||||
$('#content-netflow').remove();
|
||||
}
|
||||
if ($('#spinner').length > 0) {
|
||||
$('#spinner').removeClass("invisible");
|
||||
}
|
||||
if ($('.link-with-params').length > 0) {
|
||||
$('.link-with-params').remove();
|
||||
}
|
||||
});
|
||||
|
||||
$('.link-with-params').on('submit', function(e){
|
||||
setTimeout(() => {
|
||||
if ($('.info_box_information').length > 0) {
|
||||
$('.info_box_information').remove();
|
||||
}
|
||||
if ($('#content-netflow').length > 0) {
|
||||
$('#content-netflow').remove();
|
||||
}
|
||||
if ($('#spinner').length > 0) {
|
||||
$('#spinner').removeClass("invisible");
|
||||
}
|
||||
if ($('.link-with-params').length > 0) {
|
||||
$('.link-with-params').remove();
|
||||
}
|
||||
}, 100); // Prevent fields from being deleted before being sent.
|
||||
})
|
||||
});
|
||||
|
||||
// Configure jQuery timepickers.
|
||||
|
@ -336,7 +336,7 @@ ui_toggle(
|
||||
|
||||
$has_data = false;
|
||||
|
||||
if ((bool) get_parameter('update_netflow') === true) {
|
||||
if ((bool) get_parameter('update_netflow', 1) === true) {
|
||||
$map_data = netflow_build_map_data(
|
||||
$date_from,
|
||||
$date_to,
|
||||
@ -354,6 +354,23 @@ if ($has_data === true) {
|
||||
ui_print_info_message(__('No data to show'));
|
||||
}
|
||||
|
||||
$spinner = html_print_div(
|
||||
[
|
||||
'content' => '<span></span>',
|
||||
'class' => 'spinner-fixed inherit',
|
||||
'style' => 'position: initial;',
|
||||
],
|
||||
true
|
||||
);
|
||||
html_print_div(
|
||||
[
|
||||
'id' => 'spinner',
|
||||
'content' => '<p class="loading-text">'.__('Loading netflow data, please wait...').'</p>'.$spinner,
|
||||
'class' => 'invisible',
|
||||
'style' => 'position: initial;',
|
||||
]
|
||||
);
|
||||
|
||||
?>
|
||||
<style>
|
||||
.networkconsole {
|
||||
@ -363,7 +380,6 @@ if ($has_data === true) {
|
||||
<script>
|
||||
|
||||
$(document).ready(function(){
|
||||
nf_view_click_period();
|
||||
|
||||
$('#filter_id').change(function(){
|
||||
jQuery.post (
|
||||
@ -380,6 +396,12 @@ $(document).ready(function(){
|
||||
$('select#filter_id').select2('close');
|
||||
}, 'json');
|
||||
});
|
||||
|
||||
$('#button-update_netflow').on('click', function(){
|
||||
$('.info_box_information').remove();
|
||||
$('.networkconsole').remove();
|
||||
$('#spinner').removeClass("invisible");
|
||||
});
|
||||
});
|
||||
|
||||
// Configure jQuery timepickers.
|
||||
|
@ -6,7 +6,7 @@
|
||||
%define debug_package %{nil}
|
||||
%define name pandorafms_console
|
||||
%define version 7.0NG.773.3
|
||||
%define release 231024
|
||||
%define release 231030
|
||||
|
||||
# User and Group under which Apache is running
|
||||
%define httpd_name httpd
|
||||
|
@ -6,7 +6,7 @@
|
||||
%define debug_package %{nil}
|
||||
%define name pandorafms_console
|
||||
%define version 7.0NG.773.3
|
||||
%define release 231024
|
||||
%define release 231030
|
||||
|
||||
# User and Group under which Apache is running
|
||||
%define httpd_name httpd
|
||||
|
@ -3,7 +3,7 @@
|
||||
#
|
||||
%define name pandorafms_console
|
||||
%define version 7.0NG.773.3
|
||||
%define release 231024
|
||||
%define release 231030
|
||||
%define httpd_name httpd
|
||||
# User and Group under which Apache is running
|
||||
%define httpd_name apache2
|
||||
|
@ -276,6 +276,8 @@ CREATE TABLE IF NOT EXISTS `tagente_modulo` (
|
||||
`warning_time` INT UNSIGNED DEFAULT 0,
|
||||
`quiet_by_downtime` TINYINT NOT NULL DEFAULT 0,
|
||||
`disabled_by_downtime` TINYINT NOT NULL DEFAULT 0,
|
||||
`last_compact` TIMESTAMP NOT NULL DEFAULT 0,
|
||||
`made_enabled` TINYINT UNSIGNED DEFAULT 0,
|
||||
PRIMARY KEY (`id_agente_modulo`),
|
||||
KEY `main_idx` (`id_agente_modulo`,`id_agente`),
|
||||
KEY `tam_agente` (`id_agente`),
|
||||
@ -2541,6 +2543,7 @@ CREATE TABLE IF NOT EXISTS `tpolicy_modules` (
|
||||
`percentage_warning` TINYINT UNSIGNED DEFAULT 0,
|
||||
`percentage_critical` TINYINT UNSIGNED DEFAULT 0,
|
||||
`warning_time` INT UNSIGNED DEFAULT 0,
|
||||
`made_enabled` TINYINT UNSIGNED DEFAULT 0,
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `main_idx` (`id_policy`),
|
||||
UNIQUE (`id_policy`, `name`)
|
||||
@ -4223,6 +4226,7 @@ CREATE TABLE IF NOT EXISTS `tncm_agent_data` (
|
||||
`id` SERIAL,
|
||||
`id_agent` INT UNSIGNED NOT NULL,
|
||||
`script_type` INT UNSIGNED NOT NULL,
|
||||
`id_agent_data` INT NOT NULL DEFAULT 0,
|
||||
`data` LONGBLOB,
|
||||
`status` INT NOT NULL DEFAULT 5,
|
||||
`updated_at` BIGINT NOT NULL DEFAULT 0,
|
||||
@ -4236,10 +4240,12 @@ CREATE TABLE IF NOT EXISTS `tncm_queue` (
|
||||
`id` SERIAL,
|
||||
`id_agent` INT UNSIGNED NOT NULL,
|
||||
`id_script` BIGINT UNSIGNED NOT NULL,
|
||||
`id_agent_data` bigint unsigned,
|
||||
`utimestamp` INT UNSIGNED NOT NULL,
|
||||
`scheduled` INT UNSIGNED DEFAULT NULL,
|
||||
FOREIGN KEY (`id_agent`) REFERENCES `tagente`(`id_agente`) ON UPDATE CASCADE ON DELETE CASCADE,
|
||||
FOREIGN KEY (`id_script`) REFERENCES `tncm_script`(`id`) ON UPDATE CASCADE ON DELETE CASCADE
|
||||
FOREIGN KEY (`id_script`) REFERENCES `tncm_script`(`id`) ON UPDATE CASCADE ON DELETE CASCADE,
|
||||
FOREIGN KEY (`id_agent_data`) REFERENCES `tncm_agent_data`(`id`) ON UPDATE CASCADE ON DELETE SET NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4;
|
||||
|
||||
-- ----------------------------------------------------------------------
|
||||
@ -4472,7 +4478,7 @@ CREATE TABLE IF NOT EXISTS `tdiscovery_apps_tasks_macros` (
|
||||
-- Table `tnetwork_explorer_filter`
|
||||
-- ---------------------------------------------------------------------
|
||||
CREATE TABLE IF NOT EXISTS `tnetwork_explorer_filter` (
|
||||
`id` INT NOT NULL,
|
||||
`id` INT NOT NULL auto_increment,
|
||||
`filter_name` VARCHAR(45) NULL,
|
||||
`top` VARCHAR(45) NULL,
|
||||
`action` VARCHAR(45) NULL,
|
||||
|
@ -1228,48 +1228,48 @@ INSERT INTO `tpolicies` VALUES (4,'Basic AIX Local Monitoring','B
|
||||
INSERT INTO `tpolicies` VALUES (5,'Basic HP-UX Local Monitoring','Basic local checks to monitoring HP/UX systems.',2,0,0,0);
|
||||
INSERT INTO `tpolicies` VALUES (6,'Basic Remote Checks','Basic Remote Checks (ping, latency, ports).',9,0,0,0);
|
||||
|
||||
INSERT INTO `tpolicy_modules` VALUES (1,1,'module_begin
module_name Bytes per second (Received)
module_type generic_data_inc
module_exec powershell -c "Get-NetAdapterStatistics |Measure-Object -Sum ReceivedBytes |Select -ExpandProperty Sum"
module_end



',4,'','Bytes per second (Received)','',0,0,1,'',0,'','','','',1,1,1,0,0,NULL,NULL,NULL,0,0.000000000000000,0,0,0,'',1,0.00,0.00,'',0.00,0.00,'',0,NULL,NULL,NULL,0,0,0,'','','',0,0,0,0,0,'* * * * *',NULL,'{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
|
||||
INSERT INTO `tpolicy_modules` VALUES (2,1,'module_begin
module_name Bytes per second (Sent)
module_type generic_data_inc
module_exec powershell -c "Get-NetAdapterStatistics |Measure-Object -Sum SentBytes |Select -ExpandProperty Sum"
module_end




',4,'','Bytes per second (Sent)','',0,0,1,'',0,'','','','',1,1,1,0,0,NULL,NULL,NULL,0,0.000000000000000,0,0,0,'',1,0.00,0.00,'',0.00,0.00,'',0,NULL,NULL,NULL,0,0,0,'','','',0,0,0,0,0,'* * * * *',NULL,'{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
|
||||
INSERT INTO `tpolicy_modules` VALUES (3,1,'module_begin
module_name CPU %
module_type generic_data
module_cpuusage all
module_unit %
module_min_warning 79.00
module_max_warning 90.00;module_min_critical 91.00
module_max_critical 00.00;
module_end





',1,'CPU usage (%)','CPU %','%',0,0,1,'',0,'','','','',4,1,1,0,0,NULL,NULL,NULL,0,0.000000000000000,0,0,0,'',1,79.00,90.00,'',91.00,0.00,'',0,NULL,NULL,NULL,0,0,0,'','','',0,0,0,0,0,'* * * * *',NULL,'{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
|
||||
INSERT INTO `tpolicy_modules` VALUES (4,1,'module_begin
module_name Total processes
module_type generic_data
module_exec tasklist | wc -l | gawk "{print $1}"
module_end


',1,'','Total processes','',0,0,1,'',0,'','','','',4,1,1,0,0,NULL,NULL,NULL,0,0.000000000000000,0,0,0,'',1,0.00,0.00,'',0.00,0.00,'',0,NULL,NULL,NULL,0,0,0,'','','',0,0,0,0,0,'* * * * *',NULL,'{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
|
||||
INSERT INTO `tpolicy_modules` VALUES (5,1,'module_begin
module_name Uptime
module_type generic_data
module_exec powershell -c "((get-date) - (gcim Win32_OperatingSystem).LastBootUpTime | Select -ExpandProperty Ticks) / 100000"
module_end




',1,'','Uptime','_timeticks_',0,0,1,'',0,'','','','',4,1,1,0,0,NULL,NULL,NULL,0,0.000000000000000,0,0,0,'',1,0.00,0.00,'',0.00,0.00,'',0,NULL,NULL,NULL,0,0,0,'','','',0,0,0,0,0,'* * * * *',NULL,'{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
|
||||
INSERT INTO `tpolicy_modules` VALUES (6,1,'module_begin
module_name WMI Service
module_type generic_proc
module_service winmgmt
module_end

',2,'WMI Service enabled','WMI Service','',0,0,1,'',0,'','','','',3,1,1,0,0,NULL,NULL,NULL,0,0.000000000000000,0,0,0,'',1,0.00,0.00,'',0.00,0.00,'',0,NULL,NULL,NULL,0,0,0,'','','',0,0,0,0,0,'* * * * *',NULL,'{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
|
||||
INSERT INTO `tpolicy_modules` VALUES (7,2,'module_begin
module_name Bytes per second (Received)
module_type generic_data_inc
module_exec awk '!/lo:/ {s+=$2}END{print s}' /proc/net/dev
module_min_warning 0
module_max_warning 0
module_min_critical 0
module_max_critical 0
module_end

',4,'','Bytes per second (Received)','bytes/sec',0,0,1,'',0,'','','','',1,1,1,0,0,NULL,NULL,NULL,0,0.000000000000000,0,0,0,'',1,0.00,0.00,'',0.00,0.00,'',0,NULL,NULL,NULL,0,0,0,'','','',0,0,0,0,0,'* * * * *',NULL,'{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
|
||||
INSERT INTO `tpolicy_modules` VALUES (8,2,'module_begin
module_name Bytes per second (Sent)
module_type generic_data_inc
module_exec awk '!/lo:/ {s+=$10}END{print s}' /proc/net/dev
module_min_warning 0
module_max_warning 0
module_min_critical 0
module_max_critical 0
module_end
',4,'','Bytes per second (Sent)','bytes/sec',0,0,1,'',0,'','','','',1,1,1,0,0,NULL,NULL,NULL,0,0.000000000000000,0,0,0,'',1,0.00,0.00,'',0.00,0.00,'',0,NULL,NULL,NULL,0,0,0,'','','',0,0,0,0,0,'* * * * *',NULL,'{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
|
||||
INSERT INTO `tpolicy_modules` VALUES (9,2,'module_begin
module_name CPU %
module_type generic_data
module_exec vmstat 1 1 | tail -1 | awk '{ print $13 + $14 }'
module_unit %
module_end

',1,'Current use of CPU (System + User).','CPU %','%',0,0,1,'',0,'','','','',4,1,1,0,0,NULL,NULL,NULL,0,0.000000000000000,0,0,0,'',1,0.00,0.00,'',0.00,0.00,'',0,NULL,NULL,NULL,0,0,0,'','','',0,0,0,0,0,'* * * * *',NULL,'{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
|
||||
INSERT INTO `tpolicy_modules` VALUES (10,2,'module_begin
module_name I/O Lock
module_type generic_data
module_exec vmstat 1 1 | tail -1 | awk '{print $16}'
module_description I/O Wait Disk
module_end


',1,'','I/O Lock','',0,0,1,'',0,'','','','',4,1,1,0,0,NULL,NULL,NULL,0,0.000000000000000,0,0,0,'',1,0.00,0.00,'',0.00,0.00,'',0,NULL,NULL,NULL,0,0,0,'','','',0,0,0,0,0,'* * * * *',NULL,'{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
|
||||
INSERT INTO `tpolicy_modules` VALUES (11,2,'module_begin 
module_name Load Average
module_type generic_data
module_exec cat /proc/loadavg |awk '{print $2}'
module_end

',1,'Average process in CPU (Last 5 minutes).','Load Average','',0,0,1,'',0,'','','','',4,1,1,0,0,NULL,NULL,NULL,0,0.000000000000000,0,0,0,'',1,0.00,0.00,'',0.00,0.00,'',0,NULL,NULL,NULL,0,0,0,'','','',0,0,0,0,0,'* * * * *',NULL,'{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
|
||||
INSERT INTO `tpolicy_modules` VALUES (12,2,'module_begin
module_name Port 22 Open (SSH)
module_type generic_proc
module_exec echo > /dev/tcp/127.0.0.1/22 >/dev/null 2>&1 && echo 1 || echo 0
module_end





',2,'Checks if port 22 (SSH) is listening.','Port 22 Open (SSH)','',0,0,1,'',0,'','','','',3,1,1,0,0,NULL,NULL,NULL,0,0.000000000000000,0,0,0,'',1,0.00,0.00,'',0.00,0.00,'',0,NULL,NULL,NULL,0,0,0,'','','',0,0,0,0,0,'* * * * *',NULL,'{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
|
||||
INSERT INTO `tpolicy_modules` VALUES (13,2,'module_begin
module_name Total processes
module_type generic_data
module_exec ps ax | tail -n +2 | wc -l
module_description Total processes
module_end',1,'','Total processes','',0,0,1,'',0,'','','','',4,1,1,0,0,NULL,NULL,NULL,0,0.000000000000000,0,0,0,'',1,0.00,0.00,'',0.00,0.00,'',0,NULL,NULL,NULL,0,0,0,'','','',0,0,0,0,0,'* * * * *',NULL,'{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
|
||||
INSERT INTO `tpolicy_modules` VALUES (14,2,'module_begin
module_name Uptime
module_type generic_data
module_exec awk '{print $1*100}' /proc/uptime
module_end
',1,'Host Up time (Timeticks)','Uptime','_timeticks_',0,0,1,'',0,'','','','',1,1,1,0,0,NULL,NULL,NULL,0,0.000000000000000,0,0,0,'',1,0.00,0.00,'',0.00,0.00,'',0,NULL,NULL,NULL,0,0,0,'','','',0,0,0,0,0,'* * * * *',NULL,'{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
|
||||
INSERT INTO `tpolicy_modules` VALUES (15,3,'module_begin
module_name CPU %
module_type generic_data
module_exec vmstat 1 1 | tail -1| awk '{print (100-$NF)}'
module_unit %
module_end
',1,'CPU usage %','CPU %','%',0,0,1,'',0,'','','','',4,1,1,0,0,NULL,NULL,NULL,0,0.000000000000000,0,0,0,'',1,0.00,0.00,'',0.00,0.00,'',0,NULL,NULL,NULL,0,0,0,'','','',0,0,0,0,0,'* * * * *',NULL,'{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
|
||||
INSERT INTO `tpolicy_modules` VALUES (16,3,'module_begin
module_name Disk / usage (%)
module_type generic_data
module_exec df -k / | tail -1 | tr -d "%" | awk '{print $5}'
module_end



',1,'Disk use percentage for root partition (/)','Disk / usage (%)','',0,0,1,'',0,'','','','',1,1,1,0,0,'','','',0,0.000000000000000,0,0,0,'',1,0.00,0.00,'',0.00,0.00,'',0,NULL,NULL,NULL,0,0,0,'','','',0,0,0,0,0,'* * * * *','','{\"going_unknown\":0}','W10=',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
|
||||
INSERT INTO `tpolicy_modules` VALUES (17,3,'module_begin
module_name Disk /var usage (%)
module_type generic_data
module_exec df -k /var | tail -1 | tr -d "%" | awk '{print $5}'
module_end



',1,'Disk use percentage for var partition (/var)','Disk /var usage (%)','',0,0,1,'',0,'','','','',1,1,1,0,0,'','','',0,0.000000000000000,0,0,0,'',1,0.00,0.00,'',0.00,0.00,'',0,NULL,NULL,NULL,0,0,0,'','','',0,0,0,0,0,'* * * * *','','{\"going_unknown\":0}','W10=',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
|
||||
INSERT INTO `tpolicy_modules` VALUES (18,3,'module_begin
module_name Load Average
module_type generic_data
module_exec uptime | awk '{print $(NF-2)}' | tr -d ','
module_end
',1,'Load average','Load Average','',0,0,1,'',0,'','','','',4,1,1,0,0,NULL,NULL,NULL,0,0.000000000000000,0,0,0,'',1,0.00,0.00,'',0.00,0.00,'',0,NULL,NULL,NULL,0,0,0,'','','',0,0,0,0,0,'* * * * *',NULL,'{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
|
||||
INSERT INTO `tpolicy_modules` VALUES (19,3,'module_begin
module_name Memory Free %
module_type generic_data
module_freepercentmemory
module_end




',1,'Percentage Mem Free','Memory Free %','',0,0,1,'',0,'','','','',4,1,1,0,0,NULL,NULL,NULL,0,0.000000000000000,0,0,0,'',1,8.00,15.00,'',0.00,7.00,'',0,NULL,NULL,NULL,0,0,0,'','','',0,0,0,0,0,'* * * * *',NULL,'{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
|
||||
INSERT INTO `tpolicy_modules` VALUES (20,3,'module_begin
module_name Port 22 Open (SSH)
module_type generic_proc
module_exec timeout 1 bash -c "echo > /dev/tcp/127.0.0.1/22" >/dev/null 2>&1 && echo 1 || echo 0
module_end



',2,'Checks if port 22 (SSH) is listening.','Port 22 Open (SSH)','',0,0,1,'',0,'','','','',3,1,1,0,0,NULL,NULL,NULL,0,0.000000000000000,0,0,0,'',1,0.00,0.00,'',0.00,0.00,'',0,NULL,NULL,NULL,0,0,0,'','','',0,0,0,0,0,'* * * * *',NULL,'{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
|
||||
INSERT INTO `tpolicy_modules` VALUES (21,3,'module_begin
module_name Swap Used %
module_type generic_data
module_exec swap -l |tail -1 | awk '{print 100 - ($NF / $(NF-1) * 100)}'
module_unit %
module_end


',1,'Swap memory available in %','Swap Used %','%',0,0,1,'',0,'','','','',4,1,1,0,0,NULL,NULL,NULL,0,0.000000000000000,0,0,0,'',1,0.00,0.00,'',0.00,0.00,'',0,NULL,NULL,NULL,0,0,0,'','','',0,0,0,0,0,'* * * * *',NULL,'{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
|
||||
INSERT INTO `tpolicy_modules` VALUES (22,3,'module_begin
module_name Total processes
module_type generic_data
module_exec ps -A | wc -l | awk '{print $1}'
module_end',1,'Total processes','Total processes','',0,0,1,'',0,'','','','',4,1,1,0,0,NULL,NULL,NULL,0,0.000000000000000,0,0,0,'',1,0.00,0.00,'',0.00,0.00,'',0,NULL,NULL,NULL,0,0,0,'','','',0,0,0,0,0,'* * * * *',NULL,'{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
|
||||
INSERT INTO `tpolicy_modules` VALUES (23,3,'module_beg
module_name Uptime
module_type generic_data
module_exec perl -e "print 100*(time - $(kstat -p unix:0:system_misc:boot_time |awk '{print $2}'))"
module_end






',1,'Host Up time (Timeticks)','Uptime','_timeticks_',0,0,1,'',0,'','','','',4,1,1,0,0,NULL,NULL,NULL,0,0.000000000000000,0,0,0,'',1,0.00,0.00,'',0.00,0.00,'',0,NULL,NULL,NULL,0,0,0,'','','',0,0,0,0,0,'* * * * *',NULL,'{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
|
||||
INSERT INTO `tpolicy_modules` VALUES (24,4,'module_begin
module_name CPU %
module_type generic_data
module_exec sar 1 | tail -1 | awk '{print 100 - $5}'
module_description CPU usage in %
module_unit %
module_end',1,'','CPU %','%',0,0,1,'',0,'','','','',4,1,1,0,0,NULL,NULL,NULL,0,0.000000000000000,0,0,0,'',1,0.00,0.00,'',0.00,0.00,'',0,NULL,NULL,NULL,0,0,0,'','','',0,0,0,0,0,'* * * * *',NULL,'{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
|
||||
INSERT INTO `tpolicy_modules` VALUES (25,4,'module_begin
module_name CPU User
module_type generic_data
module_exec sar 1 | tail -1 | awk '{print $2}'
module_description CPU usage in %
module_unit %
module_end',1,'','CPU User','%',0,0,1,'',0,'','','','',4,1,1,0,0,NULL,NULL,NULL,0,0.000000000000000,0,0,0,'',1,0.00,0.00,'',0.00,0.00,'',0,NULL,NULL,NULL,0,0,0,'','','',0,0,0,0,0,'* * * * *',NULL,'{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
|
||||
INSERT INTO `tpolicy_modules` VALUES (26,4,'module_begin 
module_name Load Average
module_type generic_data
module_exec uptime | awk '{print $(NF-2)*1}' 
module_description Average process in CPU (Last minute) 
module_end',1,'','Load Average','',0,0,1,'',0,'','','','',4,1,1,0,0,NULL,NULL,NULL,0,0.000000000000000,0,0,0,'',1,0.00,0.00,'',0.00,0.00,'',0,NULL,NULL,NULL,0,0,0,'','','',0,0,0,0,0,'* * * * *',NULL,'{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
|
||||
INSERT INTO `tpolicy_modules` VALUES (27,4,'module_begin
module_name Memory Free %
module_type generic_data
module_exec svmon -G|grep memory | awk '{print (1- $3/$2 )*100}'
module_description Percentage Mem Free
module_end
',1,'','Memory Free %','',0,0,1,'',0,'','','','',4,1,1,0,0,NULL,NULL,NULL,0,0.000000000000000,0,0,0,'',1,0.00,0.00,'',0.00,0.00,'',0,NULL,NULL,NULL,0,0,0,'','','',0,0,0,0,0,'* * * * *',NULL,'{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
|
||||
INSERT INTO `tpolicy_modules` VALUES (28,4,'module_begin
module_name Pagination use
module_type generic_data
module_exec  lsps -s | tail -1 | awk '{print $2+0}'
module_end',1,'','Pagination use','',0,0,1,'',0,'','','','',1,1,1,0,0,NULL,NULL,NULL,0,0.000000000000000,0,0,0,'',1,0.00,0.00,'',0.00,0.00,'',0,NULL,NULL,NULL,0,0,0,'','','',0,0,0,0,0,'* * * * *',NULL,'{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
|
||||
INSERT INTO `tpolicy_modules` VALUES (29,4,'module_begin
module_name Service sshd status
module_type generic_proc
module_exec lssrc -a | grep ssh | grep active
module_end',2,'','Service sshd status','',0,0,1,'',0,'','','','',3,1,1,0,0,NULL,NULL,NULL,0,0.000000000000000,0,0,0,'',1,0.00,0.00,'',0.00,0.00,'',0,NULL,NULL,NULL,0,0,0,'','','',0,0,0,0,0,'* * * * *',NULL,'{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
|
||||
INSERT INTO `tpolicy_modules` VALUES (30,4,'module_begin
module_name Uptime
module_type generic_data_string
module_exec uptime |sed "s/us\.*$//g" | sed "s/,\.*$//g"
module_description Host Up time
module_end
',1,'','Uptime','',0,0,1,'',0,'','','','',4,1,1,0,0,NULL,NULL,NULL,0,0.000000000000000,0,0,0,'',1,0.00,0.00,'',0.00,0.00,'',0,NULL,NULL,NULL,0,0,0,'','','',0,0,0,0,0,'* * * * *',NULL,'{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
|
||||
INSERT INTO `tpolicy_modules` VALUES (31,5,'module_begin
module_name CPU %
module_type generic_data
module_cpuusage all
module_unit %
module_end
',1,'','CPU %','',0,0,1,'',0,'','','','',4,1,1,0,0,NULL,NULL,NULL,0,0.000000000000000,0,0,0,'',1,0.00,0.00,'',0.00,0.00,'',0,NULL,NULL,NULL,0,0,0,'','','',0,0,0,0,0,'* * * * *',NULL,'{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
|
||||
INSERT INTO `tpolicy_modules` VALUES (32,5,'module_begin
module_name CPU User
module_type generic_data
module_exec vmstat 1 2 | tail -1 | awk '{ print $(16) }'
module_description % of User CPU
module_unit %
module_end

',1,'','CPU User','%',0,0,1,'',0,'','','','',4,1,1,0,0,NULL,NULL,NULL,0,0.000000000000000,0,0,0,'',1,0.00,0.00,'',0.00,0.00,'',0,NULL,NULL,NULL,0,0,0,'','','',0,0,0,0,0,'* * * * *',NULL,'{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
|
||||
INSERT INTO `tpolicy_modules` VALUES (33,5,'module_begin
module_name Load Average
module_type generic_data
module_exec uptime | awk '{print $(NF-2)}' | tr -d ','
module_description System load average
module_end
',1,'','Load Average','',0,0,1,'',0,'','','','',4,1,1,0,0,NULL,NULL,NULL,0,0.000000000000000,0,0,0,'',1,0.00,0.00,'',0.00,0.00,'',0,NULL,NULL,NULL,0,0,0,'','','',0,0,0,0,0,'* * * * *',NULL,'{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
|
||||
INSERT INTO `tpolicy_modules` VALUES (34,5,'module_begin
module_name Memory Free %
module_type generic_data
module_exec echo "" > /tmp/hpvm_toptest; top -d 1 -f /tmp/hpvm_toptest 2>/dev/null 1>/dev/null; cat /tmp/hpvm_toptest | grep -i Memory | head -1 | awk '{print $8/($2+$5) * 100}'
module_end


',1,'','Memory Free %','',0,0,1,'',0,'','','','',4,1,1,0,0,NULL,NULL,NULL,0,0.000000000000000,0,0,0,'',1,0.00,0.00,'',0.00,0.00,'',0,NULL,NULL,NULL,0,0,0,'','','',0,0,0,0,0,'* * * * *',NULL,'{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
|
||||
INSERT INTO `tpolicy_modules` VALUES (35,5,'module_begin
module_name  Service sshd status
module_type generic_proc
module_exec ps -ef | grep  -v grep | grep "/opt/ssh/sbin/sshd" | wc -l
module_description SSH running
module_end

',2,'','Service sshd status','',0,0,1,'',0,'','','','',3,1,1,0,0,NULL,NULL,NULL,0,0.000000000000000,0,0,0,'',1,0.00,0.00,'',0.00,0.00,'',0,NULL,NULL,NULL,0,0,0,'','','',0,0,0,0,0,'* * * * *',NULL,'{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
|
||||
INSERT INTO `tpolicy_modules` VALUES (36,5,'module_begin
module_name Total processes
module_type generic_data
module_exec echo $(((`ps -e | wc -l`)-1)) | tr -d “\n”
module_description Total processes
module_end

',1,'','Total processes','',0,0,1,'',0,'','','','',4,1,1,0,0,NULL,NULL,NULL,0,0.000000000000000,0,0,0,'',1,0.00,0.00,'',0.00,0.00,'',0,NULL,NULL,NULL,0,0,0,'','','',0,0,0,0,0,'* * * * *',NULL,'{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
|
||||
INSERT INTO `tpolicy_modules` VALUES (37,5,'module_begin
module_name Uptime
module_type generic_data_string
module_exec uptime |sed s/us\.*$//g | sed s/,\.*$//g
module_description Host Up time
module_end
',3,'','Uptime','',0,0,1,'',0,'','','','',4,1,1,0,0,NULL,NULL,NULL,0,0.000000000000000,0,0,0,'',1,0.00,0.00,'',0.00,0.00,'',0,NULL,NULL,NULL,0,0,0,'','','',0,0,0,0,0,'* * * * *',NULL,'{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
|
||||
INSERT INTO `tpolicy_modules` VALUES (38,5,'module_begin
module_name Zombie processes
module_type generic_data
module_exec ps -­elf | awk '$2~/'Z'/{print $2}' | wc -l | tr -d "\n"
module_description Zombie processes
module_end
',1,'','Zombie processes','',0,0,1,'',0,'','','','',4,1,1,0,0,NULL,NULL,NULL,0,0.000000000000000,0,0,0,'',1,0.00,0.00,'',0.00,0.00,'',0,NULL,NULL,NULL,0,0,0,'','','',0,0,0,0,0,'* * * * *',NULL,'{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
|
||||
INSERT INTO `tpolicy_modules` VALUES (39,6,'',6,'','Host Alive','',0,0,300,'',0,'','','','',2,1,2,0,0,NULL,NULL,NULL,0,0.000000000000000,0,0,0,'',1,0.00,0.00,'',0.00,0.00,'',0,NULL,NULL,NULL,0,0,0,'','','',0,0,0,0,0,'* * * * *',NULL,'{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
|
||||
INSERT INTO `tpolicy_modules` VALUES (40,6,'',7,'','Host Latency','',0,0,300,'',0,'','','','',2,1,2,0,0,NULL,NULL,NULL,0,0.000000000000000,0,0,0,'',1,80.00,149.00,'',150.00,0.00,'',0,NULL,NULL,NULL,0,0,0,'','','',0,0,0,0,0,'* * * * *',NULL,'{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
|
||||
INSERT INTO `tpolicy_modules` VALUES (41,6,'',2,'Checks if port 161 is open and reachable for Pandora FMS server.','SNMP Available','',0,0,300,'',0,'','','','',1,1,4,0,0,'','','_field1_;Target IP;;_address_--_field2_;Port;;161',3,0.000000000000000,0,0,0,'',1,0.00,0.00,'',0.00,0.00,'',0,NULL,NULL,NULL,0,0,0,'','','',0,0,0,0,0,'* * * * *','{\"1\":{\"macro\":\"_field1_\",\"desc\":\"Target IP\",\"help\":\"\",\"value\":\"_address_\"},\"2\":{\"macro\":\"_field2_\",\"desc\":\"Port\",\"help\":\"\",\"value\":\"161\"}}','{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
|
||||
INSERT INTO `tpolicy_modules` VALUES (42,6,'',9,'Checks if port 22 is open and reachable for Pandora FMS server.','SSH Reachable','',0,0,300,'',22,'','','','',2,1,2,0,0,NULL,NULL,NULL,0,0.000000000000000,0,0,0,'',1,0.00,0.00,'',0.00,0.00,'',0,NULL,NULL,NULL,0,0,0,'','','',0,0,0,0,0,'* * * * *',NULL,'{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
|
||||
INSERT INTO `tpolicy_modules` VALUES (1,1,'module_begin
module_name Bytes per second (Received)
module_type generic_data_inc
module_exec powershell -c "Get-NetAdapterStatistics |Measure-Object -Sum ReceivedBytes |Select -ExpandProperty Sum"
module_end



',4,'','Bytes per second (Received)','',0,0,1,'',0,'','','','',1,1,1,0,0,NULL,NULL,NULL,0,0.000000000000000,0,0,0,'',1,0.00,0.00,'',0.00,0.00,'',0,NULL,NULL,NULL,0,0,0,'','','',0,0,0,0,0,'* * * * *',NULL,'{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
|
||||
INSERT INTO `tpolicy_modules` VALUES (2,1,'module_begin
module_name Bytes per second (Sent)
module_type generic_data_inc
module_exec powershell -c "Get-NetAdapterStatistics |Measure-Object -Sum SentBytes |Select -ExpandProperty Sum"
module_end




',4,'','Bytes per second (Sent)','',0,0,1,'',0,'','','','',1,1,1,0,0,NULL,NULL,NULL,0,0.000000000000000,0,0,0,'',1,0.00,0.00,'',0.00,0.00,'',0,NULL,NULL,NULL,0,0,0,'','','',0,0,0,0,0,'* * * * *',NULL,'{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
|
||||
INSERT INTO `tpolicy_modules` VALUES (3,1,'module_begin
module_name CPU %
module_type generic_data
module_cpuusage all
module_unit %
module_min_warning 79.00
module_max_warning 90.00;module_min_critical 91.00
module_max_critical 00.00;
module_end





',1,'CPU usage (%)','CPU %','%',0,0,1,'',0,'','','','',4,1,1,0,0,NULL,NULL,NULL,0,0.000000000000000,0,0,0,'',1,79.00,90.00,'',91.00,0.00,'',0,NULL,NULL,NULL,0,0,0,'','','',0,0,0,0,0,'* * * * *',NULL,'{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
|
||||
INSERT INTO `tpolicy_modules` VALUES (4,1,'module_begin
module_name Total processes
module_type generic_data
module_exec tasklist | wc -l | gawk "{print $1}"
module_end


',1,'','Total processes','',0,0,1,'',0,'','','','',4,1,1,0,0,NULL,NULL,NULL,0,0.000000000000000,0,0,0,'',1,0.00,0.00,'',0.00,0.00,'',0,NULL,NULL,NULL,0,0,0,'','','',0,0,0,0,0,'* * * * *',NULL,'{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
|
||||
INSERT INTO `tpolicy_modules` VALUES (5,1,'module_begin
module_name Uptime
module_type generic_data
module_exec powershell -c "((get-date) - (gcim Win32_OperatingSystem).LastBootUpTime | Select -ExpandProperty Ticks) / 100000"
module_end




',1,'','Uptime','_timeticks_',0,0,1,'',0,'','','','',4,1,1,0,0,NULL,NULL,NULL,0,0.000000000000000,0,0,0,'',1,0.00,0.00,'',0.00,0.00,'',0,NULL,NULL,NULL,0,0,0,'','','',0,0,0,0,0,'* * * * *',NULL,'{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
|
||||
INSERT INTO `tpolicy_modules` VALUES (6,1,'module_begin
module_name WMI Service
module_type generic_proc
module_service winmgmt
module_end

',2,'WMI Service enabled','WMI Service','',0,0,1,'',0,'','','','',3,1,1,0,0,NULL,NULL,NULL,0,0.000000000000000,0,0,0,'',1,0.00,0.00,'',0.00,0.00,'',0,NULL,NULL,NULL,0,0,0,'','','',0,0,0,0,0,'* * * * *',NULL,'{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
|
||||
INSERT INTO `tpolicy_modules` VALUES (7,2,'module_begin
module_name Bytes per second (Received)
module_type generic_data_inc
module_exec awk '!/lo:/ {s+=$2}END{print s}' /proc/net/dev
module_min_warning 0
module_max_warning 0
module_min_critical 0
module_max_critical 0
module_end

',4,'','Bytes per second (Received)','bytes/sec',0,0,1,'',0,'','','','',1,1,1,0,0,NULL,NULL,NULL,0,0.000000000000000,0,0,0,'',1,0.00,0.00,'',0.00,0.00,'',0,NULL,NULL,NULL,0,0,0,'','','',0,0,0,0,0,'* * * * *',NULL,'{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
|
||||
INSERT INTO `tpolicy_modules` VALUES (8,2,'module_begin
module_name Bytes per second (Sent)
module_type generic_data_inc
module_exec awk '!/lo:/ {s+=$10}END{print s}' /proc/net/dev
module_min_warning 0
module_max_warning 0
module_min_critical 0
module_max_critical 0
module_end
',4,'','Bytes per second (Sent)','bytes/sec',0,0,1,'',0,'','','','',1,1,1,0,0,NULL,NULL,NULL,0,0.000000000000000,0,0,0,'',1,0.00,0.00,'',0.00,0.00,'',0,NULL,NULL,NULL,0,0,0,'','','',0,0,0,0,0,'* * * * *',NULL,'{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
|
||||
INSERT INTO `tpolicy_modules` VALUES (9,2,'module_begin
module_name CPU %
module_type generic_data
module_exec vmstat 1 1 | tail -1 | awk '{ print $13 + $14 }'
module_unit %
module_end

',1,'Current use of CPU (System + User).','CPU %','%',0,0,1,'',0,'','','','',4,1,1,0,0,NULL,NULL,NULL,0,0.000000000000000,0,0,0,'',1,0.00,0.00,'',0.00,0.00,'',0,NULL,NULL,NULL,0,0,0,'','','',0,0,0,0,0,'* * * * *',NULL,'{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
|
||||
INSERT INTO `tpolicy_modules` VALUES (10,2,'module_begin
module_name I/O Lock
module_type generic_data
module_exec vmstat 1 1 | tail -1 | awk '{print $16}'
module_description I/O Wait Disk
module_end


',1,'','I/O Lock','',0,0,1,'',0,'','','','',4,1,1,0,0,NULL,NULL,NULL,0,0.000000000000000,0,0,0,'',1,0.00,0.00,'',0.00,0.00,'',0,NULL,NULL,NULL,0,0,0,'','','',0,0,0,0,0,'* * * * *',NULL,'{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
|
||||
INSERT INTO `tpolicy_modules` VALUES (11,2,'module_begin 
module_name Load Average
module_type generic_data
module_exec cat /proc/loadavg |awk '{print $2}'
module_end

',1,'Average process in CPU (Last 5 minutes).','Load Average','',0,0,1,'',0,'','','','',4,1,1,0,0,NULL,NULL,NULL,0,0.000000000000000,0,0,0,'',1,0.00,0.00,'',0.00,0.00,'',0,NULL,NULL,NULL,0,0,0,'','','',0,0,0,0,0,'* * * * *',NULL,'{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
|
||||
INSERT INTO `tpolicy_modules` VALUES (12,2,'module_begin
module_name Port 22 Open (SSH)
module_type generic_proc
module_exec echo > /dev/tcp/127.0.0.1/22 >/dev/null 2>&1 && echo 1 || echo 0
module_end





',2,'Checks if port 22 (SSH) is listening.','Port 22 Open (SSH)','',0,0,1,'',0,'','','','',3,1,1,0,0,NULL,NULL,NULL,0,0.000000000000000,0,0,0,'',1,0.00,0.00,'',0.00,0.00,'',0,NULL,NULL,NULL,0,0,0,'','','',0,0,0,0,0,'* * * * *',NULL,'{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
|
||||
INSERT INTO `tpolicy_modules` VALUES (13,2,'module_begin
module_name Total processes
module_type generic_data
module_exec ps ax | tail -n +2 | wc -l
module_description Total processes
module_end',1,'','Total processes','',0,0,1,'',0,'','','','',4,1,1,0,0,NULL,NULL,NULL,0,0.000000000000000,0,0,0,'',1,0.00,0.00,'',0.00,0.00,'',0,NULL,NULL,NULL,0,0,0,'','','',0,0,0,0,0,'* * * * *',NULL,'{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
|
||||
INSERT INTO `tpolicy_modules` VALUES (14,2,'module_begin
module_name Uptime
module_type generic_data
module_exec awk '{print $1*100}' /proc/uptime
module_end
',1,'Host Up time (Timeticks)','Uptime','_timeticks_',0,0,1,'',0,'','','','',1,1,1,0,0,NULL,NULL,NULL,0,0.000000000000000,0,0,0,'',1,0.00,0.00,'',0.00,0.00,'',0,NULL,NULL,NULL,0,0,0,'','','',0,0,0,0,0,'* * * * *',NULL,'{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
|
||||
INSERT INTO `tpolicy_modules` VALUES (15,3,'module_begin
module_name CPU %
module_type generic_data
module_exec vmstat 1 1 | tail -1| awk '{print (100-$NF)}'
module_unit %
module_end
',1,'CPU usage %','CPU %','%',0,0,1,'',0,'','','','',4,1,1,0,0,NULL,NULL,NULL,0,0.000000000000000,0,0,0,'',1,0.00,0.00,'',0.00,0.00,'',0,NULL,NULL,NULL,0,0,0,'','','',0,0,0,0,0,'* * * * *',NULL,'{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
|
||||
INSERT INTO `tpolicy_modules` VALUES (16,3,'module_begin
module_name Disk / usage (%)
module_type generic_data
module_exec df -k / | tail -1 | tr -d "%" | awk '{print $5}'
module_end



',1,'Disk use percentage for root partition (/)','Disk / usage (%)','',0,0,1,'',0,'','','','',1,1,1,0,0,'','','',0,0.000000000000000,0,0,0,'',1,0.00,0.00,'',0.00,0.00,'',0,NULL,NULL,NULL,0,0,0,'','','',0,0,0,0,0,'* * * * *','','{\"going_unknown\":0}','W10=',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
|
||||
INSERT INTO `tpolicy_modules` VALUES (17,3,'module_begin
module_name Disk /var usage (%)
module_type generic_data
module_exec df -k /var | tail -1 | tr -d "%" | awk '{print $5}'
module_end



',1,'Disk use percentage for var partition (/var)','Disk /var usage (%)','',0,0,1,'',0,'','','','',1,1,1,0,0,'','','',0,0.000000000000000,0,0,0,'',1,0.00,0.00,'',0.00,0.00,'',0,NULL,NULL,NULL,0,0,0,'','','',0,0,0,0,0,'* * * * *','','{\"going_unknown\":0}','W10=',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
|
||||
INSERT INTO `tpolicy_modules` VALUES (18,3,'module_begin
module_name Load Average
module_type generic_data
module_exec uptime | awk '{print $(NF-2)}' | tr -d ','
module_end
',1,'Load average','Load Average','',0,0,1,'',0,'','','','',4,1,1,0,0,NULL,NULL,NULL,0,0.000000000000000,0,0,0,'',1,0.00,0.00,'',0.00,0.00,'',0,NULL,NULL,NULL,0,0,0,'','','',0,0,0,0,0,'* * * * *',NULL,'{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
|
||||
INSERT INTO `tpolicy_modules` VALUES (19,3,'module_begin
module_name Memory Free %
module_type generic_data
module_freepercentmemory
module_end




',1,'Percentage Mem Free','Memory Free %','',0,0,1,'',0,'','','','',4,1,1,0,0,NULL,NULL,NULL,0,0.000000000000000,0,0,0,'',1,8.00,15.00,'',0.00,7.00,'',0,NULL,NULL,NULL,0,0,0,'','','',0,0,0,0,0,'* * * * *',NULL,'{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
|
||||
INSERT INTO `tpolicy_modules` VALUES (20,3,'module_begin
module_name Port 22 Open (SSH)
module_type generic_proc
module_exec timeout 1 bash -c "echo > /dev/tcp/127.0.0.1/22" >/dev/null 2>&1 && echo 1 || echo 0
module_end



',2,'Checks if port 22 (SSH) is listening.','Port 22 Open (SSH)','',0,0,1,'',0,'','','','',3,1,1,0,0,NULL,NULL,NULL,0,0.000000000000000,0,0,0,'',1,0.00,0.00,'',0.00,0.00,'',0,NULL,NULL,NULL,0,0,0,'','','',0,0,0,0,0,'* * * * *',NULL,'{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
|
||||
INSERT INTO `tpolicy_modules` VALUES (21,3,'module_begin
module_name Swap Used %
module_type generic_data
module_exec swap -l |tail -1 | awk '{print 100 - ($NF / $(NF-1) * 100)}'
module_unit %
module_end


',1,'Swap memory available in %','Swap Used %','%',0,0,1,'',0,'','','','',4,1,1,0,0,NULL,NULL,NULL,0,0.000000000000000,0,0,0,'',1,0.00,0.00,'',0.00,0.00,'',0,NULL,NULL,NULL,0,0,0,'','','',0,0,0,0,0,'* * * * *',NULL,'{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
|
||||
INSERT INTO `tpolicy_modules` VALUES (22,3,'module_begin
module_name Total processes
module_type generic_data
module_exec ps -A | wc -l | awk '{print $1}'
module_end',1,'Total processes','Total processes','',0,0,1,'',0,'','','','',4,1,1,0,0,NULL,NULL,NULL,0,0.000000000000000,0,0,0,'',1,0.00,0.00,'',0.00,0.00,'',0,NULL,NULL,NULL,0,0,0,'','','',0,0,0,0,0,'* * * * *',NULL,'{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
|
||||
INSERT INTO `tpolicy_modules` VALUES (23,3,'module_beg
module_name Uptime
module_type generic_data
module_exec perl -e "print 100*(time - $(kstat -p unix:0:system_misc:boot_time |awk '{print $2}'))"
module_end






',1,'Host Up time (Timeticks)','Uptime','_timeticks_',0,0,1,'',0,'','','','',4,1,1,0,0,NULL,NULL,NULL,0,0.000000000000000,0,0,0,'',1,0.00,0.00,'',0.00,0.00,'',0,NULL,NULL,NULL,0,0,0,'','','',0,0,0,0,0,'* * * * *',NULL,'{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
|
||||
INSERT INTO `tpolicy_modules` VALUES (24,4,'module_begin
module_name CPU %
module_type generic_data
module_exec sar 1 | tail -1 | awk '{print 100 - $5}'
module_description CPU usage in %
module_unit %
module_end',1,'','CPU %','%',0,0,1,'',0,'','','','',4,1,1,0,0,NULL,NULL,NULL,0,0.000000000000000,0,0,0,'',1,0.00,0.00,'',0.00,0.00,'',0,NULL,NULL,NULL,0,0,0,'','','',0,0,0,0,0,'* * * * *',NULL,'{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
|
||||
INSERT INTO `tpolicy_modules` VALUES (25,4,'module_begin
module_name CPU User
module_type generic_data
module_exec sar 1 | tail -1 | awk '{print $2}'
module_description CPU usage in %
module_unit %
module_end',1,'','CPU User','%',0,0,1,'',0,'','','','',4,1,1,0,0,NULL,NULL,NULL,0,0.000000000000000,0,0,0,'',1,0.00,0.00,'',0.00,0.00,'',0,NULL,NULL,NULL,0,0,0,'','','',0,0,0,0,0,'* * * * *',NULL,'{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
|
||||
INSERT INTO `tpolicy_modules` VALUES (26,4,'module_begin 
module_name Load Average
module_type generic_data
module_exec uptime | awk '{print $(NF-2)*1}' 
module_description Average process in CPU (Last minute) 
module_end',1,'','Load Average','',0,0,1,'',0,'','','','',4,1,1,0,0,NULL,NULL,NULL,0,0.000000000000000,0,0,0,'',1,0.00,0.00,'',0.00,0.00,'',0,NULL,NULL,NULL,0,0,0,'','','',0,0,0,0,0,'* * * * *',NULL,'{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
|
||||
INSERT INTO `tpolicy_modules` VALUES (27,4,'module_begin
module_name Memory Free %
module_type generic_data
module_exec svmon -G|grep memory | awk '{print (1- $3/$2 )*100}'
module_description Percentage Mem Free
module_end
',1,'','Memory Free %','',0,0,1,'',0,'','','','',4,1,1,0,0,NULL,NULL,NULL,0,0.000000000000000,0,0,0,'',1,0.00,0.00,'',0.00,0.00,'',0,NULL,NULL,NULL,0,0,0,'','','',0,0,0,0,0,'* * * * *',NULL,'{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
|
||||
INSERT INTO `tpolicy_modules` VALUES (28,4,'module_begin
module_name Pagination use
module_type generic_data
module_exec  lsps -s | tail -1 | awk '{print $2+0}'
module_end',1,'','Pagination use','',0,0,1,'',0,'','','','',1,1,1,0,0,NULL,NULL,NULL,0,0.000000000000000,0,0,0,'',1,0.00,0.00,'',0.00,0.00,'',0,NULL,NULL,NULL,0,0,0,'','','',0,0,0,0,0,'* * * * *',NULL,'{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
|
||||
INSERT INTO `tpolicy_modules` VALUES (29,4,'module_begin
module_name Service sshd status
module_type generic_proc
module_exec lssrc -a | grep ssh | grep active
module_end',2,'','Service sshd status','',0,0,1,'',0,'','','','',3,1,1,0,0,NULL,NULL,NULL,0,0.000000000000000,0,0,0,'',1,0.00,0.00,'',0.00,0.00,'',0,NULL,NULL,NULL,0,0,0,'','','',0,0,0,0,0,'* * * * *',NULL,'{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
|
||||
INSERT INTO `tpolicy_modules` VALUES (30,4,'module_begin
module_name Uptime
module_type generic_data_string
module_exec uptime |sed "s/us\.*$//g" | sed "s/,\.*$//g"
module_description Host Up time
module_end
',1,'','Uptime','',0,0,1,'',0,'','','','',4,1,1,0,0,NULL,NULL,NULL,0,0.000000000000000,0,0,0,'',1,0.00,0.00,'',0.00,0.00,'',0,NULL,NULL,NULL,0,0,0,'','','',0,0,0,0,0,'* * * * *',NULL,'{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
|
||||
INSERT INTO `tpolicy_modules` VALUES (31,5,'module_begin
module_name CPU %
module_type generic_data
module_cpuusage all
module_unit %
module_end
',1,'','CPU %','',0,0,1,'',0,'','','','',4,1,1,0,0,NULL,NULL,NULL,0,0.000000000000000,0,0,0,'',1,0.00,0.00,'',0.00,0.00,'',0,NULL,NULL,NULL,0,0,0,'','','',0,0,0,0,0,'* * * * *',NULL,'{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
|
||||
INSERT INTO `tpolicy_modules` VALUES (32,5,'module_begin
module_name CPU User
module_type generic_data
module_exec vmstat 1 2 | tail -1 | awk '{ print $(16) }'
module_description % of User CPU
module_unit %
module_end

',1,'','CPU User','%',0,0,1,'',0,'','','','',4,1,1,0,0,NULL,NULL,NULL,0,0.000000000000000,0,0,0,'',1,0.00,0.00,'',0.00,0.00,'',0,NULL,NULL,NULL,0,0,0,'','','',0,0,0,0,0,'* * * * *',NULL,'{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
|
||||
INSERT INTO `tpolicy_modules` VALUES (33,5,'module_begin
module_name Load Average
module_type generic_data
module_exec uptime | awk '{print $(NF-2)}' | tr -d ','
module_description System load average
module_end
',1,'','Load Average','',0,0,1,'',0,'','','','',4,1,1,0,0,NULL,NULL,NULL,0,0.000000000000000,0,0,0,'',1,0.00,0.00,'',0.00,0.00,'',0,NULL,NULL,NULL,0,0,0,'','','',0,0,0,0,0,'* * * * *',NULL,'{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
|
||||
INSERT INTO `tpolicy_modules` VALUES (34,5,'module_begin
module_name Memory Free %
module_type generic_data
module_exec echo "" > /tmp/hpvm_toptest; top -d 1 -f /tmp/hpvm_toptest 2>/dev/null 1>/dev/null; cat /tmp/hpvm_toptest | grep -i Memory | head -1 | awk '{print $8/($2+$5) * 100}'
module_end


',1,'','Memory Free %','',0,0,1,'',0,'','','','',4,1,1,0,0,NULL,NULL,NULL,0,0.000000000000000,0,0,0,'',1,0.00,0.00,'',0.00,0.00,'',0,NULL,NULL,NULL,0,0,0,'','','',0,0,0,0,0,'* * * * *',NULL,'{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
|
||||
INSERT INTO `tpolicy_modules` VALUES (35,5,'module_begin
module_name  Service sshd status
module_type generic_proc
module_exec ps -ef | grep  -v grep | grep "/opt/ssh/sbin/sshd" | wc -l
module_description SSH running
module_end

',2,'','Service sshd status','',0,0,1,'',0,'','','','',3,1,1,0,0,NULL,NULL,NULL,0,0.000000000000000,0,0,0,'',1,0.00,0.00,'',0.00,0.00,'',0,NULL,NULL,NULL,0,0,0,'','','',0,0,0,0,0,'* * * * *',NULL,'{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
|
||||
INSERT INTO `tpolicy_modules` VALUES (36,5,'module_begin
module_name Total processes
module_type generic_data
module_exec echo $(((`ps -e | wc -l`)-1)) | tr -d “\n”
module_description Total processes
module_end

',1,'','Total processes','',0,0,1,'',0,'','','','',4,1,1,0,0,NULL,NULL,NULL,0,0.000000000000000,0,0,0,'',1,0.00,0.00,'',0.00,0.00,'',0,NULL,NULL,NULL,0,0,0,'','','',0,0,0,0,0,'* * * * *',NULL,'{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
|
||||
INSERT INTO `tpolicy_modules` VALUES (37,5,'module_begin
module_name Uptime
module_type generic_data_string
module_exec uptime |sed s/us\.*$//g | sed s/,\.*$//g
module_description Host Up time
module_end
',3,'','Uptime','',0,0,1,'',0,'','','','',4,1,1,0,0,NULL,NULL,NULL,0,0.000000000000000,0,0,0,'',1,0.00,0.00,'',0.00,0.00,'',0,NULL,NULL,NULL,0,0,0,'','','',0,0,0,0,0,'* * * * *',NULL,'{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
|
||||
INSERT INTO `tpolicy_modules` VALUES (38,5,'module_begin
module_name Zombie processes
module_type generic_data
module_exec ps -­elf | awk '$2~/'Z'/{print $2}' | wc -l | tr -d "\n"
module_description Zombie processes
module_end
',1,'','Zombie processes','',0,0,1,'',0,'','','','',4,1,1,0,0,NULL,NULL,NULL,0,0.000000000000000,0,0,0,'',1,0.00,0.00,'',0.00,0.00,'',0,NULL,NULL,NULL,0,0,0,'','','',0,0,0,0,0,'* * * * *',NULL,'{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
|
||||
INSERT INTO `tpolicy_modules` VALUES (39,6,'',6,'','Host Alive','',0,0,300,'',0,'','','','',2,1,2,0,0,NULL,NULL,NULL,0,0.000000000000000,0,0,0,'',1,0.00,0.00,'',0.00,0.00,'',0,NULL,NULL,NULL,0,0,0,'','','',0,0,0,0,0,'* * * * *',NULL,'{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
|
||||
INSERT INTO `tpolicy_modules` VALUES (40,6,'',7,'','Host Latency','',0,0,300,'',0,'','','','',2,1,2,0,0,NULL,NULL,NULL,0,0.000000000000000,0,0,0,'',1,80.00,149.00,'',150.00,0.00,'',0,NULL,NULL,NULL,0,0,0,'','','',0,0,0,0,0,'* * * * *',NULL,'{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
|
||||
INSERT INTO `tpolicy_modules` VALUES (41,6,'',2,'Checks if port 161 is open and reachable for Pandora FMS server.','SNMP Available','',0,0,300,'',0,'','','','',1,1,4,0,0,'','','_field1_;Target IP;;_address_--_field2_;Port;;161',3,0.000000000000000,0,0,0,'',1,0.00,0.00,'',0.00,0.00,'',0,NULL,NULL,NULL,0,0,0,'','','',0,0,0,0,0,'* * * * *','{\"1\":{\"macro\":\"_field1_\",\"desc\":\"Target IP\",\"help\":\"\",\"value\":\"_address_\"},\"2\":{\"macro\":\"_field2_\",\"desc\":\"Port\",\"help\":\"\",\"value\":\"161\"}}','{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
|
||||
INSERT INTO `tpolicy_modules` VALUES (42,6,'',9,'Checks if port 22 is open and reachable for Pandora FMS server.','SSH Reachable','',0,0,300,'',22,'','','','',2,1,2,0,0,NULL,NULL,NULL,0,0.000000000000000,0,0,0,'',1,0.00,0.00,'',0.00,0.00,'',0,NULL,NULL,NULL,0,0,0,'','','',0,0,0,0,0,'* * * * *',NULL,'{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
|
||||
|
||||
INSERT INTO `tpolicy_plugins` VALUES (1,1,'cscript.exe //B "%ProgramFiles%\Pandora_Agent\util\df_percent_used.vbs"',0);
|
||||
INSERT INTO `tpolicy_plugins` VALUES (2,1,'cscript.exe //B "%ProgramFiles%\Pandora_Agent\util\mem_percent_used.vbs"',0);
|
||||
|
@ -1,5 +1,5 @@
|
||||
package: pandorafms-server
|
||||
Version: 7.0NG.773.3-231024
|
||||
Version: 7.0NG.773.3-231030
|
||||
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.773.3-231024"
|
||||
pandora_version="7.0NG.773.3-231030"
|
||||
|
||||
package_cpan=0
|
||||
package_pandora=1
|
||||
|
@ -783,3 +783,33 @@ netflowserver_threads 1
|
||||
# Enable (1) or disable (0) the verification of SSL certificates (set to 0 when using self-signed certificates).
|
||||
ssl_verify 0
|
||||
|
||||
# Enable (1) or disable (0) the Monitoring Anomaly Detection Engine (PANDORA FMS ENTERPRISE ONLY).
|
||||
madeserver 0
|
||||
|
||||
# Directory where models will be stored (PANDORA FMS ENTERPRISE ONLY).
|
||||
madeserver_path /var/spool/pandora/data_in/models
|
||||
|
||||
# Number of server threads for MADE (PANDORA FMS ENTERPRISE ONLY).
|
||||
madeserver_threads 2
|
||||
|
||||
# Model backend: 'prophet' or 'iforest' (PANDORA FMS ENTERPRISE ONLY).
|
||||
# 'prophet' is better suited for temporal series and supports forecasting.
|
||||
# 'iforest' is faster and more efficient (cpu, memory...).
|
||||
madeserver_backend prophet
|
||||
|
||||
# MADE will query the Pandora FMS database every madeserver_interval seconds
|
||||
# to look for new data (PANDORA FMS ENTERPRISE ONLY).
|
||||
madeserver_interval 60
|
||||
|
||||
# Minimum number of data required to train a model (e.g., '7d' for seven days) (PANDORA FMS ENTERPRISE ONLY).
|
||||
madeserver_min_train 7d
|
||||
|
||||
# Maximum number of data kept to train models (e.g., '90d' for 90 days) (PANDORA FMS ENTERPRISE ONLY).
|
||||
madeserver_max_history 90d
|
||||
|
||||
# Model automatic retraining period (e.g., '7d' for seven days) (PANDORA FMS ENTERPRISE ONLY).
|
||||
madeserver_autofit 7d
|
||||
|
||||
# Model sensitivity. A lower value triggers less anomalies (PANDORA FMS ENTERPRISE ONLY).
|
||||
madeserver_sensitivity 0.1
|
||||
|
||||
|
@ -46,7 +46,7 @@ our @EXPORT = qw(
|
||||
|
||||
# version: Defines actual version of Pandora Server for this module only
|
||||
my $pandora_version = "7.0NG.773.3";
|
||||
my $pandora_build = "231024";
|
||||
my $pandora_build = "231030";
|
||||
our $VERSION = $pandora_version." ".$pandora_build;
|
||||
|
||||
# Setup hash
|
||||
@ -296,9 +296,9 @@ sub pandora_load_config {
|
||||
$pa_config->{"update_parent"} = 0; # 3.1
|
||||
$pa_config->{"google_maps_description"} = 0;
|
||||
$pa_config->{'openstreetmaps_description'} = 0;
|
||||
$pa_config->{"eventserver"} = 1; # 4.0
|
||||
$pa_config->{"eventserver"} = 0; # 4.0
|
||||
$pa_config->{"eventserver_threads"} = 1; # 4.0
|
||||
$pa_config->{"logserver"} = 1; # 7.774
|
||||
$pa_config->{"logserver"} = 0; # 7.774
|
||||
$pa_config->{"logserver_threads"} = 1; # 7.774
|
||||
$pa_config->{"event_window"} = 3600; # 4.0
|
||||
$pa_config->{"log_window"} = 3600; # 7.741
|
||||
@ -513,7 +513,7 @@ sub pandora_load_config {
|
||||
$pa_config->{"clean_wux_sessions"} = 1; # 7.0.746 (only selenium 3)
|
||||
|
||||
# Syslog Server
|
||||
$pa_config->{"syslogserver"} = 1; # 7.0.716
|
||||
$pa_config->{"syslogserver"} = 0; # 7.0.716
|
||||
$pa_config->{"syslog_file"} = '/var/log/messages/'; # 7.0.716
|
||||
$pa_config->{"syslog_max"} = 65535; # 7.0.716
|
||||
$pa_config->{"syslog_threads"} = 4; # 7.0.716
|
||||
@ -583,6 +583,8 @@ sub pandora_load_config {
|
||||
|
||||
$pa_config->{"ssl_verify"} = 0; # 7.0 774
|
||||
|
||||
$pa_config->{"madeserver"} = 0; # 774.
|
||||
|
||||
# Check for UID0
|
||||
if ($pa_config->{"quiet"} != 0){
|
||||
if ($> == 0){
|
||||
@ -1400,6 +1402,9 @@ sub pandora_load_config {
|
||||
elsif ($parametro =~ m/^ssl_verify\s+([0-1])/i) {
|
||||
$pa_config->{'ssl_verify'} = clean_blank($1);
|
||||
}
|
||||
elsif ($parametro =~ m/^madeserver\s+([0-1])/i){
|
||||
$pa_config->{'madeserver'}= clean_blank($1);
|
||||
}
|
||||
} # end of loop for parameter #
|
||||
|
||||
# The DB host was overridden by pandora_ha.
|
||||
|
@ -325,6 +325,7 @@ our @ServerTypes = qw (
|
||||
ncmserver
|
||||
netflowserver
|
||||
logserver
|
||||
madeserver
|
||||
);
|
||||
our @AlertStatus = ('Execute the alert', 'Do not execute the alert', 'Do not execute the alert, but increment its internal counter', 'Cease the alert', 'Recover the alert', 'Reset internal counter');
|
||||
|
||||
@ -6739,24 +6740,23 @@ sub pandora_installation_monitoring($$) {
|
||||
my $data_size = get_db_value($dbh, 'SELECT SUM(data_length)/(1024*1024) FROM information_schema.TABLES');
|
||||
my $index_size = get_db_value($dbh, 'SELECT SUM(index_length)/(1024*1024) FROM information_schema.TABLES');
|
||||
my $writes = $insert->{'Value'} + $update->{'Value'} + $replace->{'Value'} + $delete->{'Value'} ;
|
||||
|
||||
my $reads = $select->{'Value'};
|
||||
|
||||
# Mysql Questions - Reads
|
||||
$module->{'name'} = "mysql_questions_reads";
|
||||
$module->{'description'} = 'MySQL: Questions - Reads (#): Number of read questions';
|
||||
$module->{'data'} = $select->{'Value'};
|
||||
$module->{'unit'} = 'qu';
|
||||
$module->{'data'} = $reads;
|
||||
$module->{'unit'} = 'qu/s';
|
||||
$module->{'type'} = 'generic_data_inc';
|
||||
push(@modules, $module);
|
||||
undef $module;
|
||||
|
||||
# Mysql Questions - Writes
|
||||
my $question_writes = 0;
|
||||
if(($writes + $select) > 0) {
|
||||
$question_writes = (($writes * 10000) / ($select + $writes)) / 100;
|
||||
}
|
||||
$module->{'name'} = "mysql_questions_writes";
|
||||
$module->{'description'} = 'MySQL: Questions - Writes (#): Number of writed questions';
|
||||
$module->{'data'} = $question_writes;
|
||||
$module->{'unit'} = 'qu';
|
||||
$module->{'data'} = $writes;
|
||||
$module->{'unit'} = 'qu/s';
|
||||
$module->{'type'} = 'generic_data_inc';
|
||||
push(@modules, $module);
|
||||
undef $module;
|
||||
|
||||
@ -6896,7 +6896,7 @@ sub pandora_installation_monitoring($$) {
|
||||
$dbh,
|
||||
'SELECT COUNT(id_evento)
|
||||
FROM tevento
|
||||
WHERE timestamp >=UNIX_TIMESTAMP(NOW() - INTERVAL 1 DAY)'
|
||||
WHERE utimestamp >=UNIX_TIMESTAMP(NOW() - INTERVAL 1 DAY)'
|
||||
);
|
||||
$module->{'name'} = "last_events_24h";
|
||||
$module->{'description'} = 'Last 24h events';
|
||||
|
@ -34,7 +34,7 @@ our @ISA = qw(Exporter);
|
||||
|
||||
# version: Defines actual version of Pandora Server for this module only
|
||||
my $pandora_version = "7.0NG.773.3";
|
||||
my $pandora_build = "231024";
|
||||
my $pandora_build = "231030";
|
||||
our $VERSION = $pandora_version." ".$pandora_build;
|
||||
|
||||
our %EXPORT_TAGS = ( 'all' => [ qw() ] );
|
||||
|
@ -30,6 +30,9 @@ use Scalar::Util qw(looks_like_number);
|
||||
use LWP::UserAgent;
|
||||
use threads;
|
||||
use threads::shared;
|
||||
use MIME::Base64;
|
||||
use Crypt::CBC;
|
||||
use Digest::SHA qw(hmac_sha256_base64);
|
||||
|
||||
use JSON;
|
||||
use Encode qw/decode_utf8 encode_utf8/;
|
||||
@ -79,6 +82,7 @@ our @EXPORT = qw(
|
||||
NCMSERVER
|
||||
NETFLOWSERVER
|
||||
LOGSERVER
|
||||
MADESERVER
|
||||
METACONSOLE_LICENSE
|
||||
OFFLINE_LICENSE
|
||||
DISCOVERY_HOSTDEVICES
|
||||
@ -180,6 +184,7 @@ our @EXPORT = qw(
|
||||
check_cron_value
|
||||
check_cron_element
|
||||
cron_check
|
||||
decrypt_AES
|
||||
);
|
||||
|
||||
# ID of the different servers
|
||||
@ -209,6 +214,7 @@ use constant CORRELATIONSERVER => 22; # Deprecated.
|
||||
use constant NCMSERVER => 23;
|
||||
use constant NETFLOWSERVER => 24;
|
||||
use constant LOGSERVER => 25;
|
||||
use constant MADESERVER => 26;
|
||||
|
||||
# Module status
|
||||
use constant MODULE_NORMAL => 0;
|
||||
@ -2976,10 +2982,68 @@ sub get_server_name {
|
||||
return "NCMSERVER" if ($server_type eq NCMSERVER);
|
||||
return "NETFLOWSERVER" if ($server_type eq NETFLOWSERVER);
|
||||
return "LOGSERVER" if ($server_type eq LOGSERVER);
|
||||
return "MADESERVER" if ($server_type eq MADESERVER);
|
||||
|
||||
return "UNKNOWN";
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
# Encrypt with AES cypher
|
||||
###############################################################################
|
||||
sub encrypt_AES {
|
||||
my ($str_to_encrypt, $password) = @_;
|
||||
|
||||
if (!defined($password)) {
|
||||
$password = "default_salt";
|
||||
}
|
||||
my $cipher = _get_cipher($password);
|
||||
|
||||
my $cipher_text = $cipher->encrypt($str_to_encrypt);
|
||||
my $b64str = encode_base64($cipher_text, '');
|
||||
|
||||
return $b64str;
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
# Decrypt with AES cypher
|
||||
###############################################################################
|
||||
sub decrypt_AES {
|
||||
my ($str_to_decrypt, $password) = @_;
|
||||
|
||||
if (!defined($password)) {
|
||||
$password = "default_salt";
|
||||
}
|
||||
my $cipher = _get_cipher($password);
|
||||
|
||||
my $cipher_text = decode_base64($str_to_decrypt);
|
||||
my $decrypted_str = $cipher->decrypt($cipher_text);
|
||||
|
||||
return $decrypted_str;
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
# Get cipher for AES encrypt and decrypt
|
||||
###############################################################################
|
||||
sub _get_cipher {
|
||||
my ($password) = @_;
|
||||
|
||||
my $hash_base64 = substr(Digest::SHA::hmac_sha256_base64($password,''), 0, 16);
|
||||
|
||||
my $iv = '0000000000000000';
|
||||
|
||||
my $cipher = Crypt::CBC->new(
|
||||
-key => $hash_base64,
|
||||
-cipher => 'Cipher::AES',
|
||||
-iv => $iv,
|
||||
-header => 'none',
|
||||
-padding => 'standard', # PKCS7 padding
|
||||
-keysize => 16,
|
||||
-literal_key => 1
|
||||
);
|
||||
|
||||
return $cipher;
|
||||
}
|
||||
|
||||
1;
|
||||
__END__
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
%define debug_package %{nil}
|
||||
%define name pandorafms_server
|
||||
%define version 7.0NG.773.3
|
||||
%define release 231024
|
||||
%define release 231030
|
||||
|
||||
Summary: Pandora FMS Server
|
||||
Name: %{name}
|
||||
|
@ -4,7 +4,7 @@
|
||||
%global __os_install_post %{nil}
|
||||
%define name pandorafms_server
|
||||
%define version 7.0NG.773.3
|
||||
%define release 231024
|
||||
%define release 231030
|
||||
|
||||
Summary: Pandora FMS Server
|
||||
Name: %{name}
|
||||
|
@ -9,7 +9,7 @@
|
||||
# **********************************************************************
|
||||
|
||||
PI_VERSION="7.0NG.773.3"
|
||||
PI_BUILD="231024"
|
||||
PI_BUILD="231030"
|
||||
|
||||
MODE=$1
|
||||
if [ $# -gt 1 ]; then
|
||||
|
@ -26,6 +26,9 @@ use POSIX qw(strftime);
|
||||
use File::Path qw(rmtree);
|
||||
use Time::HiRes qw(usleep);
|
||||
|
||||
use List::Util qw(min);
|
||||
use List::Util qw(sum);
|
||||
|
||||
# Default lib dir for RPM and DEB packages
|
||||
BEGIN { push @INC, '/usr/lib/perl5'; }
|
||||
|
||||
@ -35,7 +38,7 @@ use PandoraFMS::Config;
|
||||
use PandoraFMS::DB;
|
||||
|
||||
# version: define current version
|
||||
my $version = "7.0NG.773.3 Build 231024";
|
||||
my $version = "7.0NG.773.3 Build 231030";
|
||||
|
||||
# Pandora server configuration
|
||||
my %conf;
|
||||
@ -443,116 +446,187 @@ sub pandora_purgedb ($$$) {
|
||||
###############################################################################
|
||||
# Compact agent data.
|
||||
###############################################################################
|
||||
sub pandora_compactdb ($$$) {
|
||||
my ($conf, $dbh, $dbh_conf) = @_;
|
||||
sub pandora_compactdb {
|
||||
my ($conf, $dbh, $dbh_conf) = @_;
|
||||
|
||||
my $total_modules = get_db_value($dbh, "SELECT COUNT(id_agente_modulo) FROM tagente_modulo");
|
||||
|
||||
# Interval in hours to compact.
|
||||
my $compaction_interval = 24;
|
||||
my $compaction_factor = (3600 * $compaction_interval) / 300;
|
||||
|
||||
# Number of agents to be proceced on this execution
|
||||
my $agents_limit = int($total_modules / $compaction_factor);
|
||||
|
||||
my $last_compact_offset = pandora_get_config_value($dbh, "last_compact_offset");
|
||||
|
||||
unless ($last_compact_offset) {
|
||||
db_do($dbh, "INSERT INTO tconfig (token, value) VALUES ('last_compact_offset', '0')");
|
||||
$last_compact_offset = 0;
|
||||
}
|
||||
|
||||
# Obtain a group of modules to compact.
|
||||
my @module_groups = get_db_rows(
|
||||
$dbh,
|
||||
'SELECT id_agente_modulo, id_tipo_modulo, UNIX_TIMESTAMP(last_compact) as last_compact FROM tagente_modulo WHERE id_agente_modulo > ? LIMIT ?',
|
||||
$last_compact_offset,
|
||||
$agents_limit
|
||||
);
|
||||
|
||||
# Compact the group of modules.
|
||||
my $starting_time = time();
|
||||
pandora_compact_modules($dbh, $conf, @module_groups);
|
||||
my $ending_time = time();
|
||||
log_message('COMPACT', "Time taken: " . ($ending_time - $starting_time) . " seconds.");
|
||||
|
||||
# Add the offset.
|
||||
$last_compact_offset += $agents_limit;
|
||||
|
||||
# If the offset is higher than the max module start again
|
||||
$last_compact_offset = 0 if ($last_compact_offset >= $total_modules);
|
||||
|
||||
# Save the new offset
|
||||
db_do($dbh, "UPDATE tconfig SET value = ? WHERE token = 'last_compact_offset'", $last_compact_offset);
|
||||
}
|
||||
|
||||
sub pandora_compact_modules {
|
||||
my ($dbh, $conf, @module_groups) = @_;
|
||||
|
||||
# Obtain the minimun last compact from the block
|
||||
my $min_compact = min(map { $_->{"last_compact"} } @module_groups);
|
||||
|
||||
# if the min has not been setted
|
||||
if($min_compact == 0){
|
||||
$min_compact = get_db_value(
|
||||
$dbh,
|
||||
'SELECT MIN(td.utimestamp)
|
||||
FROM tagente_datos td, tagente_modulo tm
|
||||
WHERE td.id_agente_modulo = tm.id_agente_modulo
|
||||
AND tm.id_tipo_modulo not in (2, 6, 9, 18, 21, 31, 35, 100)
|
||||
AND td.id_agente_modulo BETWEEN ? AND ?',
|
||||
$module_groups[0]->{"id_agente_modulo"}, $module_groups[-1]->{"id_agente_modulo"}
|
||||
);
|
||||
}
|
||||
|
||||
# One week of data of data as max from the last min compact.
|
||||
my $max_compact = $min_compact + (60 * 60 * 24 * 7);
|
||||
|
||||
# If the last compact is on the future set the current time as max.
|
||||
$max_compact = time() if($max_compact > time());
|
||||
|
||||
log_message('COMPACT', "Compacting data of agents agents $module_groups[0]->{'id_agente_modulo'} to $module_groups[-1]->{'id_agente_modulo'}, data between " . strftime('%Y-%m-%d %H:%M:%S', localtime($min_compact)) . " and " . strftime('%Y-%m-%d %H:%M:%S', localtime($max_compact)));
|
||||
|
||||
# Obtain all the data from the interval to avoid multiple requests
|
||||
# Avoid pull data from modules that should be skipped.
|
||||
my @data = get_db_rows (
|
||||
$dbh,
|
||||
'SELECT td.id_agente_modulo, td.datos, td.utimestamp
|
||||
FROM tagente_datos td, tagente_modulo tm
|
||||
WHERE td.id_agente_modulo = tm.id_agente_modulo
|
||||
AND tm.id_tipo_modulo not in (2, 6, 9, 18, 21, 31, 35, 100)
|
||||
AND td.utimestamp < ? AND td.utimestamp >= ?
|
||||
AND td.id_agente_modulo BETWEEN ? AND ?
|
||||
',
|
||||
$max_compact, $min_compact, $module_groups[0]->{"id_agente_modulo"}, $module_groups[-1]->{"id_agente_modulo"}
|
||||
);
|
||||
|
||||
my $total_data = scalar(@data);
|
||||
my $proceced_total_data = 0;
|
||||
my $progress = 0;
|
||||
my $compactations = 0;
|
||||
|
||||
my %count_hash;
|
||||
my %id_agent_hash;
|
||||
my %value_hash;
|
||||
my %module_proc_hash;
|
||||
|
||||
return if ($conf->{'_days_compact'} == 0 || $conf->{'_step_compact'} < 1);
|
||||
|
||||
# Convert compact interval length from hours to seconds
|
||||
my $step = $conf->{'_step_compact'} * 3600;
|
||||
|
||||
# The oldest timestamp will be the lower limit
|
||||
my $limit_utime = get_db_value ($dbh, 'SELECT min(utimestamp) as min FROM tagente_datos');
|
||||
return unless (defined ($limit_utime) && $limit_utime > 0);
|
||||
# Max. 168 steps or 7 days in one hour steps.
|
||||
# This avoids blocking of old modules without last compact
|
||||
my $step_limit = 24 * 7;
|
||||
|
||||
# Calculate the start date
|
||||
my $start_utime = time() - $conf->{'_days_compact'} * 24 * 60 * 60;
|
||||
my $last_compact = $start_utime;
|
||||
my $stop_utime;
|
||||
# Compact the modules in this block
|
||||
foreach my $module (@module_groups) {
|
||||
$progress = $total_data == 0 ? 0 : ($proceced_total_data / $total_data) * 100;
|
||||
printf(strftime("\r" . "%H:%M:%S", localtime()) . ' [COMPACT] ' . "Progress: %.2f%%", $progress);
|
||||
|
||||
my $id = $module->{"id_agente_modulo"};
|
||||
my $module_type = $module->{"id_tipo_modulo"};
|
||||
|
||||
# Do not compact the same data twice!
|
||||
if (defined ($conf->{'_last_compact'}) && $conf->{'_last_compact'} > $limit_utime) {
|
||||
$limit_utime = $conf->{'_last_compact'};
|
||||
}
|
||||
|
||||
if ($start_utime <= $limit_utime || ( defined ($conf->{'_last_compact'}) && (($conf->{'_last_compact'} + 24 * 60 * 60) > $start_utime))) {
|
||||
log_message ('COMPACT', "Data already compacted.");
|
||||
return;
|
||||
}
|
||||
|
||||
log_message ('COMPACT', "Compacting data from " . strftime ("%Y-%m-%d %H:%M:%S", localtime($limit_utime)) . " to " . strftime ("%Y-%m-%d %H:%M:%S", localtime($start_utime)) . '.', '');
|
||||
next unless defined ($module_type);
|
||||
next if ($module_type == 2 || $module_type == 6 || $module_type == 9 || $module_type == 18 || $module_type == 21 || $module_type == 31 || $module_type == 35 || $module_type == 100);
|
||||
|
||||
# Prepare the query to retrieve data from an interval
|
||||
while (1) {
|
||||
# Obtain the data just for this module
|
||||
my @module_data = grep { $_->{"id_agente_modulo"} == $id } @data;
|
||||
my $total_elements = scalar(@module_data);
|
||||
|
||||
# Calculate the stop date for the interval
|
||||
$stop_utime = $start_utime - $step;
|
||||
# No data for this module.
|
||||
next if ($total_elements == 0);
|
||||
|
||||
# Out of limits
|
||||
last if ($start_utime < $limit_utime);
|
||||
# Obtain the last compact of this module to avoid compact something previously compacted
|
||||
my $last_compact = $module ->{"last_compact"};
|
||||
|
||||
# Mark the progress
|
||||
log_message ('', ".");
|
||||
# In case that the last compact has not been defined take the minimun data as last compact
|
||||
$last_compact = min(map { $_->{"utimestamp"} } @module_data)-1 if($last_compact == 0);
|
||||
|
||||
# Create an array to store INSERT commands
|
||||
my @insert_commands;
|
||||
my $insert_command = 'INSERT INTO tagente_datos (id_agente_modulo, datos, utimestamp) VALUES (?, ?, ?)';
|
||||
|
||||
my $step_number = 0;
|
||||
my $first_compact = $last_compact;
|
||||
|
||||
# Compact using the steps
|
||||
while($step_number < $step_limit){
|
||||
|
||||
my $next_compact = $last_compact + $step;
|
||||
|
||||
my @data = get_db_rows ($dbh, 'SELECT * FROM tagente_datos WHERE utimestamp < ? AND utimestamp >= ?', $start_utime, $stop_utime);
|
||||
# No data, move to the next interval
|
||||
if ($#data == 0) {
|
||||
$start_utime = $stop_utime;
|
||||
last if($next_compact > time());
|
||||
|
||||
# Obtain the data between the last compact and the next step.
|
||||
my @data_in_range = grep { $_->{"utimestamp"} > $last_compact && $_->{"utimestamp"} <= $next_compact } @module_data;
|
||||
|
||||
my $total_range_elements = scalar(@data_in_range);
|
||||
|
||||
# Nothing to compress, skip this step.
|
||||
if($total_range_elements == 0){
|
||||
$last_compact = $next_compact;
|
||||
next;
|
||||
}
|
||||
|
||||
# Get interval data
|
||||
foreach my $data (@data) {
|
||||
my $id_module = $data->{'id_agente_modulo'};
|
||||
if (! defined($module_proc_hash{$id_module})) {
|
||||
my $module_type = get_db_value ($dbh, 'SELECT id_tipo_modulo FROM tagente_modulo WHERE id_agente_modulo = ?', $id_module);
|
||||
next unless defined ($module_type);
|
||||
my $total_data = sum(map { $_->{"datos"} } @data_in_range);
|
||||
|
||||
# Mark proc modules.
|
||||
if ($module_type == 2 || $module_type == 6 || $module_type == 9 || $module_type == 18 || $module_type == 21 || $module_type == 31 || $module_type == 35 || $module_type == 100) {
|
||||
$module_proc_hash{$id_module} = 1;
|
||||
}
|
||||
else {
|
||||
$module_proc_hash{$id_module} = 0;
|
||||
}
|
||||
}
|
||||
my $avg = $total_data / $total_range_elements;
|
||||
|
||||
# Skip proc modules!
|
||||
next if ($module_proc_hash{$id_module} == 1);
|
||||
$proceced_total_data += $total_range_elements;
|
||||
|
||||
push @insert_commands, [$insert_command, $id, $avg, int($last_compact + ($step / 2))];
|
||||
|
||||
if (! defined($value_hash{$id_module})) {
|
||||
$value_hash{$id_module} = 0;
|
||||
$count_hash{$id_module} = 0;
|
||||
$last_compact = $next_compact;
|
||||
|
||||
$step_number +=1;
|
||||
# Small sleep to don't burn the DB
|
||||
usleep (1000);
|
||||
|
||||
}
|
||||
|
||||
if (! defined($id_agent_hash{$id_module})) {
|
||||
$id_agent_hash{$id_module} = $data->{'id_agente'};
|
||||
}
|
||||
}
|
||||
$dbh->begin_work;
|
||||
|
||||
$value_hash{$id_module} += $data->{'datos'};
|
||||
$count_hash{$id_module}++;
|
||||
}
|
||||
db_do ($dbh, 'DELETE FROM tagente_datos WHERE utimestamp > ? AND utimestamp <= ? AND id_agente_modulo = ?', $first_compact, $last_compact, $id);
|
||||
|
||||
# Delete interval from the database
|
||||
db_do ($dbh, 'DELETE ad FROM tagente_datos ad
|
||||
INNER JOIN tagente_modulo am ON ad.id_agente_modulo = am.id_agente_modulo AND am.id_tipo_modulo NOT IN (2,6,9,18,21,31,35,100)
|
||||
WHERE ad.utimestamp < ? AND ad.utimestamp >= ?', $start_utime, $stop_utime);
|
||||
# Execute the INSERT commands
|
||||
foreach my $command (@insert_commands) {
|
||||
my ($sql, @params) = @$command;
|
||||
db_do($dbh, $sql, @params);
|
||||
}
|
||||
|
||||
# Insert interval average value
|
||||
foreach my $key (keys(%value_hash)) {
|
||||
$value_hash{$key} /= $count_hash{$key};
|
||||
db_do ($dbh, 'INSERT INTO tagente_datos (id_agente_modulo, datos, utimestamp) VALUES (?, ?, ?)', $key, $value_hash{$key}, $stop_utime);
|
||||
delete($value_hash{$key});
|
||||
delete($count_hash{$key});
|
||||
}
|
||||
|
||||
usleep (1000); # Very small usleep, just to don't burn the DB
|
||||
# Move to the next interval
|
||||
$start_utime = $stop_utime;
|
||||
$dbh->commit;
|
||||
# Update the last compacted timestamp.
|
||||
db_do($dbh, "UPDATE tagente_modulo SET last_compact = FROM_UNIXTIME(?) WHERE id_agente_modulo = ?", $last_compact, $module ->{"id_agente_modulo"});
|
||||
$compactations += $step_number;
|
||||
}
|
||||
log_message ('', "\n");
|
||||
|
||||
# Mark the last compact date
|
||||
if (defined ($conf->{'_last_compact'})) {
|
||||
db_do ($dbh_conf, 'UPDATE tconfig SET value=? WHERE token=?', $last_compact, 'last_compact');
|
||||
} else {
|
||||
db_do ($dbh_conf, 'INSERT INTO tconfig (value, token) VALUES (?, ?)', $last_compact, 'last_compact');
|
||||
}
|
||||
printf(strftime("\r" . "%H:%M:%S", localtime()) . ' [COMPACT] ' . "Progress: %.2f%%", 100);
|
||||
print("\n");
|
||||
log_message('COMPACT', "A total of $proceced_total_data elements has been compacted into $compactations elements");
|
||||
|
||||
}
|
||||
|
||||
########################################################################
|
||||
@ -1234,9 +1308,8 @@ sub pandoradb_main {
|
||||
# Only active database should be compacted. Disabled for historical database.
|
||||
# Compact on if enable and DaysCompact are below DaysPurge
|
||||
if (($conf->{'_onlypurge'} == 0)
|
||||
&& ($conf->{'_days_compact'} < $conf->{'_days_purge'})
|
||||
) {
|
||||
pandora_compactdb ($conf, defined ($history_dbh) ? $history_dbh : $dbh, $dbh);
|
||||
pandora_compactdb ($conf, $dbh, $dbh);
|
||||
}
|
||||
|
||||
# Update tconfig with last time of database maintance time (now)
|
||||
|
@ -168,6 +168,7 @@ sub ha_load_pandora_conf($) {
|
||||
$conf->{'pandora_service_cmd'} = 'service pandora_server' unless defined($conf->{'pandora_service_cmd'});
|
||||
$conf->{'tentacle_service_cmd'} = 'service tentacle_serverd' unless defined ($conf->{'tentacle_service_cmd'});
|
||||
$conf->{'tentacle_service_watchdog'} = 1 unless defined ($conf->{'tentacle_service_watchdog'});
|
||||
$conf->{'made_service_cmd'} = 'service pandora_made' unless defined($conf->{'made_service_cmd'});
|
||||
}
|
||||
|
||||
##############################################################################
|
||||
@ -257,6 +258,31 @@ sub ha_keep_pandora_running($$) {
|
||||
}
|
||||
}
|
||||
|
||||
##############################################################################
|
||||
# Keep MADE running
|
||||
##############################################################################
|
||||
sub ha_keep_made_running($$) {
|
||||
my ($conf, $dbh) = @_;
|
||||
|
||||
# Is MADE enabled?
|
||||
return unless (defined($conf->{'madeserver'}) && $conf->{'madeserver'} == 1);
|
||||
|
||||
# Is MADE installed?
|
||||
`$conf->{'made_service_cmd'} status 2>/dev/null`;
|
||||
if (($? >> 8) == 4) {
|
||||
log_message($conf, 'LOG', "Pandora FMS MADE is not installed.");
|
||||
return;
|
||||
}
|
||||
|
||||
# Try to get the PID of the service.
|
||||
my $pid = `systemctl show --property MainPID pandora_made | cut -d= -f2`;
|
||||
chomp($pid);
|
||||
if ($pid eq "0") {
|
||||
log_message($conf, 'LOG', 'MADE service not running.');
|
||||
`$conf->{'made_service_cmd'} start 2>/dev/null`;
|
||||
}
|
||||
}
|
||||
|
||||
##############################################################################
|
||||
# Keep the Tentacle server running
|
||||
##############################################################################
|
||||
@ -535,6 +561,9 @@ sub ha_main_pacemaker($) {
|
||||
# Keep Tentacle running
|
||||
ha_keep_tentacle_running($conf, $dbh);
|
||||
|
||||
# Keep MADE running
|
||||
ha_keep_made_running($conf, $dbh);
|
||||
|
||||
# Are we the master?
|
||||
pandora_set_master($conf, $dbh);
|
||||
if (!pandora_is_master($conf)) {
|
||||
@ -627,6 +656,9 @@ sub ha_main_pandora($) {
|
||||
# Keep Tentacle running
|
||||
ha_keep_tentacle_running($conf, $dbh);
|
||||
|
||||
# Keep MADE running
|
||||
ha_keep_made_running($conf, $dbh);
|
||||
|
||||
# Are we the master?
|
||||
pandora_set_master($conf, $dbh);
|
||||
if (!pandora_is_master($conf)) {
|
||||
|
@ -36,7 +36,7 @@ use Encode::Locale;
|
||||
Encode::Locale::decode_argv;
|
||||
|
||||
# version: define current version
|
||||
my $version = "7.0NG.773.3 Build 231024";
|
||||
my $version = "7.0NG.773.3 Build 231030";
|
||||
|
||||
# save program name for logging
|
||||
my $progname = basename($0);
|
||||
|
Loading…
x
Reference in New Issue
Block a user