Merge remote-tracking branch 'origin/develop'

This commit is contained in:
artica 2024-03-14 12:00:22 +01:00
commit e4317c182a
1998 changed files with 516025 additions and 163951 deletions

View File

@ -20,7 +20,7 @@ LOGFILE="/tmp/pandora-deploy-community-$(date +%F).log"
# define default variables
[ "$TZ" ] || TZ="Europe/Madrid"
[ "$MYVER" ] || MYVER=80
[ "$PHPVER" ] || PHPVER=8
[ "$PHPVER" ] || PHPVER=8.2
[ "$DBHOST" ] || DBHOST=127.0.0.1
[ "$DBNAME" ] || DBNAME=pandora
[ "$DBUSER" ] || DBUSER=pandora
@ -49,6 +49,9 @@ cyan="\e[0;36m"
yellow="\e[33m"
reset="\e[0m"
#force lts to install php 8.0
[ "$PANDORA_LTS" -eq '1' ] && PHPVER=8.0
# Functions
execute_cmd () {
local cmd="$1"
@ -289,13 +292,13 @@ execute_cmd "dnf install -y wget" "Installing wget"
#Installing php
execute_cmd "dnf module reset -y php " "Disabling standard PHP module"
if [ "$PHPVER" -ne '8' ] ; then
execute_cmd "dnf module install -y php:remi-7.4" "Configuring PHP 7"
if [ "$PHPVER" == '8' ] ; then
PHPVER=8.0
fi
if [ "$PHPVER" -eq '8' ] ; then
execute_cmd "dnf module install -y php:remi-8.0" "Configuring PHP 8"
fi
execute_cmd "dnf module install -y php:remi-${PHPVER}" "Configuring PHP ${PHPVER}"
# Install percona Database
execute_cmd "dnf module disable -y mysql" "Disabiling mysql module"
@ -813,7 +816,7 @@ chmod 0644 /etc/logrotate.d/pandora_agent
# Add websocket engine start script.
mv /var/www/html/pandora_console/pandora_websocket_engine /etc/init.d/ &>> "$LOGFILE"
chmod +x /etc/init.d/pandora_websocket_engine
chmod +x /etc/init.d/pandora_websocket_engine &>> "$LOGFILE"
# Start Websocket engine
/etc/init.d/pandora_websocket_engine start &>> "$LOGFILE"

View File

@ -23,7 +23,7 @@ rm -f $LOGFILE &> /dev/null # remove last log before start
# define default variables
[ "$TZ" ] || TZ="Europe/Madrid"
[ "$PHPVER" ] || PHPVER=8.0
[ "$PHPVER" ] || PHPVER=8.2
[ "$DBHOST" ] || DBHOST=127.0.0.1
[ "$DBNAME" ] || DBNAME=pandora
[ "$DBUSER" ] || DBUSER=pandora
@ -50,6 +50,10 @@ green="\e[0;92m"
cyan="\e[0;36m"
reset="\e[0m"
#force lts to install php 8.0
[ "$PANDORA_LTS" -eq '1' ] && PHPVER=8.0
# Functions
execute_cmd () {
@ -526,7 +530,7 @@ if [ "$PANDORA_LTS" -eq '1' ] ; then
elif [ "$PANDORA_LTS" -ne '1' ] ; then
[ "$PANDORA_SERVER_PACKAGE" ] || PANDORA_SERVER_PACKAGE="https://firefly.pandorafms.com/pandorafms/latest/Tarball/pandorafms_server-7.0NG.tar.gz"
[ "$PANDORA_CONSOLE_PACKAGE" ] || PANDORA_CONSOLE_PACKAGE="https://firefly.pandorafms.com/pandorafms/latest/Tarball/pandorafms_console-7.0NG.tar.gz"
[ "$PANDORA_AGENT_PACKAGE" ] || PANDORA_AGENT_PACKAGE=" https://firefly.pandorafms.com/pandorafms/latest/Tarball/pandorafms_agent_linux-7.0NG.x86_64.tar.gz"
[ "$PANDORA_AGENT_PACKAGE" ] || PANDORA_AGENT_PACKAGE="https://firefly.pandorafms.com/pandorafms/latest/Tarball/pandorafms_agent_linux-7.0NG.x86_64.tar.gz"
fi
if [ "$PANDORA_BETA" -eq '1' ] ; then
@ -810,7 +814,7 @@ chmod 0644 /etc/logrotate.d/pandora_agent
# Add websocket engine start script.
mv /var/www/html/pandora_console/pandora_websocket_engine /etc/init.d/ &>> "$LOGFILE"
chmod +x /etc/init.d/pandora_websocket_engine
chmod +x /etc/init.d/pandora_websocket_engine &>> "$LOGFILE"
# Start Websocket engine
/etc/init.d/pandora_websocket_engine start &>> "$LOGFILE"
@ -850,6 +854,11 @@ systemctl enable postfix --now &>> "$LOGFILE"
systemctl disable --now snmptrapd &>> "$LOGFILE"
systemctl disable --now snmptrapd.socket &>> "$LOGFILE"
# Adding legacy to openssl
sed -i '/default = default_sect/a legacy = legacy_sect' /etc/ssl/openssl.cnf
sed -i 's/# activate = 1/activate = 1/' /etc/ssl/openssl.cnf
sed -i '/activate = 1/a [legacy_sect]\nactivate = 1' /etc/ssl/openssl.cnf
#SSH banner
[ "$(curl -s ifconfig.me)" ] && ipplublic=$(curl -s ifconfig.me)

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.775, AIX version
# Version 7.0NG.776, AIX version
# Licensed under GPL license v2,
# Copyright (c) 2003-2023 Pandora FMS
# http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.775, FreeBSD Version
# Version 7.0NG.776, FreeBSD Version
# Licensed under GPL license v2,
# Copyright (c) 2003-2023 Pandora FMS
# http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.775, HP-UX Version
# Version 7.0NG.776, HP-UX Version
# Licensed under GPL license v2,
# Copyright (c) 2003-2023 Pandora FMS
# http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.775, GNU/Linux
# Version 7.0NG.776, GNU/Linux
# Licensed under GPL license v2,
# Copyright (c) 2003-2023 Pandora FMS
# http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.775, GNU/Linux
# Version 7.0NG.776, GNU/Linux
# Licensed under GPL license v2,
# Copyright (c) 2003-2023 Pandora FMS
# http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.775, Solaris Version
# Version 7.0NG.776, Solaris Version
# Licensed under GPL license v2,
# Copyright (c) 2003-2023 Pandora FMS
# http://www.pandorafms.com

View File

@ -1,6 +1,6 @@
# Base config file for Pandora FMS Windows Agent
# (c) 2006-2023 Pandora FMS
# Version 7.0NG.775
# Version 7.0NG.776
# 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
@ -122,6 +122,7 @@ module_min_critical 91
module_max_critical 0
module_end
# Number processes
module_begin
module_name Number processes

View File

@ -585,7 +585,7 @@ sub write_broker_conf($){
# Change the agent name
if ($line =~ m/^\s*#*\s*agent_name\s+/) {
$line = "agent_name $broker_agent\n";
$line = "agent_name $broker_agent\n#broker active\n";
}
# Change the logfile
elsif ($line =~ m/^\s*logfile\s+(.*)/) {

View File

@ -467,7 +467,7 @@ fi
# Script banner at start
echo " "
echo "Pandora FMS Agent UNIX Installer $PI_VERSION $PI_BUILD (c) 2008-2015 ArticaST"
echo "Pandora FMS Agent UNIX Installer $PI_VERSION $PI_BUILD (c) 2008-2024 PandoraFMS"
echo "This program is licensed under GPL2 Terms. http://pandorafms.com"
echo " "

View File

@ -1,6 +1,6 @@
# Fichero de configuracion base de agentes de Pandora
# Base config file for Pandora agents
# Version 7.0NG.775, AIX version
# Version 7.0NG.776, AIX version
# General Parameters
# ==================

View File

@ -1,6 +1,6 @@
# Fichero de configuracion base de agentes de Pandora
# Base config file for Pandora agents
# Version 7.0NG.775
# Version 7.0NG.776
# FreeBSD/IPSO version
# Licenced under GPL licence, 2003-2007 Sancho Lerena

View File

@ -1,6 +1,6 @@
# Fichero de configuracion base de agentes de Pandora
# Base config file for Pandora agents
# Version 7.0NG.775, HPUX Version
# Version 7.0NG.776, HPUX Version
# General Parameters
# ==================

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.775
# Version 7.0NG.776
# Licensed under GPL license v2,
# (c) 2003-2023 Pandora FMS
# please visit http://pandora.sourceforge.net

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.775
# Version 7.0NG.776
# Licensed under GPL license v2,
# (c) 2003-2023 Pandora FMS
# please visit http://pandora.sourceforge.net

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.775
# Version 7.0NG.776
# Licensed under GPL license v2,
# please visit http://pandora.sourceforge.net

View File

@ -1,6 +1,6 @@
# Fichero de configuracion base de agentes de Pandora
# Base config file for Pandora agents
# Version 7.0NG.775, Solaris version
# Version 7.0NG.776, Solaris version
# General Parameters
# ==================

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.775, AIX version
# Version 7.0NG.776, AIX version
# Licensed under GPL license v2,
# Copyright (c) 2003-2023 Pandora FMS
# http://www.pandorafms.com

View File

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

View File

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

View File

@ -31,7 +31,7 @@ fi
if [ "$#" -ge 2 ]; then
VERSION="$2"
else
VERSION="7.0NG.775"
VERSION="7.0NG.776"
fi
# Path for the generated DMG file

View 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.775" onConclusion="none">pandorafms_src.pdk</pkg-ref>
<pkg-ref id="com.pandorafms.pandorafms_src" version="7.0NG.776" 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.775" onConclusion="none">pandorafms_uninstall.pdk</pkg-ref>
<pkg-ref id="com.pandorafms.pandorafms_uninstall" version="7.0NG.776" onConclusion="none">pandorafms_uninstall.pdk</pkg-ref>
<!-- <installation-check script="check()" />
<script>
<![CDATA[

View File

@ -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.775</string>
<key>CFBundleGetInfoString</key> <string>7.0NG.775 Pandora FMS on Aug 2020</string>
<key>CFBundleShortVersionString</key> <string>7.0NG.775</string>
<key>CFBundleVersion</key> <string>7.0NG.776</string>
<key>CFBundleGetInfoString</key> <string>7.0NG.776 Pandora FMS on Aug 2020</string>
<key>CFBundleShortVersionString</key> <string>7.0NG.776</string>
<key>NSPrincipalClass</key><string>NSApplication</string>
<key>NSMainNibFile</key><string>MainMenu</string>

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.775, GNU/Linux
# Version 7.0NG.776, GNU/Linux
# Licensed under GPL license v2,
# Copyright (c) 2003-2023 Pandora FMS
# http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.775, FreeBSD Version
# Version 7.0NG.776, FreeBSD Version
# Licensed under GPL license v2,
# Copyright (c) 2003-2023 Pandora FMS
# http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.775, HP-UX Version
# Version 7.0NG.776, HP-UX Version
# Licensed under GPL license v2,
# Copyright (c) 2003-2023 Pandora FMS
# http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.775
# Version 7.0NG.776
# Licensed under GPL license v2,
# Copyright (c) 2004-2023 Pandora FMS
# https://pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.775, GNU/Linux
# Version 7.0NG.776, GNU/Linux
# Licensed under GPL license v2,
# Copyright (c) 2003-2023 Pandora FMS
# http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.775, NetBSD Version
# Version 7.0NG.776, NetBSD Version
# Licensed under GPL license v2,
# Copyright (c) 2003-2023 Pandora FMS
# http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.775, Solaris Version
# Version 7.0NG.776, Solaris Version
# Licensed under GPL license v2,
# Copyright (c) 2003-2023 Pandora FMS
# http://www.pandorafms.com

View File

@ -1038,8 +1038,8 @@ my $Sem = undef;
# Semaphore used to control the number of threads
my $ThreadSem = undef;
use constant AGENT_VERSION => '7.0NG.775';
use constant AGENT_BUILD => '231228';
use constant AGENT_VERSION => '7.0NG.776';
use constant AGENT_BUILD => '240314';
# Agent log default file size maximum and instances
use constant DEFAULT_MAX_LOG_SIZE => 600000;
@ -1860,7 +1860,7 @@ sub write_broker_conf($){
# Change the agent name
if ($line =~ m/^\s*#*\s*agent_name\s+/) {
$line = "agent_name $broker_agent\n";
$line = "agent_name $broker_agent\n#broker active\n";
}
# Change the logfile
elsif ($line =~ m/^\s*logfile\s+(.*)/) {
@ -3678,9 +3678,21 @@ sub write_module_xml ($@) {
return;
}
if ($module->{'func'} == \&module_logger) {
$Xml .= $data[0];
return
# Is it an extraction log module?
if($module->{'type'} eq "log"){
my $output = join('', @data);
if ($output eq "") {
return;
}
$Xml .="<log_module>\n";
$Xml .= " <source><![CDATA[" . $module->{'name'} . "]]></source>\n";
$Xml .= " <type><![CDATA[" . $module->{'type'} . "]]></type>\n";
$Xml .= " <encoding>base64</encoding>\n";
$Xml .= " <data><![CDATA[" . $output . "]]></data>\n";
$Xml .= "</log_module>\n";
return;
}
# Critical section
@ -3690,7 +3702,7 @@ sub write_module_xml ($@) {
" <name><![CDATA[" . $module->{'name'} . "]]></name>\n" .
" <description><![CDATA[" . $module->{'description'} . "]]></description>\n" .
" <type>" . $module->{'type'} . "</type>\n";
# Interval
$Xml .= " <module_interval>" . $module->{'interval'} . "</module_interval>\n";
@ -3889,7 +3901,8 @@ sub module_logger ($) {
my $status = grep_logs(
$module->{'name'},
$module->{'params'},
$module->{'filter'}
$module->{'filter'},
$module->{'type'}
);
return $status;
@ -3926,20 +3939,25 @@ my $encode_sub = defined(&MIME::Base64::encode_base64) ? \&MIME::Base64::encode_
};
sub grep_logs {
my ($str_name, $str_file, $str_regex) = @_;
my ($module_name, $log_file, $reg_exp, $module_type) = @_;
if(!$str_name){
if(!$module_name){
log_message("module_logger", "Missing module name");
return;
}
if(!$str_file){
if(!$log_file){
log_message("module_logger", "Missing file name");
return;
}
if(!$str_regex){
$str_regex = '.*';
if(!$module_type){
log_message("module_logger", "Missing module type");
return;
}
if(!$reg_exp){
$reg_exp = '.*';
}
my $idx_dir = '/tmp/';
@ -3947,9 +3965,6 @@ sub grep_logs {
my $idx_pos = 0;
my $idx_size = 0;
my $idx_ino = '';
my $module_name = $str_name;
my $log_file = $str_file;
my $reg_exp = $str_regex;
# Check that log file exists
if (! -e $log_file) {
@ -3975,7 +3990,7 @@ sub grep_logs {
return if load_idx(\$idx_pos, \$idx_ino, \$idx_file, \$idx_size) == 1;
my @data = parse_log(\$idx_pos, \$idx_ino, \$idx_file, \$log_file, \$module_name, \$reg_exp, \$idx_size);
my $output = create_log($module_name, @data);
my $output = create_log($module_name, $module_type, @data);
return $output;
}
@ -4090,27 +4105,32 @@ sub grep_logs {
}
sub create_log {
my ($module_name, @data) = @_;
my ($module_name, $module_type, @data) = @_;
# No data
if ($#data < 0) {
return;
}
# Log module
my $output = "<log_module>\n";
$output .= "<source><![CDATA[" . $module_name . "]]></source>\n";
$output .= "<encoding>base64</encoding>\n";
$output .= "<data><![CDATA[";
$output .= &$encode_sub(join('', @data), '');
$output .= "]]></data>\n";
$output .= "</log_module>\n";
my $data_content = process_log_monitoring($module_type, @data);
return $output;
return $data_content;
}
}
sub process_log_monitoring {
my ($module_type, @data) = @_;
my $output = "";
if ($module_type eq "log"){
$output = &$encode_sub(join('', @data), '');
} elsif ($module_type eq "generic_data") {
$output = scalar @data;
} elsif ($module_type eq "generic_proc"){
$output = scalar @data > 0 ? 1 : 0;
} elsif ($module_type eq "generic_data_string" || $module_type eq "async_string"){
$output = join('', @data);
}
return $output;
}
################################################################################
# TERM Handler
################################################################################
@ -4283,6 +4303,10 @@ sub init_module ($) {
$module->{'alert_template'} = undef;
$module->{'filter'} = undef;
$module->{'absoluteinterval'} = undef;
$module->{'each_ff'} = undef;
$module->{'min_ff_event_normal'} = undef;
$module->{'min_ff_event_warning'} = undef;
$module->{'min_ff_event_critical'} = undef;
}
################################################################################

View File

@ -3,8 +3,8 @@
#
%global __os_install_post %{nil}
%define name pandorafms_agent_linux
%define version 7.0NG.775
%define release 231228
%define version 7.0NG.776
%define release 1
Summary: Pandora FMS Linux agent, PERL version
Name: %{name}

View File

@ -4,8 +4,8 @@
%global __os_install_post %{nil}
%define name pandorafms_agent_linux_bin
%define source_name pandorafms_agent_linux
%define version 7.0NG.775
%define release 231228
%define version 7.0NG.776
%define release 1
%define debug_package %{nil}
Summary: Pandora FMS Linux agent, binary version

View File

@ -4,8 +4,8 @@
%global __os_install_post %{nil}
%define name pandorafms_agent_linux_bin
%define source_name pandorafms_agent_linux
%define version 7.0NG.775
%define release 231228
%define version 7.0NG.776
%define release 1
%define debug_package %{nil}
Summary: Pandora FMS Linux agent, binary version
@ -13,23 +13,22 @@ Name: %{name}
Version: %{version}
Release: %{release}
License: GPL
Vendor: ArticaST <http://www.artica.es>
Vendor: PandoraFMS <https://pandorafms.com>
Source0: %{source_name}-%{version}.tar.gz
URL: http://pandorafms.org
URL: https://pandorafms.com
Group: System/Monitoring
Packager: Sancho Lerena <slerena@artica.es>
Packager: PandoraFMS <info@pandorafms.com>
Prefix: /usr/share
BuildRoot: %{_tmppath}/%{name}-%{version}-buildroot
BuildArch: x86_64
Requires(pre): shadow-utils
Requires(post): chkconfig /bin/ln
Requires(preun): chkconfig /bin/rm /usr/sbin/userdel
Requires(post): /bin/ln
Requires(preun): /bin/rm /usr/sbin/userdel
Requires: coreutils unzip
Requires: util-linux procps grep
Requires: /sbin/ip /bin/awk
Requires: perl-interpreter
Requires: perl-IO-Compress
Requires: libnsl
Requires: libxcrypt-compat
AutoReq: 0
Provides: %{name}-%{version}
@ -50,7 +49,7 @@ mkdir -p $RPM_BUILD_ROOT%{prefix}/pandora_agent/
mkdir -p $RPM_BUILD_ROOT/usr/bin/
mkdir -p $RPM_BUILD_ROOT/usr/sbin/
mkdir -p $RPM_BUILD_ROOT/etc/pandora/
mkdir -p $RPM_BUILD_ROOT/etc/rc.d/init.d/
#mkdir -p $RPM_BUILD_ROOT/etc/rc.d/init.d/
mkdir -p $RPM_BUILD_ROOT/var/log/pandora/
mkdir -p $RPM_BUILD_ROOT/usr/share/man/man1/
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/
@ -58,7 +57,7 @@ cp -aRf * $RPM_BUILD_ROOT%{prefix}/pandora_agent/
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/tentacle_client $RPM_BUILD_ROOT/usr/bin/
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/pandora_agent $RPM_BUILD_ROOT/usr/bin/
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/pandora_agent_exec $RPM_BUILD_ROOT/usr/bin/
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/pandora_agent_daemon $RPM_BUILD_ROOT/etc/rc.d/init.d/pandora_agent_daemon
#cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/pandora_agent_daemon $RPM_BUILD_ROOT/etc/rc.d/init.d/pandora_agent_daemon
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/man/man1/pandora_agent.1.gz $RPM_BUILD_ROOT/usr/share/man/man1/
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/man/man1/tentacle_client.1.gz $RPM_BUILD_ROOT/usr/share/man/man1/
@ -119,21 +118,11 @@ then
cp -f /usr/share/pandora_agent/pandora_agent_daemon.service /usr/lib/systemd/system/
chmod -x /usr/lib/systemd/system/pandora_agent_daemon.service
# Enable the services on SystemD
systemctl daemon-reload
systemctl enable pandora_agent_daemon.service
else
/sbin/chkconfig --add pandora_agent_daemon
/sbin/chkconfig pandora_agent_daemon on
fi
if [ "$1" -gt 1 ]
then
echo "If Pandora Agent daemon was running with init.d script,"
echo "please stop it manually and start the service with systemctl"
fi
%preun
# Upgrading
@ -141,8 +130,7 @@ if [ "$1" = "1" ]; then
exit 0
fi
/sbin/chkconfig --del pandora_agent_daemon
/etc/rc.d/init.d/pandora_agent_daemon stop >/dev/null 2>&1 || :
systemctl stop pandora_agent_daemon.service > /dev/null 2>&1 || :
# Remove symbolic links
pushd /etc/pandora
@ -162,7 +150,6 @@ exit 0
%defattr(755,root,root)
/usr/bin/pandora_agent_exec
/usr/bin/tentacle_client
/etc/rc.d/init.d/pandora_agent_daemon
%defattr(644,root,root)
/usr/share/man/man1/pandora_agent.1.gz

View File

@ -4,8 +4,8 @@
%global __os_install_post %{nil}
%define name pandorafms_agent_linux_bin
%define source_name pandorafms_agent_linux
%define version 7.0NG.775
%define release 231228
%define version 7.0NG.776
%define release 1
Summary: Pandora FMS Linux agent, binary version
Name: %{name}

View File

@ -3,8 +3,8 @@
#
%global __os_install_post %{nil}
%define name pandorafms_agent_linux
%define version 7.0NG.775
%define release 231228
%define version 7.0NG.776
%define release 1
Summary: Pandora FMS Linux agent, PERL version
Name: %{name}

View File

@ -9,8 +9,8 @@
# Please see http://www.pandorafms.org. This code is licensed under GPL 2.0 license.
# **********************************************************************
PI_VERSION="7.0NG.775"
PI_BUILD="231228"
PI_VERSION="7.0NG.776"
PI_BUILD="240314"
OS_NAME=`uname -s`
FORCE=0
@ -579,7 +579,7 @@ fi
# Script banner at start
echo " "
echo "Pandora FMS Agent UNIX Installer $PI_VERSION $PI_BUILD (c) 2008-2015 ArticaST"
echo "Pandora FMS Agent UNIX Installer $PI_VERSION $PI_BUILD (c) 2008-2024 PandoraFMS"
echo "This program is licensed under GPL2 Terms. http://pandorafms.com"
echo " "

View File

@ -1,9 +1,9 @@
bin_PROGRAMS = PandoraAgent
if DEBUG
PandoraAgent_SOURCES = misc/cron.cc misc/pandora_file.cc modules/pandora_data.cc modules/pandora_module_factory.cc modules/pandora_module.cc modules/pandora_module_list.cc modules/pandora_module_plugin.cc modules/pandora_module_inventory.cc modules/pandora_module_freememory.cc modules/pandora_module_exec.cc modules/pandora_module_perfcounter.cc modules/pandora_module_proc.cc modules/pandora_module_tcpcheck.cc modules/pandora_module_freememory_percent.cc modules/pandora_module_freedisk.cc modules/pandora_module_freedisk_percent.cc modules/pandora_module_logevent.cc modules/pandora_module_service.cc modules/pandora_module_cpuusage.cc modules/pandora_module_wmiquery.cc modules/pandora_module_regexp.cc modules/pandora_module_ping.cc modules/pandora_module_snmpget.cc udp_server/udp_server.cc main.cc pandora_strutils.cc pandora.cc windows_service.cc pandora_agent_conf.cc windows/pandora_windows_info.cc windows/pandora_wmi.cc pandora_windows_service.cc misc/md5.c misc/sha256.cc windows/wmi/disphelper.c ssh/libssh2/channel.c ssh/libssh2/mac.c ssh/libssh2/session.c ssh/libssh2/comp.c ssh/libssh2/misc.c ssh/libssh2/sftp.c ssh/libssh2/crypt.c ssh/libssh2/packet.c ssh/libssh2/userauth.c ssh/libssh2/hostkey.c ssh/libssh2/publickey.c ssh/libssh2/kex.c ssh/libssh2/scp.c ssh/pandora_ssh_client.cc ssh/pandora_ssh_test.cc ftp/pandora_ftp_client.cc ftp/pandora_ftp_test.cc debug_new.cpp
PandoraAgent_SOURCES = misc/cron.cc misc/pandora_file.cc modules/pandora_data.cc modules/pandora_module_factory.cc modules/pandora_module.cc modules/pandora_module_list.cc modules/pandora_module_plugin.cc modules/pandora_module_inventory.cc modules/pandora_module_freememory.cc modules/pandora_module_exec.cc modules/pandora_module_exec_powershell.cc modules/pandora_module_perfcounter.cc modules/pandora_module_proc.cc modules/pandora_module_tcpcheck.cc modules/pandora_module_freememory_percent.cc modules/pandora_module_freedisk.cc modules/pandora_module_freedisk_percent.cc modules/pandora_module_logevent.cc modules/pandora_module_service.cc modules/pandora_module_cpuusage.cc modules/pandora_module_wmiquery.cc modules/pandora_module_regexp.cc modules/pandora_module_ping.cc modules/pandora_module_snmpget.cc udp_server/udp_server.cc main.cc pandora_strutils.cc pandora.cc windows_service.cc pandora_agent_conf.cc windows/pandora_windows_info.cc windows/pandora_wmi.cc pandora_windows_service.cc misc/md5.c misc/sha256.cc windows/wmi/disphelper.c ssh/libssh2/channel.c ssh/libssh2/mac.c ssh/libssh2/session.c ssh/libssh2/comp.c ssh/libssh2/misc.c ssh/libssh2/sftp.c ssh/libssh2/crypt.c ssh/libssh2/packet.c ssh/libssh2/userauth.c ssh/libssh2/hostkey.c ssh/libssh2/publickey.c ssh/libssh2/kex.c ssh/libssh2/scp.c ssh/pandora_ssh_client.cc ssh/pandora_ssh_test.cc ftp/pandora_ftp_client.cc ftp/pandora_ftp_test.cc debug_new.cpp
PandoraAgent_CXXFLAGS=-g -O0
else
PandoraAgent_SOURCES = misc/cron.cc misc/pandora_file.cc modules/pandora_data.cc modules/pandora_module_factory.cc modules/pandora_module.cc modules/pandora_module_list.cc modules/pandora_module_plugin.cc modules/pandora_module_inventory.cc modules/pandora_module_freememory.cc modules/pandora_module_exec.cc modules/pandora_module_perfcounter.cc modules/pandora_module_proc.cc modules/pandora_module_tcpcheck.cc modules/pandora_module_freememory_percent.cc modules/pandora_module_freedisk.cc modules/pandora_module_freedisk_percent.cc modules/pandora_module_logevent.cc modules/pandora_module_logchannel.cc modules/pandora_module_service.cc modules/pandora_module_cpuusage.cc modules/pandora_module_wmiquery.cc modules/pandora_module_regexp.cc modules/pandora_module_ping.cc modules/pandora_module_snmpget.cc udp_server/udp_server.cc main.cc pandora_strutils.cc pandora.cc windows_service.cc pandora_agent_conf.cc windows/pandora_windows_info.cc windows/pandora_wmi.cc pandora_windows_service.cc misc/md5.c misc/sha256.cc windows/wmi/disphelper.c ssh/libssh2/channel.c ssh/libssh2/mac.c ssh/libssh2/session.c ssh/libssh2/comp.c ssh/libssh2/misc.c ssh/libssh2/sftp.c ssh/libssh2/crypt.c ssh/libssh2/packet.c ssh/libssh2/userauth.c ssh/libssh2/hostkey.c ssh/libssh2/publickey.c ssh/libssh2/kex.c ssh/libssh2/scp.c ssh/pandora_ssh_client.cc ssh/pandora_ssh_test.cc ftp/pandora_ftp_client.cc ftp/pandora_ftp_test.cc
PandoraAgent_SOURCES = misc/cron.cc misc/pandora_file.cc modules/pandora_data.cc modules/pandora_module_factory.cc modules/pandora_module.cc modules/pandora_module_list.cc modules/pandora_module_plugin.cc modules/pandora_module_inventory.cc modules/pandora_module_freememory.cc modules/pandora_module_exec.cc modules/pandora_module_exec_powershell.cc modules/pandora_module_perfcounter.cc modules/pandora_module_proc.cc modules/pandora_module_tcpcheck.cc modules/pandora_module_freememory_percent.cc modules/pandora_module_freedisk.cc modules/pandora_module_freedisk_percent.cc modules/pandora_module_logevent.cc modules/pandora_module_logchannel.cc modules/pandora_module_service.cc modules/pandora_module_cpuusage.cc modules/pandora_module_wmiquery.cc modules/pandora_module_regexp.cc modules/pandora_module_ping.cc modules/pandora_module_snmpget.cc udp_server/udp_server.cc main.cc pandora_strutils.cc pandora.cc windows_service.cc pandora_agent_conf.cc windows/pandora_windows_info.cc windows/pandora_wmi.cc pandora_windows_service.cc misc/md5.c misc/sha256.cc windows/wmi/disphelper.c ssh/libssh2/channel.c ssh/libssh2/mac.c ssh/libssh2/session.c ssh/libssh2/comp.c ssh/libssh2/misc.c ssh/libssh2/sftp.c ssh/libssh2/crypt.c ssh/libssh2/packet.c ssh/libssh2/userauth.c ssh/libssh2/hostkey.c ssh/libssh2/publickey.c ssh/libssh2/kex.c ssh/libssh2/scp.c ssh/pandora_ssh_client.cc ssh/pandora_ssh_test.cc ftp/pandora_ftp_client.cc ftp/pandora_ftp_test.cc
PandoraAgent_CXXFLAGS=-O2
endif

View File

@ -1,6 +1,6 @@
# Base config file for Pandora FMS Windows Agent
# (c) 2006-2023 Pandora FMS
# Version 7.0NG.775
# Version 7.0NG.776
# 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
@ -157,8 +157,8 @@ ehorus_conf "C:\Program Files\ehorus_agent\ehorus_agent.conf"
module_begin
module_name CPU Load
module_type generic_data
module_wmiquery SELECT LoadPercentage FROM Win32_Processor
module_wmicolumn LoadPercentage
module_wmiquery SELECT PercentProcessorTime FROM Win32_PerfFormattedData_PerfOS_Processor where name like '_Total'
module_wmicolumn PercentProcessorTime
module_max 100
module_min 0
module_description User CPU Usage (%)
@ -180,20 +180,20 @@ module_group Networking
module_end
# Get logs from System source.
module_begin
module_name Eventlog_System
module_type log
module_logevent
module_source System
module_end
# module_begin
# module_name Eventlog_System
# module_type log
# module_logevent
# module_source System
# module_end
# Get logs from Security source.
module_begin
module_name Eventlog_Security
module_type log
module_logevent
module_source Security
module_end
# module_begin
# module_name Eventlog_Security
# module_type log
# module_logevent
# module_source Security
# module_end
# Example plugin to retrieve drive usage
module_plugin cscript.exe //B "%ProgramFiles%\Pandora_Agent\util\df_percent_used.vbs"
@ -526,7 +526,8 @@ module_plugin "%PROGRAMFILES%\Pandora_Agent\util\autodiscover.exe" --default
# Hardening plugin for security compliance analysis.
#module_begin
#module_plugin "%PROGRAMFILES%\Pandora_Agent\util\pandora_hardening.exe -t 150"
#module_plugin "%PROGRAMFILES%\Pandora_Agent\util\pandora_hardening.exe" -t 150
#module_wait_timeout 5
#module_absoluteinterval 7d
#module_end

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:db207ef67053764be7e9b42cd04ea5509cc2a023548aab1c037745ca277b68a3
size 4858753
oid sha256:520619d823dd5396cc90de59e745d9ab3872d25d85358c9abb4890987b5f5426
size 4859595

View File

@ -3,7 +3,7 @@ AllowLanguageSelection
{Yes}
AppName
{Pandora FMS Windows Agent v7.0NG.775}
{Pandora FMS Windows Agent v7.0NG.776}
ApplicationID
{17E3D2CF-CA02-406B-8A80-9D31C17BD08F}
@ -186,7 +186,7 @@ UpgradeApplicationID
{}
Version
{231228}
{240314}
ViewReadme
{Yes}
@ -2387,7 +2387,7 @@ Windows,BuildSeparateArchives
{No}
Windows,Executable
{<%AppName%>-<%Version%>-Setup<%Ext%>}
{<%AppName%>-Setup<%Ext%>}
Windows,FileDescription
{<%AppName%> <%Version%> Setup}

View File

@ -236,6 +236,8 @@ Module_Kind
Pandora_Module::parseModuleKindFromString (string kind) {
if (kind == module_exec_str) {
return MODULE_EXEC;
} else if (kind == module_exec_powershell_str) {
return MODULE_EXEC_POWERSHELL;
} else if (kind == module_proc_str) {
return MODULE_PROC;
} else if (kind == module_service_str) {

View File

@ -94,7 +94,8 @@ namespace Pandora_Modules {
MODULE_REGEXP, /**< The module searches a file for matches of a regular expression */
MODULE_PLUGIN, /**< Plugin */
MODULE_PING, /**< Ping module */
MODULE_SNMPGET /**< SNMP get module */
MODULE_SNMPGET, /**< SNMP get module */
MODULE_EXEC_POWERSHELL /**< The module run a custom powershell command */
} Module_Kind;
/**
@ -109,24 +110,25 @@ namespace Pandora_Modules {
regex_t regexp;
} Condition;
const string module_exec_str = "module_exec";
const string module_proc_str = "module_proc";
const string module_service_str = "module_service";
const string module_freedisk_str = "module_freedisk";
const string module_freedisk_percent_str = "module_freedisk_percent";
const string module_freememory_str = "module_freememory";
const string module_freememory_percent_str = "module_freememory_percent";
const string module_cpuusage_str = "module_cpuusage";
const string module_inventory_str = "module_inventory";
const string module_logevent_str = "module_logevent";
const string module_logchannel_str = "module_logchannel";
const string module_wmiquery_str = "module_wmiquery";
const string module_perfcounter_str = "module_perfcounter";
const string module_tcpcheck_str = "module_tcpcheck";
const string module_regexp_str = "module_regexp";
const string module_plugin_str = "module_plugin";
const string module_ping_str = "module_ping";
const string module_snmpget_str = "module_snmpget";
const string module_exec_str = "module_exec";
const string module_proc_str = "module_proc";
const string module_service_str = "module_service";
const string module_freedisk_str = "module_freedisk";
const string module_freedisk_percent_str = "module_freedisk_percent";
const string module_freememory_str = "module_freememory";
const string module_freememory_percent_str = "module_freememory_percent";
const string module_cpuusage_str = "module_cpuusage";
const string module_inventory_str = "module_inventory";
const string module_logevent_str = "module_logevent";
const string module_logchannel_str = "module_logchannel";
const string module_wmiquery_str = "module_wmiquery";
const string module_perfcounter_str = "module_perfcounter";
const string module_tcpcheck_str = "module_tcpcheck";
const string module_regexp_str = "module_regexp";
const string module_plugin_str = "module_plugin";
const string module_ping_str = "module_ping";
const string module_snmpget_str = "module_snmpget";
const string module_exec_powershell_str = "module_exec_powershell";
/**
* Pandora module super-class exception.

View File

@ -0,0 +1,91 @@
/* Pandora exec module. These modules exec a powershell command.
Copyright (c) 2006-2023 Pandora FMS.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "pandora_module_exec_powershell.h"
#include "../pandora_strutils.h"
#include <iostream>
#include <stdexcept>
#include <sstream>
#include <string>
#include <vector>
#include <cstdio>
#define EXEC_OK 0
#define EXEC_ERR -1
#define BUFSIZE 4096
using namespace Pandora;
using namespace Pandora_Strutils;
using namespace Pandora_Modules;
/**
* Creates a Pandora_Module_Exec_Powershell object.
*
* @param name Module name
* @param exec Command to be executed.
*/
Pandora_Module_Exec_Powershell::Pandora_Module_Exec_Powershell(string name, string exec)
: Pandora_Module (name) {
string escaped_exec;
for (char c : exec) {
if (c == '"' || c == '\\') {
escaped_exec += '\\';
}
escaped_exec += c;
}
this->module_exec = "powershell -C \"" + escaped_exec + "\"";
this->setKind (module_exec_powershell_str);
}
void Pandora_Module_Exec_Powershell::run() {
string output_result;
this->has_output = false;
FILE* pipe = popen(this->module_exec.c_str(), "r");
if (!pipe) {
pandoraLog ("Error while executing command.", GetLastError ());
return;
}
char buffer[BUFSIZE];
while (fgets(buffer, BUFSIZE, pipe) != NULL) {
output_result += buffer;
}
int result = pclose(pipe);
if (result == EXEC_ERR) {
pandoraLog ("Error while closing command process.", GetLastError ());
return;
}
if (result != EXEC_OK) {
pandoraLog ("Error invalid powershell command.", GetLastError ());
return;
}
this->has_output = true;
this->setOutput (output_result);
}

View File

@ -0,0 +1,43 @@
/* Pandora exec module. These modules exec a powershell command
Copyright (c) 2006-2023 Pandora FMS.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __PANDORA_MODULE_EXEC_POWERWSHELL_H__
#define __PANDORA_MODULE_EXEC_POWERWSHELL_H__
#include "pandora_module.h"
namespace Pandora_Modules {
/**
* Module to execute a powershell command.
*
* Any custom order that want to be executed can be put in
* the <code>util</code> directory into the Pandora agent path.
*/
class Pandora_Module_Exec_Powershell : public Pandora_Module {
private:
string module_exec;
public:
Pandora_Module_Exec_Powershell (string name, string exec);
void run ();
};
}
#endif

View File

@ -22,6 +22,7 @@
#include "pandora_module_factory.h"
#include "pandora_module.h"
#include "pandora_module_exec.h"
#include "pandora_module_exec_powershell.h"
#include "pandora_module_proc.h"
#include "pandora_module_service.h"
#include "pandora_module_freedisk.h"
@ -129,6 +130,7 @@ using namespace Pandora_Strutils;
#define TOKEN_ALERT_TEMPLATE ("module_alert_template")
#define TOKEN_USER_SESSION ("module_user_session ")
#define TOKEN_WAIT_TIMEOUT ("module_wait_timeout ")
#define TOKEN_EXEC_POWERSHELL ("module_exec_powershell ")
string
parseLine (string line, string token) {
@ -158,7 +160,7 @@ Pandora_Module *
Pandora_Module_Factory::getModuleFromDefinition (string definition) {
list<string> tokens;
list<string>::iterator iter;
string module_name, module_type, module_exec;
string module_name, module_type, module_exec, module_exec_powershell;
string module_min, module_max, module_description;
string module_interval, module_absoluteinterval;
string module_proc, module_service;
@ -268,6 +270,7 @@ Pandora_Module_Factory::getModuleFromDefinition (string definition) {
module_user_session = "";
macro = "";
module_wait_timeout = "";
module_exec_powershell = "";
stringtok (tokens, definition, "\n");
@ -302,6 +305,9 @@ Pandora_Module_Factory::getModuleFromDefinition (string definition) {
if (module_exec == "") {
module_exec = parseLine (line, TOKEN_EXEC);
}
if (module_exec_powershell == "") {
module_exec_powershell = parseLine (line, TOKEN_EXEC_POWERSHELL);
}
if (module_wait_timeout == "") {
module_wait_timeout = parseLine (line, TOKEN_WAIT_TIMEOUT);
}
@ -626,6 +632,13 @@ Pandora_Module_Factory::getModuleFromDefinition (string definition) {
}
}
if (module_exec_powershell != "") {
pos_macro = module_exec_powershell.find(macro_name);
if (pos_macro != string::npos){
module_exec_powershell.replace(pos_macro, macro_name.size(), macro_value);
}
}
if (module_proc != "") {
pos_macro = module_proc.find(macro_name);
if (pos_macro != string::npos){
@ -1155,6 +1168,9 @@ Pandora_Module_Factory::getModuleFromDefinition (string definition) {
module->setWaitTimeout (atoi (module_wait_timeout.c_str ()));
}
} else if (module_exec_powershell != "") {
module = new Pandora_Module_Exec_Powershell (module_name, module_exec_powershell);
} else if (module_proc != "") {
module = new Pandora_Module_Proc (module_name,
module_proc);

View File

@ -48,7 +48,7 @@ Pandora_Module_Freedisk_Percent::Pandora_Module_Freedisk_Percent (string name, s
void
Pandora_Module_Freedisk_Percent::run () {
long res;
double res;
try {
Pandora_Module::run ();
@ -59,7 +59,7 @@ Pandora_Module_Freedisk_Percent::run () {
try {
res = Pandora_Wmi::getDiskFreeSpacePercent (this->disk_id);
this->setOutput (longtostr (res));
this->setOutput(std::to_string(res));
} catch (Pandora_Wmi::Pandora_Wmi_Exception e) {
this->has_output = false;
}

View File

@ -21,6 +21,7 @@
#include "pandora_module_factory.h"
#include "pandora_module_list.h"
#include "pandora_module_exec.h"
#include "pandora_module_exec_powershell.h"
#include "pandora_module_proc.h"
#include "pandora_module_service.h"
#include "pandora_module_freedisk.h"
@ -235,6 +236,7 @@ Pandora_Modules::Pandora_Module_List::parseModuleDefinition (string definition)
Pandora_Module_Plugin *module_plugin;
Pandora_Module_Ping *module_ping;
Pandora_Module_SNMPGet *module_snmpget;
Pandora_Module_Exec_Powershell *module_exec_powershell;
module = Pandora_Module_Factory::getModuleFromDefinition (definition);
@ -244,6 +246,11 @@ Pandora_Modules::Pandora_Module_List::parseModuleDefinition (string definition)
module_exec = (Pandora_Module_Exec *) module;
modules->push_back (module_exec);
break;
case MODULE_EXEC_POWERSHELL:
module_exec_powershell = (Pandora_Module_Exec_Powershell *) module;
modules->push_back (module_exec_powershell);
break;
case MODULE_PROC:
module_proc = (Pandora_Module_Proc *) module;

View File

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

View File

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

View File

@ -188,11 +188,11 @@ Pandora_Wmi::getDiskFreeSpace (string disk_id) {
* @exception Pandora_Wmi_Exception Throwd if an error occured when reading
* from WMI database.
*/
unsigned long
double
Pandora_Wmi::getDiskFreeSpacePercent (string disk_id) {
CDhInitialize init;
CDispPtr wmi_svc, quickfixes;
double free_space = 0, size = 0;
double free_space = 0, size = 0;
string query;
query = "SELECT Size, FreeSpace FROM Win32_LogicalDisk WHERE DeviceID = \"" + disk_id + "\"";
@ -202,7 +202,7 @@ Pandora_Wmi::getDiskFreeSpacePercent (string disk_id) {
dhCheck (dhGetValue (L"%o", &quickfixes, wmi_svc,
L".ExecQuery(%T)",
query.c_str ()));
FOR_EACH (quickfix, quickfixes, NULL) {
dhGetValue (L"%e", &free_space, quickfix,
L".FreeSpace");
@ -213,7 +213,7 @@ Pandora_Wmi::getDiskFreeSpacePercent (string disk_id) {
return 0;
}
return (unsigned long) (free_space * 100 / size);
return (free_space * 100 / size);
} NEXT_THROW (quickfix);
} catch (string errstr) {
pandoraLog ("getDiskFreeSpace error. %s", errstr.c_str ());

View File

@ -44,7 +44,7 @@ namespace Pandora_Wmi {
int isProcessRunning (string process_name);
int isServiceRunning (string service_name);
unsigned long getDiskFreeSpace (string disk_id);
unsigned long getDiskFreeSpacePercent (string disk_id);
double getDiskFreeSpacePercent (string disk_id);
int getCpuUsagePercentage (int cpu_id);
long getFreememory ();
long getFreememoryPercent ();

View File

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

View File

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.3 KiB

View File

@ -0,0 +1,16 @@
html {
box-sizing: border-box;
overflow: -moz-scrollbars-vertical;
overflow-y: scroll;
}
*,
*:before,
*:after {
box-sizing: inherit;
}
body {
margin: 0;
background: #fafafa;
}

View File

@ -0,0 +1,29 @@
<!-- HTML for static distribution bundle build -->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>Pandora FMS: API documentation</title>
<link rel="stylesheet" type="text/css" href="./swagger-ui.css" />
<link rel="stylesheet" type="text/css" href="index.css" />
<link
rel="icon"
type="image/png"
href="./favicon-32x32.png"
sizes="32x32"
/>
<link
rel="icon"
type="image/png"
href="./favicon-16x16.png"
sizes="16x16"
/>
</head>
<body>
<div id="swagger-ui"></div>
<script src="./swagger-ui-bundle.js" charset="UTF-8"></script>
<script src="./swagger-ui-standalone-preset.js" charset="UTF-8"></script>
<script src="./swagger-initializer.js" charset="UTF-8"></script>
</body>
</html>

View File

@ -0,0 +1,96 @@
ramda: 361.78 KB (5.92%)
ramda-adjunct: 257.62 KB (4.21%)
lodash: 253.56 KB (4.15%)
autolinker: 203.32 KB (3.33%)
@swagger-api/apidom-ns-openapi-3-0: 201.95 KB (3.30%)
swagger-client: 172.85 KB (2.83%)
cookie: 5.16 KB (2.98%)
is-plain-object: 758 B (0.428%)
<self>: 166.96 KB (96.6%)
@swagger-api/apidom-ns-openapi-3-1: 153.37 KB (2.51%)
immutable: 139.01 KB (2.27%)
react-dom: 129.98 KB (2.13%)
remarkable: 125.56 KB (2.05%)
highlight.js: 111.85 KB (1.83%)
js-yaml: 105.01 KB (1.72%)
readable-stream: 96.66 KB (1.58%)
@swagger-api/apidom-reference: 90.42 KB (1.48%)
core-js-pure: 82.79 KB (1.35%)
dompurify: 63.43 KB (1.04%)
minim: 57.35 KB (0.938%)
buffer: 56.99 KB (0.932%)
@swagger-api/apidom-ns-json-schema-draft-4: 54.24 KB (0.887%)
@swagger-api/apidom-core: 50.31 KB (0.823%)
@swagger-api/apidom-ast: 47.25 KB (0.773%)
react-syntax-highlighter: 40.15 KB (0.657%)
react-redux: 36.88 KB (0.603%)
fast-json-patch: 31.89 KB (0.522%)
qs: 26.61 KB (0.435%)
reselect: 21.43 KB (0.350%)
short-unique-id: 18.88 KB (0.309%)
sha.js: 18.57 KB (0.304%)
object-inspect: 18.44 KB (0.302%)
redux: 16.37 KB (0.268%)
url-parse: 16.23 KB (0.266%)
tslib: 15.87 KB (0.260%)
events: 14.54 KB (0.238%)
get-intrinsic: 13.01 KB (0.213%)
zenscroll: 12.31 KB (0.201%)
react-debounce-input: 11.95 KB (0.195%)
react-immutable-proptypes: 11.82 KB (0.193%)
ret: 10.82 KB (0.177%)
lodash.debounce: 10.53 KB (0.172%)
unraw: 9.9 KB (0.162%)
string_decoder: 9.24 KB (0.151%)
xml: 7.39 KB (0.121%)
react-copy-to-clipboard: 7.33 KB (0.120%)
traverse: 7.15 KB (0.117%)
react: 6.94 KB (0.113%)
@swagger-api/apidom-json-pointer: 6.39 KB (0.105%)
randexp: 6.15 KB (0.101%)
react-immutable-pure-component: 6.01 KB (0.0982%)
redux-immutable: 5.43 KB (0.0889%)
process: 5.29 KB (0.0865%)
drange: 4.8 KB (0.0786%)
lowlight: 4.42 KB (0.0724%)
scheduler: 4.33 KB (0.0708%)
@babel/runtime: 4.23 KB (0.0691%)
deep-extend: 4.19 KB (0.0686%)
deepmerge: 3.95 KB (0.0647%)
base64-js: 3.84 KB (0.0628%)
stream-browserify: 3.76 KB (0.0615%)
@swagger-api/apidom-error: 3.36 KB (0.0549%)
side-channel: 3.31 KB (0.0542%)
copy-to-clipboard: 3.29 KB (0.0537%)
format: 3.26 KB (0.0533%)
stampit: 3.16 KB (0.0516%)
css.escape: 3.08 KB (0.0504%)
serialize-error: 2.93 KB (0.0479%)
define-data-property: 2.77 KB (0.0453%)
prop-types: 2.6 KB (0.0425%)
querystringify: 2.5 KB (0.0410%)
xml-but-prettier: 2.17 KB (0.0354%)
has-symbols: 2.13 KB (0.0348%)
function-bind: 2.12 KB (0.0346%)
ieee754: 2.1 KB (0.0344%)
@braintree/sanitize-url: 1.98 KB (0.0324%)
safe-buffer: 1.63 KB (0.0267%)
call-bind: 1.59 KB (0.0260%)
util-deprecate: 1.58 KB (0.0258%)
randombytes: 1.54 KB (0.0252%)
js-file-download: 1.52 KB (0.0248%)
classnames: 1.49 KB (0.0244%)
use-sync-external-store: 1.28 KB (0.0210%)
repeat-string: 1.18 KB (0.0194%)
set-function-length: 1.14 KB (0.0187%)
@babel/runtime-corejs3: 878 B (0.0140%)
has-property-descriptors: 817 B (0.0130%)
toggle-selection: 780 B (0.0125%)
inherits: 753 B (0.0120%)
requires-port: 753 B (0.0120%)
fault: 691 B (0.0110%)
gopd: 263 B (0.00420%)
hasown: 234 B (0.00374%)
has-proto: 197 B (0.00315%)
object-inspect|.: 15 B (0.000240%)
<self>: 2.72 MB (45.5%)

View File

@ -0,0 +1,14 @@
readable-stream: 96.66 KB (6.16%)
buffer: 56.99 KB (3.63%)
sha.js: 18.57 KB (1.18%)
events: 14.54 KB (0.926%)
string_decoder: 9.24 KB (0.589%)
xml: 7.39 KB (0.471%)
process: 5.29 KB (0.337%)
deep-extend: 4.19 KB (0.267%)
stream-browserify: 3.76 KB (0.239%)
safe-buffer: 1.63 KB (0.104%)
util-deprecate: 1.58 KB (0.100%)
randombytes: 1.54 KB (0.0981%)
inherits: 753 B (0.0468%)
<self>: 1.32 MB (85.9%)

View File

@ -0,0 +1,96 @@
ramda: 361.78 KB (5.92%)
ramda-adjunct: 257.62 KB (4.21%)
lodash: 253.56 KB (4.15%)
autolinker: 203.32 KB (3.33%)
@swagger-api/apidom-ns-openapi-3-0: 201.95 KB (3.30%)
swagger-client: 172.85 KB (2.83%)
cookie: 5.16 KB (2.98%)
is-plain-object: 758 B (0.428%)
<self>: 166.96 KB (96.6%)
@swagger-api/apidom-ns-openapi-3-1: 153.37 KB (2.51%)
immutable: 139.01 KB (2.27%)
react-dom: 129.98 KB (2.13%)
remarkable: 125.56 KB (2.05%)
highlight.js: 111.85 KB (1.83%)
js-yaml: 105.01 KB (1.72%)
readable-stream: 96.66 KB (1.58%)
@swagger-api/apidom-reference: 90.42 KB (1.48%)
core-js-pure: 82.79 KB (1.35%)
dompurify: 63.43 KB (1.04%)
minim: 57.35 KB (0.938%)
buffer: 56.99 KB (0.932%)
@swagger-api/apidom-ns-json-schema-draft-4: 54.24 KB (0.887%)
@swagger-api/apidom-core: 50.31 KB (0.823%)
@swagger-api/apidom-ast: 47.25 KB (0.773%)
react-syntax-highlighter: 40.15 KB (0.657%)
react-redux: 36.88 KB (0.603%)
fast-json-patch: 31.89 KB (0.522%)
qs: 26.61 KB (0.435%)
reselect: 21.43 KB (0.350%)
short-unique-id: 18.88 KB (0.309%)
sha.js: 18.57 KB (0.304%)
object-inspect: 18.44 KB (0.302%)
redux: 16.37 KB (0.268%)
url-parse: 16.23 KB (0.266%)
tslib: 15.87 KB (0.260%)
events: 14.54 KB (0.238%)
get-intrinsic: 13.01 KB (0.213%)
zenscroll: 12.31 KB (0.201%)
react-debounce-input: 11.95 KB (0.195%)
react-immutable-proptypes: 11.82 KB (0.193%)
ret: 10.82 KB (0.177%)
lodash.debounce: 10.53 KB (0.172%)
unraw: 9.9 KB (0.162%)
string_decoder: 9.24 KB (0.151%)
xml: 7.39 KB (0.121%)
react-copy-to-clipboard: 7.33 KB (0.120%)
traverse: 7.15 KB (0.117%)
react: 6.94 KB (0.113%)
@swagger-api/apidom-json-pointer: 6.39 KB (0.105%)
randexp: 6.15 KB (0.101%)
react-immutable-pure-component: 6.01 KB (0.0982%)
redux-immutable: 5.43 KB (0.0889%)
process: 5.29 KB (0.0865%)
drange: 4.8 KB (0.0786%)
lowlight: 4.42 KB (0.0724%)
scheduler: 4.33 KB (0.0708%)
@babel/runtime: 4.23 KB (0.0691%)
deep-extend: 4.19 KB (0.0686%)
deepmerge: 3.95 KB (0.0647%)
base64-js: 3.84 KB (0.0628%)
stream-browserify: 3.76 KB (0.0615%)
@swagger-api/apidom-error: 3.36 KB (0.0549%)
side-channel: 3.31 KB (0.0542%)
copy-to-clipboard: 3.29 KB (0.0537%)
format: 3.26 KB (0.0533%)
stampit: 3.16 KB (0.0516%)
css.escape: 3.08 KB (0.0504%)
serialize-error: 2.93 KB (0.0479%)
define-data-property: 2.77 KB (0.0453%)
prop-types: 2.6 KB (0.0425%)
querystringify: 2.5 KB (0.0410%)
xml-but-prettier: 2.17 KB (0.0354%)
has-symbols: 2.13 KB (0.0348%)
function-bind: 2.12 KB (0.0346%)
ieee754: 2.1 KB (0.0344%)
@braintree/sanitize-url: 1.98 KB (0.0324%)
safe-buffer: 1.63 KB (0.0267%)
call-bind: 1.59 KB (0.0260%)
util-deprecate: 1.58 KB (0.0258%)
randombytes: 1.54 KB (0.0252%)
js-file-download: 1.52 KB (0.0248%)
classnames: 1.49 KB (0.0244%)
use-sync-external-store: 1.28 KB (0.0210%)
repeat-string: 1.18 KB (0.0194%)
set-function-length: 1.14 KB (0.0187%)
@babel/runtime-corejs3: 878 B (0.0140%)
has-property-descriptors: 817 B (0.0130%)
toggle-selection: 780 B (0.0125%)
inherits: 753 B (0.0120%)
requires-port: 753 B (0.0120%)
fault: 691 B (0.0110%)
gopd: 263 B (0.00420%)
hasown: 234 B (0.00374%)
has-proto: 197 B (0.00315%)
object-inspect|.: 15 B (0.000240%)
<self>: 2.72 MB (45.5%)

View File

@ -0,0 +1,95 @@
<!DOCTYPE html>
<html lang="en-US">
<head>
<title>Swagger UI: OAuth2 Redirect</title>
</head>
<body>
<script>
"use strict";
function run() {
var oauth2 = window.opener.swaggerUIRedirectOauth2;
var sentState = oauth2.state;
var redirectUrl = oauth2.redirectUrl;
var isValid, qp, arr;
if (/code|token|error/.test(window.location.hash)) {
qp = window.location.hash.substring(1).replace("?", "&");
} else {
qp = location.search.substring(1);
}
arr = qp.split("&");
arr.forEach(function(v, i, _arr) {
_arr[i] = '"' + v.replace("=", '":"') + '"';
});
qp = qp
? JSON.parse("{" + arr.join() + "}", function(key, value) {
return key === "" ? value : decodeURIComponent(value);
})
: {};
isValid = qp.state === sentState;
if (
(oauth2.auth.schema.get("flow") === "accessCode" ||
oauth2.auth.schema.get("flow") === "authorizationCode" ||
oauth2.auth.schema.get("flow") === "authorization_code") &&
!oauth2.auth.code
) {
if (!isValid) {
oauth2.errCb({
authId: oauth2.auth.name,
source: "auth",
level: "warning",
message:
"Authorization may be unsafe, passed state was changed in server. The passed state wasn't returned from auth server."
});
}
if (qp.code) {
delete oauth2.state;
oauth2.auth.code = qp.code;
oauth2.callback({ auth: oauth2.auth, redirectUrl: redirectUrl });
} else {
let oauthErrorMsg;
if (qp.error) {
oauthErrorMsg =
"[" +
qp.error +
"]: " +
(qp.error_description
? qp.error_description + ". "
: "no accessCode received from the server. ") +
(qp.error_uri ? "More info: " + qp.error_uri : "");
}
oauth2.errCb({
authId: oauth2.auth.name,
source: "auth",
level: "error",
message:
oauthErrorMsg ||
"[Authorization failed]: no accessCode received from the server."
});
}
} else {
oauth2.callback({
auth: oauth2.auth,
token: qp,
isValid: isValid,
redirectUrl: redirectUrl
});
}
window.close();
}
if (document.readyState !== "loading") {
run();
} else {
document.addEventListener("DOMContentLoaded", function() {
run();
});
}
</script>
</body>
</html>

View File

@ -0,0 +1,41 @@
window.onload = function() {
//<editor-fold desc="Changeable Configuration Block">
const UrlMutatorPlugin = system => ({
rootInjects: {
setServer: server => {
const jsonSpec = system.getState().toJSON().spec.json;
const endpoint = window.location.pathname.replace(
"/api/documentation/",
""
);
const servers = [
{
url: endpoint + jsonSpec.servers[0].url,
description: "Pandora Fms Api"
}
];
const newJsonSpec = Object.assign({}, jsonSpec, { servers });
return system.specActions.updateJsonSpec(newJsonSpec);
}
}
});
// the following lines will be replaced by docker/configurator, when it runs in a docker-container
const ui = SwaggerUIBundle({
url: "../v2/swagger.json",
dom_id: "#swagger-ui",
docExpansion: "none",
deepLinking: true,
presets: [SwaggerUIBundle.presets.apis, SwaggerUIStandalonePreset],
plugins: [SwaggerUIBundle.plugins.DownloadUrl, UrlMutatorPlugin],
layout: "StandaloneLayout",
onComplete: () => {
window.ui.setServer();
}
});
window.ui = ui;
//</editor-fold>
};

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,120 @@
/*!
Copyright (c) 2018 Jed Watson.
Licensed under the MIT License (MIT), see
http://jedwatson.github.io/classnames
*/
/*!
* @description Recursive object extending
* @author Viacheslav Lotsmanov <lotsmanov89@gmail.com>
* @license MIT
*
* The MIT License (MIT)
*
* Copyright (c) 2013-2018 Viacheslav Lotsmanov
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
/*!
* The buffer module from node.js, for the browser.
*
* @author Feross Aboukhadijeh <https://feross.org>
* @license MIT
*/
/*!
* cookie
* Copyright(c) 2012-2014 Roman Shtylman
* Copyright(c) 2015 Douglas Christopher Wilson
* MIT Licensed
*/
/*!
* https://github.com/Starcounter-Jack/JSON-Patch
* (c) 2017-2021 Joachim Wester
* MIT license
*/
/*!
* https://github.com/Starcounter-Jack/JSON-Patch
* (c) 2017-2022 Joachim Wester
* MIT licensed
*/
/*!
* is-plain-object <https://github.com/jonschlinkert/is-plain-object>
*
* Copyright (c) 2014-2017, Jon Schlinkert.
* Released under the MIT License.
*/
/*!
* repeat-string <https://github.com/jonschlinkert/repeat-string>
*
* Copyright (c) 2014-2015, Jon Schlinkert.
* Licensed under the MIT License.
*/
/*! @license DOMPurify 3.0.8 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.0.8/LICENSE */
/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
/*! js-yaml 4.1.0 https://github.com/nodeca/js-yaml @license MIT */
/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
/**
* @license React
* react-dom.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
/**
* @license React
* react.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
/**
* @license React
* scheduler.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
/**
* @license React
* use-sync-external-store-with-selector.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,35 @@
/*!
* @description Recursive object extending
* @author Viacheslav Lotsmanov <lotsmanov89@gmail.com>
* @license MIT
*
* The MIT License (MIT)
*
* Copyright (c) 2013-2018 Viacheslav Lotsmanov
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
/*!
* The buffer module from node.js, for the browser.
*
* @author Feross Aboukhadijeh <https://feross.org>
* @license MIT
*/
/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,120 @@
/*!
Copyright (c) 2018 Jed Watson.
Licensed under the MIT License (MIT), see
http://jedwatson.github.io/classnames
*/
/*!
* @description Recursive object extending
* @author Viacheslav Lotsmanov <lotsmanov89@gmail.com>
* @license MIT
*
* The MIT License (MIT)
*
* Copyright (c) 2013-2018 Viacheslav Lotsmanov
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
/*!
* The buffer module from node.js, for the browser.
*
* @author Feross Aboukhadijeh <https://feross.org>
* @license MIT
*/
/*!
* cookie
* Copyright(c) 2012-2014 Roman Shtylman
* Copyright(c) 2015 Douglas Christopher Wilson
* MIT Licensed
*/
/*!
* https://github.com/Starcounter-Jack/JSON-Patch
* (c) 2017-2021 Joachim Wester
* MIT license
*/
/*!
* https://github.com/Starcounter-Jack/JSON-Patch
* (c) 2017-2022 Joachim Wester
* MIT licensed
*/
/*!
* is-plain-object <https://github.com/jonschlinkert/is-plain-object>
*
* Copyright (c) 2014-2017, Jon Schlinkert.
* Released under the MIT License.
*/
/*!
* repeat-string <https://github.com/jonschlinkert/repeat-string>
*
* Copyright (c) 2014-2015, Jon Schlinkert.
* Licensed under the MIT License.
*/
/*! @license DOMPurify 3.0.8 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.0.8/LICENSE */
/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
/*! js-yaml 4.1.0 https://github.com/nodeca/js-yaml @license MIT */
/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
/**
* @license React
* react-dom.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
/**
* @license React
* react.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
/**
* @license React
* scheduler.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
/**
* @license React
* use-sync-external-store-with-selector.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,22 @@
/*!
* The buffer module from node.js, for the browser.
*
* @author Feross Aboukhadijeh <https://feross.org>
* @license MIT
*/
/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
/*! js-yaml 4.1.0 https://github.com/nodeca/js-yaml @license MIT */
/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
/**
* @license React
* react.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1 @@
<meta http-equiv="REFRESH" content="0; url=documentation" />

View File

@ -0,0 +1,5 @@
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^$ public/ [L]
RewriteRule (.*) public/$1 [L]
</IfModule>

View File

@ -0,0 +1,25 @@
<?php
use DI\ContainerBuilder;
use Slim\App;
require_once __DIR__.'/includeDependencies.php';
$containerBuilder = new ContainerBuilder();
// Add DI container definitions.
$containerBuilder->addDefinitions(__DIR__.'/container.php');
// Create DI container instance.
$container = $containerBuilder->build();
// Create Slim App instance.
$app = $container->get(App::class);
// Set attachment directory.
$config['attachment_directory'] = __DIR__.'/../../../attachment';
// Register routes.
(require __DIR__.'/routes.php')($app);
return $app;

View File

@ -0,0 +1,57 @@
<?php
use PandoraFMS\Modules\Authentication\Repositories\TokenRepository;
use PandoraFMS\Modules\Authentication\Repositories\TokenRepositoryMySQL;
use PandoraFMS\Modules\Events\Repositories\EventRepository;
use PandoraFMS\Modules\Events\Repositories\EventRepositoryMySQL;
use PandoraFMS\Modules\Groups\Repositories\GroupRepository;
use PandoraFMS\Modules\Groups\Repositories\GroupRepositoryMySQL;
use PandoraFMS\Modules\Shared\Repositories\Repository;
use PandoraFMS\Modules\Shared\Repositories\RepositoryMySQL;
use PandoraFMS\Modules\Users\Repositories\UserRepository;
use PandoraFMS\Modules\Users\Repositories\UserRepositoryMySQL;
use Psr\Container\ContainerInterface;
use Slim\App;
use Slim\Factory\AppFactory;
return [
'settings' => function () {
return include __DIR__.'/settings.php';
},
App::class => function (ContainerInterface $container) {
AppFactory::setContainer($container);
$app = AppFactory::create();
$basePath = rtrim(
preg_replace(
'/(.*)public\/.*/',
'$1',
$_SERVER['SCRIPT_NAME']
),
'/'
);
$app->setBasePath($basePath);
// Register middleware.
(include __DIR__.'/middleware.php')($app, $container);
return $app;
},
Repository::class => function (ContainerInterface $container) {
return $container->get(RepositoryMySQL::class);
},
TokenRepository::class => function (ContainerInterface $container) {
return $container->get(TokenRepositoryMySQL::class);
},
UserRepository::class => function (ContainerInterface $container) {
return $container->get(UserRepositoryMySQL::class);
},
GroupRepository::class => function (ContainerInterface $container) {
return $container->get(GroupRepositoryMySQL::class);
},
EventRepository::class => function (ContainerInterface $container) {
return $container->get(EventRepositoryMySQL::class);
},
];

View File

@ -0,0 +1,20 @@
<?php
require_once __DIR__.'/../../../vendor/autoload.php';
$exclude = ['tests'];
$pattern = '*.php';
$openapi = \OpenApi\Generator::scan(
\OpenApi\Util::finder(
[
__DIR__.'/..',
__DIR__.'/../../../include/lib/Modules',
],
$exclude,
$pattern
)
);
header('Content-Type: application/json');
file_put_contents(__DIR__.'/../public/swagger.json', $openapi->toJson());

View File

@ -0,0 +1,4 @@
<?php
require_once __DIR__.'/../../../vendor/autoload.php';
require_once __DIR__.'/../../../include/config.php';

View File

@ -0,0 +1,15 @@
<?php
global $config;
ob_start();
if (file_exists($config['homedir'].'/'.ENTERPRISE_DIR.'/load_enterprise.php') === true) {
$config['return_api_mode'] = true;
include_once $config['homedir'].'/'.ENTERPRISE_DIR.'/load_enterprise.php';
include_once $config['homedir'].'/'.ENTERPRISE_DIR.'/include/functions_login.php';
}
$error = ob_get_clean();
if (empty($error) === false) {
throw new Exception($error);
}

View File

@ -0,0 +1,99 @@
<?php
use PandoraFMS\Modules\Shared\Enums\HttpCodesEnum;
use PandoraFMS\Modules\Shared\Middlewares\AclListMiddleware;
use PandoraFMS\Modules\Shared\Middlewares\UserTokenMiddleware;
use Psr\Container\ContainerInterface;
use Psr\Http\Message\ServerRequestInterface as Request;
use Psr\Http\Server\RequestHandlerInterface as RequestHandler;
use Psr\Log\LoggerInterface;
use Slim\App;
return function (App $app, ContainerInterface $container) {
// Parse json, form data and xml.
$app->addBodyParsingMiddleware();
// Add the Slim built-in routing middleware.
$app->addRoutingMiddleware();
// Authenticate Integria.
$beforeMiddleware = function (
Request $request,
RequestHandler $handler
) use (
$app,
$container
) {
$ipOrigin = $_SERVER['REMOTE_ADDR'];
$aclListMiddleware = $container->get(AclListMiddleware::class);
if ($aclListMiddleware->check($ipOrigin) === false) {
$response = $app->getResponseFactory()->createResponse();
$response->getBody()->write(
json_encode(['error' => __('IP %s is not in ACL list', $ipOrigin)])
);
$errorCode = HttpCodesEnum::UNAUTHORIZED;
$newResponse = $response->withStatus($errorCode);
return $newResponse;
}
$userTokenMiddleware = $container->get(UserTokenMiddleware::class);
if ($userTokenMiddleware->check($request) === false) {
$response = $app->getResponseFactory()->createResponse();
$response->getBody()->write(
json_encode(['error' => __('You need to be authenticated to perform this action')])
);
$errorCode = HttpCodesEnum::UNAUTHORIZED;
$newResponse = $response->withStatus($errorCode);
return $newResponse;
}
try {
include_once __DIR__.'/includeEnterpriseDependencies.php';
} catch (\Throwable $th) {
$response = $app->getResponseFactory()->createResponse();
$response->getBody()->write(
json_encode(['error' => __('Invalid License')])
);
$errorCode = HttpCodesEnum::UNAUTHORIZED;
$newResponse = $response->withStatus($errorCode);
return $newResponse;
}
$response = $handler->handle($request);
return $response;
};
$app->add($beforeMiddleware);
// Handle exceptions.
// Define Custom Error Handler.
$customErrorHandler = function (
Request $request,
Throwable $exception,
bool $displayErrorDetails,
bool $logErrors,
bool $logErrorDetails,
?LoggerInterface $logger=null
) use ($app) {
$logger?->error($exception->getMessage());
$response = $app->getResponseFactory()->createResponse();
$response->getBody()->write(
json_encode(['error' => $exception->getMessage()])
);
$errorCode = 500;
if (empty($exception->getCode()) === false) {
$errorCode = $exception->getCode();
}
$newResponse = $response->withStatus($errorCode);
return $newResponse;
};
// Add Error Middleware.
$errorMiddleware = $app->addErrorMiddleware(true, true, true);
$errorMiddleware->setDefaultErrorHandler($customErrorHandler);
};

View File

@ -0,0 +1,12 @@
<?php
use Slim\App;
return function (App $app) {
(include __DIR__.'/../../../include/lib/Modules/Authentication/routes.php')($app);
(include __DIR__.'/../../../include/lib/Modules/Events/routes.php')($app);
(include __DIR__.'/../../../include/lib/Modules/Groups/routes.php')($app);
(include __DIR__.'/../../../include/lib/Modules/Profiles/routes.php')($app);
(include __DIR__.'/../../../include/lib/Modules/Tags/routes.php')($app);
(include __DIR__.'/../../../include/lib/Modules/Users/routes.php')($app);
};

View File

@ -0,0 +1,10 @@
<?php
require __DIR__.'/../../../include/config.php';
error_reporting(E_ALL);
ini_set('display_errors', 1);
ini_set('log_errors', 1);
ini_set('error_log', $config['homedir'].'/log/console.log');
return [];

View File

@ -0,0 +1,7 @@
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^ index.php [QSA,L]
RewriteRule .* - [env=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
</IfModule>

View File

@ -0,0 +1,3 @@
<?php
(require __DIR__.'/../config/bootstrap.php')->run();

File diff suppressed because it is too large Load Diff

View File

@ -9,7 +9,7 @@
],
"config": {
"platform": {
"php": "8.0.2"
"php": "8.2"
}
},
"require": {
@ -18,7 +18,17 @@
"amphp/parallel-functions": "^1.0",
"chrome-php/chrome": "^1.8.1",
"artica/phpchartjs": "^1.0",
"tinymce/tinymce": "^6.4"
"tinymce/tinymce": "^6.4",
"slim/slim": "4.*",
"slim/psr7": "^1.6",
"nyholm/psr7": "^1.8",
"nyholm/psr7-server": "^1.1",
"guzzlehttp/psr7": "^2",
"laminas/laminas-diactoros": "^3.2",
"php-di/php-di": "^7.0",
"zircote/swagger-php": "^4.8",
"doctrine/annotations": "^2.0",
"ramsey/uuid": "^4.7"
},
"repositories": {
"phpchartjs": {

File diff suppressed because it is too large Load Diff

View File

@ -496,6 +496,10 @@ function mainAgentsModules()
$agents = [];
}
if (isset($agents_id) === false) {
$agents_id = '';
}
$filter_agents = html_print_label_input_block(
__('Agents'),
html_print_select(

View File

@ -280,18 +280,17 @@ function dbmgr_extension_main()
if (is_array($result) === false) {
echo '<strong>Output: <strong>'.$result;
db_pandora_audit(
AUDIT_LOG_SYSTEM,
'DB Interface Extension. SQL',
false,
false,
$sql
);
return;
}
db_pandora_audit(
AUDIT_LOG_SYSTEM,
'DB Interface Extension. SQL',
false,
false,
$sql
);
echo "<div class='overflow'>";
$table = new stdClass();
$table->width = '100%';

View File

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

View File

@ -2,7 +2,7 @@
// Allow Grafana proxy.
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Methods: GET, POST, OPTIONS');
header('Access-Control-Allow-Headers: Origin, Content-Type, Accept, X-Grafana-Org-Id, X-Grafana-NoCache, X-DS-Authorization');
header('Access-Control-Allow-Headers: Origin, Content-Type, Accept, X-Grafana-Org-Id, X-Grafana-NoCache, X-DS-Authorization, Authorization');
// Get all request headers.
$headers = apache_request_headers();
@ -23,6 +23,9 @@ if ($headers['Authorization']) {
list($user, $password) = explode(':', base64_decode($headers['Authorization']));
// Prevent sql injection.
$user = mysqli_real_escape_string($config['dbconnection'], $user);
// Check user login
$user_in_db = process_user_login($user, $password, true);
@ -38,7 +41,7 @@ if ($headers['Authorization']) {
$result_data = [];
// Decode target data sent by datasource plugin in Grafana
$target_data = json_decode($target['target'], true);
$target_data = $target['target'];
if ($target_data['module']) {
// Get module name as target if not defined in Grafana.

View File

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

Some files were not shown because too many files have changed in this diff Show More