Merge remote-tracking branch 'origin/develop' into ent-11471-integracion-pandora-integria
This commit is contained in:
commit
dca15b5637
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.773.1, AIX version
|
||||
# Version 7.0NG.773.2, AIX version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2023 Pandora FMS
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.773.1, FreeBSD Version
|
||||
# Version 7.0NG.773.2, FreeBSD Version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2023 Pandora FMS
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.773.1, HP-UX Version
|
||||
# Version 7.0NG.773.2, HP-UX Version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2023 Pandora FMS
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.773.1, GNU/Linux
|
||||
# Version 7.0NG.773.2, GNU/Linux
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2023 Pandora FMS
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.773.1, GNU/Linux
|
||||
# Version 7.0NG.773.2, GNU/Linux
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2023 Pandora FMS
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.773.1, Solaris Version
|
||||
# Version 7.0NG.773.2, Solaris Version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2023 Pandora FMS
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Base config file for Pandora FMS Windows Agent
|
||||
# (c) 2006-2023 Pandora FMS
|
||||
# Version 7.0NG.773.1
|
||||
# Version 7.0NG.773.2
|
||||
# This program is Free Software, you can redistribute it and/or modify it
|
||||
# under the terms of the GNU General Public Licence as published by the Free Software
|
||||
# Foundation; either version 2 of the Licence or any later version
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Fichero de configuracion base de agentes de Pandora
|
||||
# Base config file for Pandora agents
|
||||
# Version 7.0NG.773.1, AIX version
|
||||
# Version 7.0NG.773.2, AIX version
|
||||
|
||||
# General Parameters
|
||||
# ==================
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Fichero de configuracion base de agentes de Pandora
|
||||
# Base config file for Pandora agents
|
||||
# Version 7.0NG.773.1
|
||||
# Version 7.0NG.773.2
|
||||
# FreeBSD/IPSO version
|
||||
# Licenced under GPL licence, 2003-2007 Sancho Lerena
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Fichero de configuracion base de agentes de Pandora
|
||||
# Base config file for Pandora agents
|
||||
# Version 7.0NG.773.1, HPUX Version
|
||||
# Version 7.0NG.773.2, HPUX Version
|
||||
|
||||
# General Parameters
|
||||
# ==================
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.773.1
|
||||
# Version 7.0NG.773.2
|
||||
# Licensed under GPL license v2,
|
||||
# (c) 2003-2023 Pandora FMS
|
||||
# please visit http://pandora.sourceforge.net
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.773.1
|
||||
# Version 7.0NG.773.2
|
||||
# Licensed under GPL license v2,
|
||||
# (c) 2003-2023 Pandora FMS
|
||||
# please visit http://pandora.sourceforge.net
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.773.1
|
||||
# Version 7.0NG.773.2
|
||||
# Licensed under GPL license v2,
|
||||
# please visit http://pandora.sourceforge.net
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Fichero de configuracion base de agentes de Pandora
|
||||
# Base config file for Pandora agents
|
||||
# Version 7.0NG.773.1, Solaris version
|
||||
# Version 7.0NG.773.2, Solaris version
|
||||
|
||||
# General Parameters
|
||||
# ==================
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.773.1, AIX version
|
||||
# Version 7.0NG.773.2, AIX version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2023 Pandora FMS
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
package: pandorafms-agent-unix
|
||||
Version: 7.0NG.773.1-230822
|
||||
Version: 7.0NG.773.2
|
||||
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.1-230822"
|
||||
pandora_version="7.0NG.773.2"
|
||||
|
||||
echo "Test if you has the tools for to make the packages."
|
||||
whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null
|
||||
|
|
|
@ -31,7 +31,7 @@ fi
|
|||
if [ "$#" -ge 2 ]; then
|
||||
VERSION="$2"
|
||||
else
|
||||
VERSION="7.0NG.773.1"
|
||||
VERSION="7.0NG.773.2"
|
||||
fi
|
||||
|
||||
# Path for the generated DMG file
|
||||
|
|
|
@ -19,11 +19,11 @@
|
|||
<choice id="com.pandorafms.pandorafms_src" visible="false">
|
||||
<pkg-ref id="com.pandorafms.pandorafms_src"/>
|
||||
</choice>
|
||||
<pkg-ref id="com.pandorafms.pandorafms_src" version="7.0NG.773.1" onConclusion="none">pandorafms_src.pdk</pkg-ref>
|
||||
<pkg-ref id="com.pandorafms.pandorafms_src" version="7.0NG.773.2" onConclusion="none">pandorafms_src.pdk</pkg-ref>
|
||||
<choice id="com.pandorafms.pandorafms_uninstall" visible="true" customLocation="/Applications">
|
||||
<pkg-ref id="com.pandorafms.pandorafms_uninstall"/>
|
||||
</choice>
|
||||
<pkg-ref id="com.pandorafms.pandorafms_uninstall" version="7.0NG.773.1" onConclusion="none">pandorafms_uninstall.pdk</pkg-ref>
|
||||
<pkg-ref id="com.pandorafms.pandorafms_uninstall" version="7.0NG.773.2" onConclusion="none">pandorafms_uninstall.pdk</pkg-ref>
|
||||
<!-- <installation-check script="check()" />
|
||||
<script>
|
||||
<![CDATA[
|
||||
|
|
|
@ -5,9 +5,9 @@
|
|||
<key>CFBundleIconFile</key> <string>pandorafms.icns</string>
|
||||
<key>CFBundleIdentifier</key> <string>com.pandorafms.pandorafms_uninstall</string>
|
||||
|
||||
<key>CFBundleVersion</key> <string>7.0NG.773.1</string>
|
||||
<key>CFBundleGetInfoString</key> <string>7.0NG.773.1 Pandora FMS on Aug 2020</string>
|
||||
<key>CFBundleShortVersionString</key> <string>7.0NG.773.1</string>
|
||||
<key>CFBundleVersion</key> <string>7.0NG.773.2</string>
|
||||
<key>CFBundleGetInfoString</key> <string>7.0NG.773.2 Pandora FMS on Aug 2020</string>
|
||||
<key>CFBundleShortVersionString</key> <string>7.0NG.773.2</string>
|
||||
|
||||
<key>NSPrincipalClass</key><string>NSApplication</string>
|
||||
<key>NSMainNibFile</key><string>MainMenu</string>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.773.1, GNU/Linux
|
||||
# Version 7.0NG.773.2, GNU/Linux
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2023 Pandora FMS
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.773.1, FreeBSD Version
|
||||
# Version 7.0NG.773.2, FreeBSD Version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2023 Pandora FMS
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.773.1, HP-UX Version
|
||||
# Version 7.0NG.773.2, HP-UX Version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2023 Pandora FMS
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.773.1
|
||||
# Version 7.0NG.773.2
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2004-2023 Pandora FMS
|
||||
# https://pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.773.1, GNU/Linux
|
||||
# Version 7.0NG.773.2, GNU/Linux
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2023 Pandora FMS
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.773.1, NetBSD Version
|
||||
# Version 7.0NG.773.2, NetBSD Version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2023 Pandora FMS
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.773.1, Solaris Version
|
||||
# Version 7.0NG.773.2, Solaris Version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2023 Pandora FMS
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1030,8 +1030,8 @@ my $Sem = undef;
|
|||
# Semaphore used to control the number of threads
|
||||
my $ThreadSem = undef;
|
||||
|
||||
use constant AGENT_VERSION => '7.0NG.773.1';
|
||||
use constant AGENT_BUILD => '230822';
|
||||
use constant AGENT_VERSION => '7.0NG.773.2';
|
||||
use constant AGENT_BUILD => '230823';
|
||||
|
||||
# Agent log default file size maximum and instances
|
||||
use constant DEFAULT_MAX_LOG_SIZE => 600000;
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
#
|
||||
%global __os_install_post %{nil}
|
||||
%define name pandorafms_agent_linux
|
||||
%define version 7.0NG.773.1
|
||||
%define release 230822
|
||||
%define version 7.0NG.773.2
|
||||
%define release 1
|
||||
|
||||
Summary: Pandora FMS Linux agent, PERL version
|
||||
Name: %{name}
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
#
|
||||
%global __os_install_post %{nil}
|
||||
%define name pandorafms_agent_linux
|
||||
%define version 7.0NG.773.1
|
||||
%define release 230822
|
||||
%define version 7.0NG.773.2
|
||||
%define release 1
|
||||
|
||||
Summary: Pandora FMS Linux agent, PERL version
|
||||
Name: %{name}
|
||||
|
|
|
@ -9,8 +9,8 @@
|
|||
# Please see http://www.pandorafms.org. This code is licensed under GPL 2.0 license.
|
||||
# **********************************************************************
|
||||
|
||||
PI_VERSION="7.0NG.773.1"
|
||||
PI_BUILD="230822"
|
||||
PI_VERSION="7.0NG.773.2"
|
||||
PI_BUILD="230823"
|
||||
OS_NAME=`uname -s`
|
||||
|
||||
FORCE=0
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Base config file for Pandora FMS Windows Agent
|
||||
# (c) 2006-2023 Pandora FMS
|
||||
# Version 7.0NG.773.1
|
||||
# Version 7.0NG.773.2
|
||||
# This program is Free Software, you can redistribute it and/or modify it
|
||||
# under the terms of the GNU General Public Licence as published by the Free Software
|
||||
# Foundation; either version 2 of the Licence or any later version
|
||||
|
|
|
@ -3,7 +3,7 @@ AllowLanguageSelection
|
|||
{Yes}
|
||||
|
||||
AppName
|
||||
{Pandora FMS Windows Agent v7.0NG.773.1}
|
||||
{Pandora FMS Windows Agent v7.0NG.773.2}
|
||||
|
||||
ApplicationID
|
||||
{17E3D2CF-CA02-406B-8A80-9D31C17BD08F}
|
||||
|
@ -186,7 +186,7 @@ UpgradeApplicationID
|
|||
{}
|
||||
|
||||
Version
|
||||
{230822}
|
||||
{230823}
|
||||
|
||||
ViewReadme
|
||||
{Yes}
|
||||
|
@ -2387,7 +2387,7 @@ Windows,BuildSeparateArchives
|
|||
{No}
|
||||
|
||||
Windows,Executable
|
||||
{<%AppName%>-<%Version%>-Setup<%Ext%>}
|
||||
{<%AppName%>-Setup<%Ext%>}
|
||||
|
||||
Windows,FileDescription
|
||||
{<%AppName%> <%Version%> Setup}
|
||||
|
|
|
@ -30,7 +30,7 @@ using namespace Pandora;
|
|||
using namespace Pandora_Strutils;
|
||||
|
||||
#define PATH_SIZE _MAX_PATH+1
|
||||
#define PANDORA_VERSION ("7.0NG.773.1 Build 230822")
|
||||
#define PANDORA_VERSION ("7.0NG.773.2 Build 230823")
|
||||
|
||||
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.1(Build 230822))"
|
||||
VALUE "ProductVersion", "(7.0NG.773.2(Build 230823))"
|
||||
VALUE "FileVersion", "1.0.0.0"
|
||||
END
|
||||
END
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
package: pandorafms-console
|
||||
Version: 7.0NG.773.1-230822
|
||||
Version: 7.0NG.773.2
|
||||
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.1-230822"
|
||||
pandora_version="7.0NG.773.2"
|
||||
|
||||
package_pear=0
|
||||
package_pandora=1
|
||||
|
|
|
@ -26,19 +26,20 @@
|
|||
* ============================================================================
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
require_once $config['homedir'].'/include/config.php';
|
||||
require_once $config['homedir'].'/include/functions_reporting.php';
|
||||
require_once $config['homedir'].'/include/functions_modules.php';
|
||||
*/
|
||||
require_once '../include/config.php';
|
||||
require_once '../include/functions_agents.php';
|
||||
require_once '../include/functions_reporting.php';
|
||||
require_once '../include/functions_modules.php';
|
||||
require_once '../include/functions_users.php';
|
||||
|
||||
global $config;
|
||||
if (true) {
|
||||
include_once '../include/config.php';
|
||||
include_once '../include/functions_agents.php';
|
||||
include_once '../include/functions_reporting.php';
|
||||
include_once '../include/functions_modules.php';
|
||||
include_once '../include/functions_users.php';
|
||||
include_once $config['homedir'].'/include/config.php';
|
||||
include_once $config['homedir'].'/include/functions_agents.php';
|
||||
include_once $config['homedir'].'/include/functions_reporting.php';
|
||||
include_once $config['homedir'].'/include/functions_modules.php';
|
||||
include_once $config['homedir'].'/include/functions_users.php';
|
||||
}
|
||||
|
||||
|
||||
check_login();
|
||||
|
||||
|
|
|
@ -190,14 +190,21 @@ $output .= html_print_label_input_block(
|
|||
html_print_extended_select_for_time(
|
||||
'period',
|
||||
$period,
|
||||
'',
|
||||
'check_period_warning(this, \''.__('Warning').'\', \''.__('Displaying items with extended historical data can have an impact on system performance. We do not recommend that you use intervals longer than 30 days, especially if you combine several of them in a report, dashboard or visual console.').'\')',
|
||||
'',
|
||||
'0',
|
||||
false,
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
'w100p'
|
||||
'w100p',
|
||||
false,
|
||||
false,
|
||||
'',
|
||||
false,
|
||||
0,
|
||||
null,
|
||||
'check_period_warning_manual(\'period\', \''.__('Warning').'\', \''.__('Displaying items with extended historical data can have an impact on system performance. We do not recommend that you use intervals longer than 30 days, especially if you combine several of them in a report, dashboard or visual console.').'\')'
|
||||
)
|
||||
);
|
||||
$output .= "</td><td class='datos2' width='50%'>";
|
||||
|
|
|
@ -1421,10 +1421,21 @@ $class = 'databox filters';
|
|||
html_print_extended_select_for_time(
|
||||
'period',
|
||||
$period,
|
||||
'',
|
||||
'check_period_warning(this, \''.__('Warning').'\', \''.__('Displaying items with extended historical data can have an impact on system performance. We do not recommend that you use intervals longer than 30 days, especially if you combine several of them in a report, dashboard or visual console.').'\')',
|
||||
'',
|
||||
'0',
|
||||
10
|
||||
10,
|
||||
false,
|
||||
false,
|
||||
true,
|
||||
'',
|
||||
false,
|
||||
false,
|
||||
'',
|
||||
false,
|
||||
0,
|
||||
null,
|
||||
'check_period_warning_manual(\'period\', \''.__('Warning').'\', \''.__('Displaying items with extended historical data can have an impact on system performance. We do not recommend that you use intervals longer than 30 days, especially if you combine several of them in a report, dashboard or visual console.').'\')'
|
||||
);
|
||||
?>
|
||||
</td>
|
||||
|
@ -1444,10 +1455,21 @@ $class = 'databox filters';
|
|||
html_print_extended_select_for_time(
|
||||
'period_range',
|
||||
$period_range,
|
||||
'',
|
||||
'check_period_warning(this, \''.__('Warning').'\', \''.__('Displaying items with extended historical data can have an impact on system performance. We do not recommend that you use intervals longer than 30 days, especially if you combine several of them in a report, dashboard or visual console.').'\')',
|
||||
'',
|
||||
'0',
|
||||
10
|
||||
10,
|
||||
false,
|
||||
false,
|
||||
true,
|
||||
'',
|
||||
false,
|
||||
false,
|
||||
'',
|
||||
false,
|
||||
0,
|
||||
null,
|
||||
'check_period_warning_manual(\'period_range\', \''.__('Warning').'\', \''.__('Displaying items with extended historical data can have an impact on system performance. We do not recommend that you use intervals longer than 30 days, especially if you combine several of them in a report, dashboard or visual console.').'\')'
|
||||
);
|
||||
?>
|
||||
</td>
|
||||
|
@ -1487,10 +1509,21 @@ $class = 'databox filters';
|
|||
html_print_extended_select_for_time(
|
||||
'period1',
|
||||
$period_pg,
|
||||
'',
|
||||
'check_period_warning(this)',
|
||||
'',
|
||||
'0',
|
||||
10
|
||||
10,
|
||||
false,
|
||||
false,
|
||||
true,
|
||||
'',
|
||||
false,
|
||||
false,
|
||||
'',
|
||||
false,
|
||||
0,
|
||||
null,
|
||||
'check_period_warning_manual(\'period\')'
|
||||
);
|
||||
?>
|
||||
</td>
|
||||
|
@ -1506,10 +1539,21 @@ $class = 'databox filters';
|
|||
html_print_extended_select_for_time(
|
||||
'period2',
|
||||
$projection_period,
|
||||
'',
|
||||
'check_period_warning(this)',
|
||||
'',
|
||||
'0',
|
||||
10
|
||||
10,
|
||||
false,
|
||||
false,
|
||||
true,
|
||||
'',
|
||||
false,
|
||||
false,
|
||||
'',
|
||||
false,
|
||||
0,
|
||||
null,
|
||||
'check_period_warning_manual(\'period\')'
|
||||
);
|
||||
?>
|
||||
</td>
|
||||
|
@ -3440,7 +3484,7 @@ $class = 'databox filters';
|
|||
html_print_extended_select_for_time(
|
||||
'lapse',
|
||||
$lapse,
|
||||
'',
|
||||
'check_period_warning(this, \''.__('Warning').'\', \''.__('Displaying items with extended historical data can have an impact on system performance. We do not recommend that you use intervals longer than 30 days, especially if you combine several of them in a report, dashboard or visual console.').'\')',
|
||||
__('None'),
|
||||
'0',
|
||||
10,
|
||||
|
@ -3448,7 +3492,13 @@ $class = 'databox filters';
|
|||
'',
|
||||
'',
|
||||
'',
|
||||
!$lapse_calc
|
||||
!$lapse_calc,
|
||||
false,
|
||||
'',
|
||||
false,
|
||||
0,
|
||||
null,
|
||||
'check_period_warning_manual(\'lapse\', \''.__('Warning').'\', \''.__('Displaying items with extended historical data can have an impact on system performance. We do not recommend that you use intervals longer than 30 days, especially if you combine several of them in a report, dashboard or visual console.').'\')'
|
||||
);
|
||||
?>
|
||||
</td>
|
||||
|
|
|
@ -555,6 +555,7 @@ switch ($activeTab) {
|
|||
$type = (int) get_parameter('type', STATIC_GRAPH);
|
||||
$image = get_parameter('image');
|
||||
$range = (int) get_parameter('range', 50);
|
||||
$range_vertical = (int) get_parameter('range_vertical', 50);
|
||||
$width = (int) get_parameter('width', 0);
|
||||
$height = (int) get_parameter('height', 0);
|
||||
$period = (int) get_parameter('period', 0);
|
||||
|
@ -567,6 +568,9 @@ switch ($activeTab) {
|
|||
$label_type = get_parameter('label_type', 'agent_module');
|
||||
$enable_link = get_parameter('enable_link', 'enable_link');
|
||||
$show_on_top = get_parameter('show_on_top', 0);
|
||||
$pos_x = get_parameter('pos_x', 0);
|
||||
$pos_y = get_parameter('pos_y', 0);
|
||||
$max_elements_row = (int) get_parameter('max_elements_row', 0);
|
||||
|
||||
// This var switch between creation of items, item_per_agent = 0 => item per module; item_per_agent <> 0 => item per agent
|
||||
$item_per_agent = get_parameter('item_per_agent', 0);
|
||||
|
@ -611,6 +615,7 @@ switch ($activeTab) {
|
|||
$image,
|
||||
$idVisualConsole,
|
||||
$range,
|
||||
$range_vertical,
|
||||
$width,
|
||||
$height,
|
||||
$period,
|
||||
|
@ -626,7 +631,10 @@ switch ($activeTab) {
|
|||
$kind_relationship,
|
||||
$item_in_the_map,
|
||||
$fontf,
|
||||
$fonts
|
||||
$fonts,
|
||||
$pos_x,
|
||||
$pos_y,
|
||||
$max_elements_row
|
||||
);
|
||||
|
||||
$statusProcessInDB = [
|
||||
|
@ -668,6 +676,7 @@ switch ($activeTab) {
|
|||
$image,
|
||||
$idVisualConsole,
|
||||
$range,
|
||||
$range_vertical,
|
||||
$width,
|
||||
$height,
|
||||
$period,
|
||||
|
@ -683,7 +692,10 @@ switch ($activeTab) {
|
|||
$kind_relationship,
|
||||
$item_in_the_map,
|
||||
$fontf,
|
||||
$fonts
|
||||
$fonts,
|
||||
$pos_x,
|
||||
$pos_y,
|
||||
$max_elements_row
|
||||
);
|
||||
} else {
|
||||
$id_modules = [];
|
||||
|
@ -722,6 +734,7 @@ switch ($activeTab) {
|
|||
$image,
|
||||
$idVisualConsole,
|
||||
$range,
|
||||
$range_vertical,
|
||||
$width,
|
||||
$height,
|
||||
$period,
|
||||
|
@ -737,7 +750,10 @@ switch ($activeTab) {
|
|||
$kind_relationship,
|
||||
$item_in_the_map,
|
||||
$fontf,
|
||||
$fonts
|
||||
$fonts,
|
||||
$pos_x,
|
||||
$pos_y,
|
||||
$max_elements_row
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -144,22 +144,28 @@ $table->data['all_0'][0] = html_print_label_input_block(
|
|||
|
||||
|
||||
$table->rowstyle['staticgraph'] = 'display: none;';
|
||||
$table->colspan['staticgraph'][0] = 2;
|
||||
$table->data['staticgraph'][0] = html_print_label_input_block(
|
||||
__('Image'),
|
||||
html_print_select(
|
||||
'<div class="flex">'.html_print_select(
|
||||
$images_list,
|
||||
'image',
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
true
|
||||
)
|
||||
true,
|
||||
false,
|
||||
true,
|
||||
'',
|
||||
false,
|
||||
'width: 49%'
|
||||
).'<span id="image_prev" class="mrgn_lft_10px mrgn_top-10px"><img src="'.$config['homeurl'].'/images/console/icons/appliance_ok.png"></span></div>'
|
||||
);
|
||||
|
||||
$table->rowstyle['all_1'] = 'display: none;';
|
||||
$table->data['all_1'][0] = html_print_label_input_block(
|
||||
__('Range between elements (px)'),
|
||||
__('Horizontal range between elements (px)'),
|
||||
html_print_input_text(
|
||||
'range',
|
||||
50,
|
||||
|
@ -170,6 +176,18 @@ $table->data['all_1'][0] = html_print_label_input_block(
|
|||
)
|
||||
);
|
||||
|
||||
$table->data['all_1'][1] = html_print_label_input_block(
|
||||
__('Vertical range between elements (px)'),
|
||||
html_print_input_text(
|
||||
'range_vertical',
|
||||
50,
|
||||
'',
|
||||
5,
|
||||
5,
|
||||
true
|
||||
)
|
||||
);
|
||||
|
||||
$input_size = __('Width').': ';
|
||||
$input_size .= html_print_input_text('width', 0, '', 5, 5, true);
|
||||
$input_size .= __('Height').': ';
|
||||
|
@ -425,6 +443,16 @@ if (is_metaconsole() === false) {
|
|||
);
|
||||
}
|
||||
|
||||
$table->data['all_4_01'][0] = html_print_label_input_block(
|
||||
__('Filter agents'),
|
||||
html_print_input_text('filter_agents', '', '', false, 255, true)
|
||||
);
|
||||
|
||||
$table->data['all_4_01'][1] = html_print_label_input_block(
|
||||
__('Filter modules'),
|
||||
html_print_input_text('filter_modules', '', '', false, 255, true)
|
||||
);
|
||||
|
||||
$table->rowstyle['all_4'] = 'display: none;';
|
||||
$table->data['all_4'][0] = html_print_label_input_block(
|
||||
__('Agents').ui_print_help_tip(
|
||||
|
@ -549,6 +577,16 @@ $table->data['all_8'][1] = html_print_label_input_block(
|
|||
).'</span>'
|
||||
);
|
||||
|
||||
$table->data['all_10'][0] = html_print_label_input_block(
|
||||
__('Max. elements for row'),
|
||||
html_print_input_text('max_elements_row', 0, '', false, 255, true)
|
||||
);
|
||||
|
||||
$table->data['all_10'][1] = html_print_label_input_block(
|
||||
__('Position'),
|
||||
'<div class="flex_center"><span class="mrgn_right_10px">X</span>'.html_print_input_text('pos_x', 0, '', false, 255, true, false, false, '', 'w50p').'<span class="margin-lr-10">Y</span>'.html_print_input_text('pos_y', 0, '', false, 255, true, false, false, '', 'w50p').'</div>'
|
||||
);
|
||||
|
||||
if (is_metaconsole() === true) {
|
||||
$pure = get_parameter('pure', 0);
|
||||
|
||||
|
@ -831,6 +869,44 @@ function item_per_agent_change(itemPerAgent) {
|
|||
function metaconsole_init() {
|
||||
$("#groups").change();
|
||||
}
|
||||
|
||||
$('#text-filter_agents').on('keyup',function(){
|
||||
if ($(this).val() !== ''){
|
||||
findInSelect('id_agents',$(this).val());
|
||||
} else {
|
||||
$('#id_agents option').each(function(){
|
||||
$(this).removeClass('invisible');
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
$('#text-filter_modules').on('keyup',function(){
|
||||
if ($(this).val() !== ''){
|
||||
findInSelect('module',$(this).val());
|
||||
} else {
|
||||
$('#module option').each(function(){
|
||||
$(this).removeClass('invisible');
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
function findInSelect(selectid, find){
|
||||
var select = $('#'+selectid+' option');
|
||||
select.each(function(){
|
||||
var regex = new RegExp(find, "gi");
|
||||
if ($(this).html().match(regex) === null) {
|
||||
$(this).addClass('invisible');
|
||||
} else {
|
||||
$(this).removeClass('invisible');
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
$('#image').on('change', function(){
|
||||
var img = $(this).val();
|
||||
$('#image_prev').html('<img src="<?php echo $config['homeurl']; ?>/images/console/icons/'+img+'.png">');
|
||||
})
|
||||
|
||||
</script>
|
||||
<style type="text/css">
|
||||
select[name='kind_relationship'] option[disabled='disabled'] {
|
||||
|
|
|
@ -542,13 +542,21 @@ class CustomNetScan extends Wizard
|
|||
'extra' => '<span id="interval_manual_container">'.html_print_extended_select_for_time(
|
||||
'interval',
|
||||
$this->task['interval_sweep'],
|
||||
'',
|
||||
'check_period_warning(this, \''.__('Warning').'\', \''.__('Displaying items with extended historical data can have an impact on system performance. We do not recommend that you use intervals longer than 30 days, especially if you combine several of them in a report, dashboard or visual console.').'\')',
|
||||
'',
|
||||
'0',
|
||||
false,
|
||||
true,
|
||||
false,
|
||||
false
|
||||
false,
|
||||
'',
|
||||
false,
|
||||
false,
|
||||
'',
|
||||
false,
|
||||
0,
|
||||
null,
|
||||
'check_period_warning_manual(\'interval\', \''.__('Warning').'\', \''.__('Displaying items with extended historical data can have an impact on system performance. We do not recommend that you use intervals longer than 30 days, especially if you combine several of them in a report, dashboard or visual console.').'\')'
|
||||
).'</span>',
|
||||
];
|
||||
|
||||
|
|
|
@ -20,8 +20,8 @@
|
|||
/**
|
||||
* Pandora build version and version
|
||||
*/
|
||||
$build_version = 'PC230822';
|
||||
$pandora_version = 'v7.0NG.773.1';
|
||||
$build_version = 'PC230823';
|
||||
$pandora_version = 'v7.0NG.773.2';
|
||||
|
||||
// Do not overwrite default timezone set if defined.
|
||||
$script_tz = @date_default_timezone_get();
|
||||
|
|
|
@ -2760,79 +2760,6 @@ function agents_delete_agent($id_agents, $disableACL=false)
|
|||
enterprise_include_once('include/functions_agents.php');
|
||||
enterprise_hook('agent_delete_from_cache', [$id_agent]);
|
||||
|
||||
// Delete agent from visual console.
|
||||
db_process_sql_delete(
|
||||
'tlayout_data',
|
||||
['id_agent' => $id_agent]
|
||||
);
|
||||
|
||||
// Delete agent from visual dashboards.
|
||||
db_process_sql(
|
||||
'UPDATE twidget_dashboard
|
||||
SET options = NULL
|
||||
WHERE options LIKE ("%\"agentid\":\"'.$id_agent.'\"%")'
|
||||
);
|
||||
|
||||
// Delete agent from treport.
|
||||
db_process_sql_delete(
|
||||
'treport_content',
|
||||
['id_agent' => $id_agent]
|
||||
);
|
||||
|
||||
// Delete rules from tevent alerts (correlative alerts)
|
||||
db_process_sql_delete(
|
||||
'tevent_rule',
|
||||
[
|
||||
'agent' => $id_agent,
|
||||
'operator_agent' => '==',
|
||||
]
|
||||
);
|
||||
|
||||
db_process_sql_delete(
|
||||
'tevent_rule',
|
||||
[
|
||||
'log_agent' => $id_agent,
|
||||
'operator_log_agent' => '==',
|
||||
]
|
||||
);
|
||||
|
||||
// Delete from gis maps history
|
||||
db_process_sql_delete(
|
||||
'tgis_data_history',
|
||||
['tagente_id_agente' => $id_agent]
|
||||
);
|
||||
|
||||
// Delete from policies.
|
||||
db_process_sql_delete(
|
||||
'tpolicy_agents',
|
||||
['id_agent' => $id_agent]
|
||||
);
|
||||
|
||||
// Delete from tnetwork maps
|
||||
db_process_sql_delete(
|
||||
'titem',
|
||||
['source_data' => $id_agent]
|
||||
);
|
||||
|
||||
db_process_sql_delete(
|
||||
'trel_item',
|
||||
[
|
||||
'id_parent_source_data' => $id_agent,
|
||||
'id_child_source_data' => $id_agent,
|
||||
],
|
||||
'OR'
|
||||
);
|
||||
|
||||
// Delete agent from fav menu.
|
||||
db_process_sql_delete(
|
||||
'tfavmenu_user',
|
||||
[
|
||||
'id_element' => $id_agent,
|
||||
'section' => 'Agents',
|
||||
'id_user' => $config['id_user'],
|
||||
]
|
||||
);
|
||||
|
||||
// Break the loop on error.
|
||||
if ((bool) $error === true) {
|
||||
break;
|
||||
|
|
|
@ -2166,7 +2166,8 @@ function html_print_extended_select_for_time(
|
|||
$style_icon='',
|
||||
$no_change=false,
|
||||
$allow_zero=0,
|
||||
$units=null
|
||||
$units=null,
|
||||
$script_input=''
|
||||
) {
|
||||
global $config;
|
||||
$admin = is_user_admin($config['id_user']);
|
||||
|
@ -2256,7 +2257,7 @@ function html_print_extended_select_for_time(
|
|||
echo '</div>';
|
||||
|
||||
echo '<div id="'.$uniq_name.'_manual" class="w100p inline_flex">';
|
||||
html_print_input_text($uniq_name.'_text', $selected, '', $size, 255, false, $readonly, false, '', $class);
|
||||
html_print_input_text($uniq_name.'_text', $selected, '', $size, 255, false, $readonly, false, '', $class, $script_input);
|
||||
|
||||
html_print_input_hidden($name, $selected, false, $uniq_name);
|
||||
html_print_select(
|
||||
|
@ -5773,7 +5774,11 @@ function html_print_input($data, $wrapper='div', $input_only=false)
|
|||
((isset($data['class']) === true) ? $data['class'] : ''),
|
||||
((isset($data['readonly']) === true) ? $data['readonly'] : false),
|
||||
((isset($data['custom_fields']) === true) ? $data['custom_fields'] : false),
|
||||
((isset($data['style_icon']) === true) ? $data['style_icon'] : '')
|
||||
((isset($data['style_icon']) === true) ? $data['style_icon'] : ''),
|
||||
((isset($data['no_change']) === true) ? $data['no_change'] : ''),
|
||||
((isset($data['allow_zero']) === true) ? $data['allow_zero'] : ''),
|
||||
((isset($data['units']) === true) ? $data['units'] : null),
|
||||
((isset($data['script_input']) === true) ? $data['script_input'] : '')
|
||||
);
|
||||
break;
|
||||
|
||||
|
|
|
@ -956,11 +956,14 @@ if (is_ajax()) {
|
|||
$dialog = '
|
||||
<div id="about-tabs" class="invisible overflow-hidden">
|
||||
<ul>
|
||||
<li><a href="#tab-general-view">'.__('Information').'</a></li>
|
||||
<li><a href="#tab-database">'.__('Database').'</a></li>
|
||||
<li><a href="#tab-system-info">'.__('System Info').'</a></li>
|
||||
<li><a href="#tab-php-system">'.__('PHP System').'</a></li>
|
||||
<li class="ui-tabs-close-button" style="float:right!important;">
|
||||
<li><a href="#tab-general-view">'.__('Information').'</a></li>';
|
||||
if ((bool) check_acl($config['id_user'], 0, 'PM') === true || $config['is_admin']['admin'] === true) {
|
||||
$dialog .= '<li><a href="#tab-database">'.__('Database').'</a></li>
|
||||
<li><a href="#tab-system-info">'.__('System Info').'</a></li>
|
||||
<li><a href="#tab-php-system">'.__('PHP System').'</a></li>';
|
||||
}
|
||||
|
||||
$dialog .= '<li class="ui-tabs-close-button" style="float:right!important;">
|
||||
<img id="about-close" style="cursor: pointer;" src="'.ui_get_full_url('/include/styles/images/dialog-titlebar-close.png', false, false, false).'" alt="'.__('Close').'" title="'.__('Close').'" width="25px">
|
||||
</li>
|
||||
</ul>
|
||||
|
@ -992,7 +995,7 @@ if (is_ajax()) {
|
|||
$dialog .= '<p><b><a href="https://pandorafms.com/contact/" target="_blank">'.__('Contact Pandora FMS for official support contract.').'</a></b></p>';
|
||||
}
|
||||
|
||||
if (((bool) check_acl($config['id_user'], 0, 'PM') === true) && (is_metaconsole() === false)) {
|
||||
if (((bool) check_acl($config['id_user'], 0, 'PM') === true || $config['is_admin']['admin'] === true) && (is_metaconsole() === false)) {
|
||||
$dialogButtons = [];
|
||||
|
||||
$dialogButtons[] = html_print_button(
|
||||
|
@ -1034,222 +1037,224 @@ if (is_ajax()) {
|
|||
</tbody>
|
||||
</table>
|
||||
<p class="trademark-copyright">Trademark and copyright 2004 - '.date('Y').' <a href="https://pandorafms.com/" target="_blank">Pandora FMS</a>. All rights reserved</p>
|
||||
</div>
|
||||
<div id="tab-database" class="div-scroll">
|
||||
<table class="table-about">
|
||||
<tbody style="text-align: left;">
|
||||
<tr>
|
||||
<th colspan="2">
|
||||
<h2><span> - </span>'.__('Database health status').'</h2>
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th style="width: 50%;">
|
||||
<p><span>'.$db_health->data->unknownAgents->name.'</span></p>
|
||||
</th>
|
||||
<th style="width: 50%;">
|
||||
<p style="font-size: 10pt;">'.$db_health->data->unknownAgents->value.'</p>
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th style="width: 50%;">
|
||||
<p><span>'.$db_health->data->notInitAgents->name.'</span></p>
|
||||
</th>
|
||||
<th style="width: 50%;">
|
||||
<p style="font-size: 10pt;">'.$db_health->data->notInitAgents->value.'</p>
|
||||
</th>
|
||||
</tr>
|
||||
<tr class="about-last-tr">
|
||||
<th style="width: 50%;">
|
||||
<p class="about-last-p"><span>'.$db_health->data->pandoraDbLastRun->name.'</span></p>
|
||||
</th>
|
||||
<th style="width: 50%;">
|
||||
<p class="about-last-p" style="font-size: 10pt;">'.$db_health->data->pandoraDbLastRun->value.'</p>
|
||||
</th>
|
||||
</tr>
|
||||
</div>';
|
||||
if ((bool) check_acl($config['id_user'], 0, 'PM') === true || $config['is_admin']['admin'] === true) {
|
||||
$dialog .= '<div id="tab-database" class="div-scroll">
|
||||
<table class="table-about">
|
||||
<tbody style="text-align: left;">
|
||||
<tr>
|
||||
<th colspan="2">
|
||||
<h2><span> - </span>'.__('Database health status').'</h2>
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th style="width: 50%;">
|
||||
<p><span>'.$db_health->data->unknownAgents->name.'</span></p>
|
||||
</th>
|
||||
<th style="width: 50%;">
|
||||
<p style="font-size: 10pt;">'.$db_health->data->unknownAgents->value.'</p>
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th style="width: 50%;">
|
||||
<p><span>'.$db_health->data->notInitAgents->name.'</span></p>
|
||||
</th>
|
||||
<th style="width: 50%;">
|
||||
<p style="font-size: 10pt;">'.$db_health->data->notInitAgents->value.'</p>
|
||||
</th>
|
||||
</tr>
|
||||
<tr class="about-last-tr">
|
||||
<th style="width: 50%;">
|
||||
<p class="about-last-p"><span>'.$db_health->data->pandoraDbLastRun->name.'</span></p>
|
||||
</th>
|
||||
<th style="width: 50%;">
|
||||
<p class="about-last-p" style="font-size: 10pt;">'.$db_health->data->pandoraDbLastRun->value.'</p>
|
||||
</th>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th colspan="2">
|
||||
<h2><span> - </span>'.__('Database status info').'</h2>
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th style="width: 50%;">
|
||||
<p><span>'.$db_info->data->dbSchemeFirstVersion->name.'</span></p>
|
||||
</th>
|
||||
<th style="width: 50%;">
|
||||
<p style="font-size: 10pt;">'.$db_info->data->dbSchemeFirstVersion->value.'</p>
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th style="width: 50%;">
|
||||
<p><span>'.$db_info->data->dbSchemeVersion->name.'</span></p>
|
||||
</th>
|
||||
<th style="width: 50%;">
|
||||
<p style="font-size: 10pt;">'.$db_info->data->dbSchemeVersion->value.'</p>
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th style="width: 50%;">
|
||||
<p><span>'.$db_info->data->dbSchemeBuild->name.'</span></p>
|
||||
</th>
|
||||
<th style="width: 50%;">
|
||||
<p style="font-size: 10pt;">'.$db_info->data->dbSchemeBuild->value.'</p>
|
||||
</th>
|
||||
</tr>
|
||||
<tr class="about-last-tr">
|
||||
<th style="width: 50%;">
|
||||
<p class="about-last-p"><span>'.$db_info->data->dbSize->name.'</span></p>
|
||||
</th>
|
||||
<th style="width: 50%;">
|
||||
<p class="about-last-p" style="font-size: 10pt;">'.$db_info->data->dbSize->value.'</p>
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th colspan="2">
|
||||
<h2><span> - </span>'.__('Database status info').'</h2>
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th style="width: 50%;">
|
||||
<p><span>'.$db_info->data->dbSchemeFirstVersion->name.'</span></p>
|
||||
</th>
|
||||
<th style="width: 50%;">
|
||||
<p style="font-size: 10pt;">'.$db_info->data->dbSchemeFirstVersion->value.'</p>
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th style="width: 50%;">
|
||||
<p><span>'.$db_info->data->dbSchemeVersion->name.'</span></p>
|
||||
</th>
|
||||
<th style="width: 50%;">
|
||||
<p style="font-size: 10pt;">'.$db_info->data->dbSchemeVersion->value.'</p>
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th style="width: 50%;">
|
||||
<p><span>'.$db_info->data->dbSchemeBuild->name.'</span></p>
|
||||
</th>
|
||||
<th style="width: 50%;">
|
||||
<p style="font-size: 10pt;">'.$db_info->data->dbSchemeBuild->value.'</p>
|
||||
</th>
|
||||
</tr>
|
||||
<tr class="about-last-tr">
|
||||
<th style="width: 50%;">
|
||||
<p class="about-last-p"><span>'.$db_info->data->dbSize->name.'</span></p>
|
||||
</th>
|
||||
<th style="width: 50%;">
|
||||
<p class="about-last-p" style="font-size: 10pt;">'.$db_info->data->dbSize->value.'</p>
|
||||
</th>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th colspan="2">
|
||||
<h2><span> - </span>'.__('Tables fragmentation in the %s database', $product_name).'</h2>
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th style="width: 50%;">
|
||||
<p><span>'.$db_fragmentation->data->tablesFragmentationMax->name.'</span></p>
|
||||
</th>
|
||||
<th style="width: 50%;">
|
||||
<p style="font-size: 10pt;">'.$db_fragmentation->data->tablesFragmentationMax->value.'</p>
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th style="width: 50%;">
|
||||
<p><span>'.$db_fragmentation->data->tablesFragmentationValue->name.'</span></p>
|
||||
</th>
|
||||
<th style="width: 50%;">
|
||||
<p style="font-size: 10pt;">'.$db_fragmentation->data->tablesFragmentationValue->value.'</p>
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th style="width: 50%;">
|
||||
<p><span>'.$db_fragmentation->data->tablesFragmentationStatus->name.'</span></p>
|
||||
</th>
|
||||
<th style="width: 50%;">
|
||||
<p>'.$fragmentation_status.'</p>
|
||||
</th>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<tr>
|
||||
<th colspan="2">
|
||||
<h2><span> - </span>'.__('Tables fragmentation in the %s database', $product_name).'</h2>
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th style="width: 50%;">
|
||||
<p><span>'.$db_fragmentation->data->tablesFragmentationMax->name.'</span></p>
|
||||
</th>
|
||||
<th style="width: 50%;">
|
||||
<p style="font-size: 10pt;">'.$db_fragmentation->data->tablesFragmentationMax->value.'</p>
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th style="width: 50%;">
|
||||
<p><span>'.$db_fragmentation->data->tablesFragmentationValue->name.'</span></p>
|
||||
</th>
|
||||
<th style="width: 50%;">
|
||||
<p style="font-size: 10pt;">'.$db_fragmentation->data->tablesFragmentationValue->value.'</p>
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th style="width: 50%;">
|
||||
<p><span>'.$db_fragmentation->data->tablesFragmentationStatus->name.'</span></p>
|
||||
</th>
|
||||
<th style="width: 50%;">
|
||||
<p>'.$fragmentation_status.'</p>
|
||||
</th>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div id="tab-system-info">
|
||||
<table class="table-about">
|
||||
<tbody style="text-align: left;">
|
||||
<tr>
|
||||
<th colspan="2">
|
||||
<h2><span> - </span>'.__('System Info').'</h2>
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th style="width: 30%;">
|
||||
<p><span>'.$sys_info->data->cpuInfo->name.'</span></p>
|
||||
</th>
|
||||
<th style="width: 85%;">
|
||||
<p style="font-size: 10pt;">'.$sys_info->data->cpuInfo->value.'</p>
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th style="width: 15%;">
|
||||
<p><span>'.$sys_info->data->ramInfo->name.'</span></p>
|
||||
</th>
|
||||
<th style="width: 85%;">
|
||||
<p style="font-size: 10pt;">'.$sys_info->data->ramInfo->value.'</p>
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th style="width: 15%;">
|
||||
<p><span>'.$sys_info->data->osInfo->name.'</span></p>
|
||||
</th>
|
||||
<th style="width: 85%;">
|
||||
<p style="font-size: 10pt;">'.$sys_info->data->osInfo->value.'</p>
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th style="width: 15%;">
|
||||
<p><span>'.$sys_info->data->hostnameInfo->name.'</span></p>
|
||||
</th>
|
||||
<th style="width: 85%;">
|
||||
<p style="font-size: 10pt;">'.$sys_info->data->hostnameInfo->value.'</p>
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th style="width: 15%;">
|
||||
<p><span>'.$sys_info->data->ipInfo->name.'</span></p>
|
||||
</th>
|
||||
<th style="width: 85%;">
|
||||
<p style="font-size: 10pt;">'.$sys_info->data->ipInfo->value.'</p>
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th style="width: 15%;">
|
||||
<p><span>'.$system_date->data->date->name.'</span></p>
|
||||
</th>
|
||||
<th style="width: 85%;">
|
||||
<p style="font-size: 10pt;">'.$system_date->data->date->value.'</p>
|
||||
</th>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div id="tab-php-system">
|
||||
<table class="table-about">
|
||||
<tbody style="text-align: left;">
|
||||
<tr>
|
||||
<th colspan="2">
|
||||
<h2><span> - </span>'.__('PHP system').'</h2>
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th style="width: 50%;">
|
||||
<p><span>'.$php_sys->data->phpVersion->name.'</span></p>
|
||||
</th>
|
||||
<th style="width: 65%;">
|
||||
<p style="font-size: 10pt;">'.$php_sys->data->phpVersion->value.'</p>
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th style="width: 35%;">
|
||||
<p><span>'.$php_sys->data->maxExecutionTime->name.'</span></p>
|
||||
</th>
|
||||
<th style="width: 65%;">
|
||||
<p style="font-size: 10pt;">'.$php_sys->data->maxExecutionTime->value.'</p>
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th style="width: 35%;">
|
||||
<p><span>'.$php_sys->data->maxInputTime->name.'</span></p>
|
||||
</th>
|
||||
<th style="width: 65%;">
|
||||
<p style="font-size: 10pt;">'.$php_sys->data->maxInputTime->value.'</p>
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th style="width: 35%;">
|
||||
<p><span>'.$php_sys->data->memoryLimit->name.'</span></p>
|
||||
</th>
|
||||
<th style="width: 65%;">
|
||||
<p style="font-size: 10pt;">'.$php_sys->data->memoryLimit->value.'</p>
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th style="width: 35%;">
|
||||
<p><span>'.$php_sys->data->sessionLifetime->name.'</span></p>
|
||||
</th>
|
||||
<th style="width: 65%;">
|
||||
<p style="font-size: 10pt;">'.$php_sys->data->sessionLifetime->value.'</p>
|
||||
</th>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div id="tab-system-info">
|
||||
<table class="table-about">
|
||||
<tbody style="text-align: left;">
|
||||
<tr>
|
||||
<th colspan="2">
|
||||
<h2><span> - </span>'.__('System Info').'</h2>
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th style="width: 30%;">
|
||||
<p><span>'.$sys_info->data->cpuInfo->name.'</span></p>
|
||||
</th>
|
||||
<th style="width: 85%;">
|
||||
<p style="font-size: 10pt;">'.$sys_info->data->cpuInfo->value.'</p>
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th style="width: 15%;">
|
||||
<p><span>'.$sys_info->data->ramInfo->name.'</span></p>
|
||||
</th>
|
||||
<th style="width: 85%;">
|
||||
<p style="font-size: 10pt;">'.$sys_info->data->ramInfo->value.'</p>
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th style="width: 15%;">
|
||||
<p><span>'.$sys_info->data->osInfo->name.'</span></p>
|
||||
</th>
|
||||
<th style="width: 85%;">
|
||||
<p style="font-size: 10pt;">'.$sys_info->data->osInfo->value.'</p>
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th style="width: 15%;">
|
||||
<p><span>'.$sys_info->data->hostnameInfo->name.'</span></p>
|
||||
</th>
|
||||
<th style="width: 85%;">
|
||||
<p style="font-size: 10pt;">'.$sys_info->data->hostnameInfo->value.'</p>
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th style="width: 15%;">
|
||||
<p><span>'.$sys_info->data->ipInfo->name.'</span></p>
|
||||
</th>
|
||||
<th style="width: 85%;">
|
||||
<p style="font-size: 10pt;">'.$sys_info->data->ipInfo->value.'</p>
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th style="width: 15%;">
|
||||
<p><span>'.$system_date->data->date->name.'</span></p>
|
||||
</th>
|
||||
<th style="width: 85%;">
|
||||
<p style="font-size: 10pt;">'.$system_date->data->date->value.'</p>
|
||||
</th>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div id="tab-php-system">
|
||||
<table class="table-about">
|
||||
<tbody style="text-align: left;">
|
||||
<tr>
|
||||
<th colspan="2">
|
||||
<h2><span> - </span>'.__('PHP system').'</h2>
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th style="width: 50%;">
|
||||
<p><span>'.$php_sys->data->phpVersion->name.'</span></p>
|
||||
</th>
|
||||
<th style="width: 65%;">
|
||||
<p style="font-size: 10pt;">'.$php_sys->data->phpVersion->value.'</p>
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th style="width: 35%;">
|
||||
<p><span>'.$php_sys->data->maxExecutionTime->name.'</span></p>
|
||||
</th>
|
||||
<th style="width: 65%;">
|
||||
<p style="font-size: 10pt;">'.$php_sys->data->maxExecutionTime->value.'</p>
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th style="width: 35%;">
|
||||
<p><span>'.$php_sys->data->maxInputTime->name.'</span></p>
|
||||
</th>
|
||||
<th style="width: 65%;">
|
||||
<p style="font-size: 10pt;">'.$php_sys->data->maxInputTime->value.'</p>
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th style="width: 35%;">
|
||||
<p><span>'.$php_sys->data->memoryLimit->name.'</span></p>
|
||||
</th>
|
||||
<th style="width: 65%;">
|
||||
<p style="font-size: 10pt;">'.$php_sys->data->memoryLimit->value.'</p>
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th style="width: 35%;">
|
||||
<p><span>'.$php_sys->data->sessionLifetime->name.'</span></p>
|
||||
</th>
|
||||
<th style="width: 65%;">
|
||||
<p style="font-size: 10pt;">'.$php_sys->data->sessionLifetime->value.'</p>
|
||||
</th>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
';
|
||||
';
|
||||
}
|
||||
|
||||
echo $dialog;
|
||||
}
|
||||
|
|
|
@ -2554,6 +2554,7 @@ function visual_map_process_wizard_add(
|
|||
$image,
|
||||
$id_layout,
|
||||
$range,
|
||||
$range_vertical,
|
||||
$width=0,
|
||||
$height=0,
|
||||
$period='',
|
||||
|
@ -2562,7 +2563,10 @@ function visual_map_process_wizard_add(
|
|||
$max_value=0,
|
||||
$type_percentile='',
|
||||
$value_show='',
|
||||
$type=''
|
||||
$type='',
|
||||
$pos_x=10,
|
||||
$pos_y=10,
|
||||
$max_elements_row=0
|
||||
) {
|
||||
if (empty($id_agents)) {
|
||||
print_error_message(__('No agents selected'));
|
||||
|
@ -2572,14 +2576,9 @@ function visual_map_process_wizard_add(
|
|||
$id_agents = (array) $id_agents;
|
||||
|
||||
$error = false;
|
||||
$pos_y = 10;
|
||||
$pos_x = 10;
|
||||
$elements_row = 1;
|
||||
$initial_x = $pos_x;
|
||||
foreach ($id_agents as $id_agent) {
|
||||
if ($pos_x > 600) {
|
||||
$pos_x = 10;
|
||||
$pos_y = ($pos_y + $range);
|
||||
}
|
||||
|
||||
$value_height = $height;
|
||||
$value_image = $image;
|
||||
$value_type = $type;
|
||||
|
@ -2628,7 +2627,14 @@ function visual_map_process_wizard_add(
|
|||
|
||||
db_process_sql_insert('tlayout_data', $values);
|
||||
|
||||
$pos_x = ($pos_x + $range);
|
||||
if (($max_elements_row === $elements_row) && $max_elements_row !== 0) {
|
||||
$elements_row = 1;
|
||||
$pos_x = $initial_x;
|
||||
$pos_y = ($range_vertical + $pos_y);
|
||||
} else {
|
||||
$pos_x = ($pos_x + $range);
|
||||
$elements_row++;
|
||||
}
|
||||
}
|
||||
|
||||
$return = ui_print_success_message(__('Agent successfully added to layout'), '', true);
|
||||
|
@ -2654,6 +2660,7 @@ function visual_map_process_wizard_add_modules(
|
|||
$image,
|
||||
$id_layout,
|
||||
$range,
|
||||
$range_vertical,
|
||||
$width,
|
||||
$height,
|
||||
$period,
|
||||
|
@ -2669,7 +2676,10 @@ function visual_map_process_wizard_add_modules(
|
|||
$kind_relationship=VISUAL_MAP_WIZARD_PARENTS_NONE,
|
||||
$item_in_the_map=0,
|
||||
$fontf='lato',
|
||||
$fonts='12pt'
|
||||
$fonts='12pt',
|
||||
$pos_x=10,
|
||||
$pos_y=10,
|
||||
$max_elements_row=0
|
||||
) {
|
||||
if (empty($width) === true) {
|
||||
$width = 0;
|
||||
|
@ -2691,15 +2701,9 @@ function visual_map_process_wizard_add_modules(
|
|||
$id_modules = (array) $id_modules;
|
||||
|
||||
$error = false;
|
||||
$pos_y = 10;
|
||||
$pos_x = 10;
|
||||
|
||||
$elements_row = 1;
|
||||
$initial_x = $pos_x;
|
||||
foreach ($id_modules as $id_module) {
|
||||
if ($pos_x > 600) {
|
||||
$pos_x = 10;
|
||||
$pos_y = ($pos_y + $range);
|
||||
}
|
||||
|
||||
if ($id_server != 0) {
|
||||
$connection = db_get_row_filter(
|
||||
'tmetaconsole_setup',
|
||||
|
@ -2820,7 +2824,14 @@ function visual_map_process_wizard_add_modules(
|
|||
|
||||
db_process_sql_insert('tlayout_data', $values);
|
||||
|
||||
$pos_x = ($pos_x + $range);
|
||||
if (($max_elements_row === $elements_row) && $max_elements_row !== 0) {
|
||||
$elements_row = 1;
|
||||
$pos_x = $initial_x;
|
||||
$pos_y = ($range_vertical + $pos_y);
|
||||
} else {
|
||||
$pos_x = ($pos_x + $range);
|
||||
$elements_row++;
|
||||
}
|
||||
}
|
||||
|
||||
$return = ui_print_success_message(__('Modules successfully added to layout'), '', true);
|
||||
|
@ -2885,6 +2896,7 @@ function visual_map_process_wizard_add_agents(
|
|||
$image,
|
||||
$id_layout,
|
||||
$range,
|
||||
$range_vertical,
|
||||
$width,
|
||||
$height,
|
||||
$period,
|
||||
|
@ -2900,7 +2912,10 @@ function visual_map_process_wizard_add_agents(
|
|||
$kind_relationship=VISUAL_MAP_WIZARD_PARENTS_NONE,
|
||||
$item_in_the_map=0,
|
||||
$fontf='lato',
|
||||
$fonts='12pt'
|
||||
$fonts='12pt',
|
||||
$pos_x=10,
|
||||
$pos_y=10,
|
||||
$max_elements_row=0
|
||||
) {
|
||||
global $config;
|
||||
|
||||
|
@ -2925,9 +2940,8 @@ function visual_map_process_wizard_add_agents(
|
|||
$id_agents = (array) $id_agents;
|
||||
|
||||
$error = false;
|
||||
$pos_y = 10;
|
||||
$pos_x = 10;
|
||||
|
||||
$elements_row = 1;
|
||||
$initial_x = $pos_x;
|
||||
$relationship = true;
|
||||
$relationships_agents = [];
|
||||
// Check if the set a none relationship
|
||||
|
@ -2945,11 +2959,6 @@ function visual_map_process_wizard_add_agents(
|
|||
$id_agent = $id_a;
|
||||
}
|
||||
|
||||
if ($pos_x > 600) {
|
||||
$pos_x = 10;
|
||||
$pos_y = ($pos_y + $range);
|
||||
}
|
||||
|
||||
$value_height = $height;
|
||||
$value_image = $image;
|
||||
$value_type = $type;
|
||||
|
@ -3061,6 +3070,15 @@ function visual_map_process_wizard_add_agents(
|
|||
|
||||
$id_item = db_process_sql_insert('tlayout_data', $values);
|
||||
|
||||
if (($max_elements_row === $elements_row) && $max_elements_row !== 0) {
|
||||
$elements_row = 1;
|
||||
$pos_x = $initial_x;
|
||||
$pos_y = ($range_vertical + $pos_y);
|
||||
} else {
|
||||
$pos_x = ($pos_x + $range);
|
||||
$elements_row++;
|
||||
}
|
||||
|
||||
if ($relationship) {
|
||||
switch ($kind_relationship) {
|
||||
case VISUAL_MAP_WIZARD_PARENTS_AGENT_RELANTIONSHIP:
|
||||
|
@ -3093,8 +3111,6 @@ function visual_map_process_wizard_add_agents(
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$pos_x = ($pos_x + $range);
|
||||
}
|
||||
|
||||
foreach ($relationships_agents as $relationship_item) {
|
||||
|
|
|
@ -2487,3 +2487,39 @@ function menuActionButtonResizing() {
|
|||
"width: calc(100% - " + $("#menu_full").width() + "px);"
|
||||
);
|
||||
}
|
||||
|
||||
function check_period_warning(time, title, message) {
|
||||
var period = time.value;
|
||||
var times = 0;
|
||||
if (period >= 2592000 && period < 7776000) {
|
||||
WarningPeriodicityModal(title, message);
|
||||
} else if (period >= 7776000 && period < 15552000) {
|
||||
do {
|
||||
WarningPeriodicityModal(title, message);
|
||||
times = times + 1;
|
||||
} while (times < 2);
|
||||
} else if (period >= 15552000) {
|
||||
do {
|
||||
WarningPeriodicityModal(title, message);
|
||||
times = times + 1;
|
||||
} while (times < 3);
|
||||
}
|
||||
}
|
||||
|
||||
function check_period_warning_manual(input_name, title, message) {
|
||||
var period = {
|
||||
value:
|
||||
$("#text-" + input_name + "_text").val() *
|
||||
$("#" + input_name + "_units option:selected").val()
|
||||
};
|
||||
check_period_warning(period, title, message);
|
||||
}
|
||||
|
||||
function WarningPeriodicityModal(title, message) {
|
||||
confirmDialog({
|
||||
title: title,
|
||||
message: message,
|
||||
strCancelButton: "Ok",
|
||||
hideOkButton: 1
|
||||
});
|
||||
}
|
||||
|
|
|
@ -421,6 +421,8 @@ class BasicChart extends Widget
|
|||
'nothing' => __('None'),
|
||||
'nothing_value' => 0,
|
||||
'style_icon' => 'flex-grow: 0',
|
||||
'script' => 'check_period_warning(this, \''.__('Warning').'\', \''.__('Displaying items with extended historical data can have an impact on system performance. We do not recommend that you use intervals longer than 30 days, especially if you combine several of them in a report, dashboard or visual console.').'\')',
|
||||
'script_input' => 'check_period_warning_manual(\'period\', \''.__('Warning').'\', \''.__('Displaying items with extended historical data can have an impact on system performance. We do not recommend that you use intervals longer than 30 days, especially if you combine several of them in a report, dashboard or visual console.').'\')',
|
||||
],
|
||||
];
|
||||
|
||||
|
|
|
@ -304,7 +304,8 @@ class BlockHistogram extends Widget
|
|||
'nothing' => __('None'),
|
||||
'nothing_value' => 0,
|
||||
'style_icon' => 'flex-grow: 0',
|
||||
|
||||
'script' => 'check_period_warning(this, \''.__('Warning').'\', \''.__('Displaying items with extended historical data can have an impact on system performance. We do not recommend that you use intervals longer than 30 days, especially if you combine several of them in a report, dashboard or visual console.').'\')',
|
||||
'script_input' => 'check_period_warning_manual(\'period\', \''.__('Warning').'\', \''.__('Displaying items with extended historical data can have an impact on system performance. We do not recommend that you use intervals longer than 30 days, especially if you combine several of them in a report, dashboard or visual console.').'\')',
|
||||
],
|
||||
];
|
||||
|
||||
|
|
|
@ -308,6 +308,8 @@ class DataMatrix extends Widget
|
|||
'nothing' => __('None'),
|
||||
'nothing_value' => 0,
|
||||
'style_icon' => 'flex-grow: 0',
|
||||
'script' => 'check_period_warning(this, \''.__('Warning').'\', \''.__('Displaying items with extended historical data can have an impact on system performance. We do not recommend that you use intervals longer than 30 days, especially if you combine several of them in a report, dashboard or visual console.').'\')',
|
||||
'script_input' => 'check_period_warning_manual(\'period\', \''.__('Warning').'\', \''.__('Displaying items with extended historical data can have an impact on system performance. We do not recommend that you use intervals longer than 30 days, especially if you combine several of them in a report, dashboard or visual console.').'\')',
|
||||
],
|
||||
];
|
||||
|
||||
|
@ -324,6 +326,8 @@ class DataMatrix extends Widget
|
|||
'nothing' => __('None'),
|
||||
'nothing_value' => 0,
|
||||
'style_icon' => 'flex-grow: 0',
|
||||
'script' => 'check_period_warning(this, \''.__('Warning').'\', \''.__('Displaying items with extended historical data can have an impact on system performance. We do not recommend that you use intervals longer than 30 days, especially if you combine several of them in a report, dashboard or visual console.').'\')',
|
||||
'script_input' => 'check_period_warning_manual(\'slice\', \''.__('Warning').'\', \''.__('Displaying items with extended historical data can have an impact on system performance. We do not recommend that you use intervals longer than 30 days, especially if you combine several of them in a report, dashboard or visual console.').'\')',
|
||||
],
|
||||
];
|
||||
|
||||
|
|
|
@ -392,6 +392,8 @@ class CustomGraphWidget extends Widget
|
|||
'nothing' => __('None'),
|
||||
'nothing_value' => 0,
|
||||
'style_icon' => 'flex-grow: 0',
|
||||
'script' => 'check_period_warning(this, \''.__('Warning').'\', \''.__('Displaying items with extended historical data can have an impact on system performance. We do not recommend that you use intervals longer than 30 days, especially if you combine several of them in a report, dashboard or visual console.').'\')',
|
||||
'script_input' => 'check_period_warning_manual(\'period\', \''.__('Warning').'\', \''.__('Displaying items with extended historical data can have an impact on system performance. We do not recommend that you use intervals longer than 30 days, especially if you combine several of them in a report, dashboard or visual console.').'\')',
|
||||
],
|
||||
];
|
||||
|
||||
|
|
|
@ -367,6 +367,8 @@ class GraphModuleHistogramWidget extends Widget
|
|||
'nothing' => __('None'),
|
||||
'nothing_value' => 0,
|
||||
'style_icon' => 'flex-grow: 0',
|
||||
'script' => 'check_period_warning(this, \''.__('Warning').'\', \''.__('Displaying items with extended historical data can have an impact on system performance. We do not recommend that you use intervals longer than 30 days, especially if you combine several of them in a report, dashboard or visual console.').'\')',
|
||||
'script_input' => 'check_period_warning_manual(\'period\', \''.__('Warning').'\', \''.__('Displaying items with extended historical data can have an impact on system performance. We do not recommend that you use intervals longer than 30 days, especially if you combine several of them in a report, dashboard or visual console.').'\')',
|
||||
|
||||
],
|
||||
];
|
||||
|
|
|
@ -205,6 +205,8 @@ class Netflow extends Widget
|
|||
'nothing' => __('None'),
|
||||
'nothing_value' => 0,
|
||||
'style_icon' => 'flex-grow: 0',
|
||||
'script' => 'check_period_warning(this, \''.__('Warning').'\', \''.__('Displaying items with extended historical data can have an impact on system performance. We do not recommend that you use intervals longer than 30 days, especially if you combine several of them in a report, dashboard or visual console.').'\')',
|
||||
'script_input' => 'check_period_warning_manual(\'period\', \''.__('Warning').'\', \''.__('Displaying items with extended historical data can have an impact on system performance. We do not recommend that you use intervals longer than 30 days, especially if you combine several of them in a report, dashboard or visual console.').'\')',
|
||||
],
|
||||
];
|
||||
$chart_types = netflow_get_chart_types();
|
||||
|
|
|
@ -352,6 +352,8 @@ class SingleGraphWidget extends Widget
|
|||
'nothing' => __('None'),
|
||||
'nothing_value' => 0,
|
||||
'style_icon' => 'flex-grow: 0',
|
||||
'script' => 'check_period_warning(this, \''.__('Warning').'\', \''.__('Displaying items with extended historical data can have an impact on system performance. We do not recommend that you use intervals longer than 30 days, especially if you combine several of them in a report, dashboard or visual console.').'\')',
|
||||
'script_input' => 'check_period_warning_manual(\'period\', \''.__('Warning').'\', \''.__('Displaying items with extended historical data can have an impact on system performance. We do not recommend that you use intervals longer than 30 days, especially if you combine several of them in a report, dashboard or visual console.').'\')',
|
||||
],
|
||||
];
|
||||
|
||||
|
|
|
@ -381,6 +381,8 @@ class SLAPercentWidget extends Widget
|
|||
'nothing' => __('None'),
|
||||
'nothing_value' => 0,
|
||||
'style_icon' => 'flex-grow: 0',
|
||||
'script' => 'check_period_warning(this, \''.__('Warning').'\', \''.__('Displaying items with extended historical data can have an impact on system performance. We do not recommend that you use intervals longer than 30 days, especially if you combine several of them in a report, dashboard or visual console.').'\')',
|
||||
'script_input' => 'check_period_warning_manual(\'period\', \''.__('Warning').'\', \''.__('Displaying items with extended historical data can have an impact on system performance. We do not recommend that you use intervals longer than 30 days, especially if you combine several of them in a report, dashboard or visual console.').'\')',
|
||||
],
|
||||
];
|
||||
|
||||
|
|
|
@ -260,6 +260,8 @@ class TopNWidget extends Widget
|
|||
'nothing' => __('None'),
|
||||
'nothing_value' => 0,
|
||||
'style_icon' => 'flex-grow: 0',
|
||||
'script' => 'check_period_warning(this, \''.__('Warning').'\', \''.__('Displaying items with extended historical data can have an impact on system performance. We do not recommend that you use intervals longer than 30 days, especially if you combine several of them in a report, dashboard or visual console.').'\')',
|
||||
'script_input' => 'check_period_warning_manual(\'period\', \''.__('Warning').'\', \''.__('Displaying items with extended historical data can have an impact on system performance. We do not recommend that you use intervals longer than 30 days, especially if you combine several of them in a report, dashboard or visual console.').'\')',
|
||||
],
|
||||
];
|
||||
|
||||
|
|
|
@ -317,6 +317,8 @@ final class BasicChart extends Item
|
|||
'value' => $values['period'],
|
||||
'nothing' => __('None'),
|
||||
'nothing_value' => 0,
|
||||
'script' => 'check_period_warning(this, \''.__('Warning').'\', \''.__('Displaying items with extended historical data can have an impact on system performance. We do not recommend that you use intervals longer than 30 days, especially if you combine several of them in a report, dashboard or visual console.').'\')',
|
||||
'script_input' => 'check_period_warning_manual(\'period\', \''.__('Warning').'\', \''.__('Displaying items with extended historical data can have an impact on system performance. We do not recommend that you use intervals longer than 30 days, especially if you combine several of them in a report, dashboard or visual console.').'\')',
|
||||
],
|
||||
];
|
||||
|
||||
|
|
|
@ -633,6 +633,8 @@ final class ModuleGraph extends Item
|
|||
'value' => $values['period'],
|
||||
'nothing' => __('None'),
|
||||
'nothing_value' => 0,
|
||||
'script' => 'check_period_warning(this, \''.__('Warning').'\', \''.__('Displaying items with extended historical data can have an impact on system performance. We do not recommend that you use intervals longer than 30 days, especially if you combine several of them in a report, dashboard or visual console.').'\')',
|
||||
'script_input' => 'check_period_warning_manual(\'period\', \''.__('Warning').'\', \''.__('Displaying items with extended historical data can have an impact on system performance. We do not recommend that you use intervals longer than 30 days, especially if you combine several of them in a report, dashboard or visual console.').'\')',
|
||||
],
|
||||
];
|
||||
|
||||
|
|
|
@ -7092,6 +7092,10 @@ div.graph div.legend table {
|
|||
margin-top: -10px;
|
||||
}
|
||||
|
||||
.mrgn_top-15px {
|
||||
margin-top: -15px;
|
||||
}
|
||||
|
||||
.mrgn_top_0px {
|
||||
margin-top: 0px;
|
||||
}
|
||||
|
|
|
@ -130,8 +130,8 @@
|
|||
</div>
|
||||
<div style='padding-bottom: 50px'>
|
||||
<?php
|
||||
$version = '7.0NG.773.1';
|
||||
$build = '230822';
|
||||
$version = '7.0NG.773.2';
|
||||
$build = '230823';
|
||||
$banner = "v$version Build $build";
|
||||
error_reporting(0);
|
||||
|
||||
|
|
|
@ -233,7 +233,25 @@ $table->data[2][2] .= html_print_image(
|
|||
|
||||
$table->data[3][1] = __('Time range');
|
||||
|
||||
$table->data[3][2] = html_print_extended_select_for_time('period', $period, '', '', 0, 7, true);
|
||||
$table->data[3][2] = html_print_extended_select_for_time(
|
||||
'period',
|
||||
$period,
|
||||
'check_period_warning(this, \''.__('Warning').'\', \''.__('Displaying items with extended historical data can have an impact on system performance. We do not recommend that you use intervals longer than 30 days, especially if you combine several of them in a report, dashboard or visual console.').'\')',
|
||||
'',
|
||||
0,
|
||||
7,
|
||||
true,
|
||||
false,
|
||||
true,
|
||||
'',
|
||||
false,
|
||||
false,
|
||||
'',
|
||||
false,
|
||||
0,
|
||||
null,
|
||||
'check_period_warning_manual(\'period\', \''.__('Warning').'\', \''.__('Displaying items with extended historical data can have an impact on system performance. We do not recommend that you use intervals longer than 30 days, especially if you combine several of them in a report, dashboard or visual console.').'\')'
|
||||
);
|
||||
|
||||
$table->data[4][2] = __('Show events');
|
||||
$table->data[4][3] = html_print_checkbox('draw_events', 1, (bool) $draw_events, true);
|
||||
|
|
|
@ -344,7 +344,25 @@ if ($view_graph) {
|
|||
$searchForm .= "<td class='datos w30p'>";
|
||||
$searchForm .= html_print_label_input_block(
|
||||
__('Time range'),
|
||||
html_print_extended_select_for_time('period', (string) $period, '', '', 0, 10, true, 'width:100%')
|
||||
html_print_extended_select_for_time(
|
||||
'period',
|
||||
(string) $period,
|
||||
'check_period_warning(this, \''.__('Warning').'\', \''.__('Displaying items with extended historical data can have an impact on system performance. We do not recommend that you use intervals longer than 30 days, especially if you combine several of them in a report, dashboard or visual console.').'\')',
|
||||
'',
|
||||
0,
|
||||
10,
|
||||
true,
|
||||
'width:100%',
|
||||
true,
|
||||
'',
|
||||
false,
|
||||
false,
|
||||
'',
|
||||
false,
|
||||
0,
|
||||
null,
|
||||
'check_period_warning_manual(\'period\', \''.__('Warning').'\', \''.__('Displaying items with extended historical data can have an impact on system performance. We do not recommend that you use intervals longer than 30 days, especially if you combine several of them in a report, dashboard or visual console.').'\')'
|
||||
)
|
||||
);
|
||||
$searchForm .= '</td>';
|
||||
$searchForm .= '</tr><tr>';
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
# Pandora FMS Console
|
||||
#
|
||||
%define name pandorafms_console
|
||||
%define version 7.0NG.773.1
|
||||
%define release 230822
|
||||
%define version 7.0NG.773.2
|
||||
%define release 1
|
||||
|
||||
# User and Group under which Apache is running
|
||||
%define httpd_name httpd
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
# Pandora FMS Console
|
||||
#
|
||||
%define name pandorafms_console
|
||||
%define version 7.0NG.773.1
|
||||
%define release 230822
|
||||
%define version 7.0NG.773.2
|
||||
%define release 1
|
||||
|
||||
# User and Group under which Apache is running
|
||||
%define httpd_name httpd
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
# Pandora FMS Console
|
||||
#
|
||||
%define name pandorafms_console
|
||||
%define version 7.0NG.773.1
|
||||
%define release 230822
|
||||
%define version 7.0NG.773.2
|
||||
%define release 1
|
||||
%define httpd_name httpd
|
||||
# User and Group under which Apache is running
|
||||
%define httpd_name apache2
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
# This code is licensed under GPL 2.0 license.
|
||||
# **********************************************************************
|
||||
|
||||
PI_VERSION="7.0NG.773.1"
|
||||
PI_VERSION="7.0NG.773.2"
|
||||
FORCE=0
|
||||
DESTDIR=""
|
||||
LOG_TIMESTAMP=`date +"%Y/%m/%d %H:%M:%S"`
|
||||
|
|
|
@ -709,9 +709,9 @@ class Client
|
|||
|
||||
$target = '';
|
||||
if ($request['action'] === 'get_server_package') {
|
||||
$target = __('server update %d', $request['version']);
|
||||
$target = __('server update %s', $request['version']);
|
||||
} else if ($request['action'] === 'get_package') {
|
||||
$target = __('console update %d', $request['version']);
|
||||
$target = __('console update %s', $request['version']);
|
||||
}
|
||||
|
||||
// phpcs:disable Generic.CodeAnalysis.UnusedFunctionParameter.Found
|
||||
|
@ -2134,7 +2134,7 @@ class Client
|
|||
|
||||
if ($package === null) {
|
||||
// Retrieve package from UMS.
|
||||
$this->notify(0, 'Downloading server update '.$version.'.');
|
||||
$this->notify(0, 'Downloading server update '.$version);
|
||||
$file = $this->post(
|
||||
[
|
||||
'action' => 'get_server_package',
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
package: pandorafms-server
|
||||
Version: 7.0NG.773.1-230822
|
||||
Version: 7.0NG.773.2
|
||||
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.1-230822"
|
||||
pandora_version="7.0NG.773.2"
|
||||
|
||||
package_cpan=0
|
||||
package_pandora=1
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#############################################################################
|
||||
# Pandora FMS Server Parameters
|
||||
# Pandora FMS, the Flexible Monitoring System.
|
||||
# Version 7.0NG.773.1
|
||||
# Version 7.0NG.773.2
|
||||
# Licensed under GPL license v2,
|
||||
# (c) 2003-2023 Pandora FMS
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -0,0 +1,84 @@
|
|||
# Python: module plugintools for PandoraFMS Developers
|
||||
|
||||
pandoraPluginTools is a library that aims to help the creation of scripts and their integration in Pandora FMS.
|
||||
|
||||
[PluginTools Reference Documentation](https://pandorafms.com/guides/public/books/plugintools)
|
||||
|
||||
The package includes the following modules. Each one has different functions that facilitate and automate the data integration in Pandora FMS:
|
||||
|
||||
**general**
|
||||
Module containing general purpose functions, useful in the creation of plugins for PandoraFMS.
|
||||
|
||||
**threads**
|
||||
Module containing threading purpose functions, useful to run parallel functions.
|
||||
|
||||
**agents**
|
||||
Module that contains functions oriented to the creation of Pandora FMS agents
|
||||
|
||||
**modules**
|
||||
Module that contains functions oriented to the creation of Pandora FMS modules.
|
||||
|
||||
**transfer**
|
||||
Module containing functions oriented to file transfer and data sending to Pandora FMS server.
|
||||
|
||||
**discovery**
|
||||
Module containing functions oriented to the creation of Pandora FMS discovery plugins.
|
||||
|
||||
**http**
|
||||
Module containing functions oriented to HTTP API calls.
|
||||
|
||||
## Example
|
||||
|
||||
``` python
|
||||
import pandoraPluginTools as ppt
|
||||
|
||||
## Define agent
|
||||
server_name = "WIN-SERV"
|
||||
|
||||
agent=ppt.init_agent({
|
||||
"agent_name" : ppt.generate_md5(server_name),
|
||||
"agent_alias" : server_name,
|
||||
"description" : "Default Windows server"
|
||||
})
|
||||
|
||||
## Define modules
|
||||
modules=[]
|
||||
|
||||
data = 10
|
||||
modules.append({
|
||||
"name" : "CPU usage",
|
||||
"type" : "generic_data",
|
||||
"value": data,
|
||||
"desc" : "Percentage of CPU utilization",
|
||||
"unit" : "%"
|
||||
})
|
||||
|
||||
## Generate and transfer XML
|
||||
xml_content = ppt.print_agent(agent, modules)
|
||||
xml_file = ppt.write_xml(xml_content, agent["agent_name"])
|
||||
ppt.transfer_xml(
|
||||
xml_file,
|
||||
transfer_mode="tentacle",
|
||||
tentacle_ip="192.168.1.20",
|
||||
tentacle_port="41121",
|
||||
)
|
||||
```
|
||||
|
||||
The package has the following dependencies:
|
||||
- Hashlib
|
||||
- datetime.datetime
|
||||
- hashlib
|
||||
- json
|
||||
- os
|
||||
- print_agent
|
||||
- print_log_module
|
||||
- print_module
|
||||
- queue.Queue
|
||||
- requests.auth.HTTPBasicAuth
|
||||
- requests.auth.HTTPDigestAuth
|
||||
- requests.sessions.Session
|
||||
- requests_ntlm.HttpNtlmAuth
|
||||
- shutil
|
||||
- subprocess.Popen
|
||||
- sys
|
||||
- threading.Thread
|
|
@ -0,0 +1,10 @@
|
|||
from .general import *
|
||||
from .output import *
|
||||
from .encryption import *
|
||||
from .threads import *
|
||||
from .agents import *
|
||||
from .modules import *
|
||||
from .transfer import *
|
||||
from .discovery import *
|
||||
from .http import *
|
||||
from .snmp import *
|
|
@ -0,0 +1,409 @@
|
|||
import sys
|
||||
import os
|
||||
|
||||
####
|
||||
# Define global variables dict, used in functions as default values.
|
||||
# Its values can be changed.
|
||||
#########################################################################################
|
||||
|
||||
_GLOBAL_VARIABLES = {
|
||||
'agents_group_name' : '',
|
||||
'interval' : 300
|
||||
}
|
||||
|
||||
####
|
||||
# Define some global variables
|
||||
#########################################################################################
|
||||
|
||||
_WINDOWS = os.name == "nt" or os.name == "ce"
|
||||
_LINUX = sys.platform.startswith("linux")
|
||||
_MACOS = sys.platform.startswith("darwin")
|
||||
_OSX = _MACOS # deprecated alias
|
||||
_FREEBSD = sys.platform.startswith("freebsd")
|
||||
_OPENBSD = sys.platform.startswith("openbsd")
|
||||
_NETBSD = sys.platform.startswith("netbsd")
|
||||
_BSD = _FREEBSD or _OPENBSD or _NETBSD
|
||||
_SUNOS = sys.platform.startswith(("sunos", "solaris"))
|
||||
_AIX = sys.platform.startswith("aix")
|
||||
|
||||
####
|
||||
# Internal: Alias for output.print_debug function
|
||||
#########################################################################################
|
||||
|
||||
def _print_debug(
|
||||
var = "",
|
||||
print_errors: bool = False
|
||||
):
|
||||
"""
|
||||
Prints any list, dict, string, float or integer as a json
|
||||
"""
|
||||
from .output import print_debug
|
||||
print_debug(var, print_errors)
|
||||
|
||||
####
|
||||
# Set a global variable with the specified name and assigns a value to it.
|
||||
#########################################################################################
|
||||
def set_global_variable(
|
||||
variable_name: str = "",
|
||||
value = None
|
||||
)-> None:
|
||||
"""
|
||||
Sets the value of a global variable in the '_GLOBAL_VARIABLES' dictionary.
|
||||
|
||||
Args:
|
||||
variable_name (str): Name of the variable to set.
|
||||
value (any): Value to assign to the variable.
|
||||
|
||||
Returns:
|
||||
None
|
||||
"""
|
||||
from .general import set_dict_key_value
|
||||
|
||||
set_dict_key_value(_GLOBAL_VARIABLES, variable_name, value)
|
||||
|
||||
####
|
||||
# Get a global variable with the specified name.
|
||||
#########################################################################################
|
||||
def get_global_variable(
|
||||
variable_name: str = ""
|
||||
)-> None:
|
||||
"""
|
||||
Gets the value of a global variable in the '_GLOBAL_VARIABLES' dictionary.
|
||||
|
||||
Args:
|
||||
variable_name (str): Name of the variable to set.
|
||||
|
||||
Returns:
|
||||
None
|
||||
"""
|
||||
from .general import get_dict_key_value
|
||||
|
||||
get_dict_key_value(_GLOBAL_VARIABLES, variable_name)
|
||||
|
||||
####
|
||||
# Agent class
|
||||
#########################################################################################
|
||||
|
||||
class Agent:
|
||||
"""
|
||||
Basic agent class. Requires agent parameters (config {dictionary})
|
||||
and module definition (modules_def [list of dictionaries])
|
||||
"""
|
||||
def __init__(
|
||||
self,
|
||||
config: dict = {},
|
||||
modules_def: list = [],
|
||||
log_modules_def: list = []
|
||||
):
|
||||
|
||||
self.modules_def = []
|
||||
self.added_modules = []
|
||||
self.log_modules_def = []
|
||||
|
||||
self.config = init_agent(config)
|
||||
|
||||
for module in modules_def:
|
||||
self.add_module(module)
|
||||
|
||||
for log_module in log_modules_def:
|
||||
self.add_log_module(log_module)
|
||||
|
||||
def update_config(
|
||||
self,
|
||||
config: dict = {}
|
||||
)-> None:
|
||||
'''
|
||||
Update the configuration settings with new values.
|
||||
|
||||
Args:
|
||||
config (dict): A dictionary containing configuration keys and their new values.
|
||||
|
||||
Returns:
|
||||
None
|
||||
'''
|
||||
for key, value in config.items():
|
||||
if key in self.config:
|
||||
self.config[key] = value
|
||||
|
||||
def get_config(
|
||||
self
|
||||
) -> dict:
|
||||
'''
|
||||
Retrieve the current configuration settings.
|
||||
|
||||
Returns:
|
||||
dict: A dictionary containing the current configuration settings.
|
||||
'''
|
||||
return self.config
|
||||
|
||||
def add_module(
|
||||
self,
|
||||
module: dict = {}
|
||||
)-> None:
|
||||
'''
|
||||
Add a new module to the list of modules.
|
||||
|
||||
Args:
|
||||
module (dict): A dictionary containing module information.
|
||||
|
||||
Returns:
|
||||
None
|
||||
'''
|
||||
from .general import generate_md5
|
||||
from .modules import init_module
|
||||
|
||||
if "name" in module and type(module["name"]) == str and len(module["name"].strip()) > 0:
|
||||
self.modules_def.append(init_module(module))
|
||||
self.added_modules.append(generate_md5(module["name"]))
|
||||
|
||||
def del_module(
|
||||
self,
|
||||
module_name: str = ""
|
||||
)-> None:
|
||||
'''
|
||||
Delete a module based on its name.
|
||||
|
||||
Args:
|
||||
module_name (str): The name of the module to be deleted.
|
||||
|
||||
Returns:
|
||||
None
|
||||
'''
|
||||
from .general import generate_md5
|
||||
|
||||
if len(module_name.strip()) > 0:
|
||||
try:
|
||||
module_id = self.added_modules.index(generate_md5(module_name))
|
||||
except:
|
||||
module_id = None
|
||||
|
||||
if module_id is not None:
|
||||
self.added_modules.pop(module_id)
|
||||
self.modules_def.pop(module_id)
|
||||
|
||||
def update_module(
|
||||
self,
|
||||
module_name: str = "",
|
||||
module: dict = {}
|
||||
)-> None:
|
||||
'''
|
||||
Update a module based on its name.
|
||||
|
||||
Args:
|
||||
module_name (str): The name of the module to be updated.
|
||||
module (dict): A dictionary containing updated module information.
|
||||
|
||||
Returns:
|
||||
None
|
||||
'''
|
||||
module_def = self.get_module(module_name)
|
||||
|
||||
if module_def:
|
||||
if "name" not in module:
|
||||
module["name"] = module_name
|
||||
|
||||
module_def.update(module)
|
||||
|
||||
self.del_module(module_name)
|
||||
self.add_module(module_def)
|
||||
|
||||
def get_module(
|
||||
self,
|
||||
module_name: str = ""
|
||||
) -> dict:
|
||||
'''
|
||||
Retrieve module information based on its name.
|
||||
|
||||
Args:
|
||||
module_name (str): The name of the module to retrieve.
|
||||
|
||||
Returns:
|
||||
dict: A dictionary containing module information if found, otherwise an empty dictionary.
|
||||
'''
|
||||
from .general import generate_md5
|
||||
|
||||
if len(module_name.strip()) > 0:
|
||||
try:
|
||||
module_id = self.added_modules.index(generate_md5(module_name))
|
||||
except:
|
||||
module_id = None
|
||||
|
||||
if module_id is not None:
|
||||
return self.modules_def[module_id]
|
||||
else:
|
||||
return {}
|
||||
|
||||
def get_modules_def(
|
||||
self
|
||||
) -> dict:
|
||||
'''
|
||||
Retrieve the definitions of all added modules.
|
||||
|
||||
Returns:
|
||||
dict: A dictionary containing the definitions of all added modules.
|
||||
'''
|
||||
return self.modules_def
|
||||
|
||||
def add_log_module(
|
||||
self,
|
||||
log_module: dict = {}
|
||||
)-> None:
|
||||
'''
|
||||
Add a new log module to the list of log modules.
|
||||
|
||||
Args:
|
||||
log_module (dict): A dictionary containing log module information.
|
||||
|
||||
Returns:
|
||||
None
|
||||
'''
|
||||
from .modules import init_log_module
|
||||
|
||||
if "source" in log_module and type(log_module["source"]) == str and len(log_module["source"].strip()) > 0:
|
||||
self.log_modules_def.append(init_log_module(log_module))
|
||||
|
||||
def get_log_modules_def(
|
||||
self
|
||||
) -> dict:
|
||||
'''
|
||||
Retrieve the definitions of all added log modules.
|
||||
|
||||
Returns:
|
||||
dict: A dictionary containing the definitions of all added log modules.
|
||||
'''
|
||||
return self.log_modules_def
|
||||
|
||||
def print_xml(
|
||||
self,
|
||||
print_flag: bool = False
|
||||
) -> str:
|
||||
'''
|
||||
Generate and optionally print the XML representation of the agent.
|
||||
|
||||
Args:
|
||||
print_flag (bool): A flag indicating whether to print the XML representation.
|
||||
|
||||
Returns:
|
||||
str: The XML representation of the agent.
|
||||
'''
|
||||
return print_agent(self.get_config(), self.get_modules_def(), self.get_log_modules_def(), print_flag)
|
||||
|
||||
####
|
||||
# Gets system OS name
|
||||
#########################################################################################
|
||||
def get_os() -> str:
|
||||
"""
|
||||
Gets system OS name
|
||||
|
||||
Returns:
|
||||
str: OS name.
|
||||
"""
|
||||
os = "Other"
|
||||
|
||||
if _WINDOWS:
|
||||
os = "Windows"
|
||||
|
||||
if _LINUX:
|
||||
os = "Linux"
|
||||
|
||||
if _MACOS or _OSX:
|
||||
os = "MacOS"
|
||||
|
||||
if _FREEBSD or _OPENBSD or _NETBSD or _BSD:
|
||||
os = "BSD"
|
||||
|
||||
if _SUNOS:
|
||||
os = "Solaris"
|
||||
|
||||
if _AIX:
|
||||
os = "AIX"
|
||||
|
||||
return os
|
||||
|
||||
####
|
||||
# Init agent template
|
||||
#########################################################################################
|
||||
def init_agent(
|
||||
default_values: dict = {}
|
||||
) -> dict:
|
||||
"""
|
||||
Initialize an agent template with default values.
|
||||
|
||||
Args:
|
||||
default_values (dict): A dictionary containing custom default values for the agent template.
|
||||
|
||||
Returns:
|
||||
dict: A dictionary representing the agent template with default and custom values.
|
||||
"""
|
||||
from .general import now
|
||||
|
||||
agent = {
|
||||
"agent_name" : "",
|
||||
"agent_alias" : "",
|
||||
"parent_agent_name" : "",
|
||||
"description" : "",
|
||||
"version" : "",
|
||||
"os_name" : "",
|
||||
"os_version" : "",
|
||||
"timestamp" : now(),
|
||||
"address" : "",
|
||||
"group" : _GLOBAL_VARIABLES['agents_group_name'],
|
||||
"interval" : _GLOBAL_VARIABLES['interval'],
|
||||
"agent_mode" : "1"
|
||||
}
|
||||
|
||||
for key, value in default_values.items():
|
||||
if key in agent:
|
||||
agent[key] = value
|
||||
|
||||
return agent
|
||||
|
||||
####
|
||||
# Prints agent XML. Requires agent conf (dict) and modules (list) as arguments.
|
||||
#########################################################################################
|
||||
def print_agent(
|
||||
agent: dict = None,
|
||||
modules: list = [],
|
||||
log_modules: list = [],
|
||||
print_flag: bool = False
|
||||
) -> str:
|
||||
"""
|
||||
Print the XML representation of an agent.
|
||||
|
||||
Args:
|
||||
agent (dict): A dictionary containing agent configuration.
|
||||
modules (list): A list of dictionaries representing modules.
|
||||
log_modules (list): A list of dictionaries representing log modules.
|
||||
print_flag (bool): A flag indicating whether to print the XML representation.
|
||||
|
||||
Returns:
|
||||
str: The XML representation of the agent.
|
||||
"""
|
||||
from .output import print_stdout
|
||||
from .modules import print_module,print_log_module
|
||||
|
||||
xml = ""
|
||||
data_file = None
|
||||
|
||||
if agent is not None:
|
||||
header = "<?xml version='1.0' encoding='UTF-8'?>\n"
|
||||
header += "<agent_data"
|
||||
for dato in agent:
|
||||
header += " " + str(dato) + "='" + str(agent[dato]) + "'"
|
||||
header += ">\n"
|
||||
xml = header
|
||||
|
||||
for module in modules:
|
||||
modules_xml = print_module(module)
|
||||
xml += str(modules_xml)
|
||||
|
||||
for log_module in log_modules:
|
||||
modules_xml = print_log_module(log_module)
|
||||
xml += str(modules_xml)
|
||||
|
||||
xml += "</agent_data>"
|
||||
|
||||
if print_flag:
|
||||
print_stdout(xml)
|
||||
|
||||
return xml
|
|
@ -0,0 +1,225 @@
|
|||
import sys
|
||||
import json
|
||||
|
||||
####
|
||||
# Define some global variables
|
||||
#########################################################################################
|
||||
|
||||
_ERROR_LEVEL = 0
|
||||
_SUMMARY = {}
|
||||
_INFO = ""
|
||||
_MONITORING_DATA = []
|
||||
|
||||
####
|
||||
# Internal: Alias for output.print_debug function
|
||||
#########################################################################################
|
||||
|
||||
def _print_debug(
|
||||
var = "",
|
||||
print_errors: bool = False
|
||||
):
|
||||
"""
|
||||
Print the variable as a JSON-like representation for debugging purposes.
|
||||
|
||||
Args:
|
||||
var (any): The variable to be printed.
|
||||
print_errors (bool): A flag indicating whether to print errors during debugging.
|
||||
"""
|
||||
from .output import print_debug
|
||||
print_debug(var, print_errors)
|
||||
|
||||
####
|
||||
# Set error level to value
|
||||
#########################################################################################
|
||||
def set_disco_error_level(
|
||||
value: int = 0
|
||||
)-> None:
|
||||
"""
|
||||
Sets the error level to the specified value.
|
||||
|
||||
Args:
|
||||
value (int, optional): The error level value. Default is 0.
|
||||
"""
|
||||
global _ERROR_LEVEL
|
||||
|
||||
_ERROR_LEVEL = value
|
||||
|
||||
####
|
||||
# Set fixed value to summary dict
|
||||
#########################################################################################
|
||||
def set_disco_summary(
|
||||
data: dict = {}
|
||||
)-> None:
|
||||
"""
|
||||
Sets the disk summary data in the internal summary dictionary.
|
||||
|
||||
This function updates the summary dictionary with the provided disk summary data.
|
||||
|
||||
Args:
|
||||
data (dict): A dictionary containing disk summary data.
|
||||
|
||||
Returns:
|
||||
None
|
||||
"""
|
||||
global _SUMMARY
|
||||
|
||||
_SUMMARY = {}
|
||||
|
||||
####
|
||||
# Set fixed value to summary key
|
||||
#########################################################################################
|
||||
def set_disco_summary_value(
|
||||
key: str = "",
|
||||
value = None
|
||||
)-> None:
|
||||
"""
|
||||
Sets a fixed value for a key in the '_SUMMARY' dictionary.
|
||||
|
||||
Args:
|
||||
key (str): Key to set the value for.
|
||||
value (any): Value to assign to the key.
|
||||
|
||||
Returns:
|
||||
None
|
||||
"""
|
||||
global _SUMMARY
|
||||
|
||||
_SUMMARY[key] = value
|
||||
|
||||
####
|
||||
# Add value to summary key
|
||||
#########################################################################################
|
||||
def add_disco_summary_value(
|
||||
key: str = "",
|
||||
value = None
|
||||
)-> None:
|
||||
"""
|
||||
Adds a value to a key in the 'SUMMARY' dictionary.
|
||||
|
||||
If the key already exists, the value will be incremented. Otherwise, a new key will be created.
|
||||
|
||||
Args:
|
||||
key (str): Key to add the value to.
|
||||
value (any): Value to add to the key.
|
||||
|
||||
Returns:
|
||||
None
|
||||
"""
|
||||
global _SUMMARY
|
||||
|
||||
if key in _SUMMARY:
|
||||
_SUMMARY[key] += value
|
||||
else:
|
||||
set_disco_summary_value(key, value)
|
||||
|
||||
####
|
||||
# Set fixed value to info
|
||||
#########################################################################################
|
||||
def set_disco_info_value(
|
||||
value: str = ""
|
||||
)-> None:
|
||||
"""
|
||||
Sets a fixed value to the '_INFO' variable.
|
||||
|
||||
Args:
|
||||
data (str, optional): The value to set in the '_INFO' variable. Default is an empty string.
|
||||
|
||||
Returns:
|
||||
None
|
||||
"""
|
||||
global _INFO
|
||||
|
||||
_INFO = value
|
||||
|
||||
####
|
||||
# Add data to info
|
||||
#########################################################################################
|
||||
def add_disco_info_value(
|
||||
value: str = ""
|
||||
)-> None:
|
||||
"""
|
||||
Adds data to the '_INFO' variable.
|
||||
|
||||
Args:
|
||||
data (str, optional): The data to add to the '_INFO' variable. Default is an empty string.
|
||||
|
||||
Returns:
|
||||
None
|
||||
"""
|
||||
global _INFO
|
||||
|
||||
_INFO += value
|
||||
|
||||
####
|
||||
# Set fixed value to monitoring data
|
||||
#########################################################################################
|
||||
def set_disco_monitoring_data(
|
||||
data: list = []
|
||||
)-> None:
|
||||
"""
|
||||
Set the monitoring data for disk usage.
|
||||
|
||||
Args:
|
||||
data (list): A list containing disk monitoring data.
|
||||
|
||||
Returns:
|
||||
None
|
||||
"""
|
||||
global _MONITORING_DATA
|
||||
|
||||
_MONITORING_DATA = data
|
||||
|
||||
####
|
||||
# Add value to monitoring data
|
||||
#########################################################################################
|
||||
def add_disco_monitoring_data(
|
||||
data: dict = {}
|
||||
)-> None:
|
||||
"""
|
||||
Add disk monitoring data to the global monitoring dataset.
|
||||
|
||||
Args:
|
||||
data (dict): A dictionary containing disk monitoring data.
|
||||
|
||||
Returns:
|
||||
None
|
||||
"""
|
||||
global _MONITORING_DATA
|
||||
|
||||
_MONITORING_DATA.append(data)
|
||||
|
||||
####
|
||||
# Print JSON output and exit script
|
||||
#########################################################################################
|
||||
def disco_output()-> None:
|
||||
"""
|
||||
Prints the JSON output and exits the script.
|
||||
|
||||
The function uses the global variables '_ERROR_LEVEL', '_SUMMARY', '_INFO' and '_MONITORING_DATA'
|
||||
to create the JSON output. It then prints the JSON string and exits the script with
|
||||
the '_ERROR_LEVEL' as the exit code.
|
||||
|
||||
Returns:
|
||||
None
|
||||
"""
|
||||
from .output import print_stdout
|
||||
|
||||
global _ERROR_LEVEL
|
||||
global _SUMMARY
|
||||
global _INFO
|
||||
global _MONITORING_DATA
|
||||
|
||||
output={}
|
||||
if _SUMMARY:
|
||||
output["summary"] = _SUMMARY
|
||||
|
||||
if _INFO:
|
||||
output["info"] = _INFO
|
||||
|
||||
if _MONITORING_DATA:
|
||||
output["monitoring_data"] = _MONITORING_DATA
|
||||
|
||||
json_string = json.dumps(output)
|
||||
|
||||
print_stdout(json_string)
|
||||
sys.exit(_ERROR_LEVEL)
|
|
@ -0,0 +1,116 @@
|
|||
try:
|
||||
from Crypto.Cipher import AES
|
||||
from Crypto.Util.Padding import pad, unpad
|
||||
except ImportError as e:
|
||||
import sys
|
||||
from .output import print_stderr
|
||||
print_stderr("ModuleNotFoundError: No module named 'pycryptodome'")
|
||||
sys.exit(1)
|
||||
|
||||
import hashlib
|
||||
import base64
|
||||
import hmac
|
||||
from binascii import unhexlify
|
||||
|
||||
####
|
||||
# Define encription internal global variables.
|
||||
#########################################################################################
|
||||
|
||||
_PASSWORD = "default_salt"
|
||||
|
||||
####
|
||||
# Internal: Alias for output.print_debug function
|
||||
#########################################################################################
|
||||
|
||||
def _print_debug(
|
||||
var = "",
|
||||
print_errors: bool = False
|
||||
):
|
||||
"""
|
||||
Print the variable as a JSON-like representation for debugging purposes.
|
||||
|
||||
Args:
|
||||
var (any): The variable to be printed.
|
||||
print_errors (bool): A flag indicating whether to print errors during debugging.
|
||||
"""
|
||||
from .output import print_debug
|
||||
print_debug(var, print_errors)
|
||||
|
||||
####
|
||||
# Internal use only: Get AES cipher
|
||||
#########################################################################################
|
||||
def _get_cipher(
|
||||
password: str = _PASSWORD
|
||||
) -> AES:
|
||||
'''
|
||||
Internal use only: Get AES cipher for encryption and decryption.
|
||||
|
||||
Args:
|
||||
password (str): The password used to derive the encryption key.
|
||||
|
||||
Returns:
|
||||
AES: An AES cipher instance for encryption and decryption.
|
||||
'''
|
||||
key = b''
|
||||
msg = password.encode('utf-8')
|
||||
hash_obj = hmac.new(key, msg, hashlib.sha256)
|
||||
hash_result = hash_obj.digest()
|
||||
hash_base64 = base64.b64encode(hash_result)[:16].decode()
|
||||
|
||||
iv = b'0000000000000000'
|
||||
|
||||
return AES.new(hash_base64.encode(), AES.MODE_CBC, iv)
|
||||
|
||||
####
|
||||
# Return encrypted string
|
||||
#########################################################################################
|
||||
def encrypt_AES(
|
||||
str_to_encrypt: str = "",
|
||||
password: str = _PASSWORD
|
||||
) -> str:
|
||||
'''
|
||||
Encrypt a string using AES encryption.
|
||||
|
||||
Args:
|
||||
str_to_encrypt (str): The string to be encrypted.
|
||||
password (str): The password used to derive the encryption key.
|
||||
|
||||
Returns:
|
||||
str: The encrypted string in base64 encoding.
|
||||
'''
|
||||
cipher = _get_cipher(password)
|
||||
|
||||
try:
|
||||
msg_padded = pad(str_to_encrypt.encode(), AES.block_size, style='pkcs7')
|
||||
cipher_text = cipher.encrypt(msg_padded)
|
||||
b64str = base64.b64encode(cipher_text).decode()
|
||||
except:
|
||||
b64str = ''
|
||||
|
||||
return b64str
|
||||
|
||||
####
|
||||
# Return decrypted string
|
||||
#########################################################################################
|
||||
def decrypt_AES(
|
||||
str_to_decrypt: str = "",
|
||||
password: str = _PASSWORD
|
||||
) -> str:
|
||||
'''
|
||||
Decrypt an encrypted string using AES decryption.
|
||||
|
||||
Args:
|
||||
str_to_decrypt (str): The encrypted string to be decrypted.
|
||||
password (str): The password used to derive the encryption key.
|
||||
|
||||
Returns:
|
||||
str: The decrypted string.
|
||||
'''
|
||||
cipher = _get_cipher(password)
|
||||
|
||||
try:
|
||||
decrypted_str = unpad(cipher.decrypt(base64.b64decode(str_to_decrypt)), AES.block_size, style='pkcs7').decode().strip()
|
||||
except:
|
||||
decrypted_str = ''
|
||||
|
||||
return decrypted_str
|
|
@ -0,0 +1,652 @@
|
|||
import sys
|
||||
from datetime import datetime
|
||||
import hashlib
|
||||
|
||||
####
|
||||
# Define some global variables
|
||||
#########################################################################################
|
||||
|
||||
# Entity to character mapping. Contains a few tweaks to make it backward compatible with the previous safe_input implementation.
|
||||
_ENT2CHR = {
|
||||
'#x00': chr(0),
|
||||
'#x01': chr(1),
|
||||
'#x02': chr(2),
|
||||
'#x03': chr(3),
|
||||
'#x04': chr(4),
|
||||
'#x05': chr(5),
|
||||
'#x06': chr(6),
|
||||
'#x07': chr(7),
|
||||
'#x08': chr(8),
|
||||
'#x09': chr(9),
|
||||
'#x0a': chr(10),
|
||||
'#x0b': chr(11),
|
||||
'#x0c': chr(12),
|
||||
'#x0d': chr(13),
|
||||
'#x0e': chr(14),
|
||||
'#x0f': chr(15),
|
||||
'#x10': chr(16),
|
||||
'#x11': chr(17),
|
||||
'#x12': chr(18),
|
||||
'#x13': chr(19),
|
||||
'#x14': chr(20),
|
||||
'#x15': chr(21),
|
||||
'#x16': chr(22),
|
||||
'#x17': chr(23),
|
||||
'#x18': chr(24),
|
||||
'#x19': chr(25),
|
||||
'#x1a': chr(26),
|
||||
'#x1b': chr(27),
|
||||
'#x1c': chr(28),
|
||||
'#x1d': chr(29),
|
||||
'#x1e': chr(30),
|
||||
'#x1f': chr(31),
|
||||
'#x20': chr(32),
|
||||
'quot': chr(34),
|
||||
'amp': chr(38),
|
||||
'#039': chr(39),
|
||||
'#40': chr(40),
|
||||
'#41': chr(41),
|
||||
'lt': chr(60),
|
||||
'gt': chr(62),
|
||||
'#92': chr(92),
|
||||
'#x80': chr(128),
|
||||
'#x81': chr(129),
|
||||
'#x82': chr(130),
|
||||
'#x83': chr(131),
|
||||
'#x84': chr(132),
|
||||
'#x85': chr(133),
|
||||
'#x86': chr(134),
|
||||
'#x87': chr(135),
|
||||
'#x88': chr(136),
|
||||
'#x89': chr(137),
|
||||
'#x8a': chr(138),
|
||||
'#x8b': chr(139),
|
||||
'#x8c': chr(140),
|
||||
'#x8d': chr(141),
|
||||
'#x8e': chr(142),
|
||||
'#x8f': chr(143),
|
||||
'#x90': chr(144),
|
||||
'#x91': chr(145),
|
||||
'#x92': chr(146),
|
||||
'#x93': chr(147),
|
||||
'#x94': chr(148),
|
||||
'#x95': chr(149),
|
||||
'#x96': chr(150),
|
||||
'#x97': chr(151),
|
||||
'#x98': chr(152),
|
||||
'#x99': chr(153),
|
||||
'#x9a': chr(154),
|
||||
'#x9b': chr(155),
|
||||
'#x9c': chr(156),
|
||||
'#x9d': chr(157),
|
||||
'#x9e': chr(158),
|
||||
'#x9f': chr(159),
|
||||
'#xa0': chr(160),
|
||||
'#xa1': chr(161),
|
||||
'#xa2': chr(162),
|
||||
'#xa3': chr(163),
|
||||
'#xa4': chr(164),
|
||||
'#xa5': chr(165),
|
||||
'#xa6': chr(166),
|
||||
'#xa7': chr(167),
|
||||
'#xa8': chr(168),
|
||||
'#xa9': chr(169),
|
||||
'#xaa': chr(170),
|
||||
'#xab': chr(171),
|
||||
'#xac': chr(172),
|
||||
'#xad': chr(173),
|
||||
'#xae': chr(174),
|
||||
'#xaf': chr(175),
|
||||
'#xb0': chr(176),
|
||||
'#xb1': chr(177),
|
||||
'#xb2': chr(178),
|
||||
'#xb3': chr(179),
|
||||
'#xb4': chr(180),
|
||||
'#xb5': chr(181),
|
||||
'#xb6': chr(182),
|
||||
'#xb7': chr(183),
|
||||
'#xb8': chr(184),
|
||||
'#xb9': chr(185),
|
||||
'#xba': chr(186),
|
||||
'#xbb': chr(187),
|
||||
'#xbc': chr(188),
|
||||
'#xbd': chr(189),
|
||||
'#xbe': chr(190),
|
||||
'Aacute': chr(193),
|
||||
'Auml': chr(196),
|
||||
'Eacute': chr(201),
|
||||
'Euml': chr(203),
|
||||
'Iacute': chr(205),
|
||||
'Iuml': chr(207),
|
||||
'Ntilde': chr(209),
|
||||
'Oacute': chr(211),
|
||||
'Ouml': chr(214),
|
||||
'Uacute': chr(218),
|
||||
'Uuml': chr(220),
|
||||
'aacute': chr(225),
|
||||
'auml': chr(228),
|
||||
'eacute': chr(233),
|
||||
'euml': chr(235),
|
||||
'iacute': chr(237),
|
||||
'iuml': chr(239),
|
||||
'ntilde': chr(241),
|
||||
'oacute': chr(243),
|
||||
'ouml': chr(246),
|
||||
'uacute': chr(250),
|
||||
'uuml': chr(252),
|
||||
'OElig': chr(338),
|
||||
'oelig': chr(339),
|
||||
'Scaron': chr(352),
|
||||
'scaron': chr(353),
|
||||
'Yuml': chr(376),
|
||||
'fnof': chr(402),
|
||||
'circ': chr(710),
|
||||
'tilde': chr(732),
|
||||
'Alpha': chr(913),
|
||||
'Beta': chr(914),
|
||||
'Gamma': chr(915),
|
||||
'Delta': chr(916),
|
||||
'Epsilon': chr(917),
|
||||
'Zeta': chr(918),
|
||||
'Eta': chr(919),
|
||||
'Theta': chr(920),
|
||||
'Iota': chr(921),
|
||||
'Kappa': chr(922),
|
||||
'Lambda': chr(923),
|
||||
'Mu': chr(924),
|
||||
'Nu': chr(925),
|
||||
'Xi': chr(926),
|
||||
'Omicron': chr(927),
|
||||
'Pi': chr(928),
|
||||
'Rho': chr(929),
|
||||
'Sigma': chr(931),
|
||||
'Tau': chr(932),
|
||||
'Upsilon': chr(933),
|
||||
'Phi': chr(934),
|
||||
'Chi': chr(935),
|
||||
'Psi': chr(936),
|
||||
'Omega': chr(937),
|
||||
'alpha': chr(945),
|
||||
'beta': chr(946),
|
||||
'gamma': chr(947),
|
||||
'delta': chr(948),
|
||||
'epsilon': chr(949),
|
||||
'zeta': chr(950),
|
||||
'eta': chr(951),
|
||||
'theta': chr(952),
|
||||
'iota': chr(953),
|
||||
'kappa': chr(954),
|
||||
'lambda': chr(955),
|
||||
'mu': chr(956),
|
||||
'nu': chr(957),
|
||||
'xi': chr(958),
|
||||
'omicron': chr(959),
|
||||
'pi': chr(960),
|
||||
'rho': chr(961),
|
||||
'sigmaf': chr(962),
|
||||
'sigma': chr(963),
|
||||
'tau': chr(964),
|
||||
'upsilon': chr(965),
|
||||
'phi': chr(966),
|
||||
'chi': chr(967),
|
||||
'psi': chr(968),
|
||||
'omega': chr(969),
|
||||
'thetasym': chr(977),
|
||||
'upsih': chr(978),
|
||||
'piv': chr(982),
|
||||
'ensp': chr(8194),
|
||||
'emsp': chr(8195),
|
||||
'thinsp': chr(8201),
|
||||
'zwnj': chr(8204),
|
||||
'zwj': chr(8205),
|
||||
'lrm': chr(8206),
|
||||
'rlm': chr(8207),
|
||||
'ndash': chr(8211),
|
||||
'mdash': chr(8212),
|
||||
'lsquo': chr(8216),
|
||||
'rsquo': chr(8217),
|
||||
'sbquo': chr(8218),
|
||||
'ldquo': chr(8220),
|
||||
'rdquo': chr(8221),
|
||||
'bdquo': chr(8222),
|
||||
'dagger': chr(8224),
|
||||
'Dagger': chr(8225),
|
||||
'bull': chr(8226),
|
||||
'hellip': chr(8230),
|
||||
'permil': chr(8240),
|
||||
'prime': chr(8242),
|
||||
'Prime': chr(8243),
|
||||
'lsaquo': chr(8249),
|
||||
'rsaquo': chr(8250),
|
||||
'oline': chr(8254),
|
||||
'frasl': chr(8260),
|
||||
'euro': chr(8364),
|
||||
'image': chr(8465),
|
||||
'weierp': chr(8472),
|
||||
'real': chr(8476),
|
||||
'trade': chr(8482),
|
||||
'alefsym': chr(8501),
|
||||
'larr': chr(8592),
|
||||
'uarr': chr(8593),
|
||||
'rarr': chr(8594),
|
||||
'darr': chr(8595),
|
||||
'harr': chr(8596),
|
||||
'crarr': chr(8629),
|
||||
'lArr': chr(8656),
|
||||
'uArr': chr(8657),
|
||||
'rArr': chr(8658),
|
||||
'dArr': chr(8659),
|
||||
'hArr': chr(8660),
|
||||
'forall': chr(8704),
|
||||
'part': chr(8706),
|
||||
'exist': chr(8707),
|
||||
'empty': chr(8709),
|
||||
'nabla': chr(8711),
|
||||
'isin': chr(8712),
|
||||
'notin': chr(8713),
|
||||
'ni': chr(8715),
|
||||
'prod': chr(8719),
|
||||
'sum': chr(8721),
|
||||
'minus': chr(8722),
|
||||
'lowast': chr(8727),
|
||||
'radic': chr(8730),
|
||||
'prop': chr(8733),
|
||||
'infin': chr(8734),
|
||||
'ang': chr(8736),
|
||||
'and': chr(8743),
|
||||
'or': chr(8744),
|
||||
'cap': chr(8745),
|
||||
'cup': chr(8746),
|
||||
'int': chr(8747),
|
||||
'there4': chr(8756),
|
||||
'sim': chr(8764),
|
||||
'cong': chr(8773),
|
||||
'asymp': chr(8776),
|
||||
'ne': chr(8800),
|
||||
'equiv': chr(8801),
|
||||
'le': chr(8804),
|
||||
'ge': chr(8805),
|
||||
'sub': chr(8834),
|
||||
'sup': chr(8835),
|
||||
'nsub': chr(8836),
|
||||
'sube': chr(8838),
|
||||
'supe': chr(8839),
|
||||
'oplus': chr(8853),
|
||||
'otimes': chr(8855),
|
||||
'perp': chr(8869),
|
||||
'sdot': chr(8901),
|
||||
'lceil': chr(8968),
|
||||
'rceil': chr(8969),
|
||||
'lfloor': chr(8970),
|
||||
'rfloor': chr(8971),
|
||||
'lang': chr(9001),
|
||||
'rang': chr(9002),
|
||||
'loz': chr(9674),
|
||||
'spades': chr(9824),
|
||||
'clubs': chr(9827),
|
||||
'hearts': chr(9829),
|
||||
'diams': chr(9830),
|
||||
}
|
||||
|
||||
# Construct the character to entity mapping.
|
||||
_CHR2ENT = {v: "&" + k + ";" for k, v in _ENT2CHR.items()}
|
||||
|
||||
####
|
||||
# Internal: Alias for output.print_debug function
|
||||
#########################################################################################
|
||||
|
||||
def _print_debug(
|
||||
var = "",
|
||||
print_errors: bool = False
|
||||
):
|
||||
"""
|
||||
Print the variable as a JSON-like representation for debugging purposes.
|
||||
|
||||
Args:
|
||||
var (any): The variable to be printed.
|
||||
print_errors (bool): A flag indicating whether to print errors during debugging.
|
||||
"""
|
||||
from .output import print_debug
|
||||
print_debug(var, print_errors)
|
||||
|
||||
####
|
||||
# Convert the input_string encoded in html entity to clear char string.
|
||||
#########################################################################################
|
||||
def safe_input(
|
||||
input_string: str = ""
|
||||
) -> str:
|
||||
'''
|
||||
Convert an input string encoded in HTML entities to a clear character string.
|
||||
|
||||
Args:
|
||||
input_string (str): The input string encoded in HTML entities.
|
||||
|
||||
Returns:
|
||||
str: The decoded clear character string.
|
||||
'''
|
||||
if not input_string:
|
||||
return ""
|
||||
|
||||
return "".join(_CHR2ENT.get(char, char) for char in input_string)
|
||||
|
||||
####
|
||||
# Convert the html entities to input_string encoded to rebuild char string.
|
||||
#########################################################################################
|
||||
def safe_output(
|
||||
input_string: str = ""
|
||||
) -> str:
|
||||
'''
|
||||
Convert HTML entities back to their corresponding characters in the input string.
|
||||
|
||||
Args:
|
||||
input_string (str): The input string containing HTML entities.
|
||||
|
||||
Returns:
|
||||
str: The decoded clear character string.
|
||||
'''
|
||||
if not input_string:
|
||||
return ""
|
||||
|
||||
for char, entity in _CHR2ENT.items():
|
||||
input_string = input_string.replace(entity, char)
|
||||
|
||||
return input_string
|
||||
|
||||
####
|
||||
# Assign to a key in a dict a given value.
|
||||
#########################################################################################
|
||||
|
||||
def set_dict_key_value(
|
||||
input_dict: dict = {},
|
||||
input_key: str = "",
|
||||
input_value = None
|
||||
)-> None:
|
||||
"""
|
||||
Assign a given value to a specified key in a dictionary.
|
||||
|
||||
Args:
|
||||
input_dict (dict): The dictionary to which the value will be assigned.
|
||||
input_key (str): The key in the dictionary to which the value will be assigned.
|
||||
input_value (any): The value to be assigned to the specified key.
|
||||
|
||||
Returns:
|
||||
None
|
||||
"""
|
||||
key = input_key.strip()
|
||||
|
||||
if len(key) > 0:
|
||||
input_dict[key] = input_value
|
||||
|
||||
####
|
||||
# Return the value of a key in a given dict.
|
||||
#########################################################################################
|
||||
|
||||
def get_dict_key_value(
|
||||
input_dict: dict = {},
|
||||
input_key: str = ""
|
||||
)-> None:
|
||||
"""
|
||||
Return the value associated with a given key in a provided dictionary.
|
||||
|
||||
Args:
|
||||
input_dict (dict): The dictionary to search for the key-value pair.
|
||||
input_key (str): The key to look up in the dictionary.
|
||||
|
||||
Returns:
|
||||
The value associated with the specified key, or None if the key is not found.
|
||||
"""
|
||||
key = input_key.strip()
|
||||
|
||||
if key in input_dict:
|
||||
return input_dict[key]
|
||||
else:
|
||||
return None
|
||||
|
||||
####
|
||||
# Return MD5 hash string.
|
||||
#########################################################################################
|
||||
|
||||
def generate_md5(
|
||||
input_string: str = ""
|
||||
) -> str:
|
||||
"""
|
||||
Generates an MD5 hash for the given input string.
|
||||
|
||||
Args:
|
||||
input_string (str): The string for which the MD5 hash will be generated.
|
||||
|
||||
Returns:
|
||||
str: The MD5 hash of the input string as a hexadecimal string.
|
||||
"""
|
||||
try:
|
||||
md5_hash = hashlib.md5(input_string.encode()).hexdigest()
|
||||
except:
|
||||
md5_hash = ""
|
||||
|
||||
return md5_hash
|
||||
|
||||
####
|
||||
# Returns or print current time in date format or utimestamp.
|
||||
#########################################################################################
|
||||
|
||||
def now(
|
||||
utimestamp: bool = False,
|
||||
print_flag: bool = False
|
||||
) -> str:
|
||||
"""
|
||||
Get the current time in the specified format or as a Unix timestamp.
|
||||
|
||||
Args:
|
||||
utimestamp (bool): Set to True to get the Unix timestamp (epoch time).
|
||||
print_flag (bool): Set to True to print the time to standard output.
|
||||
|
||||
Returns:
|
||||
str: The current time in the desired format or as a Unix timestamp.
|
||||
"""
|
||||
from .output import print_stdout
|
||||
|
||||
today = datetime.today()
|
||||
|
||||
if utimestamp:
|
||||
time = datetime.timestamp(today)
|
||||
else:
|
||||
time = today.strftime('%Y/%m/%d %H:%M:%S')
|
||||
|
||||
if print_flag:
|
||||
print_stdout(time)
|
||||
|
||||
return time
|
||||
|
||||
####
|
||||
# Translate macros in string from a dict.
|
||||
#########################################################################################
|
||||
def translate_macros(
|
||||
macro_dic: dict = {},
|
||||
data: str = ""
|
||||
) -> str:
|
||||
"""
|
||||
Replace macros in the input string with their corresponding values.
|
||||
|
||||
Args:
|
||||
macro_dic (dict): A dictionary containing macro names and their corresponding values.
|
||||
data (str): The input string in which macros should be replaced.
|
||||
|
||||
Returns:
|
||||
str: The input string with macros replaced by their values.
|
||||
"""
|
||||
for macro_name, macro_value in macro_dic.items():
|
||||
data = data.replace(macro_name, macro_value)
|
||||
|
||||
return data
|
||||
|
||||
|
||||
####
|
||||
# Parse configuration file line by line based on separator and return dict.
|
||||
#########################################################################################
|
||||
|
||||
def parse_configuration(
|
||||
file: str = "/etc/pandora/pandora_server.conf",
|
||||
separator: str = " ",
|
||||
default_values: dict = {}
|
||||
) -> dict:
|
||||
"""
|
||||
Parse a configuration file and return its data as a dictionary.
|
||||
|
||||
Args:
|
||||
file (str): The path to the configuration file. Defaults to "/etc/pandora/pandora_server.conf".
|
||||
separator (str, optional): The separator between option and value. Defaults to " ".
|
||||
default_values (dict, optional): A dictionary of default values. Defaults to an empty dictionary.
|
||||
|
||||
Returns:
|
||||
dict: A dictionary containing all keys and values from the configuration file.
|
||||
"""
|
||||
from .output import print_stderr
|
||||
|
||||
config = {}
|
||||
|
||||
try:
|
||||
with open (file, "r") as conf:
|
||||
lines = conf.read().splitlines()
|
||||
for line in lines:
|
||||
if line.strip().startswith("#") or len(line.strip()) < 1 :
|
||||
continue
|
||||
else:
|
||||
option, value = line.strip().split(separator, maxsplit=1)
|
||||
config[option.strip()] = value.strip()
|
||||
|
||||
except Exception as e:
|
||||
print_stderr(f"{type(e).__name__}: {e}")
|
||||
|
||||
for option, value in default_values.items():
|
||||
if option.strip() not in config:
|
||||
config[option.strip()] = value.strip()
|
||||
|
||||
return config
|
||||
|
||||
####
|
||||
# Parse csv file line by line and return list.
|
||||
#########################################################################################
|
||||
|
||||
def parse_csv_file(
|
||||
file: str = "",
|
||||
separator: str = ';',
|
||||
count_parameters: int = 0,
|
||||
print_errors: bool = False
|
||||
) -> list:
|
||||
"""
|
||||
Parse a CSV configuration file and return its data in a list.
|
||||
|
||||
Args:
|
||||
file (str): The path to the CSV configuration file.
|
||||
separator (str, optional): The separator between values in the CSV. Defaults to ";".
|
||||
count_parameters (int, optional): The minimum number of parameters each line should have. Defaults to 0.
|
||||
print_errors (bool, optional): Set to True to print errors for lines with insufficient parameters. Defaults to False.
|
||||
|
||||
Returns:
|
||||
list: A list containing lists of values for each line in the CSV.
|
||||
"""
|
||||
from .output import print_stderr
|
||||
|
||||
csv_arr = []
|
||||
|
||||
try:
|
||||
with open (file, "r") as csv:
|
||||
lines = csv.read().splitlines()
|
||||
for line in lines:
|
||||
if line.strip().startswith("#") or len(line.strip()) < 1 :
|
||||
continue
|
||||
else:
|
||||
value = line.strip().split(separator)
|
||||
if len(value) >= count_parameters:
|
||||
csv_arr.append(value)
|
||||
elif print_errors==True:
|
||||
print_stderr(f'Csv line: {line} does not match minimun parameter defined: {count_parameters}')
|
||||
|
||||
except Exception as e:
|
||||
print_stderr(f"{type(e).__name__}: {e}")
|
||||
|
||||
return csv_arr
|
||||
|
||||
####
|
||||
# Parse given variable to integer.
|
||||
#########################################################################################
|
||||
|
||||
def parse_int(
|
||||
var = None
|
||||
) -> int:
|
||||
"""
|
||||
Parse given variable to integer.
|
||||
|
||||
Args:
|
||||
var (any): The variable to be parsed as an integer.
|
||||
|
||||
Returns:
|
||||
int: The parsed integer value. If parsing fails, returns 0.
|
||||
"""
|
||||
try:
|
||||
return int(var)
|
||||
except:
|
||||
return 0
|
||||
|
||||
####
|
||||
# Parse given variable to float.
|
||||
#########################################################################################
|
||||
|
||||
def parse_float(
|
||||
var = None
|
||||
) -> float:
|
||||
"""
|
||||
Parse given variable to float.
|
||||
|
||||
Args:
|
||||
var (any): The variable to be parsed as an float.
|
||||
|
||||
Returns:
|
||||
float: The parsed float value. If parsing fails, returns 0.
|
||||
"""
|
||||
try:
|
||||
return float(var)
|
||||
except:
|
||||
return 0
|
||||
|
||||
####
|
||||
# Parse given variable to string.
|
||||
#########################################################################################
|
||||
|
||||
def parse_str(
|
||||
var = None
|
||||
) -> str:
|
||||
"""
|
||||
Parse given variable to string.
|
||||
|
||||
Args:
|
||||
var (any): The variable to be parsed as an string.
|
||||
|
||||
Returns:
|
||||
str: The parsed string value. If parsing fails, returns "".
|
||||
"""
|
||||
try:
|
||||
return str(var)
|
||||
except:
|
||||
return ""
|
||||
|
||||
####
|
||||
# Parse given variable to bool.
|
||||
#########################################################################################
|
||||
|
||||
def parse_bool(
|
||||
var = None
|
||||
) -> bool:
|
||||
"""
|
||||
Parse given variable to bool.
|
||||
|
||||
Args:
|
||||
var (any): The variable to be parsed as an bool.
|
||||
|
||||
Returns:
|
||||
bool: The parsed bool value. If parsing fails, returns False.
|
||||
"""
|
||||
try:
|
||||
return bool(var)
|
||||
except:
|
||||
return False
|
|
@ -0,0 +1,113 @@
|
|||
import urllib3
|
||||
import warnings
|
||||
from requests.sessions import Session
|
||||
from requests_ntlm import HttpNtlmAuth
|
||||
from requests.auth import HTTPBasicAuth
|
||||
from requests.auth import HTTPDigestAuth
|
||||
|
||||
####
|
||||
# Internal: Alias for output.print_debug function
|
||||
#########################################################################################
|
||||
|
||||
def _print_debug(
|
||||
var = "",
|
||||
print_errors: bool = False
|
||||
):
|
||||
"""
|
||||
Print the provided variable as JSON, supporting various data types.
|
||||
|
||||
Args:
|
||||
var (any): The variable to be printed as JSON.
|
||||
print_errors (bool): Set to True to print errors encountered during printing.
|
||||
"""
|
||||
from .output import print_debug
|
||||
print_debug(var, print_errors)
|
||||
|
||||
####
|
||||
# Internal: Auth URL session
|
||||
#########################################################################################
|
||||
|
||||
def _auth_call(
|
||||
session = None,
|
||||
authtype: str = "basic",
|
||||
user: str = "",
|
||||
passw: str = ""
|
||||
)-> None:
|
||||
"""
|
||||
Perform authentication for URL requests using various authentication types.
|
||||
|
||||
Args:
|
||||
session (object, optional): The request Session() object. Defaults to None.
|
||||
authtype (str, optional): The authentication type. Supported values: 'ntlm', 'basic', or 'digest'. Defaults to 'basic'.
|
||||
user (str, optional): The authentication user. Defaults to an empty string.
|
||||
passw (str, optional): The authentication password. Defaults to an empty string.
|
||||
|
||||
Returns:
|
||||
None
|
||||
"""
|
||||
if session is not None:
|
||||
if authtype == 'ntlm':
|
||||
session.auth = HttpNtlmAuth(user, passw)
|
||||
elif authtype == 'basic':
|
||||
session.auth = HTTPBasicAuth(user, passw)
|
||||
elif authtype == 'digest':
|
||||
session.auth = HTTPDigestAuth(user, passw)
|
||||
|
||||
####
|
||||
# Call URL and return output
|
||||
#########################################################################################
|
||||
|
||||
def call_url(
|
||||
url: str = "",
|
||||
authtype: str = "basic",
|
||||
user: str = "",
|
||||
passw: str = "",
|
||||
timeout: int = 1,
|
||||
verify: bool = True,
|
||||
print_errors: bool = False
|
||||
) -> str:
|
||||
"""
|
||||
Call a URL and return its contents.
|
||||
|
||||
Args:
|
||||
url (str): The URL to call.
|
||||
authtype (str, optional): The authentication type. Supported values: 'ntlm', 'basic', 'digest'. Defaults to 'basic'.
|
||||
user (str, optional): The authentication user. Defaults to an empty string.
|
||||
passw (str, optional): The authentication password. Defaults to an empty string.
|
||||
timeout (int, optional): The session timeout in seconds. Defaults to 1.
|
||||
print_errors (bool, optional): Set to True to print errors encountered during the call. Defaults to False.
|
||||
|
||||
Returns:
|
||||
str: The output from the URL call.
|
||||
"""
|
||||
from .output import print_stderr
|
||||
|
||||
if url == "":
|
||||
if print_errors:
|
||||
print_stderr("Error: URL not provided")
|
||||
return None
|
||||
else:
|
||||
# using with so we make sure the session is closed even when exceptions are encountered
|
||||
with Session() as session:
|
||||
if authtype is not None:
|
||||
_auth_call(session, authtype, user, passw)
|
||||
|
||||
output = ""
|
||||
|
||||
try:
|
||||
with warnings.catch_warnings():
|
||||
warnings.filterwarnings("ignore", category=urllib3.exceptions.InsecureRequestWarning)
|
||||
response = session.get(url, timeout=timeout, verify=verify)
|
||||
response.raise_for_status() # Raise an exception for non-2xx responses
|
||||
return response.content
|
||||
except requests.exceptions.Timeout:
|
||||
if print_errors:
|
||||
print_stderr("Error: Request timed out")
|
||||
except requests.exceptions.RequestException as e:
|
||||
if print_errors:
|
||||
print_stderr(f"RequestException:\t{e}")
|
||||
except ValueError:
|
||||
if print_errors:
|
||||
print_stderr("Error: URL format not valid (example http://myserver/page.php)")
|
||||
|
||||
return None
|
|
@ -0,0 +1,330 @@
|
|||
####
|
||||
# Internal: Alias for output.print_debug function
|
||||
#########################################################################################
|
||||
|
||||
def _print_debug(
|
||||
var = "",
|
||||
print_errors: bool = False
|
||||
):
|
||||
"""
|
||||
Print the provided variable as JSON format, supporting various data types.
|
||||
|
||||
Args:
|
||||
var (any, optional): The variable to be printed as JSON. Defaults to an empty string.
|
||||
print_errors (bool, optional): Set to True to print errors encountered during printing. Defaults to False.
|
||||
"""
|
||||
from .output import print_debug
|
||||
print_debug(var, print_errors)
|
||||
|
||||
####
|
||||
# Init module template
|
||||
#########################################################################################
|
||||
def init_module(
|
||||
default_values: dict = {}
|
||||
) -> dict:
|
||||
"""
|
||||
Initializes a module template with default values.
|
||||
|
||||
Args:
|
||||
default_values (dict, optional): Dictionary containing default values to override template values. Defaults to an empty dictionary.
|
||||
|
||||
Returns:
|
||||
dict: Dictionary representing the module template with default values.
|
||||
"""
|
||||
module = {
|
||||
"name" : None,
|
||||
"type" : "generic_data_string",
|
||||
"value" : "0",
|
||||
"desc" : "",
|
||||
"unit" : "",
|
||||
"interval" : "",
|
||||
"tags" : "",
|
||||
"module_group" : "",
|
||||
"module_parent" : "",
|
||||
"min_warning" : "",
|
||||
"min_warning_forced" : "",
|
||||
"max_warning" : "",
|
||||
"max_warning_forced" : "",
|
||||
"min_critical" : "",
|
||||
"min_critical_forced" : "",
|
||||
"max_critical" : "",
|
||||
"max_critical_forced" : "",
|
||||
"str_warning" : "",
|
||||
"str_warning_forced" : "",
|
||||
"str_critical" : "",
|
||||
"str_critical_forced" : "",
|
||||
"critical_inverse" : "",
|
||||
"warning_inverse" : "",
|
||||
"max" : "",
|
||||
"min" : "",
|
||||
"post_process" : "",
|
||||
"disabled" : "",
|
||||
"min_ff_event" : "",
|
||||
"status" : "",
|
||||
"timestamp" : "",
|
||||
"custom_id" : "",
|
||||
"critical_instructions" : "",
|
||||
"warning_instructions" : "",
|
||||
"unknown_instructions" : "",
|
||||
"quiet" : "",
|
||||
"module_ff_interval" : "",
|
||||
"crontab" : "",
|
||||
"min_ff_event_normal" : "",
|
||||
"min_ff_event_warning" : "",
|
||||
"min_ff_event_critical" : "",
|
||||
"ff_type" : "",
|
||||
"ff_timeout" : "",
|
||||
"each_ff" : "",
|
||||
"module_parent_unlink" : "",
|
||||
"alert" : []
|
||||
}
|
||||
|
||||
for key, value in default_values.items():
|
||||
if key in module:
|
||||
module[key] = value
|
||||
|
||||
return module
|
||||
|
||||
####
|
||||
# Returns module in XML format. Accepts only {dict}
|
||||
#########################################################################################
|
||||
def print_module(
|
||||
module: dict = None,
|
||||
print_flag: bool = False
|
||||
) -> str:
|
||||
"""
|
||||
Returns module in XML format. Accepts only {dict}.
|
||||
|
||||
Args:
|
||||
module (dict, optional): Dictionary containing module data. Defaults to None.
|
||||
print_flag (bool, optional): Flag to print the module XML to STDOUT. Defaults to False.
|
||||
|
||||
Returns:
|
||||
str: Module data in XML format.
|
||||
"""
|
||||
from .output import print_stdout
|
||||
|
||||
module_xml = ""
|
||||
|
||||
if module is not None:
|
||||
data = dict(module)
|
||||
module_xml = ("<module>\n"
|
||||
"\t<name><![CDATA[" + str(data["name"]) + "]]></name>\n"
|
||||
"\t<type>" + str(data["type"]) + "</type>\n"
|
||||
)
|
||||
|
||||
if type(data["type"]) is not str and "string" not in data["type"]: #### Strip spaces if module not generic_data_string
|
||||
data["value"] = data["value"].strip()
|
||||
|
||||
if isinstance(data["value"], list): # Checks if value is a list
|
||||
module_xml += "\t<datalist>\n"
|
||||
for value in data["value"]:
|
||||
if type(value) is dict and "value" in value:
|
||||
module_xml += "\t<data>\n"
|
||||
module_xml += "\t\t<value><![CDATA[" + str(value["value"]) + "]]></value>\n"
|
||||
if "timestamp" in value:
|
||||
module_xml += "\t\t<timestamp><![CDATA[" + str(value["timestamp"]) + "]]></timestamp>\n"
|
||||
module_xml += "\t</data>\n"
|
||||
module_xml += "\t</datalist>\n"
|
||||
else:
|
||||
module_xml += "\t<data><![CDATA[" + str(data["value"]) + "]]></data>\n"
|
||||
|
||||
if "desc" in data and len(str(data["desc"]).strip()) > 0:
|
||||
module_xml += "\t<description><![CDATA[" + str(data["desc"]) + "]]></description>\n"
|
||||
|
||||
if "unit" in data and len(str(data["unit"]).strip()) > 0:
|
||||
module_xml += "\t<unit><![CDATA[" + str(data["unit"]) + "]]></unit>\n"
|
||||
|
||||
if "interval" in data and len(str(data["interval"]).strip()) > 0:
|
||||
module_xml += "\t<module_interval><![CDATA[" + str(data["interval"]) + "]]></module_interval>\n"
|
||||
|
||||
if "tags" in data and len(str(data["tags"]).strip()) > 0:
|
||||
module_xml += "\t<tags>" + str(data["tags"]) + "</tags>\n"
|
||||
|
||||
if "module_group" in data and len(str(data["module_group"]).strip()) > 0:
|
||||
module_xml += "\t<module_group>" + str(data["module_group"]) + "</module_group>\n"
|
||||
|
||||
if "module_parent" in data and len(str(data["module_parent"]).strip()) > 0:
|
||||
module_xml += "\t<module_parent>" + str(data["module_parent"]) + "</module_parent>\n"
|
||||
|
||||
if "min_warning" in data and len(str(data["min_warning"]).strip()) > 0:
|
||||
module_xml += "\t<min_warning><![CDATA[" + str(data["min_warning"]) + "]]></min_warning>\n"
|
||||
|
||||
if "min_warning_forced" in data and len(str(data["min_warning_forced"]).strip()) > 0:
|
||||
module_xml += "\t<min_warning_forced><![CDATA[" + str(data["min_warning_forced"]) + "]]></min_warning_forced>\n"
|
||||
|
||||
if "max_warning" in data and len(str(data["max_warning"]).strip()) > 0:
|
||||
module_xml += "\t<max_warning><![CDATA[" + str(data["max_warning"]) + "]]></max_warning>\n"
|
||||
|
||||
if "max_warning_forced" in data and len(str(data["max_warning_forced"]).strip()) > 0:
|
||||
module_xml += "\t<max_warning_forced><![CDATA[" + str(data["max_warning_forced"]) + "]]></max_warning_forced>\n"
|
||||
|
||||
if "min_critical" in data and len(str(data["min_critical"]).strip()) > 0:
|
||||
module_xml += "\t<min_critical><![CDATA[" + str(data["min_critical"]) + "]]></min_critical>\n"
|
||||
|
||||
if "min_critical_forced" in data and len(str(data["min_critical_forced"]).strip()) > 0:
|
||||
module_xml += "\t<min_critical_forced><![CDATA[" + str(data["min_critical_forced"]) + "]]></min_critical_forced>\n"
|
||||
|
||||
if "max_critical" in data and len(str(data["max_critical"]).strip()) > 0:
|
||||
module_xml += "\t<max_critical><![CDATA[" + str(data["max_critical"]) + "]]></max_critical>\n"
|
||||
|
||||
if "max_critical_forced" in data and len(str(data["max_critical_forced"]).strip()) > 0:
|
||||
module_xml += "\t<max_critical_forced><![CDATA[" + str(data["max_critical_forced"]) + "]]></max_critical_forced>\n"
|
||||
|
||||
if "str_warning" in data and len(str(data["str_warning"]).strip()) > 0:
|
||||
module_xml += "\t<str_warning><![CDATA[" + str(data["str_warning"]) + "]]></str_warning>\n"
|
||||
|
||||
if "str_warning_forced" in data and len(str(data["str_warning_forced"]).strip()) > 0:
|
||||
module_xml += "\t<str_warning_forced><![CDATA[" + str(data["str_warning_forced"]) + "]]></str_warning_forced>\n"
|
||||
|
||||
if "str_critical" in data and len(str(data["str_critical"]).strip()) > 0:
|
||||
module_xml += "\t<str_critical><![CDATA[" + str(data["str_critical"]) + "]]></str_critical>\n"
|
||||
|
||||
if "str_critical_forced" in data and len(str(data["str_critical_forced"]).strip()) > 0:
|
||||
module_xml += "\t<str_critical_forced><![CDATA[" + str(data["str_critical_forced"]) + "]]></str_critical_forced>\n"
|
||||
|
||||
if "critical_inverse" in data and len(str(data["critical_inverse"]).strip()) > 0:
|
||||
module_xml += "\t<critical_inverse><![CDATA[" + str(data["critical_inverse"]) + "]]></critical_inverse>\n"
|
||||
|
||||
if "warning_inverse" in data and len(str(data["warning_inverse"]).strip()) > 0:
|
||||
module_xml += "\t<warning_inverse><![CDATA[" + str(data["warning_inverse"]) + "]]></warning_inverse>\n"
|
||||
|
||||
if "max" in data and len(str(data["max"]).strip()) > 0:
|
||||
module_xml += "\t<max><![CDATA[" + str(data["max"]) + "]]></max>\n"
|
||||
|
||||
if "min" in data and len(str(data["min"]).strip()) > 0:
|
||||
module_xml += "\t<min><![CDATA[" + str(data["min"]) + "]]></min>\n"
|
||||
|
||||
if "post_process" in data and len(str(data["post_process"]).strip()) > 0:
|
||||
module_xml += "\t<post_process><![CDATA[" + str(data["post_process"]) + "]]></post_process>\n"
|
||||
|
||||
if "disabled" in data and len(str(data["disabled"]).strip()) > 0:
|
||||
module_xml += "\t<disabled><![CDATA[" + str(data["disabled"]) + "]]></disabled>\n"
|
||||
|
||||
if "min_ff_event" in data and len(str(data["min_ff_event"]).strip()) > 0:
|
||||
module_xml += "\t<min_ff_event><![CDATA[" + str(data["min_ff_event"]) + "]]></min_ff_event>\n"
|
||||
|
||||
if "status" in data and len(str(data["status"]).strip()) > 0:
|
||||
module_xml += "\t<status><![CDATA[" + str(data["status"]) + "]]></status>\n"
|
||||
|
||||
if "timestamp" in data and len(str(data["timestamp"]).strip()) > 0:
|
||||
module_xml += "\t<timestamp><![CDATA[" + str(data["timestamp"]) + "]]></timestamp>\n"
|
||||
|
||||
if "custom_id" in data and len(str(data["custom_id"]).strip()) > 0:
|
||||
module_xml += "\t<custom_id><![CDATA[" + str(data["custom_id"]) + "]]></custom_id>\n"
|
||||
|
||||
if "critical_instructions" in data and len(str(data["critical_instructions"]).strip()) > 0:
|
||||
module_xml += "\t<critical_instructions><![CDATA[" + str(data["critical_instructions"]) + "]]></critical_instructions>\n"
|
||||
|
||||
if "warning_instructions" in data and len(str(data["warning_instructions"]).strip()) > 0:
|
||||
module_xml += "\t<warning_instructions><![CDATA[" + str(data["warning_instructions"]) + "]]></warning_instructions>\n"
|
||||
|
||||
if "unknown_instructions" in data and len(str(data["unknown_instructions"]).strip()) > 0:
|
||||
module_xml += "\t<unknown_instructions><![CDATA[" + str(data["unknown_instructions"]) + "]]></unknown_instructions>\n"
|
||||
|
||||
if "quiet" in data and len(str(data["quiet"]).strip()) > 0:
|
||||
module_xml += "\t<quiet><![CDATA[" + str(data["quiet"]) + "]]></quiet>\n"
|
||||
|
||||
if "module_ff_interval" in data and len(str(data["module_ff_interval"]).strip()) > 0:
|
||||
module_xml += "\t<module_ff_interval><![CDATA[" + str(data["module_ff_interval"]) + "]]></module_ff_interval>\n"
|
||||
|
||||
if "crontab" in data and len(str(data["crontab"]).strip()) > 0:
|
||||
module_xml += "\t<crontab><![CDATA[" + str(data["crontab"]) + "]]></crontab>\n"
|
||||
|
||||
if "min_ff_event_normal" in data and len(str(data["min_ff_event_normal"]).strip()) > 0:
|
||||
module_xml += "\t<min_ff_event_normal><![CDATA[" + str(data["min_ff_event_normal"]) + "]]></min_ff_event_normal>\n"
|
||||
|
||||
if "min_ff_event_warning" in data and len(str(data["min_ff_event_warning"]).strip()) > 0:
|
||||
module_xml += "\t<min_ff_event_warning><![CDATA[" + str(data["min_ff_event_warning"]) + "]]></min_ff_event_warning>\n"
|
||||
|
||||
if "min_ff_event_critical" in data and len(str(data["min_ff_event_critical"]).strip()) > 0:
|
||||
module_xml += "\t<min_ff_event_critical><![CDATA[" + str(data["min_ff_event_critical"]) + "]]></min_ff_event_critical>\n"
|
||||
|
||||
if "ff_type" in data and len(str(data["ff_type"]).strip()) > 0:
|
||||
module_xml += "\t<ff_type><![CDATA[" + str(data["ff_type"]) + "]]></ff_type>\n"
|
||||
|
||||
if "ff_timeout" in data and len(str(data["ff_timeout"]).strip()) > 0:
|
||||
module_xml += "\t<ff_timeout><![CDATA[" + str(data["ff_timeout"]) + "]]></ff_timeout>\n"
|
||||
|
||||
if "each_ff" in data and len(str(data["each_ff"]).strip()) > 0:
|
||||
module_xml += "\t<each_ff><![CDATA[" + str(data["each_ff"]) + "]]></each_ff>\n"
|
||||
|
||||
if "module_parent_unlink" in data and len(str(data["module_parent_unlink"]).strip()) > 0:
|
||||
module_xml += "\t<module_parent_unlink><![CDATA[" + str(data["module_parent_unlink"]) + "]]></module_parent_unlink>\n"
|
||||
|
||||
if "alert" in data:
|
||||
for alert in data["alert"]:
|
||||
if len(str(alert).strip()) > 0:
|
||||
module_xml += "\t<alert_template><![CDATA[" + str(alert) + "]]></alert_template>\n"
|
||||
module_xml += "</module>\n"
|
||||
|
||||
if print_flag:
|
||||
print_stdout(module_xml)
|
||||
|
||||
return module_xml
|
||||
|
||||
####
|
||||
# Init log module template
|
||||
#########################################################################################
|
||||
def init_log_module(
|
||||
default_values: dict = {}
|
||||
) -> dict:
|
||||
"""
|
||||
Initializes a log module template with default values.
|
||||
|
||||
Args:
|
||||
default_values (dict, optional): Default values to initialize the log module with. Defaults to an empty dictionary.
|
||||
|
||||
Returns:
|
||||
dict: Dictionary representing the log module template with default values.
|
||||
"""
|
||||
module = {
|
||||
"source" : None,
|
||||
"value" : ""
|
||||
}
|
||||
|
||||
for key, value in default_values.items():
|
||||
if key in module:
|
||||
module[key] = value
|
||||
|
||||
return module
|
||||
|
||||
####
|
||||
# Returns log module in XML format. Accepts only {dict}
|
||||
#########################################################################################
|
||||
|
||||
def print_log_module(
|
||||
module: dict = None,
|
||||
print_flag: bool = False
|
||||
) -> str:
|
||||
"""
|
||||
Returns log module in XML format. Accepts only {dict}.
|
||||
- Only works with one module at a time: otherwise iteration is needed.
|
||||
- Module "value" field accepts str type.
|
||||
- Use not_print_flag to avoid printing the XML (only populates variables).
|
||||
|
||||
Args:
|
||||
module (dict, optional): Dictionary representing the log module. Defaults to None.
|
||||
print_flag (bool, optional): Flag to indicate whether to print the XML. Defaults to False.
|
||||
|
||||
Returns:
|
||||
str: XML representation of the log module.
|
||||
"""
|
||||
|
||||
from .output import print_stdout
|
||||
|
||||
module_xml = ""
|
||||
|
||||
if module is not None:
|
||||
data = dict(module)
|
||||
module_xml = ("<log_module>\n"
|
||||
"\t<source><![CDATA[" + str(data["source"]) + "]]></source>\n"
|
||||
"\t<data>\"" + str(data["value"]) + "\"</data>\n"
|
||||
)
|
||||
|
||||
module_xml += "</log_module>\n"
|
||||
|
||||
if print_flag:
|
||||
print_stdout(module_xml)
|
||||
|
||||
return module_xml
|
|
@ -0,0 +1,137 @@
|
|||
import sys
|
||||
import os
|
||||
import json
|
||||
|
||||
####
|
||||
# Internal: Alias for output.print_debug function
|
||||
#########################################################################################
|
||||
|
||||
def _print_debug(
|
||||
var = "",
|
||||
print_errors: bool = False
|
||||
):
|
||||
"""
|
||||
Prints any list, dict, string, float or integer as a json
|
||||
|
||||
Args:
|
||||
var (any, optional): Variable to be printed. Defaults to "".
|
||||
print_errors (bool, optional): Flag to indicate whether to print errors. Defaults to False.
|
||||
"""
|
||||
print_debug(var, print_errors)
|
||||
|
||||
####
|
||||
# Prints message in stdout
|
||||
#########################################################################################
|
||||
|
||||
def print_stdout(
|
||||
message: str = ""
|
||||
)-> None:
|
||||
"""
|
||||
Prints message in stdout
|
||||
|
||||
Args:
|
||||
message (str, optional): Message to be printed. Defaults to "".
|
||||
|
||||
Returns:
|
||||
None
|
||||
"""
|
||||
print(message)
|
||||
|
||||
####
|
||||
# Prints message in stderr
|
||||
#########################################################################################
|
||||
|
||||
def print_stderr(
|
||||
message: str = ""
|
||||
)-> None:
|
||||
"""
|
||||
Prints message in stderr
|
||||
|
||||
Args:
|
||||
message (str, optional): Message to be printed. Defaults to "".
|
||||
|
||||
Returns:
|
||||
None
|
||||
"""
|
||||
print(message, file=sys.stderr)
|
||||
|
||||
####
|
||||
# Prints dictionary in formatted json string.
|
||||
#########################################################################################
|
||||
|
||||
def print_debug(
|
||||
var = "",
|
||||
print_errors: bool = False
|
||||
)-> None:
|
||||
"""
|
||||
Prints any list, dict, string, float or integer as a json
|
||||
|
||||
Args:
|
||||
var: Variable to be printed.
|
||||
print_errors (bool, optional): Whether to print errors. Defaults to False.
|
||||
|
||||
Returns:
|
||||
None
|
||||
"""
|
||||
try:
|
||||
debug_json = json.dumps(var, indent=4)
|
||||
print_stdout(debug_json)
|
||||
except json.JSONDecodeError as e:
|
||||
if print_errors:
|
||||
print_stderr(f"debug_dict: Failed to dump. Error: {e}")
|
||||
except Exception as e:
|
||||
if print_errors:
|
||||
print_stderr(f"debug_dict: Unexpected error: {e}")
|
||||
|
||||
####
|
||||
# Add new line to log file
|
||||
#########################################################################################
|
||||
def logger(
|
||||
log_file: str = "",
|
||||
message: str = "",
|
||||
log_level: str = "",
|
||||
add_date: bool = True,
|
||||
print_errors: bool = False
|
||||
) -> bool:
|
||||
'''
|
||||
Add new line to log file
|
||||
|
||||
Args:
|
||||
log_file (str): Path to the log file.
|
||||
message (str): Message to be added to the log.
|
||||
log_level (str): Log level, if applicable. Defaults to an empty string.
|
||||
add_date (bool): Whether to add the current date and time to the log entry. Defaults to True.
|
||||
print_errors (bool): Whether to print errors. Defaults to False.
|
||||
|
||||
Returns:
|
||||
bool: True if the log entry was successfully added, False otherwise.
|
||||
'''
|
||||
from .general import now
|
||||
|
||||
try:
|
||||
if not os.path.exists(log_file):
|
||||
with open(log_file, 'w') as file:
|
||||
pass # Creates an empty file
|
||||
elif not os.access(log_file, os.W_OK):
|
||||
if print_errors:
|
||||
print_stderr(f"Log file '{log_file}' is not writable.")
|
||||
return False
|
||||
|
||||
with open(log_file, 'a') as file:
|
||||
final_message = ""
|
||||
|
||||
if add_date:
|
||||
final_message += now() + " "
|
||||
if log_level != "":
|
||||
final_message += "[" + log_level + "] "
|
||||
|
||||
final_message += message + "\n"
|
||||
|
||||
file.write(final_message)
|
||||
|
||||
return True
|
||||
|
||||
except Exception as e:
|
||||
if print_errors:
|
||||
print_stderr(f"An error occurred while appending to the log: {e}")
|
||||
return False
|
|
@ -0,0 +1,330 @@
|
|||
from easysnmp import Session
|
||||
from pysnmp.hlapi import *
|
||||
|
||||
####
|
||||
# Define global variables dict, used in functions as default values.
|
||||
# Its values can be changed.
|
||||
#########################################################################################
|
||||
|
||||
_GLOBAL_VARIABLES = {
|
||||
'hostname' : "",
|
||||
'version' : 1,
|
||||
'community' : "public",
|
||||
'user' : "",
|
||||
'auth_protocol' : "",
|
||||
'auth_password' : "",
|
||||
'privacy_protocol' : "",
|
||||
'privacy_password' : "",
|
||||
'security_level' : "noAuthNoPriv",
|
||||
'timeout' : 2,
|
||||
'retries' : 1,
|
||||
'remote_port' : 161,
|
||||
}
|
||||
|
||||
|
||||
####
|
||||
# Set a global variable with the specified name and assigns a value to it.
|
||||
#########################################################################################
|
||||
def set_global_variable(
|
||||
variable_name: str = "",
|
||||
value = None
|
||||
)-> None:
|
||||
"""
|
||||
Sets the value of a global variable in the '_GLOBAL_VARIABLES' dictionary.
|
||||
|
||||
Args:
|
||||
variable_name (str): Name of the variable to set.
|
||||
value (any): Value to assign to the variable.
|
||||
|
||||
Returns:
|
||||
None
|
||||
"""
|
||||
from .general import set_dict_key_value
|
||||
|
||||
set_dict_key_value(_GLOBAL_VARIABLES, variable_name, value)
|
||||
|
||||
####
|
||||
# Get a global variable with the specified name.
|
||||
#########################################################################################
|
||||
def get_global_variable(
|
||||
variable_name: str = ""
|
||||
)-> None:
|
||||
"""
|
||||
Gets the value of a global variable in the '_GLOBAL_VARIABLES' dictionary.
|
||||
|
||||
Args:
|
||||
variable_name (str): Name of the variable to set.
|
||||
|
||||
Returns:
|
||||
None
|
||||
"""
|
||||
from .general import get_dict_key_value
|
||||
|
||||
get_dict_key_value(_GLOBAL_VARIABLES, variable_name)
|
||||
|
||||
####
|
||||
# A class that represents an SNMP target, providing methods for setting up SNMP configuration and performing SNMP operations like GET and WALK.
|
||||
#########################################################################################
|
||||
class SNMPTarget:
|
||||
"""
|
||||
A class that represents an SNMP target, providing methods for setting up SNMP configuration
|
||||
and performing SNMP operations like GET and WALK.
|
||||
"""
|
||||
def __init__(
|
||||
self,
|
||||
host: str = _GLOBAL_VARIABLES['hostname'],
|
||||
version: int = _GLOBAL_VARIABLES['version'],
|
||||
community: str = _GLOBAL_VARIABLES['community'],
|
||||
user: str = _GLOBAL_VARIABLES['user'],
|
||||
auth_protocol: str = _GLOBAL_VARIABLES['auth_protocol'],
|
||||
auth_password: str = _GLOBAL_VARIABLES['auth_password'],
|
||||
privacy_protocol: str = _GLOBAL_VARIABLES['privacy_protocol'],
|
||||
privacy_password: str = _GLOBAL_VARIABLES['privacy_password'],
|
||||
security_level: str = _GLOBAL_VARIABLES['security_level'],
|
||||
timeout: int = _GLOBAL_VARIABLES['timeout'],
|
||||
retries: int = _GLOBAL_VARIABLES['retries'],
|
||||
remote_port: int = _GLOBAL_VARIABLES['remote_port']):
|
||||
|
||||
self.session = create_snmp_session(
|
||||
host,
|
||||
version,
|
||||
community,
|
||||
user,
|
||||
auth_protocol,
|
||||
auth_password,
|
||||
privacy_protocol,
|
||||
privacy_password,
|
||||
security_level,
|
||||
timeout,
|
||||
retries,
|
||||
remote_port
|
||||
)
|
||||
|
||||
####
|
||||
# Performs an SNMP GET operation to retrieve the value of a specified OID.
|
||||
#########################################################################################
|
||||
def snmp_get(self, oid):
|
||||
"""
|
||||
Performs an SNMP GET operation to retrieve the value of a specified OID.
|
||||
|
||||
Args:
|
||||
oid (str): The OID (Object Identifier) for the SNMP GET operation.
|
||||
|
||||
Returns:
|
||||
str: The value retrieved from the specified OID.
|
||||
"""
|
||||
return self.session.get(oid).value
|
||||
|
||||
####
|
||||
# Performs an SNMP WALK operation to retrieve a list of values from a subtree of the MIB.
|
||||
#########################################################################################
|
||||
def snmp_walk(self, oid):
|
||||
"""
|
||||
Performs an SNMP WALK operation to retrieve a list of values from a subtree of the MIB.
|
||||
|
||||
Args:
|
||||
oid (str): The OID (Object Identifier) representing the root of the subtree.
|
||||
|
||||
Returns:
|
||||
list: A list of values retrieved from the specified subtree.
|
||||
"""
|
||||
|
||||
oid_items = self.session.walk(oid)
|
||||
|
||||
oid_value_dict = {} # Initialize an empty dictionary
|
||||
|
||||
for item in oid_items:
|
||||
oid_with_index = f"{item.oid}.{item.oid_index}"
|
||||
oid_value_dict[oid_with_index] = item.value
|
||||
|
||||
return oid_value_dict
|
||||
|
||||
####
|
||||
# Creates an SNMP session based on the global configuration variables.
|
||||
#########################################################################################
|
||||
def create_snmp_session(
|
||||
host: str = _GLOBAL_VARIABLES['hostname'],
|
||||
version: int = _GLOBAL_VARIABLES['version'],
|
||||
community: str = _GLOBAL_VARIABLES['community'],
|
||||
user: str = _GLOBAL_VARIABLES['user'],
|
||||
auth_protocol: str = _GLOBAL_VARIABLES['auth_protocol'],
|
||||
auth_password: str = _GLOBAL_VARIABLES['auth_password'],
|
||||
privacy_protocol: str = _GLOBAL_VARIABLES['privacy_protocol'],
|
||||
privacy_password: str = _GLOBAL_VARIABLES['privacy_password'],
|
||||
security_level: str = _GLOBAL_VARIABLES['security_level'],
|
||||
timeout: int = _GLOBAL_VARIABLES['timeout'],
|
||||
retries: int = _GLOBAL_VARIABLES['retries'],
|
||||
remote_port: int = _GLOBAL_VARIABLES['remote_port']
|
||||
) -> Session:
|
||||
"""
|
||||
Creates an SNMP session based on the provided configuration or global variables.
|
||||
|
||||
Args:
|
||||
hostname (str): Hostname or IP address of the SNMP agent.
|
||||
version (int): SNMP version (1, 2, or 3).
|
||||
community (str): SNMP community string (for version 1 or 2).
|
||||
user (str): SNMPv3 username (for version 3).
|
||||
auth_protocol (str): SNMPv3 authentication protocol (e.g., 'MD5' or 'SHA').
|
||||
auth_password (str): SNMPv3 authentication password.
|
||||
privacy_protocol (str): SNMPv3 privacy protocol (e.g., 'AES' or 'DES').
|
||||
privacy_password (str): SNMPv3 privacy password.
|
||||
security_level (str): SNMPv3 security level ('noAuthNoPriv', 'authNoPriv', 'authPriv').
|
||||
timeout (int): SNMP request timeout in seconds.
|
||||
retries (int): Number of SNMP request retries.
|
||||
remote_port (int): SNMP agent port.
|
||||
|
||||
Returns:
|
||||
Session: An SNMP session configured based on the provided or global variables.
|
||||
"""
|
||||
|
||||
session_kwargs = {
|
||||
"hostname": host,
|
||||
"version": version,
|
||||
"use_numeric": True,
|
||||
"timeout": timeout,
|
||||
"retries": retries,
|
||||
"remote_port": remote_port
|
||||
}
|
||||
|
||||
if version == 1 or version == 2:
|
||||
session_kwargs["community"] = community
|
||||
elif version == 3:
|
||||
session_kwargs["security_username"] = user
|
||||
|
||||
if security_level == "authPriv":
|
||||
session_kwargs.update({
|
||||
"auth_protocol": auth_protocol,
|
||||
"auth_password": auth_password,
|
||||
"privacy_protocol": privacy_protocol,
|
||||
"privacy_password": privacy_password,
|
||||
"security_level": "auth_with_privacy"
|
||||
})
|
||||
elif security_level == "authNoPriv":
|
||||
session_kwargs.update({
|
||||
"auth_protocol": auth_protocol,
|
||||
"auth_password": auth_password,
|
||||
"security_level": "auth_without_privacy"
|
||||
})
|
||||
elif security_level == "noAuthNoPriv":
|
||||
session_kwargs["security_level"] = "no_auth_or_privacy"
|
||||
|
||||
return Session(**session_kwargs)
|
||||
|
||||
####
|
||||
# Performs an SNMP GET operation to retrieve the value of a specified OID.
|
||||
#########################################################################################
|
||||
def snmp_get(
|
||||
oid: str,
|
||||
host: str = _GLOBAL_VARIABLES['hostname'],
|
||||
version: int = _GLOBAL_VARIABLES['version'],
|
||||
community: str = _GLOBAL_VARIABLES['community'],
|
||||
user: str = _GLOBAL_VARIABLES['user'],
|
||||
auth_protocol: str = _GLOBAL_VARIABLES['auth_protocol'],
|
||||
auth_password: str = _GLOBAL_VARIABLES['auth_password'],
|
||||
privacy_protocol: str = _GLOBAL_VARIABLES['privacy_protocol'],
|
||||
privacy_password: str = _GLOBAL_VARIABLES['privacy_password'],
|
||||
security_level: str = _GLOBAL_VARIABLES['security_level'],
|
||||
timeout: int = _GLOBAL_VARIABLES['timeout'],
|
||||
retries: int = _GLOBAL_VARIABLES['retries'],
|
||||
remote_port: int = _GLOBAL_VARIABLES['remote_port']
|
||||
) -> str:
|
||||
"""
|
||||
Performs an SNMP GET operation to retrieve the value of a specified OID.
|
||||
|
||||
Args:
|
||||
oid (str): The OID (Object Identifier) for the SNMP GET operation.
|
||||
|
||||
Returns:
|
||||
str: The value retrieved from the specified OID.
|
||||
"""
|
||||
session = create_snmp_session(host,version,community,user,auth_protocol,auth_password,privacy_protocol,privacy_password,security_level,timeout,retries,remote_port)
|
||||
return session.get(oid).value
|
||||
|
||||
####
|
||||
# Performs an SNMP WALK operation to retrieve a list of values from a subtree of the MIB.
|
||||
#########################################################################################
|
||||
def snmp_walk(
|
||||
oid: str,
|
||||
host: str = _GLOBAL_VARIABLES['hostname'],
|
||||
version: int = _GLOBAL_VARIABLES['version'],
|
||||
community: str = _GLOBAL_VARIABLES['community'],
|
||||
user: str = _GLOBAL_VARIABLES['user'],
|
||||
auth_protocol: str = _GLOBAL_VARIABLES['auth_protocol'],
|
||||
auth_password: str = _GLOBAL_VARIABLES['auth_password'],
|
||||
privacy_protocol: str = _GLOBAL_VARIABLES['privacy_protocol'],
|
||||
privacy_password: str = _GLOBAL_VARIABLES['privacy_password'],
|
||||
security_level: str = _GLOBAL_VARIABLES['security_level'],
|
||||
timeout: int = _GLOBAL_VARIABLES['timeout'],
|
||||
retries: int = _GLOBAL_VARIABLES['retries'],
|
||||
remote_port: int = _GLOBAL_VARIABLES['remote_port']
|
||||
) -> dict:
|
||||
"""
|
||||
Performs an SNMP WALK operation to retrieve a list of values from a subtree of the MIB.
|
||||
|
||||
Args:
|
||||
oid (str): The OID (Object Identifier) representing the root of the subtree.
|
||||
|
||||
Returns:
|
||||
list: A list of values retrieved from the specified subtree.
|
||||
"""
|
||||
session = create_snmp_session(host,version,community,user,auth_protocol,auth_password,privacy_protocol,privacy_password,security_level,timeout,retries,remote_port)
|
||||
oid_items = session.walk(oid)
|
||||
|
||||
oid_value_dict = {}
|
||||
|
||||
for item in oid_items:
|
||||
oid_with_index = f"{item.oid}.{item.oid_index}"
|
||||
oid_value_dict[oid_with_index] = item.value
|
||||
|
||||
return oid_value_dict
|
||||
|
||||
####
|
||||
# Sends an SNMP trap to the specified destination IP using the given OID, value, and community.
|
||||
#########################################################################################
|
||||
def snmp_trap(
|
||||
trap_oid: str,
|
||||
trap_value: str,
|
||||
destination_ip: str,
|
||||
community: str) -> None:
|
||||
"""
|
||||
Sends an SNMP trap to the specified destination IP using the given OID, value, and community.
|
||||
|
||||
Args:
|
||||
trap_oid (str): The OID (Object Identifier) for the SNMP trap.
|
||||
trap_value (str): The value associated with the trap.
|
||||
destination_ip (str): The IP address of the trap's destination.
|
||||
community (str): The SNMP community string for authentication.
|
||||
|
||||
Returns:
|
||||
None
|
||||
"""
|
||||
trap_object = ObjectIdentity(trap_oid)
|
||||
trap_value = OctetString(trap_value)
|
||||
|
||||
errorIndication, errorStatus, errorIndex, varBinds = next(
|
||||
sendNotification(
|
||||
SnmpEngine(),
|
||||
CommunityData(community),
|
||||
UdpTransportTarget((destination_ip, 162)),
|
||||
ContextData(),
|
||||
'trap',
|
||||
NotificationType(
|
||||
ObjectIdentity('SNMPv2-MIB', 'coldStart')
|
||||
).addVarBinds(
|
||||
(trap_object, trap_value)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
if errorIndication:
|
||||
print('Error:', errorIndication)
|
||||
elif errorStatus:
|
||||
print(
|
||||
'%s at %s' %
|
||||
(
|
||||
errorStatus.prettyPrint(),
|
||||
errorIndex and varBinds[int(errorIndex) - 1][0] or '?'
|
||||
)
|
||||
)
|
||||
else:
|
||||
print('SNMP trap sent successfully.')
|
|
@ -0,0 +1,249 @@
|
|||
import sys
|
||||
from queue import Queue
|
||||
from threading import Thread
|
||||
from multiprocessing import Pool, Manager
|
||||
|
||||
####
|
||||
# Define multi-processing internal global variables.
|
||||
#########################################################################################
|
||||
|
||||
_MANAGER = Manager()
|
||||
_SHARED_DICT = _MANAGER.dict()
|
||||
_SHARED_DICT_LOCK = _MANAGER.Lock()
|
||||
|
||||
####
|
||||
# Internal: Alias for output.print_debug function
|
||||
#########################################################################################
|
||||
|
||||
def _print_debug(
|
||||
var = "",
|
||||
print_errors: bool = False
|
||||
):
|
||||
"""
|
||||
Prints the provided variable in a JSON-like format.
|
||||
|
||||
Args:
|
||||
var: The variable (list, dict, string, float, integer) to be printed.
|
||||
print_errors (bool): If True, prints any errors that occur during formatting.
|
||||
"""
|
||||
from .output import print_debug
|
||||
print_debug(var, print_errors)
|
||||
|
||||
####
|
||||
# Internal use only: Run a given function in a thread
|
||||
#########################################################################################
|
||||
def _single_thread(
|
||||
q = None,
|
||||
function: callable = None,
|
||||
errors: list = []
|
||||
):
|
||||
"""
|
||||
Internal use only: Runs a given function in a thread.
|
||||
|
||||
Args:
|
||||
q: A queue from which to get parameters for the function.
|
||||
function (callable): The function to be executed in the thread.
|
||||
errors (list): A list to store any errors encountered during execution.
|
||||
"""
|
||||
params=q.get()
|
||||
q.task_done()
|
||||
try:
|
||||
function(params)
|
||||
except Exception as e:
|
||||
errors.append("Error while runing single thread: "+str(e))
|
||||
|
||||
####
|
||||
# Run a given function for given items list in a given number of threads
|
||||
#########################################################################################
|
||||
def run_threads(
|
||||
max_threads: int = 1,
|
||||
function: callable = None,
|
||||
items: list = [],
|
||||
print_errors: bool = False
|
||||
) -> bool:
|
||||
"""
|
||||
Run a given function for a list of items in multiple threads.
|
||||
|
||||
Args:
|
||||
max_threads (int): Maximum number of threads to use.
|
||||
function (callable): The function to be executed in each thread.
|
||||
items (list): List of items to process.
|
||||
print_errors (bool): Whether to print errors encountered during execution.
|
||||
|
||||
Returns:
|
||||
bool: True if all threads executed successfully, False otherwise.
|
||||
"""
|
||||
from .output import print_stderr
|
||||
|
||||
# Assign threads
|
||||
threads = max_threads
|
||||
|
||||
if threads > len(items):
|
||||
threads = len(items)
|
||||
|
||||
if threads < 1:
|
||||
threads = 1
|
||||
|
||||
# Distribute items per thread
|
||||
items_per_thread = []
|
||||
thread = 0
|
||||
for item in items:
|
||||
if not 0 <= thread < len(items_per_thread):
|
||||
items_per_thread.append([])
|
||||
|
||||
items_per_thread[thread].append(item)
|
||||
|
||||
thread += 1
|
||||
if thread >= threads:
|
||||
thread=0
|
||||
|
||||
# Run threads
|
||||
try:
|
||||
q=Queue()
|
||||
for n_thread in range(threads) :
|
||||
q.put(items_per_thread[n_thread])
|
||||
|
||||
run_threads = []
|
||||
errors = []
|
||||
|
||||
for n_thread in range(threads):
|
||||
t = Thread(target=_single_thread, args=(q, function, errors))
|
||||
t.daemon=True
|
||||
t.start()
|
||||
run_threads.append(t)
|
||||
|
||||
for t in run_threads:
|
||||
t.join()
|
||||
|
||||
q.join()
|
||||
|
||||
if print_errors:
|
||||
for error in errors:
|
||||
print_stderr(str(error))
|
||||
|
||||
if len(errors) > 0:
|
||||
return False
|
||||
else:
|
||||
return True
|
||||
|
||||
except Exception as e:
|
||||
if print_errors:
|
||||
print_stderr("Error while running threads: "+str(e))
|
||||
return False
|
||||
|
||||
####
|
||||
# Set a given value to a key in the internal shared dict.
|
||||
# Used by all parallel processes.
|
||||
#########################################################################################
|
||||
def set_shared_dict_value(
|
||||
key: str = None,
|
||||
value = None
|
||||
)-> None:
|
||||
"""
|
||||
Set a value for a key in the internal shared dictionary.
|
||||
This function is used by all parallel processes.
|
||||
|
||||
Args:
|
||||
key (str): The key in the shared dictionary.
|
||||
value: The value to be assigned to the key.
|
||||
"""
|
||||
global _SHARED_DICT
|
||||
|
||||
if key is not None:
|
||||
with _SHARED_DICT_LOCK:
|
||||
_SHARED_DICT[key] = value
|
||||
|
||||
####
|
||||
# Add a given value to a key in the internal shared dict.
|
||||
# Used by all parallel processes.
|
||||
#########################################################################################
|
||||
def add_shared_dict_value(
|
||||
key: str = None,
|
||||
value = None
|
||||
)-> None:
|
||||
"""
|
||||
Add a value to a key in the internal shared dictionary.
|
||||
This function is used by all parallel processes.
|
||||
|
||||
Args:
|
||||
key (str): The key in the shared dictionary.
|
||||
value: The value to be added to the key.
|
||||
"""
|
||||
global _SHARED_DICT
|
||||
|
||||
if key is not None:
|
||||
with _SHARED_DICT_LOCK:
|
||||
if key in _SHARED_DICT:
|
||||
_SHARED_DICT[key] += value
|
||||
else:
|
||||
set_shared_dict_value(key, value)
|
||||
|
||||
####
|
||||
# Get the value of a key in the internal shared dict.
|
||||
# Used by all parallel processes.
|
||||
#########################################################################################
|
||||
def get_shared_dict_value(
|
||||
key: str = None
|
||||
):
|
||||
"""
|
||||
Get the value of a key in the internal shared dictionary.
|
||||
This function is used by all parallel processes.
|
||||
|
||||
Args:
|
||||
key (str): The key in the shared dictionary.
|
||||
|
||||
Returns:
|
||||
The value associated with the key, or None if the key does not exist.
|
||||
"""
|
||||
global _SHARED_DICT
|
||||
|
||||
with _SHARED_DICT_LOCK:
|
||||
if key in _SHARED_DICT and key is not None:
|
||||
return _SHARED_DICT[key]
|
||||
else:
|
||||
return None
|
||||
|
||||
####
|
||||
# Run a given function for given items list in a given number of processes
|
||||
# Given function receives each item as first parameter
|
||||
#########################################################################################
|
||||
def run_processes(
|
||||
max_processes: int = 1,
|
||||
function: callable = None,
|
||||
items: list = [],
|
||||
print_errors: bool = False
|
||||
) -> bool:
|
||||
"""
|
||||
Run a given function for given items list in a given number of processes
|
||||
|
||||
Args:
|
||||
max_processes (int): The maximum number of processes to run in parallel.
|
||||
function (callable): The function to be executed for each item.
|
||||
items (list): List of items to be processed.
|
||||
print_errors (bool): Whether to print errors.
|
||||
|
||||
Returns:
|
||||
bool: True if all processes completed successfully, False otherwise.
|
||||
"""
|
||||
from .output import print_stderr
|
||||
|
||||
# Assign processes
|
||||
processes = max_processes
|
||||
|
||||
if processes > len(items):
|
||||
processes = len(items)
|
||||
|
||||
if processes < 1:
|
||||
processes = 1
|
||||
|
||||
# Run processes
|
||||
with Pool(processes) as pool:
|
||||
try:
|
||||
pool.map(function, items)
|
||||
result = True
|
||||
except Exception as error:
|
||||
if print_errors:
|
||||
print_stderr(str(error))
|
||||
result = False
|
||||
|
||||
return result
|
|
@ -0,0 +1,258 @@
|
|||
from datetime import datetime
|
||||
from subprocess import *
|
||||
import shutil
|
||||
import subprocess
|
||||
import os
|
||||
import sys
|
||||
|
||||
####
|
||||
# Define global variables dict, used in functions as default values.
|
||||
# Its values can be changed.
|
||||
#########################################################################################
|
||||
|
||||
_GLOBAL_VARIABLES = {
|
||||
'transfer_mode' : 'tentacle',
|
||||
'temporal' : '/tmp',
|
||||
'data_dir' : '/var/spool/pandora/data_in/',
|
||||
'tentacle_client' : 'tentacle_client',
|
||||
'tentacle_ip' : '127.0.0.1',
|
||||
'tentacle_port' : 41121,
|
||||
'tentacle_extra_opts' : '',
|
||||
'tentacle_retries' : 1
|
||||
}
|
||||
|
||||
####
|
||||
# Internal: Alias for output.print_debug function
|
||||
#########################################################################################
|
||||
|
||||
def _print_debug(
|
||||
var = "",
|
||||
print_errors: bool = False
|
||||
):
|
||||
"""
|
||||
Prints any list, dict, string, float or integer as a json
|
||||
|
||||
Args:
|
||||
var: The variable to be printed.
|
||||
print_errors (bool): Whether to print errors.
|
||||
"""
|
||||
from .output import print_debug
|
||||
print_debug(var, print_errors)
|
||||
|
||||
####
|
||||
# Set a global variable with the specified name and assigns a value to it.
|
||||
#########################################################################################
|
||||
def set_global_variable(
|
||||
variable_name: str = "",
|
||||
value = None
|
||||
)-> None:
|
||||
"""
|
||||
Sets the value of a global variable in the '_GLOBAL_VARIABLES' dictionary.
|
||||
|
||||
Args:
|
||||
variable_name (str): Name of the variable to set.
|
||||
value (any): Value to assign to the variable.
|
||||
|
||||
Returns:
|
||||
None
|
||||
"""
|
||||
from .general import set_dict_key_value
|
||||
|
||||
set_dict_key_value(_GLOBAL_VARIABLES, variable_name, value)
|
||||
|
||||
####
|
||||
# Get a global variable with the specified name.
|
||||
#########################################################################################
|
||||
def get_global_variable(
|
||||
variable_name: str = ""
|
||||
)-> None:
|
||||
"""
|
||||
Gets the value of a global variable in the '_GLOBAL_VARIABLES' dictionary.
|
||||
|
||||
Args:
|
||||
variable_name (str): Name of the variable to set.
|
||||
|
||||
Returns:
|
||||
None
|
||||
"""
|
||||
from .general import get_dict_key_value
|
||||
|
||||
get_dict_key_value(_GLOBAL_VARIABLES, variable_name)
|
||||
|
||||
####
|
||||
# Sends file using tentacle protocol
|
||||
#########################################################################################
|
||||
def tentacle_xml(
|
||||
data_file: str = "",
|
||||
tentacle_ops: dict = {},
|
||||
tentacle_path: str = _GLOBAL_VARIABLES['tentacle_client'],
|
||||
retry: bool = False,
|
||||
debug: int = 0,
|
||||
print_errors: bool = True
|
||||
) -> bool:
|
||||
"""
|
||||
Sends file using tentacle protocol
|
||||
|
||||
Args:
|
||||
data_file (str): Path to the data file to be sent.
|
||||
tentacle_ops (dict): Tentacle options as a dictionary (address [password] [port]).
|
||||
tentacle_path (str): Custom path for the tentacle client executable.
|
||||
retry (bool): Whether to retry sending the file if it fails.
|
||||
debug (int): Debug mode flag. If enabled (1), the data file will not be removed after sending.
|
||||
print_errors (bool): Whether to print error messages.
|
||||
|
||||
Returns:
|
||||
bool: True for success, False for errors.
|
||||
"""
|
||||
from .output import print_stderr
|
||||
|
||||
if data_file is not None :
|
||||
|
||||
if not 'address' in tentacle_ops:
|
||||
tentacle_ops['address'] = _GLOBAL_VARIABLES['tentacle_ip']
|
||||
if not 'port' in tentacle_ops:
|
||||
tentacle_ops['port'] = _GLOBAL_VARIABLES['tentacle_port']
|
||||
if not 'extra_opts' in tentacle_ops:
|
||||
tentacle_ops['extra_opts'] = _GLOBAL_VARIABLES['tentacle_extra_opts']
|
||||
|
||||
if tentacle_ops['address'] is None :
|
||||
if print_errors:
|
||||
print_stderr("Tentacle error: No address defined")
|
||||
return False
|
||||
|
||||
try :
|
||||
with open(data_file.strip(), 'r') as data:
|
||||
data.read()
|
||||
data.close()
|
||||
except Exception as e :
|
||||
if print_errors:
|
||||
print_stderr(f"Tentacle error: {type(e).__name__} {e}")
|
||||
return False
|
||||
|
||||
tentacle_cmd = f"{tentacle_path} -v -a {tentacle_ops['address']} -p {tentacle_ops['port']} {tentacle_ops['extra_opts']} {data_file.strip()}"
|
||||
tentacle_exe=subprocess.Popen(tentacle_cmd, stdout=subprocess.PIPE,stderr=subprocess.PIPE, shell=True)
|
||||
rc=tentacle_exe.wait()
|
||||
|
||||
result = True
|
||||
|
||||
if rc != 0 :
|
||||
|
||||
if retry:
|
||||
|
||||
tentacle_retries = _GLOBAL_VARIABLES['tentacle_retries']
|
||||
|
||||
if tentacle_retries < 1:
|
||||
tentacle_retries = 1
|
||||
|
||||
retry_count = 0
|
||||
|
||||
while retry_count < tentacle_retries :
|
||||
|
||||
tentacle_exe=subprocess.Popen(tentacle_cmd, stdout=subprocess.PIPE,stderr=subprocess.PIPE, shell=True)
|
||||
rc=tentacle_exe.wait()
|
||||
|
||||
if rc == 0:
|
||||
break
|
||||
|
||||
if print_errors:
|
||||
stderr = tentacle_exe.stderr.read().decode()
|
||||
msg = f"Tentacle error (Retry {retry_count + 1}/{tentacle_retries}): {stderr}"
|
||||
print_stderr(str(datetime.today().strftime('%Y-%m-%d %H:%M')) + msg)
|
||||
|
||||
retry_count += 1
|
||||
|
||||
if retry_count >= tentacle_retries:
|
||||
result = False
|
||||
else:
|
||||
|
||||
if print_errors:
|
||||
stderr = tentacle_exe.stderr.read().decode()
|
||||
msg="Tentacle error:" + str(stderr)
|
||||
print_stderr(str(datetime.today().strftime('%Y-%m-%d %H:%M')) + msg)
|
||||
result = False
|
||||
|
||||
if debug == 0 :
|
||||
os.remove(data_file.strip())
|
||||
|
||||
return result
|
||||
|
||||
else:
|
||||
if print_errors:
|
||||
print_stderr("Tentacle error: file path is required.")
|
||||
return False
|
||||
|
||||
####
|
||||
# Detect transfer mode and send XML.
|
||||
#########################################################################################
|
||||
def transfer_xml(
|
||||
file: str = "",
|
||||
transfer_mode: str = _GLOBAL_VARIABLES['transfer_mode'],
|
||||
tentacle_ip: str = _GLOBAL_VARIABLES['tentacle_ip'],
|
||||
tentacle_port: int = _GLOBAL_VARIABLES['tentacle_port'],
|
||||
tentacle_extra_opts: str = _GLOBAL_VARIABLES['tentacle_extra_opts'],
|
||||
data_dir: str = _GLOBAL_VARIABLES['data_dir']
|
||||
)-> None:
|
||||
|
||||
"""
|
||||
Detects the transfer mode and calls the agentplugin() function to perform the transfer.
|
||||
|
||||
Args:
|
||||
file (str): Path to file to send.
|
||||
transfer_mode (str, optional): Transfer mode. Default is _GLOBAL_VARIABLES['transfer_mode'].
|
||||
tentacle_ip (str, optional): IP address for Tentacle. Default is _GLOBAL_VARIABLES['tentacle_ip'].
|
||||
tentacle_port (str, optional): Port for Tentacle. Default is _GLOBAL_VARIABLES['tentacle_port'].
|
||||
data_dir (str, optional): Path to data dir with local transfer mode. Default is _GLOBAL_VARIABLES['data_dir'].
|
||||
|
||||
Returns:
|
||||
None
|
||||
"""
|
||||
if file is not None:
|
||||
if transfer_mode != "local":
|
||||
tentacle_conf = {
|
||||
'address' : tentacle_ip,
|
||||
'port' : tentacle_port,
|
||||
'extra_opts' : tentacle_extra_opts
|
||||
}
|
||||
tentacle_xml(file, tentacle_conf)
|
||||
else:
|
||||
shutil.move(file, data_dir)
|
||||
|
||||
####
|
||||
# Creates a agent .data file in the specified data_dir folder
|
||||
#########################################################################################
|
||||
def write_xml(
|
||||
xml: str = "",
|
||||
agent_name: str = "",
|
||||
data_dir: str = _GLOBAL_VARIABLES['temporal'],
|
||||
print_errors: bool = False
|
||||
) -> str:
|
||||
"""
|
||||
Creates an agent .data file in the specified data_dir folder
|
||||
|
||||
Args:
|
||||
xml (str): XML string to be written in the file.
|
||||
agent_name (str): Agent name for the XML and file name.
|
||||
data_dir (str): Folder in which the file will be created.
|
||||
print_errors (bool): Whether to print error messages.
|
||||
|
||||
Returns:
|
||||
str: Path to the created .data file.
|
||||
"""
|
||||
from .general import generate_md5
|
||||
from .output import print_stderr
|
||||
|
||||
Utime = datetime.now().strftime('%s')
|
||||
agent_name_md5 = generate_md5(agent_name)
|
||||
data_file = "%s/%s.%s.data" %(str(data_dir),agent_name_md5,str(Utime))
|
||||
|
||||
try:
|
||||
with open(data_file, 'x') as data:
|
||||
data.write(xml)
|
||||
except OSError as o:
|
||||
if print_errors:
|
||||
print_stderr(f"ERROR - Could not write file: {o}, please check directory permissions")
|
||||
except Exception as e:
|
||||
if print_errors:
|
||||
print_stderr(f"{type(e).__name__}: {e}")
|
||||
|
||||
return data_file
|
|
@ -45,8 +45,8 @@ our @EXPORT = qw(
|
|||
);
|
||||
|
||||
# version: Defines actual version of Pandora Server for this module only
|
||||
my $pandora_version = "7.0NG.773.1";
|
||||
my $pandora_build = "230822";
|
||||
my $pandora_version = "7.0NG.773.2";
|
||||
my $pandora_build = "230823";
|
||||
our $VERSION = $pandora_version." ".$pandora_build;
|
||||
|
||||
# Setup hash
|
||||
|
|
|
@ -33,8 +33,8 @@ use base 'Exporter';
|
|||
our @ISA = qw(Exporter);
|
||||
|
||||
# version: Defines actual version of Pandora Server for this module only
|
||||
my $pandora_version = "7.0NG.773.1";
|
||||
my $pandora_build = "230822";
|
||||
my $pandora_version = "7.0NG.773.2";
|
||||
my $pandora_build = "230823";
|
||||
our $VERSION = $pandora_version." ".$pandora_build;
|
||||
|
||||
our %EXPORT_TAGS = ( 'all' => [ qw() ] );
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
#
|
||||
%global __os_install_post %{nil}
|
||||
%define name pandorafms_server
|
||||
%define version 7.0NG.773.1
|
||||
%define release 230822
|
||||
%define version 7.0NG.773.2
|
||||
%define release 1
|
||||
|
||||
Summary: Pandora FMS Server
|
||||
Name: %{name}
|
||||
|
|
|
@ -8,8 +8,8 @@
|
|||
# This code is licensed under GPL 2.0 license.
|
||||
# **********************************************************************
|
||||
|
||||
PI_VERSION="7.0NG.773.1"
|
||||
PI_BUILD="230822"
|
||||
PI_VERSION="7.0NG.773.2"
|
||||
PI_BUILD="230823"
|
||||
|
||||
MODE=$1
|
||||
if [ $# -gt 1 ]; then
|
||||
|
|
|
@ -1,7 +1,38 @@
|
|||
### Purpose of this toolkit
|
||||
## Purpose of this toolkit
|
||||
|
||||
This directory contains configuration files and small scripts to generate an environment with simulated data for testing purposes.
|
||||
|
||||
### Quik start
|
||||
To add monitoring data, inventory, groups and users to a pandorafms environment automatically Just execute:
|
||||
```
|
||||
/usr/share/pandora_server/util/load/install_load_data.sh
|
||||
```
|
||||
|
||||
This command will creates:
|
||||
- 30 Agents with inventory linux
|
||||
- 30 Agents whith inventory Windows
|
||||
- 300 Agents
|
||||
- 44 Groups
|
||||
- 34 Users
|
||||
|
||||
Will randonly add users to groups and move agents to groups.
|
||||
Creates a cronjob to generate agent data each 5 min and inventory data once a day.
|
||||
|
||||
_note: make sure you have a licence with at least 300 agents or modify the /usr/share/pandora_server/util/load/pandora_xml_stress.agents to use max your licence limit agent amount before execute_
|
||||
|
||||
## Toolset description.
|
||||
Here we describe the specific use for all the toolset the `install_load_data.sh` used automatically, to be used individualy if its needed
|
||||
|
||||
### Generation of inventory agents
|
||||
The script will use th file pandora_xml_stress.agents take by default the first 30 listed agents and add linux inventory and the last 30 listed agents and add windows inventory.
|
||||
This will generate xml data using the templates on `templates` folder.
|
||||
|
||||
to run it, execute
|
||||
```
|
||||
cd pandorafms/pandora_server/util/load
|
||||
./generate_inventory_data.sh
|
||||
```
|
||||
|
||||
### Generation of XML files to simulate agent load
|
||||
|
||||
There is a tool that comes configured with Pandora FMS to generate test data (pandora_xml_stress) and that generates XML. It has different options and in this directory is provided a configuration file and all the dictionaries and additional files to generate data of 300 agents, with pseudo-random names (like for example "7fb8a1a734c24cc22a5c75eb").
|
||||
|
@ -9,18 +40,18 @@ There is a tool that comes configured with Pandora FMS to generate test data (pa
|
|||
These agents are defined in the "pandora_xml_stress.agents" file. If you want less agents, you can delete elements in this file.
|
||||
|
||||
To execute the XML generation manually from the code repository:
|
||||
|
||||
```
|
||||
cd pandorafms/pandora_server/util/load
|
||||
perl ../pandora_xml_stress.pl pandora_xml_stress.conf
|
||||
|
||||
```
|
||||
This will generate 300 XML in the /var/spool/pandora/data_in directory.
|
||||
|
||||
If you create a scheduled execution of this command every 5 minutes (e.g. through cron), keep in mind that if the PandoraFMS server stops, it could have hundreds of thousands of XML files pending to be processed.
|
||||
|
||||
Create /etc/cron.d/pandora_stress with this content:
|
||||
|
||||
```
|
||||
*/5 * * * * root <putyourscripthere>
|
||||
|
||||
```
|
||||
|
||||
### Generation of groups and users
|
||||
|
||||
|
@ -31,6 +62,7 @@ On the other hand, it will also create a series of groups, taking as source the
|
|||
Finally, it will take all the agents available in Pandora FMS and it will distribute them in an equal and random way among the available groups.
|
||||
|
||||
You should only run it once:
|
||||
|
||||
```
|
||||
cd pandorafms/pandora_server/util/load
|
||||
./create_userandgroups.sh
|
||||
```
|
|
@ -35,7 +35,7 @@ done
|
|||
TOTAL_GROUPS=`cat groupnames.txt | wc -l`
|
||||
for username in `cat usernames.txt`
|
||||
do
|
||||
RAN=`echo $RANDOM % $TOTAL_GROUPS + 1 | bc`
|
||||
RAN=`echo $(($RANDOM % $TOTAL_GROUPS + 1))`
|
||||
GROUP_NAME=`cat groupnames.txt | tail -$RAN | head -1`
|
||||
|
||||
/usr/share/pandora_server/util/pandora_manage.pl /etc/pandora/pandora_server.conf --add_profile $username "Operator (Read)" $GROUP_NAME
|
||||
|
@ -45,7 +45,7 @@ done
|
|||
TOTAL_GROUPS=`cat groupnames.txt | wc -l`
|
||||
for agentname in `/usr/share/pandora_server/util/pandora_manage.pl /etc/pandora/pandora_server.conf --get_agents | cut -f 2 -d ","`
|
||||
do
|
||||
RAN=`echo $RANDOM % $TOTAL_GROUPS + 1 | bc`
|
||||
RAN=`echo $(($RANDOM % $TOTAL_GROUPS + 1))`
|
||||
GROUP_NAME=`cat groupnames.txt | tail -$RAN | head -1`
|
||||
/usr/share/pandora_server/util/pandora_manage.pl /etc/pandora/pandora_server.conf --update_agent $agentname group_name $GROUP_NAME
|
||||
done
|
||||
|
|
|
@ -0,0 +1,66 @@
|
|||
#!/bin/bash
|
||||
# (c) 2023 Pandora FMS
|
||||
|
||||
if [ ! -e pandora_xml_stress.agents ]
|
||||
then
|
||||
echo "Error, cant find pandora_xml_stress.agets file"
|
||||
exit
|
||||
fi
|
||||
|
||||
linux_inventory=1
|
||||
windows_inventory=1
|
||||
|
||||
# Variables
|
||||
agent_count=30
|
||||
|
||||
data_in=/var/spool/pandora/data_in/
|
||||
description='Demo data Agent'
|
||||
group='Servers'
|
||||
current_date=`date +"%Y/%m/%d %H:%M:%S"`
|
||||
current_utimestamp=`date +%s`
|
||||
|
||||
if [ $linux_inventory -eq 1 ] ; then
|
||||
|
||||
if [ ! -e templates/inventory_linux.template ]; then
|
||||
echo "Error, cant find inventory linux template"
|
||||
exit
|
||||
fi
|
||||
|
||||
echo "Enable linux invetory: adding invetory data to ${agent_count} linux agent"
|
||||
|
||||
for agent_name in $(cat pandora_xml_stress.agents | head -n ${agent_count}); do
|
||||
echo " - Adding invetory data to ${agent_name} linux agent"
|
||||
ip_add="10.0.0.$(( RANDOM % 255 + 1 ))"
|
||||
rand_number=$(( RANDOM % 10 + 1 ))
|
||||
cat "templates/inventory_linux.template" \
|
||||
| sed -e "s/{{description}}/${description}/g" \
|
||||
-e "s/{{group}}/${group}/g" \
|
||||
-e "s/{{agent_name}}/${agent_name}/g" \
|
||||
-e "s|{{date}}|${current_date}|g" \
|
||||
-e "s|{{ip_address}}|${ip_add}|g" \
|
||||
-e "s|{{rand_number}}|${rand_number}|g" \
|
||||
> /${data_in}/${agent_name}.${current_utimestamp}.data
|
||||
done
|
||||
fi
|
||||
|
||||
if [ $windows_inventory -eq 1 ]; then
|
||||
if [ ! -e templates/inventory_windows.template ]; then
|
||||
echo "Error, cant find inventory Windows template"
|
||||
exit
|
||||
fi
|
||||
echo "Enable Windows invetory: adding invetory data to ${agent_count} Windows agent"
|
||||
|
||||
for agent_name in $(cat pandora_xml_stress.agents | tail -n ${agent_count}); do
|
||||
echo " - Adding invetory data to ${agent_name} windows agent"
|
||||
ip_add="172.16.5.$(( RANDOM % 255 + 1 ))"
|
||||
rand_number=$(( RANDOM % 100 + 1 ))
|
||||
cat "templates/inventory_windows.template" \
|
||||
| sed -e "s/{{description}}/${description}/g" \
|
||||
-e "s/{{group}}/${group}/g" \
|
||||
-e "s/{{agent_name}}/${agent_name}/g" \
|
||||
-e "s|{{date}}|${current_date}|g" \
|
||||
-e "s|{{rand_number}}|${rand_number}|g" \
|
||||
-e "s|{{ip_address}}|${ip_add}|g" \
|
||||
> /${data_in}/${agent_name}.${current_utimestamp}.data
|
||||
done
|
||||
fi
|
|
@ -0,0 +1,55 @@
|
|||
#!/bin/bash
|
||||
# (c) 2023 Pandora FMS
|
||||
# This script is used to install a set of tools to load data automatically
|
||||
# by default it will creates a set of users, groups and agents
|
||||
# then set a cronjob to insert fake monitoring data to agents each 5 min
|
||||
# and inventory data once a day.
|
||||
|
||||
PREFIX=''
|
||||
|
||||
# Moving directory
|
||||
init_dir=$(pwd)
|
||||
# Get the directory where the script is located
|
||||
script_dir="$(dirname "$0")"
|
||||
# Change the working directory to the script's directory
|
||||
cd "$script_dir" || exit 1
|
||||
|
||||
# Check needed file exists
|
||||
echo ' [INFO] Checking file requirements:'
|
||||
if [ -f $PREFIX/usr/share/pandora_server/util/pandora_xml_stress.pl ] && \
|
||||
[ -f $(pwd)/pandora_xml_stress.agents ] && \
|
||||
[ -f $(pwd)/pandora_xml_stress.conf ] && \
|
||||
[ -f $(pwd)/create_usersandgroups.sh ] && \
|
||||
[ -f $(pwd)/generate_inventory_data.sh ] && \
|
||||
[ -f $(pwd)/templates/inventory_linux.template ] && \
|
||||
[ -f $(pwd)/templates/inventory_windows.template] && \
|
||||
[ -f $(pwd)/pandora_xml_stress_module_source.txt ]; then
|
||||
echo ' [INFO] All file exist, continue'
|
||||
else
|
||||
echo ' [ERROR] Missing files, please check.' && exit -1
|
||||
fi
|
||||
# Create a set of users and grups
|
||||
echo ' [INFO] Creating demo users and groups:'
|
||||
$(pwd)/generate_inventory_data.sh
|
||||
echo ' [INFO] Waiting for inventory agents to be created:'
|
||||
while [ $(ls $PREFIX/var/spool/pandora/data_in/ | wc -l) -ge 10 ]; do
|
||||
sleep 2
|
||||
echo -ne .
|
||||
done
|
||||
# Load init monitoring data
|
||||
echo ' [INFO] Creating demo agent data:'
|
||||
perl $PREFIX/usr/share/pandora_server/util/pandora_xml_stress.pl $(pwd)/pandora_xml_stress.conf || echo ' [ERROR] Generating agent data cant be completed'
|
||||
echo ' [INFO] Waiting for agents to be created:'
|
||||
while [ $(ls $PREFIX/var/spool/pandora/data_in/ | wc -l) -ge 10 ]; do
|
||||
sleep 2
|
||||
echo -ne .
|
||||
done
|
||||
# Create a set of users and grups
|
||||
echo ' [INFO] Creating demo users and groups:'
|
||||
$(pwd)/create_usersandgroups.sh
|
||||
# Set cronjobs in /etc/crotab
|
||||
echo ' [INFO] Adding data and inventory data to cronjob'
|
||||
echo "*/5 * * * * root cd $(pwd) && perl $PREFIX/usr/share/pandora_server/util/pandora_xml_stress.pl $(pwd)/pandora_xml_stress.conf " >> /etc/crontab
|
||||
echo "0 0 * * * root cd $(pwd) && $(pwd)/generate_inventory_data.sh" >> /etc/crontab
|
||||
# Get back init directory
|
||||
cd $init_dir
|
|
@ -0,0 +1,24 @@
|
|||
[1692774345] Generating XML data files for 300 agents from 2023-08-23 09:05:45 to 2023-08-23 09:05:45 interval 300.
|
||||
[1692774345] Total agents: 300
|
||||
Total modules: 3600 (12 per agent)
|
||||
Total XML: 300 (6964 per second)
|
||||
[1692774481] Generating XML data files for 300 agents from 2023-08-23 09:08:01 to 2023-08-23 09:08:01 interval 300.
|
||||
[1692774481] Total agents: 300
|
||||
Total modules: 3600 (12 per agent)
|
||||
Total XML: 300 (6996 per second)
|
||||
[1692775236] Generating XML data files for 300 agents from 2023-08-23 09:20:36 to 2023-08-23 09:20:36 interval 300.
|
||||
[1692775236] Total agents: 300
|
||||
Total modules: 3600 (12 per agent)
|
||||
Total XML: 300 (7036 per second)
|
||||
[1692775282] Generating XML data files for 300 agents from 2023-08-23 09:21:22 to 2023-08-23 09:21:22 interval 300.
|
||||
[1692775282] Total agents: 300
|
||||
Total modules: 3600 (12 per agent)
|
||||
Total XML: 300 (6935 per second)
|
||||
[1692775320] Generating XML data files for 300 agents from 2023-08-23 09:22:00 to 2023-08-23 09:22:00 interval 300.
|
||||
[1692775320] Total agents: 300
|
||||
Total modules: 3600 (12 per agent)
|
||||
Total XML: 300 (6921 per second)
|
||||
[1692775629] Generating XML data files for 300 agents from 2023-08-23 09:27:09 to 2023-08-23 09:27:09 interval 300.
|
||||
[1692775629] Total agents: 300
|
||||
Total modules: 3600 (12 per agent)
|
||||
Total XML: 300 (6927 per second)
|
|
@ -0,0 +1,192 @@
|
|||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<agent_data description='{{description}}' group='{{group}}' os_name='linux' os_version='Rocky Linux 8.7 (Green Obsidian)' interval='300' version='' timestamp='{{date}}' agent_name='{{agent_name}}' agent_alias='' timezone_offset='0' custom_id='' url_address='' address=''>
|
||||
|
||||
<inventory>
|
||||
<inventory_module>
|
||||
<name><![CDATA[IP]]></name>
|
||||
<datalist>
|
||||
<data><![CDATA[eth0;{{ip_address}} ]]></data>
|
||||
<data><![CDATA[lo;127.0.0.1 ]]></data>
|
||||
</datalist>
|
||||
</inventory_module>
|
||||
<inventory_module>
|
||||
<name><![CDATA[File system]]></name>
|
||||
<datalist>
|
||||
<data><![CDATA[overlay;38G;919G;/]]></data>
|
||||
<data><![CDATA[tmpfs;0;64M;/dev]]></data>
|
||||
<data><![CDATA[tmpfs;0;16G;/sys/fs/cgroup]]></data>
|
||||
<data><![CDATA[shm;0;64M;/dev/shm]]></data>
|
||||
<data><![CDATA[/dev/sdc;39G;918G;/tmp/pandora_code]]></data>
|
||||
<data><![CDATA[none;108K;16G;/tmp/.X11-unix]]></data>
|
||||
<data><![CDATA[/dev/sde;38G;919G;/etc/hosts]]></data>
|
||||
<data><![CDATA[tmpfs;0;16G;/proc/acpi]]></data>
|
||||
<data><![CDATA[tmpfs;0;16G;/sys/firmware]]></data>
|
||||
</datalist>
|
||||
</inventory_module>
|
||||
<inventory_module>
|
||||
<name><![CDATA[Process]]></name>
|
||||
<datalist>
|
||||
<data><![CDATA[/bin/bash /tmp/pandora_code/projects/qa_utils/run_pandora_qa/local_install_qa.sh]]></data>
|
||||
<data><![CDATA[sudo -u mysql mysqld]]></data>
|
||||
<data><![CDATA[mysqld]]></data>
|
||||
<data><![CDATA[php-fpm: master process (/etc/php-fpm.conf)]]></data>
|
||||
<data><![CDATA[php-fpm: pool www]]></data>
|
||||
<data><![CDATA[php-fpm: pool www]]></data>
|
||||
<data><![CDATA[php-fpm: pool www]]></data>
|
||||
<data><![CDATA[php-fpm: pool www]]></data>
|
||||
<data><![CDATA[php-fpm: pool www]]></data>
|
||||
<data><![CDATA[httpd -k start]]></data>
|
||||
<data><![CDATA[httpd -k start]]></data>
|
||||
<data><![CDATA[httpd -k start]]></data>
|
||||
<data><![CDATA[httpd -k start]]></data>
|
||||
<data><![CDATA[httpd -k start]]></data>
|
||||
<data><![CDATA[php-fpm: pool www]]></data>
|
||||
<data><![CDATA[httpd -k start]]></data>
|
||||
<data><![CDATA[/usr/bin/perl /usr/bin/tentacle_server -F /etc/tentacle/tentacle_server.conf]]></data>
|
||||
<data><![CDATA[/usr/bin/perl /usr/bin/pandora_ha -d -p /var/run/pandora_ha.pid /etc/pandora/pandora_server.conf]]></data>
|
||||
<data><![CDATA[/usr/bin/perl /usr/bin/pandora_agent /etc/pandora]]></data>
|
||||
<data><![CDATA[/usr/bin/php /var/www/html/pandora_console/ws.php]]></data>
|
||||
<data><![CDATA[/usr/bin/gotty --permit-arguments -a 127.0.0.1 -w --port 8081 ssh]]></data>
|
||||
<data><![CDATA[/usr/bin/gotty --permit-arguments -a 127.0.0.1 -w --port 8082 telnet]]></data>
|
||||
<data><![CDATA[crond]]></data>
|
||||
<data><![CDATA[/bin/bash]]></data>
|
||||
<data><![CDATA[/usr/bin/perl /usr/bin/pandora_server /etc/pandora/pandora_server.conf -D]]></data>
|
||||
<data><![CDATA[/usr/bin/perl /etc/pandora/plugins/inventory 0]]></data>
|
||||
<data><![CDATA[sh -c ps -eo command | tail -n +2]]></data>
|
||||
<data><![CDATA[ps -eo command]]></data>
|
||||
<data><![CDATA[/usr/bin/coreutils --coreutils-prog-shebang=tail /usr/bin/tail -n +2]]></data>
|
||||
</datalist>
|
||||
</inventory_module>
|
||||
<inventory_module>
|
||||
<name><![CDATA[Kernel]]></name>
|
||||
<datalist>
|
||||
<data><![CDATA[Linux pandorafms 5.15.90.1-microsoft-standard-WSL2 #1 SMP Fri Jan 27 02:56:13 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
|
||||
]]></data>
|
||||
</datalist>
|
||||
</inventory_module>
|
||||
<inventory_module>
|
||||
<name><![CDATA[Software]]></name>
|
||||
<datalist>
|
||||
<data><![CDATA[abattis-cantarell-fonts;0.0.{{rand_number}};Cantarell, a Humanist sans-serif font family]]></data>
|
||||
<data><![CDATA[acl;2.2.53;Access control list utilities]]></data>
|
||||
<data><![CDATA[adobe-mappings-cmap;20171205;CMap resources for Adobe's character collections]]></data>
|
||||
<data><![CDATA[adobe-mappings-cmap-deprecated;20171205;Deprecated CMap resources for Adobe's character collections]]></data>
|
||||
<data><![CDATA[adobe-mappings-pdf;20180407;PDF mapping resources from Adobe]]></data>
|
||||
<data><![CDATA[adwaita-cursor-theme;3.28.0;Adwaita cursor theme]]></data>
|
||||
<data><![CDATA[adwaita-icon-theme;3.{{rand_number}}.0;Adwaita icon theme]]></data>
|
||||
<data><![CDATA[alsa-lib;1.2.7.2;The Advanced Linux Sound Architecture (ALSA) library]]></data>
|
||||
<data><![CDATA[annobin;10.67;Annotate and examine compiled binary files]]></data>
|
||||
<data><![CDATA[apr;1.6.3;Apache Portable Runtime library]]></data>
|
||||
<data><![CDATA[apr-util;1.6.1;Apache Portable Runtime Utility library]]></data>
|
||||
<data><![CDATA[python39;3.9.{{rand_number}};Version 3.9 of the Python interpreter]]></data>
|
||||
<data><![CDATA[python39-libs;3.9.{{rand_number}};Python runtime libraries]]></data>
|
||||
<data><![CDATA[python39-pip;20.{{rand_number}}.4;A tool for installing and managing Python3 packages]]></data>
|
||||
<data><![CDATA[python39-pip-wheel;20.2.4;The pip wheel]]></data>
|
||||
<data><![CDATA[python39-setuptools;50.3.2;Easily build and distribute Python 3 packages]]></data>
|
||||
<data><![CDATA[python39-setuptools-wheel;50.3.2;The setuptools wheel]]></data>
|
||||
<data><![CDATA[python39-tkinter;3.9.13;A GUI toolkit for Python]]></data>
|
||||
<data><![CDATA[python3-audit;3.0.7;Python3 bindings for libaudit]]></data>
|
||||
<data><![CDATA[python3-bind;9.11.36;A module allowing rndc commands to be sent from Python programs]]></data>
|
||||
<data><![CDATA[python3-dateutil;2.6.1;Powerful extensions to the standard datetime module]]></data>
|
||||
<data><![CDATA[python3-dbus;1.2.4;D-Bus bindings for python3]]></data>
|
||||
<data><![CDATA[python3-dnf;4.7.0;Python 3 interface to DNF]]></data>
|
||||
<data><![CDATA[python3-dnf-plugins-core;4.0.21;Core Plugins for DNF]]></data>
|
||||
<data><![CDATA[python3-gpg;1.13.1;gpgme bindings for Python 3]]></data>
|
||||
<data><![CDATA[python3-hawkey;0.63.0;Python 3 bindings for the hawkey library]]></data>
|
||||
<data><![CDATA[python3-libcomps;0.1.18;Python 3 bindings for libcomps library]]></data>
|
||||
<data><![CDATA[python3-libdnf;0.63.0;Python 3 bindings for the libdnf library.]]></data>
|
||||
<data><![CDATA[python3-libs;3.6.8;Python runtime libraries]]></data>
|
||||
<data><![CDATA[python3-libselinux;2.9;SELinux python 3 bindings for libselinux]]></data>
|
||||
<data><![CDATA[python3-libsemanage;2.9;semanage python 3 bindings for libsemanage]]></data>
|
||||
<data><![CDATA[python3-pip-wheel;9.0.3;The pip wheel]]></data>
|
||||
<data><![CDATA[python3-ply;3.9;Python Lex-Yacc]]></data>
|
||||
<data><![CDATA[python3-policycoreutils;2.9;SELinux policy core python3 interfaces]]></data>
|
||||
<data><![CDATA[python3-pyparsing;2.1.10;Python package with an object-oriented approach to text processing]]></data>
|
||||
<data><![CDATA[python3-rpm;4.14.3;Python 3 bindings for apps which will manipulate RPM packages]]></data>
|
||||
<data><![CDATA[python3-rpm-macros;3;RPM macros for building Python 3 packages]]></data>
|
||||
<data><![CDATA[python3-setools;4.3.0;Policy analysis tools for SELinux]]></data>
|
||||
<data><![CDATA[python3-setuptools-wheel;39.2.0;The setuptools wheel]]></data>
|
||||
<data><![CDATA[python3-six;1.11.0;Python 2 and 3 compatibility utilities]]></data>
|
||||
<data><![CDATA[python-rpm-macros;3;The unversioned Python RPM macros]]></data>
|
||||
<data><![CDATA[python-srpm-macros;3;RPM macros for building Python source packages]]></data>
|
||||
<data><![CDATA[qt5-srpm-macros;5.15.3;RPM macros for source Qt5 packages]]></data>
|
||||
<data><![CDATA[readline;7.0;A library for editing typed command lines]]></data>
|
||||
<data><![CDATA[redhat-rpm-config;130;Red Hat specific rpm configuration files]]></data>
|
||||
<data><![CDATA[remi-libssh2;1.10.0;A library implementing the SSH2 protocol]]></data>
|
||||
<data><![CDATA[remi-release;8.7;YUM configuration for remi repository]]></data>
|
||||
<data><![CDATA[rest;0.8.1;A library for access to RESTful web services]]></data>
|
||||
<data><![CDATA[rocky-gpg-keys;8.7;Rocky RPM GPG Keys]]></data>
|
||||
<data><![CDATA[rocky-indexhtml;8.0;Browser default start page for Rocky Linux]]></data>
|
||||
<data><![CDATA[rocky-logos-httpd;86.3;Rocky related icons and pictures used by httpd]]></data>
|
||||
<data><![CDATA[rocky-release;8.7;Rocky Linux release files]]></data>
|
||||
<data><![CDATA[rocky-repos;8.7;Rocky Linux Package Repositories]]></data>
|
||||
<data><![CDATA[rootfiles;8.1;The basic required files for the root user's directory]]></data>
|
||||
<data><![CDATA[rpm;4.14.3;The RPM package management system]]></data>
|
||||
<data><![CDATA[rpm-build-libs;4.14.3;Libraries for building and signing RPM packages]]></data>
|
||||
<data><![CDATA[rpm-libs;4.14.3;Libraries for manipulating RPM packages]]></data>
|
||||
<data><![CDATA[rrdtool;1.7.0;Round Robin Database Tool to store and display time-series data]]></data>
|
||||
<data><![CDATA[rsync;3.1.3;A program for synchronizing files over a network]]></data>
|
||||
<data><![CDATA[rust-srpm-macros;5;RPM macros for building Rust source packages]]></data>
|
||||
<data><![CDATA[samba-client-libs;4.16.4;Samba client libraries]]></data>
|
||||
<data><![CDATA[samba-common;4.16.4;Files used by both Samba servers and clients]]></data>
|
||||
<data><![CDATA[samba-common-libs;4.16.4;Libraries used by both Samba servers and clients]]></data>
|
||||
<data><![CDATA[samba-winexe;4.16.4;Samba Winexe Windows Binary]]></data>
|
||||
<data><![CDATA[sed;4.5;A GNU stream text editor]]></data>
|
||||
<data><![CDATA[setup;2.12.2;A set of system configuration and setup files]]></data>
|
||||
<data><![CDATA[shadow-utils;4.6;Utilities for managing accounts and shadow password files]]></data>
|
||||
<data><![CDATA[shared-mime-info;1.9;Shared MIME information database]]></data>
|
||||
<data><![CDATA[sound-theme-freedesktop;0.8;freedesktop.org sound theme]]></data>
|
||||
<data><![CDATA[sqlite-libs;3.26.0;Shared library for the sqlite3 embeddable SQL database engine.]]></data>
|
||||
<data><![CDATA[sscg;3.0.0;Simple SSL certificate generator]]></data>
|
||||
<data><![CDATA[sudo;1.8.29;Allows restricted root access for specified users]]></data>
|
||||
<data><![CDATA[svt-av1-libs;0.8.7;SVT-AV1 libraries]]></data>
|
||||
<data><![CDATA[systemd;239;System and Service Manager]]></data>
|
||||
<data><![CDATA[systemd-libs;239;systemd libraries]]></data>
|
||||
<data><![CDATA[systemd-pam;239;systemd PAM module]]></data>
|
||||
<data><![CDATA[systemd-udev;239;Rule-based device node and kernel event manager]]></data>
|
||||
<data><![CDATA[systemtap-sdt-devel;4.7;Static probe support tools]]></data>
|
||||
<data><![CDATA[tar;1.30;A GNU file archiving program]]></data>
|
||||
<data><![CDATA[tcl;8.6.8;Tool Command Language, pronounced tickle]]></data>
|
||||
<data><![CDATA[tk;8.6.8;The graphical toolkit for the Tcl scripting language]]></data>
|
||||
<data><![CDATA[tpm2-tss;2.3.2;TPM2.0 Software Stack]]></data>
|
||||
<data><![CDATA[tree;1.7.0;File system tree viewer]]></data>
|
||||
<data><![CDATA[ttmkfdir;3.0.9;Utility to create fonts.scale files for truetype fonts]]></data>
|
||||
<data><![CDATA[tzdata;2022g;Timezone data]]></data>
|
||||
<data><![CDATA[tzdata-java;2022g;Timezone data for Java]]></data>
|
||||
<data><![CDATA[unixODBC;2.3.7;A complete ODBC driver manager for Linux]]></data>
|
||||
<data><![CDATA[unzip;6.0;A utility for unpacking zip files]]></data>
|
||||
<data><![CDATA[util-linux;2.32.1;A collection of basic system utilities]]></data>
|
||||
<data><![CDATA[vim-common;8.0.1763;The common files needed by any version of the VIM editor]]></data>
|
||||
<data><![CDATA[vim-enhanced;8.0.1763;A version of the VIM editor which includes recent enhancements]]></data>
|
||||
<data><![CDATA[vim-filesystem;8.0.1763;VIM filesystem layout]]></data>
|
||||
<data><![CDATA[vim-minimal;8.0.1763;A minimal version of the VIM editor]]></data>
|
||||
<data><![CDATA[VMware-vSphere-Perl-SDK;6.5.0;VMware libraries for Perl. Allows connect to remote VSphere/VCenter/ESXi device.]]></data>
|
||||
<data><![CDATA[wget;1.19.5;A utility for retrieving files using the HTTP or FTP protocols]]></data>
|
||||
<data><![CDATA[which;2.21;Displays where a particular program in your path is located]]></data>
|
||||
<data><![CDATA[whois;5.5.1;Improved WHOIS client]]></data>
|
||||
<data><![CDATA[whois-nls;5.5.1;Gettext catalogs for whois tools]]></data>
|
||||
<data><![CDATA[wmic;1.4;PandoraFMS wmic binary]]></data>
|
||||
<data><![CDATA[x11vnc;0.9.16;VNC server for the current X11 session]]></data>
|
||||
<data><![CDATA[xkeyboard-config;2.28;X Keyboard Extension configuration data]]></data>
|
||||
<data><![CDATA[xterm;331;Terminal emulator for the X Window System]]></data>
|
||||
<data><![CDATA[xterm-resize;331;Set environment and terminal settings to current window size]]></data>
|
||||
<data><![CDATA[xz;5.2.4;LZMA compression utilities]]></data>
|
||||
<data><![CDATA[xz-devel;5.2.4;Devel libraries & headers for liblzma]]></data>
|
||||
<data><![CDATA[xz-libs;5.2.4;Libraries for decoding LZMA compression]]></data>
|
||||
<data><![CDATA[yum;4.7.0;Package manager]]></data>
|
||||
<data><![CDATA[yum-utils;4.0.21;Yum-utils CLI compatibility layer]]></data>
|
||||
<data><![CDATA[zip;3.0;A file compression and packaging utility compatible with PKZIP]]></data>
|
||||
<data><![CDATA[zlib;1.2.11;The compression and decompression library]]></data>
|
||||
<data><![CDATA[zlib-devel;1.2.{{rand_number}};Header files and libraries for Zlib development]]></data>
|
||||
</datalist>
|
||||
</inventory_module>
|
||||
<inventory_module>
|
||||
<name><![CDATA[Routes]]></name>
|
||||
<datalist>
|
||||
<data><![CDATA[default;_gateway;0.0.0.0;UG;0;0;eth0]]></data>
|
||||
<data><![CDATA[{{ip_address}};0.0.0.0;255.255.0.0;U;0;0;eth0]]></data>
|
||||
</datalist>
|
||||
</inventory_module>
|
||||
</inventory>
|
||||
|
||||
</agent_data>
|
|
@ -0,0 +1,257 @@
|
|||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<agent_data description='{{description}}' group='{{group}}' os_name='windows' os_version='Windows 11' interval='300' version='' timestamp='{{date}}' agent_name='{{agent_name}}' agent_alias='' timezone_offset='0' custom_id='' url_address='' address=''>
|
||||
|
||||
<inventory>
|
||||
<inventory_module>
|
||||
<name>CPU</name>
|
||||
<type><![CDATA[generic_data_string]]></type>
|
||||
<datalist>
|
||||
<data><![CDATA[Intel(R) Core(TM) i7-8700K CPU @ 3.70GHz;3696 MHz;Intel64 Family 6 Model 158 Stepping 10]]></data>
|
||||
<data><![CDATA[Intel(R) Core(TM) i7-8700K CPU @ 3.70GHz;3696 MHz;Intel64 Family 6 Model 158 Stepping 10]]></data>
|
||||
<data><![CDATA[Intel(R) Core(TM) i7-8700K CPU @ 3.70GHz;3696 MHz;Intel64 Family 6 Model 158 Stepping 10]]></data>
|
||||
<data><![CDATA[Intel(R) Core(TM) i7-8700K CPU @ 3.70GHz;3696 MHz;Intel64 Family 6 Model 158 Stepping 10]]></data>
|
||||
</datalist>
|
||||
</inventory_module>
|
||||
|
||||
<inventory_module>
|
||||
<name>HD</name>
|
||||
<type><![CDATA[generic_data_string]]></type>
|
||||
<datalist>
|
||||
<data><![CDATA[XENSRC PVDISK SCSI Disk Device;100 GB;4c0ae98e-d414-4c ]]></data>
|
||||
<data><![CDATA[XENSRC PVDISK SCSI Disk Device;100 GB;afd0d8a2-84d3-49 ]]></data>
|
||||
</datalist>
|
||||
</inventory_module>
|
||||
|
||||
<inventory_module>
|
||||
<name>Video</name>
|
||||
<type><![CDATA[generic_data_string]]></type>
|
||||
<datalist>
|
||||
<data><![CDATA[Citrix Indirect Display Adapter;;PCI\VEN_5853&DEV_1003\1&79F5D87&2&03]]></data>
|
||||
<data><![CDATA[Microsoft Basic Display Adapter;0 MB;PCI\VEN_1013&DEV_00B8&SUBSYS_00015853&REV_00\3&267A616A&0&10]]></data>
|
||||
</datalist>
|
||||
</inventory_module>
|
||||
|
||||
<inventory_module>
|
||||
<name>NIC</name>
|
||||
<type><![CDATA[generic_data_string]]></type>
|
||||
<datalist>
|
||||
<data><![CDATA[XenServer PV Network Device;BE:99:07:B0:E6:8F;{{ip_address}}]]></data>
|
||||
<data><![CDATA[XenServer PV Network Device;C6:4E:9F:12:99:27;]]></data>
|
||||
</datalist>
|
||||
</inventory_module>
|
||||
|
||||
<inventory_module>
|
||||
<name>Monitors</name>
|
||||
<type><![CDATA[generic_data_string]]></type>
|
||||
<datalist>
|
||||
<data><![CDATA[Generic Non-PnP Monitor;DISPLAY\DEFAULT_MONITOR\4&251819FC&0&UID0]]></data>
|
||||
</datalist>
|
||||
</inventory_module>
|
||||
|
||||
<inventory_module>
|
||||
<name>RAM</name>
|
||||
<type><![CDATA[generic_data_string]]></type>
|
||||
<datalist>
|
||||
<data><![CDATA[DIMM 0;4092 MB;18756 MHz]]></data>
|
||||
<data><![CDATA[DIMM 1;4092 MB;18756 MHz]]></data>
|
||||
</datalist>
|
||||
</inventory_module>
|
||||
|
||||
<inventory_module>
|
||||
<name><![CDATA[Software]]></name>
|
||||
<type><![CDATA[generic_data_string]]></type>
|
||||
<datalist>
|
||||
<data><![CDATA[Microsoft Office 32-bit Components 2016 ;16.0.{{rand_number}}.1000]]></data>
|
||||
<data><![CDATA[Microsoft Office Shared 32-bit MUI (Spanish) 2016 ;16.0.4417.1000]]></data>
|
||||
<data><![CDATA[Microsoft Skype for Business MUI (Spanish) 2016;16.0.4417.1000]]></data>
|
||||
<data><![CDATA[Microsoft Office Proofing (Spanish) 2016 ;16.0.4417.1000]]></data>
|
||||
<data><![CDATA[Microsoft Skype for Business Entry 2016 ;16.0.4417.1000]]></data>
|
||||
<data><![CDATA[Microsoft Office Shared MUI (Spanish) 2016 ;16.0.4417.1000]]></data>
|
||||
<data><![CDATA[Eines de correcció del Microsoft Office 2016: català ;16.0.4417.1000]]></data>
|
||||
<data><![CDATA[Revisores de Texto do Microsoft Office 2016 – Português (Brasil) ;16.0.4417.1000]]></data>
|
||||
<data><![CDATA[Ferramentas de verificación de Microsoft Office 2016 - Galego ;16.0.4417.1000]]></data>
|
||||
<data><![CDATA[Microsoft Office Proofing Tools 2016 - English ;16.0.4417.1000]]></data>
|
||||
<data><![CDATA[Herramientas de corrección de Microsoft Office 2016: español;16.0.4417.1000]]></data>
|
||||
<data><![CDATA[Microsoft Office zuzenketa-tresnak 2016 - Euskara ;16.0.4417.1000]]></data>
|
||||
<data><![CDATA[Microsoft OLE DB Driver for SQL Server;18.6.5.0]]></data>
|
||||
<data><![CDATA[Integration Services ;16.0.5107.0]]></data>
|
||||
<data><![CDATA[Remote Desktop ;1.2.{{rand_number}}.0]]></data>
|
||||
<data><![CDATA[XCP-ng Center 20.04.01;20.04.01.33]]></data>
|
||||
<data><![CDATA[Universal CRT Headers Libraries and Sources ;10.1.18362.1]]></data>
|
||||
<data><![CDATA[MSI Development Tools ;10.1.22000.194]]></data>
|
||||
<data><![CDATA[Windows SDK Redistributables;10.1.18362.1]]></data>
|
||||
<data><![CDATA[MSI Development Tools ;10.1.18362.1]]></data>
|
||||
<data><![CDATA[SQL Server 2022 XEvent;16.0.1000.6]]></data>
|
||||
<data><![CDATA[Windows SDK Desktop Tools x86 ;10.1.18362.1]]></data>
|
||||
<data><![CDATA[CrossChex Standard ;1.1.0.0]]></data>
|
||||
<data><![CDATA[Windows SDK Desktop Tools x64 ;10.1.18362.1]]></data>
|
||||
<data><![CDATA[SQL Server 2022 Shared Management Objects;16.0.1000.6]]></data>
|
||||
<data><![CDATA[WinRT Intellisense PPI - en-us ;10.1.18362.1]]></data>
|
||||
<data><![CDATA[WinRT Intellisense UAP - Other Languages ;10.1.18362.1]]></data>
|
||||
<data><![CDATA[Microsoft .NET Framework 4.8 Targeting Pack ;4.8.03761]]></data>
|
||||
<data><![CDATA[Microsoft Visual C++ 2010 x64 Redistributable - 10.0.40219 ;10.0.40219]]></data>
|
||||
<data><![CDATA[Windows SDK AddOn ;10.1.0.0]]></data>
|
||||
<data><![CDATA[GlobalProtect ;5.2.13]]></data>
|
||||
<data><![CDATA[Windows SDK ;10.1.18362.1]]></data>
|
||||
<data><![CDATA[Microsoft Visual C++ 2010 x86 Redistributable - 10.0.40219 ;10.0.40219]]></data>
|
||||
<data><![CDATA[Windows SDK for Windows Store Apps Contracts;10.1.18362.1]]></data>
|
||||
<data><![CDATA[Windows SDK Signing Tools;10.1.18362.1]]></data>
|
||||
<data><![CDATA[SQL Server 2022 Database Engine Shared;16.0.1000.6]]></data>
|
||||
<data><![CDATA[Microsoft Visual C++ 2013 x86 Minimum Runtime - 12.0.21005 ;12.0.21005]]></data>
|
||||
<data><![CDATA[Windows SDK EULA;10.1.18362.1]]></data>
|
||||
<data><![CDATA[Microsoft Visual C++ 2013 x86 Additional Runtime - 12.0.21005 ;12.0.21005]]></data>
|
||||
<data><![CDATA[WPTx64 (DesktopEditions) ;10.1.22000.194]]></data>
|
||||
<data><![CDATA[Citrix XenServer Windows Management Agent;7.2.1555]]></data>
|
||||
<data><![CDATA[Microsoft Visual C++ 2019 X64 Minimum Runtime - 14.29.30139 ;14.29.30139]]></data>
|
||||
<data><![CDATA[Microsoft Visual C++ 2019 X64 Additional Runtime - 14.29.30139 ;14.29.30139]]></data>
|
||||
<data><![CDATA[SDK Debuggers ;10.1.22000.194]]></data>
|
||||
<data><![CDATA[Windows SDK ARM Desktop Tools ;10.1.18362.1]]></data>
|
||||
<data><![CDATA[SQL Server 2022 Connection Info;16.0.1000.6]]></data>
|
||||
<data><![CDATA[VMware Horizon HTML5 Multimedia Redirection Client;7.8.0]]></data>
|
||||
<data><![CDATA[Microsoft Analysis Services OLE DB Provider ;16.0.5143.0]]></data>
|
||||
<data><![CDATA[Windows Mobile Extension SDK Contracts;10.1.18362.1]]></data>
|
||||
<data><![CDATA[WinRT Intellisense PPI - Other Languages ;10.1.18362.1]]></data>
|
||||
<data><![CDATA[Windows SDK for Windows Store Apps Metadata ;10.1.18362.1]]></data>
|
||||
<data><![CDATA[VMware Horizon Client ;5.0.0.5596]]></data>
|
||||
<data><![CDATA[Microsoft SQL Server 2022 Setup (English);16.0.{{rand_number}}.5]]></data>
|
||||
<data><![CDATA[SQL Server 2022 Connection Info;16.0.1000.6]]></data>
|
||||
<data><![CDATA[WinRT Intellisense Desktop - en-us;10.1.18362.1]]></data>
|
||||
<data><![CDATA[Microsoft Visual Studio Tools for Applications 2019 x64 Hosting Support ;16.0.31110]]></data>
|
||||
<data><![CDATA[Universal CRT Tools x64 ;10.1.18362.1]]></data>
|
||||
<data><![CDATA[Application Verifier x64 External Package;10.1.22000.194]]></data>
|
||||
<data><![CDATA[SSMS Post Install Tasks ;19.0.20209.0]]></data>
|
||||
<data><![CDATA[MSI Wrapper 10.0.50.0 ;10.0.50.0]]></data>
|
||||
<data><![CDATA[Windows SDK DirectX x86 Remote ;10.1.18362.1]]></data>
|
||||
<data><![CDATA[SQL Server 2022 Database Engine Services ;16.0.1000.6]]></data>
|
||||
<data><![CDATA[Microsoft Web Platform Installer 5.1 ;5.1.51515.0]]></data>
|
||||
<data><![CDATA[Self-service Plug-in ;21.7.0.28]]></data>
|
||||
<data><![CDATA[SDK ARM Redistributables ;10.1.18362.1]]></data>
|
||||
<data><![CDATA[Citrix Web Helper ;21.7.0.28]]></data>
|
||||
<data><![CDATA[FortiClient ;6.0.10.0297]]></data>
|
||||
<data><![CDATA[Microsoft Visual Studio Tools for Applications 2019 x86 Hosting Support ;16.0.31110]]></data>
|
||||
<data><![CDATA[Windows SDK EULA;10.1.22000.194]]></data>
|
||||
<data><![CDATA[Microsoft Visual C++ 2019 X86 Additional Runtime - 14.29.30139 ;14.29.30139]]></data>
|
||||
<data><![CDATA[SQL Server 2022 Common Files;16.0.1000.6]]></data>
|
||||
<data><![CDATA[Windows Mobile Extension SDK;10.1.18362.1]]></data>
|
||||
<data><![CDATA[Citrix WorkSpace Browser ;21.7.0.2]]></data>
|
||||
<data><![CDATA[Python 2.7.15 ;2.7.15150]]></data>
|
||||
<data><![CDATA[WinRT Intellisense IoT - Other Languages ;10.1.18362.1]]></data>
|
||||
<data><![CDATA[SQL Server 2022 Database Engine Services ;16.0.1000.6]]></data>
|
||||
<data><![CDATA[Java 8 Update 201 ;8.0.2010.9]]></data>
|
||||
<data><![CDATA[Java 8 Update 201 (64-bit) ;8.0.2010.9]]></data>
|
||||
<data><![CDATA[Microsoft .NET Framework 4.8 SDK ;4.8.03928]]></data>
|
||||
<data><![CDATA[SQL Server 2022 Shared Management Objects Extensions ;16.0.1000.6]]></data>
|
||||
<data><![CDATA[SQL Server 2022 Database Engine Services ;16.0.1000.6]]></data>
|
||||
<data><![CDATA[VIP Access ;2.2.4.44]]></data>
|
||||
<data><![CDATA[Microsoft Visual C++ 2019 X86 Minimum Runtime - 14.29.30139 ;14.29.30139]]></data>
|
||||
<data><![CDATA[Microsoft Analysis Services OLE DB Provider ;16.0.5143.0]]></data>
|
||||
<data><![CDATA[RSA SecurID Software Token ;5.0.2.440]]></data>
|
||||
<data><![CDATA[Windows SDK Facade Windows WinMD Versioned ;10.1.18362.1]]></data>
|
||||
<data><![CDATA[Browser for SQL Server 2022 ;16.0.1000.6]]></data>
|
||||
<data><![CDATA[SQL Server Management Studio Language Pack - English ;19.0.20209.0]]></data>
|
||||
<data><![CDATA[PowerShell 7-x64;7.2.11.0]]></data>
|
||||
<data><![CDATA[Microsoft Help Viewer 2.3;2.3.28307]]></data>
|
||||
<data><![CDATA[Microsoft Visual C++ 2013 x64 Additional Runtime - 12.0.21005 ;12.0.21005]]></data>
|
||||
<data><![CDATA[Online Plug-in ;21.7.0.17]]></data>
|
||||
<data><![CDATA[Microsoft Visual C++ 2008 Redistributable - x64 9.0.{{rand_number}}.6161 ;9.0.30729.6161]]></data>
|
||||
<data><![CDATA[SDK ARM Additions ;10.1.18362.1]]></data>
|
||||
<data><![CDATA[Universal CRT Tools x86 ;10.1.18362.1]]></data>
|
||||
<data><![CDATA[Citrix Screen Casting for Windows ;19.11.100.48]]></data>
|
||||
<data><![CDATA[WPTx64 (OnecoreUAP);10.1.22000.194]]></data>
|
||||
<data><![CDATA[Windows IoT Extension SDK Contracts;10.1.18362.1]]></data>
|
||||
<data><![CDATA[SQL Server 2022 DMF;16.0.1000.6]]></data>
|
||||
<data><![CDATA[Microsoft Visual C++ 2008 Redistributable - x86 9.0.30729.6161 ;9.0.30729.6161]]></data>
|
||||
<data><![CDATA[Microsoft Visual C++ 2013 x64 Minimum Runtime - 12.0.21005 ;12.0.21005]]></data>
|
||||
<data><![CDATA[Windows SDK for Windows Store Apps Tools ;10.1.18362.1]]></data>
|
||||
<data><![CDATA[Windows SDK for Windows Store Managed Apps Libs;10.1.18362.1]]></data>
|
||||
<data><![CDATA[Check Point VPN;98.61.3407]]></data>
|
||||
<data><![CDATA[Windows SDK for Windows Store Apps;10.1.18362.1]]></data>
|
||||
<data><![CDATA[Application Verifier x64 External Package;10.1.18362.1]]></data>
|
||||
<data><![CDATA[Universal General MIDI DLS Extension SDK ;10.1.18362.1]]></data>
|
||||
<data><![CDATA[Windows SDK Desktop Libs x86;10.1.18362.1]]></data>
|
||||
<data><![CDATA[Windows App Certification Kit x64 ;10.1.18362.1]]></data>
|
||||
<data><![CDATA[Citrix Workspace(DV) ;21.7.0.17]]></data>
|
||||
<data><![CDATA[SQL Server 2022 Database Engine Shared;16.0.1000.6]]></data>
|
||||
<data><![CDATA[SQL Server 2022 SQL Diagnostics;16.0.1000.6]]></data>
|
||||
<data><![CDATA[Microsoft VSS Writer for SQL Server 2022 ;16.0.1000.6]]></data>
|
||||
<data><![CDATA[WPT Redistributables ;10.1.22000.194]]></data>
|
||||
<data><![CDATA[Kits Configuration Installer;10.1.22000.194]]></data>
|
||||
<data><![CDATA[Windows SDK for Windows Store Apps Libs ;10.1.18362.1]]></data>
|
||||
<data><![CDATA[SQL Server 2022 Batch Parser;16.0.1000.6]]></data>
|
||||
<data><![CDATA[SQL Server 2022 XEvent;16.0.1000.6]]></data>
|
||||
<data><![CDATA[Windows SDK Desktop Libs x64;10.1.18362.1]]></data>
|
||||
<data><![CDATA[SMA Connect Agent ;1.0.13]]></data>
|
||||
<data><![CDATA[Windows SDK Desktop Tools arm64;10.1.18362.1]]></data>
|
||||
<data><![CDATA[Windows SDK DirectX x64 Remote ;10.1.18362.1]]></data>
|
||||
<data><![CDATA[Microsoft SQL Server 2022 RsFx Driver ;16.0.1000.6]]></data>
|
||||
<data><![CDATA[Citrix Workspace(USB) ;21.7.0.17]]></data>
|
||||
<data><![CDATA[Universal CRT Extension SDK ;10.1.18362.1]]></data>
|
||||
<data><![CDATA[Check MK Agent 1.6 ;1.6.0p5]]></data>
|
||||
<data><![CDATA[SQL Server 2022 Shared Management Objects;16.0.1000.6]]></data>
|
||||
<data><![CDATA[SQL Server 2022 Shared Management Objects Extensions ;16.0.1000.6]]></data>
|
||||
<data><![CDATA[WinRT Intellisense UAP - en-us ;10.1.18362.1]]></data>
|
||||
<data><![CDATA[BIG-IP Edge Client ;72.22.0308....]]></data>
|
||||
<data><![CDATA[Orca ;3.1.3790.0000]]></data>
|
||||
<data><![CDATA[Cisco AnyConnect Secure Mobility Client ;4.9.06037]]></data>
|
||||
<data><![CDATA[WinRT Intellisense IoT - en-us ;10.1.18362.1]]></data>
|
||||
<data><![CDATA[SQL Server 2022 Common Files;16.0.1000.6]]></data>
|
||||
<data><![CDATA[Windows IP Over USB;10.1.18362.1]]></data>
|
||||
<data><![CDATA[Windows SDK Desktop Headers arm;10.1.18362.1]]></data>
|
||||
<data><![CDATA[SQL Server 2022 Database Engine Services ;16.0.1000.6]]></data>
|
||||
<data><![CDATA[Windows App Certification Kit SupportedApiList x86;10.1.18362.1]]></data>
|
||||
<data><![CDATA[Windows IoT Extension SDK;10.1.18362.1]]></data>
|
||||
<data><![CDATA[MySQL Workbench 8.0 CE;8.0.23]]></data>
|
||||
<data><![CDATA[Windows Desktop Extension SDK ;10.1.18362.1]]></data>
|
||||
<data><![CDATA[Microsoft ODBC Driver 17 for SQL Server ;17.10.3.1]]></data>
|
||||
<data><![CDATA[Google Chrome ;114.0.5735.199]]></data>
|
||||
<data><![CDATA[Windows Desktop Extension SDK Contracts ;10.1.18362.1]]></data>
|
||||
<data><![CDATA[Windows SDK Modern Versioned Developer Tools;10.1.18362.1]]></data>
|
||||
<data><![CDATA[Windows Team Extension SDK ;10.1.18362.1]]></data>
|
||||
<data><![CDATA[Windows SDK for Windows Store Apps DirectX x86 Remote;10.1.18362.1]]></data>
|
||||
<data><![CDATA[Windows SDK Desktop Libs arm64 ;10.1.18362.1]]></data>
|
||||
<data><![CDATA[Windows SDK Desktop Headers x64;10.1.18362.1]]></data>
|
||||
<data><![CDATA[Windows SDK Modern Non-Versioned Developer Tools ;10.1.18362.1]]></data>
|
||||
<data><![CDATA[Windows App Certification Kit Native Components;10.1.18362.1]]></data>
|
||||
<data><![CDATA[SQL Server 2022 DMF;16.0.1000.6]]></data>
|
||||
<data><![CDATA[Citrix Authentication Manager ;21.7.0.2]]></data>
|
||||
<data><![CDATA[Citrix Gateway Plug-in;12.1.55.18]]></data>
|
||||
<data><![CDATA[Windows SDK Signing Tools;10.1.22000.194]]></data>
|
||||
<data><![CDATA[Citrix Hypervisor PV Tools ;9.0.33]]></data>
|
||||
<data><![CDATA[Windows SDK Desktop Headers arm64 ;10.1.18362.1]]></data>
|
||||
<data><![CDATA[Windows SDK Desktop Headers x86;10.1.18362.1]]></data>
|
||||
<data><![CDATA[CrossChex Lite ;1.1.0.0]]></data>
|
||||
<data><![CDATA[PuTTY release 0.70 (64-bit) ;0.70.0.0]]></data>
|
||||
<data><![CDATA[SQL Server Management Studio;19.0.20209.0]]></data>
|
||||
<data><![CDATA[Windows SDK Desktop Libs arm;10.1.18362.1]]></data>
|
||||
<data><![CDATA[Visual Studio 2017 Isolated Shell for SSMS ;15.0.28308.421]]></data>
|
||||
<data><![CDATA[Java Auto Updater ;2.8.{{rand_number}}.9]]></data>
|
||||
<data><![CDATA[WinRT Intellisense Mobile - en-us ;10.1.18362.1]]></data>
|
||||
<data><![CDATA[Windows SDK for Windows Store Apps Headers ;10.1.18362.1]]></data>
|
||||
<data><![CDATA[Citrix Workspace Inside ;21.7.0.19]]></data>
|
||||
<data><![CDATA[Universal CRT Redistributable ;10.1.18362.1]]></data>
|
||||
<data><![CDATA[VMware Horizon Media Engine 8.0.0.561 (64-bit) ;8.0.0.561]]></data>
|
||||
<data><![CDATA[WinAppDeploy;10.1.18362.1]]></data>
|
||||
<data><![CDATA[Windows Team Extension SDK Contracts ;10.1.18362.1]]></data>
|
||||
<data><![CDATA[WinRT Intellisense Desktop - Other Languages;10.1.18362.1]]></data>
|
||||
</datalist>
|
||||
</inventory_module>
|
||||
|
||||
<inventory_module>
|
||||
<name>Users</name>
|
||||
<type><![CDATA[generic_data_string]]></type>
|
||||
<datalist>
|
||||
<data><![CDATA[PROJECTS;Roberto]]></data>
|
||||
</datalist>
|
||||
</inventory_module>
|
||||
|
||||
<inventory_module>
|
||||
<name>product_ID</name>
|
||||
<type><![CDATA[generic_data_string]]></type>
|
||||
<datalist>
|
||||
<data><![CDATA[00429-00101-62363-AA558 ]]></data>
|
||||
</datalist>
|
||||
</inventory_module>
|
||||
|
||||
</inventory>
|
||||
|
||||
</agent_data>
|
|
@ -35,7 +35,7 @@ use PandoraFMS::Config;
|
|||
use PandoraFMS::DB;
|
||||
|
||||
# version: define current version
|
||||
my $version = "7.0NG.773.1 Build 230822";
|
||||
my $version = "7.0NG.773.2 Build 230823";
|
||||
|
||||
# Pandora server configuration
|
||||
my %conf;
|
||||
|
@ -767,52 +767,6 @@ sub pandora_checkdb_integrity {
|
|||
# Delete orphan data_inc reference records
|
||||
db_do ($dbh, 'DELETE FROM tagente_datos_inc WHERE id_agente_modulo NOT IN (SELECT id_agente_modulo FROM tagente_modulo)');
|
||||
|
||||
# Delete orphan data from visual console.
|
||||
log_message ('INTEGRITY', "Deleting orphan visual console items.");
|
||||
db_do ($dbh, 'DELETE FROM tlayout_data WHERE id_agent <> 0 AND id_agent NOT IN (SELECT id_agente FROM tagente)');
|
||||
db_do ($dbh, 'DELETE FROM tlayout_data WHERE id_agente_modulo <> 0 AND id_agente_modulo NOT IN (SELECT id_agente_modulo FROM tagente_modulo)');
|
||||
|
||||
# Delete orphan data form deleted agents.
|
||||
# Clearl orphan data from dashboards
|
||||
log_message ('INTEGRITY', "Deleting orphan dahsboard items.");
|
||||
my @agents_ids = get_db_rows($dbh, 'SELECT id_agente FROM tagente');
|
||||
my $where_condition;
|
||||
foreach my $agent_id (@agents_ids) {
|
||||
$where_condition .= 'options NOT LIKE ("%\\"agentid\\":\\"'.$agent_id->{'id_agente'}.'\\"%")';
|
||||
if($agent_id == $agents_ids[-1]) {
|
||||
last;
|
||||
}
|
||||
$where_condition .= ' AND ';
|
||||
}
|
||||
|
||||
db_do ($dbh, 'UPDATE twidget_dashboard set options = NULL WHERE '.$where_condition);
|
||||
|
||||
$where_condition = '';
|
||||
my @modules = get_db_rows($dbh, 'SELECT id_agente_modulo FROM tagente_modulo');
|
||||
foreach my $id_agente_modulo (@modules) {
|
||||
$where_condition .= 'options NOT LIKE ("%\\"moduleId\\":\\"'.$id_agente_modulo->{'id_agente_modulo'}.'\\"%")';
|
||||
if($id_agente_modulo == $modules[-1]) {
|
||||
last;
|
||||
}
|
||||
$where_condition .= ' AND ';
|
||||
}
|
||||
|
||||
db_do ($dbh, 'UPDATE twidget_dashboard set options = NULL WHERE '.$where_condition);
|
||||
|
||||
# Delete orphan data from favorite agents
|
||||
log_message ('INTEGRITY', "Deleting orphan favories items.");
|
||||
db_do ($dbh, 'DELETE FROM tfavmenu_user WHERE section = "Agents" AND id_element NOT IN (SELECT id_agente FROM tagente)');
|
||||
|
||||
# Delete orphan data from gis maps
|
||||
log_message ('INTEGRITY', "Deleting orphan GIS data.");
|
||||
db_do ($dbh, 'DELETE FROM tgis_data_history WHERE tagente_id_agente NOT IN (SELECT id_agente FROM tagente)');
|
||||
|
||||
# Delete orphan tnetwork maps data
|
||||
log_message ('INTEGRITY', "Deleting orphan networkmaps data.");
|
||||
db_do ($dbh, 'DELETE FROM titem WHERE source_data NOT IN (SELECT id_agente FROM tagente)');
|
||||
db_do ($dbh, 'DELETE FROM trel_item WHERE id_parent_source_data NOT IN (SELECT id_agente FROM tagente) OR id_child_source_data NOT IN (SELECT id_agente FROM tagente)');
|
||||
|
||||
|
||||
# Check enterprise tables
|
||||
enterprise_hook ('pandora_checkdb_integrity_enterprise', [$conf, $dbh]);
|
||||
}
|
||||
|
|
|
@ -36,7 +36,7 @@ use Encode::Locale;
|
|||
Encode::Locale::decode_argv;
|
||||
|
||||
# version: define current version
|
||||
my $version = "7.0NG.773.1 Build 230822";
|
||||
my $version = "7.0NG.773.2 Build 230823";
|
||||
|
||||
# save program name for logging
|
||||
my $progname = basename($0);
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
################################################################################
|
||||
#
|
||||
# Copyright (c) 2007-2008 Ramon Novoa <rnovoa@artica.es>
|
||||
# Copyright (c) 2007-2023 Pandora FMS.
|
||||
# Copyright (c) 2007-2023 Pandora FMS.
|
||||
#
|
||||
# tentacle_client.pl Tentacle Client. See https://pandorafms.com/docs/ for
|
||||
# protocol description.
|
||||
|
|
Loading…
Reference in New Issue