mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-09-26 11:29:12 +02:00
Merge branch 'develop' into ent-10153-el-modo-mantenimiento-en-url-anonima-compartida-no-funciona
This commit is contained in:
commit
a5852f3060
@ -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
|
||||||
|
@ -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
|
||||||
|
@ -410,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"
|
||||||
|
@ -488,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"
|
||||||
|
@ -420,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
|
||||||
@ -432,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}"
|
||||||
@ -449,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
|
||||||
|
@ -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
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# Base config file for Pandora FMS agents
|
# Base config file for Pandora FMS agents
|
||||||
# Version 7.0NG.767, AIX version
|
# Version 7.0NG.768, AIX version
|
||||||
# Licensed under GPL license v2,
|
# Licensed under GPL license v2,
|
||||||
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
|
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
|
||||||
# http://www.pandorafms.com
|
# http://www.pandorafms.com
|
||||||
|
@ -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
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# Base config file for Pandora FMS agents
|
# Base config file for Pandora FMS agents
|
||||||
# Version 7.0NG.767, FreeBSD Version
|
# Version 7.0NG.768, FreeBSD Version
|
||||||
# Licensed under GPL license v2,
|
# Licensed under GPL license v2,
|
||||||
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
|
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
|
||||||
# http://www.pandorafms.com
|
# http://www.pandorafms.com
|
||||||
@ -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
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# Base config file for Pandora FMS agents
|
# Base config file for Pandora FMS agents
|
||||||
# Version 7.0NG.767, HP-UX Version
|
# Version 7.0NG.768, HP-UX Version
|
||||||
# Licensed under GPL license v2,
|
# Licensed under GPL license v2,
|
||||||
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
|
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
|
||||||
# http://www.pandorafms.com
|
# http://www.pandorafms.com
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# Base config file for Pandora FMS agents
|
# Base config file for Pandora FMS agents
|
||||||
# Version 7.0NG.767, GNU/Linux
|
# Version 7.0NG.768, GNU/Linux
|
||||||
# Licensed under GPL license v2,
|
# Licensed under GPL license v2,
|
||||||
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
|
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
|
||||||
# http://www.pandorafms.com
|
# http://www.pandorafms.com
|
||||||
@ -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
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# Base config file for Pandora FMS agents
|
# Base config file for Pandora FMS agents
|
||||||
# Version 7.0NG.767, GNU/Linux
|
# Version 7.0NG.768, GNU/Linux
|
||||||
# Licensed under GPL license v2,
|
# Licensed under GPL license v2,
|
||||||
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
|
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
|
||||||
# http://www.pandorafms.com
|
# http://www.pandorafms.com
|
||||||
|
@ -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
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# Base config file for Pandora FMS agents
|
# Base config file for Pandora FMS agents
|
||||||
# Version 7.0NG.767, Solaris Version
|
# Version 7.0NG.768, Solaris Version
|
||||||
# Licensed under GPL license v2,
|
# Licensed under GPL license v2,
|
||||||
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
|
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
|
||||||
# http://www.pandorafms.com
|
# http://www.pandorafms.com
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
# Base config file for Pandora FMS Windows Agent
|
# Base config file for Pandora FMS Windows Agent
|
||||||
# (c) 2006-2021 Artica Soluciones Tecnologicas
|
# (c) 2006-2021 Artica Soluciones Tecnologicas
|
||||||
# Version 7.0NG.767
|
# Version 7.0NG.768
|
||||||
# This program is Free Software, you can redistribute it and/or modify it
|
# This program is Free Software, you can redistribute it and/or modify it
|
||||||
# under the terms of the GNU General Public Licence as published by the Free Software
|
# under the terms of the GNU General Public Licence as published by the Free Software
|
||||||
# Foundation; either version 2 of the Licence or any later version
|
# Foundation; either version 2 of the Licence or any later version
|
||||||
|
@ -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
|
||||||
|
|
||||||
|
@ -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
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
# Fichero de configuracion base de agentes de Pandora
|
# Fichero de configuracion base de agentes de Pandora
|
||||||
# Base config file for Pandora agents
|
# Base config file for Pandora agents
|
||||||
# Version 7.0NG.767, AIX version
|
# Version 7.0NG.768, AIX version
|
||||||
|
|
||||||
# General Parameters
|
# General Parameters
|
||||||
# ==================
|
# ==================
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
# Fichero de configuracion base de agentes de Pandora
|
# Fichero de configuracion base de agentes de Pandora
|
||||||
# Base config file for Pandora agents
|
# Base config file for Pandora agents
|
||||||
# Version 7.0NG.767
|
# Version 7.0NG.768
|
||||||
# FreeBSD/IPSO version
|
# FreeBSD/IPSO version
|
||||||
# Licenced under GPL licence, 2003-2007 Sancho Lerena
|
# Licenced under GPL licence, 2003-2007 Sancho Lerena
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
# Fichero de configuracion base de agentes de Pandora
|
# Fichero de configuracion base de agentes de Pandora
|
||||||
# Base config file for Pandora agents
|
# Base config file for Pandora agents
|
||||||
# Version 7.0NG.767, HPUX Version
|
# Version 7.0NG.768, HPUX Version
|
||||||
|
|
||||||
# General Parameters
|
# General Parameters
|
||||||
# ==================
|
# ==================
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# Base config file for Pandora FMS agents
|
# Base config file for Pandora FMS agents
|
||||||
# Version 7.0NG.767
|
# Version 7.0NG.768
|
||||||
# Licensed under GPL license v2,
|
# Licensed under GPL license v2,
|
||||||
# (c) 2003-2021 Artica Soluciones Tecnologicas
|
# (c) 2003-2021 Artica Soluciones Tecnologicas
|
||||||
# please visit http://pandora.sourceforge.net
|
# please visit http://pandora.sourceforge.net
|
||||||
@ -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
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# Base config file for Pandora FMS agents
|
# Base config file for Pandora FMS agents
|
||||||
# Version 7.0NG.767
|
# Version 7.0NG.768
|
||||||
# Licensed under GPL license v2,
|
# Licensed under GPL license v2,
|
||||||
# (c) 2003-2021 Artica Soluciones Tecnologicas
|
# (c) 2003-2021 Artica Soluciones Tecnologicas
|
||||||
# please visit http://pandora.sourceforge.net
|
# please visit http://pandora.sourceforge.net
|
||||||
@ -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
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# Base config file for Pandora FMS agents
|
# Base config file for Pandora FMS agents
|
||||||
# Version 7.0NG.767
|
# Version 7.0NG.768
|
||||||
# Licensed under GPL license v2,
|
# Licensed under GPL license v2,
|
||||||
# please visit http://pandora.sourceforge.net
|
# please visit http://pandora.sourceforge.net
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
# Fichero de configuracion base de agentes de Pandora
|
# Fichero de configuracion base de agentes de Pandora
|
||||||
# Base config file for Pandora agents
|
# Base config file for Pandora agents
|
||||||
# Version 7.0NG.767, Solaris version
|
# Version 7.0NG.768, Solaris version
|
||||||
|
|
||||||
# General Parameters
|
# General Parameters
|
||||||
# ==================
|
# ==================
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# Base config file for Pandora FMS agents
|
# Base config file for Pandora FMS agents
|
||||||
# Version 7.0NG.767, AIX version
|
# Version 7.0NG.768, AIX version
|
||||||
# Licensed under GPL license v2,
|
# Licensed under GPL license v2,
|
||||||
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
|
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
|
||||||
# http://www.pandorafms.com
|
# http://www.pandorafms.com
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
package: pandorafms-agent-unix
|
package: pandorafms-agent-unix
|
||||||
Version: 7.0NG.767-230116
|
Version: 7.0NG.768-230124
|
||||||
Architecture: all
|
Architecture: all
|
||||||
Priority: optional
|
Priority: optional
|
||||||
Section: admin
|
Section: admin
|
||||||
|
@ -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-230116"
|
pandora_version="7.0NG.768-230124"
|
||||||
|
|
||||||
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
|
||||||
|
@ -31,7 +31,7 @@ fi
|
|||||||
if [ "$#" -ge 2 ]; then
|
if [ "$#" -ge 2 ]; then
|
||||||
VERSION="$2"
|
VERSION="$2"
|
||||||
else
|
else
|
||||||
VERSION="7.0NG.767"
|
VERSION="7.0NG.768"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Path for the generated DMG file
|
# Path for the generated DMG file
|
||||||
|
@ -19,11 +19,11 @@
|
|||||||
<choice id="com.pandorafms.pandorafms_src" visible="false">
|
<choice id="com.pandorafms.pandorafms_src" visible="false">
|
||||||
<pkg-ref id="com.pandorafms.pandorafms_src"/>
|
<pkg-ref id="com.pandorafms.pandorafms_src"/>
|
||||||
</choice>
|
</choice>
|
||||||
<pkg-ref id="com.pandorafms.pandorafms_src" version="7.0NG.767" onConclusion="none">pandorafms_src.pdk</pkg-ref>
|
<pkg-ref id="com.pandorafms.pandorafms_src" version="7.0NG.768" onConclusion="none">pandorafms_src.pdk</pkg-ref>
|
||||||
<choice id="com.pandorafms.pandorafms_uninstall" visible="true" customLocation="/Applications">
|
<choice id="com.pandorafms.pandorafms_uninstall" visible="true" customLocation="/Applications">
|
||||||
<pkg-ref id="com.pandorafms.pandorafms_uninstall"/>
|
<pkg-ref id="com.pandorafms.pandorafms_uninstall"/>
|
||||||
</choice>
|
</choice>
|
||||||
<pkg-ref id="com.pandorafms.pandorafms_uninstall" version="7.0NG.767" onConclusion="none">pandorafms_uninstall.pdk</pkg-ref>
|
<pkg-ref id="com.pandorafms.pandorafms_uninstall" version="7.0NG.768" onConclusion="none">pandorafms_uninstall.pdk</pkg-ref>
|
||||||
<!-- <installation-check script="check()" />
|
<!-- <installation-check script="check()" />
|
||||||
<script>
|
<script>
|
||||||
<![CDATA[
|
<![CDATA[
|
||||||
|
@ -5,9 +5,9 @@
|
|||||||
<key>CFBundleIconFile</key> <string>pandorafms.icns</string>
|
<key>CFBundleIconFile</key> <string>pandorafms.icns</string>
|
||||||
<key>CFBundleIdentifier</key> <string>com.pandorafms.pandorafms_uninstall</string>
|
<key>CFBundleIdentifier</key> <string>com.pandorafms.pandorafms_uninstall</string>
|
||||||
|
|
||||||
<key>CFBundleVersion</key> <string>7.0NG.767</string>
|
<key>CFBundleVersion</key> <string>7.0NG.768</string>
|
||||||
<key>CFBundleGetInfoString</key> <string>7.0NG.767 Pandora FMS Agent uninstaller for MacOS by Artica ST on Aug 2020</string>
|
<key>CFBundleGetInfoString</key> <string>7.0NG.768 Pandora FMS Agent uninstaller for MacOS by Artica ST on Aug 2020</string>
|
||||||
<key>CFBundleShortVersionString</key> <string>7.0NG.767</string>
|
<key>CFBundleShortVersionString</key> <string>7.0NG.768</string>
|
||||||
|
|
||||||
<key>NSPrincipalClass</key><string>NSApplication</string>
|
<key>NSPrincipalClass</key><string>NSApplication</string>
|
||||||
<key>NSMainNibFile</key><string>MainMenu</string>
|
<key>NSMainNibFile</key><string>MainMenu</string>
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# Base config file for Pandora FMS agents
|
# Base config file for Pandora FMS agents
|
||||||
# Version 7.0NG.767, GNU/Linux
|
# Version 7.0NG.768, GNU/Linux
|
||||||
# Licensed under GPL license v2,
|
# Licensed under GPL license v2,
|
||||||
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
|
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
|
||||||
# http://www.pandorafms.com
|
# http://www.pandorafms.com
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# Base config file for Pandora FMS agents
|
# Base config file for Pandora FMS agents
|
||||||
# Version 7.0NG.767, FreeBSD Version
|
# Version 7.0NG.768, FreeBSD Version
|
||||||
# Licensed under GPL license v2,
|
# Licensed under GPL license v2,
|
||||||
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
|
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
|
||||||
# http://www.pandorafms.com
|
# http://www.pandorafms.com
|
||||||
@ -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.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# Base config file for Pandora FMS agents
|
# Base config file for Pandora FMS agents
|
||||||
# Version 7.0NG.767, HP-UX Version
|
# Version 7.0NG.768, HP-UX Version
|
||||||
# Licensed under GPL license v2,
|
# Licensed under GPL license v2,
|
||||||
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
|
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
|
||||||
# http://www.pandorafms.com
|
# http://www.pandorafms.com
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# Base config file for Pandora FMS agents
|
# Base config file for Pandora FMS agents
|
||||||
# Version 7.0NG.767, GNU/Linux
|
# Version 7.0NG.768, GNU/Linux
|
||||||
# Licensed under GPL license v2,
|
# Licensed under GPL license v2,
|
||||||
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
|
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
|
||||||
# http://www.pandorafms.com
|
# http://www.pandorafms.com
|
||||||
@ -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.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# Base config file for Pandora FMS agents
|
# Base config file for Pandora FMS agents
|
||||||
# Version 7.0NG.767, GNU/Linux
|
# Version 7.0NG.768, GNU/Linux
|
||||||
# Licensed under GPL license v2,
|
# Licensed under GPL license v2,
|
||||||
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
|
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
|
||||||
# http://www.pandorafms.com
|
# http://www.pandorafms.com
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# Base config file for Pandora FMS agents
|
# Base config file for Pandora FMS agents
|
||||||
# Version 7.0NG.767, NetBSD Version
|
# Version 7.0NG.768, NetBSD Version
|
||||||
# Licensed under GPL license v2,
|
# Licensed under GPL license v2,
|
||||||
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
|
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
|
||||||
# http://www.pandorafms.com
|
# http://www.pandorafms.com
|
||||||
@ -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
|
||||||
|
@ -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
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# Base config file for Pandora FMS agents
|
# Base config file for Pandora FMS agents
|
||||||
# Version 7.0NG.767, Solaris Version
|
# Version 7.0NG.768, Solaris Version
|
||||||
# Licensed under GPL license v2,
|
# Licensed under GPL license v2,
|
||||||
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
|
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
|
||||||
# http://www.pandorafms.com
|
# http://www.pandorafms.com
|
||||||
|
@ -1014,8 +1014,8 @@ my $Sem = undef;
|
|||||||
# Semaphore used to control the number of threads
|
# Semaphore used to control the number of threads
|
||||||
my $ThreadSem = undef;
|
my $ThreadSem = undef;
|
||||||
|
|
||||||
use constant AGENT_VERSION => '7.0NG.767';
|
use constant AGENT_VERSION => '7.0NG.768';
|
||||||
use constant AGENT_BUILD => '230116';
|
use constant AGENT_BUILD => '230124';
|
||||||
|
|
||||||
# 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;
|
||||||
|
@ -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.768
|
||||||
%define release 230116
|
%define release 230124
|
||||||
|
|
||||||
Summary: Pandora FMS Linux agent, PERL version
|
Summary: Pandora FMS Linux agent, PERL version
|
||||||
Name: %{name}
|
Name: %{name}
|
||||||
|
@ -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.768
|
||||||
%define release 230116
|
%define release 230124
|
||||||
|
|
||||||
Summary: Pandora FMS Linux agent, PERL version
|
Summary: Pandora FMS Linux agent, PERL version
|
||||||
Name: %{name}
|
Name: %{name}
|
||||||
|
@ -9,8 +9,8 @@
|
|||||||
# Please see http://www.pandorafms.org. This code is licensed under GPL 2.0 license.
|
# Please see http://www.pandorafms.org. This code is licensed under GPL 2.0 license.
|
||||||
# **********************************************************************
|
# **********************************************************************
|
||||||
|
|
||||||
PI_VERSION="7.0NG.767"
|
PI_VERSION="7.0NG.768"
|
||||||
PI_BUILD="230116"
|
PI_BUILD="230124"
|
||||||
OS_NAME=`uname -s`
|
OS_NAME=`uname -s`
|
||||||
|
|
||||||
FORCE=0
|
FORCE=0
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
# Base config file for Pandora FMS Windows Agent
|
# Base config file for Pandora FMS Windows Agent
|
||||||
# (c) 2006-2021 Artica Soluciones Tecnologicas
|
# (c) 2006-2021 Artica Soluciones Tecnologicas
|
||||||
# Version 7.0NG.767
|
# Version 7.0NG.768
|
||||||
# This program is Free Software, you can redistribute it and/or modify it
|
# This program is Free Software, you can redistribute it and/or modify it
|
||||||
# under the terms of the GNU General Public Licence as published by the Free Software
|
# under the terms of the GNU General Public Licence as published by the Free Software
|
||||||
# Foundation; either version 2 of the Licence or any later version
|
# Foundation; either version 2 of the Licence or any later version
|
||||||
|
@ -3,7 +3,7 @@ AllowLanguageSelection
|
|||||||
{Yes}
|
{Yes}
|
||||||
|
|
||||||
AppName
|
AppName
|
||||||
{Pandora FMS Windows Agent v7.0NG.767}
|
{Pandora FMS Windows Agent v7.0NG.768}
|
||||||
|
|
||||||
ApplicationID
|
ApplicationID
|
||||||
{17E3D2CF-CA02-406B-8A80-9D31C17BD08F}
|
{17E3D2CF-CA02-406B-8A80-9D31C17BD08F}
|
||||||
@ -186,7 +186,7 @@ UpgradeApplicationID
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
Version
|
Version
|
||||||
{230116}
|
{230124}
|
||||||
|
|
||||||
ViewReadme
|
ViewReadme
|
||||||
{Yes}
|
{Yes}
|
||||||
|
@ -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 230116")
|
#define PANDORA_VERSION ("7.0NG.768 Build 230124")
|
||||||
|
|
||||||
string pandora_path;
|
string pandora_path;
|
||||||
string pandora_dir;
|
string pandora_dir;
|
||||||
|
@ -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 230116))"
|
VALUE "ProductVersion", "(7.0NG.768(Build 230124))"
|
||||||
VALUE "FileVersion", "1.0.0.0"
|
VALUE "FileVersion", "1.0.0.0"
|
||||||
END
|
END
|
||||||
END
|
END
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
package: pandorafms-console
|
package: pandorafms-console
|
||||||
Version: 7.0NG.767-230116
|
Version: 7.0NG.768-230124
|
||||||
Architecture: all
|
Architecture: all
|
||||||
Priority: optional
|
Priority: optional
|
||||||
Section: admin
|
Section: admin
|
||||||
|
@ -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-230116"
|
pandora_version="7.0NG.768-230124"
|
||||||
|
|
||||||
package_pear=0
|
package_pear=0
|
||||||
package_pandora=1
|
package_pandora=1
|
||||||
|
@ -1685,5 +1685,10 @@ enterprise/operation/agentes/manage_transmap.php
|
|||||||
enterprise/operation/agentes/manage_transmap_creation.php
|
enterprise/operation/agentes/manage_transmap_creation.php
|
||||||
enterprise/operation/agentes/manage_transmap_creation_phases_data.php
|
enterprise/operation/agentes/manage_transmap_creation_phases_data.php
|
||||||
enterprise/operation/agentes/transactional_map.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/test.js
|
||||||
include/web2image.js
|
include/web2image.js
|
||||||
|
File diff suppressed because one or more lines are too long
14
pandora_console/extras/mr/61.sql
Normal file
14
pandora_console/extras/mr/61.sql
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
START TRANSACTION;
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS `tsesion_filter` (
|
||||||
|
`id_filter` INT NOT NULL AUTO_INCREMENT,
|
||||||
|
`id_name` TEXT NULL,
|
||||||
|
`text` TEXT NULL,
|
||||||
|
`period` TEXT NULL,
|
||||||
|
`ip` TEXT NULL,
|
||||||
|
`type` TEXT NULL,
|
||||||
|
`user` TEXT NULL,
|
||||||
|
PRIMARY KEY (`id_filter`)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||||
|
|
||||||
|
COMMIT;
|
@ -459,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 = '';
|
||||||
@ -2384,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
|
||||||
|
263
pandora_console/godmode/agentes/inventory_manager.php
Normal file
263
pandora_console/godmode/agentes/inventory_manager.php
Normal 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 ' </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> ';
|
||||||
|
// 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> ';
|
||||||
|
// 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);
|
||||||
|
}
|
@ -290,7 +290,7 @@ $search_text = (string) get_parameter('search_text');
|
|||||||
$date_from = (string) get_parameter('date_from');
|
$date_from = (string) get_parameter('date_from');
|
||||||
$date_to = (string) get_parameter('date_to');
|
$date_to = (string) get_parameter('date_to');
|
||||||
$execution_type = (string) get_parameter('execution_type');
|
$execution_type = (string) get_parameter('execution_type');
|
||||||
$show_archived = (bool) get_parameter('archived');
|
$show_archived = (bool) get_parameter_switch('archived', false);
|
||||||
$agent_id = (int) get_parameter('agent_id');
|
$agent_id = (int) get_parameter('agent_id');
|
||||||
$agent_name = (string) ((empty($agent_id) === false) ? get_parameter('agent_name') : '');
|
$agent_name = (string) ((empty($agent_id) === false) ? get_parameter('agent_name') : '');
|
||||||
$module_id = (int) get_parameter('module_name_hidden');
|
$module_id = (int) get_parameter('module_name_hidden');
|
||||||
@ -313,12 +313,20 @@ $table_form = new StdClass();
|
|||||||
$table_form->class = 'databox filters';
|
$table_form->class = 'databox filters';
|
||||||
$table_form->width = '100%';
|
$table_form->width = '100%';
|
||||||
$table_form->rowstyle = [];
|
$table_form->rowstyle = [];
|
||||||
|
$table_form->cellstyle[0] = ['width: 100px;'];
|
||||||
|
$table_form->cellstyle[1] = ['width: 100px;'];
|
||||||
|
$table_form->cellstyle[1][2] = 'display: flex; align-items: center;';
|
||||||
|
$table_form->cellstyle[2] = ['width: 100px;'];
|
||||||
|
$table_form->cellstyle[3] = ['text-align: right;'];
|
||||||
|
$table_form->colspan[3][0] = 3;
|
||||||
$table_form->data = [];
|
$table_form->data = [];
|
||||||
|
|
||||||
$row = [];
|
$row = [];
|
||||||
|
|
||||||
// Search text.
|
// Search text.
|
||||||
$row[] = __('Search').' '.html_print_input_text(
|
$row[] = __('Search');
|
||||||
|
|
||||||
|
$row[] = html_print_input_text(
|
||||||
'search_text',
|
'search_text',
|
||||||
$search_text,
|
$search_text,
|
||||||
'',
|
'',
|
||||||
@ -356,7 +364,8 @@ $execution_type_fields = [
|
|||||||
'periodically' => __('Periodically'),
|
'periodically' => __('Periodically'),
|
||||||
'cron' => __('Cron'),
|
'cron' => __('Cron'),
|
||||||
];
|
];
|
||||||
$row[] = __('Execution type').' '.html_print_select(
|
$row[] = __('Execution type');
|
||||||
|
$row[] = html_print_select(
|
||||||
$execution_type_fields,
|
$execution_type_fields,
|
||||||
'execution_type',
|
'execution_type',
|
||||||
$execution_type,
|
$execution_type,
|
||||||
@ -368,11 +377,11 @@ $row[] = __('Execution type').' '.html_print_select(
|
|||||||
false
|
false
|
||||||
);
|
);
|
||||||
// Show past downtimes.
|
// Show past downtimes.
|
||||||
$row[] = __('Show past downtimes').' '.html_print_checkbox(
|
$row[] = __('Show past downtimes').' '.html_print_switch(
|
||||||
'archived',
|
[
|
||||||
1,
|
'name' => 'archived',
|
||||||
$show_archived,
|
'value' => $show_archived,
|
||||||
true
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
$table_form->data[] = $row;
|
$table_form->data[] = $row;
|
||||||
@ -388,8 +397,8 @@ $params['return'] = true;
|
|||||||
$params['print_hidden_input_idagent'] = true;
|
$params['print_hidden_input_idagent'] = true;
|
||||||
$params['hidden_input_idagent_name'] = 'agent_id';
|
$params['hidden_input_idagent_name'] = 'agent_id';
|
||||||
$params['hidden_input_idagent_value'] = $agent_id;
|
$params['hidden_input_idagent_value'] = $agent_id;
|
||||||
$agent_input = __('Agent').' '.ui_print_agent_autocomplete_input($params);
|
$row[] = __('Agent');
|
||||||
$row[] = $agent_input;
|
$row[] = ui_print_agent_autocomplete_input($params);
|
||||||
|
|
||||||
// Module.
|
// Module.
|
||||||
$row[] = __('Module').' '.html_print_autocomplete_modules(
|
$row[] = __('Module').' '.html_print_autocomplete_modules(
|
||||||
@ -402,6 +411,10 @@ $row[] = __('Module').' '.html_print_autocomplete_modules(
|
|||||||
true
|
true
|
||||||
);
|
);
|
||||||
|
|
||||||
|
$table_form->data[] = $row;
|
||||||
|
|
||||||
|
$row = [];
|
||||||
|
|
||||||
$row[] = html_print_submit_button(
|
$row[] = html_print_submit_button(
|
||||||
__('Search'),
|
__('Search'),
|
||||||
'search',
|
'search',
|
||||||
|
@ -181,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');
|
||||||
}
|
}
|
||||||
|
393
pandora_console/godmode/modules/manage_inventory_modules.php
Normal file
393
pandora_console/godmode/modules/manage_inventory_modules.php
Normal 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').' » '.__('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> ';
|
||||||
|
$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>
|
@ -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
|
||||||
|
).' ';
|
||||||
|
$table->data[5][1] .= '    '.__('Use inline code');
|
||||||
|
$table->data[5][1] .= html_print_radio_button(
|
||||||
|
'script_mode',
|
||||||
|
2,
|
||||||
|
'',
|
||||||
|
$script_mode,
|
||||||
|
true
|
||||||
|
).' ';
|
||||||
|
|
||||||
|
$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>
|
@ -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>
|
||||||
|
@ -1372,7 +1372,14 @@ $home_screen .= html_print_select(
|
|||||||
).'</div>';
|
).'</div>';
|
||||||
|
|
||||||
|
|
||||||
$dashboards = Manager::getDashboards(-1, -1);
|
$dashboards = Manager::getDashboards(
|
||||||
|
-1,
|
||||||
|
-1,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
$id_usr
|
||||||
|
);
|
||||||
|
|
||||||
$dashboards_aux = [];
|
$dashboards_aux = [];
|
||||||
if ($dashboards === false) {
|
if ($dashboards === false) {
|
||||||
$dashboards = ['None' => 'None'];
|
$dashboards = ['None' => 'None'];
|
||||||
|
@ -333,6 +333,7 @@ if ($delete_user === true) {
|
|||||||
$result = delete_user($id_user);
|
$result = delete_user($id_user);
|
||||||
|
|
||||||
if ($result) {
|
if ($result) {
|
||||||
|
delete_session_user($id_user);
|
||||||
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))
|
||||||
|
@ -721,7 +721,7 @@ if ($get_agent_alerts_datatable === true) {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'lastFired':
|
case 'last_fired':
|
||||||
switch ($sort) {
|
switch ($sort) {
|
||||||
case 'asc':
|
case 'asc':
|
||||||
$selectLastFiredasc = $selected;
|
$selectLastFiredasc = $selected;
|
||||||
|
457
pandora_console/include/ajax/audit_log.php
Normal file
457
pandora_console/include/ajax/audit_log.php
Normal file
@ -0,0 +1,457 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Manage AJAX response for event pages.
|
||||||
|
*
|
||||||
|
* @category Ajax
|
||||||
|
* @package Pandora FMS
|
||||||
|
* @subpackage Events
|
||||||
|
* @version 1.0.0
|
||||||
|
* @license See below
|
||||||
|
*
|
||||||
|
* ______ ___ _______ _______ ________
|
||||||
|
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
|
||||||
|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
|
||||||
|
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
||||||
|
*
|
||||||
|
* ============================================================================
|
||||||
|
* Copyright (c) 2005-2023 Artica Soluciones Tecnologicas
|
||||||
|
* Please see http://pandorafms.org for full contribution list
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation for version 2.
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
* ============================================================================
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Begin.
|
||||||
|
global $config;
|
||||||
|
enterprise_include_once('include/functions_audit.php');
|
||||||
|
|
||||||
|
// Check access.
|
||||||
|
check_login();
|
||||||
|
|
||||||
|
if (! check_acl($config['id_user'], 0, 'ER')
|
||||||
|
&& ! check_acl($config['id_user'], 0, 'EW')
|
||||||
|
&& ! check_acl($config['id_user'], 0, 'EM')
|
||||||
|
) {
|
||||||
|
db_pandora_audit(
|
||||||
|
AUDIT_LOG_ACL_VIOLATION,
|
||||||
|
'Trying to access event viewer'
|
||||||
|
);
|
||||||
|
include 'general/noaccess.php';
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$save_filter_modal = get_parameter('save_filter_modal', 0);
|
||||||
|
$load_filter_modal = get_parameter('load_filter_modal', 0);
|
||||||
|
$get_filter_values = get_parameter('get_filter_values', 0);
|
||||||
|
$update_log_filter = get_parameter('update_log_filter', 0);
|
||||||
|
$save_log_filter = get_parameter('save_log_filter', 0);
|
||||||
|
$recover_aduit_log_select = get_parameter('recover_aduit_log_select', 0);
|
||||||
|
|
||||||
|
|
||||||
|
// Saves an event filter.
|
||||||
|
if ($save_log_filter) {
|
||||||
|
$values = [];
|
||||||
|
$values['id_name'] = get_parameter('id_name');
|
||||||
|
$values['text'] = get_parameter('text', '');
|
||||||
|
$values['period'] = get_parameter('period', '');
|
||||||
|
$values['ip'] = get_parameter('ip', '');
|
||||||
|
$values['type'] = get_parameter('type', -1);
|
||||||
|
$values['user'] = get_parameter('user', -1);
|
||||||
|
|
||||||
|
$exists = (bool) db_get_value_filter(
|
||||||
|
'id_filter',
|
||||||
|
'tsesion_filter',
|
||||||
|
['id_name' => $values['id_name']]
|
||||||
|
);
|
||||||
|
|
||||||
|
if ($exists) {
|
||||||
|
echo 'duplicate';
|
||||||
|
} else {
|
||||||
|
$result = db_process_sql_insert('tsesion_filter', $values);
|
||||||
|
|
||||||
|
if ($result === false) {
|
||||||
|
echo 'error';
|
||||||
|
} else {
|
||||||
|
echo $result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if ($recover_aduit_log_select) {
|
||||||
|
echo json_encode(audit_get_audit_filter_select());
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($update_log_filter) {
|
||||||
|
$values = [];
|
||||||
|
$id = get_parameter('id');
|
||||||
|
$values['text'] = get_parameter('text', '');
|
||||||
|
$values['period'] = get_parameter('period', '');
|
||||||
|
$values['ip'] = get_parameter('ip', '');
|
||||||
|
$values['type'] = get_parameter('type', -1);
|
||||||
|
$values['user'] = get_parameter('user', -1);
|
||||||
|
|
||||||
|
$result = db_process_sql_update(
|
||||||
|
'tsesion_filter',
|
||||||
|
$values,
|
||||||
|
['id_filter' => $id]
|
||||||
|
);
|
||||||
|
|
||||||
|
if ($result === false) {
|
||||||
|
echo 'error';
|
||||||
|
} else {
|
||||||
|
echo 'ok';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if ($get_filter_values) {
|
||||||
|
$id_filter = get_parameter('id');
|
||||||
|
|
||||||
|
$event_filter = audit_get_audit_log_filter($id_filter);
|
||||||
|
echo json_encode($event_filter);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if ($load_filter_modal) {
|
||||||
|
$filters = audit_get_audit_filter_select();
|
||||||
|
$user_groups_array = users_get_groups_for_select(
|
||||||
|
$config['id_user'],
|
||||||
|
$access,
|
||||||
|
true,
|
||||||
|
true,
|
||||||
|
false
|
||||||
|
);
|
||||||
|
|
||||||
|
echo '<div id="load-filter-select" class="load-filter-modal">';
|
||||||
|
|
||||||
|
$table = new StdClass;
|
||||||
|
$table->id = 'load_filter_form';
|
||||||
|
$table->width = '100%';
|
||||||
|
$table->cellspacing = 4;
|
||||||
|
$table->cellpadding = 4;
|
||||||
|
$table->class = 'databox';
|
||||||
|
if (is_metaconsole()) {
|
||||||
|
$table->cellspacing = 0;
|
||||||
|
$table->cellpadding = 0;
|
||||||
|
$table->class = 'databox filters';
|
||||||
|
}
|
||||||
|
|
||||||
|
$table->styleTable = 'font-weight: bold; color: #555; text-align:left;';
|
||||||
|
$filter_id_width = '200px';
|
||||||
|
if (is_metaconsole()) {
|
||||||
|
$filter_id_width = '150px';
|
||||||
|
}
|
||||||
|
|
||||||
|
$data = [];
|
||||||
|
$table->rowid[3] = 'update_filter_row1';
|
||||||
|
$data[0] = __('Load filter').$jump;
|
||||||
|
$data[0] .= html_print_select(
|
||||||
|
$filters,
|
||||||
|
'filter_id',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
__('None'),
|
||||||
|
0,
|
||||||
|
true,
|
||||||
|
false,
|
||||||
|
true,
|
||||||
|
'',
|
||||||
|
false,
|
||||||
|
'margin-left:5px; width:'.$filter_id_width.';'
|
||||||
|
);
|
||||||
|
$data[1] = html_print_submit_button(
|
||||||
|
__('Load filter'),
|
||||||
|
'load_filter',
|
||||||
|
false,
|
||||||
|
'class="sub upd" onclick="load_filter_values()"',
|
||||||
|
true
|
||||||
|
);
|
||||||
|
$data[1] .= html_print_input_hidden('load_filter', 1, true);
|
||||||
|
$table->data[] = $data;
|
||||||
|
$table->rowclass[] = '';
|
||||||
|
|
||||||
|
html_print_table($table);
|
||||||
|
echo '</div>';
|
||||||
|
?>
|
||||||
|
<script type="text/javascript">
|
||||||
|
function show_filter() {
|
||||||
|
$("#load-filter-select").dialog({
|
||||||
|
resizable: true,
|
||||||
|
draggable: true,
|
||||||
|
modal: false,
|
||||||
|
closeOnEscape: true,
|
||||||
|
width: 450
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function load_filter_values() {
|
||||||
|
$.ajax({
|
||||||
|
method: 'POST',
|
||||||
|
url: '<?php echo ui_get_full_url('ajax.php'); ?>',
|
||||||
|
dataType: 'json',
|
||||||
|
data: {
|
||||||
|
page: 'include/ajax/audit_log',
|
||||||
|
get_filter_values: 1,
|
||||||
|
"id" : $('#filter_id :selected').val()
|
||||||
|
},
|
||||||
|
success: function(data) {
|
||||||
|
var options = "";
|
||||||
|
$.each(data,function(i,value){
|
||||||
|
if (i == 'text'){
|
||||||
|
$("#text-filter_text").val(value);
|
||||||
|
}
|
||||||
|
if (i == 'period'){
|
||||||
|
$("#text-filter_period").val(value);
|
||||||
|
}
|
||||||
|
if (i == 'ip'){
|
||||||
|
$("#text-filter_ip").val(value);
|
||||||
|
}
|
||||||
|
if (i == 'type'){
|
||||||
|
$("#filter_type").val(value).change();
|
||||||
|
}
|
||||||
|
if (i == 'user'){
|
||||||
|
$("#filter_user").val(value).change();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Close dialog.
|
||||||
|
$("#load-filter-select").dialog('close');
|
||||||
|
}
|
||||||
|
|
||||||
|
$(document).ready (function() {
|
||||||
|
show_filter();
|
||||||
|
})
|
||||||
|
|
||||||
|
</script>
|
||||||
|
<?php
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if ($save_filter_modal) {
|
||||||
|
echo '<div id="save-filter-select" style="width:350px;">';
|
||||||
|
|
||||||
|
if (check_acl($config['id_user'], 0, 'EW') === 1 || check_acl($config['id_user'], 0, 'EM') === 1) {
|
||||||
|
echo '<div id="info_box"></div>';
|
||||||
|
$table = new StdClass;
|
||||||
|
$table->id = 'save_filter_form';
|
||||||
|
$table->width = '100%';
|
||||||
|
$table->cellspacing = 4;
|
||||||
|
$table->cellpadding = 4;
|
||||||
|
$table->class = 'databox';
|
||||||
|
if (is_metaconsole()) {
|
||||||
|
$table->class = 'databox filters';
|
||||||
|
$table->cellspacing = 0;
|
||||||
|
$table->cellpadding = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
$table->styleTable = 'font-weight: bold; text-align:left;';
|
||||||
|
if (!is_metaconsole()) {
|
||||||
|
$table->style[0] = 'width: 50%; width:50%;';
|
||||||
|
}
|
||||||
|
|
||||||
|
$data = [];
|
||||||
|
$table->rowid[0] = 'update_save_selector';
|
||||||
|
$data[0] = html_print_radio_button(
|
||||||
|
'filter_mode',
|
||||||
|
'new',
|
||||||
|
__('New filter'),
|
||||||
|
true,
|
||||||
|
true
|
||||||
|
);
|
||||||
|
|
||||||
|
$data[1] = html_print_radio_button(
|
||||||
|
'filter_mode',
|
||||||
|
'update',
|
||||||
|
__('Update filter'),
|
||||||
|
false,
|
||||||
|
true
|
||||||
|
);
|
||||||
|
|
||||||
|
$table->data[] = $data;
|
||||||
|
$table->rowclass[] = '';
|
||||||
|
|
||||||
|
$data = [];
|
||||||
|
$table->rowid[1] = 'save_filter_row1';
|
||||||
|
$data[0] = __('Filter name').$jump;
|
||||||
|
$data[0] .= html_print_input_text('id_name', '', '', 15, 255, true);
|
||||||
|
|
||||||
|
$data[1] = html_print_submit_button(
|
||||||
|
__('Save filter'),
|
||||||
|
'save_filter',
|
||||||
|
false,
|
||||||
|
'class="sub wand" onclick="save_new_filter();"',
|
||||||
|
true
|
||||||
|
);
|
||||||
|
|
||||||
|
$table->data[] = $data;
|
||||||
|
$table->rowclass[] = '';
|
||||||
|
|
||||||
|
$data = [];
|
||||||
|
$table->rowid[2] = 'save_filter_row2';
|
||||||
|
|
||||||
|
$table->data[] = $data;
|
||||||
|
$table->rowclass[] = '';
|
||||||
|
|
||||||
|
$data = [];
|
||||||
|
$table->rowid[3] = 'update_filter_row1';
|
||||||
|
$data[0] = __('Overwrite filter').$jump;
|
||||||
|
|
||||||
|
$_filters_update = audit_get_audit_filter_select();
|
||||||
|
|
||||||
|
$data[0] .= html_print_select(
|
||||||
|
$_filters_update,
|
||||||
|
'overwrite_filter',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
0,
|
||||||
|
true
|
||||||
|
);
|
||||||
|
$data[1] = html_print_submit_button(
|
||||||
|
__('Update filter'),
|
||||||
|
'update_filter',
|
||||||
|
false,
|
||||||
|
'class="sub upd" onclick="save_update_filter();"',
|
||||||
|
true
|
||||||
|
);
|
||||||
|
|
||||||
|
$table->data[] = $data;
|
||||||
|
$table->rowclass[] = '';
|
||||||
|
|
||||||
|
html_print_table($table);
|
||||||
|
} else {
|
||||||
|
include 'general/noaccess.php';
|
||||||
|
}
|
||||||
|
|
||||||
|
echo '</div>';
|
||||||
|
?>
|
||||||
|
<script type="text/javascript">
|
||||||
|
function show_save_filter() {
|
||||||
|
$('#save_filter_row1').show();
|
||||||
|
$('#save_filter_row2').show();
|
||||||
|
$('#update_filter_row1').hide();
|
||||||
|
// Filter save mode selector
|
||||||
|
$("[name='filter_mode']").click(function() {
|
||||||
|
if ($(this).val() == 'new') {
|
||||||
|
$('#save_filter_row1').show();
|
||||||
|
$('#save_filter_row2').show();
|
||||||
|
$('#submit-save_filter').show();
|
||||||
|
$('#update_filter_row1').hide();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$('#save_filter_row1').hide();
|
||||||
|
$('#save_filter_row2').hide();
|
||||||
|
$('#update_filter_row1').show();
|
||||||
|
$('#submit-save_filter').hide();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
$("#save-filter-select").dialog({
|
||||||
|
resizable: true,
|
||||||
|
draggable: true,
|
||||||
|
modal: false,
|
||||||
|
closeOnEscape: true
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function save_new_filter() {
|
||||||
|
|
||||||
|
// If the filter name is blank show error
|
||||||
|
if ($('#text-id_name').val() == '') {
|
||||||
|
$('#info_box').html("<h3 class='error'><?php echo __('Filter name cannot be left blank'); ?></h3>");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
var id_filter_save;
|
||||||
|
|
||||||
|
jQuery.post ("<?php echo ui_get_full_url('ajax.php', false, false, false); ?>",
|
||||||
|
{
|
||||||
|
"page" : "include/ajax/audit_log",
|
||||||
|
"save_log_filter" : 1,
|
||||||
|
"id_name" : $("#text-id_name").val(),
|
||||||
|
"text" : $("#text-filter_text").val(),
|
||||||
|
"period" : $("#text-filter_period").val(),
|
||||||
|
"ip" : $('#text-filter_ip').val(),
|
||||||
|
"type" : $('#filter_type :selected').val(),
|
||||||
|
"user" : $('#filter_user :selected').val(),
|
||||||
|
},
|
||||||
|
function (data) {
|
||||||
|
$("#info_box").hide();
|
||||||
|
if (data == 'error') {
|
||||||
|
$("#info_box").filter(function(i, item) {
|
||||||
|
if ($(item).data('type_info_box') == "error_create_filter") {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return false;
|
||||||
|
}).show();
|
||||||
|
} else if (data == 'duplicate') {
|
||||||
|
$('#info_box').html("<h3 class='error'><?php echo __('Filter name already on use'); ?></h3>");
|
||||||
|
$('#info_box').show();
|
||||||
|
} else {
|
||||||
|
// Close dialog.
|
||||||
|
$("#save-filter-select").dialog('close');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// This updates an event filter
|
||||||
|
function save_update_filter() {
|
||||||
|
var id_filter_update = $("#overwrite_filter").val();
|
||||||
|
var name_filter_update = $("#overwrite_filter option[value='"+id_filter_update+"']").text();
|
||||||
|
|
||||||
|
jQuery.post ("<?php echo ui_get_full_url('ajax.php', false, false, false); ?>",
|
||||||
|
{"page" : "include/ajax/audit_log",
|
||||||
|
"update_log_filter" : 1,
|
||||||
|
"id" : $("#overwrite_filter :selected").val(),
|
||||||
|
"text" : $("#text-filter_text").val(),
|
||||||
|
"period" : $("#text-filter_period").val(),
|
||||||
|
"ip" : $('#text-filter_ip').val(),
|
||||||
|
"type" : $('#filter_type :selected').val(),
|
||||||
|
"user" : $('#filter_user :selected').val(),
|
||||||
|
},
|
||||||
|
function (data) {
|
||||||
|
$(".info_box").hide();
|
||||||
|
if (data == 'ok') {
|
||||||
|
$(".info_box").filter(function(i, item) {
|
||||||
|
if ($(item).data('type_info_box') == "success_update_filter") {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return false;
|
||||||
|
}).show();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$(".info_box").filter(function(i, item) {
|
||||||
|
if ($(item).data('type_info_box') == "error_create_filter") {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return false;
|
||||||
|
}).show();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Close dialog
|
||||||
|
$('.ui-dialog-titlebar-close').trigger('click');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$(document).ready(function (){
|
||||||
|
show_save_filter();
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
<?php
|
||||||
|
return;
|
||||||
|
}
|
@ -340,7 +340,7 @@ if (is_ajax() === true) {
|
|||||||
|
|
||||||
// Group.
|
// Group.
|
||||||
$secondary_groups = '';
|
$secondary_groups = '';
|
||||||
$secondary = agents_get_secondary_groups($data['id_agente']);
|
$secondary = enterprise_hook('agents_get_secondary_groups', [$data['id_agente']]);
|
||||||
if (isset($secondary['for_select']) === true && empty($secondary['for_select']) === false) {
|
if (isset($secondary['for_select']) === true && empty($secondary['for_select']) === false) {
|
||||||
$secondary_groups = implode(', ', $secondary['for_select']);
|
$secondary_groups = implode(', ', $secondary['for_select']);
|
||||||
$secondary_groups = ', '.$secondary_groups;
|
$secondary_groups = ', '.$secondary_groups;
|
||||||
@ -353,19 +353,26 @@ if (is_ajax() === true) {
|
|||||||
|
|
||||||
|
|
||||||
// Events.
|
// Events.
|
||||||
echo '<div class="div-dialog">';
|
$result_graph_event = enterprise_hook(
|
||||||
echo graph_graphic_agentevents(
|
'graph_graphic_agentevents',
|
||||||
$id,
|
[
|
||||||
100,
|
$id,
|
||||||
40,
|
100,
|
||||||
SECONDS_1DAY,
|
40,
|
||||||
'',
|
SECONDS_1DAY,
|
||||||
true,
|
'',
|
||||||
false,
|
true,
|
||||||
false,
|
false,
|
||||||
1
|
false,
|
||||||
|
1,
|
||||||
|
]
|
||||||
);
|
);
|
||||||
echo '</div>';
|
|
||||||
|
if ($result_graph_event !== -1) {
|
||||||
|
echo '<div class="div-dialog">';
|
||||||
|
echo $result_graph_event;
|
||||||
|
echo '</div>';
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -156,6 +156,26 @@ class AuditLog extends HTML
|
|||||||
open_meta_frame();
|
open_meta_frame();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$buttons = [];
|
||||||
|
|
||||||
|
$buttons[] = [
|
||||||
|
'id' => 'load-filter',
|
||||||
|
'class' => 'float-left margin-right-2 margin-left-2 sub config',
|
||||||
|
'text' => __('Load filter'),
|
||||||
|
'onclick' => '',
|
||||||
|
];
|
||||||
|
|
||||||
|
$buttons[] = [
|
||||||
|
'id' => 'save-filter',
|
||||||
|
'class' => 'float-left margin-right-2 sub wand',
|
||||||
|
'text' => __('Save filter'),
|
||||||
|
'onclick' => '',
|
||||||
|
];
|
||||||
|
|
||||||
|
// Modal for save/load filters.
|
||||||
|
echo '<div id="save-modal-filter" style="display:none"></div>';
|
||||||
|
echo '<div id="load-modal-filter" style="display:none"></div>';
|
||||||
|
|
||||||
// Load datatables user interface.
|
// Load datatables user interface.
|
||||||
ui_print_datatable(
|
ui_print_datatable(
|
||||||
[
|
[
|
||||||
@ -174,9 +194,10 @@ class AuditLog extends HTML
|
|||||||
],
|
],
|
||||||
'search_button_class' => 'sub filter float-right',
|
'search_button_class' => 'sub filter float-right',
|
||||||
'form' => [
|
'form' => [
|
||||||
'inputs' => [
|
'extra_buttons' => $buttons,
|
||||||
|
'inputs' => [
|
||||||
[
|
[
|
||||||
'label' => __('Search'),
|
'label' => __('Free search').ui_print_help_tip(__('Search filter by User, Action, Date, Source IP or Comments fields content'), true),
|
||||||
'type' => 'text',
|
'type' => 'text',
|
||||||
'class' => 'w200px',
|
'class' => 'w200px',
|
||||||
'id' => 'filter_text',
|
'id' => 'filter_text',
|
||||||
@ -211,7 +232,9 @@ class AuditLog extends HTML
|
|||||||
'type' => 'select_from_sql',
|
'type' => 'select_from_sql',
|
||||||
'nothing' => __('All'),
|
'nothing' => __('All'),
|
||||||
'nothing_value' => '-1',
|
'nothing_value' => '-1',
|
||||||
'sql' => 'SELECT id_user, id_user AS text FROM tusuario',
|
'sql' => 'SELECT id_user, id_user AS text FROM tusuario UNION SELECT "SYSTEM"
|
||||||
|
AS id_user, "SYSTEM" AS text UNION SELECT "N/A"
|
||||||
|
AS id_user, "N/A" AS text',
|
||||||
'class' => 'mw250px',
|
'class' => 'mw250px',
|
||||||
'id' => 'filter_user',
|
'id' => 'filter_user',
|
||||||
'name' => 'filter_user',
|
'name' => 'filter_user',
|
||||||
@ -269,7 +292,10 @@ class AuditLog extends HTML
|
|||||||
|
|
||||||
if (empty($this->filterText) === false) {
|
if (empty($this->filterText) === false) {
|
||||||
$filter .= sprintf(
|
$filter .= sprintf(
|
||||||
" AND (accion LIKE '%%%s%%' OR descripcion LIKE '%%%s%%')",
|
" AND (accion LIKE '%%%s%%' OR descripcion LIKE '%%%s%%' OR id_usuario LIKE '%%%s%%' OR fecha LIKE '%%%s%%' OR ip_origen LIKE '%%%s%%')",
|
||||||
|
$this->filterText,
|
||||||
|
$this->filterText,
|
||||||
|
$this->filterText,
|
||||||
$this->filterText,
|
$this->filterText,
|
||||||
$this->filterText
|
$this->filterText
|
||||||
);
|
);
|
||||||
@ -366,38 +392,147 @@ class AuditLog extends HTML
|
|||||||
|
|
||||||
// Javascript content.
|
// Javascript content.
|
||||||
?>
|
?>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
function format(d) {
|
var loading = 0;
|
||||||
var output = '';
|
|
||||||
|
|
||||||
if (d.extendedInfo === '') {
|
function format(d) {
|
||||||
output = "<?php echo __('There is no additional information to display'); ?>";
|
var output = '';
|
||||||
} else {
|
|
||||||
output = d.extendedInfo;
|
if (d.extendedInfo === '') {
|
||||||
|
output = "<?php echo __('There is no additional information to display'); ?>";
|
||||||
|
} else {
|
||||||
|
output = d.extendedInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
return output;
|
||||||
}
|
}
|
||||||
|
|
||||||
return output;
|
$(document).ready(function() {
|
||||||
}
|
// Add event listener for opening and closing details
|
||||||
|
$('#audit_logs tbody').on('click', 'td.show_extended_info', function() {
|
||||||
|
var tr = $(this).closest('tr');
|
||||||
|
var table = $("#<?php echo $this->tableId; ?>").DataTable();
|
||||||
|
var row = table.row(tr);
|
||||||
|
|
||||||
$(document).ready(function() {
|
if (row.child.isShown()) {
|
||||||
// Add event listener for opening and closing details
|
// This row is already open - close it
|
||||||
$('#audit_logs tbody').on('click', 'td.show_extended_info', function() {
|
row.child.hide();
|
||||||
var tr = $(this).closest('tr');
|
tr.removeClass('shown');
|
||||||
var table = $("#<?php echo $this->tableId; ?>").DataTable();
|
} else {
|
||||||
var row = table.row(tr);
|
// Open this row
|
||||||
|
row.child(format(row.data())).show();
|
||||||
|
tr.addClass('shown');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
if (row.child.isShown()) {
|
$('#save-filter').click(function() {
|
||||||
// This row is already open - close it
|
if ($('#save-filter-select').length) {
|
||||||
row.child.hide();
|
$('#save-filter-select').dialog({
|
||||||
tr.removeClass('shown');
|
width: "20%",
|
||||||
} else {
|
maxWidth: "25%",
|
||||||
// Open this row
|
title: "<?php echo __('Save filter'); ?>"
|
||||||
row.child(format(row.data())).show();
|
});
|
||||||
tr.addClass('shown');
|
$('#info_box').html("");
|
||||||
}
|
$('#text-id_name').val("");
|
||||||
|
$.ajax({
|
||||||
|
method: 'POST',
|
||||||
|
url: '<?php echo ui_get_full_url('ajax.php'); ?>',
|
||||||
|
dataType: 'json',
|
||||||
|
data: {
|
||||||
|
page: 'include/ajax/audit_log',
|
||||||
|
recover_aduit_log_select: 1
|
||||||
|
},
|
||||||
|
success: function(data) {
|
||||||
|
var options = "";
|
||||||
|
$.each(data,function(key,value){
|
||||||
|
options += "<option value='"+key+"'>"+value+"</option>";
|
||||||
|
});
|
||||||
|
$('#overwrite_filter').html(options);
|
||||||
|
$('#overwrite_filter').select2();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
if (loading == 0) {
|
||||||
|
loading = 1
|
||||||
|
$.ajax({
|
||||||
|
method: 'POST',
|
||||||
|
url: '<?php echo ui_get_full_url('ajax.php'); ?>',
|
||||||
|
data: {
|
||||||
|
page: 'include/ajax/audit_log',
|
||||||
|
save_filter_modal: 1,
|
||||||
|
current_filter: $('#latest_filter_id').val()
|
||||||
|
},
|
||||||
|
success: function(data) {
|
||||||
|
$('#save-modal-filter')
|
||||||
|
.empty()
|
||||||
|
.html(data);
|
||||||
|
loading = 0;
|
||||||
|
$('#save-filter-select').dialog({
|
||||||
|
width: "20%",
|
||||||
|
maxWidth: "25%",
|
||||||
|
title: "<?php echo __('Save filter'); ?>"
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#save_filter_form-0-1, #radiobtn0002').click(function(){
|
||||||
|
$('#overwrite_filter').select2();
|
||||||
|
});
|
||||||
|
|
||||||
|
/* Filter management */
|
||||||
|
$('#load-filter').click(function (){
|
||||||
|
if($('#load-filter-select').length) {
|
||||||
|
$('#load-filter-select').dialog({width: "20%",
|
||||||
|
maxWidth: "25%",
|
||||||
|
title: "<?php echo __('Load filter'); ?>"
|
||||||
|
});
|
||||||
|
$.ajax({
|
||||||
|
method: 'POST',
|
||||||
|
url: '<?php echo ui_get_full_url('ajax.php'); ?>',
|
||||||
|
dataType: 'json',
|
||||||
|
data: {
|
||||||
|
page: 'include/ajax/audit_log',
|
||||||
|
recover_aduit_log_select: 1
|
||||||
|
},
|
||||||
|
success: function(data) {
|
||||||
|
var options = "";
|
||||||
|
$.each(data,function(key,value){
|
||||||
|
options += "<option value='"+key+"'>"+value+"</option>";
|
||||||
|
});
|
||||||
|
$('#filter_id').html(options);
|
||||||
|
$('#filter_id').select2();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
if (loading == 0) {
|
||||||
|
loading = 1
|
||||||
|
$.ajax({
|
||||||
|
method: 'POST',
|
||||||
|
url: '<?php echo ui_get_full_url('ajax.php'); ?>',
|
||||||
|
data: {
|
||||||
|
page: 'include/ajax/audit_log',
|
||||||
|
load_filter_modal: 1
|
||||||
|
},
|
||||||
|
success: function (data){
|
||||||
|
$('#load-modal-filter')
|
||||||
|
.empty()
|
||||||
|
.html(data);
|
||||||
|
loading = 0;
|
||||||
|
$('#load-filter-select').dialog({
|
||||||
|
width: "20%",
|
||||||
|
maxWidth: "25%",
|
||||||
|
title: "<?php echo __('Load filter'); ?>"
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
</script>
|
||||||
</script>
|
|
||||||
<?php
|
<?php
|
||||||
// EOF Javascript content.
|
// EOF Javascript content.
|
||||||
return ob_get_clean();
|
return ob_get_clean();
|
||||||
|
@ -606,15 +606,13 @@ class CustomNetScan extends Wizard
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (isset($this->page) === true && $this->page === 1) {
|
if (isset($this->page) === true && $this->page === 1) {
|
||||||
$name_ipam = 'IPAM Recon';
|
|
||||||
// Recon script.
|
// Recon script.
|
||||||
$form['inputs'][] = [
|
$form['inputs'][] = [
|
||||||
'label' => __('Recon script'),
|
'label' => __('Recon script'),
|
||||||
'arguments' => [
|
'arguments' => [
|
||||||
'type' => 'select_from_sql',
|
'type' => 'select_from_sql',
|
||||||
'sql' => sprintf(
|
'sql' => sprintf(
|
||||||
'SELECT id_recon_script, name FROM trecon_script WHERE name <> "%s" ORDER BY name',
|
'SELECT id_recon_script, name FROM trecon_script ORDER BY name'
|
||||||
$name_ipam
|
|
||||||
),
|
),
|
||||||
'name' => 'id_recon_script',
|
'name' => 'id_recon_script',
|
||||||
'selected' => $this->task['id_recon_script'],
|
'selected' => $this->task['id_recon_script'],
|
||||||
|
@ -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) {
|
||||||
|
@ -20,8 +20,8 @@
|
|||||||
/**
|
/**
|
||||||
* Pandora build version and version
|
* Pandora build version and version
|
||||||
*/
|
*/
|
||||||
$build_version = 'PC230116';
|
$build_version = 'PC230124';
|
||||||
$pandora_version = 'v7.0NG.767';
|
$pandora_version = 'v7.0NG.768';
|
||||||
|
|
||||||
// Do not overwrite default timezone set if defined.
|
// Do not overwrite default timezone set if defined.
|
||||||
$script_tz = @date_default_timezone_get();
|
$script_tz = @date_default_timezone_get();
|
||||||
|
@ -805,6 +805,7 @@ define('AUDIT_LOG_DASHBOARD_MANAGEMENT', 'Dashboard management');
|
|||||||
define('AUDIT_LOG_SERVICE_MANAGEMENT', 'Service management');
|
define('AUDIT_LOG_SERVICE_MANAGEMENT', 'Service management');
|
||||||
define('AUDIT_LOG_INCIDENT_MANAGEMENT', 'Incident management');
|
define('AUDIT_LOG_INCIDENT_MANAGEMENT', 'Incident management');
|
||||||
define('AUDIT_LOG_UMC', 'Warp Manager');
|
define('AUDIT_LOG_UMC', 'Warp Manager');
|
||||||
|
define('AUDIT_LOG_NMS_VIOLATION', 'NMS Violation');
|
||||||
|
|
||||||
// MIMEs.
|
// MIMEs.
|
||||||
define(
|
define(
|
||||||
|
@ -1,10 +1,17 @@
|
|||||||
|
@font-face {
|
||||||
|
font-family: 'Glyphicons Halflings';
|
||||||
|
src: url('../fonts/glyphicons-halflings-regular.woff') format('woff');
|
||||||
|
src:
|
||||||
|
}
|
||||||
|
|
||||||
.terminal-main {
|
.terminal-main {
|
||||||
font-family: monospace;
|
font-family: monospace;
|
||||||
font-size: 10pt;
|
font-size: 10pt;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ehorus-client-container {
|
#ehorus-client-container {
|
||||||
font-family: 'lato';
|
font-family: 'Lato', sans-serif;
|
||||||
|
font-weight: 400;
|
||||||
}
|
}
|
||||||
|
|
||||||
.glyphicon {
|
.glyphicon {
|
||||||
|
@ -395,6 +395,11 @@ function config_update_config()
|
|||||||
if (config_update_value('email_password', io_input_password(get_parameter('email_password')), true) === false) {
|
if (config_update_value('email_password', io_input_password(get_parameter('email_password')), true) === false) {
|
||||||
$error_update[] = __('Email password');
|
$error_update[] = __('Email password');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$inventory_changes_blacklist = get_parameter('inventory_changes_blacklist', []);
|
||||||
|
if (config_update_value('inventory_changes_blacklist', implode(',', $inventory_changes_blacklist), true) === false) {
|
||||||
|
$error_update[] = __('Inventory changes blacklist');
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'enterprise':
|
case 'enterprise':
|
||||||
@ -458,11 +463,6 @@ function config_update_config()
|
|||||||
if (config_update_value('sap_license', get_parameter('sap_license'), true) === false) {
|
if (config_update_value('sap_license', get_parameter('sap_license'), true) === false) {
|
||||||
$error_update[] = __('SAP/R3 Plugin Licence');
|
$error_update[] = __('SAP/R3 Plugin Licence');
|
||||||
}
|
}
|
||||||
|
|
||||||
$inventory_changes_blacklist = get_parameter('inventory_changes_blacklist', []);
|
|
||||||
if (config_update_value('inventory_changes_blacklist', implode(',', $inventory_changes_blacklist), true) === false) {
|
|
||||||
$error_update[] = __('Inventory changes blacklist');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -3489,8 +3489,9 @@ function graph_custom_sql_graph(
|
|||||||
$data_result = [];
|
$data_result = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
$data = [];
|
$data_bar = [];
|
||||||
$labels = [];
|
$labels_pie = [];
|
||||||
|
$data_pie = [];
|
||||||
$count = 0;
|
$count = 0;
|
||||||
$other = 0;
|
$other = 0;
|
||||||
foreach ($data_result as $data_item) {
|
foreach ($data_result as $data_item) {
|
||||||
|
1147
pandora_console/include/functions_inventory.php
Normal file
1147
pandora_console/include/functions_inventory.php
Normal file
File diff suppressed because it is too large
Load Diff
@ -487,7 +487,7 @@ function menu_add_extras(&$menu)
|
|||||||
$menu_extra['gusuarios']['sub']['godmode/users/configure_profile']['text'] = __('Configure profile');
|
$menu_extra['gusuarios']['sub']['godmode/users/configure_profile']['text'] = __('Configure profile');
|
||||||
|
|
||||||
$menu_extra['gmodules']['sub']['godmode/modules/manage_network_templates_form']['text'] = __('Module templates management');
|
$menu_extra['gmodules']['sub']['godmode/modules/manage_network_templates_form']['text'] = __('Module templates management');
|
||||||
$menu_extra['gmodules']['sub']['enterprise/godmode/modules/manage_inventory_modules_form']['text'] = __('Inventory modules management');
|
$menu_extra['gmodules']['sub']['godmode/modules/manage_inventory_modules_form']['text'] = __('Inventory modules management');
|
||||||
|
|
||||||
$menu_extra['gagente']['sub']['godmode/agentes/configurar_agente']['text'] = __('Agents management');
|
$menu_extra['gagente']['sub']['godmode/agentes/configurar_agente']['text'] = __('Agents management');
|
||||||
|
|
||||||
|
@ -3112,7 +3112,7 @@ function modules_get_relations($params=[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
$distinct = '';
|
$distinct = '';
|
||||||
if (empty($params)) {
|
if (empty($params) || isset($params['distinct'])) {
|
||||||
$distinct = 'DISTINCT';
|
$distinct = 'DISTINCT';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3136,6 +3136,11 @@ function modules_get_relations($params=[])
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$id_rt_filter = '';
|
||||||
|
if (isset($params['id_rt'])) {
|
||||||
|
$id_rt_filter = sprintf('AND tmr.id_rt = %d', $params['id_rt']);
|
||||||
|
}
|
||||||
|
|
||||||
$sql = sprintf(
|
$sql = sprintf(
|
||||||
'SELECT %s tmr.id, tmr.module_a, tmr.module_b,
|
'SELECT %s tmr.id, tmr.module_a, tmr.module_b,
|
||||||
tmr.disable_update, tmr.type
|
tmr.disable_update, tmr.type
|
||||||
@ -3153,7 +3158,8 @@ function modules_get_relations($params=[])
|
|||||||
$module_type,
|
$module_type,
|
||||||
$agent_filter,
|
$agent_filter,
|
||||||
$disabled_update_filter,
|
$disabled_update_filter,
|
||||||
$modules_type_filter
|
$modules_type_filter,
|
||||||
|
$id_rt_filter
|
||||||
);
|
);
|
||||||
|
|
||||||
return db_get_all_rows_sql($sql);
|
return db_get_all_rows_sql($sql);
|
||||||
|
@ -4161,7 +4161,149 @@ function networkmap_get_new_nodes_and_links($networkmap, $x, $y)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ((int) $networkmap['source'] === SOURCE_TASK) {
|
if ((int) $networkmap['source'] === SOURCE_TASK) {
|
||||||
$agents = get_discovery_agents($id_recon, true);
|
$agents = enterprise_hook('get_discovery_agents', [$id_recon, true]);
|
||||||
|
|
||||||
|
$relations_discovery = modules_get_relations(['id_rt' => $id_recon, 'distinct' => true]);
|
||||||
|
$array_aux = $relations_discovery;
|
||||||
|
$target_aux = $relations_discovery;
|
||||||
|
|
||||||
|
foreach ($relations_discovery as $key => $rel) {
|
||||||
|
foreach ($array_aux as $key2 => $rel2) {
|
||||||
|
if ($key2 <= $key) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($rel['module_a'] === $rel2['module_a']) {
|
||||||
|
$agent1 = modules_get_agentmodule_agent($rel['module_b']);
|
||||||
|
$agent2 = modules_get_agentmodule_agent($rel2['module_b']);
|
||||||
|
|
||||||
|
if ($agent1 === $agent2) {
|
||||||
|
$name1 = modules_get_agentmodule_name($rel['module_b']);
|
||||||
|
$name2 = modules_get_agentmodule_name($rel2['module_b']);
|
||||||
|
if ($name1 == 'Host Alive') {
|
||||||
|
unset($target_aux[$key]);
|
||||||
|
} else if ($name2 == 'Host Alive') {
|
||||||
|
unset($target_aux[$key2]);
|
||||||
|
}
|
||||||
|
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($rel['module_b'] === $rel2['module_b']) {
|
||||||
|
$agent1 = modules_get_agentmodule_agent($rel['module_a']);
|
||||||
|
$agent2 = modules_get_agentmodule_agent($rel2['module_a']);
|
||||||
|
|
||||||
|
if ($agent1 === $agent2) {
|
||||||
|
$name1 = modules_get_agentmodule_name($rel['module_a']);
|
||||||
|
$name2 = modules_get_agentmodule_name($rel2['module_a']);
|
||||||
|
if ($name1 == 'Host Alive') {
|
||||||
|
unset($target_aux[$key]);
|
||||||
|
} else if ($name2 == 'Host Alive') {
|
||||||
|
unset($target_aux[$key2]);
|
||||||
|
}
|
||||||
|
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($rel['module_a'] === $rel2['module_b']) {
|
||||||
|
$agent1 = modules_get_agentmodule_agent($rel['module_b']);
|
||||||
|
$agent2 = modules_get_agentmodule_agent($rel2['module_a']);
|
||||||
|
|
||||||
|
if ($agent1 === $agent2) {
|
||||||
|
$name1 = modules_get_agentmodule_name($rel['module_b']);
|
||||||
|
$name2 = modules_get_agentmodule_name($rel2['module_a']);
|
||||||
|
if ($name1 == 'Host Alive') {
|
||||||
|
unset($target_aux[$key]);
|
||||||
|
} else if ($name2 == 'Host Alive') {
|
||||||
|
unset($target_aux[$key2]);
|
||||||
|
}
|
||||||
|
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($rel['module_b'] === $rel2['module_a']) {
|
||||||
|
$agent1 = modules_get_agentmodule_agent($rel['module_a']);
|
||||||
|
$agent2 = modules_get_agentmodule_agent($rel2['module_b']);
|
||||||
|
|
||||||
|
if ($agent1 === $agent2) {
|
||||||
|
$name1 = modules_get_agentmodule_name($rel['module_a']);
|
||||||
|
$name2 = modules_get_agentmodule_name($rel2['module_b']);
|
||||||
|
if ($name1 == 'Host Alive') {
|
||||||
|
unset($target_aux[$key]);
|
||||||
|
} else if ($name2 == 'Host Alive') {
|
||||||
|
unset($target_aux[$key2]);
|
||||||
|
}
|
||||||
|
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$relations_discovery = $target_aux;
|
||||||
|
|
||||||
|
db_process_sql_delete('trel_item', ['id_map' => $id_networkmap, 'parent_type' => 1, 'child_type' => 1]);
|
||||||
|
|
||||||
|
$id_recon = $id_networkmap;
|
||||||
|
|
||||||
|
// Relations Module <-> Module.
|
||||||
|
foreach ($relations_discovery as $key => $relation) {
|
||||||
|
$module_a = $relation['module_a'];
|
||||||
|
$agent_a = modules_get_agentmodule_agent($module_a);
|
||||||
|
$module_b = $relation['module_b'];
|
||||||
|
$agent_b = modules_get_agentmodule_agent($module_b);
|
||||||
|
|
||||||
|
$exist = db_get_row_filter(
|
||||||
|
'trel_item',
|
||||||
|
[
|
||||||
|
'id_map' => $id_networkmap,
|
||||||
|
'id_parent_source_data' => $module_a,
|
||||||
|
'id_child_source_data' => $module_b,
|
||||||
|
'deleted' => 0,
|
||||||
|
]
|
||||||
|
);
|
||||||
|
$exist_reverse = db_get_row_filter(
|
||||||
|
'trel_item',
|
||||||
|
[
|
||||||
|
'id_map' => $id_networkmap,
|
||||||
|
'id_parent_source_data' => $module_b,
|
||||||
|
'id_child_source_data' => $module_a,
|
||||||
|
'deleted' => 0,
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
if (empty($exist) === true && empty($exist_reverse) === true) {
|
||||||
|
$item_a = db_get_value(
|
||||||
|
'id',
|
||||||
|
'titem',
|
||||||
|
'source_data',
|
||||||
|
$agent_a
|
||||||
|
);
|
||||||
|
|
||||||
|
$item_b = db_get_value(
|
||||||
|
'id',
|
||||||
|
'titem',
|
||||||
|
'source_data',
|
||||||
|
$agent_b
|
||||||
|
);
|
||||||
|
|
||||||
|
db_process_sql_insert(
|
||||||
|
'trel_item',
|
||||||
|
[
|
||||||
|
'id_map' => $id_networkmap,
|
||||||
|
'id_parent' => $item_a,
|
||||||
|
'id_child' => $item_b,
|
||||||
|
'id_parent_source_data' => $module_a,
|
||||||
|
'id_child_source_data' => $module_b,
|
||||||
|
'parent_type' => 1,
|
||||||
|
'child_type' => 1,
|
||||||
|
]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
} else if ((int) $networkmap['source'] === SOURCE_NETWORK) {
|
} else if ((int) $networkmap['source'] === SOURCE_NETWORK) {
|
||||||
// Network map, based on direct network.
|
// Network map, based on direct network.
|
||||||
$agents = networkmap_get_nodes_from_ip_mask(
|
$agents = networkmap_get_nodes_from_ip_mask(
|
||||||
@ -4375,280 +4517,6 @@ function networkmap_get_new_nodes_and_links($networkmap, $x, $y)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// foreach ($interfaces as $interface) {
|
|
||||||
// $relations = modules_get_relations(
|
|
||||||
// ['id_module' => $interface['id_agente_modulo']]
|
|
||||||
// );
|
|
||||||
// if (empty($relations) === true) {
|
|
||||||
// $relations = [];
|
|
||||||
// }
|
|
||||||
// foreach ($relations as $relation) {
|
|
||||||
// Get the links althought they are deleted (for to
|
|
||||||
// avoid to add)
|
|
||||||
// Check if the module is ping.
|
|
||||||
// if (modules_get_agentmodule_type($relation['module_a']) === '6') {
|
|
||||||
// The pings modules are not exist as interface
|
|
||||||
// the link is with the agent.
|
|
||||||
// $node_a = db_get_value_filter(
|
|
||||||
// 'id',
|
|
||||||
// 'titem',
|
|
||||||
// [
|
|
||||||
// 'source_data' => modules_get_agentmodule_agent(
|
|
||||||
// $relation['module_a']
|
|
||||||
// ),
|
|
||||||
// 'id_map' => $id_networkmap,
|
|
||||||
// ]
|
|
||||||
// );
|
|
||||||
// } else {
|
|
||||||
// $node_a = db_get_value_filter(
|
|
||||||
// 'id',
|
|
||||||
// 'titem',
|
|
||||||
// [
|
|
||||||
// 'source_data' => $relation['module_a'],
|
|
||||||
// 'type' => 1,
|
|
||||||
// 'id_map' => $id_networkmap,
|
|
||||||
// ]
|
|
||||||
// );
|
|
||||||
// }
|
|
||||||
// Check if the module is ping.
|
|
||||||
// if (modules_get_agentmodule_type($relation['module_b']) == 6) {
|
|
||||||
// The pings modules are not exist as interface
|
|
||||||
// the link is with the agent.
|
|
||||||
// $node_b = db_get_value_filter(
|
|
||||||
// 'id',
|
|
||||||
// 'titem',
|
|
||||||
// [
|
|
||||||
// 'source_data' => modules_get_agentmodule_agent(
|
|
||||||
// $relation['module_b']
|
|
||||||
// ),
|
|
||||||
// 'id_map' => $id_networkmap,
|
|
||||||
// ]
|
|
||||||
// );
|
|
||||||
// } else {
|
|
||||||
// $node_b = db_get_value_filter(
|
|
||||||
// 'id',
|
|
||||||
// 'titem',
|
|
||||||
// [
|
|
||||||
// 'source_data' => $relation['module_b'],
|
|
||||||
// 'type' => 1,
|
|
||||||
// 'id_map' => $id_networkmap,
|
|
||||||
// ]
|
|
||||||
// );
|
|
||||||
// }
|
|
||||||
// $exist = db_get_row_filter(
|
|
||||||
// 'trel_item',
|
|
||||||
// [
|
|
||||||
// 'id_map' => $id_networkmap,
|
|
||||||
// 'id_parent_source_data' => $relation['module_a'],
|
|
||||||
// 'id_child_source_data' => $relation['module_b'],
|
|
||||||
// 'deleted' => 0,
|
|
||||||
// ]
|
|
||||||
// );
|
|
||||||
// $exist_reverse = db_get_row_filter(
|
|
||||||
// 'trel_item',
|
|
||||||
// [
|
|
||||||
// 'id_map' => $id_networkmap,
|
|
||||||
// 'id_parent_source_data' => $relation['module_b'],
|
|
||||||
// 'id_child_source_data' => $relation['module_a'],
|
|
||||||
// 'deleted' => 0,
|
|
||||||
// ]
|
|
||||||
// );
|
|
||||||
// if (empty($exist) && empty($exist_reverse)) {
|
|
||||||
// Create the nodes for interfaces
|
|
||||||
// Ag1 ----- I1 ------ I2 ----- Ag2
|
|
||||||
// * 2 interfaces nodes
|
|
||||||
// * 3 relations
|
|
||||||
// * I1 between I2
|
|
||||||
// * Ag1 between I1
|
|
||||||
// * Ag2 between I2
|
|
||||||
//
|
|
||||||
// But check if it exists the relations
|
|
||||||
// agent between interface.
|
|
||||||
// if ($interface['id_agente_modulo'] == $relation['module_a']) {
|
|
||||||
// $agent_a = $interface['id_agente'];
|
|
||||||
// $agent_b = modules_get_agentmodule_agent(
|
|
||||||
// $relation['module_b']
|
|
||||||
// );
|
|
||||||
// } else {
|
|
||||||
// $agent_a = modules_get_agentmodule_agent(
|
|
||||||
// $relation['module_a']
|
|
||||||
// );
|
|
||||||
// $agent_b = $interface['id_agente'];
|
|
||||||
// }
|
|
||||||
// $item_a = db_get_value(
|
|
||||||
// 'id',
|
|
||||||
// 'titem',
|
|
||||||
// 'source_data',
|
|
||||||
// $agent_a
|
|
||||||
// );
|
|
||||||
// $item_b = db_get_value(
|
|
||||||
// 'id',
|
|
||||||
// 'titem',
|
|
||||||
// 'source_data',
|
|
||||||
// $agent_b
|
|
||||||
// );
|
|
||||||
// hd('----------------------', true);
|
|
||||||
// hd($agent_a, true);
|
|
||||||
// hd($agent_b, true);
|
|
||||||
// foreach ($interfaces as $interface) {
|
|
||||||
// $relations = modules_get_relations(
|
|
||||||
// ['id_module' => $interface['id_agente_modulo']]
|
|
||||||
// );
|
|
||||||
// if (empty($relations) === true) {
|
|
||||||
// $relations = [];
|
|
||||||
// }
|
|
||||||
// foreach ($relations as $relation) {hd($item_a. '<->'. $item_b, true);
|
|
||||||
// hd('----------------------', true);
|
|
||||||
// continue;
|
|
||||||
// $exist_node_interface1 = db_get_row_filter(
|
|
||||||
// 'titem',
|
|
||||||
// [
|
|
||||||
// 'id_map' => $id_networkmap,
|
|
||||||
// 'type' => 0,
|
|
||||||
// 'source_data' => $relation['module_a'],
|
|
||||||
// ]
|
|
||||||
// );
|
|
||||||
// if (empty($exist_node_interface1) === true) {
|
|
||||||
// Crete the interface node
|
|
||||||
// and create the relation between agent and
|
|
||||||
// interface.
|
|
||||||
// $style = [];
|
|
||||||
// $style['id_agent'] = $agent_a;
|
|
||||||
// $style['shape'] = 'circle';
|
|
||||||
// $style['image'] = 'images/mod_snmp_proc.png';
|
|
||||||
// $style['width'] = 50;
|
|
||||||
// $style['height'] = 16;
|
|
||||||
// $style['label'] = modules_get_agentmodule_name($relation['module_a']);
|
|
||||||
// $id_int1 = db_process_sql_insert(
|
|
||||||
// 'titem',
|
|
||||||
// [
|
|
||||||
// 'id_map' => $id_networkmap,
|
|
||||||
// 'x' => 666,
|
|
||||||
// 'y' => 666,
|
|
||||||
// 'z' => 0,
|
|
||||||
// 'deleted' => 0,
|
|
||||||
// 'type' => 1,
|
|
||||||
// 'refresh' => 0,
|
|
||||||
// 'source' => 0,
|
|
||||||
// 'source_data' => $relation['module_a'],
|
|
||||||
// 'style' => json_encode($style),
|
|
||||||
// ]
|
|
||||||
// );
|
|
||||||
// $node_interface1 = db_get_row_filter(
|
|
||||||
// 'titem',
|
|
||||||
// [
|
|
||||||
// 'id_map' => $id_networkmap,
|
|
||||||
// 'type' => 1,
|
|
||||||
// 'id' => $id_int1,
|
|
||||||
// ]
|
|
||||||
// );
|
|
||||||
// $node_agent1 = db_get_value(
|
|
||||||
// 'id',
|
|
||||||
// 'titem',
|
|
||||||
// 'source_data',
|
|
||||||
// $agent_a
|
|
||||||
// );
|
|
||||||
// db_process_sql_insert(
|
|
||||||
// 'trel_item',
|
|
||||||
// [
|
|
||||||
// 'id_map' => $id_networkmap,
|
|
||||||
// 'id_parent' => $node_agent1,
|
|
||||||
// 'id_child' => $node_interface1,
|
|
||||||
// 'id_parent-source_data' => $agent_a,
|
|
||||||
// 'id_child-source_data' => $relation['module_a'],
|
|
||||||
// 'parent_type' => 0,
|
|
||||||
// 'child_type' => 1,
|
|
||||||
// ]
|
|
||||||
// );
|
|
||||||
// } else {
|
|
||||||
// $node_interface1 = $exist_node_interface1;
|
|
||||||
// }
|
|
||||||
// $exist_node_interface2 = db_get_row_filter(
|
|
||||||
// 'titem',
|
|
||||||
// [
|
|
||||||
// 'id_map' => $id_networkmap,
|
|
||||||
// 'type' => 1,
|
|
||||||
// 'source_data' => $relation['module_b'],
|
|
||||||
// ]
|
|
||||||
// );
|
|
||||||
// if (empty($exist_node_interface2) === true) {
|
|
||||||
// Crete the interface node
|
|
||||||
// and create the relation between agent and
|
|
||||||
// interface.
|
|
||||||
// $style = [];
|
|
||||||
// $style['id_agent'] = $agent_a;
|
|
||||||
// $style['shape'] = 'circle';
|
|
||||||
// $style['image'] = 'images/mod_snmp_proc.png';
|
|
||||||
// $style['width'] = 50;
|
|
||||||
// $style['height'] = 16;
|
|
||||||
// $style['label'] = modules_get_agentmodule_name($relation['module_b']);
|
|
||||||
// $id_int2 = db_process_sql_insert(
|
|
||||||
// 'titem',
|
|
||||||
// [
|
|
||||||
// 'id_map' => $id_networkmap,
|
|
||||||
// 'x' => 666,
|
|
||||||
// 'y' => 666,
|
|
||||||
// 'z' => 0,
|
|
||||||
// 'deleted' => 0,
|
|
||||||
// 'type' => 1,
|
|
||||||
// 'refresh' => 0,
|
|
||||||
// 'source' => 0,
|
|
||||||
// 'source_data' => $relation['module_b'],
|
|
||||||
// 'style' => json_encode($style),
|
|
||||||
// ]
|
|
||||||
// );
|
|
||||||
// $node_interface2 = db_get_row_filter(
|
|
||||||
// 'titem',
|
|
||||||
// [
|
|
||||||
// 'id_map' => $id_networkmap,
|
|
||||||
// 'type' => 1,
|
|
||||||
// 'id' => $id_int1,
|
|
||||||
// ]
|
|
||||||
// );
|
|
||||||
// $node_agent1 = db_get_value(
|
|
||||||
// 'id',
|
|
||||||
// 'titem',
|
|
||||||
// 'source_data',
|
|
||||||
// $agent_a
|
|
||||||
// );
|
|
||||||
// db_process_sql_insert(
|
|
||||||
// 'trel_item',
|
|
||||||
// [
|
|
||||||
// 'id_map' => $id_networkmap,
|
|
||||||
// 'id_parent' => $node_agent1,
|
|
||||||
// 'id_child' => $node_interface1,
|
|
||||||
// 'id_parent-source_data' => $agent_a,
|
|
||||||
// 'id_child-source_data' => $relation['module_b'],
|
|
||||||
// 'parent_type' => 0,
|
|
||||||
// 'child_type' => 1,
|
|
||||||
// ]
|
|
||||||
// );
|
|
||||||
// } else {
|
|
||||||
// $node_interface2 = $exist_node_interface2;
|
|
||||||
// }
|
|
||||||
// if (empty($node_interface1) === false && empty($node_interface2) === false) {
|
|
||||||
// if (is_array($node_interface1) === true) {
|
|
||||||
// $node_interface1 = $node_interface1['id'];
|
|
||||||
// }
|
|
||||||
// if (is_array($node_interface2) === true) {
|
|
||||||
// $node_interface2 = $node_interface2['id'];
|
|
||||||
// }
|
|
||||||
// db_process_sql_insert(
|
|
||||||
// 'trel_item',
|
|
||||||
// [
|
|
||||||
// 'id_map' => $id_networkmap,
|
|
||||||
// 'id_parent' => $node_interface2,
|
|
||||||
// 'id_child' => $node_interface1,
|
|
||||||
// 'id_parent_source_data' => $relation['module_b'],
|
|
||||||
// 'id_child_source_data' => $relation['module_a'],
|
|
||||||
// 'parent_type' => 1,
|
|
||||||
// 'child_type' => 1,
|
|
||||||
// ]
|
|
||||||
// );
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
$relations = modules_get_relations(
|
$relations = modules_get_relations(
|
||||||
[
|
[
|
||||||
'id_agent' => $node['source_data'],
|
'id_agent' => $node['source_data'],
|
||||||
@ -4726,18 +4594,6 @@ function networkmap_get_new_nodes_and_links($networkmap, $x, $y)
|
|||||||
if (empty($interfaces) === true) {
|
if (empty($interfaces) === true) {
|
||||||
$interfaces = [];
|
$interfaces = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
// hd('interfaces', true);
|
|
||||||
// foreach ($interfaces as $interface) {
|
|
||||||
// $relations = modules_get_relations(
|
|
||||||
// ['id_module' => $interface['id_agente_modulo']]
|
|
||||||
// );
|
|
||||||
// if (empty($relations) === true) {
|
|
||||||
// $relations = [];
|
|
||||||
// }
|
|
||||||
// foreach ($relations as $relation) {
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,7 +24,8 @@ global $config;
|
|||||||
* Include the usual functions
|
* Include the usual functions
|
||||||
*/
|
*/
|
||||||
require_once $config['homedir'].'/include/functions_ui.php';
|
require_once $config['homedir'].'/include/functions_ui.php';
|
||||||
// enterprise_include_once('include/functions_inventory.php');
|
|
||||||
|
|
||||||
function planned_downtimes_check_dates($type_execution='once', $type_periodicity='', $datetime_from=false, $datetime_to=false, $periodically_time_from=false, $periodically_time_to=false, $periodically_day_from=false, $periodically_day_to=false)
|
function planned_downtimes_check_dates($type_execution='once', $type_periodicity='', $datetime_from=false, $datetime_to=false, $periodically_time_from=false, $periodically_time_to=false, $periodically_day_from=false, $periodically_day_to=false)
|
||||||
{
|
{
|
||||||
global $config;
|
global $config;
|
||||||
|
@ -38,6 +38,7 @@ require_once $config['homedir'].'/include/functions_alerts.php';
|
|||||||
require_once $config['homedir'].'/include/functions_users.php';
|
require_once $config['homedir'].'/include/functions_users.php';
|
||||||
enterprise_include_once('include/functions_metaconsole.php');
|
enterprise_include_once('include/functions_metaconsole.php');
|
||||||
enterprise_include_once('include/functions_inventory.php');
|
enterprise_include_once('include/functions_inventory.php');
|
||||||
|
require_once $config['homedir'].'/include/functions_inventory.php';
|
||||||
require_once $config['homedir'].'/include/functions_forecast.php';
|
require_once $config['homedir'].'/include/functions_forecast.php';
|
||||||
require_once $config['homedir'].'/include/functions_ui.php';
|
require_once $config['homedir'].'/include/functions_ui.php';
|
||||||
require_once $config['homedir'].'/include/functions_netflow.php';
|
require_once $config['homedir'].'/include/functions_netflow.php';
|
||||||
|
@ -6828,3 +6828,259 @@ function ui_print_spinner(string $text='Loading', bool $return=false)
|
|||||||
echo $output;
|
echo $output;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function ui_get_inventory_module_add_form(
|
||||||
|
$form_action,
|
||||||
|
$form_buttons='',
|
||||||
|
$inventory_module_id=0,
|
||||||
|
$os_id=false,
|
||||||
|
$target=false,
|
||||||
|
$interval=3600,
|
||||||
|
$username='',
|
||||||
|
$password='',
|
||||||
|
$custom_fields_enabled=false,
|
||||||
|
$custom_fields=[]
|
||||||
|
) {
|
||||||
|
$table = new stdClass();
|
||||||
|
$table->id = 'inventory-module-form';
|
||||||
|
$table->width = '100%';
|
||||||
|
$table->class = 'databox filters';
|
||||||
|
$table->style['module-title'] = 'font-weight: bold;';
|
||||||
|
$table->style['interval-title'] = 'font-weight: bold;';
|
||||||
|
$table->style['target-title'] = 'font-weight: bold;';
|
||||||
|
$table->style['chkbx-custom-fields-title'] = 'font-weight: bold;';
|
||||||
|
$table->style['username-title'] = 'font-weight: bold;';
|
||||||
|
$table->style['password-title'] = 'font-weight: bold;';
|
||||||
|
$table->rowstyle = [];
|
||||||
|
$table->rowstyle['hidden-custom-field-row'] = 'display: none;';
|
||||||
|
$table->colspan = [];
|
||||||
|
$table->colspan['custom-fields-row'] = [];
|
||||||
|
$table->colspan['custom-fields-row']['custom-fields-column'] = 4;
|
||||||
|
$table->data = [];
|
||||||
|
|
||||||
|
$row = [];
|
||||||
|
$row['module-title'] = __('Module');
|
||||||
|
if (empty($inventory_module_id)) {
|
||||||
|
if (empty($os_id)) {
|
||||||
|
$sql = 'SELECT mi.id_module_inventory AS id, mi.name AS name, co.name AS os
|
||||||
|
FROM tmodule_inventory mi, tconfig_os co
|
||||||
|
WHERE co.id_os = mi.id_os
|
||||||
|
ORDER BY co.name, mi.name';
|
||||||
|
$inventory_modules_raw = db_get_all_rows_sql($sql);
|
||||||
|
|
||||||
|
$inventory_modules = [];
|
||||||
|
foreach ($inventory_modules_raw as $im) {
|
||||||
|
$inventory_modules[$im['id']] = [
|
||||||
|
'name' => $im['name'],
|
||||||
|
'optgroup' => $im['os'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$sql = sprintf(
|
||||||
|
'SELECT id_module_inventory AS id, name
|
||||||
|
FROM tmodule_inventory
|
||||||
|
WHERE id_os = %d
|
||||||
|
ORDER BY name',
|
||||||
|
$os_id
|
||||||
|
);
|
||||||
|
$inventory_modules_raw = db_get_all_rows_sql($sql);
|
||||||
|
|
||||||
|
$inventory_modules = [];
|
||||||
|
foreach ($inventory_modules_raw as $im) {
|
||||||
|
$inventory_modules[$im['id']] = $im['name'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$row['module-input'] = html_print_select($inventory_modules, 'id_module_inventory', 0, '', __('Select inventory module'), 0, true, false, false);
|
||||||
|
} else {
|
||||||
|
$row['module-input'] = db_get_sql('SELECT name FROM tmodule_inventory WHERE id_module_inventory = '.$inventory_module_id);
|
||||||
|
}
|
||||||
|
|
||||||
|
$row['interval-title'] = __('Interval');
|
||||||
|
$row['interval-input'] = html_print_extended_select_for_time('interval', $interval, '', '', '', false, true);
|
||||||
|
|
||||||
|
$table->data['first-row'] = $row;
|
||||||
|
|
||||||
|
$row = [];
|
||||||
|
|
||||||
|
if ($target !== false) {
|
||||||
|
$row['target-title'] = __('Target');
|
||||||
|
$row['target-input'] = html_print_input_text('target', $target, '', 25, 40, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
$row['chkbx-custom-fields-title'] = __('Use custom fields');
|
||||||
|
$row['chkbx-custom-fields-input'] = html_print_checkbox('custom_fields_enabled', 1, $custom_fields_enabled, true);
|
||||||
|
|
||||||
|
$table->data['second-row'] = $row;
|
||||||
|
|
||||||
|
$row = [];
|
||||||
|
$row['username-title'] = __('Username');
|
||||||
|
$row['username-input'] = html_print_input_text('username', $username, '', 25, 40, true);
|
||||||
|
$row['password-title'] = __('Password');
|
||||||
|
$row['password-input'] = html_print_input_password('password', $password, '', 25, 40, true);
|
||||||
|
|
||||||
|
$table->data['userpass-row'] = $row;
|
||||||
|
|
||||||
|
$row = [];
|
||||||
|
$row['hidden-title'] = '';
|
||||||
|
$row['hidden-input'] = html_print_input_hidden('hidden-custom-field-name', '', true);
|
||||||
|
$row['hidden-input'] .= html_print_input_hidden('hidden-custom-field-is-secure', 0, true);
|
||||||
|
$row['hidden-input'] .= html_print_input_text('hidden-custom-field-input', '', '', 25, 40, true);
|
||||||
|
$row['hidden-input'] .= '<span> </span>';
|
||||||
|
$row['hidden-input'] .= html_print_image(
|
||||||
|
'images/cross.png',
|
||||||
|
true,
|
||||||
|
[
|
||||||
|
'border' => '0',
|
||||||
|
'title' => __('Remove'),
|
||||||
|
'style' => 'cursor: pointer;',
|
||||||
|
'class' => 'remove-custom-field invert_filter',
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$table->data['hidden-custom-field-row'] = $row;
|
||||||
|
|
||||||
|
if ($custom_fields_enabled) {
|
||||||
|
foreach ($custom_fields as $i => $field) {
|
||||||
|
$row = [];
|
||||||
|
$row['title'] = '<b>'.$field['name'].'</b>';
|
||||||
|
$row['input'] = html_print_input_hidden(
|
||||||
|
'custom_fields['.$i.'][name]',
|
||||||
|
$field['name'],
|
||||||
|
true
|
||||||
|
);
|
||||||
|
$row['input'] .= html_print_input_hidden(
|
||||||
|
'custom_fields['.$i.'][secure]',
|
||||||
|
$field['secure'],
|
||||||
|
true
|
||||||
|
);
|
||||||
|
if ($field['secure']) {
|
||||||
|
$row['input'] .= html_print_input_password(
|
||||||
|
'custom_fields['.$i.'][value]',
|
||||||
|
$field['value'],
|
||||||
|
'',
|
||||||
|
25,
|
||||||
|
40,
|
||||||
|
true
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
$row['input'] .= html_print_input_text(
|
||||||
|
'custom_fields['.$i.'][value]',
|
||||||
|
$field['value'],
|
||||||
|
'',
|
||||||
|
25,
|
||||||
|
40,
|
||||||
|
true
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
$row['input'] .= '<span> </span>';
|
||||||
|
$row['input'] .= html_print_image(
|
||||||
|
'images/cross.png',
|
||||||
|
true,
|
||||||
|
[
|
||||||
|
'border' => '0',
|
||||||
|
'title' => __('Remove'),
|
||||||
|
'style' => 'cursor: pointer;',
|
||||||
|
'class' => 'remove-custom-field invert_filter',
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$table->data['custom-field-row-'.$i] = $row;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$row = [];
|
||||||
|
$row['custom-fields-column'] = '<b>'.__('Field name').'</b>'.' '.html_print_input_text('field-name', '', '', 25, 40, true).' '.html_print_checkbox('field-is-password', 1, false, true).__("It's a password").' '.html_print_button(__('Add field'), 'add-field', false, '', 'class="sub add"', true);
|
||||||
|
|
||||||
|
$table->data['custom-fields-row'] = $row;
|
||||||
|
|
||||||
|
ob_start();
|
||||||
|
|
||||||
|
echo '<form name="modulo" method="post" action="'.$form_action.'">';
|
||||||
|
echo html_print_table($table);
|
||||||
|
echo '<div class="action-buttons w100p">';
|
||||||
|
echo $form_buttons;
|
||||||
|
echo '</div>';
|
||||||
|
echo '</form>';
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
(function () {
|
||||||
|
function toggle_custom_fields () {
|
||||||
|
if ($("#checkbox-custom_fields_enabled").prop("checked")) {
|
||||||
|
$("#inventory-module-form-userpass-row").hide();
|
||||||
|
$("#inventory-module-form-custom-fields-row").show();
|
||||||
|
$("tr[id^=inventory-module-form-custom-field-row-]").show();
|
||||||
|
} else {
|
||||||
|
$("#inventory-module-form-userpass-row").show();
|
||||||
|
$("#inventory-module-form-custom-fields-row").hide();
|
||||||
|
$("tr[id^=inventory-module-form-custom-field-row-]").hide();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function add_row_for_custom_field (fieldName, isSecure) {
|
||||||
|
var custom_fields_num = $("tr[id^=inventory-module-form-custom-field-row-]").length;
|
||||||
|
$("#inventory-module-form-hidden-custom-field-row")
|
||||||
|
.clone()
|
||||||
|
.prop("id", "inventory-module-form-custom-field-row-" + custom_fields_num)
|
||||||
|
.children("#inventory-module-form-hidden-custom-field-row-hidden-title")
|
||||||
|
.prop("id", "inventory-module-form-custom-field-row-title-" + custom_fields_num)
|
||||||
|
.html("<b>" + fieldName + "</b>")
|
||||||
|
.parent()
|
||||||
|
.children("#inventory-module-form-hidden-custom-field-row-hidden-input")
|
||||||
|
.prop("id", "inventory-module-form-custom-field-row-input-" + custom_fields_num)
|
||||||
|
.prop("colspan", 2)
|
||||||
|
.children("input[name=hidden-custom-field-name]")
|
||||||
|
.prop("id", "custom-field-name-" + custom_fields_num)
|
||||||
|
.prop("name", "custom_fields[" + custom_fields_num + "][name]")
|
||||||
|
.val(fieldName)
|
||||||
|
.parent()
|
||||||
|
.children("input[name=hidden-custom-field-is-secure]")
|
||||||
|
.prop("id", "custom-field-is-secure-" + custom_fields_num)
|
||||||
|
.prop("name", "custom_fields[" + custom_fields_num + "][secure]")
|
||||||
|
.val(isSecure ? 1 : 0)
|
||||||
|
.parent()
|
||||||
|
.children("input[name=hidden-custom-field-input]")
|
||||||
|
.prop("id", "custom-field-input-" + custom_fields_num)
|
||||||
|
.prop("type", isSecure ? "password" : "text")
|
||||||
|
.prop("name", "custom_fields[" + custom_fields_num + "][value]")
|
||||||
|
.parent()
|
||||||
|
.children("img.remove-custom-field")
|
||||||
|
.click(remove_custom_field)
|
||||||
|
.parent()
|
||||||
|
.parent()
|
||||||
|
.insertBefore($("#inventory-module-form-custom-fields-row"))
|
||||||
|
.show();
|
||||||
|
}
|
||||||
|
|
||||||
|
function add_custom_field () {
|
||||||
|
var fieldName = $("#text-field-name").val();
|
||||||
|
var isSecure = $("#checkbox-field-is-password").prop("checked");
|
||||||
|
|
||||||
|
if (fieldName.length === 0) return;
|
||||||
|
|
||||||
|
add_row_for_custom_field(fieldName, isSecure);
|
||||||
|
// Clean the fields
|
||||||
|
$("#text-field-name").val("");
|
||||||
|
$("#checkbox-field-is-password").prop("checked", false);
|
||||||
|
}
|
||||||
|
|
||||||
|
function remove_custom_field (event) {
|
||||||
|
$(event.target).parents("tr[id^=inventory-module-form-custom-field-row-]").remove();
|
||||||
|
}
|
||||||
|
|
||||||
|
$("#checkbox-custom_fields_enabled").click(toggle_custom_fields);
|
||||||
|
$("#button-add-field").click(add_custom_field);
|
||||||
|
$("img.remove-custom-field").click(remove_custom_field);
|
||||||
|
|
||||||
|
toggle_custom_fields();
|
||||||
|
})();
|
||||||
|
</script>
|
||||||
|
<?php
|
||||||
|
return ob_get_clean();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -811,6 +811,20 @@ function users_get_users_by_group($id_group, $um=false, $disabled=true)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete session user if exist
|
||||||
|
*
|
||||||
|
* @param string $id_user User id.
|
||||||
|
*
|
||||||
|
* @return boolean Return .
|
||||||
|
*/
|
||||||
|
function delete_session_user($id_user)
|
||||||
|
{
|
||||||
|
$sql = "DELETE FROM tsessions_php where data like '%\"".$id_user."\"%'";
|
||||||
|
return db_process_sql($sql);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
function users_has_profile_without_UM($id_user, $id_groups)
|
function users_has_profile_without_UM($id_user, $id_groups)
|
||||||
{
|
{
|
||||||
$sql = sprintf(
|
$sql = sprintf(
|
||||||
|
@ -154,14 +154,14 @@ function progressbar(
|
|||||||
/**
|
/**
|
||||||
* Draw vertical bars graph.
|
* Draw vertical bars graph.
|
||||||
*
|
*
|
||||||
* @param array $chart_data Data chart.
|
* @param array|null $chart_data Data chart.
|
||||||
* @param array $params Params draw chart.
|
* @param array $params Params draw chart.
|
||||||
* @param integer $ttl Pdf option.
|
* @param integer $ttl Pdf option.
|
||||||
*
|
*
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
function vbar_graph(
|
function vbar_graph(
|
||||||
array $chart_data,
|
array|null $chart_data,
|
||||||
array $options
|
array $options
|
||||||
) {
|
) {
|
||||||
if (empty($chart_data) === true) {
|
if (empty($chart_data) === true) {
|
||||||
|
@ -2504,7 +2504,7 @@ function refresh() {
|
|||||||
if (array_nodes.length === 0 && array_links.length === 0) {
|
if (array_nodes.length === 0 && array_links.length === 0) {
|
||||||
update_networkmap();
|
update_networkmap();
|
||||||
$("#spinner_networkmap").css("display", "none");
|
$("#spinner_networkmap").css("display", "none");
|
||||||
startCountDown(refresh_time);
|
window.location = location;
|
||||||
} else {
|
} else {
|
||||||
if (array_nodes.length > 0) {
|
if (array_nodes.length > 0) {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
@ -2530,6 +2530,7 @@ function refresh() {
|
|||||||
},
|
},
|
||||||
error: function(e) {
|
error: function(e) {
|
||||||
$("#spinner_networkmap").css("display", "none");
|
$("#spinner_networkmap").css("display", "none");
|
||||||
|
window.location = location;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1027,6 +1027,7 @@ class ClusterWizard extends \HTML
|
|||||||
foreach ($aa_modules as $module) {
|
foreach ($aa_modules as $module) {
|
||||||
$inputs[] = [
|
$inputs[] = [
|
||||||
'block_id' => 'from-to-threshold',
|
'block_id' => 'from-to-threshold',
|
||||||
|
'label' => '<b>'.$module->name().'</b>',
|
||||||
'class' => 'flex-row line w100p',
|
'class' => 'flex-row line w100p',
|
||||||
'direct' => 1,
|
'direct' => 1,
|
||||||
'block_content' => [
|
'block_content' => [
|
||||||
|
@ -675,7 +675,8 @@ class Manager implements PublicLogin
|
|||||||
int $offset=-1,
|
int $offset=-1,
|
||||||
int $limit=-1,
|
int $limit=-1,
|
||||||
bool $favourite=false,
|
bool $favourite=false,
|
||||||
bool $slideshow=false
|
bool $slideshow=false,
|
||||||
|
string $id_user=''
|
||||||
):array {
|
):array {
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
@ -693,11 +694,15 @@ class Manager implements PublicLogin
|
|||||||
$sql_where .= 'AND td.cells_slideshow = 1';
|
$sql_where .= 'AND td.cells_slideshow = 1';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (empty($id_user) === true) {
|
||||||
|
$id_user = $config['id_user'];
|
||||||
|
}
|
||||||
|
|
||||||
// Check ACl.
|
// Check ACl.
|
||||||
if (\is_user_admin($config['id_user']) !== true) {
|
if (\is_user_admin($id_user) !== true) {
|
||||||
// Non-admin user can see dashboards of his groups and 'AR' profile.
|
// Non-admin user can see dashboards of his groups and 'AR' profile.
|
||||||
$group_list = \users_get_groups(
|
$group_list = \users_get_groups(
|
||||||
$config['id_user'],
|
$id_user,
|
||||||
'RR',
|
'RR',
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
@ -727,7 +732,7 @@ class Manager implements PublicLogin
|
|||||||
GROUP BY td.id
|
GROUP BY td.id
|
||||||
ORDER BY name%s",
|
ORDER BY name%s",
|
||||||
$string_groups,
|
$string_groups,
|
||||||
$config['id_user'],
|
$id_user,
|
||||||
$sql_where,
|
$sql_where,
|
||||||
$sql_limit
|
$sql_limit
|
||||||
);
|
);
|
||||||
@ -746,7 +751,7 @@ class Manager implements PublicLogin
|
|||||||
WHERE td.id_group = 0 AND td.id_user = '%s' %s
|
WHERE td.id_group = 0 AND td.id_user = '%s' %s
|
||||||
GROUP BY td.id
|
GROUP BY td.id
|
||||||
ORDER BY name%s",
|
ORDER BY name%s",
|
||||||
$config['id_user'],
|
$id_user,
|
||||||
$sql_where,
|
$sql_where,
|
||||||
$sql_limit
|
$sql_limit
|
||||||
);
|
);
|
||||||
|
@ -1771,8 +1771,8 @@ class Item extends CachedModel
|
|||||||
$imageSrc = static::issetInArray(
|
$imageSrc = static::issetInArray(
|
||||||
$data,
|
$data,
|
||||||
[
|
[
|
||||||
'image',
|
|
||||||
'imageSrc',
|
'imageSrc',
|
||||||
|
'image',
|
||||||
'backgroundColor',
|
'backgroundColor',
|
||||||
'backgroundType',
|
'backgroundType',
|
||||||
'valueType',
|
'valueType',
|
||||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -128,8 +128,8 @@
|
|||||||
</div>
|
</div>
|
||||||
<div style='height: 10px'>
|
<div style='height: 10px'>
|
||||||
<?php
|
<?php
|
||||||
$version = '7.0NG.767';
|
$version = '7.0NG.768';
|
||||||
$build = '230116';
|
$build = '230124';
|
||||||
$banner = "v$version Build $build";
|
$banner = "v$version Build $build";
|
||||||
|
|
||||||
error_reporting(0);
|
error_reporting(0);
|
||||||
|
281
pandora_console/operation/agentes/agent_inventory.php
Normal file
281
pandora_console/operation/agentes/agent_inventory.php
Normal file
@ -0,0 +1,281 @@
|
|||||||
|
<?php
|
||||||
|
// phpcs:disable Squiz.NamingConventions.ValidVariableName.MemberNotCamelCaps
|
||||||
|
/**
|
||||||
|
* Agent Inventory view.
|
||||||
|
*
|
||||||
|
* @category Monitoring.
|
||||||
|
* @package Pandora FMS
|
||||||
|
* @subpackage Enterprise
|
||||||
|
* @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.
|
||||||
|
* ============================================================================
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Begin.
|
||||||
|
require 'include/config.php';
|
||||||
|
|
||||||
|
// Check user credentials.
|
||||||
|
check_login();
|
||||||
|
|
||||||
|
if (! check_acl($config['id_user'], 0, 'AR') && ! check_acl($config['id_user'], 0, 'AW')) {
|
||||||
|
db_pandora_audit(
|
||||||
|
AUDIT_LOG_ACL_VIOLATION,
|
||||||
|
'Trying to access Agent Inventory view'
|
||||||
|
);
|
||||||
|
include 'general/noaccess.php';
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
global $id_agente;
|
||||||
|
|
||||||
|
$diff_view = (bool) get_parameter('diff_view', 0);
|
||||||
|
if ($diff_view === true) {
|
||||||
|
// Show the diff.
|
||||||
|
include 'enterprise/operation/agentes/agent_inventory.diff_view.php';
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Initialize data.
|
||||||
|
$module = (int) get_parameter('module_inventory_agent_view');
|
||||||
|
$utimestamp = (int) get_parameter('utimestamp', 0);
|
||||||
|
$search_string = (string) get_parameter('search_string');
|
||||||
|
|
||||||
|
$sqlGetData = sprintf(
|
||||||
|
'SELECT *
|
||||||
|
FROM tmodule_inventory, tagent_module_inventory
|
||||||
|
WHERE tmodule_inventory.id_module_inventory = tagent_module_inventory.id_module_inventory
|
||||||
|
AND id_agente = %d %s',
|
||||||
|
$id_agente,
|
||||||
|
($module !== 0) ? 'AND tagent_module_inventory.id_module_inventory = '.$module : ''
|
||||||
|
);
|
||||||
|
|
||||||
|
$rows = db_get_all_rows_sql($sqlGetData);
|
||||||
|
|
||||||
|
if ($rows === false) {
|
||||||
|
ui_print_empty_data(__('This agent has not modules inventory'));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get Module Inventory.
|
||||||
|
$sqlModuleInventoryAgentView = sprintf(
|
||||||
|
'SELECT tmodule_inventory.id_module_inventory, tmodule_inventory.name
|
||||||
|
FROM tmodule_inventory, tagent_module_inventory
|
||||||
|
WHERE tmodule_inventory.id_module_inventory = tagent_module_inventory.id_module_inventory
|
||||||
|
AND id_agente = %s',
|
||||||
|
$id_agente
|
||||||
|
);
|
||||||
|
|
||||||
|
// Utimestamps.
|
||||||
|
$utimestamps = db_get_all_rows_sql(
|
||||||
|
sprintf(
|
||||||
|
'SELECT tagente_datos_inventory.utimestamp
|
||||||
|
FROM tmodule_inventory, tagent_module_inventory, tagente_datos_inventory
|
||||||
|
WHERE tmodule_inventory.id_module_inventory = tagent_module_inventory.id_module_inventory
|
||||||
|
AND tagente_datos_inventory.id_agent_module_inventory = tagent_module_inventory.id_agent_module_inventory
|
||||||
|
AND tagent_module_inventory.%s',
|
||||||
|
($module !== 0) ? 'id_module_inventory = '.$module : 'id_agente = '.$id_agente
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
$utimestamps = (empty($utimestamps) === true) ? [] : extract_column($utimestamps, 'utimestamp');
|
||||||
|
|
||||||
|
$utimestampSelectValues = array_reduce(
|
||||||
|
$utimestamps,
|
||||||
|
function ($acc, $utimestamp) use ($config) {
|
||||||
|
$acc[$utimestamp] = date($config['date_format'], $utimestamp);
|
||||||
|
return $acc;
|
||||||
|
},
|
||||||
|
[]
|
||||||
|
);
|
||||||
|
|
||||||
|
// Inventory module select.
|
||||||
|
$table = new stdClass();
|
||||||
|
$table->width = '100%';
|
||||||
|
$table->class = 'databox filters';
|
||||||
|
$table->size = [];
|
||||||
|
$table->data = [];
|
||||||
|
|
||||||
|
$table->data[0][0] = __('Module');
|
||||||
|
$table->data[0][1] = html_print_select_from_sql(
|
||||||
|
$sqlModuleInventoryAgentView,
|
||||||
|
'module_inventory_agent_view',
|
||||||
|
$module,
|
||||||
|
'javascript:this.form.submit();',
|
||||||
|
__('All'),
|
||||||
|
0,
|
||||||
|
true
|
||||||
|
);
|
||||||
|
|
||||||
|
$table->data[0][2] = __('Date');
|
||||||
|
$table->data[0][3] = html_print_select(
|
||||||
|
$utimestampSelectValues,
|
||||||
|
'utimestamp',
|
||||||
|
$utimestamp,
|
||||||
|
'javascript:this.form.submit();',
|
||||||
|
__('Now'),
|
||||||
|
0,
|
||||||
|
true
|
||||||
|
);
|
||||||
|
|
||||||
|
$table->data[0][4] = __('Search');
|
||||||
|
$table->data[0][5] = html_print_input_text('search_string', $search_string, '', 25, 0, true);
|
||||||
|
$table->data[0][6] = html_print_submit_button(__('Search'), 'search_button', false, 'class="sub wand"', true);
|
||||||
|
|
||||||
|
// Show filters table.
|
||||||
|
echo sprintf(
|
||||||
|
'<form method="post" action="index.php?sec=estado&sec2=operation/agentes/ver_agente&tab=inventory&id_agente=%s">%s</form>',
|
||||||
|
$id_agente,
|
||||||
|
html_print_table($table, true)
|
||||||
|
);
|
||||||
|
|
||||||
|
unset($table);
|
||||||
|
|
||||||
|
$idModuleInventory = null;
|
||||||
|
$rowTable = 1;
|
||||||
|
$printedTables = 0;
|
||||||
|
|
||||||
|
// Inventory module data.
|
||||||
|
foreach ($rows as $row) {
|
||||||
|
if ($utimestamp > 0) {
|
||||||
|
$data_row = db_get_row_sql(
|
||||||
|
"SELECT data, timestamp
|
||||||
|
FROM tagente_datos_inventory
|
||||||
|
WHERE utimestamp <= '".$utimestamp."'
|
||||||
|
AND id_agent_module_inventory = ".$row['id_agent_module_inventory'].'
|
||||||
|
ORDER BY utimestamp DESC'
|
||||||
|
);
|
||||||
|
if ($data_row !== false) {
|
||||||
|
$row['data'] = $data_row['data'];
|
||||||
|
$row['timestamp'] = $data_row['timestamp'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($idModuleInventory != $row['id_module_inventory']) {
|
||||||
|
if (isset($table) === true && $rowTable > 1) {
|
||||||
|
html_print_table($table);
|
||||||
|
unset($table);
|
||||||
|
$rowTable = 1;
|
||||||
|
$printedTables++;
|
||||||
|
}
|
||||||
|
|
||||||
|
$table = new StdClass();
|
||||||
|
$table->width = '98%';
|
||||||
|
$table->align = [];
|
||||||
|
$table->cellpadding = 4;
|
||||||
|
$table->cellspacing = 4;
|
||||||
|
$table->class = 'databox filters';
|
||||||
|
$table->head = [];
|
||||||
|
$table->head[0] = $row['name'].' - ('.date($config['date_format'], $row['utimestamp']).')';
|
||||||
|
|
||||||
|
if ((bool) $row['block_mode'] === true) {
|
||||||
|
$table->head[0] .= ' <a href="index.php?sec=estado&sec2=operation/agentes/ver_agente&tab=inventory&id_agente='.$id_agente.'&utimestamp='.$utimestamp.'&id_agent_module_inventory='.$row['id_agent_module_inventory'].'&diff_view=1">'.html_print_image(
|
||||||
|
'images/op_inventory.menu.png',
|
||||||
|
true,
|
||||||
|
[
|
||||||
|
'alt' => __('Diff view'),
|
||||||
|
'title' => __('Diff view'),
|
||||||
|
'style' => 'vertical-align: middle; opacity: 0.8;',
|
||||||
|
]
|
||||||
|
).'</a>';
|
||||||
|
}
|
||||||
|
|
||||||
|
$subHeadTitles = explode(';', io_safe_output($row['data_format']));
|
||||||
|
|
||||||
|
$table->head_colspan = [];
|
||||||
|
$table->head_colspan[0] = (1 + count($subHeadTitles));
|
||||||
|
$total_fields = count($subHeadTitles);
|
||||||
|
$table->rowspan = [];
|
||||||
|
|
||||||
|
$table->data = [];
|
||||||
|
|
||||||
|
$iterator = 0;
|
||||||
|
|
||||||
|
foreach ($subHeadTitles as $titleData) {
|
||||||
|
$table->data[0][$iterator] = $titleData;
|
||||||
|
$table->cellstyle[0][$iterator] = 'background: #373737; color: #FFF;';
|
||||||
|
|
||||||
|
$iterator++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($row['block_mode']) {
|
||||||
|
$rowTable++;
|
||||||
|
$table->data[$rowTable][0] = '<pre>'.$row['data'].'</pre>';
|
||||||
|
} else {
|
||||||
|
$arrayDataRowsInventory = explode(SEPARATOR_ROW, io_safe_output($row['data']));
|
||||||
|
// SPLIT DATA IN ROWS
|
||||||
|
// Remove the empty item caused by a line ending with a new line.
|
||||||
|
$len = count($arrayDataRowsInventory);
|
||||||
|
if (end($arrayDataRowsInventory) == '') {
|
||||||
|
$len--;
|
||||||
|
unset($arrayDataRowsInventory[$len]);
|
||||||
|
}
|
||||||
|
|
||||||
|
$iterator1 = 0;
|
||||||
|
$numRowHasNameAgent = $rowTable;
|
||||||
|
|
||||||
|
$rowPair = true;
|
||||||
|
$iterator = 0;
|
||||||
|
foreach ($arrayDataRowsInventory as $dataRowInventory) {
|
||||||
|
$table->rowclass[$iterator] = ($rowPair === true) ? 'rowPair' : 'rowOdd';
|
||||||
|
$rowPair = !$rowPair;
|
||||||
|
$iterator++;
|
||||||
|
|
||||||
|
// Because SQL query extract all rows (row1;row2;row3...) and only I want the row has
|
||||||
|
// the search string.
|
||||||
|
if ($search_string && preg_match('/'.io_safe_output($search_string).'/i', io_safe_output($dataRowInventory)) == 0) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($rowTable > $numRowHasNameAgent) {
|
||||||
|
$table->data[$rowTable][0] = '';
|
||||||
|
}
|
||||||
|
|
||||||
|
$arrayDataColumnInventory = explode(SEPARATOR_COLUMN, $dataRowInventory);
|
||||||
|
// SPLIT ROW IN COLUMNS.
|
||||||
|
$iterator2 = 0;
|
||||||
|
foreach ($arrayDataColumnInventory as $dataColumnInventory) {
|
||||||
|
$table->data[$rowTable][$iterator2] = $dataColumnInventory;
|
||||||
|
$iterator2++;
|
||||||
|
}
|
||||||
|
|
||||||
|
$iterator1++;
|
||||||
|
$rowTable++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($iterator1 > 5) {
|
||||||
|
// PRINT COUNT TOTAL.
|
||||||
|
$table->data[$rowTable][0] = '<b>'.__('Total').': </b>'.$iterator1;
|
||||||
|
$rowTable++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$idModuleInventory = $row['id_module_inventory'];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($table) === true && $rowTable > 1) {
|
||||||
|
html_print_table($table);
|
||||||
|
$printedTables++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($printedTables === 0) {
|
||||||
|
echo "<div class='nf'>".__('No data found.').'</div>';
|
||||||
|
}
|
@ -1061,7 +1061,7 @@ if (is_ajax() === true) {
|
|||||||
|
|
||||||
if (preg_match('/(.+)_ifOperStatus$/', (string) $source_text, $matches)) {
|
if (preg_match('/(.+)_ifOperStatus$/', (string) $source_text, $matches)) {
|
||||||
if ($matches[1]) {
|
if ($matches[1]) {
|
||||||
$source_text = $matches[1];
|
$source_text = $matches[1];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -1480,7 +1480,7 @@ if (!empty($result)) {
|
|||||||
'agent_small',
|
'agent_small',
|
||||||
false,
|
false,
|
||||||
true,
|
true,
|
||||||
false,
|
true,
|
||||||
'[…]',
|
'[…]',
|
||||||
'font-size:7.5pt;'
|
'font-size:7.5pt;'
|
||||||
);
|
);
|
||||||
|
@ -1455,8 +1455,20 @@ if ($tab === 'alert') {
|
|||||||
|
|
||||||
// Inventory.
|
// Inventory.
|
||||||
$inventoryCount = db_get_num_rows('SELECT id_agent_module_inventory FROM tagent_module_inventory WHERE id_agente = '.$agent['id_agente']);
|
$inventoryCount = db_get_num_rows('SELECT id_agent_module_inventory FROM tagent_module_inventory WHERE id_agente = '.$agent['id_agente']);
|
||||||
$inventorytab = enterprise_hook('inventory_tab');
|
$inventorytab['text'] = '<a href="index.php?sec=estado&sec2=operation/agentes/ver_agente&tab=inventory&id_agente='.$id_agente.'">'.html_print_image(
|
||||||
if ($inventorytab == -1 || $inventoryCount === 0) {
|
'images/page_white_text.png',
|
||||||
|
true,
|
||||||
|
[
|
||||||
|
'class' => 'invert_filter',
|
||||||
|
'title' => __('Inventory'),
|
||||||
|
]
|
||||||
|
).'</a>';
|
||||||
|
|
||||||
|
if ($tab == 'inventory') {
|
||||||
|
$inventorytab['active'] = true;
|
||||||
|
} else {
|
||||||
|
$inventorytab['active'] = false;
|
||||||
|
}if ($inventorytab == -1 || $inventoryCount === 0) {
|
||||||
$inventorytab = '';
|
$inventorytab = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1986,7 +1998,7 @@ switch ($tab) {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 'inventory':
|
case 'inventory':
|
||||||
enterprise_include('operation/agentes/agent_inventory.php');
|
include 'operation/agentes/agent_inventory.php';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'collection':
|
case 'collection':
|
||||||
|
551
pandora_console/operation/inventory/inventory.php
Executable file
551
pandora_console/operation/inventory/inventory.php
Executable file
@ -0,0 +1,551 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Inventory view.
|
||||||
|
*
|
||||||
|
* @category Monitoring.
|
||||||
|
* @package Pandora FMS
|
||||||
|
* @subpackage Community
|
||||||
|
* @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.
|
||||||
|
* ============================================================================
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Begin.
|
||||||
|
require_once $config['homedir'].'/include/functions_users.php';
|
||||||
|
require_once $config['homedir'].'/include/functions_inventory.php';
|
||||||
|
|
||||||
|
if (is_ajax() === true) {
|
||||||
|
$get_csv_url = (bool) get_parameter('get_csv_url');
|
||||||
|
|
||||||
|
if ($get_csv_url) {
|
||||||
|
// $inventory_module = get_parameter ('module_inventory_general_view', 'all');
|
||||||
|
$inventory_module = get_parameter('module', 'all');
|
||||||
|
$inventory_id_group = (int) get_parameter('id_group', 0);
|
||||||
|
// 0 is All groups
|
||||||
|
$inventory_search_string = (string) get_parameter('search_string');
|
||||||
|
$export = (string) get_parameter('export');
|
||||||
|
$utimestamp = (int) get_parameter('utimestamp', 0);
|
||||||
|
$inventory_agent = (string) get_parameter('agent', '');
|
||||||
|
$order_by_agent = (boolean) get_parameter('order_by_agent', 0);
|
||||||
|
|
||||||
|
// Agent select.
|
||||||
|
$agents = [];
|
||||||
|
|
||||||
|
$sql = 'SELECT id_agente, nombre FROM tagente';
|
||||||
|
if ($inventory_id_group > 0) {
|
||||||
|
$sql .= ' WHERE id_grupo = '.$inventory_id_group;
|
||||||
|
} else {
|
||||||
|
$user_groups = implode(',', array_keys(users_get_groups($config['id_user'])));
|
||||||
|
|
||||||
|
// Avoid errors if there are no groups.
|
||||||
|
if (empty($user_groups) === true) {
|
||||||
|
$user_groups = '"0"';
|
||||||
|
}
|
||||||
|
|
||||||
|
$sql .= ' WHERE id_grupo IN ('.$user_groups.')';
|
||||||
|
}
|
||||||
|
|
||||||
|
$result = db_get_all_rows_sql($sql);
|
||||||
|
if ($result !== false) {
|
||||||
|
foreach ($result as $row) {
|
||||||
|
$agents[$row['id_agente']] = $row['nombre'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$agents_select = $agents;
|
||||||
|
|
||||||
|
if (strlen($inventory_agent) == 0) {
|
||||||
|
$inventory_id_agent = -1;
|
||||||
|
$inventory_agent = __('All');
|
||||||
|
} else if ($inventory_agent == __('All')) {
|
||||||
|
$inventory_id_agent = 0;
|
||||||
|
} else {
|
||||||
|
$sql = 'SELECT id_agente
|
||||||
|
FROM tagente
|
||||||
|
WHERE nombre LIKE "'.$inventory_agent.'"';
|
||||||
|
|
||||||
|
$result = db_get_all_rows_sql($sql);
|
||||||
|
$inventory_id_agent = $result[0]['id_agente'];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Single agent selected.
|
||||||
|
if ($inventory_id_agent > 0 && isset($agents[$inventory_id_agent]) === true) {
|
||||||
|
$agents = [$inventory_id_agent => $agents[$inventory_id_agent]];
|
||||||
|
}
|
||||||
|
|
||||||
|
$agents_ids = array_keys($agents);
|
||||||
|
if (count($agents_ids) > 0) {
|
||||||
|
$inventory_data = inventory_get_data(
|
||||||
|
$agents_ids,
|
||||||
|
$inventory_module,
|
||||||
|
$utimestamp,
|
||||||
|
$inventory_search_string,
|
||||||
|
$export,
|
||||||
|
false,
|
||||||
|
$order_by_agent
|
||||||
|
);
|
||||||
|
|
||||||
|
if ((int) $inventory_data === ERR_NODATA) {
|
||||||
|
$inventory_data = '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
global $config;
|
||||||
|
|
||||||
|
check_login();
|
||||||
|
|
||||||
|
|
||||||
|
$is_metaconsole = is_metaconsole();
|
||||||
|
|
||||||
|
if ($is_metaconsole === true) {
|
||||||
|
open_meta_frame();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! check_acl($config['id_user'], 0, 'AR') && ! check_acl($config['id_user'], 0, 'AW')) {
|
||||||
|
db_pandora_audit(
|
||||||
|
AUDIT_LOG_ACL_VIOLATION,
|
||||||
|
'Trying to access Inventory'
|
||||||
|
);
|
||||||
|
include 'general/noaccess.php';
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
require_once $config['homedir'].'/include/functions_users.php';
|
||||||
|
require_once $config['homedir'].'/include/functions_inventory.php';
|
||||||
|
|
||||||
|
// Header.
|
||||||
|
ui_print_standard_header(
|
||||||
|
__('Inventory'),
|
||||||
|
'images/op_inventory.png',
|
||||||
|
false,
|
||||||
|
'',
|
||||||
|
false,
|
||||||
|
[],
|
||||||
|
[
|
||||||
|
[
|
||||||
|
'link' => '',
|
||||||
|
'label' => __('Monitoring'),
|
||||||
|
],
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$inventory_id_agent = (int) get_parameter('agent_id', -1);
|
||||||
|
$inventory_agent = (string) get_parameter('agent', '');
|
||||||
|
if (strlen($inventory_agent) == 0) {
|
||||||
|
$inventory_id_agent = -1;
|
||||||
|
$inventory_agent = __('All');
|
||||||
|
} else if ($inventory_agent == __('All')) {
|
||||||
|
$inventory_id_agent = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
$inventory_module = get_parameter('module_inventory_general_view');
|
||||||
|
$inventory_id_group = (int) get_parameter('id_group');
|
||||||
|
$inventory_search_string = (string) get_parameter('search_string');
|
||||||
|
$order_by_agent = (bool) get_parameter('order_by_agent');
|
||||||
|
$export = (string) get_parameter('export');
|
||||||
|
$utimestamp = (int) get_parameter('utimestamp');
|
||||||
|
$submit_filter = (bool) get_parameter('submit_filter');
|
||||||
|
|
||||||
|
$pagination_url_parameters = [
|
||||||
|
'inventory_id_agent' => $inventory_id_agent,
|
||||||
|
'inventory_agent' => $inventory_agent,
|
||||||
|
'inventory_id_group' => $inventory_id_group,
|
||||||
|
];
|
||||||
|
|
||||||
|
$noFilterSelected = false;
|
||||||
|
// Get variables.
|
||||||
|
if ($is_metaconsole === true) {
|
||||||
|
$nodes_connection = metaconsole_get_connections();
|
||||||
|
$id_server = (int) get_parameter('id_server', 0);
|
||||||
|
$pagination_url_parameters['id_server'] = $id_server;
|
||||||
|
|
||||||
|
if ($inventory_id_agent > 0) {
|
||||||
|
$inventory_id_server = (int) get_parameter('id_server_agent', -1);
|
||||||
|
$pagination_url_parameters['inventory_id_server'] = $inventory_id_server;
|
||||||
|
|
||||||
|
if ($inventory_id_server !== -1) {
|
||||||
|
$id_server = $inventory_id_server;
|
||||||
|
$pagination_url_parameters['id_server'] = $id_server;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// No filter selected.
|
||||||
|
$noFilterSelected = $inventory_id_agent === -1 && $inventory_id_group === 0 && $id_server === 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($is_metaconsole === true) {
|
||||||
|
if ($id_server > 0) {
|
||||||
|
$connection = metaconsole_get_connection_by_id($id_server);
|
||||||
|
$agents_node = metaconsole_get_agents_servers($connection['server_name'], $inventory_id_group);
|
||||||
|
$node = metaconsole_get_servers($id_server);
|
||||||
|
|
||||||
|
if (metaconsole_connect($connection) !== NOERR) {
|
||||||
|
ui_print_error_message(
|
||||||
|
__('There was a problem connecting with the node')
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
$sql = 'SELECT DISTINCT name as indexname, name
|
||||||
|
FROM tmodule_inventory, tagent_module_inventory
|
||||||
|
WHERE tmodule_inventory.id_module_inventory = tagent_module_inventory.id_module_inventory';
|
||||||
|
if ($inventory_id_agent > 0) {
|
||||||
|
$sql .= ' AND id_agente = '.$inventory_id_agent;
|
||||||
|
}
|
||||||
|
|
||||||
|
$result_module = db_get_all_rows_sql($sql);
|
||||||
|
if ($submit_filter === true) {
|
||||||
|
$inventory_data .= inventory_get_data(
|
||||||
|
array_keys($agents_node),
|
||||||
|
$inventory_module,
|
||||||
|
$utimestamp,
|
||||||
|
$inventory_search_string,
|
||||||
|
$export,
|
||||||
|
false,
|
||||||
|
$order_by_agent,
|
||||||
|
$node,
|
||||||
|
$pagination_url_parameters
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Restore db connection.
|
||||||
|
metaconsole_restore_db();
|
||||||
|
} else {
|
||||||
|
$result_module = [];
|
||||||
|
foreach ($nodes_connection as $key => $server) {
|
||||||
|
$agents_node = metaconsole_get_agents_servers($server['server_name'], $inventory_id_group);
|
||||||
|
$connection = metaconsole_get_connection($server['server_name']);
|
||||||
|
if (metaconsole_connect($connection) !== NOERR) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$sql = 'SELECT DISTINCT name as indexname, name
|
||||||
|
FROM tmodule_inventory, tagent_module_inventory
|
||||||
|
WHERE tmodule_inventory.id_module_inventory = tagent_module_inventory.id_module_inventory';
|
||||||
|
if ($inventory_id_agent > 0) {
|
||||||
|
$sql .= ' AND id_agente = '.$inventory_id_agent;
|
||||||
|
}
|
||||||
|
|
||||||
|
$result = db_get_all_rows_sql($sql);
|
||||||
|
|
||||||
|
if ($result !== false) {
|
||||||
|
$result_module = array_merge($result_module, $result);
|
||||||
|
if ($submit_filter === true) {
|
||||||
|
// Get the data.
|
||||||
|
$result_data = inventory_get_data(
|
||||||
|
array_keys($agents_node),
|
||||||
|
$inventory_module,
|
||||||
|
$utimestamp,
|
||||||
|
$inventory_search_string,
|
||||||
|
$export,
|
||||||
|
false,
|
||||||
|
$order_by_agent,
|
||||||
|
$server,
|
||||||
|
$pagination_url_parameters
|
||||||
|
);
|
||||||
|
if ($result_data !== ERR_NODATA) {
|
||||||
|
$inventory_data .= $result_data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Restore db connection.
|
||||||
|
metaconsole_restore_db();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$fields = [];
|
||||||
|
foreach ($result_module as $row) {
|
||||||
|
$id = array_shift($row);
|
||||||
|
$value = array_shift($row);
|
||||||
|
$fields[$id] = $value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$agent_a = (bool) check_acl($config['id_user'], 0, 'AR');
|
||||||
|
$agent_w = (bool) check_acl($config['id_user'], 0, 'AW');
|
||||||
|
$access = ($agent_a === true) ? 'AR' : (($agent_w === true) ? 'AW' : 'AR');
|
||||||
|
|
||||||
|
if (is_metaconsole() === true) {
|
||||||
|
$filteringFunction = 'active_inventory_submit()';
|
||||||
|
ui_print_info_message(['no_close' => true, 'message' => __('You must select at least one filter.'), 'force_class' => 'select_one_filter']);
|
||||||
|
?>
|
||||||
|
<script type="text/javascript">
|
||||||
|
function active_inventory_submit() {
|
||||||
|
if (
|
||||||
|
$("#id_group").val() == 0 &&
|
||||||
|
$("#id_server").val() == 0 &&
|
||||||
|
$("#module_inventory_general_view").val() == 0 &&
|
||||||
|
$("#text-search_string").val() === ''
|
||||||
|
) {
|
||||||
|
$("#submit-submit_filter").attr("disabled", true);
|
||||||
|
$(".select_one_filter").css("display", "table");
|
||||||
|
} else {
|
||||||
|
$("#submit-submit_filter").attr("disabled", false);
|
||||||
|
$(".select_one_filter").css("display", "none");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
<?php
|
||||||
|
} else {
|
||||||
|
$filteringFunction = '';
|
||||||
|
}
|
||||||
|
|
||||||
|
echo '<form method="POST" action="index.php?sec=estado&sec2=operation/inventory/inventory" name="form_inventory">';
|
||||||
|
|
||||||
|
$table = new stdClass();
|
||||||
|
$table->width = '100%';
|
||||||
|
$table->class = 'databox filters';
|
||||||
|
$table->size = [];
|
||||||
|
$table->size[0] = '120px';
|
||||||
|
$table->cellpadding = 0;
|
||||||
|
$table->cellspacing = 0;
|
||||||
|
$table->data = [];
|
||||||
|
$table->rowspan[0][4] = 2;
|
||||||
|
|
||||||
|
if ($is_metaconsole === true) {
|
||||||
|
// Node select.
|
||||||
|
$nodes = [];
|
||||||
|
foreach ($nodes_connection as $row) {
|
||||||
|
$nodes[$row['id']] = $row['server_name'];
|
||||||
|
}
|
||||||
|
|
||||||
|
$table->data[-1][0] = '<strong>'.__('Server').'</strong>';
|
||||||
|
$table->data[-1][1] = html_print_select($nodes, 'id_server', $id_server, $filteringFunction, __('All'), 0, true, false, true, '', false, 'min-width: 250px; max-width: 300px;');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Group select.
|
||||||
|
$table->data[0][0] = '<strong>'.__('Group').'</strong>';
|
||||||
|
|
||||||
|
$table->data[0][1] = '<div class="w250px">';
|
||||||
|
$table->data[0][1] .= html_print_select_groups(
|
||||||
|
$config['id_user'],
|
||||||
|
$access,
|
||||||
|
true,
|
||||||
|
'id_group',
|
||||||
|
$inventory_id_group,
|
||||||
|
$filteringFunction,
|
||||||
|
'',
|
||||||
|
'1',
|
||||||
|
true,
|
||||||
|
false,
|
||||||
|
true,
|
||||||
|
'',
|
||||||
|
false
|
||||||
|
);
|
||||||
|
$table->data[0][1] .= '</div>';
|
||||||
|
|
||||||
|
// Module selected.
|
||||||
|
$table->data[0][2] = '<strong>'.__('Module').'</strong>';
|
||||||
|
|
||||||
|
if ($is_metaconsole === true) {
|
||||||
|
$table->data[0][3] = html_print_select($fields, 'module_inventory_general_view', $inventory_module, $filteringFunction, __('All'), 0, true, false, true, '', false, 'min-width: 194px; max-width: 200px;');
|
||||||
|
} else {
|
||||||
|
$sql = 'SELECT name as indexname, name
|
||||||
|
FROM tmodule_inventory, tagent_module_inventory
|
||||||
|
WHERE tmodule_inventory.id_module_inventory = tagent_module_inventory.id_module_inventory';
|
||||||
|
if ($inventory_id_agent > 0) {
|
||||||
|
$sql .= ' AND id_agente = '.$inventory_id_agent;
|
||||||
|
}
|
||||||
|
|
||||||
|
$table->data[0][3] = html_print_select_from_sql($sql, 'module_inventory_general_view', $inventory_module, '', __('All'), 'all', true, false, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Button of submit.
|
||||||
|
$table->data[0][4] = html_print_submit_button(__('Search'), 'submit_filter', $noFilterSelected, "class='sub search'", true);
|
||||||
|
|
||||||
|
// Agent select.
|
||||||
|
if ($is_metaconsole === false) {
|
||||||
|
$agents = [];
|
||||||
|
$sql = 'SELECT id_agente, nombre FROM tagente';
|
||||||
|
if ($inventory_id_group > 0) {
|
||||||
|
$sql .= ' WHERE id_grupo = '.$inventory_id_group;
|
||||||
|
} else {
|
||||||
|
$user_groups = implode(',', array_keys(users_get_groups($config['id_user'])));
|
||||||
|
|
||||||
|
// Avoid errors if there are no groups.
|
||||||
|
if (empty($user_groups) === true) {
|
||||||
|
$user_groups = '"0"';
|
||||||
|
}
|
||||||
|
|
||||||
|
$sql .= ' WHERE id_grupo IN ('.$user_groups.')';
|
||||||
|
}
|
||||||
|
|
||||||
|
$result = db_get_all_rows_sql($sql);
|
||||||
|
if ($result) {
|
||||||
|
foreach ($result as $row) {
|
||||||
|
$agents[$row['id_agente']] = $row['nombre'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$table->data[1][0] = '<strong>'.__('Agent').'</strong>';
|
||||||
|
|
||||||
|
$params = [];
|
||||||
|
$params['return'] = true;
|
||||||
|
$params['show_helptip'] = true;
|
||||||
|
$params['input_name'] = 'agent';
|
||||||
|
$params['value'] = $inventory_agent;
|
||||||
|
$params['selectbox_id'] = 'module_inventory_general_view';
|
||||||
|
$params['javascript_is_function_select'] = true;
|
||||||
|
$params['javascript_function_action_after_select'] = 'this.form.submit';
|
||||||
|
$params['use_hidden_input_idagent'] = true;
|
||||||
|
$params['print_hidden_input_idagent'] = true;
|
||||||
|
$params['hidden_input_idagent_id'] = 'hidden-autocomplete_id_agent';
|
||||||
|
$params['hidden_input_idagent_name'] = 'agent_id';
|
||||||
|
$params['hidden_input_idagent_value'] = $inventory_id_agent;
|
||||||
|
if ($is_metaconsole === true) {
|
||||||
|
$params['print_input_id_server'] = true;
|
||||||
|
$params['input_id_server_id'] = 'hidden-autocomplete_id_server';
|
||||||
|
$params['input_id_server_name'] = 'id_server_agent';
|
||||||
|
$params['input_id_server_value'] = $inventory_id_server;
|
||||||
|
$params['metaconsole_enabled'] = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
$table->data[1][1] = ui_print_agent_autocomplete_input($params);
|
||||||
|
|
||||||
|
// String search_string.
|
||||||
|
$table->data[1][2] = '<strong>'.__('Search').'</strong>';
|
||||||
|
$table->data[1][3] = html_print_input_text('search_string', $inventory_search_string, '', 25, 0, true, false, false, '', '', $filteringFunction, 'off', false, $filteringFunction);
|
||||||
|
|
||||||
|
// Date filter. In Metaconsole has not reason for show.
|
||||||
|
if (is_metaconsole() === false) {
|
||||||
|
$table->data[2][0] = '<strong>'.__('Date').'</strong>';
|
||||||
|
$dates = inventory_get_dates($inventory_module, $inventory_agent, $inventory_id_group);
|
||||||
|
$table->data[2][1] = html_print_select($dates, 'utimestamp', $utimestamp, '', __('Last'), 0, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Order by agent filter.
|
||||||
|
$table->data[2][2] = '<strong>'.__('Order by agent').'</strong>';
|
||||||
|
|
||||||
|
$table->data[2][3] = html_print_checkbox('order_by_agent', 1, $order_by_agent, true, false, '');
|
||||||
|
|
||||||
|
html_print_table($table);
|
||||||
|
|
||||||
|
echo '</form>';
|
||||||
|
|
||||||
|
// No agent selected or no search performed.
|
||||||
|
if ($inventory_id_agent < 0 || $submit_filter === false) {
|
||||||
|
echo ' </td></tr><tr><td>';
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($is_metaconsole === false) {
|
||||||
|
// Single agent selected.
|
||||||
|
if ($inventory_id_agent > 0 && isset($agents[$inventory_id_agent]) === true) {
|
||||||
|
$agents = [$inventory_id_agent => $agents[$inventory_id_agent]];
|
||||||
|
}
|
||||||
|
|
||||||
|
$agents_ids = array_keys($agents);
|
||||||
|
if (count($agents_ids) > 0) {
|
||||||
|
$inventory_data = inventory_get_data(
|
||||||
|
$agents_ids,
|
||||||
|
$inventory_module,
|
||||||
|
$utimestamp,
|
||||||
|
$inventory_search_string,
|
||||||
|
$export,
|
||||||
|
false,
|
||||||
|
$order_by_agent,
|
||||||
|
'',
|
||||||
|
$pagination_url_parameters
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (count($agents_ids) === 0 || (int) $inventory_data === ERR_NODATA) {
|
||||||
|
ui_print_info_message(['no_close' => true, 'message' => __('No data found.') ]);
|
||||||
|
echo ' </td></tr><tr><td>';
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
echo "<div id='url_csv' style='width: ".$table->width.";' class='inventory_table_buttons'>";
|
||||||
|
echo "<a href='javascript: get_csv_url(\"".$inventory_module.'",'.$inventory_id_group.','.'"'.$inventory_search_string.'",'.$utimestamp.','.'"'.$inventory_agent.'",'.$order_by_agent.")'><span>".__('Export this list to CSV').'</span>'.html_print_image('images/csv.png', true, ['title' => __('Export this list to CSV')]).'</a>';
|
||||||
|
echo '</div>';
|
||||||
|
echo "<div id='loading_url' style='display: none; width: ".$table->width."; text-align: right;'>".html_print_image('images/spinner.gif', true).'</div>';
|
||||||
|
?>
|
||||||
|
<script type="text/javascript">
|
||||||
|
function get_csv_url(module, id_group, search_string, utimestamp, agent, order_by_agent) {
|
||||||
|
$("#url_csv").hide();
|
||||||
|
$("#loading_url").show();
|
||||||
|
$.ajax ({
|
||||||
|
method:'GET',
|
||||||
|
url:'ajax.php',
|
||||||
|
datatype:'html',
|
||||||
|
data:{
|
||||||
|
"page" : "operation/inventory/inventory",
|
||||||
|
"get_csv_url" : 1,
|
||||||
|
"module" : module,
|
||||||
|
"id_group" : id_group,
|
||||||
|
"search_string" : search_string,
|
||||||
|
"utimestamp" : utimestamp,
|
||||||
|
"agent" : agent,
|
||||||
|
"export": true,
|
||||||
|
"order_by_agent": order_by_agent
|
||||||
|
},
|
||||||
|
success: function (data, status) {
|
||||||
|
$("#url_csv").html(data);
|
||||||
|
$("#loading_url").hide();
|
||||||
|
$("#url_csv").show();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
<?php
|
||||||
|
echo $inventory_data;
|
||||||
|
} else {
|
||||||
|
if (empty($inventory_data) === true) {
|
||||||
|
ui_print_info_message(['no_close' => true, 'message' => __('No data found.') ]);
|
||||||
|
} else {
|
||||||
|
echo $inventory_data;
|
||||||
|
}
|
||||||
|
|
||||||
|
close_meta_frame();
|
||||||
|
}
|
||||||
|
|
||||||
|
ui_require_jquery_file('pandora.controls');
|
||||||
|
ui_require_jquery_file('ajaxqueue');
|
||||||
|
ui_require_jquery_file('bgiframe');
|
||||||
|
?>
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
/* <![CDATA[ */
|
||||||
|
$(document).ready (function () {
|
||||||
|
<?php if (is_metaconsole() === true) : ?>
|
||||||
|
active_inventory_submit();
|
||||||
|
<?php endif; ?>
|
||||||
|
$("#id_group").click (
|
||||||
|
function () {
|
||||||
|
$(this).css ("width", "auto");
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
$("#id_group").blur (function () {
|
||||||
|
$(this).css ("width", "180px");
|
||||||
|
});
|
||||||
|
});
|
||||||
|
/* ]]> */
|
||||||
|
</script>
|
@ -73,7 +73,11 @@ if ($access_console_node === true) {
|
|||||||
|
|
||||||
$sub['view']['sub2'] = $sub2;
|
$sub['view']['sub2'] = $sub2;
|
||||||
|
|
||||||
enterprise_hook('inventory_menu');
|
if (check_acl($config['id_user'], 0, 'AR') || check_acl($config['id_user'], 0, 'AW')) {
|
||||||
|
$sub['operation/inventory/inventory']['text'] = __('Inventory');
|
||||||
|
$sub['operation/inventory/inventory']['id'] = 'Inventory';
|
||||||
|
$sub['operation/inventory/inventory']['refr'] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
if ($config['activate_netflow']) {
|
if ($config['activate_netflow']) {
|
||||||
$sub['network_traffic'] = [
|
$sub['network_traffic'] = [
|
||||||
|
@ -31,6 +31,7 @@ global $config;
|
|||||||
$headerTitle = __('User detail editor');
|
$headerTitle = __('User detail editor');
|
||||||
// Load the header.
|
// Load the header.
|
||||||
require $config['homedir'].'/operation/users/user_edit_header.php';
|
require $config['homedir'].'/operation/users/user_edit_header.php';
|
||||||
|
use PandoraFMS\Dashboard\Manager;
|
||||||
|
|
||||||
if (is_metaconsole() === false) {
|
if (is_metaconsole() === false) {
|
||||||
include 'include/javascript/timezonepicker/includes/parser.inc';
|
include 'include/javascript/timezonepicker/includes/parser.inc';
|
||||||
@ -442,7 +443,13 @@ if (!$meta) {
|
|||||||
|
|
||||||
$home_screen .= html_print_select($values, 'section', io_safe_output($user_info['section']), 'show_data_section();', '', -1, true, false, false).'</div>';
|
$home_screen .= html_print_select($values, 'section', io_safe_output($user_info['section']), 'show_data_section();', '', -1, true, false, false).'</div>';
|
||||||
|
|
||||||
$dashboards = get_user_dashboards($config['id_user']);
|
$dashboards = Manager::getDashboards(
|
||||||
|
-1,
|
||||||
|
-1,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
$config['id_user']
|
||||||
|
);
|
||||||
|
|
||||||
$dashboards_aux = [];
|
$dashboards_aux = [];
|
||||||
if ($dashboards === false) {
|
if ($dashboards === false) {
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user