resolved conflict

This commit is contained in:
Daniel Maya 2023-01-18 11:31:26 +01:00
commit 04e039c515
835 changed files with 151665 additions and 51087 deletions

View File

@ -24,7 +24,7 @@ cd $CODEHOME && tar zcvf $RPMHOME/SOURCES/pandorafms_server-$LOCAL_VERSION.tar.g
cd $CODEHOME/pandora_agents/shellscript && tar zcvf $RPMHOME/SOURCES/pandorafms_agent-$LOCAL_VERSION.tar.gz --exclude \.exe --exclude \.svn --exclude nohup linux || exit 1 cd $CODEHOME/pandora_agents/shellscript && tar zcvf $RPMHOME/SOURCES/pandorafms_agent-$LOCAL_VERSION.tar.gz --exclude \.exe --exclude \.svn --exclude nohup linux || exit 1
# Unix agent # Unix agent
cd $CODEHOME/pandora_agents && tar zvcf $RPMHOME/SOURCES/pandorafms_agent_unix-$LOCAL_VERSION.tar.gz --exclude \.exe --exclude \.svn --exclude nohup --exclude NT4 --exclude Darwin/dmg unix || exit 1 cd $CODEHOME/pandora_agents && tar zvcf $RPMHOME/SOURCES/pandorafms_agent_linux-$LOCAL_VERSION.tar.gz --exclude \.exe --exclude \.svn --exclude nohup --exclude NT4 --exclude Darwin/dmg unix || exit 1
# Enterprise console # Enterprise console
cd $PANDHOME_ENT/pandora_console && tar zcvf $RPMHOME/SOURCES/pandorafms_console_enterprise-$LOCAL_VERSION.tar.gz --exclude \.exe --exclude \.svn enterprise/* || exit 1 cd $PANDHOME_ENT/pandora_console && tar zcvf $RPMHOME/SOURCES/pandorafms_console_enterprise-$LOCAL_VERSION.tar.gz --exclude \.exe --exclude \.svn enterprise/* || exit 1
@ -37,7 +37,7 @@ if [ "$1" == "nightly" ]; then
ln -s $RPMHOME/SOURCES/pandorafms_console-$LOCAL_VERSION.tar.gz $RPMHOME/SOURCES/pandorafms_console-$VERSION.tar.gz || exit 1 ln -s $RPMHOME/SOURCES/pandorafms_console-$LOCAL_VERSION.tar.gz $RPMHOME/SOURCES/pandorafms_console-$VERSION.tar.gz || exit 1
ln -s $RPMHOME/SOURCES/pandorafms_server-$LOCAL_VERSION.tar.gz $RPMHOME/SOURCES/pandorafms_server-$VERSION.tar.gz || exit 1 ln -s $RPMHOME/SOURCES/pandorafms_server-$LOCAL_VERSION.tar.gz $RPMHOME/SOURCES/pandorafms_server-$VERSION.tar.gz || exit 1
ln -s $RPMHOME/SOURCES/pandorafms_agent-$LOCAL_VERSION.tar.gz $RPMHOME/SOURCES/pandorafms_agent-$VERSION.tar.gz || exit 1 ln -s $RPMHOME/SOURCES/pandorafms_agent-$LOCAL_VERSION.tar.gz $RPMHOME/SOURCES/pandorafms_agent-$VERSION.tar.gz || exit 1
ln -s $RPMHOME/SOURCES/pandorafms_agent_unix-$LOCAL_VERSION.tar.gz $RPMHOME/SOURCES/pandorafms_agent_unix-$VERSION.tar.gz || exit 1 ln -s $RPMHOME/SOURCES/pandorafms_agent_linux-$LOCAL_VERSION.tar.gz $RPMHOME/SOURCES/pandorafms_agent_linux-$VERSION.tar.gz || exit 1
ln -s $RPMHOME/SOURCES/pandorafms_console_enterprise-$LOCAL_VERSION.tar.gz $RPMHOME/SOURCES/pandorafms_console_enterprise-$VERSION.tar.gz || exit 1 ln -s $RPMHOME/SOURCES/pandorafms_console_enterprise-$LOCAL_VERSION.tar.gz $RPMHOME/SOURCES/pandorafms_console_enterprise-$VERSION.tar.gz || exit 1
ln -s $RPMHOME/SOURCES/pandorafms_server_enterprise-$LOCAL_VERSION.tar.gz $RPMHOME/SOURCES/pandorafms_server_enterprise-$VERSION.tar.gz || exit 1 ln -s $RPMHOME/SOURCES/pandorafms_server_enterprise-$LOCAL_VERSION.tar.gz $RPMHOME/SOURCES/pandorafms_server_enterprise-$VERSION.tar.gz || exit 1
fi fi

View File

@ -142,7 +142,7 @@ if [[ $OS_RELEASE =~ 'rhel' ]] || [[ $OS_RELEASE =~ 'fedora' ]]; then
echo -e "${cyan}Installing agent dependencies...${reset}" ${green}OK${reset} echo -e "${cyan}Installing agent dependencies...${reset}" ${green}OK${reset}
# Insatall pandora agent # Insatall pandora agent
$package_manager_cmd install -y http://firefly.artica.es/pandorafms/latest/RHEL_CentOS/pandorafms_agent_unix-7.0NG.noarch.rpm &>> $LOGFILE $package_manager_cmd install -y http://firefly.artica.es/pandorafms/latest/RHEL_CentOS/pandorafms_agent_linux-7.0NG.noarch.rpm &>> $LOGFILE
echo -en "${cyan}Installing Pandora FMS agent...${reset}" echo -en "${cyan}Installing Pandora FMS agent...${reset}"
check_cmd_status 'Error installing Pandora FMS agent' check_cmd_status 'Error installing Pandora FMS agent'
@ -151,8 +151,8 @@ fi
if [[ $OS_RELEASE == 'debian' ]]; then if [[ $OS_RELEASE == 'debian' ]]; then
execute_cmd "apt update" 'Updating repos' execute_cmd "apt update" 'Updating repos'
execute_cmd "apt install -y perl wget curl unzip procps python3 python3-pip" 'Installing agent dependencies' execute_cmd "apt install -y perl wget curl unzip procps python3 python3-pip" 'Installing agent dependencies'
execute_cmd 'wget http://firefly.artica.es/pandorafms/latest/Debian_Ubuntu/pandorafms.agent_unix_7.0NG.deb' 'Downloading Pandora FMS agent dependencies' execute_cmd 'wget http://firefly.artica.es/pandorafms/latest/Debian_Ubuntu/pandorafms.agent_linux_7.0NG.deb' 'Downloading Pandora FMS agent dependencies'
execute_cmd 'apt install -y ./pandorafms.agent_unix_7.0NG.deb' 'Installing Pandora FMS agent' execute_cmd 'apt install -y ./pandorafms.agent_linux_7.0NG.deb' 'Installing Pandora FMS agent'
fi fi
# Configuring Agente # Configuring Agente

View File

@ -258,6 +258,7 @@ console_dependencies=" \
mod_ssl \ mod_ssl \
libzstd \ libzstd \
openldap-clients \ openldap-clients \
chromium \
http://firefly.artica.es/centos8/phantomjs-2.1.1-1.el7.x86_64.rpm" http://firefly.artica.es/centos8/phantomjs-2.1.1-1.el7.x86_64.rpm"
execute_cmd "yum install -y $console_dependencies" "Installing Pandora FMS Console dependencies" execute_cmd "yum install -y $console_dependencies" "Installing Pandora FMS Console dependencies"
@ -409,17 +410,17 @@ execute_cmd "systemctl restart mysqld" "Configuring database engine"
if [ "$PANDORA_BETA" -eq '0' ] ; then if [ "$PANDORA_BETA" -eq '0' ] ; then
[ "$PANDORA_SERVER_PACKAGE" ] || PANDORA_SERVER_PACKAGE="http://firefly.artica.es/pandorafms/latest/RHEL_CentOS/pandorafms_server-7.0NG.noarch.rpm" [ "$PANDORA_SERVER_PACKAGE" ] || PANDORA_SERVER_PACKAGE="http://firefly.artica.es/pandorafms/latest/RHEL_CentOS/pandorafms_server-7.0NG.noarch.rpm"
[ "$PANDORA_CONSOLE_PACKAGE" ] || PANDORA_CONSOLE_PACKAGE="http://firefly.artica.es/pandorafms/latest/RHEL_CentOS/pandorafms_console-7.0NG.noarch.rpm" [ "$PANDORA_CONSOLE_PACKAGE" ] || PANDORA_CONSOLE_PACKAGE="http://firefly.artica.es/pandorafms/latest/RHEL_CentOS/pandorafms_console-7.0NG.noarch.rpm"
[ "$PANDORA_AGENT_PACKAGE" ] || PANDORA_AGENT_PACKAGE="http://firefly.artica.es/pandorafms/latest/RHEL_CentOS/pandorafms_agent_unix-7.0NG.noarch.rpm" [ "$PANDORA_AGENT_PACKAGE" ] || PANDORA_AGENT_PACKAGE="http://firefly.artica.es/pandorafms/latest/RHEL_CentOS/pandorafms_agent_linux-7.0NG.noarch.rpm"
elif [ "$PANDORA_BETA" -ne '0' ] ; then elif [ "$PANDORA_BETA" -ne '0' ] ; then
[ "$PANDORA_SERVER_PACKAGE" ] || PANDORA_SERVER_PACKAGE="http://firefly.artica.es/pandora_enterprise_nightlies/pandorafms_server-latest.x86_64.rpm" [ "$PANDORA_SERVER_PACKAGE" ] || PANDORA_SERVER_PACKAGE="http://firefly.artica.es/pandora_enterprise_nightlies/pandorafms_server-latest.x86_64.rpm"
[ "$PANDORA_CONSOLE_PACKAGE" ] || PANDORA_CONSOLE_PACKAGE="https://pandorafms.com/community/community-console-rpm-beta/" [ "$PANDORA_CONSOLE_PACKAGE" ] || PANDORA_CONSOLE_PACKAGE="https://pandorafms.com/community/community-console-rpm-beta/"
[ "$PANDORA_AGENT_PACKAGE" ] || PANDORA_AGENT_PACKAGE="http://firefly.artica.es/pandorafms/latest/RHEL_CentOS/pandorafms_agent_unix-7.0NG.noarch.rpm" [ "$PANDORA_AGENT_PACKAGE" ] || PANDORA_AGENT_PACKAGE="http://firefly.artica.es/pandorafms/latest/RHEL_CentOS/pandorafms_agent_linux-7.0NG.noarch.rpm"
fi fi
# Downloading Pandora Packages # Downloading Pandora Packages
execute_cmd "curl -LSs --output pandorafms_server-7.0NG.noarch.rpm ${PANDORA_SERVER_PACKAGE}" "Downloading Pandora FMS Server community" execute_cmd "curl -LSs --output pandorafms_server-7.0NG.noarch.rpm ${PANDORA_SERVER_PACKAGE}" "Downloading Pandora FMS Server community"
execute_cmd "curl -LSs --output pandorafms_console-7.0NG.noarch.rpm ${PANDORA_CONSOLE_PACKAGE}" "Downloading Pandora FMS Console community" execute_cmd "curl -LSs --output pandorafms_console-7.0NG.noarch.rpm ${PANDORA_CONSOLE_PACKAGE}" "Downloading Pandora FMS Console community"
execute_cmd "curl -LSs --output pandorafms_agent_unix-7.0NG.noarch.rpm ${PANDORA_AGENT_PACKAGE}" "Downloading Pandora FMS Agent community" execute_cmd "curl -LSs --output pandorafms_agent_linux-7.0NG.noarch.rpm ${PANDORA_AGENT_PACKAGE}" "Downloading Pandora FMS Agent community"
# Install Pandora # Install Pandora
execute_cmd "yum install -y $HOME/pandora_deploy_tmp/pandorafms*.rpm" "installing PandoraFMS packages" execute_cmd "yum install -y $HOME/pandora_deploy_tmp/pandorafms*.rpm" "installing PandoraFMS packages"

View File

@ -312,6 +312,7 @@ console_dependencies=" \
mod_ssl \ mod_ssl \
libzstd \ libzstd \
openldap-clients \ openldap-clients \
chromium \
http://firefly.artica.es/centos8/perl-Net-Telnet-3.04-1.el8.noarch.rpm \ http://firefly.artica.es/centos8/perl-Net-Telnet-3.04-1.el8.noarch.rpm \
http://firefly.artica.es/centos7/wmic-1.4-1.el7.x86_64.rpm \ http://firefly.artica.es/centos7/wmic-1.4-1.el7.x86_64.rpm \
http://firefly.artica.es/centos8/phantomjs-2.1.1-1.el7.x86_64.rpm" http://firefly.artica.es/centos8/phantomjs-2.1.1-1.el7.x86_64.rpm"
@ -487,17 +488,17 @@ export MYSQL_PWD=$DBPASS
if [ "$PANDORA_BETA" -eq '0' ] ; then if [ "$PANDORA_BETA" -eq '0' ] ; then
[ "$PANDORA_SERVER_PACKAGE" ] || PANDORA_SERVER_PACKAGE="http://firefly.artica.es/pandorafms/latest/RHEL_CentOS/pandorafms_server-7.0NG.noarch.rpm" [ "$PANDORA_SERVER_PACKAGE" ] || PANDORA_SERVER_PACKAGE="http://firefly.artica.es/pandorafms/latest/RHEL_CentOS/pandorafms_server-7.0NG.noarch.rpm"
[ "$PANDORA_CONSOLE_PACKAGE" ] || PANDORA_CONSOLE_PACKAGE="http://firefly.artica.es/pandorafms/latest/RHEL_CentOS/pandorafms_console-7.0NG.noarch.rpm" [ "$PANDORA_CONSOLE_PACKAGE" ] || PANDORA_CONSOLE_PACKAGE="http://firefly.artica.es/pandorafms/latest/RHEL_CentOS/pandorafms_console-7.0NG.noarch.rpm"
[ "$PANDORA_AGENT_PACKAGE" ] || PANDORA_AGENT_PACKAGE="http://firefly.artica.es/pandorafms/latest/RHEL_CentOS/pandorafms_agent_unix-7.0NG.noarch.rpm" [ "$PANDORA_AGENT_PACKAGE" ] || PANDORA_AGENT_PACKAGE="http://firefly.artica.es/pandorafms/latest/RHEL_CentOS/pandorafms_agent_linux-7.0NG.noarch.rpm"
elif [ "$PANDORA_BETA" -ne '0' ] ; then elif [ "$PANDORA_BETA" -ne '0' ] ; then
[ "$PANDORA_SERVER_PACKAGE" ] || PANDORA_SERVER_PACKAGE="http://firefly.artica.es/pandora_enterprise_nightlies/pandorafms_server-latest.x86_64.rpm" [ "$PANDORA_SERVER_PACKAGE" ] || PANDORA_SERVER_PACKAGE="http://firefly.artica.es/pandora_enterprise_nightlies/pandorafms_server-latest.x86_64.rpm"
[ "$PANDORA_CONSOLE_PACKAGE" ] || PANDORA_CONSOLE_PACKAGE="https://pandorafms.com/community/community-console-rpm-beta/" [ "$PANDORA_CONSOLE_PACKAGE" ] || PANDORA_CONSOLE_PACKAGE="https://pandorafms.com/community/community-console-rpm-beta/"
[ "$PANDORA_AGENT_PACKAGE" ] || PANDORA_AGENT_PACKAGE="http://firefly.artica.es/pandorafms/latest/RHEL_CentOS/pandorafms_agent_unix-7.0NG.noarch.rpm" [ "$PANDORA_AGENT_PACKAGE" ] || PANDORA_AGENT_PACKAGE="http://firefly.artica.es/pandorafms/latest/RHEL_CentOS/pandorafms_agent_linux-7.0NG.noarch.rpm"
fi fi
# Downloading Pandora Packages # Downloading Pandora Packages
execute_cmd "curl -LSs --output pandorafms_server-7.0NG.noarch.rpm ${PANDORA_SERVER_PACKAGE}" "Downloading Pandora FMS Server community" execute_cmd "curl -LSs --output pandorafms_server-7.0NG.noarch.rpm ${PANDORA_SERVER_PACKAGE}" "Downloading Pandora FMS Server community"
execute_cmd "curl -LSs --output pandorafms_console-7.0NG.noarch.rpm ${PANDORA_CONSOLE_PACKAGE}" "Downloading Pandora FMS Console community" execute_cmd "curl -LSs --output pandorafms_console-7.0NG.noarch.rpm ${PANDORA_CONSOLE_PACKAGE}" "Downloading Pandora FMS Console community"
execute_cmd "curl -LSs --output pandorafms_agent_unix-7.0NG.noarch.rpm ${PANDORA_AGENT_PACKAGE}" "Downloading Pandora FMS Agent community" execute_cmd "curl -LSs --output pandorafms_agent_linux-7.0NG.noarch.rpm ${PANDORA_AGENT_PACKAGE}" "Downloading Pandora FMS Agent community"
# Install Pandora # Install Pandora
execute_cmd "dnf install -y $HOME/pandora_deploy_tmp/pandorafms*.rpm" "Installing Pandora FMS packages" execute_cmd "dnf install -y $HOME/pandora_deploy_tmp/pandorafms*.rpm" "Installing Pandora FMS packages"

View File

@ -18,6 +18,7 @@ WORKDIR=/opt/pandora/deploy
S_VERSION='2022052501' S_VERSION='2022052501'
LOGFILE="/tmp/pandora-deploy-community-$(date +%F).log" LOGFILE="/tmp/pandora-deploy-community-$(date +%F).log"
rm -f $LOGFILE &> /dev/null # remove last log before start
# define default variables # define default variables
[ "$TZ" ] || TZ="Europe/Madrid" [ "$TZ" ] || TZ="Europe/Madrid"
@ -271,6 +272,10 @@ echo -en "${cyan}Installing phantomjs...${reset}"
/usr/bin/phantomjs --version &>> "$LOGFILE" /usr/bin/phantomjs --version &>> "$LOGFILE"
check_cmd_status "Error Installing phanromjs" check_cmd_status "Error Installing phanromjs"
# Chrome
execute_cmd "wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb" "Downloading google chrome"
execute_cmd "apt install -y ./google-chrome-stable_current_amd64.deb" "Intalling google chrome"
execute_cmd "ln -s /usr/bin/google-chrome /usr/bin/chromium-browser" "Creating /usr/bin/chromium-browser Symlink"
# SDK VMware perl dependencies # SDK VMware perl dependencies
vmware_dependencies=" \ vmware_dependencies=" \
@ -415,11 +420,11 @@ execute_cmd "systemctl restart mysql" "Configuring and restarting database engin
if [ "$PANDORA_BETA" -eq '0' ] ; then if [ "$PANDORA_BETA" -eq '0' ] ; then
[ "$PANDORA_SERVER_PACKAGE" ] || PANDORA_SERVER_PACKAGE="http://firefly.artica.es/pandorafms/latest/Tarball/pandorafms_server-7.0NG.tar.gz" [ "$PANDORA_SERVER_PACKAGE" ] || PANDORA_SERVER_PACKAGE="http://firefly.artica.es/pandorafms/latest/Tarball/pandorafms_server-7.0NG.tar.gz"
[ "$PANDORA_CONSOLE_PACKAGE" ] || PANDORA_CONSOLE_PACKAGE="http://firefly.artica.es/pandorafms/latest/Tarball/pandorafms_console-7.0NG.tar.gz" [ "$PANDORA_CONSOLE_PACKAGE" ] || PANDORA_CONSOLE_PACKAGE="http://firefly.artica.es/pandorafms/latest/Tarball/pandorafms_console-7.0NG.tar.gz"
[ "$PANDORA_AGENT_PACKAGE" ] || PANDORA_AGENT_PACKAGE="http://firefly.artica.es/pandorafms/latest/Tarball/pandorafms_agent_unix-7.0NG.tar.gz" [ "$PANDORA_AGENT_PACKAGE" ] || PANDORA_AGENT_PACKAGE="http://firefly.artica.es/pandorafms/latest/Tarball/pandorafms_agent_linux-7.0NG.tar.gz"
elif [ "$PANDORA_BETA" -ne '0' ] ; then elif [ "$PANDORA_BETA" -ne '0' ] ; then
[ "$PANDORA_SERVER_PACKAGE" ] || PANDORA_SERVER_PACKAGE="http://firefly.artica.es/pandora_enterprise_nightlies/pandorafms_server-latest_x86_64.tar.gz" [ "$PANDORA_SERVER_PACKAGE" ] || PANDORA_SERVER_PACKAGE="http://firefly.artica.es/pandora_enterprise_nightlies/pandorafms_server-latest_x86_64.tar.gz"
[ "$PANDORA_CONSOLE_PACKAGE" ] || PANDORA_CONSOLE_PACKAGE="http://firefly.artica.es/pandora_enterprise_nightlies/pandorafms_console-latest.tar.gz" [ "$PANDORA_CONSOLE_PACKAGE" ] || PANDORA_CONSOLE_PACKAGE="http://firefly.artica.es/pandora_enterprise_nightlies/pandorafms_console-latest.tar.gz"
[ "$PANDORA_AGENT_PACKAGE" ] || PANDORA_AGENT_PACKAGE="http://firefly.artica.es/pandorafms/latest/Tarball/pandorafms_agent_unix-7.0NG.tar.gz" [ "$PANDORA_AGENT_PACKAGE" ] || PANDORA_AGENT_PACKAGE="http://firefly.artica.es/pandorafms/latest/Tarball/pandorafms_agent_linux-7.0NG.tar.gz"
fi fi
# Downloading Pandora Packages # Downloading Pandora Packages
@ -427,7 +432,7 @@ cd $WORKDIR &>> "$LOGFILE"
curl -LSs --output pandorafms_console-7.0NG.tar.gz "${PANDORA_CONSOLE_PACKAGE}" &>> "$LOGFILE" curl -LSs --output pandorafms_console-7.0NG.tar.gz "${PANDORA_CONSOLE_PACKAGE}" &>> "$LOGFILE"
curl -LSs --output pandorafms_server-7.0NG.tar.gz "${PANDORA_SERVER_PACKAGE}" &>> "$LOGFILE" curl -LSs --output pandorafms_server-7.0NG.tar.gz "${PANDORA_SERVER_PACKAGE}" &>> "$LOGFILE"
curl -LSs --output pandorafms_agent_unix-7.0NG.tar.gz "${PANDORA_AGENT_PACKAGE}" &>> "$LOGFILE" curl -LSs --output pandorafms_agent_linux-7.0NG.tar.gz "${PANDORA_AGENT_PACKAGE}" &>> "$LOGFILE"
# Install PandoraFMS Console # Install PandoraFMS Console
echo -en "${cyan}Installing PandoraFMS Console...${reset}" echo -en "${cyan}Installing PandoraFMS Console...${reset}"
@ -444,7 +449,7 @@ check_cmd_status "Error installing PandoraFMS Server"
#Install agent: #Install agent:
execute_cmd "apt install -y libyaml-tiny-perl perl coreutils wget curl unzip procps python3 python3-pip" "Installing PandoraFMS Agent Dependencies" execute_cmd "apt install -y libyaml-tiny-perl perl coreutils wget curl unzip procps python3 python3-pip" "Installing PandoraFMS Agent Dependencies"
echo -en "${cyan}Installing PandoraFMS Agent...${reset}" echo -en "${cyan}Installing PandoraFMS Agent...${reset}"
tar xvzf $WORKDIR/pandorafms_agent_unix-7.0NG.tar.gz &>> "$LOGFILE" && cd unix && ./pandora_agent_installer --install &>> $LOGFILE && cp -a tentacle_client /usr/local/bin/ &>> $LOGFILE && cd $WORKDIR tar xvzf $WORKDIR/pandorafms_agent_linux-7.0NG.tar.gz &>> "$LOGFILE" && cd unix && ./pandora_agent_installer --install &>> $LOGFILE && cp -a tentacle_client /usr/local/bin/ &>> $LOGFILE && cd $WORKDIR
check_cmd_status "Error installing PandoraFMS Agent" check_cmd_status "Error installing PandoraFMS Agent"
# Copy gotty utility # Copy gotty utility

View File

@ -262,13 +262,11 @@ RUN dnf install -y --setopt=tsflags=nodocs \
http://firefly.artica.es/centos7/wmic-1.4-1.el7.x86_64.rpm http://firefly.artica.es/centos7/wmic-1.4-1.el7.x86_64.rpm
# Install utils # Install utils
RUN dnf install -y supervisor crontabs http://firefly.artica.es/centos8/phantomjs-2.1.1-1.el7.x86_64.rpm --setopt=tsflags=nodocs RUN dnf install -y supervisor chromium crontabs http://firefly.artica.es/centos8/phantomjs-2.1.1-1.el7.x86_64.rpm --setopt=tsflags=nodocs
# SDK VMware perl dependencies # SDK VMware perl dependencies
RUN dnf install -y http://firefly.artica.es/centos8/perl-Crypt-OpenSSL-AES-0.02-1.el8.x86_64.rpm http://firefly.artica.es/centos8/perl-Crypt-SSLeay-0.73_07-1.gf.el8.x86_64.rpm perl-Net-HTTP perl-libwww-perl openssl-devel perl-Crypt-CBC perl-Bytes-Random-Secure perl-Crypt-Random-Seed perl-Math-Random-ISAAC perl-JSON http://firefly.artica.es/centos8/VMware-vSphere-Perl-SDK-6.5.0-4566394.x86_64.rpm RUN dnf install -y http://firefly.artica.es/centos8/perl-Crypt-OpenSSL-AES-0.02-1.el8.x86_64.rpm http://firefly.artica.es/centos8/perl-Crypt-SSLeay-0.73_07-1.gf.el8.x86_64.rpm perl-Net-HTTP perl-libwww-perl openssl-devel perl-Crypt-CBC perl-Bytes-Random-Secure perl-Crypt-Random-Seed perl-Math-Random-ISAAC perl-JSON http://firefly.artica.es/centos8/VMware-vSphere-Perl-SDK-6.5.0-4566394.x86_64.rpm
# Instant client Oracle # Instant client Oracle
RUN dnf install -y https://download.oracle.com/otn_software/linux/instantclient/19800/oracle-instantclient19.8-basic-19.8.0.0.0-1.x86_64.rpm https://download.oracle.com/otn_software/linux/instantclient/19800/oracle-instantclient19.8-sqlplus-19.8.0.0.0-1.x86_64.rpm RUN dnf install -y https://download.oracle.com/otn_software/linux/instantclient/19800/oracle-instantclient19.8-basic-19.8.0.0.0-1.x86_64.rpm https://download.oracle.com/otn_software/linux/instantclient/19800/oracle-instantclient19.8-sqlplus-19.8.0.0.0-1.x86_64.rpm
# Install Phantom
RUN dnf install -y supervisor crontabs http://firefly.artica.es/centos8/phantomjs-2.1.1-1.el7.x86_64.rpm --setopt=tsflags=nodocs
EXPOSE 80 443 41121 162/udp EXPOSE 80 443 41121 162/udp

View File

@ -4,9 +4,9 @@ Release: 140223.sp3%{?dist}
Summary: Host/service/network agent for Pandora FMS monitoring system Summary: Host/service/network agent for Pandora FMS monitoring system
License: GPLv2 License: GPLv2
Vendor: Artica <http://www.artica.es> Vendor: Artica <http://www.artica.es>
Source: http://code.pandorafms.com/static_download/pandorafms_agent_unix-5.0SP3.tar.gz Source: http://code.pandorafms.com/static_download/pandorafms_agent_linux-5.0SP3.tar.gz
#Source: %{name}-%{version}.tar.gz #Source: %{name}-%{version}.tar.gz
#Source0: http://code.pandorafms.com/static_download/pandorafms_agent_unix-5.0SP3.tar.gz #Source0: http://code.pandorafms.com/static_download/pandorafms_agent_linux-5.0SP3.tar.gz
URL: http://pandorafms.com URL: http://pandorafms.com
Group: Applications/System Group: Applications/System
#Prefix: /usr/share #Prefix: /usr/share

View File

@ -114,7 +114,7 @@ echo "END"
echo "Make the package \"Pandorafms console\"." echo "Make the package \"Pandorafms console\"."
dpkg-deb --build temp_package dpkg-deb --build temp_package
mv temp_package.deb pandorafms.agent_unix_$pandora_version.deb mv temp_package.deb pandorafms.agent_linux_$pandora_version.deb
echo "Delete the \"temp_package\" temp dir for job." echo "Delete the \"temp_package\" temp dir for job."
rm -rf temp_package rm -rf temp_package

View File

@ -207,6 +207,6 @@ module_end
module_plugin grep_log /var/log/auth.log Syslog sshd module_plugin grep_log /var/log/auth.log Syslog sshd
# Plugin for inventory on the agent (Only Enterprise) # Plugin for inventory on the agent.
# module_plugin inventory 1 cpu ram video nic hd cdrom software # module_plugin inventory 1 cpu ram video nic hd cdrom software

View File

@ -269,7 +269,7 @@ module_plugin grep_log /var/log/syslog Syslog ssh
#module_description Used memory in KB postprocessed to be in MB #module_description Used memory in KB postprocessed to be in MB
#module_end #module_end
# Plugin for inventory on the agent (Only Enterprise) # Plugin for inventory on the agent.
# module_plugin inventory 1 cpu ram video nic hd cdrom software init_services filesystem users process ip route # module_plugin inventory 1 cpu ram video nic hd cdrom software init_services filesystem users process ip route

View File

@ -31,14 +31,14 @@ Install procedure
Step 1 - Get the latest package and copy to /tmp, you can get the latest package at: Step 1 - Get the latest package and copy to /tmp, you can get the latest package at:
http://sourceforge.net/projects/pandora/files/Pandora%20FMS%203.2/Stable%20release/Unix%20%28Tarball%29/pandorafms_agent_unix-3.2.tar.gz/download http://sourceforge.net/projects/pandora/files/Pandora%20FMS%203.2/Stable%20release/Unix%20%28Tarball%29/pandorafms_agent_linux-3.2.tar.gz/download
Note: You will get a special version of the launcher, you can get it from our SVN repository and replace the perl daemon launcher with this special version for OpenWRT. Just replace it after do the package install for the Unix/Perl generic agent. Note: You will get a special version of the launcher, you can get it from our SVN repository and replace the perl daemon launcher with this special version for OpenWRT. Just replace it after do the package install for the Unix/Perl generic agent.
Step 2 - Install it Step 2 - Install it
cd /tmp cd /tmp
tar xvzf pandorafms_agent_unix-3.2.tar.gz tar xvzf pandorafms_agent_linux-3.2.tar.gz
cd unix cd unix
./pandora_agent --install ./pandora_agent --install

View File

@ -1,7 +1,7 @@
# #
#Pandora FMS Linux Agent #Pandora FMS Linux Agent
# #
%define name pandorafms_agent_unix %define name pandorafms_agent_linux
%define version 4.0 %define version 4.0
%define release 1 %define release 1

View File

@ -1,7 +1,7 @@
# #
#Pandora FMS Linux Agent #Pandora FMS Linux Agent
# #
%define name pandorafms_agent_unix %define name pandorafms_agent_linux
%define version 4.0.1 %define version 4.0.1
%define release 1 %define release 1

View File

@ -164,5 +164,5 @@ module_end
module_plugin grep_log /var/log/syslog Syslog ssh module_plugin grep_log /var/log/syslog Syslog ssh
# Plugin for inventory on the agent (Only Enterprise) # Plugin for inventory on the agent.
# module_plugin inventory 1 cpu ram video nic hd cdrom software # module_plugin inventory 1 cpu ram video nic hd cdrom software

View File

@ -379,6 +379,6 @@ module_end
#module_plugin grep_log /var/log/syslog Syslog ssh #module_plugin grep_log /var/log/syslog Syslog ssh
# Plugin for inventory on the agent (Only Enterprise) # Plugin for inventory on the agent.
# module_plugin inventory 1 cpu ram video nic hd cdrom software # module_plugin inventory 1 cpu ram video nic hd cdrom software

View File

@ -1,5 +1,5 @@
package: pandorafms-agent-unix package: pandorafms-agent-unix
Version: 7.0NG.767-221207 Version: 7.0NG.767-230118
Architecture: all Architecture: all
Priority: optional Priority: optional
Section: admin Section: admin

View File

@ -14,7 +14,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details. # GNU General Public License for more details.
pandora_version="7.0NG.767-221207" pandora_version="7.0NG.767-230118"
echo "Test if you has the tools for to make the packages." echo "Test if you has the tools for to make the packages."
whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null
@ -61,7 +61,7 @@ chmod 755 -R temp_package/DEBIAN
#cp -aRf * temp_package/usr/share/pandora_agent/ #cp -aRf * temp_package/usr/share/pandora_agent/
#but don't copy recursive the temp_package into temp_package #but don't copy recursive the temp_package into temp_package
for item in `ls | grep -v NT4 | grep -v AIX | grep -v FreeBSD | grep -v NetBSD | grep -v HP-UX | grep -v SunOS | grep -v Darwin | grep -v OpenWRT | grep -v pandorafms.agent_unix | grep -v temp_package` for item in `ls | grep -v NT4 | grep -v AIX | grep -v FreeBSD | grep -v NetBSD | grep -v HP-UX | grep -v SunOS | grep -v Darwin | grep -v OpenWRT | grep -v pandorafms.agent_linux | grep -v temp_package`
do do
#if [ \( $item != 'temp_package' \) -a \( $item != 'NT4' \) ] #if [ \( $item != 'temp_package' \) -a \( $item != 'NT4' \) ]
#then #then
@ -137,7 +137,7 @@ if [ "$USE_DOCKER_APP" == "1" ]; then
else else
dpkg-deb --root-owner-group --build temp_package dpkg-deb --root-owner-group --build temp_package
fi fi
mv temp_package.deb pandorafms.agent_unix_$pandora_version.deb mv temp_package.deb pandorafms.agent_linux_$pandora_version.deb
echo "Delete the \"temp_package\" temp dir for job." echo "Delete the \"temp_package\" temp dir for job."
rm -rf temp_package rm -rf temp_package

View File

@ -272,7 +272,7 @@ module_plugin pandora_df_free
module_plugin grep_log /var/log/auth.log Syslog sshd module_plugin grep_log /var/log/auth.log Syslog sshd
# Plugin for inventory on the agent (Only Enterprise) # Plugin for inventory on the agent.
# module_plugin inventory 1 cpu ram video nic hd cdrom software init_services filesystem users route # module_plugin inventory 1 cpu ram video nic hd cdrom software init_services filesystem users route
# Log collection modules. Only for enterprise version, this will collect log files for forensic analysis. # Log collection modules. Only for enterprise version, this will collect log files for forensic analysis.

View File

@ -269,7 +269,7 @@ module_plugin pandora_netusage
# Service autodiscovery plugin # Service autodiscovery plugin
module_plugin autodiscover --default module_plugin autodiscover --default
# Plugin for inventory on the agent (Only Enterprise) # Plugin for inventory on the agent.
#module_plugin inventory 1 cpu ram video nic hd cdrom software init_services filesystem users route #module_plugin inventory 1 cpu ram video nic hd cdrom software init_services filesystem users route
# Log collection modules. Only for enterprise version, this will collect log files for forensic analysis. # Log collection modules. Only for enterprise version, this will collect log files for forensic analysis.

View File

@ -232,6 +232,6 @@ module_end
module_plugin grep_log /var/log/auth.log Syslog sshd module_plugin grep_log /var/log/auth.log Syslog sshd
# Plugin for inventory on the agent (Only Enterprise) # Plugin for inventory on the agent.
# module_plugin inventory 1 cpu ram video nic hd cdrom software # module_plugin inventory 1 cpu ram video nic hd cdrom software

View File

@ -31,14 +31,14 @@ Install procedure
Step 1 - Get the latest package and copy to /tmp, you can get the latest package at: Step 1 - Get the latest package and copy to /tmp, you can get the latest package at:
http://sourceforge.net/projects/pandora/files/Pandora%20FMS%203.2/Stable%20release/Unix%20%28Tarball%29/pandorafms_agent_unix-3.2.tar.gz/download http://sourceforge.net/projects/pandora/files/Pandora%20FMS%203.2/Stable%20release/Unix%20%28Tarball%29/pandorafms_agent_linux-3.2.tar.gz/download
Note: You will get a special version of the launcher, you can get it from our SVN repository and replace the perl daemon launcher with this special version for OpenWRT. Just replace it after do the package install for the Unix/Perl generic agent. Note: You will get a special version of the launcher, you can get it from our SVN repository and replace the perl daemon launcher with this special version for OpenWRT. Just replace it after do the package install for the Unix/Perl generic agent.
Step 2 - Install it Step 2 - Install it
cd /tmp cd /tmp
tar xvzf pandorafms_agent_unix-3.2.tar.gz tar xvzf pandorafms_agent_linux-3.2.tar.gz
cd unix cd unix
./pandora_agent --install ./pandora_agent --install

View File

@ -1015,7 +1015,7 @@ my $Sem = undef;
my $ThreadSem = undef; my $ThreadSem = undef;
use constant AGENT_VERSION => '7.0NG.767'; use constant AGENT_VERSION => '7.0NG.767';
use constant AGENT_BUILD => '221207'; use constant AGENT_BUILD => '230118';
# Agent log default file size maximum and instances # Agent log default file size maximum and instances
use constant DEFAULT_MAX_LOG_SIZE => 600000; use constant DEFAULT_MAX_LOG_SIZE => 600000;
@ -2403,6 +2403,11 @@ sub check_collections () {
if (open (MD5_FILE, "< $ConfDir/collections/$collection_md5_file")) { if (open (MD5_FILE, "< $ConfDir/collections/$collection_md5_file")) {
$local_collection_md5 = <MD5_FILE>; $local_collection_md5 = <MD5_FILE>;
close MD5_FILE; close MD5_FILE;
if ( ! defined ($local_collection_md5) ) {
log_message ('Collection', "Size of $ConfDir/collections/$collection_md5_file is 0");
unlink ("$ConfDir/collections/$collection_md5_file");
$local_collection_md5 = "Size 0";
}
} else { } else {
log_message ('Collection', "Could not open dir $ConfDir/collections/$collection_md5_file"); log_message ('Collection', "Could not open dir $ConfDir/collections/$collection_md5_file");
next; next;

View File

@ -1,9 +1,9 @@
# #
#Pandora FMS Linux Agent #Pandora FMS Linux Agent
# #
%define name pandorafms_agent_unix %define name pandorafms_agent_linux
%define version 7.0NG.767 %define version 7.0NG.767
%define release 221207 %define release 230118
Summary: Pandora FMS Linux agent, PERL version Summary: Pandora FMS Linux agent, PERL version
Name: %{name} Name: %{name}

View File

@ -1,9 +1,9 @@
# #
#Pandora FMS Linux Agent #Pandora FMS Linux Agent
# #
%define name pandorafms_agent_unix %define name pandorafms_agent_linux
%define version 7.0NG.767 %define version 7.0NG.767
%define release 221207 %define release 230118
Summary: Pandora FMS Linux agent, PERL version Summary: Pandora FMS Linux agent, PERL version
Name: %{name} Name: %{name}

View File

@ -10,7 +10,7 @@
# ********************************************************************** # **********************************************************************
PI_VERSION="7.0NG.767" PI_VERSION="7.0NG.767"
PI_BUILD="221207" PI_BUILD="230118"
OS_NAME=`uname -s` OS_NAME=`uname -s`
FORCE=0 FORCE=0

View File

@ -186,7 +186,7 @@ UpgradeApplicationID
{} {}
Version Version
{221207} {230118}
ViewReadme ViewReadme
{Yes} {Yes}

View File

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

View File

@ -11,7 +11,7 @@ BEGIN
VALUE "LegalCopyright", "Artica ST" VALUE "LegalCopyright", "Artica ST"
VALUE "OriginalFilename", "PandoraAgent.exe" VALUE "OriginalFilename", "PandoraAgent.exe"
VALUE "ProductName", "Pandora FMS Windows Agent" VALUE "ProductName", "Pandora FMS Windows Agent"
VALUE "ProductVersion", "(7.0NG.767(Build 221207))" VALUE "ProductVersion", "(7.0NG.767(Build 230118))"
VALUE "FileVersion", "1.0.0.0" VALUE "FileVersion", "1.0.0.0"
END END
END END

View File

@ -1,5 +1,5 @@
package: pandorafms-console package: pandorafms-console
Version: 7.0NG.767-221207 Version: 7.0NG.767-230118
Architecture: all Architecture: all
Priority: optional Priority: optional
Section: admin Section: admin

View File

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

View File

@ -1 +0,0 @@

View File

@ -9,13 +9,24 @@
], ],
"config": { "config": {
"platform": { "platform": {
"php": "7.2.0" "php": "8.0.0"
} }
}, },
"require": { "require": {
"mpdf/mpdf": "^8.0.15", "mpdf/mpdf": "^8.0.15",
"swiftmailer/swiftmailer": "^6.0", "swiftmailer/swiftmailer": "^6.0",
"amphp/parallel-functions": "^1.0" "amphp/parallel-functions": "^1.0",
"chrome-php/chrome": "^1.7.1",
"artica/phpchartjs": "^1.0"
},
"repositories": {
"phpchartjs": {
"type": "path",
"url": "../../../phpchartjs",
"options": {
"symlink": false
}
}
}, },
"autoload": { "autoload": {
"psr-4": { "psr-4": {

View File

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "643ac0dc8a8e1f129104399054f8dd0c", "content-hash": "be2ad3d9d4df55d7ccb87981e82c4932",
"packages": [ "packages": [
{ {
"name": "amphp/amp", "name": "amphp/amp",
@ -549,6 +549,205 @@
], ],
"time": "2021-10-25T18:29:10+00:00" "time": "2021-10-25T18:29:10+00:00"
}, },
{
"name": "artica/phpchartjs",
"version": "v1.0.2",
"dist": {
"type": "path",
"url": "../../../phpchartjs",
"reference": "4957e7cd699e50cee8e0ba7304e1423aafb2cad2"
},
"require": {
"ext-dom": "*",
"ext-json": "*",
"halfpastfouram/collection": "1.0.0",
"laminas/laminas-json": ">3.1.2",
"php": ">=7.2",
"symfony/var-dumper": "^3.4"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "*",
"phpunit/phpunit": "^9.5",
"sensiolabs/security-checker": "^5.0",
"squizlabs/php_codesniffer": "3.5.3"
},
"type": "package",
"autoload": {
"psr-4": {
"Artica\\PHPChartJS\\": "src/",
"Test\\": "test/"
}
},
"scripts": {
"test": [
"./vendor/bin/phpunit"
],
"cs-check": [
"./vendor/bin/phpcs"
],
"cs-fix": [
"./vendor/bin/phpcbf"
]
},
"license": [
"AGPL-3.0-or-later"
],
"authors": [
{
"name": "Bob Kruithof"
},
{
"name": "Daniel Barbero"
}
],
"description": "PHP library for ChartJS",
"homepage": "https://artica.es/",
"keywords": [
"chartjs",
"graph",
"php"
],
"transport-options": {
"symlink": false,
"relative": true
}
},
{
"name": "chrome-php/chrome",
"version": "v1.7.1",
"source": {
"type": "git",
"url": "https://github.com/chrome-php/chrome.git",
"reference": "5783c749b2ee385d1c481b0906f1b8acef0296e4"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/chrome-php/chrome/zipball/5783c749b2ee385d1c481b0906f1b8acef0296e4",
"reference": "5783c749b2ee385d1c481b0906f1b8acef0296e4",
"shasum": ""
},
"require": {
"chrome-php/wrench": "^1.3",
"evenement/evenement": "^3.0.1",
"monolog/monolog": "^1.27.1 || ^2.8 || ^3.2",
"php": "^7.3 || ^8.0",
"psr/log": "^1.1 || ^2.0 || ^3.0",
"symfony/filesystem": "^4.4 || ^5.0 || ^6.0",
"symfony/polyfill-mbstring": "^1.26",
"symfony/process": "^4.4 || ^5.0 || ^6.0"
},
"require-dev": {
"bamarni/composer-bin-plugin": "^1.8.1",
"phpunit/phpunit": "^9.5.23",
"symfony/var-dumper": "^4.4 || ^5.0 || ^6.0"
},
"type": "library",
"extra": {
"bamarni-bin": {
"bin-links": true,
"forward-command": false
}
},
"autoload": {
"psr-4": {
"HeadlessChromium\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Graham Campbell",
"email": "hello@gjcampbell.co.uk",
"homepage": "https://github.com/GrahamCampbell"
},
{
"name": "Enrico Dias",
"email": "enrico@enricodias.com",
"homepage": "https://github.com/enricodias"
}
],
"description": "Instrument headless chrome/chromium instances from PHP",
"keywords": [
"browser",
"chrome",
"chromium",
"crawl",
"headless",
"pdf",
"puppeteer",
"screenshot"
],
"support": {
"issues": "https://github.com/chrome-php/chrome/issues",
"source": "https://github.com/chrome-php/chrome/tree/v1.7.1"
},
"time": "2022-09-04T21:11:00+00:00"
},
{
"name": "chrome-php/wrench",
"version": "v1.3.0",
"source": {
"type": "git",
"url": "https://github.com/chrome-php/wrench.git",
"reference": "68b8282d5d0d54a519c3212ee3e4c35bef40b7d9"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/chrome-php/wrench/zipball/68b8282d5d0d54a519c3212ee3e4c35bef40b7d9",
"reference": "68b8282d5d0d54a519c3212ee3e4c35bef40b7d9",
"shasum": ""
},
"require": {
"ext-sockets": "*",
"php": "^7.3 || ^8.0",
"psr/log": "^1.1 || ^2.0 || ^3.0",
"symfony/polyfill-php80": "^1.26"
},
"conflict": {
"wrench/wrench": "*"
},
"require-dev": {
"bamarni/composer-bin-plugin": "^1.8.1",
"phpunit/phpunit": "^9.5.23"
},
"type": "library",
"extra": {
"bamarni-bin": {
"bin-links": true,
"forward-command": false
}
},
"autoload": {
"psr-4": {
"Wrench\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Graham Campbell",
"email": "hello@gjcampbell.co.uk",
"homepage": "https://github.com/GrahamCampbell"
}
],
"description": "A simple PHP WebSocket implementation",
"keywords": [
"WebSockets",
"hybi",
"websocket"
],
"support": {
"issues": "https://github.com/chrome-php/wrench/issues",
"source": "https://github.com/chrome-php/wrench/tree/v1.3.0"
},
"time": "2022-08-28T11:42:16+00:00"
},
{ {
"name": "doctrine/lexer", "name": "doctrine/lexer",
"version": "1.2.2", "version": "1.2.2",
@ -693,6 +892,265 @@
], ],
"time": "2021-10-11T09:18:27+00:00" "time": "2021-10-11T09:18:27+00:00"
}, },
{
"name": "evenement/evenement",
"version": "v3.0.1",
"source": {
"type": "git",
"url": "https://github.com/igorw/evenement.git",
"reference": "531bfb9d15f8aa57454f5f0285b18bec903b8fb7"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/igorw/evenement/zipball/531bfb9d15f8aa57454f5f0285b18bec903b8fb7",
"reference": "531bfb9d15f8aa57454f5f0285b18bec903b8fb7",
"shasum": ""
},
"require": {
"php": ">=7.0"
},
"require-dev": {
"phpunit/phpunit": "^6.0"
},
"type": "library",
"autoload": {
"psr-0": {
"Evenement": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Igor Wiedler",
"email": "igor@wiedler.ch"
}
],
"description": "Événement is a very simple event dispatching library for PHP",
"keywords": [
"event-dispatcher",
"event-emitter"
],
"support": {
"issues": "https://github.com/igorw/evenement/issues",
"source": "https://github.com/igorw/evenement/tree/master"
},
"time": "2017-07-23T21:35:13+00:00"
},
{
"name": "halfpastfouram/collection",
"version": "v1.0.0",
"source": {
"type": "git",
"url": "https://github.com/halfpastfouram/collection.git",
"reference": "0862d0b431fef9dc2245518dc06b86ff00dcd102"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/halfpastfouram/collection/zipball/0862d0b431fef9dc2245518dc06b86ff00dcd102",
"reference": "0862d0b431fef9dc2245518dc06b86ff00dcd102",
"shasum": ""
},
"require": {
"php": ">=5.6.0 || ^7.0"
},
"require-dev": {
"codeclimate/php-test-reporter": "dev-master",
"phpunit/phpunit": "5.2.*"
},
"type": "package",
"autoload": {
"psr-4": {
"Test\\": "test/",
"Halfpastfour\\Collection\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"AGPL 3.0"
],
"authors": [
{
"name": "Bob Kruithof"
}
],
"description": "A flexible PHP Collection complete with custom Iterator.",
"homepage": "http://github.com/halfpastfouram/collection",
"keywords": [
"collection",
"php"
],
"support": {
"issues": "https://github.com/halfpastfouram/collection/issues",
"source": "https://github.com/halfpastfouram/collection/tree/master"
},
"time": "2016-12-18T13:04:48+00:00"
},
{
"name": "laminas/laminas-json",
"version": "3.5.0",
"source": {
"type": "git",
"url": "https://github.com/laminas/laminas-json.git",
"reference": "7a8a1d7bf2d05dd6c1fbd7c0868d3848cf2b57ec"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/laminas/laminas-json/zipball/7a8a1d7bf2d05dd6c1fbd7c0868d3848cf2b57ec",
"reference": "7a8a1d7bf2d05dd6c1fbd7c0868d3848cf2b57ec",
"shasum": ""
},
"require": {
"php": "~8.0.0 || ~8.1.0 || ~8.2.0"
},
"conflict": {
"zendframework/zend-json": "*"
},
"require-dev": {
"laminas/laminas-coding-standard": "~2.4.0",
"laminas/laminas-stdlib": "^2.7.7 || ^3.1",
"phpunit/phpunit": "^9.5.25"
},
"suggest": {
"laminas/laminas-json-server": "For implementing JSON-RPC servers",
"laminas/laminas-xml2json": "For converting XML documents to JSON"
},
"type": "library",
"autoload": {
"psr-4": {
"Laminas\\Json\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"description": "provides convenience methods for serializing native PHP to JSON and decoding JSON to native PHP",
"homepage": "https://laminas.dev",
"keywords": [
"json",
"laminas"
],
"support": {
"chat": "https://laminas.dev/chat",
"docs": "https://docs.laminas.dev/laminas-json/",
"forum": "https://discourse.laminas.dev",
"issues": "https://github.com/laminas/laminas-json/issues",
"rss": "https://github.com/laminas/laminas-json/releases.atom",
"source": "https://github.com/laminas/laminas-json"
},
"funding": [
{
"url": "https://funding.communitybridge.org/projects/laminas-project",
"type": "community_bridge"
}
],
"time": "2022-10-17T04:06:45+00:00"
},
{
"name": "monolog/monolog",
"version": "2.8.0",
"source": {
"type": "git",
"url": "https://github.com/Seldaek/monolog.git",
"reference": "720488632c590286b88b80e62aa3d3d551ad4a50"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/Seldaek/monolog/zipball/720488632c590286b88b80e62aa3d3d551ad4a50",
"reference": "720488632c590286b88b80e62aa3d3d551ad4a50",
"shasum": ""
},
"require": {
"php": ">=7.2",
"psr/log": "^1.0.1 || ^2.0 || ^3.0"
},
"provide": {
"psr/log-implementation": "1.0.0 || 2.0.0 || 3.0.0"
},
"require-dev": {
"aws/aws-sdk-php": "^2.4.9 || ^3.0",
"doctrine/couchdb": "~1.0@dev",
"elasticsearch/elasticsearch": "^7 || ^8",
"ext-json": "*",
"graylog2/gelf-php": "^1.4.2",
"guzzlehttp/guzzle": "^7.4",
"guzzlehttp/psr7": "^2.2",
"mongodb/mongodb": "^1.8",
"php-amqplib/php-amqplib": "~2.4 || ^3",
"phpspec/prophecy": "^1.15",
"phpstan/phpstan": "^0.12.91",
"phpunit/phpunit": "^8.5.14",
"predis/predis": "^1.1 || ^2.0",
"rollbar/rollbar": "^1.3 || ^2 || ^3",
"ruflin/elastica": "^7",
"swiftmailer/swiftmailer": "^5.3|^6.0",
"symfony/mailer": "^5.4 || ^6",
"symfony/mime": "^5.4 || ^6"
},
"suggest": {
"aws/aws-sdk-php": "Allow sending log messages to AWS services like DynamoDB",
"doctrine/couchdb": "Allow sending log messages to a CouchDB server",
"elasticsearch/elasticsearch": "Allow sending log messages to an Elasticsearch server via official client",
"ext-amqp": "Allow sending log messages to an AMQP server (1.0+ required)",
"ext-curl": "Required to send log messages using the IFTTTHandler, the LogglyHandler, the SendGridHandler, the SlackWebhookHandler or the TelegramBotHandler",
"ext-mbstring": "Allow to work properly with unicode symbols",
"ext-mongodb": "Allow sending log messages to a MongoDB server (via driver)",
"ext-openssl": "Required to send log messages using SSL",
"ext-sockets": "Allow sending log messages to a Syslog server (via UDP driver)",
"graylog2/gelf-php": "Allow sending log messages to a GrayLog2 server",
"mongodb/mongodb": "Allow sending log messages to a MongoDB server (via library)",
"php-amqplib/php-amqplib": "Allow sending log messages to an AMQP server using php-amqplib",
"rollbar/rollbar": "Allow sending log messages to Rollbar",
"ruflin/elastica": "Allow sending log messages to an Elastic Search server"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-main": "2.x-dev"
}
},
"autoload": {
"psr-4": {
"Monolog\\": "src/Monolog"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Jordi Boggiano",
"email": "j.boggiano@seld.be",
"homepage": "https://seld.be"
}
],
"description": "Sends your logs to files, sockets, inboxes, databases and various web services",
"homepage": "https://github.com/Seldaek/monolog",
"keywords": [
"log",
"logging",
"psr-3"
],
"support": {
"issues": "https://github.com/Seldaek/monolog/issues",
"source": "https://github.com/Seldaek/monolog/tree/2.8.0"
},
"funding": [
{
"url": "https://github.com/Seldaek",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/monolog/monolog",
"type": "tidelift"
}
],
"time": "2022-07-24T11:55:47+00:00"
},
{ {
"name": "mpdf/mpdf", "name": "mpdf/mpdf",
"version": "v8.0.15", "version": "v8.0.15",
@ -940,30 +1398,30 @@
}, },
{ {
"name": "psr/log", "name": "psr/log",
"version": "1.1.4", "version": "2.0.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/php-fig/log.git", "url": "https://github.com/php-fig/log.git",
"reference": "d49695b909c3b7628b6289db5479a1c204601f11" "reference": "ef29f6d262798707a9edd554e2b82517ef3a9376"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/php-fig/log/zipball/d49695b909c3b7628b6289db5479a1c204601f11", "url": "https://api.github.com/repos/php-fig/log/zipball/ef29f6d262798707a9edd554e2b82517ef3a9376",
"reference": "d49695b909c3b7628b6289db5479a1c204601f11", "reference": "ef29f6d262798707a9edd554e2b82517ef3a9376",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"php": ">=5.3.0" "php": ">=8.0.0"
}, },
"type": "library", "type": "library",
"extra": { "extra": {
"branch-alias": { "branch-alias": {
"dev-master": "1.1.x-dev" "dev-master": "2.0.x-dev"
} }
}, },
"autoload": { "autoload": {
"psr-4": { "psr-4": {
"Psr\\Log\\": "Psr/Log/" "Psr\\Log\\": "src"
} }
}, },
"notification-url": "https://packagist.org/downloads/", "notification-url": "https://packagist.org/downloads/",
@ -984,9 +1442,9 @@
"psr-3" "psr-3"
], ],
"support": { "support": {
"source": "https://github.com/php-fig/log/tree/1.1.4" "source": "https://github.com/php-fig/log/tree/2.0.0"
}, },
"time": "2021-05-03T11:20:27+00:00" "time": "2021-07-14T16:41:46+00:00"
}, },
{ {
"name": "setasign/fpdi", "name": "setasign/fpdi",
@ -1136,6 +1594,152 @@
"abandoned": "symfony/mailer", "abandoned": "symfony/mailer",
"time": "2021-10-18T15:26:12+00:00" "time": "2021-10-18T15:26:12+00:00"
}, },
{
"name": "symfony/filesystem",
"version": "v5.4.13",
"source": {
"type": "git",
"url": "https://github.com/symfony/filesystem.git",
"reference": "ac09569844a9109a5966b9438fc29113ce77cf51"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/filesystem/zipball/ac09569844a9109a5966b9438fc29113ce77cf51",
"reference": "ac09569844a9109a5966b9438fc29113ce77cf51",
"shasum": ""
},
"require": {
"php": ">=7.2.5",
"symfony/polyfill-ctype": "~1.8",
"symfony/polyfill-mbstring": "~1.8",
"symfony/polyfill-php80": "^1.16"
},
"type": "library",
"autoload": {
"psr-4": {
"Symfony\\Component\\Filesystem\\": ""
},
"exclude-from-classmap": [
"/Tests/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Provides basic utilities for the filesystem",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/filesystem/tree/v5.4.13"
},
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2022-09-21T19:53:16+00:00"
},
{
"name": "symfony/polyfill-ctype",
"version": "v1.27.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-ctype.git",
"reference": "5bbc823adecdae860bb64756d639ecfec17b050a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/5bbc823adecdae860bb64756d639ecfec17b050a",
"reference": "5bbc823adecdae860bb64756d639ecfec17b050a",
"shasum": ""
},
"require": {
"php": ">=7.1"
},
"provide": {
"ext-ctype": "*"
},
"suggest": {
"ext-ctype": "For best performance"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-main": "1.27-dev"
},
"thanks": {
"name": "symfony/polyfill",
"url": "https://github.com/symfony/polyfill"
}
},
"autoload": {
"files": [
"bootstrap.php"
],
"psr-4": {
"Symfony\\Polyfill\\Ctype\\": ""
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Gert de Pagter",
"email": "BackEndTea@gmail.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony polyfill for ctype functions",
"homepage": "https://symfony.com",
"keywords": [
"compatibility",
"ctype",
"polyfill",
"portable"
],
"support": {
"source": "https://github.com/symfony/polyfill-ctype/tree/v1.27.0"
},
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2022-11-03T14:55:06+00:00"
},
{ {
"name": "symfony/polyfill-iconv", "name": "symfony/polyfill-iconv",
"version": "v1.24.0", "version": "v1.24.0",
@ -1392,16 +1996,16 @@
}, },
{ {
"name": "symfony/polyfill-mbstring", "name": "symfony/polyfill-mbstring",
"version": "v1.24.0", "version": "v1.27.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/polyfill-mbstring.git", "url": "https://github.com/symfony/polyfill-mbstring.git",
"reference": "0abb51d2f102e00a4eefcf46ba7fec406d245825" "reference": "8ad114f6b39e2c98a8b0e3bd907732c207c2b534"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/0abb51d2f102e00a4eefcf46ba7fec406d245825", "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/8ad114f6b39e2c98a8b0e3bd907732c207c2b534",
"reference": "0abb51d2f102e00a4eefcf46ba7fec406d245825", "reference": "8ad114f6b39e2c98a8b0e3bd907732c207c2b534",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -1416,7 +2020,7 @@
"type": "library", "type": "library",
"extra": { "extra": {
"branch-alias": { "branch-alias": {
"dev-main": "1.23-dev" "dev-main": "1.27-dev"
}, },
"thanks": { "thanks": {
"name": "symfony/polyfill", "name": "symfony/polyfill",
@ -1424,12 +2028,12 @@
} }
}, },
"autoload": { "autoload": {
"psr-4": {
"Symfony\\Polyfill\\Mbstring\\": ""
},
"files": [ "files": [
"bootstrap.php" "bootstrap.php"
] ],
"psr-4": {
"Symfony\\Polyfill\\Mbstring\\": ""
}
}, },
"notification-url": "https://packagist.org/downloads/", "notification-url": "https://packagist.org/downloads/",
"license": [ "license": [
@ -1455,7 +2059,7 @@
"shim" "shim"
], ],
"support": { "support": {
"source": "https://github.com/symfony/polyfill-mbstring/tree/v1.24.0" "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.27.0"
}, },
"funding": [ "funding": [
{ {
@ -1471,7 +2075,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2021-11-30T18:21:41+00:00" "time": "2022-11-03T14:55:06+00:00"
}, },
{ {
"name": "symfony/polyfill-php72", "name": "symfony/polyfill-php72",
@ -1548,6 +2152,232 @@
} }
], ],
"time": "2021-05-27T09:17:38+00:00" "time": "2021-05-27T09:17:38+00:00"
},
{
"name": "symfony/polyfill-php80",
"version": "v1.27.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-php80.git",
"reference": "7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936",
"reference": "7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936",
"shasum": ""
},
"require": {
"php": ">=7.1"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-main": "1.27-dev"
},
"thanks": {
"name": "symfony/polyfill",
"url": "https://github.com/symfony/polyfill"
}
},
"autoload": {
"files": [
"bootstrap.php"
],
"psr-4": {
"Symfony\\Polyfill\\Php80\\": ""
},
"classmap": [
"Resources/stubs"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Ion Bazan",
"email": "ion.bazan@gmail.com"
},
{
"name": "Nicolas Grekas",
"email": "p@tchwork.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions",
"homepage": "https://symfony.com",
"keywords": [
"compatibility",
"polyfill",
"portable",
"shim"
],
"support": {
"source": "https://github.com/symfony/polyfill-php80/tree/v1.27.0"
},
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2022-11-03T14:55:06+00:00"
},
{
"name": "symfony/process",
"version": "v5.4.11",
"source": {
"type": "git",
"url": "https://github.com/symfony/process.git",
"reference": "6e75fe6874cbc7e4773d049616ab450eff537bf1"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/process/zipball/6e75fe6874cbc7e4773d049616ab450eff537bf1",
"reference": "6e75fe6874cbc7e4773d049616ab450eff537bf1",
"shasum": ""
},
"require": {
"php": ">=7.2.5",
"symfony/polyfill-php80": "^1.16"
},
"type": "library",
"autoload": {
"psr-4": {
"Symfony\\Component\\Process\\": ""
},
"exclude-from-classmap": [
"/Tests/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Executes commands in sub-processes",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/process/tree/v5.4.11"
},
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2022-06-27T16:58:25+00:00"
},
{
"name": "symfony/var-dumper",
"version": "v3.4.47",
"source": {
"type": "git",
"url": "https://github.com/symfony/var-dumper.git",
"reference": "0719f6cf4633a38b2c1585140998579ce23b4b7d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/var-dumper/zipball/0719f6cf4633a38b2c1585140998579ce23b4b7d",
"reference": "0719f6cf4633a38b2c1585140998579ce23b4b7d",
"shasum": ""
},
"require": {
"php": "^5.5.9|>=7.0.8",
"symfony/polyfill-mbstring": "~1.0"
},
"conflict": {
"phpunit/phpunit": "<4.8.35|<5.4.3,>=5.0"
},
"require-dev": {
"ext-iconv": "*",
"twig/twig": "~1.34|~2.4"
},
"suggest": {
"ext-iconv": "To convert non-UTF-8 strings to UTF-8 (or symfony/polyfill-iconv in case ext-iconv cannot be used).",
"ext-intl": "To show region name in time zone dump",
"ext-symfony_debug": ""
},
"type": "library",
"autoload": {
"files": [
"Resources/functions/dump.php"
],
"psr-4": {
"Symfony\\Component\\VarDumper\\": ""
},
"exclude-from-classmap": [
"/Tests/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Nicolas Grekas",
"email": "p@tchwork.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony mechanism for exploring and dumping PHP variables",
"homepage": "https://symfony.com",
"keywords": [
"debug",
"dump"
],
"support": {
"source": "https://github.com/symfony/var-dumper/tree/v3.4.47"
},
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2020-10-24T10:57:07+00:00"
} }
], ],
"packages-dev": [], "packages-dev": [],
@ -1559,7 +2389,7 @@
"platform": [], "platform": [],
"platform-dev": [], "platform-dev": [],
"platform-overrides": { "platform-overrides": {
"php": "7.2.0" "php": "8.0.0"
}, },
"plugin-api-version": "2.3.0" "plugin-api-version": "2.3.0"
} }

View File

@ -1,67 +1,144 @@
<?php <?php
/**
* Pandora FMS API Checker Extension.
*
* @category API
* @package Pandora FMS
* @subpackage Extensions
* @version 1.0.0
* @license See below
*
* ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2005-2022 Artica Soluciones Tecnologicas
* Please see http://pandorafms.org for full contribution list
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation for version 2.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* ============================================================================
*/
// Pandora FMS - http://pandorafms.com // Begin.
// ==================================================
// Copyright (c) 2005-2021 Artica Soluciones Tecnologicas
// Please see http://pandorafms.org for full contribution list
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; version 2
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
function api_execute($url, $ip, $pandora_url, $apipass, $user, $password, $op, $op2, $id, $id2, $return_type, $other, $other_mode)
{
if (empty($url)) {
$url = 'http://'.$ip.$pandora_url.'/include/api.php';
$url .= '?';
$url .= 'apipass='.$apipass; /**
$url .= '&user='.$user; * Api Execution.
$url .= '&pass='.$password; *
$url .= '&op='.$op; * @param string $url Url.
$url .= '&op2='.$op2; * @param string $ip Ip.
if ($id !== '') { * @param string $pandora_url Pandora_url.
$url .= '&id='.$id; * @param string $apipass Apipass.
* @param string $user User.
* @param string $password Password.
* @param string $op Op.
* @param string $op2 Op2.
* @param string $id Id.
* @param string $id2 Id2.
* @param string $return_type Return_type.
* @param string $other Other.
* @param string $other_mode Other_mode.
* @param string $token Token.
*
* @return array.
*/
function api_execute(
string $url,
string $ip,
string $pandora_url,
string $apipass,
string $user,
string $password,
string $op,
string $op2,
string $id='',
string $id2='',
string $return_type='',
string $other='',
string $other_mode='',
string $token=''
) {
$data = [];
if (empty($url) === true) {
$url = 'http://'.$ip.$pandora_url.'/include/api.php?';
if (empty($op) === false) {
$data['op'] = $op;
} }
if ($id2 !== '') { if (empty($op2) === false) {
$url .= '&id2='.$id2; $data['op2'] = $op2;
} }
if ($return_type !== '') { if (empty($id) === false) {
$url .= '&return_type='.$return_type; $data['id'] = $id;
} }
if ($other !== '') { if (empty($id2) === false) {
$url .= '&other_mode='.$other_mode; $data['id2'] = $id2;
$url .= '&other='.$other; }
if (empty($return_type) === false) {
$data['return_type'] = $return_type;
}
if (empty($other) === false) {
$data['other_mode'] = $other_mode;
$data['other'] = $other;
}
// If token is not reported,use old method.
if (empty($token) === true) {
$data['apipass'] = $apipass;
$data['user'] = $user;
$data['password'] = $password;
} }
} }
$curlObj = curl_init(); $curlObj = curl_init($url);
if (empty($data) === false) {
$url .= http_build_query($data);
}
// set the content type json
$headers = [
'Content-Type: application/json',
'Authorization: Bearer '.$token,
];
curl_setopt($curlObj, CURLOPT_URL, $url); curl_setopt($curlObj, CURLOPT_URL, $url);
curl_setopt($curlObj, CURLOPT_RETURNTRANSFER, 1); curl_setopt($curlObj, CURLOPT_HTTPHEADER, $headers);
curl_setopt($curlObj, CURLOPT_RETURNTRANSFER, true);
$result = curl_exec($curlObj); $result = curl_exec($curlObj);
curl_close($curlObj); curl_close($curlObj);
$return = [ return [
'url' => $url, 'url' => $url,
'result' => $result, 'result' => $result,
]; ];
return $return;
} }
/**
* Perform API Checker
*
* @return void.
*/
function extension_api_checker() function extension_api_checker()
{ {
global $config; global $config;
check_login(); check_login();
if (! check_acl($config['id_user'], 0, 'PM')) { if ((bool) check_acl($config['id_user'], 0, 'PM') === false) {
db_pandora_audit( db_pandora_audit(
AUDIT_LOG_ACL_VIOLATION, AUDIT_LOG_ACL_VIOLATION,
'Trying to access Profile Management' 'Trying to access Profile Management'
@ -85,11 +162,12 @@ function extension_api_checker()
$return_type = io_safe_output(get_parameter('return_type', '')); $return_type = io_safe_output(get_parameter('return_type', ''));
$other = io_safe_output(get_parameter('other', '')); $other = io_safe_output(get_parameter('other', ''));
$other_mode = io_safe_output(get_parameter('other_mode', 'url_encode_separator_|')); $other_mode = io_safe_output(get_parameter('other_mode', 'url_encode_separator_|'));
$token = get_parameter('token');
$api_execute = get_parameter('api_execute', 0); $api_execute = (bool) get_parameter('api_execute', false);
$return_call_api = ''; $return_call_api = '';
if ($api_execute) { if ($api_execute === true) {
$return_call_api = api_execute( $return_call_api = api_execute(
$url, $url,
$ip, $ip,
@ -103,7 +181,8 @@ function extension_api_checker()
urlencode($id2), urlencode($id2),
$return_type, $return_type,
urlencode($other), urlencode($other),
$other_mode $other_mode,
$token
); );
} }
@ -129,6 +208,11 @@ function extension_api_checker()
$row[] = html_print_input_text('pandora_url', $pandora_url, '', 50, 255, true); $row[] = html_print_input_text('pandora_url', $pandora_url, '', 50, 255, true);
$table->data[] = $row; $table->data[] = $row;
$row = [];
$row[] = __('API Token').ui_print_help_tip(__('Use API Token instead API Pass, User and Password.'), true);
$row[] = html_print_input_text('token', $token, '', 50, 255, true);
$table->data[] = $row;
$row = []; $row = [];
$row[] = __('API Pass'); $row[] = __('API Pass');
$row[] = html_print_input_password('apipass', $apipass, '', 50, 255, true); $row[] = html_print_input_password('apipass', $apipass, '', 50, 255, true);
@ -214,7 +298,7 @@ function extension_api_checker()
echo '</div>'; echo '</div>';
echo '</form>'; echo '</form>';
if ($api_execute) { if ($api_execute === true) {
echo '<fieldset>'; echo '<fieldset>';
echo '<legend>'.__('Result').'</legend>'; echo '<legend>'.__('Result').'</legend>';
echo __('URL').'<br />'; echo __('URL').'<br />';

View File

@ -1,66 +0,0 @@
<?php
// Pandora FMS - http://pandorafms.com
// ==================================================
// Copyright (c) 2005-2021 Artica Soluciones Tecnologicas
// Please see http://pandorafms.org for full contribution list
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; version 2
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
require_once __DIR__.'/../include/config.php';
require_once __DIR__.'/../include/auth/mysql.php';
require_once __DIR__.'/../include/functions.php';
require_once __DIR__.'/../include/functions_db.php';
/*
* Review if sample agent is active and deploys configuration for
* visual consoles if necessary
*/
global $config;
// Deployment of sample agent for visual consoles.
if ($config['sample_agent'] == 1 && !isset($config['sample_agent_deployed'])) {
$id_agente = db_get_sql('SELECT id_agente FROM tagente WHERE nombre = "Sample_Agent";');
$modules = db_get_all_rows_filter('tagente_modulo', ['id_agente' => $id_agente], 'id_agente_modulo');
$count_modules = count($modules);
// Update of layout 1 (Rack sample).
$images_rack_server = [
'rack_server_rack',
'rack_server',
'rack_switch',
'rack_firewall',
'rack_double_server',
'rack_frame',
'rack_pdu',
];
$query = 'UPDATE `tlayout_data` SET `id_agent` = '.$id_agente.', `id_agente_modulo` = CASE ';
for ($i = 0; $i < $count_modules; $i++) {
$query .= 'WHEN `image` = "'.$images_rack_server[$i].'" THEN '.$modules[$i]['id_agente_modulo'].' ';
}
$query .= 'END WHERE `id_layout` = 1 AND `image` IN ("'.implode('","', $images_rack_server).'");';
db_process_sql($query);
// Update of layout 2 (Dashboard).
$query = 'UPDATE `tlayout_data` SET `id_agent`= '.$id_agente.', `id_agente_modulo` = CASE ';
$query .= 'WHEN `id` = 107 THEN '.$modules[0]['id_agente_modulo'].' ';
$query .= 'WHEN `id` = 108 THEN '.$modules[1]['id_agente_modulo'].' ';
$query .= 'WHEN `id` = 109 THEN '.$modules[2]['id_agente_modulo'].' ';
$query .= 'WHEN `id` = 110 THEN '.$modules[2]['id_agente_modulo'].' ';
$query .= 'WHEN `id` = 111 THEN '.$modules[3]['id_agente_modulo'].' ';
$query .= 'WHEN `id` = 112 THEN '.$modules[4]['id_agente_modulo'].' ';
$query .= 'WHEN `id` = 113 THEN '.$modules[5]['id_agente_modulo'].' ';
$query .= 'WHEN `id` = 114 THEN '.$modules[6]['id_agente_modulo'].' ';
$query .= 'END WHERE `id_layout` = 2 AND `id` IN (107,108,109,110,111,112,113,114);';
db_process_sql($query);
// This setting will avoid regenerate all the times the visual consoles.
config_update_value('sample_agent_deployed', 1);
}
extensions_add_main_function('sample_agent_deployment');

View File

@ -1666,4 +1666,29 @@ godmode/um_client/vendor/sebastian/object-enumerator
godmode/um_client/vendor/sebastian godmode/um_client/vendor/sebastian
godmode/um_client/vendor godmode/um_client/vendor
update_manager_client/resources/styles/pandora.css update_manager_client/resources/styles/pandora.css
enterprise/views/cluster/edit.php
enterprise/views/cluster/list.php
enterprise/views/cluster/view.php
enterprise/include/lib/Cluster.php
enterprise/include/lib/ClusterModule.php
enterprise/include/lib/ClusterViewer/ClusterManager.php
enterprise/include/lib/ClusterViewer/ClusterWizard.php
enterprise/operation/cluster/cluster.php
enterprise/meta/general/upload_head_image.php enterprise/meta/general/upload_head_image.php
general/first_task/transactional_list.php
enterprise/include/ajax/transactional.ajax.php
enterprise/include/class/Transactionalmap.class.php
enterprise/include/help/es/help_transactional_map_phases.php
enterprise/include/javascript/transactional/TransactionalController.js
enterprise/include/functions_transactional.php
enterprise/operation/agentes/manage_transmap.php
enterprise/operation/agentes/manage_transmap_creation.php
enterprise/operation/agentes/manage_transmap_creation_phases_data.php
enterprise/operation/agentes/transactional_map.php
enterprise/godmode/agentes/inventory_manager.php
enterprise/operation/agentes/agent_inventory.php
enterprise/godmode/modules/manage_inventory_modules.php
enterprise/godmode/modules/manage_inventory_modules_form.php
enterprise/operation/inventory/inventory.php
include/test.js
include/web2image.js

File diff suppressed because one or more lines are too long

View File

@ -68,7 +68,7 @@ ui_print_info_message(['no_close' => true, 'message' => __('There are no cluster
if (check_acl($config['id_user'], 0, 'AW')) { if (check_acl($config['id_user'], 0, 'AW')) {
?> ?>
<form action='index.php?sec=estado&sec2=enterprise/operation/cluster/cluster&op=new' method="post"> <form action='index.php?sec=estado&sec2=operation/cluster/cluster&op=new' method="post">
<input type="submit" class="button_task ui_toggle" value="<?php echo __('Create Cluster'); ?>" /> <input type="submit" class="button_task ui_toggle" value="<?php echo __('Create Cluster'); ?>" />
</form> </form>
@ -76,4 +76,4 @@ ui_print_info_message(['no_close' => true, 'message' => __('There are no cluster
} }
?> ?>
</div> </div>
</div> </div>

View File

@ -1,46 +0,0 @@
<?php
// Pandora FMS - http://pandorafms.com
// ==================================================
// Copyright (c) 2005-2021 Artica Soluciones Tecnologicas
// Please see http://pandorafms.org for full contribution list
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; version 2
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
global $config;
global $networkmaps_write;
global $networkmaps_manage;
check_login();
ui_require_css_file('first_task');
?>
<?php
ui_print_info_message(['no_close' => true, 'message' => __('There are no transactions defined yet.') ]);
if ($networkmaps_write || $networkmaps_manage) {
?>
<div class="new_task">
<div class="image_task">
<?php echo html_print_image('images/first_task/icono_grande_topology.png', true, ['title' => __('Transactions')]); ?>
</div>
<div class="text_task">
<h3> <?php echo __('Create Transactions'); ?></h3><p id="description_task">
<?php
echo __(
'The new transactional server allows you to execute tasks dependent on the others following a user-defined design. This means that it is possible to coordinate several executions to check a target at a given time.
Transaction graphs represent the different processes within our infrastructure that we use to deliver our service.'
);
?>
</p>
<form action="index.php?sec=network&sec2=enterprise/operation/agentes/manage_transmap_creation&create_transaction=1" method="post">
<input type="submit" class="button_task" value="<?php echo __('Create Transactions'); ?>" />
</form>
</div>
</div>
<?php
}

View File

@ -91,7 +91,7 @@ $login_body_class = '';
// Overrides the default background with the defined by the user. // Overrides the default background with the defined by the user.
if (!empty($config['login_background'])) { if (!empty($config['login_background'])) {
$background_url = 'images/backgrounds/'.$config['login_background']; $background_url = 'images/backgrounds/'.$config['login_background'];
$login_body_style = "style=\"background:linear-gradient(74deg, rgba(2, 2, 2, 0.333) 36%, transparent 36%), url('".$background_url."');\""; $login_body_style = "style=\"background-size: 100% 100% !important;background:linear-gradient(74deg, rgba(2, 2, 2, 0.333) 36%, transparent 36%), url('".$background_url."');\"";
} }
// Support for Internet Explorer and Microsoft Edge browsers // Support for Internet Explorer and Microsoft Edge browsers

View File

@ -59,6 +59,7 @@ ui_print_warning_message(
] ]
); );
$table = new StdClass();
$table->width = '100%'; $table->width = '100%';
$table->class = 'databox filters'; $table->class = 'databox filters';
$table->data = []; $table->data = [];

View File

@ -872,6 +872,35 @@ foreach ($fields as $field) {
true, true,
true true
); );
} else if ($field['is_link_enabled']) {
list($link_text, $link_url) = json_decode($custom_value, true);
if (json_last_error() !== JSON_ERROR_NONE) {
$link_text = '';
$link_url = '';
}
$data_field[1] = '<span style="line-height: 3.5;">'.__('Link text:').'</span>';
$data_field[1] .= '<br>';
$data_field[1] .= html_print_textarea(
'customvalue_'.$field['id_field'].'[]',
2,
65,
$link_text,
'class="min-height-30px',
true
);
$data_field[1] .= '<br>';
$data_field[1] .= '<span style="line-height: 3.5;">'.__('Link URL:').'</span>';
$data_field[1] .= '<br>';
$data_field[1] .= html_print_textarea(
'customvalue_'.$field['id_field'].'[]',
2,
65,
$link_url,
'class="min-height-30px',
true
);
} else { } else {
$data_field[1] = html_print_textarea( $data_field[1] = html_print_textarea(
'customvalue_'.$field['id_field'], 'customvalue_'.$field['id_field'],

View File

@ -224,6 +224,7 @@ if ($result === false) {
$result = []; $result = [];
} }
$table = new stdClass();
$table->width = '100%'; $table->width = '100%';
$table->cellpadding = 0; $table->cellpadding = 0;
$table->cellspacing = 0; $table->cellspacing = 0;

View File

@ -238,7 +238,15 @@ if ($create_agent) {
$field_values = []; $field_values = [];
foreach ($fields as $field) { foreach ($fields as $field) {
$field_values[$field['id_field']] = (string) get_parameter_post('customvalue_'.$field['id_field'], ''); $field_value = get_parameter_post('customvalue_'.$field['id_field'], '');
if ($field['is_link_enabled']) {
$field_value = json_encode($field_value);
} else {
$field_value = (string) $field_value;
}
$field_values[$field['id_field']] = $field_value;
} }
// Check if agent exists (BUG WC-50518-2). // Check if agent exists (BUG WC-50518-2).
@ -451,7 +459,20 @@ if ($id_agente) {
// Inventory. // Inventory.
$inventorytab = enterprise_hook('inventory_tab'); $inventorytab['text'] = '<a href="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=inventory&id_agente='.$id_agente.'">'.html_print_image(
'images/page_white_text.png',
true,
[
'title' => __('Inventory'),
'class' => 'invert_filter',
]
).'</a>';
if ($tab == 'inventory') {
$inventorytab['active'] = true;
} else {
$inventorytab['active'] = false;
}
if ($inventorytab == -1) { if ($inventorytab == -1) {
$inventorytab = ''; $inventorytab = '';
@ -999,7 +1020,22 @@ if ($update_agent) {
$field_values = []; $field_values = [];
foreach ($fields as $field) { foreach ($fields as $field) {
$field_values[$field['id_field']] = (string) get_parameter_post('customvalue_'.$field['id_field'], ''); $field_value = get_parameter_post('customvalue_'.$field['id_field'], '');
if ($field['is_link_enabled']) {
if ($field_value[1] !== '') {
$parsed_url = parse_url($field_value[1]);
if (empty($parsed_url['scheme']) === true) {
$field_value[1] = 'http://'.ltrim($field_value[1], '/');
}
}
$field_value = json_encode($field_value);
} else {
$field_value = (string) $field_value;
}
$field_values[$field['id_field']] = $field_value;
} }
foreach ($field_values as $key => $value) { foreach ($field_values as $key => $value) {
@ -2095,6 +2131,9 @@ if ($delete_module) {
exit; exit;
} }
// Before delete the main module, check and delete the childrens from the original module.
module_check_childrens_and_delete($id_borrar_modulo);
// Also call base function to delete modules. // Also call base function to delete modules.
modules_delete_agent_module($id_borrar_modulo); modules_delete_agent_module($id_borrar_modulo);
@ -2358,6 +2397,10 @@ switch ($tab) {
include 'agent_wizard.php'; include 'agent_wizard.php';
break; break;
case 'inventory':
include 'inventory_manager.php';
break;
default: default:
if (enterprise_hook('switch_agent_tab', [$tab])) { if (enterprise_hook('switch_agent_tab', [$tab])) {
// This will make sure that blank pages will have at least some // This will make sure that blank pages will have at least some
@ -2450,6 +2493,11 @@ switch ($tab) {
} }
}); });
}); });
// Change description when edit port
$( "#text-tcp_port" ).change(function() {
$( "#textarea_description" ).text(`Checks port ${$( "#text-tcp_port" ).val()} is opened`);
});
// Set the position and width of the subtab // Set the position and width of the subtab
/* /*

View File

@ -30,6 +30,8 @@ $display_on_front = (bool) get_parameter('display_on_front', 0);
$is_password_type = (bool) get_parameter('is_password_type', 0); $is_password_type = (bool) get_parameter('is_password_type', 0);
$is_combo_enable = (bool) get_parameter('is_combo_enable', 0); $is_combo_enable = (bool) get_parameter('is_combo_enable', 0);
$combo_values = (string) get_parameter('combo_values', ''); $combo_values = (string) get_parameter('combo_values', '');
$is_link_enabled = (bool) get_parameter('is_link_enabled', 0);
// Header. // Header.
if ($id_field) { if ($id_field) {
$field = db_get_row_filter('tagent_custom_fields', ['id_field' => $id_field]); $field = db_get_row_filter('tagent_custom_fields', ['id_field' => $id_field]);
@ -38,6 +40,7 @@ if ($id_field) {
$is_password_type = $field['is_password_type']; $is_password_type = $field['is_password_type'];
$combo_values = $field['combo_values'] ? $field['combo_values'] : ''; $combo_values = $field['combo_values'] ? $field['combo_values'] : '';
$is_combo_enable = $config['is_combo_enable']; $is_combo_enable = $config['is_combo_enable'];
$is_link_enabled = $field['is_link_enabled'];
ui_print_page_header(__('Update agent custom field'), 'images/custom_field.png', false, '', true, ''); ui_print_page_header(__('Update agent custom field'), 'images/custom_field.png', false, '', true, '');
} else { } else {
ui_print_page_header(__('Create agent custom field'), 'images/custom_field.png', false, '', true, ''); ui_print_page_header(__('Create agent custom field'), 'images/custom_field.png', false, '', true, '');
@ -128,6 +131,17 @@ $table->data[4][1] = html_print_textarea(
true true
); );
$table->data[5][0] = __('Link type');
$table->data[5][1] = html_print_checkbox_switch_extended(
'is_link_enabled',
1,
$is_link_enabled,
false,
'',
'',
true
);
echo '<form name="field" method="post" action="index.php?sec=gagente&sec2=godmode/agentes/fields_manager">'; echo '<form name="field" method="post" action="index.php?sec=gagente&sec2=godmode/agentes/fields_manager">';
html_print_table($table); html_print_table($table);
echo '<div class="action-buttons" style="width: '.$table->width.'">'; echo '<div class="action-buttons" style="width: '.$table->width.'">';
@ -167,25 +181,46 @@ $(document).ready (function () {
}); });
} }
if ($('input[type=checkbox][name=is_link_enabled]').is(":checked") === true) {
$('#configure_field-1').hide();
$('#configure_field-3').hide();
} else {
$('#configure_field-1').show();
$('#configure_field-3').show();
}
$('input[type=checkbox][name=is_link_enabled]').change(function () {
if( $(this).is(":checked") ){
$('#configure_field-1').hide();
$('#configure_field-3').hide();
} else{
$('#configure_field-1').show();
$('#configure_field-3').show();
}
});
$('input[type=checkbox][name=is_combo_enable]').change(function () { $('input[type=checkbox][name=is_combo_enable]').change(function () {
if( $(this).is(":checked") ){ if( $(this).is(":checked") ){
$('#configure_field-4').show(); $('#configure_field-4').show();
dialog_message("#message_no_set_password"); dialog_message("#message_no_set_password");
$('#configure_field-1').hide(); $('#configure_field-1').hide();
$('#configure_field-5').hide();
} }
else{ else{
$('#configure_field-4').hide(); $('#configure_field-4').hide();
$('#configure_field-1').show(); $('#configure_field-1').show();
$('#configure_field-5').show();
} }
}); });
$('input[type=checkbox][name=is_password_type]').change(function () { $('input[type=checkbox][name=is_password_type]').change(function () {
if( $(this).is(":checked")){ if( $(this).is(":checked")){
dialog_message("#message_no_set_combo"); dialog_message("#message_no_set_combo");
$('#configure_field-3').hide(); $('#configure_field-3').hide();
$('#configure_field-5').hide();
} }
else{ else{
$('#configure_field-3').show(); $('#configure_field-3').show();
$('#configure_field-5').show();
} }
}); });
}); });

View File

@ -38,11 +38,12 @@ $display_on_front = (int) get_parameter('display_on_front', 0);
$is_password_type = (int) get_parameter('is_password_type', 0); $is_password_type = (int) get_parameter('is_password_type', 0);
$combo_values = (string) get_parameter('combo_values', ''); $combo_values = (string) get_parameter('combo_values', '');
$combo_value_selected = (string) get_parameter('combo_value_selected', ''); $combo_value_selected = (string) get_parameter('combo_value_selected', '');
$is_link_enabled = (bool) get_parameter('is_link_enabled', 0);
// Create field. // Create field.
if ($create_field) { if ($create_field) {
// Check if name field is empty. // Check if name field is empty.
if ($name == '') { if ($name === '') {
ui_print_error_message(__('The name must not be empty')); ui_print_error_message(__('The name must not be empty'));
} else if ($name == db_get_value('name', 'tagent_custom_fields', 'name', $name)) { } else if ($name == db_get_value('name', 'tagent_custom_fields', 'name', $name)) {
ui_print_error_message(__('The name must be unique')); ui_print_error_message(__('The name must be unique'));
@ -54,6 +55,7 @@ if ($create_field) {
'display_on_front' => $display_on_front, 'display_on_front' => $display_on_front,
'is_password_type' => $is_password_type, 'is_password_type' => $is_password_type,
'combo_values' => $combo_values, 'combo_values' => $combo_values,
'is_link_enabled' => $is_link_enabled,
] ]
); );
ui_print_success_message(__('Field successfully created')); ui_print_success_message(__('Field successfully created'));
@ -63,12 +65,13 @@ if ($create_field) {
// Update field. // Update field.
if ($update_field) { if ($update_field) {
// Check if name field is empty. // Check if name field is empty.
if ($name != '') { if ($name !== '') {
$values = [ $values = [
'name' => $name, 'name' => $name,
'display_on_front' => $display_on_front, 'display_on_front' => $display_on_front,
'is_password_type' => $is_password_type, 'is_password_type' => $is_password_type,
'combo_values' => $combo_values, 'combo_values' => $combo_values,
'is_link_enabled' => $is_link_enabled,
]; ];
$result = db_process_sql_update('tagent_custom_fields', $values, ['id_field' => $id_field]); $result = db_process_sql_update('tagent_custom_fields', $values, ['id_field' => $id_field]);

View File

@ -0,0 +1,263 @@
<?php
// ______ __ _______ _______ _______
// | __ \.---.-.-----.--| |.-----.----.---.-. | ___| | | __|
// | __/| _ | | _ || _ | _| _ | | ___| |__ |
// |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
//
// ============================================================================
// Copyright (c) 2007-2021 Artica Soluciones Tecnologicas, http://www.artica.es
// This code is NOT free software. This code is NOT licenced under GPL2 licence
// You cannnot redistribute it without written permission of copyright holder.
// ============================================================================
// Load global variables
global $config;
// Check user credentials
check_login();
if (! check_acl($config['id_user'], 0, 'AW')) {
db_pandora_audit(
AUDIT_LOG_ACL_VIOLATION,
'Trying to access agent manager'
);
include $config['homedir'].'/general/noaccess.php';
return;
}
global $direccion_agente, $id_agente, $id_os;
// include_once ($config['homedir'].'/'.ENTERPRISE_DIR.'/include/functions_policies.php');
require_once $config['homedir'].'/include/functions_ui.php';
// Initialize data
$add_inventory_module = (boolean) get_parameter('add_inventory_module');
$update_inventory_module = (boolean) get_parameter('update_inventory_module');
$delete_inventory_module = (int) get_parameter('delete_inventory_module');
$load_inventory_module = (int) get_parameter('load_inventory_module');
$force_inventory_module = (int) get_parameter('force_inventory_module');
$id_agent_module_inventory = (int) get_parameter('id_agent_module_inventory');
$id_module_inventory = (int) get_parameter('id_module_inventory');
$target = (string) get_parameter('target', '');
$username = (string) get_parameter('username');
$password = io_input_password((string) get_parameter('password'));
$interval = (int) get_parameter('interval');
$custom_fields = array_map(
function ($field) {
$field['secure'] = (bool) $field['secure'];
if ($field['secure']) {
$field['value'] = io_input_password($field['value']);
}
return $field;
},
get_parameter('custom_fields', [])
);
$custom_fields_enabled = (bool) get_parameter('custom_fields_enabled');
// Add inventory module to agent
if ($add_inventory_module) {
$if_exists = db_get_value_filter(
'id_agent_module_inventory',
'tagent_module_inventory',
[
'id_agente' => $id_agente,
'id_module_inventory' => $id_module_inventory,
]
);
if (!$if_exists) {
$values = [
'id_agente' => $id_agente,
'id_module_inventory' => $id_module_inventory,
'target' => $target,
'interval' => $interval,
'username' => $username,
'password' => $password,
'custom_fields' => $custom_fields_enabled && !empty($custom_fields) ? base64_encode(json_encode($custom_fields)) : '',
];
$result = db_process_sql_insert('tagent_module_inventory', $values);
if ($result) {
ui_print_success_message(__('Successfully added inventory module'));
} else {
ui_print_error_message(__('Error adding inventory module'));
}
} else {
ui_print_error_message(__('The inventory of the module already exists'));
}
// Remove inventory module from agent
} else if ($delete_inventory_module) {
$result = db_process_sql_delete(
'tagent_module_inventory',
['id_agent_module_inventory' => $delete_inventory_module]
);
if ($result) {
ui_print_success_message(__('Successfully deleted inventory module'));
} else {
ui_print_error_message(__('Error deleting inventory module'));
}
// Update inventory module
} else if ($force_inventory_module) {
$result = db_process_sql_update('tagent_module_inventory', ['flag' => 1], ['id_agent_module_inventory' => $force_inventory_module]);
if ($result) {
ui_print_success_message(__('Successfully forced inventory module'));
} else {
ui_print_error_message(__('Error forcing inventory module'));
}
// Update inventory module
} else if ($update_inventory_module) {
$values = [
'target' => $target,
'interval' => $interval,
'username' => $username,
'password' => $password,
'custom_fields' => $custom_fields_enabled && !empty($custom_fields) ? base64_encode(json_encode($custom_fields)) : '',
];
$result = db_process_sql_update('tagent_module_inventory', $values, ['id_agent_module_inventory' => $id_agent_module_inventory, 'id_agente' => $id_agente]);
if ($result) {
ui_print_success_message(__('Successfully updated inventory module'));
} else {
ui_print_error_message(__('Error updating inventory module'));
}
}
// Load inventory module data for updating
if ($load_inventory_module) {
$sql = 'SELECT * FROM tagent_module_inventory WHERE id_module_inventory = '.$load_inventory_module;
$row = db_get_row_sql($sql);
if (!empty($row)) {
$id_agent_module_inventory = $row['id_agent_module_inventory'];
$id_module_inventory = $row['id_module_inventory'];
$target = $row['target'];
$interval = $row['interval'];
$username = $row['username'];
$password = io_output_password($row['password']);
$custom_fields = [];
if (!empty($row['custom_fields'])) {
try {
$custom_fields = array_map(
function ($field) {
if ($field['secure']) {
$field['value'] = io_output_password($field['value']);
}
return $field;
},
json_decode(base64_decode($row['custom_fields']), true)
);
$custom_fields_enabled = true;
} catch (Exception $e) {
}
}
} else {
ui_print_error_message(__('Inventory module error'));
include 'general/footer.php';
return;
}
} else {
$target = $direccion_agente;
$interval = (string) SECONDS_1HOUR;
$username = '';
$password = '';
$custom_fields_enabled = false;
$custom_fields = [];
}
// Inventory module configuration
$form_buttons = '';
if ($load_inventory_module) {
$form_buttons .= html_print_input_hidden('id_agent_module_inventory', $id_agent_module_inventory, true);
$form_buttons .= html_print_submit_button(__('Update'), 'update_inventory_module', false, 'class="sub next"', true);
} else {
$form_buttons .= html_print_submit_button(__('Add'), 'add_inventory_module', false, 'class="sub next"', true);
}
echo ui_get_inventory_module_add_form(
'index.php?sec=estado&sec2=godmode/agentes/configurar_agente&tab=inventory&id_agente='.$id_agente,
$form_buttons,
$load_inventory_module,
$id_os,
$target,
$interval,
$username,
$password,
$custom_fields_enabled,
$custom_fields
);
// Inventory module list
$sql = sprintf(
'SELECT *
FROM tmodule_inventory, tagent_module_inventory
WHERE tagent_module_inventory.id_agente = %d
AND tmodule_inventory.id_module_inventory = tagent_module_inventory.id_module_inventory
ORDER BY name',
$id_agente
);
$result = db_process_sql($sql);
if (db_get_num_rows($sql) == 0) {
echo '&nbsp;</td></tr><tr><td>';
} else {
$table = new stdClass();
$table->width = '100%';
$table->class = 'databox filters';
$table->data = [];
$table->head = [];
$table->styleTable = 'margin-top: 20px;';
$table->head[0] = "<span title='".__('Policy')."'>".__('P.').'</span>';
$table->head[1] = __('Name');
$table->head[2] = __('Description');
$table->head[3] = __('Target');
$table->head[4] = __('Interval');
$table->head[5] = __('Actions');
$table->align = [];
$table->align[5] = 'left';
foreach ($result as $row) {
$data = [];
$sql = sprintf('SELECT id_policy FROM tpolicy_modules_inventory WHERE id = %d', $row['id_policy_module_inventory']);
$id_policy = db_get_value_sql($sql);
if ($id_policy) {
$policy = policies_get_policy($id_policy);
$data[0] = '<a href="index.php?sec=gmodules&sec2='.ENTERPRISE_DIR.'/godmode/policies/policies&id='.$id_policy.'">';
$data[0] .= html_print_image('images/policies_mc.png', true, ['border' => '0', 'title' => $policy['name']]);
$data[0] .= '</a>';
} else {
$data[0] = '';
}
$data[1] = '<a href="index.php?sec=estado&sec2=godmode/agentes/configurar_agente&tab=inventory&id_agente='.$id_agente.'&load_inventory_module='.$row['id_module_inventory'].'">'.$row['name'].'</a>';
$data[2] = $row['description'];
$data[3] = $row['target'];
$data[4] = human_time_description_raw($row['interval']);
// Delete module
$data[5] = '<a href="index.php?sec=estado&sec2=godmode/agentes/configurar_agente&tab=inventory&id_agente='.$id_agente.'&delete_inventory_module='.$row['id_agent_module_inventory'].'" onClick="if (!confirm(\''.__('Are you sure?').'\')) return false;">';
$data[5] .= html_print_image('images/cross.png', true, ['border' => '0', 'title' => __('Delete'), 'class' => 'invert_filter']);
$data[5] .= '</b></a>&nbsp;&nbsp;';
// Update module
$data[5] .= '<a href="index.php?sec=estado&sec2=godmode/agentes/configurar_agente&tab=inventory&id_agente='.$id_agente.'&load_inventory_module='.$row['id_module_inventory'].'">';
$data[5] .= html_print_image('images/config.png', true, ['border' => '0', 'title' => __('Update'), 'class' => 'invert_filter']);
$data[5] .= '</b></a>&nbsp;&nbsp;';
// Force refresh module
$data[5] .= '<a href="index.php?sec=estado&sec2=godmode/agentes/configurar_agente&tab=inventory&id_agente='.$id_agente.'&force_inventory_module='.$row['id_agent_module_inventory'].'">';
$data[5] .= html_print_image('images/target.png', true, ['border' => '0', 'title' => __('Force'), 'class' => 'invert_filter']).'</b></a>';
array_push($table->data, $data);
}
html_print_table($table);
}

View File

@ -732,17 +732,15 @@ if ($agents !== false) {
} }
if ($agent['id_os'] == CLUSTER_OS_ID) { if ($agent['id_os'] == CLUSTER_OS_ID) {
if (enterprise_installed()) { $cluster = PandoraFMS\Cluster::loadFromAgentId(
$cluster = PandoraFMS\Enterprise\Cluster::loadFromAgentId( $agent['id_agente']
$agent['id_agente'] );
); $url = 'index.php?sec=reporting&sec2=';
$url = 'index.php?sec=reporting&sec2='.ENTERPRISE_DIR; $url .= 'operation/cluster/cluster';
$url .= '/operation/cluster/cluster'; $url = ui_get_full_url(
$url = ui_get_full_url( $url.'&op=update&id='.$cluster->id()
$url.'&op=update&id='.$cluster->id() );
); echo '<a href="'.$url.'">'.ui_print_truncate_text($agent['alias'], 'agent_medium').'</a>';
echo '<a href="'.$url.'">'.ui_print_truncate_text($agent['alias'], 'agent_medium').'</a>';
}
} else { } else {
echo '<a alt ='.$agent['nombre']." href='index.php?sec=gagente& echo '<a alt ='.$agent['nombre']." href='index.php?sec=gagente&
sec2=godmode/agentes/configurar_agente&tab=$main_tab& sec2=godmode/agentes/configurar_agente&tab=$main_tab&
@ -792,18 +790,16 @@ if ($agents !== false) {
echo '</span><div class="left actions clear_left" style=" visibility: hidden">'; echo '</span><div class="left actions clear_left" style=" visibility: hidden">';
if ($check_aw) { if ($check_aw) {
if ($agent['id_os'] == CLUSTER_OS_ID) { if ($agent['id_os'] == CLUSTER_OS_ID) {
if (enterprise_installed()) { $cluster = PandoraFMS\Cluster::loadFromAgentId(
$cluster = PandoraFMS\Enterprise\Cluster::loadFromAgentId( $agent['id_agente']
$agent['id_agente'] );
); $url = 'index.php?sec=reporting&sec2=';
$url = 'index.php?sec=reporting&sec2='.ENTERPRISE_DIR; $url .= 'operation/cluster/cluster';
$url .= '/operation/cluster/cluster'; $url = ui_get_full_url(
$url = ui_get_full_url( $url.'&op=update&id='.$cluster->id()
$url.'&op=update&id='.$cluster->id() );
); echo '<a href="'.$url.'">'.__('Edit').'</a>';
echo '<a href="'.$url.'">'.__('Edit').'</a>'; echo ' | ';
echo ' | ';
}
} else { } else {
echo '<a href="index.php?sec=gagente& echo '<a href="index.php?sec=gagente&
sec2=godmode/agentes/configurar_agente&tab=main& sec2=godmode/agentes/configurar_agente&tab=main&
@ -825,17 +821,15 @@ if ($agents !== false) {
echo ' | '; echo ' | ';
if ($agent['id_os'] == CLUSTER_OS_ID) { if ($agent['id_os'] == CLUSTER_OS_ID) {
if (enterprise_installed()) { $cluster = PandoraFMS\Cluster::loadFromAgentId(
$cluster = PandoraFMS\Enterprise\Cluster::loadFromAgentId( $agent['id_agente']
$agent['id_agente'] );
); $url = 'index.php?sec=reporting&sec2=';
$url = 'index.php?sec=reporting&sec2='.ENTERPRISE_DIR; $url .= 'operation/cluster/cluster';
$url .= '/operation/cluster/cluster'; $url = ui_get_full_url(
$url = ui_get_full_url( $url.'&op=view&id='.$cluster->id()
$url.'&op=view&id='.$cluster->id() );
); echo '<a href="'.$url.'">'.__('View').'</a>';
echo '<a href="'.$url.'">'.__('View').'</a>';
}
} else { } else {
echo '<a href="index.php?sec=estado echo '<a href="index.php?sec=estado
&sec2=operation/agentes/ver_agente &sec2=operation/agentes/ver_agente

View File

@ -52,13 +52,13 @@ if (!isset($policy_page)) {
echo '<form id="create_module_type" method="post" action="'.$url.'">'; echo '<form id="create_module_type" method="post" action="'.$url.'">';
echo '<table width="100%" cellpadding="2" cellspacing="2" class="databox filters" >'; echo '<table width="100%" cellpadding="2" cellspacing="2" class="databox filters" >';
echo "<tr><td class='datos bolder w20p'>"; echo "<tr><td class='datos bolder w12p'><span class='mrgn_right_7px'>";
echo __('Search').' '.html_print_input_text( echo __('Search').'</span>'.html_print_input_text(
'search_string', 'search_string',
$search_string, $search_string,
'', '',
15, 5,
255, 5,
true true
); );
html_print_input_hidden('search', 1); html_print_input_hidden('search', 1);
@ -73,7 +73,6 @@ echo '</td>';
echo "<td class='datos w10p'>"; echo "<td class='datos w10p'>";
html_print_submit_button(__('Filter'), 'filter', false, 'class="sub search"'); html_print_submit_button(__('Filter'), 'filter', false, 'class="sub search"');
echo '</td>'; echo '</td>';
echo "<td class='datos w10p'></td>";
echo '</form>'; echo '</form>';
// Check if there is at least one server of each type available to assign that // Check if there is at least one server of each type available to assign that
// kind of modules. If not, do not show server type in combo. // kind of modules. If not, do not show server type in combo.
@ -179,7 +178,7 @@ if (($policy_page) || (isset($agent))) {
// Create module/type combo. // Create module/type combo.
echo '<form id="create_module_type" method="post" action="'.$url.'">'; echo '<form id="create_module_type" method="post" action="'.$url.'">';
if (!$policy_page) { if (!$policy_page) {
echo '<td class="datos w20p bolder">'; echo '<td class="datos w15p bolder">';
echo __('Show in hierachy mode'); echo __('Show in hierachy mode');
if ($checked == 'true') { if ($checked == 'true') {
$checked = true; $checked = true;
@ -198,8 +197,8 @@ if (($policy_page) || (isset($agent))) {
echo '</td>'; echo '</td>';
} }
echo '<td class="datos w20p bolder">'; echo '<td class="datos w20p bolder lign_right"><span class="mrgn_right_7px">';
echo __('<p>Type</p>'); echo __('Type').'</span>';
html_print_select( html_print_select(
$modules, $modules,
'moduletype', 'moduletype',
@ -216,7 +215,7 @@ if (($policy_page) || (isset($agent))) {
); );
html_print_input_hidden('edit_module', 1); html_print_input_hidden('edit_module', 1);
echo '</td>'; echo '</td>';
echo '<td class="datos w10p">'; echo '<td class="datos w5p">';
echo '<input align="right" name="updbutton" type="submit" class="sub next" value="'.__('Create').'">'; echo '<input align="right" name="updbutton" type="submit" class="sub next" value="'.__('Create').'">';
echo '</td>'; echo '</td>';
echo '</tr>'; echo '</tr>';
@ -247,6 +246,8 @@ if ($module_action === 'delete') {
$print_result_msg = true; $print_result_msg = true;
$count_correct_delete_modules = 0; $count_correct_delete_modules = 0;
foreach ($id_agent_modules_delete as $id_agent_module_del) { foreach ($id_agent_modules_delete as $id_agent_module_del) {
// Before delete the main module, check and delete the childrens from the original module.
module_check_childrens_and_delete($id_agent_module_del);
$id_grupo = (int) agents_get_agent_group($id_agente); $id_grupo = (int) agents_get_agent_group($id_agente);
$all_groups = agents_get_all_groups_agent($id_agente, $id_grupo); $all_groups = agents_get_all_groups_agent($id_agente, $id_grupo);
@ -445,8 +446,6 @@ if ($module_action === 'delete') {
} }
} else if ($module_action === 'disable') { } else if ($module_action === 'disable') {
$id_agent_modules_disable = (array) get_parameter('id_delete'); $id_agent_modules_disable = (array) get_parameter('id_delete');
$count_correct_delete_modules = 0;
$updated_count = 0; $updated_count = 0;
foreach ($id_agent_modules_disable as $id_agent_module_disable) { foreach ($id_agent_modules_disable as $id_agent_module_disable) {
@ -490,6 +489,52 @@ if ($module_action === 'delete') {
); );
} }
} }
} else if ($module_action === 'enable') {
$id_agent_modules_enable = (array) get_parameter('id_delete');
$updated_count = 0;
foreach ($id_agent_modules_enable as $id_agent_module_enable) {
$sql = sprintf(
'UPDATE tagente_modulo
SET disabled = 0
WHERE id_agente_modulo = %d',
$id_agent_module_enable
);
$id_agent_changed[] = modules_get_agentmodule_agent($id_agent_module_enable);
$agent_update_result = db_process_sql_update(
'tagente',
['update_module_count' => 1],
['id_agente' => $id_agent_changed]
);
if (db_process_sql($sql) !== false && $agent_update_result !== false) {
$updated_count++;
}
}
$count_modules_to_enable = count($id_agent_modules_enable);
if ($updated_count === 0) {
ui_print_error_message(
sprintf(
__('There was a problem completing the operation. Applied to 0/%d modules.'),
$count_modules_to_enable
)
);
} else {
if ($updated_count == $count_modules_to_enable) {
ui_print_success_message(__('Operation finished successfully.'));
} else {
ui_print_error_message(
sprintf(
__('There was a problem completing the operation. Applied to %d/%d modules.'),
$updated_count,
$count_modules_to_enable
)
);
}
}
} }
@ -1132,7 +1177,11 @@ foreach ($modules as $module) {
$data[6] = ui_print_status_image( $data[6] = ui_print_status_image(
$status, $status,
htmlspecialchars($title), htmlspecialchars($title),
true true,
false,
false,
false,
($module['ip_target']) ? 'IP: '.$module['ip_target'] : false
); );
// MAX / MIN values. // MAX / MIN values.
@ -1274,6 +1323,7 @@ if (check_acl_one_of_groups($config['id_user'], $all_groups, 'AW')) {
html_print_select( html_print_select(
[ [
'disable' => 'Disable selected modules', 'disable' => 'Disable selected modules',
'enable' => 'Enable selected modules',
'delete' => 'Delete selected modules', 'delete' => 'Delete selected modules',
], ],
'module_action', 'module_action',
@ -1286,6 +1336,8 @@ if (check_acl_one_of_groups($config['id_user'], $all_groups, 'AW')) {
false false
); );
echo '&nbsp&nbsp&nbsp&nbsp';
html_print_submit_button( html_print_submit_button(
__('Execute action'), __('Execute action'),
'submit_modules_action', 'submit_modules_action',

View File

@ -69,7 +69,7 @@ if (strstr($page, 'policy_modules') === false) {
define('ID_NETWORK_COMPONENT_TYPE', 2); define('ID_NETWORK_COMPONENT_TYPE', 2);
if (empty($update_module_id)) { if (empty($edit_module)) {
// Function in module_manager_editor_common.php. // Function in module_manager_editor_common.php.
add_component_selection(ID_NETWORK_COMPONENT_TYPE); add_component_selection(ID_NETWORK_COMPONENT_TYPE);
} }

View File

@ -36,7 +36,7 @@ if (strstr($page, 'policy_modules') === false) {
define('ID_NETWORK_COMPONENT_TYPE', 4); define('ID_NETWORK_COMPONENT_TYPE', 4);
if (empty($update_module_id)) { if (empty($edit_module)) {
// Function in module_manager_editor_common.php // Function in module_manager_editor_common.php
add_component_selection(ID_NETWORK_COMPONENT_TYPE); add_component_selection(ID_NETWORK_COMPONENT_TYPE);
} else { } else {

View File

@ -82,7 +82,7 @@ if ($plugin_pass == '' && !$id_agent_module) {
$plugin_pass = 1; $plugin_pass = 1;
} }
if (empty($update_module_id)) { if (empty($edit_module)) {
// Function in module_manager_editor_common.php // Function in module_manager_editor_common.php
add_component_selection(ID_NETWORK_COMPONENT_TYPE); add_component_selection(ID_NETWORK_COMPONENT_TYPE);
} else { } else {

View File

@ -34,7 +34,7 @@ $extra_title = __('WMI server module');
define('ID_NETWORK_COMPONENT_TYPE', 6); define('ID_NETWORK_COMPONENT_TYPE', 6);
if (empty($update_module_id)) { if (empty($edit_module)) {
// Function in module_manager_editor_common.php // Function in module_manager_editor_common.php
add_component_selection(ID_NETWORK_COMPONENT_TYPE); add_component_selection(ID_NETWORK_COMPONENT_TYPE);
} else { } else {

View File

@ -1842,6 +1842,10 @@ function insert_downtime_agent($id_downtime, $user_groups_ad)
$(document).ready (function () { $(document).ready (function () {
populate_agents_selector(); populate_agents_selector();
// Add data-pendingdelete attribute to exclude delete_pending modules
document.querySelector("#id_agents").dataset.pendingdelete = true
document.querySelector("#modules_selection_mode").dataset.pendingdelete = true
$("#id_agents").change(agent_changed_by_multiple_agents); $("#id_agents").change(agent_changed_by_multiple_agents);
$("#modules_selection_mode").change(agent_changed_by_multiple_agents); $("#modules_selection_mode").change(agent_changed_by_multiple_agents);

View File

@ -124,6 +124,8 @@ if (!empty($groups)) {
if (!empty($downtimes)) { if (!empty($downtimes)) {
ob_clean(); ob_clean();
// Show contentype header // Show contentype header
// Set cookie for download control.
setDownloadCookieToken();
header('Content-type: text/csv'); header('Content-type: text/csv');
header('Content-Disposition: attachment; filename="pandora_planned_downtime_'.date('Y/m/d H:i:s').'.csv"'); header('Content-Disposition: attachment; filename="pandora_planned_downtime_'.date('Y/m/d H:i:s').'.csv"');
@ -161,7 +163,7 @@ if (!empty($downtimes)) {
if (!empty($downtime_agents)) { if (!empty($downtime_agents)) {
foreach ($downtime_agents as $downtime_agent) { foreach ($downtime_agents as $downtime_agent) {
$downtime_items = []; $downtime_items = [];
$downtime_items[] = $downtime_agent[alias]; $downtime_items[] = $downtime_agent['alias'];
if (!$downtime_agent['all_modules']) { if (!$downtime_agent['all_modules']) {
$agent_id = $downtime_agent['agent_id']; $agent_id = $downtime_agent['agent_id'];

View File

@ -907,7 +907,7 @@ if ($downtimes === false && $filter_performed === false) {
__('Export to CSV'), __('Export to CSV'),
'csv_export', 'csv_export',
false, false,
'location.href="godmode/agentes/planned_downtime.export_csv.php?'.$filter_params_str.'"', 'blockResubmit($(this)); location.href=\'godmode/agentes/planned_downtime.export_csv.php?'.$filter_params_str.'\'',
'class="sub next"' 'class="sub next"'
); );
echo '</div>'; echo '</div>';

View File

@ -40,6 +40,7 @@ $update_command = (bool) get_parameter('update_command');
$create_command = (bool) get_parameter('create_command'); $create_command = (bool) get_parameter('create_command');
$delete_command = (bool) get_parameter('delete_command'); $delete_command = (bool) get_parameter('delete_command');
$copy_command = (bool) get_parameter('copy_command'); $copy_command = (bool) get_parameter('copy_command');
$content_type = (string) get_parameter('content_type', 'text/plain');
$url = 'index.php?sec='.$sec.'&sec2=godmode/alerts/alert_commands'; $url = 'index.php?sec='.$sec.'&sec2=godmode/alerts/alert_commands';
@ -226,7 +227,7 @@ if (is_ajax()) {
'field'.$i.'_value', 'field'.$i.'_value',
'text/plain', 'text/plain',
'', '',
'', $content_type == 'text/plain',
$is_management_allowed, $is_management_allowed,
'', '',
'', '',
@ -238,7 +239,7 @@ if (is_ajax()) {
'field'.$i.'_value', 'field'.$i.'_value',
'text/html', 'text/html',
'', '',
'text/html', $content_type == 'text/html',
$is_management_allowed, $is_management_allowed,
'', '',
'', '',

View File

@ -231,7 +231,7 @@ if (strlen(trim($agentName)) > 0) {
} }
if ($actionID != -1 && $actionID != '') { if ($actionID != -1 && $actionID != '') {
$where .= ' AND talert_template_modules.id IN (SELECT id_alert_template_module FROM talert_template_module_actions WHERE id_alert_action = '.$actionID.') OR talert_template_modules.id IN (SELECT id FROM talert_template_modules ttm WHERE ttm.id_alert_template IN (SELECT tat.id FROM talert_templates tat WHERE tat.id_alert_action = '.$actionID.'))'; $where .= ' AND (talert_template_modules.id IN (SELECT id_alert_template_module FROM talert_template_module_actions WHERE id_alert_action = '.$actionID.') OR talert_template_modules.id IN (SELECT id FROM talert_template_modules ttm WHERE ttm.id_alert_template IN (SELECT tat.id FROM talert_templates tat WHERE tat.id_alert_action = '.$actionID.')))';
} }
if ($status_alert === 'disabled') { if ($status_alert === 'disabled') {

View File

@ -353,9 +353,18 @@ if ($delete_action) {
if ($enable_alert) { if ($enable_alert) {
$searchFlag = true; $searchFlag = true;
$id_alert = (int) get_parameter('id_alert'); $id_alert = (int) get_parameter('id_alert');
$id_agente = ($id_agente !== 0) ? $id_agente : alerts_get_agent_by_alert($id_alert);
$result = alerts_agent_module_disable($id_alert, false); $result = alerts_agent_module_disable($id_alert, false);
if ($id_agente) {
db_process_sql(
'UPDATE tagente
SET update_alert_count = 1
WHERE id_agente = '.$id_agente
);
}
if ($result) { if ($result) {
db_pandora_audit( db_pandora_audit(
AUDIT_LOG_ALERT_MANAGEMENT, AUDIT_LOG_ALERT_MANAGEMENT,
@ -380,9 +389,18 @@ if ($enable_alert) {
if ($disable_alert) { if ($disable_alert) {
$searchFlag = true; $searchFlag = true;
$id_alert = (int) get_parameter('id_alert'); $id_alert = (int) get_parameter('id_alert');
$id_agente = ($id_agente !== 0) ? $id_agente : alerts_get_agent_by_alert($id_alert);
$result = alerts_agent_module_disable($id_alert, true); $result = alerts_agent_module_disable($id_alert, true);
if ($id_agente) {
db_process_sql(
'UPDATE tagente
SET update_alert_count = 1
WHERE id_agente = '.$id_agente
);
}
if ($result) { if ($result) {
db_pandora_audit( db_pandora_audit(
AUDIT_LOG_ALERT_MANAGEMENT, AUDIT_LOG_ALERT_MANAGEMENT,

View File

@ -66,6 +66,7 @@ if ($id) {
$severity = explode(',', $filter['severity']); $severity = explode(',', $filter['severity']);
$status = $filter['status']; $status = $filter['status'];
$search = $filter['search']; $search = $filter['search'];
$not_search = $filter['not_search'];
$text_agent = $filter['text_agent']; $text_agent = $filter['text_agent'];
$id_agent = $filter['id_agent']; $id_agent = $filter['id_agent'];
$text_module = $filter['text_module']; $text_module = $filter['text_module'];
@ -73,6 +74,7 @@ if ($id) {
$pagination = $filter['pagination']; $pagination = $filter['pagination'];
$event_view_hr = $filter['event_view_hr']; $event_view_hr = $filter['event_view_hr'];
$id_user_ack = $filter['id_user_ack']; $id_user_ack = $filter['id_user_ack'];
$owner_user = $filter['owner_user'];
$group_rep = $filter['group_rep']; $group_rep = $filter['group_rep'];
$date_from = str_replace('-', '/', $filter['date_from']); $date_from = str_replace('-', '/', $filter['date_from']);
$date_to = str_replace('-', '/', $filter['date_to']); $date_to = str_replace('-', '/', $filter['date_to']);
@ -107,6 +109,8 @@ if ($id) {
$text_agent = ''; $text_agent = '';
} }
} }
$server_id = ($filter['server_id'] ?? '');
} else { } else {
$id_group = ''; $id_group = '';
$id_group_filter = ''; $id_group_filter = '';
@ -115,10 +119,12 @@ if ($id) {
$severity = ''; $severity = '';
$status = ''; $status = '';
$search = ''; $search = '';
$not_search = 0;
$text_agent = ''; $text_agent = '';
$pagination = ''; $pagination = '';
$event_view_hr = ''; $event_view_hr = '';
$id_user_ack = ''; $id_user_ack = '';
$owner_user = '';
$group_rep = ''; $group_rep = '';
$date_from = ''; $date_from = '';
$date_to = ''; $date_to = '';
@ -130,6 +136,7 @@ if ($id) {
$filter_only_alert = ''; $filter_only_alert = '';
$search_secondary_groups = 0; $search_secondary_groups = 0;
$search_recursive_groups = 0; $search_recursive_groups = 0;
$server_id = '';
} }
if ($update || $create) { if ($update || $create) {
@ -140,6 +147,7 @@ if ($update || $create) {
$severity = implode(',', get_parameter('severity', -1)); $severity = implode(',', get_parameter('severity', -1));
$status = get_parameter('status', ''); $status = get_parameter('status', '');
$search = get_parameter('search', ''); $search = get_parameter('search', '');
$not_search = get_parameter_switch('not_search', 0);
$text_agent = get_parameter('text_agent', ''); $text_agent = get_parameter('text_agent', '');
$id_agent = (int) get_parameter('id_agent'); $id_agent = (int) get_parameter('id_agent');
$text_module = get_parameter('text_module', ''); $text_module = get_parameter('text_module', '');
@ -157,6 +165,7 @@ if ($update || $create) {
$pagination = get_parameter('pagination', ''); $pagination = get_parameter('pagination', '');
$event_view_hr = get_parameter('event_view_hr', ''); $event_view_hr = get_parameter('event_view_hr', '');
$id_user_ack = get_parameter('id_user_ack', ''); $id_user_ack = get_parameter('id_user_ack', '');
$owner_user = get_parameter('owner_user', '');
$group_rep = get_parameter('group_rep', ''); $group_rep = get_parameter('group_rep', '');
$date_from = get_parameter('date_from', ''); $date_from = get_parameter('date_from', '');
$date_to = get_parameter('date_to', ''); $date_to = get_parameter('date_to', '');
@ -177,6 +186,12 @@ if ($update || $create) {
$custom_data = get_parameter('custom_data', ''); $custom_data = get_parameter('custom_data', '');
$custom_data_filter_type = get_parameter('custom_data_filter_type', ''); $custom_data_filter_type = get_parameter('custom_data_filter_type', '');
$server_id = '';
if (is_metaconsole() === true) {
$servers_array = get_parameter('server_id', []);
$server_id = implode(',', $servers_array);
}
$values = [ $values = [
'id_name' => $id_name, 'id_name' => $id_name,
'id_group_filter' => $id_group_filter, 'id_group_filter' => $id_group_filter,
@ -185,12 +200,14 @@ if ($update || $create) {
'severity' => $severity, 'severity' => $severity,
'status' => $status, 'status' => $status,
'search' => $search, 'search' => $search,
'not_search' => $not_search,
'text_agent' => $text_agent, 'text_agent' => $text_agent,
'id_agent_module' => $id_agent_module, 'id_agent_module' => $id_agent_module,
'id_agent' => $id_agent, 'id_agent' => $id_agent,
'pagination' => $pagination, 'pagination' => $pagination,
'event_view_hr' => $event_view_hr, 'event_view_hr' => $event_view_hr,
'id_user_ack' => $id_user_ack, 'id_user_ack' => $id_user_ack,
'owner_user' => $owner_user,
'group_rep' => $group_rep, 'group_rep' => $group_rep,
'tag_with' => $tag_with_json, 'tag_with' => $tag_with_json,
'tag_without' => $tag_without_json, 'tag_without' => $tag_without_json,
@ -204,6 +221,7 @@ if ($update || $create) {
'search_recursive_groups' => $search_recursive_groups, 'search_recursive_groups' => $search_recursive_groups,
'custom_data' => $custom_data, 'custom_data' => $custom_data,
'custom_data_filter_type' => $custom_data_filter_type, 'custom_data_filter_type' => $custom_data_filter_type,
'server_id' => $server_id,
]; ];
$severity = explode(',', $severity); $severity = explode(',', $severity);
@ -376,6 +394,15 @@ $table->data[6][1] = html_print_input_text(
255, 255,
true true
); );
$table->data[6][1] .= ' '.html_print_checkbox_switch(
'not_search',
$not_search,
$not_search,
true,
false,
'checked_slide_events(this);',
true
);
$table->data[7][0] = '<b>'.__('Agent search').'</b>'; $table->data[7][0] = '<b>'.__('Agent search').'</b>';
$params = []; $params = [];
@ -420,7 +447,12 @@ $table->data[9][1] = html_print_input_text(
true true
); );
$table->data[10][0] = '<b>'.__('User ack.').'</b>'.' '.ui_print_help_tip(__('Choose between the users who have validated an event. '), true); $table->data[10][0] = '<b>'.__('User ack.').'</b>';
$table->data[10][0] .= ' ';
$table->data[10][0] .= ui_print_help_tip(
__('Choose between the users who have validated an event. '),
true
);
if ($strict_user) { if ($strict_user) {
$users = [$config['id_user'] => $config['id_user']]; $users = [$config['id_user'] => $config['id_user']];
@ -442,14 +474,25 @@ $table->data[10][1] = html_print_select(
true true
); );
$table->data[11][0] = '<b>'.__('Owner.').'</b>';
$table->data[11][1] = html_print_select(
$users,
'owner_user',
$owner_user,
'',
__('Any'),
0,
true
);
$repeated_sel = [ $repeated_sel = [
EVENT_GROUP_REP_ALL => __('All events'), EVENT_GROUP_REP_ALL => __('All events'),
EVENT_GROUP_REP_EVENTS => __('Group events'), EVENT_GROUP_REP_EVENTS => __('Group events'),
EVENT_GROUP_REP_AGENTS => __('Group agents'), EVENT_GROUP_REP_AGENTS => __('Group agents'),
EVENT_GROUP_REP_EXTRAIDS => __('Group extra id'), EVENT_GROUP_REP_EXTRAIDS => __('Group extra id'),
]; ];
$table->data[11][0] = '<b>'.__('Repeated').'</b>'; $table->data[12][0] = '<b>'.__('Repeated').'</b>';
$table->data[11][1] = html_print_select( $table->data[12][1] = html_print_select(
$repeated_sel, $repeated_sel,
'group_rep', 'group_rep',
$group_rep, $group_rep,
@ -459,11 +502,11 @@ $table->data[11][1] = html_print_select(
true true
); );
$table->data[12][0] = '<b>'.__('Date from').'</b>'; $table->data[13][0] = '<b>'.__('Date from').'</b>';
$table->data[12][1] = html_print_input_text('date_from', $date_from, '', 15, 10, true); $table->data[13][1] = html_print_input_text('date_from', $date_from, '', 15, 10, true);
$table->data[13][0] = '<b>'.__('Date to').'</b>'; $table->data[14][0] = '<b>'.__('Date to').'</b>';
$table->data[13][1] = html_print_input_text('date_to', $date_to, '', 15, 10, true); $table->data[14][1] = html_print_input_text('date_to', $date_to, '', 15, 10, true);
$tag_with = json_decode($tag_with_json_clean, true); $tag_with = json_decode($tag_with_json_clean, true);
if (empty($tag_with)) { if (empty($tag_with)) {
@ -502,9 +545,9 @@ $remove_with_tag_disabled = empty($tag_with_temp);
$add_without_tag_disabled = empty($tags_select_without); $add_without_tag_disabled = empty($tags_select_without);
$remove_without_tag_disabled = empty($tag_without_temp); $remove_without_tag_disabled = empty($tag_without_temp);
$table->colspan[14][0] = '2'; $table->colspan[15][0] = '2';
$table->data[14][0] = '<b>'.__('Events with following tags').'</b>'; $table->data[15][0] = '<b>'.__('Events with following tags').'</b>';
$table->data[15][0] = html_print_select( $table->data[16][0] = html_print_select(
$tags_select_with, $tags_select_with,
'select_with', 'select_with',
'', '',
@ -518,7 +561,7 @@ $table->data[15][0] = html_print_select(
false, false,
'width: 220px;' 'width: 220px;'
); );
$table->data[15][1] = html_print_button( $table->data[16][1] = html_print_button(
__('Add'), __('Add'),
'add_whith', 'add_whith',
$add_with_tag_disabled, $add_with_tag_disabled,
@ -527,7 +570,7 @@ $table->data[15][1] = html_print_button(
true true
); );
$table->data[16][0] = html_print_select( $table->data[17][0] = html_print_select(
$tag_with_temp, $tag_with_temp,
'tag_with_temp', 'tag_with_temp',
[], [],
@ -541,12 +584,12 @@ $table->data[16][0] = html_print_select(
false, false,
'width: 220px; height: 50px;' 'width: 220px; height: 50px;'
); );
$table->data[16][0] .= html_print_input_hidden( $table->data[17][0] .= html_print_input_hidden(
'tag_with', 'tag_with',
$tag_with_base64, $tag_with_base64,
true true
); );
$table->data[16][1] = html_print_button( $table->data[17][1] = html_print_button(
__('Remove'), __('Remove'),
'remove_whith', 'remove_whith',
$remove_with_tag_disabled, $remove_with_tag_disabled,
@ -555,9 +598,9 @@ $table->data[16][1] = html_print_button(
true true
); );
$table->colspan[17][0] = '2'; $table->colspan[18][0] = '2';
$table->data[17][0] = '<b>'.__('Events without following tags').'</b>'; $table->data[18][0] = '<b>'.__('Events without following tags').'</b>';
$table->data[18][0] = html_print_select( $table->data[19][0] = html_print_select(
$tags_select_without, $tags_select_without,
'select_without', 'select_without',
'', '',
@ -571,7 +614,7 @@ $table->data[18][0] = html_print_select(
false, false,
'width: 220px;' 'width: 220px;'
); );
$table->data[18][1] = html_print_button( $table->data[19][1] = html_print_button(
__('Add'), __('Add'),
'add_whithout', 'add_whithout',
$add_without_tag_disabled, $add_without_tag_disabled,
@ -580,7 +623,7 @@ $table->data[18][1] = html_print_button(
true true
); );
$table->data[19][0] = html_print_select( $table->data[20][0] = html_print_select(
$tag_without_temp, $tag_without_temp,
'tag_without_temp', 'tag_without_temp',
[], [],
@ -594,12 +637,12 @@ $table->data[19][0] = html_print_select(
false, false,
'width: 220px; height: 50px;' 'width: 220px; height: 50px;'
); );
$table->data[19][0] .= html_print_input_hidden( $table->data[20][0] .= html_print_input_hidden(
'tag_without', 'tag_without',
$tag_without_base64, $tag_without_base64,
true true
); );
$table->data[19][1] = html_print_button( $table->data[20][1] = html_print_button(
__('Remove'), __('Remove'),
'remove_whithout', 'remove_whithout',
$remove_without_tag_disabled, $remove_without_tag_disabled,
@ -608,8 +651,8 @@ $table->data[19][1] = html_print_button(
true true
); );
$table->data[20][0] = '<b>'.__('Alert events').'</b>'; $table->data[21][0] = '<b>'.__('Alert events').'</b>';
$table->data[20][1] = html_print_select( $table->data[21][1] = html_print_select(
[ [
'-1' => __('All'), '-1' => __('All'),
'0' => __('Filter alert events'), '0' => __('Filter alert events'),
@ -624,8 +667,8 @@ $table->data[20][1] = html_print_select(
); );
if (!is_metaconsole()) { if (!is_metaconsole()) {
$table->data[21][0] = '<b>'.__('Module search').'</b>'; $table->data[22][0] = '<b>'.__('Module search').'</b>';
$table->data[21][1] .= html_print_autocomplete_modules( $table->data[22][1] .= html_print_autocomplete_modules(
'module_search', 'module_search',
$text_module, $text_module,
false, false,
@ -637,17 +680,17 @@ if (!is_metaconsole()) {
); );
} }
$table->data[22][0] = '<b>'.__('Source').'</b>'; $table->data[23][0] = '<b>'.__('Source').'</b>';
$table->data[22][1] = html_print_input_text('source', $source, '', 35, 255, true); $table->data[23][1] = html_print_input_text('source', $source, '', 35, 255, true);
$table->data[23][0] = '<b>'.__('Extra ID').'</b>'; $table->data[24][0] = '<b>'.__('Extra ID').'</b>';
$table->data[23][1] = html_print_input_text('id_extra', $id_extra, '', 11, 255, true); $table->data[24][1] = html_print_input_text('id_extra', $id_extra, '', 11, 255, true);
$table->data[24][0] = '<b>'.__('Comment').'</b>'; $table->data[25][0] = '<b>'.__('Comment').'</b>';
$table->data[24][1] = html_print_input_text('user_comment', $user_comment, '', 35, 255, true); $table->data[25][1] = html_print_input_text('user_comment', $user_comment, '', 35, 255, true);
$table->data[25][0] = '<b>'.__('Custom data filter type').'</b>'; $table->data[26][0] = '<b>'.__('Custom data filter type').'</b>';
$table->data[25][1] = html_print_select( $table->data[26][1] = html_print_select(
[ [
'0' => __('Filter custom data by name field'), '0' => __('Filter custom data by name field'),
'1' => __('Filter custom data by value field'), '1' => __('Filter custom data by value field'),
@ -660,12 +703,12 @@ $table->data[25][1] = html_print_select(
true true
); );
$table->data[26][0] = '<b>'.__('Custom data').'</b>'; $table->data[27][0] = '<b>'.__('Custom data').'</b>';
$table->data[26][1] = html_print_input_text('custom_data', $custom_data, '', 35, 255, true); $table->data[27][1] = html_print_input_text('custom_data', $custom_data, '', 35, 255, true);
if (is_metaconsole()) { if (is_metaconsole()) {
$table->data[27][0] = '<b>'.__('Id souce event').'</b>'; $table->data[28][0] = '<b>'.__('Id souce event').'</b>';
$table->data[27][1] = html_print_input_text( $table->data[28][1] = html_print_input_text(
'id_source_event', 'id_source_event',
$id_source_event, $id_source_event,
'', '',
@ -675,6 +718,55 @@ if (is_metaconsole()) {
); );
} }
if (is_metaconsole() === true) {
$servers = metaconsole_get_servers();
if (is_array($servers) === true) {
$servers = array_reduce(
$servers,
function ($carry, $item) {
$carry[$item['id']] = $item['server_name'];
return $carry;
}
);
} else {
$servers = [];
}
$servers[0] = __('Metaconsola');
if ($server_id === '') {
$server_id = array_keys($servers);
} else {
if (is_array($server_id) === false) {
if (is_numeric($server_id) === true) {
if ($server_id !== 0) {
$server_id = [$server_id];
} else {
$server_id = array_keys($servers);
}
} else {
$server_id = explode(',', $server_id);
}
}
}
$table->data[29][0] = '<b>'.__('Server').'</b>';
$table->data[29][1] = html_print_select(
$servers,
'server_id[]',
$server_id,
'',
'',
0,
true,
true,
true,
'',
false,
'height: 60px;'
);
}
echo '<form method="post" action="index.php?sec=geventos&sec2=godmode/events/events&section=edit_filter&pure='.$config['pure'].'">'; echo '<form method="post" action="index.php?sec=geventos&sec2=godmode/events/events&section=edit_filter&pure='.$config['pure'].'">';
html_print_table($table); html_print_table($table);
@ -727,6 +819,14 @@ $(document).ready( function() {
}); });
function checked_slide_events(element) {
var value = $("#checkbox-"+element.name).val();
if (value == 0) {
$("#checkbox-"+element.name).val(1);
} else {
$("#checkbox-"+element.name).val(0);
}
}
function click_button_remove_tag(what_button) { function click_button_remove_tag(what_button) {
if (what_button == "with") { if (what_button == "with") {

View File

@ -92,6 +92,7 @@ if (is_ajax() === true) {
if ($get_group_agents === true) { if ($get_group_agents === true) {
ob_clean(); ob_clean();
$id_group = (int) get_parameter('id_group'); $id_group = (int) get_parameter('id_group');
$id_os = (int) get_parameter('id_os', 0);
$disabled = (int) get_parameter('disabled', 0); $disabled = (int) get_parameter('disabled', 0);
$search = (string) get_parameter('search', ''); $search = (string) get_parameter('search', '');
$recursion = (int) get_parameter('recursion', 0); $recursion = (int) get_parameter('recursion', 0);
@ -151,6 +152,10 @@ if (is_ajax() === true) {
$filter['status'] = $status_agents; $filter['status'] = $status_agents;
} }
if ($id_os !== 0) {
$filter['id_os'] = $id_os;
}
$_sql_post = ' 1=1 '; $_sql_post = ' 1=1 ';
if ($show_void_agents == 0) { if ($show_void_agents == 0) {
$_sql_post .= ' AND id_agente IN (SELECT a.id_agente FROM tagente a, tagente_modulo b WHERE a.id_agente=b.id_agente AND b.delete_pending=0) AND \'1\''; $_sql_post .= ' AND id_agente IN (SELECT a.id_agente FROM tagente a, tagente_modulo b WHERE a.id_agente=b.id_agente AND b.delete_pending=0) AND \'1\'';
@ -782,18 +787,18 @@ if ($tab == 'tree') {
$form = "<form method='post' action=''>"; $form = "<form method='post' action=''>";
$form .= "<table class='databox filters bolder' width='100%'>"; $form .= "<table class='databox filters bolder' width='100%'>";
$form .= '<tr><td>'.__('Search').'&nbsp;'; $form .= '<tr><td>'.__('Search').'&nbsp;&nbsp;&nbsp;';
$form .= html_print_input_text( $form .= html_print_input_text(
'search', 'search',
$search, $search,
'', '',
100, 30,
100, 30,
true true
); );
$form .= '</td><td>'; $form .= '</td><td style="text-align: right">';
$form .= "<input name='find' type='submit' class='sub search' value='".__('Search')."'>"; $form .= "<input name='find' type='submit' class='sub search' value='".__('Search')."'>";
$form .= '<td></tr>'; $form .= '</tr>';
$form .= '</table>'; $form .= '</table>';
$form .= '</form>'; $form .= '</form>';

View File

@ -181,6 +181,7 @@ if (empty($alert_templates)) {
$alert_templates = ''; $alert_templates = '';
} }
$table = new stdClass();
$table->id = 'delete_table'; $table->id = 'delete_table';
$table->width = '98%'; $table->width = '98%';
$table->data = []; $table->data = [];

View File

@ -192,6 +192,7 @@ if (!$own_info['is_admin'] && !check_acl($config['id_user'], 0, 'AW')) {
$return_all_group = true; $return_all_group = true;
} }
$table = new stdClass();
$table->id = 'delete_table'; $table->id = 'delete_table';
$table->class = 'databox filters'; $table->class = 'databox filters';
$table->width = '100%'; $table->width = '100%';

View File

@ -249,6 +249,7 @@ if (!$own_info['is_admin'] && !check_acl($config['id_user'], 0, 'AW')) {
$return_all_group = true; $return_all_group = true;
} }
$table = new stdClass();
$table->id = 'delete_table'; $table->id = 'delete_table';
$table->class = 'databox filters'; $table->class = 'databox filters';
$table->width = '100%'; $table->width = '100%';

View File

@ -148,6 +148,7 @@ if (!$own_info['is_admin'] && !check_acl($config['id_user'], 0, 'AW')) {
$return_all_group = true; $return_all_group = true;
} }
$table = new stdClass();
$table->id = 'delete_table'; $table->id = 'delete_table';
$table->class = 'databox filters'; $table->class = 'databox filters';
$table->width = '100%'; $table->width = '100%';

View File

@ -164,6 +164,7 @@ if (!$own_info['is_admin'] && !check_acl($config['id_user'], 0, 'AW')) {
$return_all_group = true; $return_all_group = true;
} }
$table = new stdClass();
$table->id = 'delete_table'; $table->id = 'delete_table';
$table->class = 'databox filters'; $table->class = 'databox filters';
$table->width = '100%'; $table->width = '100%';

View File

@ -1,4 +1,5 @@
<?php <?php
/** /**
* Godmode menu. * Godmode menu.
* *
@ -180,7 +181,9 @@ if ($access_console_node === true) {
$sub2['godmode/modules/manage_network_components']['id'] = 'Network components'; $sub2['godmode/modules/manage_network_components']['id'] = 'Network components';
$sub['templates']['sub2'] = $sub2; $sub['templates']['sub2'] = $sub2;
enterprise_hook('inventory_submenu'); $sub['godmode/modules/manage_inventory_modules']['text'] = __('Inventory modules');
$sub['godmode/modules/manage_inventory_modules']['id'] = 'Inventory modules';
enterprise_hook('autoconfiguration_menu'); enterprise_hook('autoconfiguration_menu');
enterprise_hook('agent_repository_menu'); enterprise_hook('agent_repository_menu');
} }
@ -200,14 +203,14 @@ if ($access_console_node === true) {
$sub['gmassive']['type'] = 'direct'; $sub['gmassive']['type'] = 'direct';
$sub['gmassive']['subtype'] = 'nolink'; $sub['gmassive']['subtype'] = 'nolink';
$sub2 = []; $sub2 = [];
$sub2['godmode/massive/massive_operations&amp;tab=massive_agents']['text'] = __('Agents operations'); $sub2['godmode/massive/massive_operations&tab=massive_agents']['text'] = __('Agents operations');
$sub2['godmode/massive/massive_operations&amp;tab=massive_modules']['text'] = __('Modules operations'); $sub2['godmode/massive/massive_operations&tab=massive_modules']['text'] = __('Modules operations');
$sub2['godmode/massive/massive_operations&amp;tab=massive_plugins']['text'] = __('Plugins operations'); $sub2['godmode/massive/massive_operations&tab=massive_plugins']['text'] = __('Plugins operations');
if ((bool) check_acl($config['id_user'], 0, 'UM') === true) { if ((bool) check_acl($config['id_user'], 0, 'UM') === true) {
$sub2['godmode/massive/massive_operations&amp;tab=massive_users']['text'] = __('Users operations'); $sub2['godmode/massive/massive_operations&tab=massive_users']['text'] = __('Users operations');
} }
$sub2['godmode/massive/massive_operations&amp;tab=massive_alerts']['text'] = __('Alerts operations'); $sub2['godmode/massive/massive_operations&tab=massive_alerts']['text'] = __('Alerts operations');
enterprise_hook('massivepolicies_submenu'); enterprise_hook('massivepolicies_submenu');
enterprise_hook('massivesnmp_submenu'); enterprise_hook('massivesnmp_submenu');
enterprise_hook('massivesatellite_submenu'); enterprise_hook('massivesatellite_submenu');
@ -422,10 +425,10 @@ if ((bool) check_acl($config['id_user'], 0, 'PM') === true || (bool) check_acl($
if (is_user_admin($config['id_user']) === true) { if (is_user_admin($config['id_user']) === true) {
$sub['extensions/db_status']['text'] = __('DB Schema Check'); $sub['extensions/db_status']['text'] = __('DB Schema Check');
$sub['extensions/db_status']['id'] = 'DB Schema Check'; $sub['extensions/db_status']['id'] = 'DB Schema Check';
$sub['extensions/db_status']['sec'] = 'gbman'; $sub['extensions/db_status']['sec'] = 'gextensions';
$sub['extensions/dbmanager']['text'] = __('DB Interface'); $sub['extensions/dbmanager']['text'] = __('DB Interface');
$sub['extensions/dbmanager']['id'] = 'DB Interface'; $sub['extensions/dbmanager']['id'] = 'DB Interface';
$sub['extensions/dbmanager']['sec'] = 'gbman'; $sub['extensions/dbmanager']['sec'] = 'gextensions';
enterprise_hook('dbBackupManager'); enterprise_hook('dbBackupManager');
enterprise_hook('elasticsearch_interface_menu'); enterprise_hook('elasticsearch_interface_menu');
} }
@ -578,6 +581,14 @@ if ($access_console_node === true) {
} }
} }
if ($access_console_node === true) {
// About.
$menu_godmode['about']['text'] = __('About');
$menu_godmode['about']['id'] = 'about';
}
if ((bool) $config['pure'] === false) { if ((bool) $config['pure'] === false) {
menu_print_menu($menu_godmode); menu_print_menu($menu_godmode);
} }
echo '<div id="about-div"></div>';

View File

@ -0,0 +1,393 @@
<?php
// ______ __ _______ _______ _______
// | __ \.---.-.-----.--| |.-----.----.---.-. | ___| | | __|
// | __/| _ | | _ || _ | _| _ | | ___| |__ |
// |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
//
// ============================================================================
// Copyright (c) 2007-2021 Artica Soluciones Tecnologicas, http://www.artica.es
// This code is NOT free software. This code is NOT licenced under GPL2 licence
// You cannnot redistribute it without written permission of copyright holder.
// ============================================================================
// Load global variables
global $config;
// Check user credentials.
check_login();
if (! check_acl($config['id_user'], 0, 'PM') && ! check_acl($config['id_user'], 0, 'AW')) {
db_pandora_audit(
AUDIT_LOG_ACL_VIOLATION,
'Trying to access Inventory Module Management'
);
include 'general/noaccess.php';
return;
}
require_once $config['homedir'].'/include/functions_inventory.php';
enterprise_include_once('include/functions_metaconsole.php');
$management_allowed = is_management_allowed();
// Header.
if (is_metaconsole() === true) {
$sec = 'advanced';
enterprise_include_once('meta/include/functions_components_meta.php');
enterprise_hook('open_meta_frame');
components_meta_print_header();
if ($management_allowed === false) {
ui_print_warning_message(__('To manage inventory plugin you must activate centralized management'));
}
} else {
$sec = 'gmodules';
ui_print_page_header(
__('Module management').' &raquo; '.__('Inventory modules'),
'images/page_white_text.png',
false,
'',
true
);
if ($management_allowed === false) {
if (is_metaconsole() === false) {
$url = '<a target="_blank" href="'.ui_get_meta_url(
'index.php?sec=advanced&sec2=godmode/modules/manage_inventory_modules'
).'">'.__('metaconsole').'</a>';
} else {
$url = __('any node');
}
ui_print_warning_message(
__(
'This console is not manager of this environment, please manage this feature from centralized manager console. Go to %s to manage it.',
$url
)
);
}
}
$is_windows = strtoupper(substr(PHP_OS, 0, 3)) == 'WIN';
if ($is_windows) {
ui_print_error_message(__('Not supported in Windows systems'));
}
// Initialize variables.
$offset = (int) get_parameter('offset');
$create_module_inventory = (bool) get_parameter('create_module_inventory');
$update_module_inventory = (bool) get_parameter('update_module_inventory');
$delete_inventory_module = (int) get_parameter('delete_inventory_module');
$multiple_delete = (bool) get_parameter('multiple_delete', 0);
$id_module_inventory = (int) get_parameter('id_module_inventory');
$name = (string) get_parameter('name');
$description = (string) get_parameter('description');
$id_os = (int) get_parameter('id_os');
if ($id_os == 0) {
$id_os = 'NULL';
}
$interpreter = (string) get_parameter('interpreter');
$script_mode = (string) get_parameter('script_mode');
$code = (string) get_parameter('code');
$code = base64_encode(str_replace("\r", '', html_entity_decode($code, ENT_QUOTES)));
$format = (string) get_parameter('format');
$block_mode = (int) get_parameter('block_mode', 0);
$script_path = (string) get_parameter('script_path');
// Create inventory module.
if ($create_module_inventory === true) {
$values = [
'name' => $name,
'description' => $description,
'id_os' => $id_os,
'interpreter' => $interpreter,
'code' => $code,
'data_format' => $format,
'block_mode' => $block_mode,
'script_mode' => $script_mode,
'script_path' => $script_path,
];
$result = (bool) inventory_create_inventory_module($values);
$auditMessage = ((bool) $result === true) ? sprintf('Create inventory module #%s', $result) : 'Fail try to create inventory module';
db_pandora_audit(
AUDIT_LOG_MODULE_MANAGEMENT,
$auditMessage
);
ui_print_result_message(
(bool) $result,
__('Successfully created inventory module'),
__('Error creating inventory module')
);
// Update inventory module.
} else if ($update_module_inventory === true) {
$values = [
'name' => $name,
'description' => $description,
'id_os' => $id_os,
'interpreter' => $interpreter,
'code' => $code,
'data_format' => $format,
'block_mode' => $block_mode,
'script_mode' => $script_mode,
'script_path' => $script_path,
];
$result = inventory_update_inventory_module($id_module_inventory, $values);
$auditMessage = ((bool) $result === true) ? 'Update inventory module' : 'Fail try to update inventory module';
db_pandora_audit(
AUDIT_LOG_MODULE_MANAGEMENT,
sprintf('%s #%s', $auditMessage, $id_module_inventory)
);
ui_print_result_message(
(bool) $result,
__('Successfully updated inventory module'),
__('Error updating inventory module')
);
// Delete inventory module.
} else if ((bool) $delete_inventory_module === true) {
$result = db_process_sql_delete(
'tmodule_inventory',
['id_module_inventory' => $delete_inventory_module]
);
$auditMessage = ((bool) $result === true) ? 'Delete inventory module' : 'Fail try to delete inventory module';
db_pandora_audit(
AUDIT_LOG_MODULE_MANAGEMENT,
sprintf('%s #%s', $auditMessage, $id_module_inventory)
);
ui_print_result_message(
(bool) $result,
__('Successfully deleted inventory module'),
__('Error deleting inventory module')
);
if (is_metaconsole() === true) {
$setups = db_get_all_rows_in_table('tmetaconsole_setup');
foreach ($setups as $key => $setup) {
if (metaconsole_connect($setup) == NOERR) {
$result = db_process_sql_delete(
'tmodule_inventory',
['id_module_inventory' => $delete_inventory_module]
);
$auditMessage = ((bool) $result === true) ? 'Delete inventory module' : 'Fail try to delete inventory module';
db_pandora_audit(
AUDIT_LOG_MODULE_MANAGEMENT,
sprintf('%s #%s', $auditMessage, $id_module_inventory)
);
ui_print_result_message(
(bool) $result,
$setup['server_name'].': '.__('Successfully deleted inventory module'),
$setup['server_name'].': '.__('Error deleting inventory module')
);
}
metaconsole_restore_db();
}
}
} else if ($multiple_delete) {
$ids = (array) get_parameter('delete_multiple', []);
foreach ($ids as $id) {
$result = db_process_sql_delete('tmodule_inventory', ['id_module_inventory' => $id]);
if ($result === false) {
break;
}
}
if ($result !== false) {
$result = true;
} else {
$result = false;
}
$str_ids = implode(',', $ids);
$auditMessage = ($result === true) ? 'Multiple delete inventory module' : 'Fail try to delete inventory module';
db_pandora_audit(
AUDIT_LOG_MODULE_MANAGEMENT,
sprintf('%s :%s', $auditMessage, $str_ids)
);
ui_print_result_message(
$result,
__('Successfully multiple deleted'),
__('Not deleted. Error deleting multiple data')
);
$id = 0;
if (is_metaconsole()) {
$setups = db_get_all_rows_in_table('tmetaconsole_setup');
foreach ($setups as $key => $setup) {
if (metaconsole_connect($setup) == NOERR) {
foreach ($ids as $id) {
$result_node = db_process_sql_delete('tmodule_inventory', ['id_module_inventory' => $id]);
if ($result_node === false) {
break;
}
}
if ($result_node !== false) {
$result_node = true;
} else {
$result_node = false;
}
$str_ids = implode(',', $ids);
$auditMessage = ($result_node === true) ? 'Multiple delete inventory module' : 'Fail try to delete inventory module';
db_pandora_audit(
AUDIT_LOG_MODULE_MANAGEMENT,
sprintf('%s :%s', $auditMessage, $str_ids)
);
ui_print_result_message(
$result_node,
$setup['server_name'].': '.__('Successfully multiple deleted'),
$setup['server_name'].': '.__('Not deleted. Error deleting multiple data')
);
}
metaconsole_restore_db();
}
}
}
$total_modules = db_get_sql('SELECT COUNT(*) FROM tmodule_inventory');
$table = new stdClass();
$table->width = '100%';
$table->class = 'info_table';
$table->size = [];
$table->size[0] = '140px';
$table->align = [];
$table->align[2] = 'left';
$table->align[4] = 'left';
$table->data = [];
$table->head = [];
$table->head[0] = __('Name');
$table->head[1] = __('Description');
$table->head[2] = __('OS');
$table->head[3] = __('Interpreter');
if ($management_allowed === true) {
$table->head[4] = __('Action').html_print_checkbox('all_delete', 0, false, true, false);
}
$result = inventory_get_modules_list($offset);
if ($result === false) {
ui_print_info_message(['no_close' => true, 'message' => __('No inventory modules defined') ]);
} else {
$status = '';
$begin = true;
while ($row = array_shift($result)) {
$data = [];
$begin = false;
if ($management_allowed === true) {
$data[0] = '<strong><a href="index.php?sec='.$sec.'&sec2=godmode/modules/manage_inventory_modules_form&id_module_inventory='.$row['id_module_inventory'].'">'.$row['name'].'</a></strong>';
} else {
$data[0] = '<strong>'.$row['name'].'</strong>';
}
$data[1] = $row['description'];
if ($row['os_name'] == null) {
$data[2] = html_print_image('images/agent.png', true, ['border' => '0', 'alt' => __('Agent'), 'title' => __('Agent'), 'height' => '18', 'class' => 'invert_filter']);
} else {
$data[2] = ui_print_os_icon($row['id_os'], false, true);
}
if ($row['interpreter'] == '') {
$data[3] = __('Local module');
} else {
$data[3] = __('Remote/Local');
}
if ($management_allowed === true) {
// Update module.
$data[4] = '<a href="index.php?sec='.$sec.'&sec2=godmode/modules/manage_inventory_modules_form&id_module_inventory='.$row['id_module_inventory'].'">';
$data[4] .= html_print_image('images/config.png', true, ['border' => '0', 'title' => __('Update'), 'class' => 'invert_filter']).'</b></a>';
// Delete module.
$data[4] .= '<a href="index.php?sec='.$sec.'&sec2=godmode/modules/manage_inventory_modules&delete_inventory_module='.$row['id_module_inventory'].'" onClick="if (!confirm(\''.__('Are you sure?').'\')) return false;">';
$data[4] .= html_print_image('images/cross.png', true, ['border' => '0', 'title' => __('Delete'), 'class' => 'invert_filter']);
$data[4] .= '</b></a>&nbsp;&nbsp;';
$data[4] .= html_print_checkbox_extended('delete_multiple[]', $row['id_module_inventory'], false, false, '', 'class="check_delete"', true);
}
array_push($table->data, $data);
}
echo "<form method='post' action='index.php?sec=".$sec."&sec2=godmode/modules/manage_inventory_modules'>";
html_print_input_hidden('multiple_delete', 1);
ui_pagination($total_modules, 'index.php?sec='.$sec.'&sec2=godmode/modules/manage_inventory_modules', $offset);
html_print_table($table);
ui_pagination($total_modules, 'index.php?sec='.$sec.'&sec2=godmode/modules/manage_inventory_modules', $offset, 0, false, 'offset', true, 'pagination-bottom');
echo "<div class='pdd_l_5px float-right'>";
if ($management_allowed === true) {
html_print_submit_button(__('Delete'), 'delete_btn', false, 'class="sub delete"');
}
echo '</div>';
echo '</form>';
}
if ($management_allowed === true) {
echo '<form method="post" action="index.php?sec='.$sec.'&sec2=godmode/modules/manage_inventory_modules_form">';
echo '<div class="float-right mrgn_btn_15px">';
html_print_input_hidden('create_module_inventory', 1);
html_print_submit_button(__('Create'), 'crt', false, 'class="sub next"');
echo '</div>';
echo '</form>';
}
if (is_metaconsole() === true) {
enterprise_hook('close_meta_frame');
echo '<div id="deploy_messages" class="invisible">';
echo '<span>'.__(
'The configurations of inventory modules from the nodes have been unified.
From this point on, changes to the inventory scripts must be made through this screen.'
).'</br></br>'.__('You can find more information at:')."<a href='https://pandorafms.com/manual'>https://pandorafms.com/manual</a>".'</span>';
echo '</div>';
}
?>
<script type="text/javascript">
$( document ).ready(function() {
$('[id^=checkbox-delete_multiple]').change(function(){
if($(this).parent().parent().hasClass('checkselected')){
$(this).parent().parent().removeClass('checkselected');
}
else{
$(this).parent().parent().addClass('checkselected');
}
});
$('[id^=checkbox-all_delete]').change(function() {
if ($("#checkbox-all_delete").prop("checked")) {
$('[id^=checkbox-delete_multiple]').parent().parent().addClass('checkselected');
$(".check_delete").prop("checked", true);
}
else {
$('[id^=checkbox-delete_multiple]').parent().parent().removeClass('checkselected');
$(".check_delete").prop("checked", false);
}
});
});
</script>

View File

@ -0,0 +1,206 @@
<?php
// ______ __ _______ _______ _______
// | __ \.---.-.-----.--| |.-----.----.---.-. | ___| | | __|
// | __/| _ | | _ || _ | _| _ | | ___| |__ |
// |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
//
// ============================================================================
// Copyright (c) 2007-2021 Artica Soluciones Tecnologicas, http://www.artica.es
// This code is NOT free software. This code is NOT licenced under GPL2 licence
// You cannnot redistribute it without written permission of copyright holder.
// ============================================================================
// Load global variables
global $config;
// Check user credentials
check_login();
if (! check_acl($config['id_user'], 0, 'PM') && ! check_acl($config['id_user'], 0, 'AW')) {
db_pandora_audit(
AUDIT_LOG_ACL_VIOLATION,
'Trying to access Inventory Module Management'
);
include 'general/noaccess.php';
return;
}
// Header
if (defined('METACONSOLE')) {
$sec = 'advanced';
enterprise_include_once('meta/include/functions_components_meta.php');
enterprise_hook('open_meta_frame');
components_meta_print_header();
} else {
$sec = 'gmodules';
ui_print_page_header(
__('Module management').' » '.__('Inventory modules'),
'images/op_inventory.png',
false,
'',
true
);
}
// Header
$is_windows = strtoupper(substr(PHP_OS, 0, 3)) == 'WIN';
if ($is_windows) {
ui_print_error_message(__('Not supported in Windows systems'));
}
// Initialize variables
$id_module_inventory = (int) get_parameter('id_module_inventory');
$script_mode = 1;
// Updating
if ($id_module_inventory) {
$row = db_get_row(
'tmodule_inventory',
'id_module_inventory',
$id_module_inventory
);
if (!empty($row)) {
$name = $row['name'];
$description = $row['description'];
$id_os = $row['id_os'];
$interpreter = $row['interpreter'];
$code = $row['code'];
$data_format = $row['data_format'];
$block_mode = $row['block_mode'];
$script_path = $row['script_path'];
$script_mode = $row['script_mode'];
} else {
ui_print_error_message(__('Inventory module error'));
include 'general/footer.php';
return;
}
// New module
} else {
$name = '';
$description = '';
$id_os = 1;
$interpreter = '';
$code = '';
$data_format = '';
$block_mode = 0;
}
if ($id_os == null) {
$disabled = true;
} else {
$disabled = false;
}
$table = new stdClass();
$table->width = '100%';
$table->class = 'databox filters';
$table->style = [];
$table->style[0] = 'font-weight: bold';
$table->data = [];
$table->data[0][0] = '<strong>'.__('Name').'</strong>';
$table->data[0][1] = html_print_input_text('name', $name, '', 45, 100, true, $disabled);
$table->data[1][0] = '<strong>'.__('Description').'</strong>';
$table->data[1][1] = html_print_input_text('description', $description, '', 60, 500, true);
$table->data[2][0] = '<strong>'.__('OS').'</strong>';
$table->data[2][1] = html_print_select_from_sql(
'SELECT id_os, name FROM tconfig_os ORDER BY name',
'id_os',
$id_os,
'',
'',
'',
$return = true
);
$table->data[3][0] = '<strong>'.__('Interpreter').'</strong>';
$table->data[3][1] = html_print_input_text('interpreter', $interpreter, '', 25, 100, true);
$table->data[3][1] .= ui_print_help_tip(__('Left blank for the LOCAL inventory modules'), true);
$table->data['block_mode'][0] = '<strong>'.__('Block Mode').'</strong>';
$table->data['block_mode'][1] = html_print_checkbox('block_mode', 1, $block_mode, true);
$table->data[4][0] = '<strong>'.__('Format').'</strong>';
$table->data[4][0] .= ui_print_help_tip(__('separate fields with ').SEPARATOR_COLUMN, true);
$table->data[4][1] = html_print_input_text('format', $data_format, '', 50, 100, true);
$table->data[5][0] = '<strong>'.__('Script mode').'</strong>';
$table->data[5][0] .= ui_print_help_tip(__(''), true);
$table->data[5][1] = __('Use script');
$table->data[5][1] .= html_print_radio_button(
'script_mode',
1,
'',
$script_mode,
true
).'&nbsp;&nbsp;';
$table->data[5][1] .= '&nbsp&nbsp&nbsp&nbsp'.__('Use inline code');
$table->data[5][1] .= html_print_radio_button(
'script_mode',
2,
'',
$script_mode,
true
).'&nbsp;&nbsp;';
$table->data[6][0] = '<strong>'.__('Script path').'</strong>';
$table->data[6][1] = html_print_input_text('script_path', $script_path, '', 50, 1000, true);
$table->data[7][0] = '<strong>'.__('Code').'</strong>';
$table->data[7][0] .= ui_print_help_tip(__("Here is placed the script for the REMOTE inventory modules Local inventory modules don't use this field").SEPARATOR_COLUMN, true);
$table->data[7][1] = html_print_textarea('code', 25, 80, base64_decode($code), '', true);
echo '<form name="inventorymodule" id="inventorymodule_form" method="post"
action="index.php?sec='.$sec.'&sec2=godmode/modules/manage_inventory_modules">';
html_print_table($table);
if ($id_module_inventory) {
html_print_input_hidden('update_module_inventory', 1);
html_print_input_hidden('id_module_inventory', $id_module_inventory);
} else {
html_print_input_hidden('create_module_inventory', 1);
}
echo '<div class="action-buttons" style="width: '.$table->width.'">';
if ($id_module_inventory) {
html_print_submit_button(__('Update'), 'submit', false, 'class="sub next"');
} else {
html_print_submit_button(__('Create'), 'submit', false, 'class="sub upd"');
}
echo '</div>';
echo '</form>';
if (defined('METACONSOLE')) {
enterprise_hook('close_meta_frame');
}
?>
<script type="text/javascript">
$(document).ready (function () {
var mode = <?php echo $script_mode; ?>;
if (mode == 1) {
$('#table1-6').show();
$('#table1-7').hide();
} else {
$('#table1-7').show();
$('#table1-6').hide();
}
$('input[type=radio][name=script_mode]').change(function() {
if (this.value == 1) {
$('#table1-6').show();
$('#table1-7').hide();
}
else if (this.value == 2) {
$('#table1-7').show();
$('#table1-6').hide();
}
});
});
</script>

View File

@ -189,6 +189,8 @@ if ($export_profile) {
} }
} }
// Set cookie for download control.
setDownloadCookieToken();
// Send headers to tell the browser we're sending a file // Send headers to tell the browser we're sending a file
header('Content-type: application/octet-stream'); header('Content-type: application/octet-stream');
header('Content-Disposition: attachment; filename='.preg_replace('/\s/', '_', $profile_info['name']).'.csv'); header('Content-Disposition: attachment; filename='.preg_replace('/\s/', '_', $profile_info['name']).'.csv');
@ -285,7 +287,7 @@ foreach ($result as $row) {
] ]
); );
$data[3] = '<a href="index.php?sec=gmodules&sec2=godmode/modules/manage_network_templates'.'&delete_profile=1&delete_profile='.$row['id_np'].'" '.'onclick="if (!confirm(\''.__('Are you sure?').'\')) return false;">'.html_print_image('images/cross.png', true, ['title' => __('Delete'), 'class' => 'invert_filter']).'</a>'; $data[3] = '<a href="index.php?sec=gmodules&sec2=godmode/modules/manage_network_templates'.'&delete_profile=1&delete_profile='.$row['id_np'].'" '.'onclick="if (!confirm(\''.__('Are you sure?').'\')) return false;">'.html_print_image('images/cross.png', true, ['title' => __('Delete'), 'class' => 'invert_filter']).'</a>';
$data[3] .= '<a href="index.php?sec=gmodules&sec2=godmode/modules/manage_network_templates'.'&export_profile='.$row['id_np'].'">'.html_print_image('images/csv.png', true, ['title' => __('Export to CSV'), 'class' => 'invert_filter']).'</a>'; $data[3] .= '<a onclick="blockResubmit($(this))" href="index.php?sec=gmodules&sec2=godmode/modules/manage_network_templates'.'&export_profile='.$row['id_np'].'">'.html_print_image('images/csv.png', true, ['title' => __('Export to CSV'), 'class' => 'invert_filter']).'</a>';
array_push($table->data, $data); array_push($table->data, $data);
} }

View File

@ -229,7 +229,8 @@ if ($add_module === true) {
// Safe output remove all entities. // Safe output remove all entities.
io_safe_output_array($id_modules, ''); io_safe_output_array($id_modules, '');
$id_modules = array_map(function ($mod) { $id_modules = array_map(
function ($mod) {
return io_safe_input($mod); return io_safe_input($mod);
}, },
$id_modules $id_modules

View File

@ -169,6 +169,7 @@ $visual_format = 0;
$filter_search = ''; $filter_search = '';
$filter_exclude = ''; $filter_exclude = '';
$use_prefix_notation = true;
// Added for select fields. // Added for select fields.
$total_time = true; $total_time = true;
@ -461,6 +462,7 @@ switch ($action) {
$lapse = $item['lapse']; $lapse = $item['lapse'];
$lapse_calc = $item['lapse_calc']; $lapse_calc = $item['lapse_calc'];
$visual_format = $item['visual_format']; $visual_format = $item['visual_format'];
$use_prefix_notation = $item['use_prefix_notation'];
break; break;
case 'max_value': case 'max_value':
@ -476,6 +478,7 @@ switch ($action) {
$lapse = $item['lapse']; $lapse = $item['lapse'];
$lapse_calc = $item['lapse_calc']; $lapse_calc = $item['lapse_calc'];
$visual_format = $item['visual_format']; $visual_format = $item['visual_format'];
$use_prefix_notation = $item['use_prefix_notation'];
break; break;
case 'min_value': case 'min_value':
@ -491,6 +494,7 @@ switch ($action) {
$lapse = $item['lapse']; $lapse = $item['lapse'];
$lapse_calc = $item['lapse_calc']; $lapse_calc = $item['lapse_calc'];
$visual_format = $item['visual_format']; $visual_format = $item['visual_format'];
$use_prefix_notation = $item['use_prefix_notation'];
break; break;
case 'sumatory': case 'sumatory':
@ -504,6 +508,7 @@ switch ($action) {
$idAgentModule = $item['id_agent_module']; $idAgentModule = $item['id_agent_module'];
$period = $item['period']; $period = $item['period'];
$uncompressed_module = $item['uncompressed_module']; $uncompressed_module = $item['uncompressed_module'];
$use_prefix_notation = $item['use_prefix_notation'];
break; break;
case 'historical_data': case 'historical_data':
@ -773,6 +778,7 @@ switch ($action) {
$show_resume = $item['show_resume']; $show_resume = $item['show_resume'];
$show_graph = $item['show_graph']; $show_graph = $item['show_graph'];
$order_uptodown = $item['order_uptodown']; $order_uptodown = $item['order_uptodown'];
$use_prefix_notation = $item['use_prefix_notation'];
$text_agent = ''; $text_agent = '';
if (isset($style['text_agent']) === true if (isset($style['text_agent']) === true
@ -3404,6 +3410,22 @@ $class = 'databox filters';
</td> </td>
</tr> </tr>
<tr id="row_use_prefix_notation" class="datos advanced_elements">
<td class="bolder">
<?php
echo __('Use prefix notation');
ui_print_help_tip(
__('Use prefix notation for numeric values (example: 20,8Kbytes/sec), otherwise full value will be displayed (example: 20.742 bytes/sec)')
);
?>
</td>
<td>
<?php
html_print_checkbox_switch('use_prefix_notation', 1, $use_prefix_notation);
?>
</td>
</tr>
<tr id="row_uncompressed_module" class="datos"> <tr id="row_uncompressed_module" class="datos">
<td class="bolder"> <td class="bolder">
<?php <?php
@ -6367,6 +6389,7 @@ function chooseType() {
$("#row_show_summary").hide(); $("#row_show_summary").hide();
$("#row_group_by").hide(); $("#row_group_by").hide();
$("#row_type_show").hide(); $("#row_type_show").hide();
$("#row_use_prefix_notation").hide();
// SLA list default state. // SLA list default state.
$("#sla_list").hide(); $("#sla_list").hide();
@ -6561,6 +6584,7 @@ function chooseType() {
$("#row_lapse").show(); $("#row_lapse").show();
$("#row_visual_format").show(); $("#row_visual_format").show();
$("#row_historical_db_check").hide(); $("#row_historical_db_check").hide();
$("#row_use_prefix_notation").show();
break; break;
case 'max_value': case 'max_value':
@ -6572,6 +6596,7 @@ function chooseType() {
$("#row_lapse").show(); $("#row_lapse").show();
$("#row_visual_format").show(); $("#row_visual_format").show();
$("#row_historical_db_check").hide(); $("#row_historical_db_check").hide();
$("#row_use_prefix_notation").show();
break; break;
case 'min_value': case 'min_value':
@ -6583,6 +6608,7 @@ function chooseType() {
$("#row_lapse").show(); $("#row_lapse").show();
$("#row_visual_format").show(); $("#row_visual_format").show();
$("#row_historical_db_check").hide(); $("#row_historical_db_check").hide();
$("#row_use_prefix_notation").show();
break; break;
case 'sumatory': case 'sumatory':
@ -6592,6 +6618,7 @@ function chooseType() {
$("#row_period").show(); $("#row_period").show();
$("#row_historical_db_check").hide(); $("#row_historical_db_check").hide();
$("#row_uncompressed_module").show(); $("#row_uncompressed_module").show();
$("#row_use_prefix_notation").show();
break; break;
case 'historical_data': case 'historical_data':
@ -6879,6 +6906,7 @@ function chooseType() {
$("#row_show_resume").show(); $("#row_show_resume").show();
$("#row_show_graph").show(); $("#row_show_graph").show();
$("#row_historical_db_check").hide(); $("#row_historical_db_check").hide();
$("#row_use_prefix_notation").show();
break; break;
case 'exception': case 'exception':

View File

@ -1055,7 +1055,7 @@ switch ($action) {
] ]
); );
$data[2] .= '</a>'; $data[2] .= '</a>';
$data[3] = '<a href="'.ui_get_full_url(false, false, false, false).'ajax.php?page='.$config['homedir'].'/operation/reporting/reporting_xml&id='.$report['id_report'].'">'; $data[3] = '<a onclick="blockResubmit($(this))" href="'.ui_get_full_url(false, false, false, false).'ajax.php?page='.$config['homedir'].'/operation/reporting/reporting_xml&id='.$report['id_report'].'">';
$data[3] .= html_print_image( $data[3] .= html_print_image(
'images/xml.png', 'images/xml.png',
true, true,
@ -1888,6 +1888,9 @@ switch ($action) {
$values['visual_format'] = get_parameter( $values['visual_format'] = get_parameter(
'visual_format' 'visual_format'
); );
$values['use_prefix_notation'] = get_parameter(
'use_prefix_notation'
);
$good_format = true; $good_format = true;
break; break;
@ -1911,6 +1914,9 @@ switch ($action) {
$values['show_graph'] = get_parameter( $values['show_graph'] = get_parameter(
'combo_graph_options' 'combo_graph_options'
); );
$values['use_prefix_notation'] = get_parameter(
'use_prefix_notation'
);
$good_format = true; $good_format = true;
break; break;
} }
@ -2176,6 +2182,8 @@ switch ($action) {
'historical_db_check' 'historical_db_check'
); );
$values['top_n_value'] = get_parameter('max_items'); $values['top_n_value'] = get_parameter('max_items');
$values['server_name'] = get_parameter('combo_server');
} else if ($values['type'] == 'url') { } else if ($values['type'] == 'url') {
$values['external_source'] = get_parameter('url'); $values['external_source'] = get_parameter('url');
} else if ($values['type'] == 'event_report_group') { } else if ($values['type'] == 'event_report_group') {
@ -2704,6 +2712,9 @@ switch ($action) {
$values['visual_format'] = get_parameter( $values['visual_format'] = get_parameter(
'visual_format' 'visual_format'
); );
$values['use_prefix_notation'] = get_parameter(
'use_prefix_notation'
);
$good_format = true; $good_format = true;
break; break;
@ -2720,6 +2731,9 @@ switch ($action) {
$values['show_graph'] = get_parameter( $values['show_graph'] = get_parameter(
'combo_graph_options' 'combo_graph_options'
); );
$values['use_prefix_notation'] = get_parameter(
'use_prefix_notation'
);
$good_format = true; $good_format = true;
break; break;
} }

View File

@ -399,10 +399,7 @@ if (($create != '') || ($view != '')) {
$data = []; $data = [];
$data[0] = __('Plugin command').ui_print_help_tip(__('Specify interpreter and plugin path. The server needs permissions to run it.'), true); $data[0] = __('Plugin command').ui_print_help_tip(__('Specify interpreter and plugin path. The server needs permissions to run it.'), true);
$data[1] = '<input type="text" name="form_execute" id="form_execute" class="command_component command_advanced_conf text_input" size=100 value="'.$form_execute.'" '.$disabled.'>'; $data[1] = '<input type="text" name="form_execute" id="form_execute" class="command_component command_advanced_conf text_input" size=100 value="'.$form_execute.'" >';
if ($locked) {
$data[1] .= html_print_image('images/lock_mc.png', true, ['class' => 'command_advanced_conf lock', 'class' => 'invert_filter']);
}
$data[1] .= ' <a href="index.php?sec=gservers&sec2=godmode/servers/plugin&filemanager=1&id_plugin='.$form_id.'" class="bot">'; $data[1] .= ' <a href="index.php?sec=gservers&sec2=godmode/servers/plugin&filemanager=1&id_plugin='.$form_id.'" class="bot">';
$data[1] .= html_print_image('images/file.png', true, ['class' => 'invert_filter'], false, true); $data[1] .= html_print_image('images/file.png', true, ['class' => 'invert_filter'], false, true);
@ -411,11 +408,7 @@ if (($create != '') || ($view != '')) {
$data = []; $data = [];
$data[0] = __('Plug-in parameters'); $data[0] = __('Plug-in parameters');
$data[1] = '<input type="text" name="form_parameters" id="form_parameters" class="command_component command_advanced_conf text_input" size=100 value="'.$parameters.'" '.$disabled.'>'; $data[1] = '<input type="text" name="form_parameters" id="form_parameters" class="command_component command_advanced_conf text_input" size=100 value="'.$parameters.'" >';
if ($locked) {
$data[1] .= html_print_image('images/lock_mc.png', true, ['class' => 'command_advanced_conf lock', 'class' => 'invert_filter']);
}
$table->data['plugin_parameters'] = $data; $table->data['plugin_parameters'] = $data;
$data = []; $data = [];
@ -484,16 +477,10 @@ if (($create != '') || ($view != '')) {
$datam = []; $datam = [];
$datam[0] = __('Description')."<span class='normal_weight'> ($macro_name)</span>"; $datam[0] = __('Description')."<span class='normal_weight'> ($macro_name)</span>";
$datam[0] .= html_print_input_hidden($macro_name_name, $macro_name, true); $datam[0] .= html_print_input_hidden($macro_name_name, $macro_name, true);
$datam[1] = html_print_input_text_extended($macro_desc_name, $macro_desc_value, 'text-'.$macro_desc_name, '', 30, 255, $locked, '', "class='command_macro text_input'", true); $datam[1] = html_print_input_text_extended($macro_desc_name, $macro_desc_value, 'text-'.$macro_desc_name, '', 30, 255, false, '', "class='command_macro text_input'", true);
if ($locked) {
$datam[1] .= html_print_image('images/lock_mc.png', true, ['class' => 'command_macro lock', 'class' => 'invert_filter']);
}
$datam[2] = __('Default value')."<span class='normal_weight'> ($macro_name)</span>"; $datam[2] = __('Default value')."<span class='normal_weight'> ($macro_name)</span>";
$datam[3] = html_print_input_text_extended($macro_value_name, $macro_value_value, 'text-'.$macro_value_name, '', 30, 255, $locked, '', "class='command_component command_macro text_input'", true); $datam[3] = html_print_input_text_extended($macro_value_name, $macro_value_value, 'text-'.$macro_value_name, '', 30, 255, false, '', "class='command_component command_macro text_input'", true);
if ($locked) {
$datam[3] .= html_print_image('images/lock_mc.png', true, ['class' => 'command_macro lock', 'class' => 'invert_filter']);
}
$table->data['plugin_'.$next_name_number] = $datam; $table->data['plugin_'.$next_name_number] = $datam;
@ -524,24 +511,15 @@ if (($create != '') || ($view != '')) {
$datam = []; $datam = [];
$datam[0] = __('Help')."<span class='normal_weight'> ($macro_name)</span><br><br><br>"; $datam[0] = __('Help')."<span class='normal_weight'> ($macro_name)</span><br><br><br>";
$tadisabled = $locked === true ? ' disabled' : '';
$datam[1] = html_print_textarea( $datam[1] = html_print_textarea(
$macro_help_name, $macro_help_name,
6, 6,
100, 100,
$macro_help_value, $macro_help_value,
'class="command_macro" class="w97p"'.$tadisabled, 'class="command_macro" class="w97p"',
true true
); );
if ($locked) {
$datam[1] .= html_print_image(
'images/lock_mc.png',
true,
['class' => 'command_macro lock invert_filter']
);
}
$datam[1] .= '<br><br><br>'; $datam[1] .= '<br><br><br>';
$table->data['plugin_'.$next_name_number] = $datam; $table->data['plugin_'.$next_name_number] = $datam;
@ -551,15 +529,16 @@ if (($create != '') || ($view != '')) {
// Add/Delete buttons // Add/Delete buttons
$datam = []; $datam = [];
$datam[0] = '<a id="add_macro_btn" href="javascript:;">'.'<span class="bolder">'.__('Add macro').'</span>'.'&nbsp;'.html_print_image(
'images/add.png',
true,
['class' => 'invert_filter']
).'</a>';
$datam[0] .= '<div id="next_macro" class="invisible">'.$i.'</div>';
$datam[0] .= '<div id="next_row" class="invisible">'.$next_name_number.'</div>';
if (!$locked) { if (!$locked) {
$datam[0] = '<a id="add_macro_btn" href="javascript:;">'.'<span class="bolder">'.__('Add macro').'</span>'.'&nbsp;'.html_print_image(
'images/add.png',
true,
['class' => 'invert_filter']
).'</a>';
$datam[0] .= '<div id="next_macro" class="invisible">'.$i.'</div>';
$datam[0] .= '<div id="next_row" class="invisible">'.$next_name_number.'</div>';
$delete_macro_style = ''; $delete_macro_style = '';
if ($i <= 2) { if ($i <= 2) {
$delete_macro_style = 'display:none;'; $delete_macro_style = 'display:none;';
@ -1002,8 +981,11 @@ ui_require_javascript_file('pandora_modules');
}); });
update_preview(); update_preview();
} }
$('a#add_macro_btn').click(add_macro_click_event);
if (locked === 0) {
$('a#add_macro_btn').click(add_macro_click_event);
}
// Delete macro // Delete macro
var delete_macro_click_event = function (event) { var delete_macro_click_event = function (event) {
delete_macro_form('table-form-plugin_'); delete_macro_form('table-form-plugin_');
@ -1031,45 +1013,12 @@ ui_require_javascript_file('pandora_modules');
} }
} }
var command_click_locked_event = function (event) {
var $element = $(this);
if (!$element.is('input') || ($element.is('input') && ($element.prop('readonly') || $element.prop('disabled')))) {
if ($element.prop('id') === 'form_parameters') {
var message = '<?php echo __('Some modules or components are using the plugin'); ?>'
+ '.\n' + '<?php echo __('Are you sure you want to unlock this item?'); ?>';
if (confirm(message)) {
if ($element.is('input')) {
$element
.prop('readonly', false)
.prop('disabled', false)
.siblings('img.command_advanced_conf.lock')
.remove();
}
else {
$element
.siblings('input.command_advanced_conf')
.prop('readonly', false)
.prop('disabled', false)
$element.remove();
}
}
}
else {
alert("<?php echo __('The plugin command cannot be updated because some modules or components are using the plugin.'); ?>");
}
}
}
var macros_click_locked_event = function (event) { var macros_click_locked_event = function (event) {
alert("<?php echo __('The plugin macros cannot be updated because some modules or components are using the plugin'); ?>"); alert("<?php echo __('The plugin macros cannot be updated because some modules or components are using the plugin'); ?>");
} }
if (locked) { if (locked) {
$('a#add_macro_btn').click(add_macro_click_locked_event); $('a#add_macro_btn').click(add_macro_click_locked_event);
$('.command_advanced_conf').click(command_click_locked_event);
$('.command_macro').click(macros_click_locked_event);
} }

View File

@ -684,23 +684,6 @@ $table_other->data[$i++][1] = html_print_input_text(
true true
); );
if (enterprise_installed() === true) {
$table_other->data[$i][0] = __('PhantomJS cache cleanup ').$tip;
$table_other->data[$i++][1] = html_print_input(
[
'type' => 'select',
'name' => 'phantomjs_cache_interval',
'return' => true,
'fields' => [
PHANTOM_CACHE_CLEANUP_ONCE => __('No scheduled'),
PHANTOM_CACHE_CLEANUP_WEEKLY => __('Each week'),
PHANTOM_CACHE_CLEANUP_DAILY => __('Each day'),
],
'selected' => ($config['phantomjs_cache_interval'] ?? PHANTOM_CACHE_CLEANUP_ONCE),
]
);
}
// Agent Wizard defaults. // Agent Wizard defaults.
$defaultAgentWizardOptions = json_decode(io_safe_output($config['agent_wizard_defaults'])); $defaultAgentWizardOptions = json_decode(io_safe_output($config['agent_wizard_defaults']));
$tableSnmpWizard = new stdClass(); $tableSnmpWizard = new stdClass();

View File

@ -77,6 +77,7 @@ if (is_ajax()) {
true true
).'&nbsp;&nbsp;'; ).'&nbsp;&nbsp;';
$table->data['autocreate_remote_users'] = $row; $table->data['autocreate_remote_users'] = $row;
$table->data['csrf_token'] = html_print_csrf_hidden();
add_enterprise_auth_autocreate_profiles($table, $type_auth); add_enterprise_auth_autocreate_profiles($table, $type_auth);
} }
@ -475,6 +476,8 @@ if (!is_metaconsole()) {
html_print_input_hidden('hash_save_config', md5('save'.$config['dbpass'])); html_print_input_hidden('hash_save_config', md5('save'.$config['dbpass']));
} }
html_print_csrf_hidden();
html_print_table($table); html_print_table($table);
echo '<div id="table_auth_result"></div>'; echo '<div id="table_auth_result"></div>';
echo '<div class="action-buttons" style="width: '.$table->width.'">'; echo '<div class="action-buttons" style="width: '.$table->width.'">';

View File

@ -95,11 +95,11 @@ $table->data[$i++][1] = html_print_input_text(
true true
); );
$table->data[$i][0] = __('Phantomjs bin directory'); $table->data[$i][0] = __('Chromium path');
$table->data[$i++][1] = html_print_input_text( $table->data[$i++][1] = html_print_input_text(
'phantomjs_bin', 'chromium_path',
io_safe_output( io_safe_output(
$config['phantomjs_bin'] $config['chromium_path']
), ),
'', '',
30, 30,
@ -350,6 +350,87 @@ $table->data[$i++][1] = html_print_textarea(
true true
); );
// Inventory changes blacklist.
$table->data[$i][0] = __('Inventory changes blacklist');
$inventory_changes_blacklist_id = get_parameter(
'inventory_changes_blacklist',
$config['inventory_changes_blacklist']
);
if (!is_array($inventory_changes_blacklist_id)) {
$inventory_changes_blacklist_id = explode(
',',
$inventory_changes_blacklist_id
);
}
$inventory_modules = db_get_all_rows_sql(
'SELECT mi.id_module_inventory, mi.name module_inventory_name, os.name os_name
FROM tmodule_inventory mi, tconfig_os os
WHERE os.id_os = mi.id_os'
);
$inventory_changes_blacklist = [];
$inventory_changes_blacklist_out = [];
foreach ($inventory_modules as $inventory_module) {
if (in_array($inventory_module['id_module_inventory'], $inventory_changes_blacklist_id)) {
$inventory_changes_blacklist[$inventory_module['id_module_inventory']] = $inventory_module['module_inventory_name'].' ('.$inventory_module['os_name'].')';
} else {
$inventory_changes_blacklist_out[$inventory_module['id_module_inventory']] = $inventory_module['module_inventory_name'].' ('.$inventory_module['os_name'].')';
}
}
$select_out = html_print_select(
$inventory_changes_blacklist_out,
'inventory_changes_blacklist_out[]',
'',
'',
'',
'',
true,
true,
true,
'',
false,
'width:200px'
);
$arrows = ' ';
$select_in = html_print_select(
$inventory_changes_blacklist,
'inventory_changes_blacklist[]',
'',
'',
'',
'',
true,
true,
true,
'',
false,
'width:200px'
);
$table_ichanges = '<table>
<tr>
<td>'.__('Out of black list').'</td>
<td></td>
<td>'.__('In black list').'</td>
</tr>
<tr>
<td>'.$select_out.'</td>
<td>
<a href="javascript:">'.html_print_image('images/darrowright.png', true, ['id' => 'right_iblacklist', 'alt' => __('Push selected modules into blacklist'), 'title' => __('Push selected modules into blacklist'), 'class' => 'invert_filter']).'</a>
<br><br>
<a href="javascript:">'.html_print_image('images/darrowleft.png', true, ['id' => 'left_iblacklist', 'alt' => __('Pop selected modules out of blacklist'), 'title' => __('Pop selected modules out of blacklist'), 'class' => 'invert_filter']).'</a>
</td>
<td>'.$select_in.'</td>
</tr>
</table>';
$table->data[$i++][1] = $table_ichanges;
$table->data[$i][0] = __('Referer security'); $table->data[$i][0] = __('Referer security');
$table->data[$i++][1] = html_print_checkbox_switch( $table->data[$i++][1] = html_print_checkbox_switch(
'referer_security', 'referer_security',
@ -815,5 +896,64 @@ $(document).ready (function () {
}) })
$('input#button-email_test').click(perform_email_test); $('input#button-email_test').click(perform_email_test);
$("#right_iblacklist").click (function () {
jQuery.each($("select[name='inventory_changes_blacklist_out[]'] option:selected"), function (key, value) {
imodule_name = $(value).html();
if (imodule_name != <?php echo "'".__('None')."'"; ?>) {
id_imodule = $(value).attr('value');
$("select[name='inventory_changes_blacklist[]']")
.append(
$("<option></option>")
.val(id_imodule)
.html('<i>' + imodule_name + '</i>')
);
$("#inventory_changes_blacklist_out")
.find("option[value='" + id_imodule + "']").remove();
$("#inventory_changes_blacklist")
.find("option[value='']").remove();
if($("#inventory_changes_blacklist_out option").length == 0) {
$("select[name='inventory_changes_blacklist_out[]']")
.append(
$("<option></option>")
.val('')
.html('<i><?php echo __('None'); ?></i>')
);
}
}
});
});
$("#left_iblacklist").click (function () {
jQuery.each($("select[name='inventory_changes_blacklist[]'] option:selected"), function (key, value) {
imodule_name = $(value).html();
if (imodule_name != <?php echo "'".__('None')."'"; ?>) {
id_imodule = $(value).attr('value');
$("select[name='inventory_changes_blacklist_out[]']")
.append(
$("<option></option>")
.val(id_imodule)
.html('<i>' + imodule_name + '</i>')
);
$("#inventory_changes_blacklist")
.find("option[value='" + id_imodule + "']").remove();
$("#inventory_changes_blacklist_out")
.find("option[value='']").remove();
if($("#inventory_changes_blacklist option").length == 0) {
$("select[name='inventory_changes_blacklist[]']")
.append(
$("<option></option>")
.val('')
.html('<i><?php echo __('None'); ?></i>')
);
}
}
});
});
$("#submit-update_button").click(function () {
$('#inventory_changes_blacklist option').map(function(){
$(this).prop('selected', true);
});
});
}); });
</script> </script>

View File

@ -1312,6 +1312,27 @@ $table_other->data[$row][1] = '<em>'.__('Example').'</em> '.date($config['date_f
$table_other->data[$row][1] .= html_print_input_text('date_format', $config['date_format'], '', 30, 100, true); $table_other->data[$row][1] .= html_print_input_text('date_format', $config['date_format'], '', 30, 100, true);
$row++; $row++;
$decimal_separators = [
',' => ',',
'.' => '.',
];
$table_other->data[$row][0] = __('Decimal separator');
$table_other->data[$row][1] = html_print_select(
$decimal_separators,
'decimal_separator',
$config['decimal_separator'],
'',
'',
'',
true,
false,
false
);
$row++;
if ($config['prominent_time'] == 'comparation') { if ($config['prominent_time'] == 'comparation') {
$timestamp = false; $timestamp = false;
$comparation = true; $comparation = true;

View File

@ -1599,6 +1599,10 @@ $(document).ready (function () {
name: "get_recovery_fields", name: "get_recovery_fields",
value: "0" value: "0"
}); });
values.push({
name: "content_type",
value: "<?php echo $al_field4; ?>"
})
jQuery.post (<?php echo "'".ui_get_full_url('ajax.php', false, false, false)."'"; ?>, jQuery.post (<?php echo "'".ui_get_full_url('ajax.php', false, false, false)."'"; ?>,
values, values,
function (data, status) { function (data, status) {
@ -1624,8 +1628,9 @@ $(document).ready (function () {
// The row provided has a predefined class. We delete it. // The row provided has a predefined class. We delete it.
$('#table_macros-field' + i) $('#table_macros-field' + i)
.removeAttr('class'); .removeAttr('class');
if(old_value && i != 4){
$("[name=field" + i + "_value]").val(old_value).trigger('change'); $("[name=field" + i + "_value]").val(old_value).trigger('change');
}
$('#table_macros-field').show(); $('#table_macros-field').show();
} }
} }

View File

@ -404,6 +404,7 @@ if ($id_profile || $new_profile) {
html_print_input_hidden('create_profile', 1); html_print_input_hidden('create_profile', 1);
} else { } else {
html_print_input_hidden('id', $id_profile); html_print_input_hidden('id', $id_profile);
html_print_input_hidden('old_name_profile', $name);
html_print_input_hidden('update_profile', 1); html_print_input_hidden('update_profile', 1);
html_print_submit_button(__('Update'), 'upd', false, 'class="sub upd"'); html_print_submit_button(__('Update'), 'upd', false, 'class="sub upd"');
} }
@ -415,15 +416,53 @@ enterprise_hook('close_meta_frame');
?> ?>
<script type="text/javascript" language="javascript"> <script type="text/javascript" language="javascript">
$(document).ready (function () { $(document).ready (function () {
var disable_option = '<?php echo $disable_option; ?>'; var disable_option = '<?php echo $disable_option; ?>';
if (disable_option != '') { if (disable_option != '') {
var ids = ['#checkbox-db_management', '#checkbox-user_management', '#checkbox-pandora_management']; var ids = ['#checkbox-db_management', '#checkbox-user_management', '#checkbox-pandora_management'];
ids.forEach(id => { ids.forEach(id => {
$(id).css({'cursor':'not-allowed', 'opacity':'0.5'}); $(id).css({'cursor':'not-allowed', 'opacity':'0.5'});
}); });
} }
//Not enable enter for prevent submits
$(window).keydown(function(event){
if(event.keyCode == 13) {
event.preventDefault();
return false;
}
});
});
$('#text-name').on('blur',function(){
/* Check if the name is already on use for new profiles or check if the
name is already on use for update checking if the name is distinct of the original*/
if($('#hidden-create_profile').val()==1 || ($('#hidden-update_profile').val()==1 && $('#hidden-old_name_profile').val()!=$('#text-name').val())){
$.ajax({
type: "POST",
url: "ajax.php",
dataType: "html",
data: {
page: 'include/ajax/profile',
search_profile_nanme: true,
profile_name: $('#text-name').val().trim(),
},
success: function (data) {
if(data === 'true'){
alert( <?php echo "'".__('Profile name already on use, please, change the name before save')."'"; ?> );
if($('#hidden-old_name_profile').val()){
$('#text-name').val($('#hidden-old_name_profile').val());
}else{
$('#text-name').val("");
}
}
},
error: function (data) {
console.error("Fatal error in AJAX call to interpreter order", data)
}
});
}
}); });
</script> </script>

View File

@ -42,10 +42,7 @@ require_once $config['homedir'].'/include/functions_visual_map.php';
require_once $config['homedir'].'/include/functions_custom_fields.php'; require_once $config['homedir'].'/include/functions_custom_fields.php';
enterprise_include_once('include/functions_profile.php'); enterprise_include_once('include/functions_profile.php');
$meta = false; $meta = is_metaconsole();
if (enterprise_installed() && defined('METACONSOLE')) {
$meta = true;
}
$isFunctionSkins = enterprise_include_once('include/functions_skins.php'); $isFunctionSkins = enterprise_include_once('include/functions_skins.php');
@ -55,12 +52,11 @@ if (ENTERPRISE_NOT_HOOK !== enterprise_include('include/functions_policies.php')
$enterprise_include = true; $enterprise_include = true;
} }
if ($enterprise_include) { if ($enterprise_include === true) {
enterprise_include_once('meta/include/functions_users_meta.php'); enterprise_include_once('meta/include/functions_users_meta.php');
} }
if (is_metaconsole() === false) {
if (!is_metaconsole()) {
date_default_timezone_set('UTC'); date_default_timezone_set('UTC');
include 'include/javascript/timezonepicker/includes/parser.inc'; include 'include/javascript/timezonepicker/includes/parser.inc';
@ -110,13 +106,13 @@ if (!is_metaconsole()) {
// This defines the working user. Beware with this, old code get confusses // This defines the working user. Beware with this, old code get confusses
// and operates with current logged user (dangerous). // and operates with current logged user (dangerous).
$id = get_parameter('id', get_parameter('id_user', '')); $id = get_parameter('id', get_parameter('id_user', ''));
// ID given as parameter // ID given as parameter.
$pure = get_parameter('pure', 0); $pure = get_parameter('pure', 0);
$user_info = get_user_info($id); $user_info = get_user_info($id);
$is_err = false; $is_err = false;
if (! check_acl($config['id_user'], 0, 'UM')) { if ((bool) check_acl($config['id_user'], 0, 'UM') === false) {
db_pandora_audit( db_pandora_audit(
AUDIT_LOG_ACL_VIOLATION, AUDIT_LOG_ACL_VIOLATION,
'Trying to access User Management' 'Trying to access User Management'
@ -126,11 +122,11 @@ if (! check_acl($config['id_user'], 0, 'UM')) {
return; return;
} }
if (is_ajax()) { if (is_ajax() === true) {
$delete_profile = (bool) get_parameter('delete_profile'); $delete_profile = (bool) get_parameter('delete_profile');
$get_user_profile = (bool) get_parameter('get_user_profile'); $get_user_profile = (bool) get_parameter('get_user_profile');
if ($delete_profile) { if ($delete_profile === true) {
$id2 = (string) get_parameter('id_user'); $id2 = (string) get_parameter('id_user');
$id_up = (int) get_parameter('id_user_profile'); $id_up = (int) get_parameter('id_user_profile');
@ -160,7 +156,7 @@ if (is_ajax()) {
if ($has_profile === false && $user_is_global_admin === false) { if ($has_profile === false && $user_is_global_admin === false) {
$result = delete_user($id2); $result = delete_user($id2);
if ($result) { if ($result === true) {
db_pandora_audit( db_pandora_audit(
AUDIT_LOG_USER_MANAGEMENT, AUDIT_LOG_USER_MANAGEMENT,
__('Deleted user %s', io_safe_output($id_user)) __('Deleted user %s', io_safe_output($id_user))
@ -173,30 +169,34 @@ if (is_ajax()) {
__('There was a problem deleting the user') __('There was a problem deleting the user')
); );
// Delete the user in all the consoles // Delete the user in all the consoles.
if (defined('METACONSOLE')) { if (is_metaconsole() === true) {
$servers = metaconsole_get_servers(); $servers = metaconsole_get_servers();
foreach ($servers as $server) { foreach ($servers as $server) {
// Connect to the remote console // Connect to the remote console.
metaconsole_connect($server); metaconsole_connect($server);
// Delete the user // Delete the user.
$result = delete_user($id_user); $result = delete_user($id_user);
if ($result) { if ($result === true) {
db_pandora_audit( db_pandora_audit(
AUDIT_LOG_USER_MANAGEMENT, AUDIT_LOG_USER_MANAGEMENT,
__('Deleted user %s from metaconsole', io_safe_output($id_user)) __('Deleted user %s from metaconsole', io_safe_output($id_user))
); );
} }
// Restore the db connection // Restore the db connection.
metaconsole_restore_db(); metaconsole_restore_db();
// Log to the metaconsole too // Log to the metaconsole too.
if ($result) { if ($result === true) {
db_pandora_audit( db_pandora_audit(
AUDIT_LOG_USER_MANAGEMENT, AUDIT_LOG_USER_MANAGEMENT,
__('Deleted user %s from %s', io_safe_input($id_user), io_safe_input($server['server_name'])) __(
'Deleted user %s from %s',
io_safe_input($id_user),
io_safe_input($server['server_name'])
)
); );
} }
@ -272,14 +272,8 @@ enterprise_hook('open_meta_frame');
$tab = get_parameter('tab', 'user'); $tab = get_parameter('tab', 'user');
if ($id) { // Header.
$header_title = ' &raquo; '.__('Update user'); if (is_metaconsole() === true) {
} else {
$header_title = ' &raquo; '.__('Create user');
}
// Header
if ($meta) {
user_meta_print_header(); user_meta_print_header();
$sec = 'advanced'; $sec = 'advanced';
} else { } else {
@ -310,19 +304,34 @@ if ($meta) {
$buttons[$tab]['active'] = true; $buttons[$tab]['active'] = true;
ui_print_page_header( ui_print_standard_header(
__('User detail editor').$header_title, (empty($id) === false) ? __('Update user') : __('Create user'),
'images/gm_users.png', 'images/gm_users.png',
false, false,
'', '',
true, true,
$buttons $buttons,
[
[
'link' => '',
'label' => __('Profiles'),
],
[
'link' => ui_get_full_url('index.php?sec=gusuarios&sec2=godmode/users/user_list'),
'label' => __('Manage users'),
],
[
'link' => '',
'label' => __('User Detail Editor'),
],
]
); );
$sec = 'gusuarios'; $sec = 'gusuarios';
} }
if ($config['user_can_update_info']) { if ((bool) $config['user_can_update_info'] === true) {
$view_mode = false; $view_mode = false;
} else { } else {
$view_mode = true; $view_mode = true;
@ -332,17 +341,18 @@ $new_user = (bool) get_parameter('new_user');
$create_user = (bool) get_parameter('create_user'); $create_user = (bool) get_parameter('create_user');
$add_profile = (bool) get_parameter('add_profile'); $add_profile = (bool) get_parameter('add_profile');
$update_user = (bool) get_parameter('update_user'); $update_user = (bool) get_parameter('update_user');
$renewAPIToken = (bool) get_parameter('renewAPIToken');
$status = get_parameter('status', -1); $status = get_parameter('status', -1);
$json_profile = get_parameter('json_profile', ''); $json_profile = get_parameter('json_profile', '');
// Reset status var if current action is not update_user // Reset status var if current action is not update_user.
if ($new_user || $create_user || $add_profile if ($new_user === true || $create_user === true || $add_profile === true
|| $delete_profile || $update_user || $delete_profile === true || $update_user === true
) { ) {
$status = -1; $status = -1;
} }
if ($new_user && $config['admin_can_add_user']) { if ($new_user === true && (bool) $config['admin_can_add_user'] === true) {
$user_info = []; $user_info = [];
$id = ''; $id = '';
$user_info['fullname'] = ''; $user_info['fullname'] = '';
@ -366,28 +376,30 @@ if ($new_user && $config['admin_can_add_user']) {
$user_info['section'] = ''; $user_info['section'] = '';
$user_info['data_section'] = ''; $user_info['data_section'] = '';
// This attributes are inherited from global configuration // This attributes are inherited from global configuration.
$user_info['block_size'] = $config['block_size']; $user_info['block_size'] = $config['block_size'];
if (enterprise_installed() && is_metaconsole() === true) { if (enterprise_installed() === true && is_metaconsole() === true) {
$user_info['metaconsole_agents_manager'] = 0; $user_info['metaconsole_agents_manager'] = 0;
$user_info['metaconsole_access_node'] = 0; $user_info['metaconsole_access_node'] = 0;
} }
if ($config['ehorus_user_level_conf']) { if ((bool) $config['ehorus_user_level_conf'] === true) {
$user_info['ehorus_user_level_user'] = ''; $user_info['ehorus_user_level_user'] = '';
$user_info['ehorus_user_level_pass'] = ''; $user_info['ehorus_user_level_pass'] = '';
$user_info['ehorus_user_level_enabled'] = true; $user_info['ehorus_user_level_enabled'] = true;
} }
} }
if ($create_user) { if ($create_user === true) {
if (! $config['admin_can_add_user']) { if ((bool) $config['admin_can_add_user'] === false) {
ui_print_error_message(__('The current authentication scheme doesn\'t support creating users on %s', get_product_name())); ui_print_error_message(
__('The current authentication scheme doesn\'t support creating users on %s', get_product_name())
);
return; return;
} }
if (html_print_csrf_error()) { if (html_print_csrf_error() === true) {
return; return;
} }
@ -468,6 +480,8 @@ if ($create_user) {
} }
} }
// Generate new API token.
$values['api_token'] = api_token_generate();
if (empty($id) === true) { if (empty($id) === true) {
ui_print_error_message(__('User ID cannot be empty')); ui_print_error_message(__('User ID cannot be empty'));
@ -659,7 +673,7 @@ if ($create_user) {
} }
if ($update_user) { if ($update_user) {
if (html_print_csrf_error()) { if (html_print_csrf_error() === true) {
return; return;
} }
@ -678,6 +692,9 @@ if ($update_user) {
$values['timezone'] = (string) get_parameter('timezone'); $values['timezone'] = (string) get_parameter('timezone');
$values['default_event_filter'] = (int) get_parameter('default_event_filter'); $values['default_event_filter'] = (int) get_parameter('default_event_filter');
$values['default_custom_view'] = (int) get_parameter('default_custom_view'); $values['default_custom_view'] = (int) get_parameter('default_custom_view');
// API Token information.
$apiTokenRenewed = (bool) get_parameter('renewAPIToken');
$values['api_token'] = ($apiTokenRenewed === true) ? api_token_generate() : users_get_API_token($values['id_user']);
if (users_is_admin() === false && (bool) $values['is_admin'] !== false) { if (users_is_admin() === false && (bool) $values['is_admin'] !== false) {
db_pandora_audit( db_pandora_audit(
@ -689,7 +706,7 @@ if ($update_user) {
exit; exit;
} }
// eHorus user level conf. // Ehorus user level conf.
$values['ehorus_user_level_enabled'] = (bool) get_parameter('ehorus_user_level_enabled', false); $values['ehorus_user_level_enabled'] = (bool) get_parameter('ehorus_user_level_enabled', false);
$values['ehorus_user_level_user'] = (string) get_parameter('ehorus_user_level_user'); $values['ehorus_user_level_user'] = (string) get_parameter('ehorus_user_level_user');
$values['ehorus_user_level_pass'] = (string) get_parameter('ehorus_user_level_pass'); $values['ehorus_user_level_pass'] = (string) get_parameter('ehorus_user_level_pass');
@ -868,7 +885,7 @@ if ($update_user) {
ui_print_result_message( ui_print_result_message(
$res1, $res1,
__('User info successfully updated'), ($apiTokenRenewed === true) ? __('You have generated a new API Token.') : __('User info successfully updated'),
__('Error updating user info (no change?)') __('Error updating user info (no change?)')
); );
} }
@ -904,7 +921,7 @@ if ($update_user) {
$user_info = $values; $user_info = $values;
} }
if ($status != -1) { if ((int) $status !== -1) {
ui_print_result_message( ui_print_result_message(
$status, $status,
__('User info successfully updated'), __('User info successfully updated'),
@ -1029,6 +1046,48 @@ if (!$new_user) {
$user_id .= '<span>'.$id.'</span>'; $user_id .= '<span>'.$id.'</span>';
$user_id .= html_print_input_hidden('id_user', $id, true); $user_id .= html_print_input_hidden('id_user', $id, true);
$user_id .= '</div>'; $user_id .= '</div>';
$user_id .= '<div class="label_select_simple"><p class="edit_user_labels">'.__('API Token').'</p>';
$user_id .= html_print_anchor(
[
'onClick' => sprintf(
'javascript:renewAPIToken(\'%s\', \'%s\', \'%s\')',
__('Warning'),
__('The API token will be renewed. After this action, the last token you were using will not work. Are you sure?'),
'user_profile_form',
),
'content' => html_print_image(
'images/icono-refrescar.png',
true,
[
'class' => 'renew_api_token_image clickable',
'title' => __('Renew API Token'),
]
),
'class' => 'renew_api_token_link',
],
true
);
$user_id .= html_print_anchor(
[
'onClick' => sprintf(
'javascript:showAPIToken(\'%s\', \'%s\')',
__('API Token'),
base64_encode(__('Your API Token is:').'&nbsp;<br><span class="font_12pt bolder">'.users_get_API_token($id).'</span><br>&nbsp;'.__('Please, avoid share this string with others.')),
),
'content' => html_print_image(
'images/eye_show.png',
true,
[
'class' => 'renew_api_token_image clickable',
'title' => __('Show API Token'),
]
),
'class' => 'renew_api_token_link',
],
true
);
$user_id .= '</div>';
} else { } else {
$user_id = '<div class="label_select_simple">'.html_print_input_text_extended( $user_id = '<div class="label_select_simple">'.html_print_input_text_extended(
'id_user', 'id_user',
@ -1047,7 +1106,7 @@ if (!$new_user) {
).'</div>'; ).'</div>';
} }
if (is_user_admin($id)) { if (is_user_admin($id) === true) {
$avatar = html_print_image( $avatar = html_print_image(
'images/people_1.png', 'images/people_1.png',
true, true,
@ -1444,7 +1503,6 @@ $session_time .= html_print_input_text(
'class="input_line_small"' 'class="input_line_small"'
).'</div>'; ).'</div>';
$user_groups = implode(',', array_keys((users_get_groups($id, 'AR', $display_all_group)))); $user_groups = implode(',', array_keys((users_get_groups($id, 'AR', $display_all_group))));
if (empty($user_groups) === false) { if (empty($user_groups) === false) {
@ -1573,7 +1631,7 @@ if (!$id) {
$user_id_create = $user_id; $user_id_create = $user_id;
} }
if (is_metaconsole()) { if (is_metaconsole() === true) {
$access_or_pagination = $meta_access; $access_or_pagination = $meta_access;
} else { } else {
$access_or_pagination = $size_pagination; $access_or_pagination = $size_pagination;
@ -1589,14 +1647,14 @@ if ($id != '' && !$is_err) {
echo '<div id="user_form"> echo '<div id="user_form">
<div class="user_edit_first_row"> <div class="user_edit_first_row">
<div class="edit_user_info white_box">'.$div_user_info.'</div> <div class="edit_user_info white_box">'.$div_user_info.'</div>
<div class="edit_user_autorefresh white_box"><p class="bolder">Extra info</p>'.$email.$phone.$not_login.$local_user.$session_time.'</div> <div class="edit_user_autorefresh white_box"><p class="bolder">Extra info</p>'.$email.$phone.$not_login.$local_user.$session_time.'</div>
</div> </div>
<div class="user_edit_second_row white_box"> <div class="user_edit_second_row white_box">
<div class="edit_user_options">'.$language.$access_or_pagination.$skin.$home_screen.$default_event_filter.$double_authentication.'</div> <div class="edit_user_options">'.$language.$access_or_pagination.$skin.$home_screen.$default_event_filter.$double_authentication.'</div>
<div class="edit_user_timezone">'.$timezone; <div class="edit_user_timezone">'.$timezone;
if (!is_metaconsole()) { if (is_metaconsole() === false) {
echo '<div id="timezone-picker"> echo '<div id="timezone-picker">
<img id="timezone-image" src="'.$local_file.'" width="'.$map_width.'" height="'.$map_height.'" usemap="#timezone-map" /> <img id="timezone-image" src="'.$local_file.'" width="'.$map_width.'" height="'.$map_height.'" usemap="#timezone-map" />
<img class="timezone-pin" src="include/javascript/timezonepicker/images/pin.png" class="pdd_t_4px" /> <img class="timezone-pin" src="include/javascript/timezonepicker/images/pin.png" class="pdd_t_4px" />
@ -1643,13 +1701,18 @@ if ($config['admin_can_add_user']) {
} }
echo '</div>'; echo '</div>';
if ($new_user === true) {
html_print_input_hidden('json_profile', $json_profile);
}
html_print_input_hidden('json_profile', $json_profile);
echo '</form>'; echo '</form>';
if ($is_err === true && $new_user === true) {
profile_print_profile_table($id, io_safe_output($json_profile)); profile_print_profile_table($id, io_safe_output($json_profile), false, true);
} else {
profile_print_profile_table($id, io_safe_output($json_profile));
}
echo '<br />'; echo '<br />';
@ -1869,6 +1932,8 @@ $(document).ready (function () {
}); });
$('input:image[name="del"]').click(function (e) { $('input:image[name="del"]').click(function (e) {
if($(json_profile).length > 0) return;
if (!confirm ('Are you sure?')) return;
e.preventDefault(); e.preventDefault();
var rows = $("#table_profiles tr").length; var rows = $("#table_profiles tr").length;
if (((is_metaconsole === '1' && rows <= 4) || (is_metaconsole === '' && rows <= 3)) && user_is_global_admin !== '1') { if (((is_metaconsole === '1' && rows <= 4) || (is_metaconsole === '' && rows <= 3)) && user_is_global_admin !== '1') {

View File

@ -319,6 +319,17 @@ if ($delete_user === true) {
if ($id_user != $config['id_user']) { if ($id_user != $config['id_user']) {
$user_row = users_get_user_by_id($id_user); $user_row = users_get_user_by_id($id_user);
$private_dashboards = db_get_all_rows_filter(
'tdashboard',
['id_user' => $id_user],
'id'
);
if (isset($private_dashboards) === true) {
db_process_sql_delete('tdashboard', ['id_user' => $id_user]);
header('Refresh:1');
}
$result = delete_user($id_user); $result = delete_user($id_user);
if ($result) { if ($result) {
@ -335,12 +346,16 @@ if ($delete_user === true) {
); );
// Delete the user in all the consoles. // Delete the user in all the consoles.
if (is_metaconsole() === true && isset($_GET['delete_all'])) { if (is_metaconsole() === true) {
$servers = metaconsole_get_servers(); $servers = metaconsole_get_servers();
foreach ($servers as $server) { foreach ($servers as $server) {
// Connect to the remote console. // Connect to the remote console.
if (metaconsole_connect($server) === NOERR) { if (metaconsole_connect($server) === NOERR) {
// Delete the user. // Delete the user.
if (isset($private_dashboards) === true) {
db_process_sql_delete('tdashboard', ['id_user' => $id_user]);
}
$result = delete_user($id_user); $result = delete_user($id_user);
if ($result) { if ($result) {
db_pandora_audit( db_pandora_audit(
@ -367,6 +382,8 @@ if ($delete_user === true) {
__('There was a problem deleting the user from %s', io_safe_input($server['server_name'])) __('There was a problem deleting the user from %s', io_safe_input($server['server_name']))
); );
} }
header('Refresh:1');
} }
} else { } else {
ui_print_error_message(__('There was a problem deleting the user')); ui_print_error_message(__('There was a problem deleting the user'));

View File

@ -1450,17 +1450,17 @@ class DiscoveryTaskList extends HTML
// Header information. // Header information.
if ((int) $task['status'] <= 0 && empty($summary)) { if ((int) $task['status'] <= 0 && empty($summary)) {
if ($task['type'] == DISCOVERY_APP_VMWARE && $task['utimestamp'] != 0) { if ((int) $task['utimestamp'] !== 0) {
$outputMessage = __('Task completed.'); $output .= $this->progressTaskGraph($task);
} else { } else {
$outputMessage = __('This task has never executed'); $outputMessage = __('This task has never executed');
}
$output .= ui_print_info_message( $output .= ui_print_info_message(
$outputMessage, $outputMessage,
'', '',
true true
); );
}
} else if ($task['status'] == 1 } else if ($task['status'] == 1
|| ($task['utimestamp'] == 0 && $task['interval_sweep']) || ($task['utimestamp'] == 0 && $task['interval_sweep'])
) { ) {

View File

@ -1288,6 +1288,37 @@ class HostDevices extends Wizard
], ],
], ],
[
'label' => '<b>'.__('Security level').'</b>',
'arguments' => [
'name' => 'snmp_security_level',
'type' => 'select',
'fields' => [
'noAuthNoPriv' => __('Not auth and not privacy method'),
'authNoPriv' => __('Auth and not privacy method'),
'authPriv' => __('Auth and privacy method'),
],
'selected' => $this->task['snmp_security_level'],
'size' => 15,
'return' => true,
],
],
[
'label' => '<b>'.__('Auth method').'</b>',
'arguments' => [
'name' => 'snmp_auth_method',
'type' => 'select',
'fields' => [
'MD5' => __('MD5'),
'SHA' => __('SHA'),
],
'selected' => $this->task['snmp_auth_method'],
'size' => 15,
'return' => true,
],
],
[ [
'label' => '<b>'.__('Auth password').'</b>'.ui_print_help_tip( 'label' => '<b>'.__('Auth password').'</b>'.ui_print_help_tip(
__( __(
@ -1335,38 +1366,6 @@ class HostDevices extends Wizard
], ],
], ],
[
'label' => '<b>'.__('Auth method').'</b>',
'arguments' => [
'name' => 'snmp_auth_method',
'type' => 'select',
'fields' => [
'MD5' => __('MD5'),
'SHA' => __('SHA'),
],
'selected' => $this->task['snmp_auth_method'],
'size' => 15,
'return' => true,
],
],
[
'label' => '<b>'.__('Security level').'</b>',
'arguments' => [
'name' => 'snmp_security_level',
'type' => 'select',
'fields' => [
'noAuthNoPriv' => __('Not auth and not privacy method'),
'authNoPriv' => __('Auth and not privacy method'),
'authPriv' => __('Auth and privacy method'),
],
'selected' => $this->task['snmp_security_level'],
'size' => 15,
'return' => true,
],
],
], ],
]; ];

Binary file not shown.

After

Width:  |  Height:  |  Size: 759 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 563 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

View File

@ -654,7 +654,7 @@ if ($get_agent_alerts_datatable === true) {
} }
$idGroup = $filter_alert['ag_group']; $idGroup = $filter_alert['ag_group'];
$tag_filter = $filter_alert['tag_filter']; $tag_filter = $filter_alert['tag'];
$action_filter = $filter_alert['action']; $action_filter = $filter_alert['action'];
try { try {
@ -850,7 +850,7 @@ if ($get_agent_alerts_datatable === true) {
} else { } else {
$options_simple = [ $options_simple = [
'order' => $order, 'order' => $order,
'limit' => $length, 'limit' => ($length > 0) ? $length : 1844674407370955161,
'offset' => $start, 'offset' => $start,
]; ];
} }
@ -884,9 +884,9 @@ if ($get_agent_alerts_datatable === true) {
users_get_groups($config['id_user'], $access, false) users_get_groups($config['id_user'], $access, false)
); );
$alerts['alerts_simple'] = get_group_alerts($id_groups, $filter_alert, $options_simple, $whereAlertSimple, false, false, $idGroup, false, $strict_user, $tag_filter, $action_filter); $alerts['alerts_simple'] = get_group_alerts($id_groups, $filter_alert, $options_simple, $whereAlertSimple, false, false, $idGroup, false, $strict_user, $tag_filter, $action_filter, false);
$countAlertsSimple = get_group_alerts($id_groups, $filter_alert, false, $whereAlertSimple, false, false, $idGroup, true, $strict_user, $tag_filter, $action_filter); $countAlertsSimple = get_group_alerts($id_groups, $filter_alert, false, $whereAlertSimple, false, false, $idGroup, true, $strict_user, $tag_filter, $action_filter, false);
} }
} }
@ -915,7 +915,6 @@ if ($get_agent_alerts_datatable === true) {
$data[] = ui_format_alert_row($alert, true, $url, 'font-size: 7pt;'); $data[] = ui_format_alert_row($alert, true, $url, 'font-size: 7pt;');
} }
$data = array_reduce( $data = array_reduce(
$data, $data,
function ($carry, $row) { function ($carry, $row) {
@ -923,17 +922,29 @@ if ($get_agent_alerts_datatable === true) {
// of objects, making a post-process of certain fields. // of objects, making a post-process of certain fields.
$tmp = new stdClass(); $tmp = new stdClass();
// Standby. if (enterprise_installed() === true) {
$tmp->policy = $row[0]; $tmp->policy = $row[0];
$tmp->standby = $row[1]; $tmp->standby = $row[1];
$tmp->force = $row[2]; $tmp->force = $row[2];
$tmp->agent_name = $row[3]; $tmp->agent_name = $row[3];
$tmp->agent_module_name = $row[4]; $tmp->agent_module_name = $row[4];
$tmp->template_name = $row[5]; $tmp->template_name = $row[5];
$tmp->action = $row[6]; $tmp->action = $row[6];
$tmp->last_fired = $row[7]; $tmp->last_fired = $row[7];
$tmp->status = $row[8]; $tmp->status = $row[8];
$tmp->validate = $row[9]; $tmp->validate = $row[9];
} else {
// Open.
$tmp->standby = $row[0];
$tmp->force = $row[1];
$tmp->agent_name = $row[2];
$tmp->agent_module_name = $row[3];
$tmp->template_name = $row[4];
$tmp->action = $row[5];
$tmp->last_fired = $row[6];
$tmp->status = $row[7];
$tmp->validate = $row[8];
}
$carry[] = $tmp; $carry[] = $tmp;
return $carry; return $carry;

View File

@ -429,7 +429,9 @@ if (check_login()) {
$table_modules->data[$key][1] = remove_right_zeros( $table_modules->data[$key][1] = remove_right_zeros(
number_format( number_format(
$value['datos'], $value['datos'],
$config['graph_precision'] $config['graph_precision'],
$config['decimal_separator'],
$config['thousand_separator']
) )
); );
} else { } else {

View File

@ -59,6 +59,7 @@ $drawConsoleSound = (bool) get_parameter('drawConsoleSound', false);
$process_buffers = (bool) get_parameter('process_buffers', false); $process_buffers = (bool) get_parameter('process_buffers', false);
$get_extended_event = (bool) get_parameter('get_extended_event'); $get_extended_event = (bool) get_parameter('get_extended_event');
$change_status = (bool) get_parameter('change_status'); $change_status = (bool) get_parameter('change_status');
$get_Acknowledged = (bool) get_parameter('get_Acknowledged');
$change_owner = (bool) get_parameter('change_owner'); $change_owner = (bool) get_parameter('change_owner');
$add_comment = (bool) get_parameter('add_comment'); $add_comment = (bool) get_parameter('add_comment');
$dialogue_event_response = (bool) get_parameter('dialogue_event_response'); $dialogue_event_response = (bool) get_parameter('dialogue_event_response');
@ -351,12 +352,14 @@ if ($save_event_filter) {
$values['severity'] = implode(',', get_parameter('severity', -1)); $values['severity'] = implode(',', get_parameter('severity', -1));
$values['status'] = get_parameter('status'); $values['status'] = get_parameter('status');
$values['search'] = get_parameter('search'); $values['search'] = get_parameter('search');
$values['not_search'] = get_parameter('not_search');
$values['text_agent'] = get_parameter('text_agent'); $values['text_agent'] = get_parameter('text_agent');
$values['id_agent'] = get_parameter('id_agent'); $values['id_agent'] = get_parameter('id_agent');
$values['id_agent_module'] = get_parameter('id_agent_module'); $values['id_agent_module'] = get_parameter('id_agent_module');
$values['pagination'] = get_parameter('pagination'); $values['pagination'] = get_parameter('pagination');
$values['event_view_hr'] = get_parameter('event_view_hr'); $values['event_view_hr'] = get_parameter('event_view_hr');
$values['id_user_ack'] = get_parameter('id_user_ack'); $values['id_user_ack'] = get_parameter('id_user_ack');
$values['owner_user'] = get_parameter('owner_user');
$values['group_rep'] = get_parameter('group_rep'); $values['group_rep'] = get_parameter('group_rep');
$values['tag_with'] = get_parameter('tag_with', io_json_mb_encode([])); $values['tag_with'] = get_parameter('tag_with', io_json_mb_encode([]));
$values['tag_without'] = get_parameter( $values['tag_without'] = get_parameter(
@ -409,12 +412,14 @@ if ($update_event_filter) {
$values['severity'] = implode(',', get_parameter('severity', -1)); $values['severity'] = implode(',', get_parameter('severity', -1));
$values['status'] = get_parameter('status'); $values['status'] = get_parameter('status');
$values['search'] = get_parameter('search'); $values['search'] = get_parameter('search');
$values['not_search'] = get_parameter('not_search');
$values['text_agent'] = get_parameter('text_agent'); $values['text_agent'] = get_parameter('text_agent');
$values['id_agent'] = get_parameter('id_agent'); $values['id_agent'] = get_parameter('id_agent');
$values['id_agent_module'] = get_parameter('id_agent_module'); $values['id_agent_module'] = get_parameter('id_agent_module');
$values['pagination'] = get_parameter('pagination'); $values['pagination'] = get_parameter('pagination');
$values['event_view_hr'] = get_parameter('event_view_hr'); $values['event_view_hr'] = get_parameter('event_view_hr');
$values['id_user_ack'] = get_parameter('id_user_ack'); $values['id_user_ack'] = get_parameter('id_user_ack');
$values['owner_user'] = get_parameter('owner_user');
$values['group_rep'] = get_parameter('group_rep'); $values['group_rep'] = get_parameter('group_rep');
$values['tag_with'] = get_parameter('tag_with', io_json_mb_encode([])); $values['tag_with'] = get_parameter('tag_with', io_json_mb_encode([]));
$values['tag_without'] = get_parameter( $values['tag_without'] = get_parameter(
@ -481,6 +486,7 @@ if ($get_filter_values) {
'user_comment' => '', 'user_comment' => '',
'id_extra' => '', 'id_extra' => '',
'id_user_ack' => '', 'id_user_ack' => '',
'owner_user' => '',
'date_from' => '', 'date_from' => '',
'time_from' => '', 'time_from' => '',
'date_to' => '', 'date_to' => '',
@ -642,6 +648,8 @@ function load_form_filter() {
$("#status").val(val); $("#status").val(val);
if (i == 'search') if (i == 'search')
$('#text-search').val(val); $('#text-search').val(val);
if (i == 'not_search')
$('#checkbox-not_search').val(val);
if (i == 'text_agent') if (i == 'text_agent')
$('input[name=text_agent]').val(val); $('input[name=text_agent]').val(val);
if (i == 'id_agent') if (i == 'id_agent')
@ -654,6 +662,8 @@ function load_form_filter() {
$("#text-event_view_hr").val(val); $("#text-event_view_hr").val(val);
if (i == 'id_user_ack') if (i == 'id_user_ack')
$("#id_user_ack").val(val); $("#id_user_ack").val(val);
if (i == 'owner_user')
$("#owner_user").val(val);
if (i == 'group_rep') if (i == 'group_rep')
$("#group_rep").val(val); $("#group_rep").val(val);
if (i == 'tag_with') if (i == 'tag_with')
@ -898,12 +908,14 @@ function save_new_filter() {
"severity" : $("#severity").val(), "severity" : $("#severity").val(),
"status" : $("#status").val(), "status" : $("#status").val(),
"search" : $("#text-search").val(), "search" : $("#text-search").val(),
"not_search" : $("#checkbox-not_search").val(),
"text_agent" : $("#text_id_agent").val(), "text_agent" : $("#text_id_agent").val(),
"id_agent" : $('input:hidden[name=id_agent]').val(), "id_agent" : $('input:hidden[name=id_agent]').val(),
"id_agent_module" : $('input:hidden[name=module_search_hidden]').val(), "id_agent_module" : $('input:hidden[name=module_search_hidden]').val(),
"pagination" : $("#pagination").val(), "pagination" : $("#pagination").val(),
"event_view_hr" : $("#text-event_view_hr").val(), "event_view_hr" : $("#text-event_view_hr").val(),
"id_user_ack" : $("#id_user_ack").val(), "id_user_ack" : $("#id_user_ack").val(),
"owner_user" : $("#owner_user").val(),
"group_rep" : $("#group_rep").val(), "group_rep" : $("#group_rep").val(),
"tag_with": Base64.decode($("#hidden-tag_with").val()), "tag_with": Base64.decode($("#hidden-tag_with").val()),
"tag_without": Base64.decode($("#hidden-tag_without").val()), "tag_without": Base64.decode($("#hidden-tag_without").val()),
@ -975,12 +987,14 @@ function save_update_filter() {
"severity" : $("#severity").val(), "severity" : $("#severity").val(),
"status" : $("#status").val(), "status" : $("#status").val(),
"search" : $("#text-search").val(), "search" : $("#text-search").val(),
"not_search" : $("#checkbox-not_search").val(),
"text_agent" : $("#text_id_agent").val(), "text_agent" : $("#text_id_agent").val(),
"id_agent" : $('input:hidden[name=id_agent]').val(), "id_agent" : $('input:hidden[name=id_agent]').val(),
"id_agent_module" : $('input:hidden[name=module_search_hidden]').val(), "id_agent_module" : $('input:hidden[name=module_search_hidden]').val(),
"pagination" : $("#pagination").val(), "pagination" : $("#pagination").val(),
"event_view_hr" : $("#text-event_view_hr").val(), "event_view_hr" : $("#text-event_view_hr").val(),
"id_user_ack" : $("#id_user_ack").val(), "id_user_ack" : $("#id_user_ack").val(),
"owner_user" : $("#owner_user").val(),
"group_rep" : $("#group_rep").val(), "group_rep" : $("#group_rep").val(),
"tag_with" : Base64.decode($("#hidden-tag_with").val()), "tag_with" : Base64.decode($("#hidden-tag_with").val()),
"tag_without" : Base64.decode($("#hidden-tag_without").val()), "tag_without" : Base64.decode($("#hidden-tag_without").val()),
@ -1500,6 +1514,12 @@ if ($change_status === true) {
return; return;
} }
if ($get_Acknowledged === true) {
$event_id = get_parameter('event_id');
echo events_page_general_acknowledged($event_id);
return;
}
if ($change_owner === true) { if ($change_owner === true) {
$new_owner = get_parameter('new_owner', ''); $new_owner = get_parameter('new_owner', '');
$event_id = (int) get_parameter('event_id', 0); $event_id = (int) get_parameter('event_id', 0);
@ -2018,8 +2038,10 @@ if ($total_event_graph) {
include_once $config['homedir'].'/include/functions_graph.php'; include_once $config['homedir'].'/include/functions_graph.php';
$prueba = grafico_eventos_total('', 280, 150, false, true); $out = '<div style="flex: 0 0 300px; width:99%; height:100%;">';
echo $prueba; $out .= grafico_eventos_total('', 0, 0, false, true);
$out .= '<div>';
echo $out;
return; return;
} }
@ -2028,8 +2050,10 @@ if ($graphic_event_group) {
include_once $config['homedir'].'/include/functions_graph.php'; include_once $config['homedir'].'/include/functions_graph.php';
$prueba = grafico_eventos_grupo(280, 150, '', false, true); $out = '<div style="flex: 0 0 300px; width:99%; height:100%;">';
echo $prueba; $out .= grafico_eventos_grupo(0, 0, '', false, true);
$out .= '<div>';
echo $out;
return; return;
} }
@ -2270,7 +2294,7 @@ if ($drawConsoleSound === true) {
], ],
], ],
[ [
'label' => __('Time Sound'), 'label' => __('Sound duration'),
'arguments' => [ 'arguments' => [
'type' => 'select', 'type' => 'select',
'fields' => $times_sound, 'fields' => $times_sound,
@ -2417,6 +2441,7 @@ if ($get_events_fired) {
'severity' => -1, 'severity' => -1,
'status' => -1, 'status' => -1,
'search' => '', 'search' => '',
'not_search' => 0,
'text_agent' => '', 'text_agent' => '',
'id_agent' => 0, 'id_agent' => 0,
'id_agent_module' => 0, 'id_agent_module' => 0,

View File

@ -26,6 +26,8 @@
* ============================================================================ * ============================================================================
*/ */
use PandoraFMS\Enterprise\Metaconsole\Node;
// Begin. // Begin.
if (check_login()) { if (check_login()) {
global $config; global $config;
@ -59,6 +61,11 @@ if (check_login()) {
0 0
); );
$get_data_dataMatrix = (bool) get_parameter(
'get_data_dataMatrix',
0
);
if ($get_agent_modules_json_by_name === true) { if ($get_agent_modules_json_by_name === true) {
$agent_name = get_parameter('agent_name'); $agent_name = get_parameter('agent_name');
@ -499,7 +506,9 @@ if (check_login()) {
$data[] = remove_right_zeros( $data[] = remove_right_zeros(
number_format( number_format(
$row[$attr[0]], $row[$attr[0]],
$config['graph_precision'] $config['graph_precision'],
$config['decimal_separator'],
$config['thousand_separator']
) )
); );
} }
@ -507,7 +516,9 @@ if (check_login()) {
$data[] = remove_right_zeros( $data[] = remove_right_zeros(
number_format( number_format(
$row[$attr[0]], $row[$attr[0]],
$config['graph_precision'] $config['graph_precision'],
$config['decimal_separator'],
$config['thousand_separator']
) )
); );
} }
@ -524,7 +535,9 @@ if (check_login()) {
$data[] = remove_right_zeros( $data[] = remove_right_zeros(
number_format( number_format(
$row[$attr[0]], $row[$attr[0]],
$config['graph_precision'] $config['graph_precision'],
$config['decimal_separator'],
$config['thousand_separator']
) )
); );
} }
@ -1163,8 +1176,8 @@ if (check_login()) {
$status, $status,
$title $title
); );
$last_status_change_text = ($module['ip_target']) ? 'IP: '.$module['ip_target'].'<br />' : '';
$last_status_change_text = 'Time elapsed since last status change: '; $last_status_change_text .= 'Time elapsed since last status change: ';
$last_status_change_text .= !empty($module['last_status_change']) ? human_time_comparation($module['last_status_change']) : __('N/A'); $last_status_change_text .= !empty($module['last_status_change']) ? human_time_comparation($module['last_status_change']) : __('N/A');
$data[5] = ui_print_status_image($status, htmlspecialchars($title), true, false, false, false, $last_status_change_text); $data[5] = ui_print_status_image($status, htmlspecialchars($title), true, false, false, false, $last_status_change_text);
@ -1430,4 +1443,190 @@ if (check_login()) {
return; return;
} }
if ($get_data_dataMatrix === true) {
global $config;
$table_id = get_parameter('table_id', '');
$modules = json_decode(
io_safe_output(
get_parameter('modules', '')
),
true
);
$period = get_parameter('period', 0);
$slice = get_parameter('slice', 0);
// Datatables offset, limit.
$start = get_parameter('start', 0);
$formatData = (bool) get_parameter('formatData', 0);
$length = get_parameter(
'length',
$config['block_size']
);
$order = get_datatable_order(true);
// Total time per page.
$time_all_box = ($length * $slice);
// Total number of boxes.
$total_box = ceil($period / $slice);
if ($start > 0) {
$start = ($start / $length);
}
// Uncompress.
try {
ob_start();
$dateNow = get_system_time();
$final = ($dateNow - $period);
$date = ($dateNow - ($time_all_box * $start));
if (($date - $time_all_box) > $final) {
$datelimit = ($date - $time_all_box);
} else {
$datelimit = $final;
}
foreach ($modules as $key => $value) {
if (is_metaconsole() === true) {
try {
$node = new Node((int) $value['id_node']);
$node->connect();
} catch (\Exception $e) {
// Unexistent agent.
$node->disconnect();
}
}
$value['thresholds'] = [
'min_critical' => (empty($value['c_min']) === true) ? null : $value['c_min'],
'max_critical' => (empty($value['c_max']) === true) ? null : $value['c_max'],
'min_warning' => (empty($value['w_min']) === true) ? null : $value['w_min'],
'max_warning' => (empty($value['w_max']) === true) ? null : $value['w_max'],
];
$module_data = db_uncompress_module_data(
$value['id'],
$datelimit,
$date,
$slice,
true
);
$uncompressData[] = array_reduce(
$module_data,
function ($carry, $item) use ($value, $config, $formatData) {
// Last value.
$vdata = null;
if (is_array($item['data']) === true) {
foreach ($item['data'] as $v) {
$vdata = $v['datos'];
}
}
$status = get_status_data_modules(
$value['id'],
$vdata,
$value['thresholds']
);
$resultData = '<span style="color:'.$status['color'].'">';
if ($vdata !== null && $vdata !== '' && $vdata !== false) {
if (isset($formatData) === true
&& (bool) $formatData === true
) {
$resultData .= format_for_graph(
$vdata,
$config['graph_precision']
);
} else {
$resultData .= sla_truncate(
$vdata,
$config['graph_precision']
);
}
$resultData .= ' '.$value['unit'];
} else {
$resultData .= '--';
}
$resultData .= '</span>';
$carry[] = [
'utimestamp' => $item['utimestamp'],
'Column-'.$value['id'] => $resultData,
];
return $carry;
},
[]
);
if (is_metaconsole() === true) {
$node->disconnect();
}
}
if (empty($uncompressData) === false) {
$data = array_reduce(
$uncompressData,
function ($carry, $item) {
foreach ($item as $data_module) {
foreach ($data_module as $key => $value) {
if ($key === 'utimestamp') {
$carry[$data_module['utimestamp']]['date'] = date('Y-m-d H:i', (int) $value);
} else {
$carry[$data_module['utimestamp']][$key] = $value;
}
}
}
return $carry;
}
);
}
if (empty($data) === false) {
$data = array_reverse(array_values($data));
} else {
$data = [];
}
// RecordsTotal && recordsfiltered resultados totales.
echo json_encode(
[
'data' => $data,
'recordsTotal' => $total_box,
'recordsFiltered' => $total_box,
]
);
$response = ob_get_clean();
// Clean output buffer.
while (ob_get_level() !== 0) {
ob_end_clean();
}
} catch (Exception $e) {
echo json_encode(
['error' => $e->getMessage()]
);
}
// If not valid it will throw an exception.
json_decode($response);
if (json_last_error() == JSON_ERROR_NONE) {
// If valid dump.
echo $response;
} else {
echo json_encode(
['error' => $response]
);
}
return;
}
} }

View File

@ -0,0 +1,29 @@
<?php
// Pandora FMS- http://pandorafms.com
// ==================================================
// Copyright (c) 2005-2021 Artica Soluciones Tecnologicas
// Please see http://pandorafms.org for full contribution list
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public License
// as published by the Free Software Foundation; version 2
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
global $config;
require_once $config['homedir'].'/include/functions_profile.php';
// Clean the possible blanks introduced by the included files.
ob_clean();
$search_profile_name = (bool) get_parameter('search_profile_nanme');
if ($search_profile_name) {
$profile_name = (string) get_parameter('profile_name');
echo json_encode(profile_exist($profile_name));
return;
}

View File

@ -14,7 +14,7 @@
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______| * |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
* *
* ============================================================================ * ============================================================================
* Copyright (c) 2005-2021 Artica Soluciones Tecnologicas * Copyright (c) 2005-2022 Artica Soluciones Tecnologicas
* Please see http://pandorafms.org for full contribution list * Please see http://pandorafms.org for full contribution list
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -69,9 +69,6 @@ $id2 = get_parameter('id2');
$otherSerialize = get_parameter('other'); $otherSerialize = get_parameter('other');
$otherMode = get_parameter('other_mode', 'url_encode'); $otherMode = get_parameter('other_mode', 'url_encode');
$returnType = get_parameter('return_type', 'string'); $returnType = get_parameter('return_type', 'string');
$api_password = get_parameter('apipass', '');
$password = get_parameter('pass', '');
$user = get_parameter('user', '');
$info = get_parameter('info', ''); $info = get_parameter('info', '');
$raw_decode = (bool) get_parameter('raw_decode', false); $raw_decode = (bool) get_parameter('raw_decode', false);
@ -84,6 +81,21 @@ $apiPassword = io_output_password(
) )
); );
$apiTokenValid = false;
// Try getting bearer token from header.
// TODO. Getting token from url will be removed.
$apiToken = (string) getBearerToken();
if (empty($apiToken) === true) {
// Legacy user/pass token.
// TODO. Revome in future.
$api_password = get_parameter('apipass', '');
$user = get_parameter('user', '');
$password = get_parameter('pass', '');
} else {
$apiTokenValid = (bool) api_token_check($apiToken);
}
$correctLogin = false; $correctLogin = false;
$no_login_msg = ''; $no_login_msg = '';
@ -94,8 +106,8 @@ ob_clean();
// Special call without checks to retrieve version and build of the Pandora FMS // Special call without checks to retrieve version and build of the Pandora FMS
// This info is avalable from the web console without login // This info is avalable from the web console without login
// Don't change the format, it is parsed by applications. // Don't change the format, it is parsed by applications.
if ($info == 'version') { if ($info === 'version') {
if (!$config['MR']) { if ((bool) $config['MR'] === false) {
$config['MR'] = 0; $config['MR'] = 0;
} }
@ -105,6 +117,7 @@ if ($info == 'version') {
if (empty($apiPassword) === true if (empty($apiPassword) === true
|| (empty($apiPassword) === false && $api_password === $apiPassword) || (empty($apiPassword) === false && $api_password === $apiPassword)
|| $apiTokenValid === true
) { ) {
if (enterprise_hook('metaconsole_validate_origin', [get_parameter('server_auth')]) === true if (enterprise_hook('metaconsole_validate_origin', [get_parameter('server_auth')]) === true
|| enterprise_hook('console_validate_origin', [get_parameter('server_auth')]) === true || enterprise_hook('console_validate_origin', [get_parameter('server_auth')]) === true
@ -118,7 +131,14 @@ if (empty($apiPassword) === true
$correctLogin = true; $correctLogin = true;
} else if ((bool) isInACL($ipOrigin) === true) { } else if ((bool) isInACL($ipOrigin) === true) {
// External access. // External access.
$user_in_db = process_user_login($user, $password, true); // Token is valid. Bypass the credentials.
if ($apiTokenValid === true) {
$credentials = db_get_row('tusuario', 'api_token', $apiToken);
$user = $credentials['id_user'];
$password = $credentials['password'];
}
$user_in_db = process_user_login($user, $password, true, $apiTokenValid);
if ($user_in_db !== false) { if ($user_in_db !== false) {
$config['id_usuario'] = $user_in_db; $config['id_usuario'] = $user_in_db;
// Compat. // Compat.
@ -144,19 +164,19 @@ if (empty($apiPassword) === true
$no_login_msg = 'Incorrect given API password'; $no_login_msg = 'Incorrect given API password';
} }
if ($correctLogin) { if ($correctLogin === true) {
if (($op !== 'get') && ($op !== 'set') && ($op !== 'help')) { if (($op !== 'get') && ($op !== 'set') && ($op !== 'help')) {
returnError('no_set_no_get_no_help', $returnType); returnError('no_set_no_get_no_help', $returnType);
} else { } else {
$function_name = ''; $function_name = '';
// Check if is an extension function and get the function name. // Check if is an extension function and get the function name.
if ($op2 == 'extension') { if ($op2 === 'extension') {
$extension_api_url = $config['homedir'].'/'.EXTENSIONS_DIR.'/'.$ext_name.'/'.$ext_name.'.api.php'; $extension_api_url = $config['homedir'].'/'.EXTENSIONS_DIR.'/'.$ext_name.'/'.$ext_name.'.api.php';
// The extension API file must exist and the extension must be // The extension API file must exist and the extension must be
// enabled. // enabled.
if (file_exists($extension_api_url) if (file_exists($extension_api_url) === true
&& !in_array($ext_name, extensions_get_disabled_extensions()) && in_array($ext_name, extensions_get_disabled_extensions()) === false
) { ) {
include_once $extension_api_url; include_once $extension_api_url;
$function_name = 'apiextension_'.$op.'_'.$ext_function; $function_name = 'apiextension_'.$op.'_'.$ext_function;
@ -164,7 +184,7 @@ if ($correctLogin) {
} else { } else {
$function_name = 'api_'.$op.'_'.$op2; $function_name = 'api_'.$op.'_'.$op2;
if ($op == 'set' && $id) { if ($op === 'set' && $id) {
switch ($op2) { switch ($op2) {
case 'update_agent': case 'update_agent':
case 'add_module_in_conf': case 'add_module_in_conf':
@ -173,7 +193,7 @@ if ($correctLogin) {
$agent = agents_locate_agent($id); $agent = agents_locate_agent($id);
if ($agent !== false) { if ($agent !== false) {
$id_os = $agent['id_os']; $id_os = $agent['id_os'];
if ($id_os == 100) { if ((int) $id_os === 100) {
returnError( returnError(
'not_allowed_operation_cluster', 'not_allowed_operation_cluster',
$returnType $returnType

View File

@ -94,7 +94,7 @@ $config['admin_can_make_admin'] = true;
* @return mixed False in case of error or invalid credentials, the username in * @return mixed False in case of error or invalid credentials, the username in
* case it's correct. * case it's correct.
*/ */
function process_user_login($login, $pass, $api=false) function process_user_login($login, $pass, $api=false, $passAlreadyEncrypted=false)
{ {
global $config; global $config;
@ -130,10 +130,10 @@ function process_user_login($login, $pass, $api=false)
if ($config['fallback_local_auth'] if ($config['fallback_local_auth']
|| is_user_admin($login) || is_user_admin($login)
|| $local_user === true || $local_user === true
|| strtolower($config['auth']) == 'mysql' || strtolower($config['auth']) === 'mysql'
|| (bool) $user_not_login === true || (bool) $user_not_login === true
) { ) {
return process_user_login_local($login, $pass, $api); return process_user_login_local($login, $pass, $api, $passAlreadyEncrypted);
} else { } else {
return false; return false;
} }
@ -144,96 +144,66 @@ function process_user_login($login, $pass, $api=false)
} }
function process_user_login_local($login, $pass, $api=false) function process_user_login_local($login, $pass, $api=false, $passAlreadyEncrypted=false)
{ {
global $config, $mysql_cache; global $config, $mysql_cache;
// Connect to Database if ((bool) $api === false) {
switch ($config['dbtype']) { $sql = sprintf(
case 'mysql': "SELECT `id_user`, `password`
if (!$api) { FROM `tusuario`
$sql = sprintf( WHERE `id_user` = '%s' AND `not_login` = 0
"SELECT `id_user`, `password` AND `disabled` = 0",
FROM `tusuario` $login
WHERE `id_user` = '%s' AND `not_login` = 0 );
AND `disabled` = 0", } else {
$login $sql = sprintf(
); "SELECT `id_user`, `password`
} else { FROM `tusuario`
$sql = sprintf( WHERE `id_user` = '%s'
"SELECT `id_user`, `password` AND `disabled` = 0",
FROM `tusuario` $login
WHERE `id_user` = '%s' );
AND `disabled` = 0",
$login
);
}
break;
case 'postgresql':
if (!$api) {
$sql = sprintf(
'SELECT "id_user", "password"
FROM "tusuario"
WHERE "id_user" = \'%s\' AND "not_login" = 0
AND "disabled" = 0',
$login
);
} else {
$sql = sprintf(
'SELECT "id_user", "password"
FROM "tusuario"
WHERE "id_user" = \'%s\'
AND "disabled" = 0',
$login
);
}
break;
case 'oracle':
if (!$api) {
$sql = sprintf(
'SELECT id_user, password
FROM tusuario
WHERE id_user = \'%s\' AND not_login = 0
AND disabled = 0',
$login
);
} else {
$sql = sprintf(
'SELECT id_user, password
FROM tusuario
WHERE id_user = \'%s\'
AND disabled = 0',
$login
);
}
break;
} }
$row = db_get_row_sql($sql); $row = db_get_row_sql($sql);
// Check that row exists, that password is not empty and that password is the same hash if ($passAlreadyEncrypted) {
if ($row !== false && $row['password'] !== md5('') $credentials_check = $pass === $row['password'];
&& $row['password'] == md5($pass) } else {
) { // Perform password check whether it is MD5-hashed (old hashing) or Bcrypt-hashed.
if (strlen($row['password']) === 32) {
// MD5.
$credentials_check = $row !== false && $row['password'] !== md5('') && $row['password'] == md5($pass);
} else {
// Bcrypt.
$credentials_check = password_verify($pass, $row['password']);
}
}
if ($credentials_check === true) {
// Login OK // Login OK
// Nick could be uppercase or lowercase (select in MySQL // Nick could be uppercase or lowercase (select in MySQL
// is not case sensitive) // is not case sensitive)
// We get DB nick to put in PHP Session variable, // We get DB nick to put in PHP Session variable,
// to avoid problems with case-sensitive usernames. // to avoid problems with case-sensitive usernames.
// Thanks to David Muñiz for Bug discovery :) // Thanks to David Muñiz for Bug discovery :).
$filter = ['id_usuario' => $login]; $filter = ['id_usuario' => $login];
$user_profile = db_get_row_filter('tusuario_perfil', $filter); $user_profile = db_get_row_filter('tusuario_perfil', $filter);
if (!users_is_admin($login) && !$user_profile) { if ((bool) users_is_admin($login) === false && (bool) $user_profile === false) {
$mysql_cache['auth_error'] = 'User does not have any profile'; $mysql_cache['auth_error'] = 'User does not have any profile';
$config['auth_error'] = 'User does not have any profile'; $config['auth_error'] = 'User does not have any profile';
return false; return false;
} }
// Override password to use Bcrypt encryption.
if (strlen($row['password']) === 32) {
update_user_password($login, $pass);
}
return $row['id_user']; return $row['id_user'];
} else { } else {
if (!user_can_login($login)) { if (user_can_login($login) === false) {
$mysql_cache['auth_error'] = 'User only can use the API.'; $mysql_cache['auth_error'] = 'User only can use the API.';
$config['auth_error'] = 'User only can use the API.'; $config['auth_error'] = 'User only can use the API.';
} else { } else {
@ -655,8 +625,16 @@ function process_user_contact(string $id_user)
function create_user($id_user, $password, $user_info) function create_user($id_user, $password, $user_info)
{ {
$values = $user_info; $values = $user_info;
$column_type = db_get_column_type('tusuario', 'password');
if (empty($column_type) === false && isset($column_type[0]['COLUMN_TYPE'])) {
$column_type = ($column_type[0]['COLUMN_TYPE'] === 'varchar(60)');
} else {
$column_type = false;
}
$values['id_user'] = $id_user; $values['id_user'] = $id_user;
$values['password'] = md5($password); $values['password'] = ($column_type === false) ? md5($password) : password_hash($password, PASSWORD_BCRYPT);
$values['last_connect'] = 0; $values['last_connect'] = 0;
$values['registered'] = get_system_time(); $values['registered'] = get_system_time();
@ -747,7 +725,7 @@ function delete_user(string $id_user)
/** /**
* Update the password in MD5 for user pass as id_user with * Update the password using BCRYPT algorithm for specific id_user passing
* password in plain text. * password in plain text.
* *
* @param string $user User ID. * @param string $user User ID.
@ -764,9 +742,19 @@ function update_user_password(string $user, string $password_new)
return false; return false;
} }
$column_type = db_get_column_type('tusuario', 'password');
if (empty($column_type) === false && isset($column_type[0]['COLUMN_TYPE'])) {
$column_type = ($column_type[0]['COLUMN_TYPE'] === 'varchar(60)');
} else {
$column_type = false;
}
if (isset($config['auth']) === true && $config['auth'] === 'pandora') { if (isset($config['auth']) === true && $config['auth'] === 'pandora') {
$sql = sprintf( $sql = sprintf(
"UPDATE tusuario SET password = '".md5($password_new)."', last_pass_change = '".date('Y-m-d H:i:s', get_system_time())."' WHERE id_user = '".$user."'" "UPDATE tusuario SET password = '%s', last_pass_change = '%s' WHERE id_user = '%s'",
($column_type === false) ? md5($password_new) : password_hash($password_new, PASSWORD_BCRYPT),
date('Y-m-d H:i:s', get_system_time()),
$user
); );
$connection = mysql_connect_db( $connection = mysql_connect_db(
@ -786,7 +774,7 @@ function update_user_password(string $user, string $password_new)
return db_process_sql_update( return db_process_sql_update(
'tusuario', 'tusuario',
[ [
'password' => md5($password_new), 'password' => ($column_type === false) ? md5($password_new) : password_hash($password_new, PASSWORD_BCRYPT),
'last_pass_change' => date('Y/m/d H:i:s', get_system_time()), 'last_pass_change' => date('Y/m/d H:i:s', get_system_time()),
], ],
['id_user' => $user] ['id_user' => $user]
@ -1050,7 +1038,14 @@ function create_user_and_permisions_ldap(
$values['id_user'] = $id_user; $values['id_user'] = $id_user;
if ($config['ldap_save_password'] || $config['ad_save_password']) { if ($config['ldap_save_password'] || $config['ad_save_password']) {
$values['password'] = md5($password); $column_type = db_get_column_type('tusuario', 'password');
if (empty($column_type) === false && isset($column_type[0]['COLUMN_TYPE'])) {
$column_type = ($column_type[0]['COLUMN_TYPE'] === 'varchar(60)');
} else {
$column_type = false;
}
$values['password'] = ($column_type === false) ? md5($password) : password_hash($password, PASSWORD_BCRYPT);
} }
$values['last_connect'] = 0; $values['last_connect'] = 0;
@ -1482,11 +1477,26 @@ function change_local_user_pass_ldap($id_user, $password)
$local_user_pass = db_get_value_filter('password', 'tusuario', ['id_user' => $id_user]); $local_user_pass = db_get_value_filter('password', 'tusuario', ['id_user' => $id_user]);
$return = false; $return = false;
if (md5($password) !== $local_user_pass) {
$values_update = [];
$values_update['password'] = md5($password);
$return = db_process_sql_update('tusuario', $values_update, ['id_user' => $id_user]); $column_type = db_get_column_type('tusuario', 'password');
if (empty($column_type) === false && isset($column_type[0]['COLUMN_TYPE'])) {
$column_type = ($column_type[0]['COLUMN_TYPE'] === 'varchar(60)');
} else {
$column_type = false;
}
$values_update = [];
if ($column_type === false) {
if (md5($password) !== $local_user_pass) {
$values_update['password'] = md5($password);
$return = db_process_sql_update('tusuario', $values_update, ['id_user' => $id_user]);
}
} else {
if (password_hash($password, PASSWORD_BCRYPT) !== $local_user_pass) {
$values_update['password'] = password_hash($password, PASSWORD_BCRYPT);
$return = db_process_sql_update('tusuario', $values_update, ['id_user' => $id_user]);
}
} }
return $return; return $return;

View File

@ -42,40 +42,23 @@ require_once $config['homedir'].'/include/functions_agents.php';
require_once $config['homedir'].'/include/functions_tags.php'; require_once $config['homedir'].'/include/functions_tags.php';
$data_raw = get_parameter('data'); $data_raw = get_parameter('data');
$data_decoded = json_decode(base64_decode($data_raw), true); $data_decoded = json_decode(io_safe_output($data_raw), true);
if (json_last_error() === JSON_ERROR_NONE) { if (json_last_error() === JSON_ERROR_NONE) {
$data = urldecode($data_decoded['data']); $data = $data_decoded['data'];
$session_id = urldecode($data_decoded['session_id']); $session_id = $data_decoded['session_id'];
$data_combined = urldecode($data_decoded['data_combined']); $type_graph_pdf = $data_decoded['type_graph_pdf'];
$data_module_list = urldecode($data_decoded['data_module_list']);
$type_graph_pdf = urldecode($data_decoded['type_graph_pdf']); $data_combined = [];
$viewport_width = urldecode($data_decoded['viewport_width']); if (isset($data_decoded['data_combined']) === true) {
$data_combined = $data_decoded['data_combined'];
}
$data_module_list = [];
if (isset($data_decoded['data_module_list']) === true) {
$data_module_list = $data_decoded['data_module_list'];
}
} }
/**
* Echo to stdout a PhantomJS callback call.
*
* @return void
*/
function echoPhantomCallback()
{
?>
<script type="text/javascript">
$('document').ready(function () {
setTimeout(function () {
try {
var status = window.callPhantom({ status: "loaded" });
} catch (error) {
console.log("CALLBACK ERROR", error.message)
}
}, 100);
});
</script>
<?php
}
// Initialize session. // Initialize session.
global $config; global $config;
@ -99,7 +82,6 @@ if (check_login(false) === false) {
</head> </head>
<body> <body>
<h1>Access is not granted</h1> <h1>Access is not granted</h1>
<?php echoPhantomCallback(); ?>
</body> </body>
</html> </html>
@ -108,10 +90,16 @@ if (check_login(false) === false) {
} }
// Access granted. // Access granted.
$params = json_decode($data, true); $params = $data;
if (isset($params['backgroundColor']) === false) {
$params['backgroundColor'] = 'inherit';
}
// Metaconsole connection to the node. // Metaconsole connection to the node.
$server_id = $params['server_id']; $server_id = 0;
if (isset($params['server_id']) === true) {
$server_id = $params['server_id'];
}
if (is_metaconsole() === true && empty($server_id) === false) { if (is_metaconsole() === true && empty($server_id) === false) {
$server = metaconsole_get_connection_by_id($server_id); $server = metaconsole_get_connection_by_id($server_id);
@ -124,7 +112,6 @@ if (is_metaconsole() === true && empty($server_id) === false) {
ui_print_error_message( ui_print_error_message(
__('There was a problem connecting with the node') __('There was a problem connecting with the node')
); );
echoPhantomCallback();
?> ?>
</body> </body>
</html> </html>
@ -133,7 +120,6 @@ if (is_metaconsole() === true && empty($server_id) === false) {
} }
} }
$user_language = get_user_language($config['id_user']); $user_language = get_user_language($config['id_user']);
if (file_exists('languages/'.$user_language.'.mo') === true) { if (file_exists('languages/'.$user_language.'.mo') === true) {
$cfr = new CachedFileReader('languages/'.$user_language.'.mo'); $cfr = new CachedFileReader('languages/'.$user_language.'.mo');
@ -146,16 +132,16 @@ if (file_exists('languages/'.$user_language.'.mo') === true) {
<html> <html>
<head> <head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Pandora FMS Graph (<?php echo agents_get_alias($agent_id).' - '.$interface_name; ?>)</title> <title>Pandora FMS Graph</title>
<link rel="stylesheet" href="styles/pandora.css" type="text/css" /> <link rel="stylesheet" href="styles/pandora.css" type="text/css" />
<link rel="stylesheet" href="styles/pandora_minimal.css" type="text/css" /> <link rel="stylesheet" href="styles/pandora_minimal.css" type="text/css" />
<link rel="stylesheet" href="styles/js/jquery-ui.min.css" type="text/css" /> <link rel="stylesheet" href="styles/js/jquery-ui.min.css" type="text/css" />
<link rel="stylesheet" href="styles/js/jquery-ui_custom.css" type="text/css" /> <link rel="stylesheet" href="styles/js/jquery-ui_custom.css" type="text/css" />
<script language="javascript" type='text/javascript' src='javascript/pandora.js'></script>
<script language="javascript" type='text/javascript' src='javascript/pandora_ui.js'></script> <script language="javascript" type='text/javascript' src='javascript/pandora_ui.js'></script>
<script language="javascript" type='text/javascript' src='javascript/jquery.current.js'></script> <script language="javascript" type='text/javascript' src='javascript/jquery.current.js'></script>
<script language="javascript" type='text/javascript' src='javascript/jquery.pandora.js'></script> <script language="javascript" type='text/javascript' src='javascript/jquery.pandora.js'></script>
<script language="javascript" type='text/javascript' src='javascript/jquery-ui.min.js'></script> <script language="javascript" type='text/javascript' src='javascript/jquery-ui.min.js'></script>
<script language="javascript" type='text/javascript' src='javascript/pandora.js'></script>
<script language="javascript" type="text/javascript" src="graphs/flot/jquery.flot.js"></script> <script language="javascript" type="text/javascript" src="graphs/flot/jquery.flot.js"></script>
<script language="javascript" type="text/javascript" src="graphs/flot/jquery.flot.min.js"></script> <script language="javascript" type="text/javascript" src="graphs/flot/jquery.flot.min.js"></script>
<script language="javascript" type="text/javascript" src="graphs/flot/jquery.flot.time.js"></script> <script language="javascript" type="text/javascript" src="graphs/flot/jquery.flot.time.js"></script>
@ -170,48 +156,46 @@ if (file_exists('languages/'.$user_language.'.mo') === true) {
<script language="javascript" type="text/javascript" src="graphs/flot/jquery.flot.exportdata.pandora.js"></script> <script language="javascript" type="text/javascript" src="graphs/flot/jquery.flot.exportdata.pandora.js"></script>
<script language="javascript" type="text/javascript" src="graphs/flot/jquery.flot.axislabels.js"></script> <script language="javascript" type="text/javascript" src="graphs/flot/jquery.flot.axislabels.js"></script>
<script language="javascript" type="text/javascript" src="graphs/flot/pandora.flot.js"></script> <script language="javascript" type="text/javascript" src="graphs/flot/pandora.flot.js"></script>
<script language="javascript" type="text/javascript" src="graphs/chartjs/chart.js"></script>
<script language="javascript" type="text/javascript" src="graphs/chartjs/chartjs-plugin-datalabels.min.js"></script>
</head> </head>
<body style='background-color: <?php echo $params['backgroundColor']; ?>;'> <body style='width:794px; margin: 0px; background-color: <?php echo $params['backgroundColor']; ?>;'>
<?php <?php
$params['only_image'] = false; $params['only_image'] = false;
$params['menu'] = false; $params['menu'] = false;
$params['disable_black'] = true; $params['disable_black'] = true;
$params_combined = json_decode($data_combined, true); $params_combined = $data_combined;
$module_list = json_decode($data_module_list, true); $module_list = $data_module_list;
if (isset($params['vconsole']) === false || $params['vconsole'] === false) { $viewport = [
if ((int) $viewport_width > 0) { 'width' => 0,
$params['width'] = (int) $viewport_width; 'height' => 0,
];
$style = 'width:100%;';
if (isset($params['options']['viewport']) === true) {
$viewport = $params['options']['viewport'];
if (empty($viewport['width']) === false) {
$style .= 'width:'.$viewport['width'].'px;';
} }
if ((isset($params['width']) === false if (empty($viewport['height']) === false) {
|| ($params['width'] <= 0)) $style .= 'height:'.$viewport['height'].'px;';
) {
if ((int) $params['width'] <= 0) {
$params['width'] = 650;
}
if ((int) $params['landscape'] === 1) {
$params['width'] = 850;
}
if ($type_graph_pdf === 'slicebar') {
$params['width'] = 100;
$params['height'] = 70;
}
} }
} }
echo '<div>'; echo '<div id="container-chart-generator-item" style="'.$style.' margin:0px;">';
switch ($type_graph_pdf) { switch ($type_graph_pdf) {
case 'combined': case 'combined':
$params['pdf'] = true; $params['pdf'] = true;
echo graphic_combined_module( $result = graphic_combined_module(
$module_list, $module_list,
$params, $params,
$params_combined $params_combined
); );
echo $result;
break; break;
case 'sparse': case 'sparse':
@ -219,67 +203,40 @@ if (file_exists('languages/'.$user_language.'.mo') === true) {
echo grafico_modulo_sparse($params); echo grafico_modulo_sparse($params);
break; break;
case 'pie_chart': case 'pie_graph':
$params['pdf'] = true; $params['pdf'] = true;
echo flot_pie_chart( $chart = get_build_setup_charts(
$params['values'], 'PIE',
$params['keys'], $params['options'],
$params['width'], $params['chart_data']
$params['height'],
$params['water_mark_url'],
$params['font'],
$config['font_size'],
$params['legend_position'],
$params['colors'],
$params['hide_labels']
); );
echo $chart->render(true);
break; break;
case 'vbar': case 'vbar_graph':
$params['pdf'] = true; $params['pdf'] = true;
echo flot_vcolumn_chart($params); $chart = get_build_setup_charts(
break; 'BAR',
$params['options'],
case 'hbar': $params['chart_data']
$params['pdf'] = true;
echo flot_hcolumn_chart(
$params['chart_data'],
$params['width'],
$params['height'],
$params['water_mark_url'],
$params['font'],
$config['font_size'],
$params['backgroundColor'],
$params['tick_color'],
$params['val_min'],
$params['val_max'],
$params['pdf']
); );
echo $chart->render(true);
break; break;
case 'ring_graph': case 'ring_graph':
$params['pdf'] = true; $params['pdf'] = true;
echo flot_custom_pie_chart( $params['options']['width'] = 500;
$params['chart_data'], $params['options']['height'] = 500;
$params['width'],
$params['height'], $chart = get_build_setup_charts(
$params['colors'], 'DOUGHNUT',
$params['module_name_list'], $params['options'],
$params['long_index'], $params['chart_data']
$params['no_data'],
false,
'',
$params['water_mark'],
$params['font'],
$config['font_size'],
$params['unit'],
$params['ttl'],
$params['homeurl'],
$params['background_color'],
$params['legend_position'],
$params['background_color'],
$params['pdf']
); );
echo $chart->render(true);
break; break;
case 'slicebar': case 'slicebar':
@ -313,7 +270,6 @@ if (file_exists('languages/'.$user_language.'.mo') === true) {
} }
echo '</div>'; echo '</div>';
echoPhantomCallback();
?> ?>
</body> </body>
</html> </html>

View File

@ -2636,6 +2636,8 @@ class AgentWizard extends HTML
*/ */
private function resultsInterfaceWizard() private function resultsInterfaceWizard()
{ {
global $config;
$generalInterfaceModules = $this->getInterfacesModules(); $generalInterfaceModules = $this->getInterfacesModules();
$generalInterfaceTables = []; $generalInterfaceTables = [];
$generalInterfaceModulesUpdated = []; $generalInterfaceModulesUpdated = [];
@ -2849,7 +2851,12 @@ class AgentWizard extends HTML
// Format current value with thousands and decimals. // Format current value with thousands and decimals.
if (is_numeric($currentValue) === true) { if (is_numeric($currentValue) === true) {
$decimals = (is_float($currentValue) === true) ? 2 : 0; $decimals = (is_float($currentValue) === true) ? 2 : 0;
$currentValue = number_format($currentValue, $decimals); $currentValue = number_format(
$currentValue,
$decimals,
$config['decimal_separator'],
$config['thousand_separator']
);
} }
// It unit of measure have data, attach to current value. // It unit of measure have data, attach to current value.

View File

@ -167,7 +167,7 @@ class ConsoleSupervisor
* NOTIF.PHP.UPLOAD_MAX_FILESIZE * NOTIF.PHP.UPLOAD_MAX_FILESIZE
* NOTIF.PHP.MEMORY_LIMIT * NOTIF.PHP.MEMORY_LIMIT
* NOTIF.PHP.DISABLE_FUNCTIONS * NOTIF.PHP.DISABLE_FUNCTIONS
* NOTIF.PHP.PHANTOMJS * NOTIF.PHP.CHROMIUM
* NOTIF.PHP.VERSION * NOTIF.PHP.VERSION
*/ */
@ -349,7 +349,7 @@ class ConsoleSupervisor
* NOTIF.PHP.UPLOAD_MAX_FILESIZE * NOTIF.PHP.UPLOAD_MAX_FILESIZE
* NOTIF.PHP.MEMORY_LIMIT * NOTIF.PHP.MEMORY_LIMIT
* NOTIF.PHP.DISABLE_FUNCTIONS * NOTIF.PHP.DISABLE_FUNCTIONS
* NOTIF.PHP.PHANTOMJS * NOTIF.PHP.CHROMIUM
* NOTIF.PHP.VERSION * NOTIF.PHP.VERSION
*/ */
@ -528,11 +528,7 @@ class ConsoleSupervisor
*/ */
public function maintenanceOperations() public function maintenanceOperations()
{ {
/*
* Process cache clean if needed.
*/
$this->checkCleanPhantomCache();
} }
@ -688,7 +684,7 @@ class ConsoleSupervisor
case 'NOTIF.PHP.UPLOAD_MAX_FILESIZE': case 'NOTIF.PHP.UPLOAD_MAX_FILESIZE':
case 'NOTIF.PHP.MEMORY_LIMIT': case 'NOTIF.PHP.MEMORY_LIMIT':
case 'NOTIF.PHP.DISABLE_FUNCTIONS': case 'NOTIF.PHP.DISABLE_FUNCTIONS':
case 'NOTIF.PHP.PHANTOMJS': case 'NOTIF.PHP.CHROMIUM':
case 'NOTIF.PHP.VERSION': case 'NOTIF.PHP.VERSION':
case 'NOTIF.HISTORYDB': case 'NOTIF.HISTORYDB':
case 'NOTIF.PANDORADB': case 'NOTIF.PANDORADB':
@ -1431,9 +1427,9 @@ class ConsoleSupervisor
$PHPmemory_limit_min = config_return_in_bytes('-1'); $PHPmemory_limit_min = config_return_in_bytes('-1');
} }
// PhantomJS status. // Chromium status.
$phantomjs_dir = io_safe_output($config['phantomjs_bin']); $chromium_dir = io_safe_output($config['chromium_path']);
$result_ejecution = exec($phantomjs_dir.'/phantomjs --version'); $result_ejecution = exec($chromium_dir.' --version');
// PHP version checks. // PHP version checks.
$php_version = phpversion(); $php_version = phpversion();
@ -1577,21 +1573,20 @@ class ConsoleSupervisor
} }
if (!isset($result_ejecution) || $result_ejecution == '') { if (!isset($result_ejecution) || $result_ejecution == '') {
$url = 'https://pandorafms.com/manual/en/documentation/02_installation/04_configuration#Phantomjs'; $url = 'https://www.chromium.org/getting-involved/download-chromium/';
if ($config['language'] == 'es') { // if ($config['language'] == 'es') {
$url = 'https://pandorafms.com/manual/es/documentation/02_installation/04_configuration#Phantomjs'; // $url = 'https://pandorafms.com/manual/es/documentation/02_installation/04_configuration#Phantomjs';
} // }
$this->notify( $this->notify(
[ [
'type' => 'NOTIF.PHP.PHANTOMJS', 'type' => 'NOTIF.PHP.CHROMIUM',
'title' => __('PhantomJS is not installed'), 'title' => __('chromium is not installed'),
'message' => __('To be able to create images of the graphs for PDFs, please install the PhantomJS extension. For that, it is necessary to follow these steps:'), 'message' => __('To be able to create images of the graphs for PDFs, please install the chromium extension. For that, it is necessary to follow these steps:'),
'url' => $url, 'url' => $url,
] ]
); );
} else { } else {
$this->cleanNotifications('NOTIF.PHP.PHANTOMJS'); $this->cleanNotifications('NOTIF.PHP.CHROMIUM');
} }
if ($php_version_array[0] < 8) { if ($php_version_array[0] < 8) {
@ -2698,34 +2693,6 @@ class ConsoleSupervisor
} }
/**
* Clean Phantom cache if needed.
*
* @return void
*/
public function checkCleanPhantomCache()
{
global $config;
if (isset($config['clean_phantomjs_cache']) !== true
|| (int) $config['clean_phantomjs_cache'] !== 1
) {
return;
}
$cache_dir = $config['homedir'].'/attachment/cache';
if (is_dir($cache_dir) === true) {
Files::rmrf($cache_dir);
}
// Clean process has ended.
config_update_value(
'clean_phantomjs_cache',
0
);
}
/** /**
* Verifies the status of synchronization queue and warns if something is * Verifies the status of synchronization queue and warns if something is
* not working as expected. * not working as expected.

View File

@ -141,8 +141,9 @@ class Diagnostics extends Wizard
'images/pdf.png', 'images/pdf.png',
true, true,
[ [
'title' => __('Export to PDF'), 'title' => __('Export to PDF'),
'class' => 'invert_filter', 'class' => 'invert_filter',
'onclick' => 'blockResubmit($(this))',
] ]
); );
$header_buttons = [ $header_buttons = [
@ -986,7 +987,7 @@ class Diagnostics extends Wizard
], ],
'tablesFragmentationValue' => [ 'tablesFragmentationValue' => [
'name' => __('Tables fragmentation (current value)'), 'name' => __('Tables fragmentation (current value)'),
'value' => number_format($tFragmentationValue, 2).'%', 'value' => number_format($tFragmentationValue, 2, $config['decimal_separator'], $config['thousand_separator']).'%',
], ],
'tablesFragmentationStatus' => [ 'tablesFragmentationStatus' => [
'name' => __('Table fragmentation status'), 'name' => __('Table fragmentation status'),
@ -1121,7 +1122,9 @@ class Diagnostics extends Wizard
if ($totalModuleIntervalTime !== false) { if ($totalModuleIntervalTime !== false) {
$averageTime = number_format( $averageTime = number_format(
((int) $totalNetworkModules / (int) $totalModuleIntervalTime), ((int) $totalNetworkModules / (int) $totalModuleIntervalTime),
3 3,
$config['decimal_separator'],
$config['thousand_separator']
); );
} }
@ -1273,11 +1276,16 @@ class Diagnostics extends Wizard
FROM tagente_datos' FROM tagente_datos'
); );
$modulesDataCount = db_get_value_sql(
'SELECT count(*) * 300 FROM (SELECT * FROM tagente_datos GROUP BY id_agente_modulo) AS totalmodules'
);
$modulesDataCount = ($modulesDataCount >= 500000) ? $modulesDataCount : 500000;
$taMsg = __( $taMsg = __(
'The tagente_datos table contains too much data. A historical database is recommended.' 'The tagente_datos table contains too much data. A historical database is recommended.'
); );
$taStatus = 0; $taStatus = 0;
if ($agentDataCount <= 3000000) { if ($agentDataCount <= $modulesDataCount) {
$taMsg = __( $taMsg = __(
'The tagente_datos table contains an acceptable amount of data.' 'The tagente_datos table contains an acceptable amount of data.'
); );
@ -1748,7 +1756,7 @@ class Diagnostics extends Wizard
$sizeServerLog = number_format($fileSize); $sizeServerLog = number_format($fileSize);
$sizeServerLog = (0 + str_replace(',', '', $sizeServerLog)); $sizeServerLog = (0 + str_replace(',', '', $sizeServerLog));
$value = number_format(($fileSize / $mega), 3); $value = number_format(($fileSize / $mega), 3, $config['decimal_separator'], $config['thousand_separator']);
$message = __('You have more than 10 MB of logs'); $message = __('You have more than 10 MB of logs');
$status = 0; $status = 0;
if ($sizeServerLog <= $tenMega) { if ($sizeServerLog <= $tenMega) {

View File

@ -506,6 +506,7 @@ class ModuleTemplates extends HTML
header('Content-Disposition: attachment; filename='.preg_replace('/\s/', '_', $fileName).'.csv'); header('Content-Disposition: attachment; filename='.preg_replace('/\s/', '_', $fileName).'.csv');
header('Pragma: no-cache'); header('Pragma: no-cache');
header('Expires: 0'); header('Expires: 0');
setDownloadCookieToken();
// Clean up output buffering // Clean up output buffering
while (@ob_end_clean()) { while (@ob_end_clean()) {
@ -931,7 +932,7 @@ class ModuleTemplates extends HTML
] ]
); );
$data[3] = '<a href="'.$this->baseUrl.'&action=delete&id_np='.$row['id_np'].'" onclick="if (!confirm(\''.__('Are you sure?').'\')) return false;">'.html_print_image('images/cross.png', true, ['title' => __('Delete'), 'class' => 'invert_filter']).'</a>'; $data[3] = '<a href="'.$this->baseUrl.'&action=delete&id_np='.$row['id_np'].'" onclick="if (!confirm(\''.__('Are you sure?').'\')) return false;">'.html_print_image('images/cross.png', true, ['title' => __('Delete'), 'class' => 'invert_filter']).'</a>';
$data[3] .= '<a href="'.$this->baseUrl.'&action=export&id_np='.$row['id_np'].'">'.html_print_image('images/csv.png', true, ['title' => __('Export to CSV'), 'class' => 'invert_filter']).'</a>'; $data[3] .= '<a href="'.$this->baseUrl.'&action=export&id_np='.$row['id_np'].'" onclick="blockResubmit($(this))">'.html_print_image('images/csv.png', true, ['title' => __('Export to CSV'), 'class' => 'invert_filter']).'</a>';
array_push($table->data, $data); array_push($table->data, $data);
} }

View File

@ -776,7 +776,7 @@ class NetworkMap
// Search. // Search.
if ($this->idTask) { if ($this->idTask) {
// Network map, based on discovery task. // Network map, based on discovery task.
return get_discovery_agents($this->idTask); enterprise_hook('get_discovery_agents', [$this->idTask]);
} }
if ($this->network) { if ($this->network) {
@ -1672,7 +1672,7 @@ class NetworkMap
if (isset($source_data['color'])) { if (isset($source_data['color'])) {
$item['color'] = $source_data['color']; $item['color'] = $source_data['color'];
} else { } else {
if (empty($node['status']) && empty($node['id_module']) && !empty($node['style']['id_networkmap'])) { if (empty($node['style']['id_networkmap']) === false) {
$status_aux = get_status_color_networkmap_fictional_point($node['style']['id_networkmap']); $status_aux = get_status_color_networkmap_fictional_point($node['style']['id_networkmap']);
$item['color'] = $status_aux; $item['color'] = $status_aux;
} else { } else {

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