diff --git a/extras/build_src.sh b/extras/build_src.sh index da5b75d20b..a9e3262afd 100755 --- a/extras/build_src.sh +++ b/extras/build_src.sh @@ -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 # 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 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_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_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_server_enterprise-$LOCAL_VERSION.tar.gz $RPMHOME/SOURCES/pandorafms_server_enterprise-$VERSION.tar.gz || exit 1 fi diff --git a/extras/deploy-scripts/pandora_agent_deploy.sh b/extras/deploy-scripts/pandora_agent_deploy.sh index 281ad530a9..3f7ffcb7bf 100644 --- a/extras/deploy-scripts/pandora_agent_deploy.sh +++ b/extras/deploy-scripts/pandora_agent_deploy.sh @@ -142,7 +142,7 @@ if [[ $OS_RELEASE =~ 'rhel' ]] || [[ $OS_RELEASE =~ 'fedora' ]]; then echo -e "${cyan}Installing agent dependencies...${reset}" ${green}OK${reset} # 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}" check_cmd_status 'Error installing Pandora FMS agent' @@ -151,8 +151,8 @@ fi if [[ $OS_RELEASE == 'debian' ]]; then execute_cmd "apt update" 'Updating repos' 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 'apt install -y ./pandorafms.agent_unix_7.0NG.deb' 'Installing Pandora FMS agent' + 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_linux_7.0NG.deb' 'Installing Pandora FMS agent' fi # Configuring Agente diff --git a/extras/deploy-scripts/pandora_deploy_community.sh b/extras/deploy-scripts/pandora_deploy_community.sh index 534649be59..873b9a3068 100644 --- a/extras/deploy-scripts/pandora_deploy_community.sh +++ b/extras/deploy-scripts/pandora_deploy_community.sh @@ -285,11 +285,16 @@ server_dependencies=" \ java \ bind-utils \ whois \ + cpanminus \ http://firefly.artica.es/centos7/xprobe2-0.3-12.2.x86_64.rpm \ http://firefly.artica.es/centos7/wmic-1.4-1.el7.x86_64.rpm \ https://firefly.artica.es/centos7/pandorawmic-1.0.0-1.x86_64.rpm" execute_cmd "yum install -y $server_dependencies" "Installing Pandora FMS Server dependencies" +# install cpan dependencies +execute_cmd "cpanm -i Thread::Semaphore" "Installing Thread::Semaphore" + + # SDK VMware perl dependencies vmware_dependencies=" \ http://firefly.artica.es/centos8/VMware-vSphere-Perl-SDK-6.5.0-4566394.x86_64.rpm \ @@ -410,17 +415,17 @@ execute_cmd "systemctl restart mysqld" "Configuring database engine" 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_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 [ "$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_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 # 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_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 execute_cmd "yum install -y $HOME/pandora_deploy_tmp/pandorafms*.rpm" "installing PandoraFMS packages" diff --git a/extras/deploy-scripts/pandora_deploy_community_el8.sh b/extras/deploy-scripts/pandora_deploy_community_el8.sh index 465ee302ea..794e11f8fe 100644 --- a/extras/deploy-scripts/pandora_deploy_community_el8.sh +++ b/extras/deploy-scripts/pandora_deploy_community_el8.sh @@ -4,7 +4,7 @@ ####################################################### ## Tested versions ## # Centos 8.4, 8.5 -# Rocky 8.4, 8.5 +# Rocky 8.4, 8.5, 8.6, 8.7 # Almalinuz 8.4, 8.5 # RedHat 8.5 @@ -14,24 +14,25 @@ PANDORA_SERVER_CONF=/etc/pandora/pandora_server.conf PANDORA_AGENT_CONF=/etc/pandora/pandora_agent.conf -S_VERSION='202209231' +S_VERSION='202301251' LOGFILE="/tmp/pandora-deploy-community-$(date +%F).log" # define default variables -[ "$TZ" ] || TZ="Europe/Madrid" -[ "$MYVER" ] || MYVER=57 -[ "$PHPVER" ] || PHPVER=8 -[ "$DBHOST" ] || DBHOST=127.0.0.1 -[ "$DBNAME" ] || DBNAME=pandora -[ "$DBUSER" ] || DBUSER=pandora -[ "$DBPASS" ] || DBPASS=pandora -[ "$DBPORT" ] || DBPORT=3306 +[ "$TZ" ] || TZ="Europe/Madrid" +[ "$MYVER" ] || MYVER=57 +[ "$PHPVER" ] || PHPVER=8 +[ "$DBHOST" ] || DBHOST=127.0.0.1 +[ "$DBNAME" ] || DBNAME=pandora +[ "$DBUSER" ] || DBUSER=pandora +[ "$DBPASS" ] || DBPASS=pandora +[ "$DBPORT" ] || DBPORT=3306 [ "$DBROOTUSER" ] || DBROOTUSER=root [ "$DBROOTPASS" ] || DBROOTPASS=pandora [ "$SKIP_PRECHECK" ] || SKIP_PRECHECK=0 -[ "$SKIP_DATABASE_INSTALL" ] || SKIP_DATABASE_INSTALL=0 +[ "$SKIP_DATABASE_INSTALL" ] || SKIP_DATABASE_INSTALL=0 [ "$SKIP_KERNEL_OPTIMIZATIONS" ] || SKIP_KERNEL_OPTIMIZATIONS=0 -[ "$POOL_SIZE" ] || POOL_SIZE=$(grep -i total /proc/meminfo | head -1 | awk '{printf "%.2f \n", $(NF-1)*0.4/1024}' | sed "s/\\..*$/M/g") +[ "$POOL_SIZE" ] || POOL_SIZE=$(grep -i total /proc/meminfo | head -1 | awk '{printf "%.2f \n", $(NF-1)*0.4/1024}' | sed "s/\\..*$/M/g") +[ "$PANDORA_LTS" ] || PANDORA_LTS=1 [ "$PANDORA_BETA" ] || PANDORA_BETA=0 # Ansi color code variables @@ -41,7 +42,6 @@ cyan="\e[0;36m" reset="\e[0m" # Functions - execute_cmd () { local cmd="$1" local msg="$2" @@ -76,7 +76,7 @@ check_cmd_status () { check_pre_pandora () { echo -en "${cyan}Checking environment ... ${reset}" - rpm -qa | grep 'pandorafms_' &>> /dev/null && local fail=true + rpm -qa | grep -v "pandorawmic" | grep 'pandorafms_' &>> /dev/null && local fail=true [ -d "$PANDORA_CONSOLE" ] && local fail=true [ -f /usr/bin/pandora_server ] && local fail=true @@ -137,7 +137,10 @@ check_root_permissions [ "$SKIP_PRECHECK" == 1 ] || check_pre_pandora #advicing BETA PROGRAM -[ "$PANDORA_BETA" -ne '0' ] && echo -e "${red}BETA version enable using nightly PandoraFMS packages${reset}" +INSTALLING_VER="${green}RRR version enable using RRR PandoraFMS packages${reset}" +[ "$PANDORA_BETA" -ne '0' ] && INSTALLING_VER="${red}BETA version enable using nightly PandoraFMS packages${reset}" +[ "$PANDORA_LTS" -ne '0' ] && INSTALLING_VER="${green}LTS version enable using LTS PandoraFMS packages${reset}" +echo -e $INSTALLING_VER # Connectivity check_repo_connection @@ -467,6 +470,8 @@ query_cache_size = 64M query_cache_min_res_unit = 2k query_cache_limit = 256K +#skip-log-bin + sql_mode="" [mysqld_safe] @@ -477,6 +482,7 @@ EO_CONFIG_F if [ "$MYVER" -eq '80' ] ; then sed -i -e "/query_cache.*/ s/^#*/#/g" /etc/my.cnf + sed -i -e "s/#skip-log-bin/skip-log-bin/g" /etc/my.cnf fi execute_cmd "systemctl restart mysqld" "Configuring database engine" @@ -485,20 +491,27 @@ fi export MYSQL_PWD=$DBPASS #Define packages -if [ "$PANDORA_BETA" -eq '0' ] ; then +if [ "$PANDORA_LTS" -eq '1' ] ; then + [ "$PANDORA_SERVER_PACKAGE" ] || PANDORA_SERVER_PACKAGE="http://firefly.artica.es/pandorafms/latest/RHEL_CentOS/LTS/pandorafms_server-7.0NG.noarch.rpm" + [ "$PANDORA_CONSOLE_PACKAGE" ] || PANDORA_CONSOLE_PACKAGE="http://firefly.artica.es/pandorafms/latest/RHEL_CentOS/LTS/pandorafms_console-7.0NG.noarch.rpm" + [ "$PANDORA_AGENT_PACKAGE" ] || PANDORA_AGENT_PACKAGE="http://firefly.artica.es/pandorafms/latest/RHEL_CentOS/LTS/pandorafms_agent_linux-7.0NG.noarch.rpm" +elif [ "$PANDORA_LTS" -ne '1' ] ; then [ "$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_AGENT_PACKAGE" ] || PANDORA_AGENT_PACKAGE="http://firefly.artica.es/pandorafms/latest/RHEL_CentOS/pandorafms_agent_unix-7.0NG.noarch.rpm" -elif [ "$PANDORA_BETA" -ne '0' ] ; then + [ "$PANDORA_AGENT_PACKAGE" ] || PANDORA_AGENT_PACKAGE="http://firefly.artica.es/pandorafms/latest/RHEL_CentOS/pandorafms_agent_linux-7.0NG.noarch.rpm" +fi + +# if beta is enable +if [ "$PANDORA_BETA" -eq '1' ] ; then [ "$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_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 # 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_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 execute_cmd "dnf install -y $HOME/pandora_deploy_tmp/pandorafms*.rpm" "Installing Pandora FMS packages" diff --git a/extras/deploy-scripts/pandora_deploy_community_ubuntu_2204.sh b/extras/deploy-scripts/pandora_deploy_community_ubuntu_2204.sh index b0667cca81..f52eb625e2 100644 --- a/extras/deploy-scripts/pandora_deploy_community_ubuntu_2204.sh +++ b/extras/deploy-scripts/pandora_deploy_community_ubuntu_2204.sh @@ -16,7 +16,7 @@ PANDORA_AGENT_CONF=/etc/pandora/pandora_agent.conf WORKDIR=/opt/pandora/deploy -S_VERSION='2022052501' +S_VERSION='202301251' LOGFILE="/tmp/pandora-deploy-community-$(date +%F).log" rm -f $LOGFILE &> /dev/null # remove last log before start @@ -34,6 +34,8 @@ rm -f $LOGFILE &> /dev/null # remove last log before start [ "$SKIP_KERNEL_OPTIMIZATIONS" ] || SKIP_KERNEL_OPTIMIZATIONS=0 [ "$POOL_SIZE" ] || POOL_SIZE=$(grep -i total /proc/meminfo | head -1 | awk '{printf "%.2f \n", $(NF-1)*0.4/1024}' | sed "s/\\..*$/M/g") [ "$PANDORA_BETA" ] || PANDORA_BETA=0 +[ "$PANDORA_LTS" ] || PANDORA_LTS=1 + # Ansi color code variables red="\e[0;91m" @@ -134,7 +136,10 @@ check_root_permissions [ "$SKIP_PRECHECK" == 1 ] || check_pre_pandora #advicing BETA PROGRAM -[ "$PANDORA_BETA" -ne '0' ] && echo -e "${red}BETA version enable using nightly PandoraFMS packages${reset}" +INSTALLING_VER="${green}RRR version enable using RRR PandoraFMS packages${reset}" +[ "$PANDORA_BETA" -ne '0' ] && INSTALLING_VER="${red}BETA version enable using nightly PandoraFMS packages${reset}" +[ "$PANDORA_LTS" -ne '0' ] && INSTALLING_VER="${green}LTS version enable using LTS PandoraFMS packages${reset}" +echo -e $INSTALLING_VER # Connectivity check_repo_connection @@ -272,14 +277,19 @@ echo -en "${cyan}Installing phantomjs...${reset}" /usr/bin/phantomjs --version &>> "$LOGFILE" check_cmd_status "Error Installing phanromjs" +# create symlink for fping +rm -f /usr/sbin/fping &>> "$LOGFILE" +ln -s /usr/bin/fping /usr/sbin/fping &>> "$LOGFILE" + # Chrome +rm -f /usr/bin/chromium-browser &>> "$LOGFILE" execute_cmd "wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb" "Downloading google chrome" execute_cmd "apt install -y ./google-chrome-stable_current_amd64.deb" "Intalling google chrome" execute_cmd "ln -s /usr/bin/google-chrome /usr/bin/chromium-browser" "Creating /usr/bin/chromium-browser Symlink" # SDK VMware perl dependencies -vmware_dependencies=" \ - lib32z1 \ +vmware_dependencies="\ + lib32z1 \ lib32z1 \ build-essential \ uuid uuid-dev \ @@ -350,16 +360,22 @@ systemctl stop apparmor &>> "$LOGFILE" systemctl disable apparmor &>> "$LOGFILE" #install mysql -debconf-set-selections <<< $(echo -n "mysql-server mysql-server/root_password password $DBROOTPASS") &>> "$LOGFILE" -debconf-set-selections <<< $(echo -n "mysql-server mysql-server/root_password_again password $DBROOTPASS") &>> "$LOGFILE" -echo -en "${cyan}Installing MySql Server...${reset}" - env DEBIAN_FRONTEND=noninteractive apt install -y mysql-server &>> "$LOGFILE" +execute_cmd "curl -O https://repo.percona.com/apt/percona-release_latest.generic_all.deb" "Downloading Percona repository for MySQL8" +execute_cmd "apt install -y gnupg2 lsb-release ./percona-release_latest.generic_all.deb" "Installing Percona repository for MySQL8" +execute_cmd "percona-release setup ps80" "Configuring Percona repository for MySQL8" + +echo -en "${cyan}Installing Percona Server for MySQL8...${reset}" + env DEBIAN_FRONTEND=noninteractive apt install -y percona-server-server &>> "$LOGFILE" check_cmd_status "Error Installing MySql Server" #Configuring Database if [ "$SKIP_DATABASE_INSTALL" -eq '0' ] ; then execute_cmd "systemctl start mysql" "Starting database engine" + + echo """ + ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '$DBROOTPASS'; + """ | mysql -uroot &>> "$LOGFILE" export MYSQL_PWD=$DBROOTPASS echo -en "${cyan}Creating Pandora FMS database...${reset}" @@ -399,11 +415,12 @@ max_connections = 100 key_buffer_size=4M read_buffer_size=128K - read_rnd_buffer_size=128K sort_buffer_size=128K join_buffer_size=4M +skip-log-bin + sql_mode="" log-error=/var/log/mysql/error.log @@ -417,14 +434,20 @@ execute_cmd "systemctl restart mysql" "Configuring and restarting database engin #Define packages -if [ "$PANDORA_BETA" -eq '0' ] ; then +if [ "$PANDORA_LTS" -eq '1' ] ; then + [ "$PANDORA_SERVER_PACKAGE" ] || PANDORA_SERVER_PACKAGE="http://firefly.artica.es/pandorafms/latest/Tarball/LTS/pandorafms_server-7.0NG.tar.gz" + [ "$PANDORA_CONSOLE_PACKAGE" ] || PANDORA_CONSOLE_PACKAGE="http://firefly.artica.es/pandorafms/latest/Tarball/LTS/pandorafms_console-7.0NG.tar.gz" + [ "$PANDORA_AGENT_PACKAGE" ] || PANDORA_AGENT_PACKAGE="http://firefly.artica.es/pandorafms/latest/Tarball/LTS/pandorafms_agent_linux-7.0NG.tar.gz" +elif [ "$PANDORA_LTS" -ne '1' ] ; then [ "$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_AGENT_PACKAGE" ] || PANDORA_AGENT_PACKAGE="http://firefly.artica.es/pandorafms/latest/Tarball/pandorafms_agent_unix-7.0NG.tar.gz" -elif [ "$PANDORA_BETA" -ne '0' ] ; then + [ "$PANDORA_AGENT_PACKAGE" ] || PANDORA_AGENT_PACKAGE="http://firefly.artica.es/pandorafms/latest/Tarball/pandorafms_agent_linux-7.0NG.tar.gz" +fi + +if [ "$PANDORA_BETA" -eq '1' ] ; then [ "$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_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 # Downloading Pandora Packages @@ -432,7 +455,7 @@ cd $WORKDIR &>> "$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_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 echo -en "${cyan}Installing PandoraFMS Console...${reset}" @@ -449,7 +472,7 @@ check_cmd_status "Error installing PandoraFMS Server" #Install agent: 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}" - 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" # Copy gotty utility diff --git a/extras/fedora_official_specs/pandorafms-agent.spec b/extras/fedora_official_specs/pandorafms-agent.spec index 8819a76cf4..2603777a1e 100644 --- a/extras/fedora_official_specs/pandorafms-agent.spec +++ b/extras/fedora_official_specs/pandorafms-agent.spec @@ -4,9 +4,9 @@ Release: 140223.sp3%{?dist} Summary: Host/service/network agent for Pandora FMS monitoring system License: GPLv2 Vendor: Artica -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 -#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 Group: Applications/System #Prefix: /usr/share diff --git a/pandora_agents/pc/AIX/pandora_agent.conf b/pandora_agents/pc/AIX/pandora_agent.conf index 00a1617190..c8512ffc13 100644 --- a/pandora_agents/pc/AIX/pandora_agent.conf +++ b/pandora_agents/pc/AIX/pandora_agent.conf @@ -1,5 +1,5 @@ # Base config file for Pandora FMS agents -# Version 7.0NG.767, AIX version +# Version 7.0NG.768, AIX version # Licensed under GPL license v2, # Copyright (c) 2003-2021 Artica Soluciones Tecnologicas # http://www.pandorafms.com diff --git a/pandora_agents/pc/DEBIAN/make_deb_package.sh b/pandora_agents/pc/DEBIAN/make_deb_package.sh index 483afe1b2e..1496975d21 100644 --- a/pandora_agents/pc/DEBIAN/make_deb_package.sh +++ b/pandora_agents/pc/DEBIAN/make_deb_package.sh @@ -114,7 +114,7 @@ echo "END" echo "Make the package \"Pandorafms console\"." 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." rm -rf temp_package diff --git a/pandora_agents/pc/FreeBSD/pandora_agent.conf b/pandora_agents/pc/FreeBSD/pandora_agent.conf index 9e90282e7d..c98b6c4f48 100644 --- a/pandora_agents/pc/FreeBSD/pandora_agent.conf +++ b/pandora_agents/pc/FreeBSD/pandora_agent.conf @@ -1,5 +1,5 @@ # Base config file for Pandora FMS agents -# Version 7.0NG.767, FreeBSD Version +# Version 7.0NG.768, FreeBSD Version # Licensed under GPL license v2, # Copyright (c) 2003-2021 Artica Soluciones Tecnologicas # http://www.pandorafms.com @@ -207,6 +207,6 @@ module_end 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 diff --git a/pandora_agents/pc/HP-UX/pandora_agent.conf b/pandora_agents/pc/HP-UX/pandora_agent.conf index fd8b228e91..a17181b6c2 100644 --- a/pandora_agents/pc/HP-UX/pandora_agent.conf +++ b/pandora_agents/pc/HP-UX/pandora_agent.conf @@ -1,5 +1,5 @@ # 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, # Copyright (c) 2003-2021 Artica Soluciones Tecnologicas # http://www.pandorafms.com diff --git a/pandora_agents/pc/Linux/pandora_agent.conf b/pandora_agents/pc/Linux/pandora_agent.conf index 94491a8855..7eea50cdac 100644 --- a/pandora_agents/pc/Linux/pandora_agent.conf +++ b/pandora_agents/pc/Linux/pandora_agent.conf @@ -1,5 +1,5 @@ # Base config file for Pandora FMS agents -# Version 7.0NG.767, GNU/Linux +# Version 7.0NG.768, GNU/Linux # Licensed under GPL license v2, # Copyright (c) 2003-2021 Artica Soluciones Tecnologicas # 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_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 diff --git a/pandora_agents/pc/NT4/pandora_agent.conf b/pandora_agents/pc/NT4/pandora_agent.conf index 4de40aae53..ed7aae82b3 100644 --- a/pandora_agents/pc/NT4/pandora_agent.conf +++ b/pandora_agents/pc/NT4/pandora_agent.conf @@ -1,5 +1,5 @@ # Base config file for Pandora FMS agents -# Version 7.0NG.767, GNU/Linux +# Version 7.0NG.768, GNU/Linux # Licensed under GPL license v2, # Copyright (c) 2003-2021 Artica Soluciones Tecnologicas # http://www.pandorafms.com diff --git a/pandora_agents/pc/OpenWRT/INSTALL b/pandora_agents/pc/OpenWRT/INSTALL index 6975acdfbb..cae96b27cf 100644 --- a/pandora_agents/pc/OpenWRT/INSTALL +++ b/pandora_agents/pc/OpenWRT/INSTALL @@ -31,14 +31,14 @@ Install procedure 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. Step 2 - Install it cd /tmp - tar xvzf pandorafms_agent_unix-3.2.tar.gz + tar xvzf pandorafms_agent_linux-3.2.tar.gz cd unix ./pandora_agent --install diff --git a/pandora_agents/pc/SunOS/pandora_agent.conf b/pandora_agents/pc/SunOS/pandora_agent.conf index c23c8bdfff..8c189f05bf 100644 --- a/pandora_agents/pc/SunOS/pandora_agent.conf +++ b/pandora_agents/pc/SunOS/pandora_agent.conf @@ -1,5 +1,5 @@ # Base config file for Pandora FMS agents -# Version 7.0NG.767, Solaris Version +# Version 7.0NG.768, Solaris Version # Licensed under GPL license v2, # Copyright (c) 2003-2021 Artica Soluciones Tecnologicas # http://www.pandorafms.com diff --git a/pandora_agents/pc/Win32/pandora_agent.conf b/pandora_agents/pc/Win32/pandora_agent.conf index 35de6e4c44..46a569686d 100644 --- a/pandora_agents/pc/Win32/pandora_agent.conf +++ b/pandora_agents/pc/Win32/pandora_agent.conf @@ -1,6 +1,6 @@ # Base config file for Pandora FMS Windows Agent # (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 # 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 diff --git a/pandora_agents/pc/pandora_agent.redhat.spec b/pandora_agents/pc/pandora_agent.redhat.spec index b09d423d36..ae481e3403 100644 --- a/pandora_agents/pc/pandora_agent.redhat.spec +++ b/pandora_agents/pc/pandora_agent.redhat.spec @@ -1,7 +1,7 @@ # #Pandora FMS Linux Agent # -%define name pandorafms_agent_unix +%define name pandorafms_agent_linux %define version 4.0 %define release 1 diff --git a/pandora_agents/pc/pandora_agent.spec b/pandora_agents/pc/pandora_agent.spec index 1378fa26c1..1bfc289d52 100644 --- a/pandora_agents/pc/pandora_agent.spec +++ b/pandora_agents/pc/pandora_agent.spec @@ -1,7 +1,7 @@ # #Pandora FMS Linux Agent # -%define name pandorafms_agent_unix +%define name pandorafms_agent_linux %define version 4.0.1 %define release 1 diff --git a/pandora_agents/shellscript/aix/pandora_agent.conf b/pandora_agents/shellscript/aix/pandora_agent.conf index 8b5f3a9239..a723aa503b 100644 --- a/pandora_agents/shellscript/aix/pandora_agent.conf +++ b/pandora_agents/shellscript/aix/pandora_agent.conf @@ -1,6 +1,6 @@ # Fichero de configuracion base de agentes de Pandora # Base config file for Pandora agents -# Version 7.0NG.767, AIX version +# Version 7.0NG.768, AIX version # General Parameters # ================== diff --git a/pandora_agents/shellscript/bsd-ipso/pandora_agent.conf b/pandora_agents/shellscript/bsd-ipso/pandora_agent.conf index f60fb27d7f..e8dd39e1d2 100644 --- a/pandora_agents/shellscript/bsd-ipso/pandora_agent.conf +++ b/pandora_agents/shellscript/bsd-ipso/pandora_agent.conf @@ -1,6 +1,6 @@ # Fichero de configuracion base de agentes de Pandora # Base config file for Pandora agents -# Version 7.0NG.767 +# Version 7.0NG.768 # FreeBSD/IPSO version # Licenced under GPL licence, 2003-2007 Sancho Lerena diff --git a/pandora_agents/shellscript/hp-ux/pandora_agent.conf b/pandora_agents/shellscript/hp-ux/pandora_agent.conf index cdd0850668..6b4ea56e3d 100644 --- a/pandora_agents/shellscript/hp-ux/pandora_agent.conf +++ b/pandora_agents/shellscript/hp-ux/pandora_agent.conf @@ -1,6 +1,6 @@ # Fichero de configuracion base de agentes de Pandora # Base config file for Pandora agents -# Version 7.0NG.767, HPUX Version +# Version 7.0NG.768, HPUX Version # General Parameters # ================== diff --git a/pandora_agents/shellscript/linux/pandora_agent.conf b/pandora_agents/shellscript/linux/pandora_agent.conf index bc7dc2b2c0..5ca49a15e1 100644 --- a/pandora_agents/shellscript/linux/pandora_agent.conf +++ b/pandora_agents/shellscript/linux/pandora_agent.conf @@ -1,5 +1,5 @@ # Base config file for Pandora FMS agents -# Version 7.0NG.767 +# Version 7.0NG.768 # Licensed under GPL license v2, # (c) 2003-2021 Artica Soluciones Tecnologicas # please visit http://pandora.sourceforge.net @@ -164,5 +164,5 @@ module_end 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 diff --git a/pandora_agents/shellscript/mac_osx/pandora_agent.conf b/pandora_agents/shellscript/mac_osx/pandora_agent.conf index 7bf2d86d38..b26ec72942 100644 --- a/pandora_agents/shellscript/mac_osx/pandora_agent.conf +++ b/pandora_agents/shellscript/mac_osx/pandora_agent.conf @@ -1,5 +1,5 @@ # Base config file for Pandora FMS agents -# Version 7.0NG.767 +# Version 7.0NG.768 # Licensed under GPL license v2, # (c) 2003-2021 Artica Soluciones Tecnologicas # please visit http://pandora.sourceforge.net @@ -379,6 +379,6 @@ module_end #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 diff --git a/pandora_agents/shellscript/openWRT/pandora_agent.conf b/pandora_agents/shellscript/openWRT/pandora_agent.conf index 40ee8e92a3..b9b09e0f02 100644 --- a/pandora_agents/shellscript/openWRT/pandora_agent.conf +++ b/pandora_agents/shellscript/openWRT/pandora_agent.conf @@ -1,5 +1,5 @@ # Base config file for Pandora FMS agents -# Version 7.0NG.767 +# Version 7.0NG.768 # Licensed under GPL license v2, # please visit http://pandora.sourceforge.net diff --git a/pandora_agents/shellscript/solaris/pandora_agent.conf b/pandora_agents/shellscript/solaris/pandora_agent.conf index 37b30848ab..20036302b7 100644 --- a/pandora_agents/shellscript/solaris/pandora_agent.conf +++ b/pandora_agents/shellscript/solaris/pandora_agent.conf @@ -1,6 +1,6 @@ # Fichero de configuracion base de agentes de Pandora # Base config file for Pandora agents -# Version 7.0NG.767, Solaris version +# Version 7.0NG.768, Solaris version # General Parameters # ================== diff --git a/pandora_agents/unix/AIX/pandora_agent.conf b/pandora_agents/unix/AIX/pandora_agent.conf index f0295fd471..e2050f1a5c 100644 --- a/pandora_agents/unix/AIX/pandora_agent.conf +++ b/pandora_agents/unix/AIX/pandora_agent.conf @@ -1,5 +1,5 @@ # Base config file for Pandora FMS agents -# Version 7.0NG.767, AIX version +# Version 7.0NG.768, AIX version # Licensed under GPL license v2, # Copyright (c) 2003-2021 Artica Soluciones Tecnologicas # http://www.pandorafms.com diff --git a/pandora_agents/unix/DEBIAN/control b/pandora_agents/unix/DEBIAN/control index 2ecaee147a..4b4a52511b 100644 --- a/pandora_agents/unix/DEBIAN/control +++ b/pandora_agents/unix/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-agent-unix -Version: 7.0NG.767-230110 +Version: 7.0NG.768-230131 Architecture: all Priority: optional Section: admin diff --git a/pandora_agents/unix/DEBIAN/make_deb_package.sh b/pandora_agents/unix/DEBIAN/make_deb_package.sh index 0fd96fba5c..9254a5d6f4 100644 --- a/pandora_agents/unix/DEBIAN/make_deb_package.sh +++ b/pandora_agents/unix/DEBIAN/make_deb_package.sh @@ -14,7 +14,7 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -pandora_version="7.0NG.767-230110" +pandora_version="7.0NG.768-230131" echo "Test if you has the tools for to make the packages." 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/ #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 #if [ \( $item != 'temp_package' \) -a \( $item != 'NT4' \) ] #then @@ -137,7 +137,7 @@ if [ "$USE_DOCKER_APP" == "1" ]; then else dpkg-deb --root-owner-group --build temp_package 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." rm -rf temp_package diff --git a/pandora_agents/unix/Darwin/dmg/build_darwin_dmg.sh b/pandora_agents/unix/Darwin/dmg/build_darwin_dmg.sh index 93a271b109..fd449c646b 100644 --- a/pandora_agents/unix/Darwin/dmg/build_darwin_dmg.sh +++ b/pandora_agents/unix/Darwin/dmg/build_darwin_dmg.sh @@ -31,7 +31,7 @@ fi if [ "$#" -ge 2 ]; then VERSION="$2" else - VERSION="7.0NG.767" + VERSION="7.0NG.768" fi # Path for the generated DMG file diff --git a/pandora_agents/unix/Darwin/dmg/extras/distribution.xml b/pandora_agents/unix/Darwin/dmg/extras/distribution.xml index 29d73048dd..4e4b347f08 100644 --- a/pandora_agents/unix/Darwin/dmg/extras/distribution.xml +++ b/pandora_agents/unix/Darwin/dmg/extras/distribution.xml @@ -19,11 +19,11 @@ - pandorafms_src.pdk + pandorafms_src.pdk - pandorafms_uninstall.pdk + pandorafms_uninstall.pdk '.io_safe_output($agent_name)."\n"; + $out_csv .= __('Timestamp').' = '.$row['timestamp']."\n"; + $out_csv .= io_safe_output($row['data_format'])."\n"; + + // Filter data by search string. + if ($inventory_search_string !== '') { + $str = io_safe_output($row['data']); + $matches = []; + $re = '/.*'.$inventory_search_string.'.*\n/m'; + if (preg_match_all($re, $str, $matches, PREG_SET_ORDER, 0)) { + // Print the entire match result. + foreach ($matches as $match) { + $out_csv .= $match[0]; + } + + $out_csv .= "\n\n"; + } + } else { + $out_csv .= io_safe_output($row['data'])."\n\n"; + } + } else { + $agent_name = db_get_value('alias', 'tagente', 'id_agente', $row['id_agente']); + $agent_inventory_temp = []; + $agent_inventory[$agent_name][] = [ + 'name' => $row['name'], + 'data_formtat' => $row['data_format'], + 'data' => $row['data'], + ]; + } + } + + if ($order_by_agent) { + if (empty($agent_inventory) === false) { + foreach ($agent_inventory as $alias => $agent_data) { + $out_csv .= __('Agent alias').' --> '.io_safe_output($alias)."\n"; + $out_csv .= __('Timestamp').' = '.$row['timestamp']."\n"; + + foreach ($agent_data as $data) { + $out_csv .= io_safe_output($data['name'])."\n"; + $out_csv .= io_safe_output($data['data_format'])."\n"; + + // Filter data by search string. + if ($inventory_search_string !== '') { + $str = io_safe_output($data['data']); + $matches = []; + $re = '/.*'.$inventory_search_string.'.*\n/m'; + if (preg_match_all($re, $str, $matches, PREG_SET_ORDER, 0)) { + // Print the entire match result. + foreach ($matches as $match) { + $out_csv .= $match[0]; + } + + $out_csv .= "\n\n"; + } + } else { + $out_csv .= io_safe_output($row['data'])."\n\n"; + } + } + } + } + } + } + + if ($export_csv) { + $name_file = 'inventory_'.md5( + $inventory_module_name.$utimestamp.$inventory_search_string + ).'.csv'; + file_put_contents( + $config['attachment_store'].'/'.$name_file, + $out_csv + ); + + echo "".__('Get CSV file').''; + return; + } else if ($return_mode === 'csv') { + return $out_csv; + } else if ($return_mode === 'hash') { + if ($utimestamp > 0) { + $timestamp = db_get_value_sql( + "SELECT timestamp + FROM tagente_datos_inventory + WHERE utimestamp = $utimestamp" + ); + } else { + $timestamp = db_get_value_sql( + 'SELECT timestamp + FROM tagente_datos_inventory + WHERE utimestamp = + (SELECT MAX(tagente_datos_inventory.utimestamp) + FROM tagente_datos_inventory, tmodule_inventory, + tagent_module_inventory + WHERE '.implode(' AND ', $where).' + AND tmodule_inventory.id_module_inventory = tagent_module_inventory.id_module_inventory + AND tagent_module_inventory.id_agent_module_inventory = tagente_datos_inventory.id_agent_module_inventory)' + ); + } + + $out_array = []; + foreach ($rows as $k => $row) { + $out_array[$k]['timestamp'] = $timestamp; + $out_array[$k]['id_module_inventory'] = $row['id_module_inventory']; + $out_array[$k]['id_os'] = $row['id_os']; + $out_array[$k]['name'] = io_safe_output($row['name']); + $out_array[$k]['description'] = io_safe_output($row['description']); + $out_array[$k]['interpreter'] = $row['interpreter']; + $out_array[$k]['id_agent_module_inventory'] = $row['id_agent_module_inventory']; + $out_array[$k]['id_agente'] = $row['id_agente']; + $agent_name = db_get_value('alias', 'tagente', 'id_agente', $row['id_agente']); + $out_array[$k]['agent_name'] = $agent_name; + $out_array[$k]['target'] = $row['target']; + $out_array[$k]['interval'] = $row['interval']; + $out_array[$k]['username'] = $row['username']; + + $items = explode(';', io_safe_output($row['data_format'])); + + $data = []; + if (empty($row['data']) === false) { + $data_rows = explode("\n", io_safe_output($row['data'])); + $data = []; + foreach ($data_rows as $data_row) { + $cells = explode(';', $data_row); + + $temp_row = []; + $i = 0; + foreach ($cells as $cell) { + $temp_row[$items[$i]] = $cell; + $i++; + } + + $data[] = $temp_row; + } + } + + $out_array[$k]['data'] = $data; + $out_array[$k]['timestamp'] = io_safe_output($row['timestamp']); + $out_array[$k]['flag'] = io_safe_output($row['flag']); + } + + return $out_array; + } else if ($return_mode === 'array') { + $out_array = []; + foreach ($rows as $k => $row) { + $out_array[$k]['id_module_inventory'] = $row['id_module_inventory']; + $out_array[$k]['id_os'] = $row['id_os']; + $out_array[$k]['name'] = io_safe_output($row['name']); + $out_array[$k]['description'] = io_safe_output($row['description']); + $out_array[$k]['interpreter'] = $row['interpreter']; + $out_array[$k]['data_format'] = $row['data_format']; + $out_array[$k]['id_agent_module_inventory'] = $row['id_agent_module_inventory']; + $out_array[$k]['id_agente'] = $row['id_agente']; + $out_array[$k]['target'] = $row['target']; + $out_array[$k]['interval'] = $row['interval']; + $out_array[$k]['username'] = $row['username']; + $out_array[$k]['data'] = ''; + $out_array[$k]['timestamp'] = io_safe_output($row['timestamp']); + $out_array[$k]['flag'] = io_safe_output($row['flag']); + } + + if (empty($out_array) === true) { + return __('No data found'); + } + + return $out_array; + } + + $idModuleInventory = null; + + $rowTable = 1; + + // Timestamp filter only allowed in nodes for performance. + if (is_metaconsole() === false) { + if ($utimestamp > 0) { + $timestamp = db_get_value_sql( + "SELECT timestamp + FROM tagente_datos_inventory + WHERE utimestamp = $utimestamp" + ); + } else { + $timestamp = db_get_value_sql( + 'SELECT timestamp + FROM tagente_datos_inventory + WHERE utimestamp = + (SELECT MAX(tagente_datos_inventory.utimestamp) + FROM tagente_datos_inventory, tmodule_inventory, + tagent_module_inventory + WHERE '.implode(' AND ', $where).' + AND tmodule_inventory.id_module_inventory = tagent_module_inventory.id_module_inventory + AND tagent_module_inventory.id_agent_module_inventory = tagente_datos_inventory.id_agent_module_inventory)' + ); + } + } + + // TODO: Workaround. + $timestamp = 'Last'; + if (!$order_by_agent) { + $countRows = 0; + foreach ($rows as $row) { + // Check for not show more elements that allowed in config. + if ($countRows >= (int) $config['meta_num_elements']) { + break; + } + + $countRows++; + + // Continue. + if (is_metaconsole() === false && $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']; + } else { + // Continue to next row in case there is no data for that timestamp. + continue; + } + } + + if ($idModuleInventory != $row['id_module_inventory']) { + if (isset($table) === true) { + $out .= "
"; + $out .= html_print_table($table, true); + $out .= '
'; + unset($table); + $rowTable = 1; + } + + $table = new stdClass(); + $table->width = '100%'; + $table->align = []; + $table->cellpadding = 0; + $table->cellspacing = 0; + $table->class = 'info_table inventory_tables'; + $table->head = []; + $table->head[0] = ''.$row['name'].' '.html_print_image('images/timestamp.png', true, ['title' => __('Timestamp'), 'style' => 'vertical-align:middle']).' ('.$timestamp.')'; + $table->headstyle[0] = 'text-align:center'; + + $subHeadTitles = explode(';', io_safe_output($row['data_format'])); + + $table->head_colspan = []; + $table->head_colspan[0] = (2 + count($subHeadTitles)); + $total_fields = count($subHeadTitles); + $table->rowspan = []; + + $table->data = []; + + $iterator = 1; + + $table->data[0][0] = __('Agent'); + foreach ($subHeadTitles as $titleData) { + $table->data[0][$iterator] = $titleData; + $iterator++; + } + + $table->data[0][] = __('Timestamp'); + $iterator++; + } + + // Setting for link the agent with the proper server. + if (is_metaconsole() === true && empty($node) === false) { + $loginHash = metaconsole_get_servers_url_hash($node); + $urlToAgent = sprintf( + '%sindex.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=%s%s', + $node['server_url'], + $row['id_agente'], + $loginHash + ); + } else { + $urlToAgent = sprintf( + 'index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=%s', + $row['id_agente'] + ); + } + + $agent_name = db_get_value_sql( + 'SELECT alias + FROM tagente + WHERE id_agente = '.$row['id_agente'] + ); + + $table->data[$rowTable][0] = html_print_anchor( + [ + 'href' => $urlToAgent, + 'content' => ''.$agent_name.'', + ], + true + ); + + $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) { + if ($rowPair === true) { + $table->rowclass[$iterator] = 'rowPair'; + } else { + $table->rowclass[$iterator] = 'rowOdd'; + } + + $rowPair = !$rowPair; + $iterator++; + + // Because SQL query extract all rows (row1;row2;row3...) and only I want the row has + // the search string. + if ($inventory_search_string && preg_match('/'.io_safe_output($inventory_search_string).'/', ($dataRowInventory)) == 0) { + continue; + } + + if ($rowTable > $numRowHasNameAgent) { + $table->data[$rowTable][0] = ''; + } + + $arrayDataColumnInventory = explode(SEPARATOR_COLUMN, $dataRowInventory); + // SPLIT ROW IN COLUMNS. + $iterator2 = 1; + + foreach ($arrayDataColumnInventory as $dataColumnInventory) { + $table->data[$rowTable][$iterator2] = $dataColumnInventory; + $iterator2++; + } + + // Fill unfilled cells with empty string. + $countArray = count($arrayDataColumnInventory); + for ($i = 0; $i < ($total_fields - $countArray); $i++) { + $table->data[$rowTable][$iterator2] = ''; + $iterator2++; + } + + $table->data[$rowTable][$iterator2] = $row['timestamp']; + + $iterator1++; + + $rowTable++; + if ($rowPair === true) { + $table->rowclass[$rowTable] = 'rowPair'; + } else { + $table->rowclass[$rowTable] = 'rowOdd'; + } + } + + if ($rowPair === true) { + $table->rowclass[$iterator] = 'rowPair'; + } else { + $table->rowclass[$iterator] = 'rowOdd'; + } + + $rowPair = !$rowPair; + if ($rowPair) { + $table->rowclass[($iterator + 1)] = 'rowPair'; + } else { + $table->rowclass[($iterator + 1)] = 'rowOdd'; + } + + if ($iterator1 > 5) { + // PRINT COUNT TOTAL. + $table->data[$rowTable][0] = ''; + $table->data[$rowTable][1] = ''.__('Total').': '.$iterator1; + $countSubHeadTitles = count($subHeadTitles); + for ($row_i = 2; $row_i <= $countSubHeadTitles; $row_i++) { + $table->data[$rowTable][$row_i] = ''; + } + + $rowTable++; + } + + $idModuleInventory = $row['id_module_inventory']; + } + } else { + $agent_data = []; + foreach ($rows as $row) { + $agent_data[$row['id_agente']][] = $row; + } + + foreach ($agent_data as $id_agent => $rows) { + $agent_name = db_get_value_sql( + 'SELECT alias + FROM tagente + WHERE id_agente = '.$id_agent + ); + + $out .= '
'; + $out .= '
'.$agent_name.'
'; + $out .= '
'; + + 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']; + } else { + continue; + } + } + + $table = new stdClass(); + $table->colspan = []; + if ($idModuleInventory != $row['id_module_inventory']) { + $table->width = '98%'; + $table->align = []; + $table->styleTable = 'margin:0 auto; text-align:left;'; + $table->cellpadding = 0; + $table->cellspacing = 0; + $table->class = 'databox data'; + $table->head = []; + $table->head[0] = $row['name'].' - ('.$timestamp.')'; + $table->headstyle[0] = 'text-align:center'; + + $subHeadTitles = explode(';', io_safe_output($row['data_format'])); + + $table->head_colspan = []; + $table->head_colspan[0] = (2 + count($subHeadTitles)); + $total_fields = count($subHeadTitles); + $table->rowspan = []; + + $table->data = []; + + $iterator = 0; + + foreach ($subHeadTitles as $titleData) { + $table->data[0][$iterator] = $titleData; + $iterator++; + } + + $table->data[0][] = __('Timestamp'); + $iterator++; + } + + $rowTable = 1; + + $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; + $rowPair = true; + + foreach ($arrayDataRowsInventory as $dataRowInventory) { + if ($rowPair === true) { + $table->rowclass[$iterator] = 'rowPair'; + } else { + $table->rowclass[$iterator] = 'rowOdd'; + } + + $rowPair = !$rowPair; + $iterator++; + + // Because SQL query extract all rows (row1;row2;row3...) and only I want the row has + // the search string. + if ($inventory_search_string && preg_match('/'.io_safe_output($inventory_search_string).'/', ($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++; + } + + // Fill unfilled cells with empty string. + $countArrayDataColumnInventory = count($arrayDataColumnInventory); + for ($i = 0; $i < ($total_fields - $countArrayDataColumnInventory); $i++) { + $table->data[$rowTable][$iterator2] = ''; + $iterator2++; + } + + $table->data[$rowTable][$iterator2] = $row['timestamp']; + + $iterator1++; + + $rowTable++; + if ($rowPair === true) { + $table->rowclass[$rowTable] = 'rowPair'; + } else { + $table->rowclass[$rowTable] = 'rowOdd'; + } + } + + if ($iterator1 > 5) { + // PRINT COUNT TOTAL. + $table->data[$rowTable][0] = ''; + $table->data[$rowTable][1] = ''.__('Total').': '.$iterator1; + $countSubHeadTitles = count($subHeadTitles); + for ($row_i = 2; $row_i <= $countSubHeadTitles; $row_i++) { + $table->data[$rowTable][$row_i] = ''; + } + + $rowTable++; + } + + $idModuleInventory = $row['id_module_inventory']; + + if (isset($table) === true) { + $out .= html_print_table($table, true); + } + + $out .= '
'; + } + + $out .= '
'; + $out .= '
'; + $out .= '
'; + $out .= '
'; + } + + return $out; + } + + if (isset($table) === true) { + $out .= html_print_table($table, true); + $out .= ui_pagination($count, $url, $offset, 0, true); + } + + return $out; +} + + +function inventory_get_dates($module_inventory_name, $inventory_agent, $inventory_id_group) +{ + $sql = 'SELECT tagente_datos_inventory.utimestamp, + tagente_datos_inventory.timestamp + FROM tmodule_inventory, tagent_module_inventory, + tagente_datos_inventory, tagente + 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 tagente.id_agente = tagent_module_inventory.id_agente'; + + if ($inventory_agent != 0) { + $sql .= ' AND tagent_module_inventory.id_agente IN ('."'".implode(',', (array) $inventory_agent)."'".')'; + } + + if ($inventory_id_group != 0) { + $sql .= " AND tagente.id_grupo = $inventory_id_group"; + } + + if (is_string($module_inventory_name) === true + && $module_inventory_name != 'all' + ) { + $sql .= " AND tmodule_inventory.name IN ('".str_replace(',', "','", $module_inventory_name)."')"; + } + + $sql .= ' ORDER BY tagente_datos_inventory.utimestamp DESC'; + + $dates_raw = db_get_all_rows_sql($sql); + + if ($dates_raw == false) { + return []; + } + + $dates = []; + foreach ($dates_raw as $date) { + $dates[$date['utimestamp']] = $date['timestamp']; + } + + return $dates; +} + + +function inventory_get_agents($filter=false, $fields=false) +{ + $inventory_agents_id = db_get_all_rows_sql( + 'SELECT DISTINCT(id_agente) + FROM tagent_module_inventory' + ); + + if ($inventory_agents_id == false) { + $inventory_agents_id = []; + return []; + } + + $ids = []; + foreach ($inventory_agents_id as $ia) { + $ids[] = $ia['id_agente']; + } + + $filter['id_agente'] = $ids; + + $agents = agents_get_agents($filter, $fields); + + if ($agents === false) { + $agents = []; + } + + return $agents; +} + + +function inventory_get_changes( + $id_agent, + $module_names, + $start_utimestamp, + $end_utimestamp, + $return_mode=false +) { + global $config; + + $any_inventory_modules = false; + if (empty($module_names)) { + $any_inventory_modules = true; + } else if (((string) ($module_names[0])) === '0') { + $any_inventory_modules = true; + } + + $module_names = (array) $module_names; + + if ($id_agent[0] == -1) { + // Any agent + $sql = sprintf( + "SELECT evento, utimestamp + FROM tevento + WHERE utimestamp >= %d + AND utimestamp <= %d + AND event_type = 'configuration_change'", + $start_utimestamp, + $end_utimestamp + ); + } else { + $sql = sprintf( + "SELECT evento, utimestamp + FROM tevento + WHERE id_agente IN (%s) + AND utimestamp >= %d + AND utimestamp <= %d + AND event_type = 'configuration_change'", + implode(',', (array) $id_agent), + $start_utimestamp, + $end_utimestamp + ); + } + + $events = db_get_all_rows_sql($sql); + + if ($events === false) { + return ERR_NODATA; + } + + $inventory_changes = []; + $are_data = false; + + foreach ($events as $k => $event) { + $changes = io_safe_output($event['evento']); + $changes = explode("\n", $changes); + + $check = preg_match( + '/agent \'(.*)\' module \'(.*)\'/', + end($changes), + $matches + ); + + $agent_name = $matches[1]; + $module_name = $matches[2]; + + if (!$any_inventory_modules) { + if (!in_array($module_name, $module_names)) { + continue; + } + } + + $are_data = true; + + $inventory_changes[$k]['agent_name'] = $matches[1]; + $inventory_changes[$k]['module_name'] = $module_name; + $inventory_changes[$k]['utimestamp'] = $event['utimestamp']; + $changes[0] = str_replace('Configuration changes (', '', $changes[0]); + + unset($changes[(count($changes) - 1)]); + $state = ''; + foreach ($changes as $ch) { + if (preg_match('/NEW RECORD: (.*)/', $ch)) { + $ch = preg_replace('/NEW RECORD: /', '', $ch); + $ch = preg_replace('/^\'/', '', $ch); + $ch = '
'.$ch.'
'; + $state = 'new'; + } + + if (preg_match('/\s*DELETED RECORD: (.*)/', $ch)) { + $ch = preg_replace('/\s*DELETED RECORD/', '', $ch); + $ch = preg_replace('/^\'/', '', $ch); + $ch = '
'.$ch.'
'; + $state = 'deleted'; + } + + $inventory_changes[$k][$state][] = $ch; + } + } + + if ($are_data === false) { + if ($return_mode !== false) { + switch ($return_mode) { + case 'array': + return ERR_NODATA; + + break; + default: + return __('No changes found'); + break; + } + } + + return ERR_NODATA; + } + + switch ($return_mode) { + case 'csv': + $out_csv = ''; + foreach ($inventory_changes as $ic) { + $out_csv .= __('Agent').SEPARATOR_COLUMN_CSV.$ic['agent_name']."\n"; + $out_csv .= __('Module').SEPARATOR_COLUMN_CSV.$ic['module_name']."\n"; + $out_csv .= __('Date').SEPARATOR_COLUMN_CSV.date($config['date_format'], $ic['utimestamp'])."\n"; + if (isset($ic['new'])) { + foreach ($ic['new'] as $icc) { + $out_csv .= __('Added').SEPARATOR_COLUMN_CSV.$icc."\n"; + } + } + + if (isset($ic['deleted'])) { + foreach ($ic['deleted'] as $icc) { + $out_csv .= __('Deleted').SEPARATOR_COLUMN_CSV.$icc."\n"; + } + } + } + return $out_csv; + + break; + case 'array': + $out_array = []; + + foreach ($inventory_changes as $k => $ic) { + $out_array[$k]['agent'] = $ic['agent_name']; + $out_array[$k]['module'] = $ic['module_name']; + $out_array[$k]['date'] = date($config['date_format'], $ic['utimestamp']); + + if (isset($ic['new'])) { + foreach ($ic['new'] as $icc) { + $out_array[$k]['added'][] = $icc; + } + } + + if (isset($ic['deleted'])) { + foreach ($ic['deleted'] as $icc) { + $out_array[$k]['deleted'][] = $icc; + } + } + } + + if (empty($out_array)) { + return ERR_NODATA; + } + return $out_array; + + break; + } + + $out = ''; + foreach ($inventory_changes as $ic) { + $out .= ''; + } + + $out .= '
'; + + unset($table); + $table->width = '98%'; + $table->style[0] = 'text-align:50%'; + $table->style[1] = 'text-align:50%'; + + $table->data[0][0] = ''.__('Agent').': '.$ic['agent_name']; + $table->data[0][1] = ''.__('Module').': '.$ic['module_name']; + + $timestamp = date($config['date_format'], $ic['utimestamp']); + + $table->colspan[1][0] = 2; + $table->data[1][0] = '
('.$timestamp.')
'; + $row = 2; + + if (isset($ic['new'])) { + foreach ($ic['new'] as $icc) { + $table->colspan[$row][0] = 2; + $table->data[$row][0] = ''.__('Added').': '.$icc; + $row++; + } + } + + if (isset($ic['deleted'])) { + foreach ($ic['deleted'] as $icc) { + $table->colspan[$row][0] = 2; + $table->data[$row][0] = ''.__('Deleted').': '.$icc; + $row++; + } + } + + $out .= html_print_table($table, true); + + $out .= '
'; + + return $out; +} + + +/** + * Get a list with inventory modules + * + * @param mixed An integer can be place here to get a response + * to paginate. If this parameter is false, return full list + * + * @return array with inventory modules (paginated or not) + */ +function inventory_get_modules_list($offset=false) +{ + global $config; + + $filter = []; + if (is_numeric($offset)) { + $filter['limit'] = $config['block_size']; + $filter['offset'] = $offset; + } + + return db_get_all_rows_filter( + 'tmodule_inventory LEFT JOIN tconfig_os + ON tmodule_inventory.id_os = tconfig_os.id_os', + $filter, + [ + 'tmodule_inventory.id_module_inventory', + 'tmodule_inventory.name', + 'tmodule_inventory.description', + 'tmodule_inventory.interpreter', + 'tconfig_os.name AS os_name', + 'tconfig_os.id_os', + ] + ); +} + + +/** + * Validate the modules inventory + * + * @param array with inventory modules data. + * + * @return boolean True if the values are valid + */ +function inventory_validate_inventory_module($values) +{ + return !(empty($values['name']) || empty($values['id_os']) || + empty($values['data_format']) + ); +} + + +/** + * Insert the module inventory data into database + * + * @param array with inventory modules data. + * + * @return boolean False if values are invalid or cannot put it on database + */ +function inventory_create_inventory_module($values) +{ + if (!inventory_validate_inventory_module($values)) { + return false; + } + + return db_process_sql_insert('tmodule_inventory', $values); +} + + +/** + * Update the module inventory data into database + * + * @param int ID inventory module + * @param array with inventory modules data. + * + * @return boolean False if values are invalid or cannot put it on database + */ +function inventory_update_inventory_module($id_module_inventory, $values) +{ + if (!inventory_validate_inventory_module($values)) { + return false; + } + + return db_process_sql_update( + 'tmodule_inventory', + $values, + ['id_module_inventory' => $id_module_inventory] + ); +} + + +/** + * Returns inventory module names given agent id. + * + * @param integer $id_agent + * @param string $all + * @param integer $server_id + * @param string $server_name + * @return void + */ +function inventory_get_agent_modules($id_agent, $all='all', $server_id=0, $server_name=null) +{ + global $config; + + if ($config['metaconsole']) { + $server_id = metaconsole_get_id_server($server_name); + } + + switch ($all) { + default: + case 'all': + $enabled = '1 = 1'; + break; + case 'enabled': + $enabled = 'disabled = 0'; + break; + } + + if (is_array($id_agent)) { + $count_id_agent = count(($id_agent)); + $id_agent = implode(',', $id_agent); + } else { + $count_id_agent = 1; + } + + $sql = 'SELECT t1.id_module_inventory, name + FROM tmodule_inventory t1, tagent_module_inventory t2 + WHERE t1.id_module_inventory = t2.id_module_inventory + AND id_agente IN ('.$id_agent.') AND ( + SELECT count(name) + FROM tmodule_inventory t3, tagent_module_inventory t4 + WHERE t3.id_module_inventory = t4.id_module_inventory + AND t3.name = t1.name + AND t4.id_agente IN ('.$id_agent.')) = ('.$count_id_agent.') + ORDER BY name'; + + // Only in template editor from metaconsole. + if ($config['metaconsole']) { + $server_data = metaconsole_get_connection_by_id($server_id); + + if ($server_data === false) { + return ''; + } + + $modules = []; + + // Establishes connection. + if (metaconsole_load_external_db($server_data) !== NOERR) { + return ''; + } + + $modules = db_get_all_rows_sql($sql); + + if ($modules == false) { + $modules = []; + } + + $result = []; + foreach ($modules as $module) { + $result[$module['name']] = io_safe_output($module['name']); + } + + // Restore DB connection. + metaconsole_restore_db(); + } else { + $modules = db_get_all_rows_sql($sql); + + if ($modules == false) { + $modules = []; + } + + $result = []; + foreach ($modules as $module) { + $result[$module['name']] = io_safe_output($module['name']); + } + } + + return $result; +} diff --git a/pandora_console/include/functions_menu.php b/pandora_console/include/functions_menu.php index a126cf5d03..277eb8520c 100644 --- a/pandora_console/include/functions_menu.php +++ b/pandora_console/include/functions_menu.php @@ -487,7 +487,7 @@ function menu_add_extras(&$menu) $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']['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'); @@ -508,6 +508,14 @@ function menu_add_extras(&$menu) $menu_extra['reporting']['sub']['enterprise/godmode/reporting/graph_template_wizard']['text'] = __('Graph template wizard'); $menu_extra['reporting']['sub']['godmode/reporting/reporting_builder&tab=wizard&action=wizard']['text'] = __('Templates wizard'); $menu_extra['reporting']['sub']['godmode/reporting/reporting_builder&tab=template&action=list_template']['text'] = __('Templates'); + $menu_extra['reporting']['sub']['godmode/reporting/reporting_builder&action=edit']['text'] = __('Edit custom reports'); + $menu_extra['reporting']['sub']['godmode/reporting/reporting_builder&tab=list_items&action=edit']['text'] = __('List items'); + $menu_extra['reporting']['sub']['godmode/reporting/reporting_builder&tab=item_editor&action=new']['text'] = __('Edit item'); + $menu_extra['reporting']['sub']['godmode/reporting/reporting_builder&tab=wizard&action=edit']['text'] = __('Wizard'); + $menu_extra['reporting']['sub']['godmode/reporting/reporting_builder&tab=wizard_sla&action=edit']['text'] = __('Wizard sla'); + $menu_extra['reporting']['sub']['godmode/reporting/reporting_builder&tab=global&action=edit']['text'] = __('Global custom reports'); + $menu_extra['reporting']['sub']['godmode/reporting/reporting_builder&tab=advanced&action=edit']['text'] = __('Avanced options'); + if ($config['activate_gis']) { $menu_extra['godgismaps']['sub']['godmode/gis_maps/configure_gis_map']['text'] = __('Manage GIS Maps'); } @@ -811,6 +819,27 @@ if (is_ajax()) { ); } + $image_about = ui_get_full_url('/images/custom_logo/logo-default-pandorafms.png', false, false, false); + if (enterprise_installed() === false) { + if ($config['style'] === 'pandora_black') { + $image_about = 'images/custom_logo/'.HEADER_LOGO_BLACK_CLASSIC; + } else if ($config['style'] === 'pandora') { + $image_about = 'images/custom_logo/'.HEADER_LOGO_DEFAULT_CLASSIC; + } + } else { + if ($config['style'] === 'pandora_black' && $config['custom_logo'] === HEADER_LOGO_DEFAULT_CLASSIC) { + $config['custom_logo'] = HEADER_LOGO_BLACK_CLASSIC; + } else if ($config['style'] === 'pandora' && $config['custom_logo'] === HEADER_LOGO_BLACK_CLASSIC) { + $config['custom_logo'] = HEADER_LOGO_DEFAULT_CLASSIC; + } + + $image_about = 'images/custom_logo/'.$config['custom_logo']; + + if (file_exists(ENTERPRISE_DIR.'/'.$image_about) === true) { + $image_about = ENTERPRISE_DIR.'/'.$image_about; + } + } + $dialog = ' '; @@ -1691,7 +1701,3 @@ require 'include/php_to_js_values.php'; ); }); - + + + '; + + echo ''; + echo '

Installation in

'; + + echo ''; + + echo ''; + } + + echo " + +

DB User with privileges

+ + + +

DB Password for this user

+ + + + + +

DB Hostname

+ + + +

DB Name (pandora by default)

+ + + "; + + // the field dbgrant is only shown when the DB host is different from 127.0.0.1 or localhost + echo " + +

DB Host Access

+ + + "; + + echo " + +

Full path to HTTP publication directory

+

For example /var/www/pandora_console/

+ + + "; + echo " + + +

URL path to Pandora FMS Console

+

For example '/pandora_console'

+ + + "; + + echo " + + +

Drop Database if exists

+ + "; + + echo ''; + + echo ''; + + echo ''; + echo ''; + echo "
+