Merge remote-tracking branch 'origin/develop' into ent-9713-boton-para-mostrar-ruta-real-en-ventana-modal-en-filemanager

This commit is contained in:
sergio 2023-02-13 12:47:27 +01:00
commit 6654327a1c
912 changed files with 183248 additions and 81168 deletions

View File

@ -24,7 +24,7 @@ cd $CODEHOME && tar zcvf $RPMHOME/SOURCES/pandorafms_server-$LOCAL_VERSION.tar.g
cd $CODEHOME/pandora_agents/shellscript && tar zcvf $RPMHOME/SOURCES/pandorafms_agent-$LOCAL_VERSION.tar.gz --exclude \.exe --exclude \.svn --exclude nohup linux || exit 1
# 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

View File

@ -0,0 +1,320 @@
#!/bin/bash
#######################################################
# PandoraFMS Community online installation script
#######################################################
## Tested versions ##
# Centos 8.4, 8.5
# Rocky 8.4, 8.5, 8.6, 8.7
# Almalinuz 8.4, 8.5
# RedHat 8.5
#Constants
S_VERSION='202302081'
LOGFILE="/tmp/deploy-ext-db-$(date +%F).log"
# define default variables
[ "$TZ" ] || TZ="Europe/Madrid"
[ "$MYVER" ] || MYVER=57
[ "$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_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")
# Ansi color code variables
red="\e[0;91m"
green="\e[0;92m"
cyan="\e[0;36m"
reset="\e[0m"
# Functions
execute_cmd () {
local cmd="$1"
local msg="$2"
echo -e "${cyan}$msg...${reset}"
$cmd &>> "$LOGFILE"
if [ $? -ne 0 ]; then
echo -e "${red}Fail${reset}"
[ "$3" ] && echo "$3"
echo "Error installing Pandora FMS for detailed error please check log: $LOGFILE"
rm -rf "$HOME"/pandora_deploy_tmp &>> "$LOGFILE"
exit 1
else
echo -e "\e[1A\e ${cyan}$msg...${reset} ${green}OK${reset}"
return 0
fi
}
check_cmd_status () {
if [ $? -ne 0 ]; then
echo -e "${red}Fail${reset}"
[ "$1" ] && echo "$1"
echo "Error installing Pandora FMS for detailed error please check log: $LOGFILE"
rm -rf "$HOME"/pandora_deploy_tmp/*.rpm* &>> "$LOGFILE"
exit 1
else
echo -e "${green}OK${reset}"
return 0
fi
}
check_root_permissions () {
echo -en "${cyan}Checking root account... ${reset}"
if [ "$(whoami)" != "root" ]; then
echo -e "${red}Fail${reset}"
echo "Please use a root account or sudo for installing Pandora FMS"
echo "Error installing Pandora FMS for detailed error please check log: $LOGFILE"
exit 1
else
echo -e "${green}OK${reset}"
fi
}
## Main
echo "Starting PandoraFMS External DB deployment EL8 ver. $S_VERSION"
# Centos Version
if [ ! "$(grep -Ei 'centos|rocky|Almalinux|Red Hat Enterprise' /etc/redhat-release)" ]; then
printf "\n ${red}Error this is not a Centos/Rocky/Almalinux Base system, this installer is compatible with RHEL/Almalinux/Centos/Rockylinux systems only${reset}\n"
exit 1
fi
echo -en "${cyan}Check Centos Version...${reset}"
[ $(sed -nr 's/VERSION_ID+=\s*"([0-9]).*"$/\1/p' /etc/os-release) -eq '8' ]
check_cmd_status 'Error OS version, RHEL/Almalinux/Centos/Rockylinux 8+ is expected'
#Detect OS
os_name=$(grep ^PRETTY_NAME= /etc/os-release | cut -d '=' -f2 | tr -d '"')
execute_cmd "echo $os_name" "OS detected: ${os_name}"
# initialice logfile
execute_cmd "echo 'Starting community deployment' > $LOGFILE" "All installer activity is logged on $LOGFILE"
echo "Community installer version: $S_VERSION" >> "$LOGFILE"
# Pre checks
# Root permisions
check_root_permissions
# Systemd
execute_cmd "systemctl status" "Checking SystemD" 'This is not a SystemD enable system, if tryng to use in a docker env please check: https://github.com/pandorafms/pandorafms/tree/develop/extras/docker/centos8'
# Check memomry greather or equal to 2G
execute_cmd "[ $(grep MemTotal /proc/meminfo | awk '{print $2}') -ge 1700000 ]" 'Checking memory (required: 2 GB)'
# Check disk size at least 10 Gb free space
execute_cmd "[ $(df -BM / | tail -1 | awk '{print $4}' | tr -d M) -gt 10000 ]" 'Checking Disk (required: 10 GB free min)'
# Setting timezone
rm -rf /etc/localtime &>> "$LOGFILE"
execute_cmd "timedatectl set-timezone $TZ" "Setting Timezone $TZ"
# Execute tools check
execute_cmd "awk --version" 'Checking needed tools: awk'
execute_cmd "grep --version" 'Checking needed tools: grep'
execute_cmd "sed --version" 'Checking needed tools: sed'
execute_cmd "dnf --version" 'Checking needed tools: dnf'
# Creating working directory
rm -rf "$HOME"/pandora_deploy_tmp/*.rpm* &>> "$LOGFILE"
mkdir "$HOME"/pandora_deploy_tmp &>> "$LOGFILE"
execute_cmd "cd $HOME/pandora_deploy_tmp" "Moving to workspace: $HOME/pandora_deploy_tmp"
## Extra steps on redhat envs
if [ "$(grep -Ei 'Red Hat Enterprise' /etc/redhat-release)" ]; then
## In case REDHAT
# Check susbscription manager status:
echo -en "${cyan}Checking Red Hat Enterprise subscription... ${reset}"
subscription-manager list &>> "$LOGFILE"
subscription-manager status &>> "$LOGFILE"
check_cmd_status 'Error checking subscription status, make sure your server is activated and suscribed to Red Hat Enterprise repositories'
# Ckeck repolist
dnf repolist &>> "$LOGFILE"
echo -en "${cyan}Checking Red Hat Enterprise repolist... ${reset}"
dnf repolist | grep 'rhel-8-for-x86_64-baseos-rpms' &>> "$LOGFILE"
check_cmd_status 'Error checking repositories status, could try a subscription-manager attach command or contact sysadmin'
#install extra repos
extra_repos=" \
tar \
dnf-utils \
https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm \
https://repo.percona.com/yum/percona-release-latest.noarch.rpm"
execute_cmd "dnf install -y $extra_repos" "Installing extra repositories"
execute_cmd "subscription-manager repos --enable codeready-builder-for-rhel-8-x86_64-rpms" "Enabling subscription to codeready-builder"
else
# For alma/rocky/centos
extra_repos=" \
tar \
dnf-utils \
epel-release \
https://repo.percona.com/yum/percona-release-latest.noarch.rpm"
execute_cmd "dnf install -y $extra_repos" "Installing extra repositories"
execute_cmd "dnf config-manager --set-enabled powertools" "Configuring Powertools"
fi
#Installing wget
execute_cmd "dnf install -y wget" "Installing wget"
# Install percona Database
execute_cmd "dnf module disable -y mysql" "Disabiling mysql module"
if [ "$MYVER" -eq '80' ] ; then
execute_cmd "percona-release setup ps80 -y" "Enabling mysql80 module"
execute_cmd "dnf install -y percona-server-server percona-xtrabackup-24" "Installing Percona Server 80"
fi
if [ "$MYVER" -ne '80' ] ; then
execute_cmd "dnf install -y Percona-Server-server-57 percona-xtrabackup-24" "Installing Percona Server 57"
fi
# Disabling SELINUX and firewalld
setenforce 0 &>> "$LOGFILE"
sed -i -e "s/^SELINUX=.*/SELINUX=disabled/g" /etc/selinux/config &>> "$LOGFILE"
systemctl disable firewalld --now &>> "$LOGFILE"
# Adding standar cnf for initial setup.
cat > /etc/my.cnf << EO_CONFIG_TMP
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
symbolic-links=0
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
EO_CONFIG_TMP
#Configuring Database
if [ "$SKIP_DATABASE_INSTALL" -eq '0' ] ; then
execute_cmd "systemctl start mysqld" "Starting database engine"
export MYSQL_PWD=$(grep "temporary password" /var/log/mysqld.log | rev | cut -d' ' -f1 | rev)
if [ "$MYVER" -eq '80' ] ; then
echo """
SET PASSWORD FOR '$DBROOTUSER'@'localhost' = 'Pandor4!';
UNINSTALL COMPONENT 'file://component_validate_password';
SET PASSWORD FOR '$DBROOTUSER'@'localhost' = '$DBROOTPASS';
""" | mysql --connect-expired-password -u$DBROOTUSER &>> "$LOGFILE"
fi
if [ "$MYVER" -ne '80' ] ; then
echo """
SET PASSWORD FOR '$DBROOTUSER'@'localhost' = PASSWORD('Pandor4!');
UNINSTALL PLUGIN validate_password;
SET PASSWORD FOR '$DBROOTUSER'@'localhost' = PASSWORD('$DBROOTPASS');
""" | mysql --connect-expired-password -u$DBROOTUSER &>> "$LOGFILE"fi
fi
export MYSQL_PWD=$DBROOTPASS
echo -en "${cyan}Creating Pandora FMS database...${reset}"
echo "create database $DBNAME" | mysql -u$DBROOTUSER -P$DBPORT -h$DBHOST
check_cmd_status "Error creating database $DBNAME, is this an empty node? if you have a previus installation please contact with support."
echo "CREATE USER \"$DBUSER\"@'%' IDENTIFIED BY \"$DBPASS\";" | mysql -u$DBROOTUSER -P$DBPORT -h$DBHOST
echo "ALTER USER \"$DBUSER\"@'%' IDENTIFIED WITH mysql_native_password BY \"$DBPASS\"" | mysql -u$DBROOTUSER -P$DBPORT -h$DBHOST
echo "GRANT ALL PRIVILEGES ON $DBNAME.* TO \"$DBUSER\"@'%'" | mysql -u$DBROOTUSER -P$DBPORT -h$DBHOST
#Generating my.cnf
cat > /etc/my.cnf << EO_CONFIG_F
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
character-set-server=utf8
skip-character-set-client-handshake
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
# Mysql optimizations for Pandora FMS
# Please check the documentation in http://pandorafms.com for better results
max_allowed_packet = 64M
innodb_buffer_pool_size = $POOL_SIZE
innodb_lock_wait_timeout = 90
innodb_file_per_table
innodb_flush_log_at_trx_commit = 0
innodb_flush_method = O_DIRECT
innodb_log_file_size = 64M
innodb_log_buffer_size = 16M
innodb_io_capacity = 100
thread_cache_size = 8
thread_stack = 256K
max_connections = 100
key_buffer_size=4M
read_buffer_size=128K
read_rnd_buffer_size=128K
sort_buffer_size=128K
join_buffer_size=4M
query_cache_type = 1
query_cache_size = 64M
query_cache_min_res_unit = 2k
query_cache_limit = 256K
#skip-log-bin
sql_mode=""
[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
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"
execute_cmd "systemctl enable mysqld --now" "Enabling Database service"
fi
export MYSQL_PWD=$DBPASS
# Kernel optimization
if [ "$SKIP_KERNEL_OPTIMIZATIONS" -eq '0' ] ; then
cat >> /etc/sysctl.conf <<EO_KO
# Pandora FMS Optimization
# default=5
net.ipv4.tcp_syn_retries = 3
# default=5
net.ipv4.tcp_synack_retries = 3
# default=1024
net.ipv4.tcp_max_syn_backlog = 65536
# default=124928
net.core.wmem_max = 8388608
# default=131071
net.core.rmem_max = 8388608
# default = 128
net.core.somaxconn = 1024
# default = 20480
net.core.optmem_max = 81920
EO_KO
[ -d /dev/lxd/ ] || execute_cmd "sysctl --system" "Applying Kernel optimization"
fi
execute_cmd "echo done" "Percona server installed"
cd
execute_cmd "rm -rf $HOME/pandora_deploy_tmp" "Removing temporary files"

View File

@ -0,0 +1,257 @@
#!/bin/bash
##############################################################################################################
# PandoraFMS Community online installation script for Ubuntu 22.04
##############################################################################################################
## Tested versions ##
# Ubuntu 22.04.1
#avoid promps
export DEBIAN_FRONTEND=noninteractive
export NEEDRESTART_SUSPEND=1
#Constants
PANDORA_CONSOLE=/var/www/html/pandora_console
PANDORA_SERVER_CONF=/etc/pandora/pandora_server.conf
PANDORA_AGENT_CONF=/etc/pandora/pandora_agent.conf
WORKDIR=/opt/pandora/deploy
S_VERSION='202302081'
LOGFILE="/tmp/deploy-ext-db-$(date +%F).log"
rm -f $LOGFILE &> /dev/null # remove last log before start
# define default variables
[ "$TZ" ] || TZ="Europe/Madrid"
[ "$DBHOST" ] || DBHOST=127.0.0.1
[ "$DBNAME" ] || DBNAME=pandora
[ "$DBUSER" ] || DBUSER=pandora
[ "$DBPASS" ] || DBPASS=pandora
[ "$DBPORT" ] || DBPORT=3306
[ "$DBROOTPASS" ] || DBROOTPASS=pandora
[ "$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")
# Ansi color code variables
red="\e[0;91m"
green="\e[0;92m"
cyan="\e[0;36m"
reset="\e[0m"
# Functions
execute_cmd () {
local cmd="$1"
local msg="$2"
echo -e "${cyan}$msg...${reset}"
$cmd &>> "$LOGFILE"
if [ $? -ne 0 ]; then
echo -e "${red}Fail${reset}"
[ "$3" ] && echo "$3"
echo "Error installing Pandora FMS for detailed error please check log: $LOGFILE"
rm -rf "$WORKDIR" &>> "$LOGFILE"
exit 1
else
echo -e "\e[1A\e ${cyan}$msg...${reset} ${green}OK${reset}"
return 0
fi
}
check_cmd_status () {
if [ $? -ne 0 ]; then
echo -e "${red}Fail${reset}"
[ "$1" ] && echo "$1"
echo "Error installing Pandora FMS for detailed error please check log: $LOGFILE"
rm -rf "$WORKDIR" &>> "$LOGFILE"
exit 1
else
echo -e "${green}OK${reset}"
return 0
fi
}
check_root_permissions () {
echo -en "${cyan}Checking root account... ${reset}"
if [ "$(whoami)" != "root" ]; then
echo -e "${red}Fail${reset}"
echo "Please use a root account or sudo for installing Pandora FMS"
echo "Error installing Pandora FMS for detailed error please check log: $LOGFILE"
exit 1
else
echo -e "${green}OK${reset}"
fi
}
## Main
echo "Starting PandoraFMS External DB deployment Ubuntu 22.04 ver. $S_VERSION"
# Ubuntu Version
if [ ! "$(grep -Ei 'Ubuntu' /etc/lsb-release)" ]; then
printf "\n ${red}Error this is not a Ubuntu system, this installer is compatible with Ubuntu systems only${reset}\n"
exit 1
fi
echo -en "${cyan}Check Ubuntu Version...${reset}"
[ $(sed -nr 's/VERSION_ID+=\s*"([0-9][0-9].[0-9][0-9])"$/\1/p' /etc/os-release) == "22.04" ]
check_cmd_status 'Error OS version, Ubuntu 22.04 is expected'
#Detect OS
os_name=$(grep ^PRETTY_NAME= /etc/os-release | cut -d '=' -f2 | tr -d '"')
execute_cmd "echo $os_name" "OS detected: ${os_name}"
# initialice logfile
execute_cmd "echo 'Starting community deployment' > $LOGFILE" "All installer activity is logged on $LOGFILE"
echo "Community installer version: $S_VERSION" >> "$LOGFILE"
# Pre checks
# Root permisions
check_root_permissions
#Install awk, sed, grep if not present
execute_cmd "apt install -y gawk sed grep" 'Installing needed tools'
# Systemd
execute_cmd "systemctl --version" "Checking SystemD" 'This is not a SystemD enable system, if tryng to use in a docker env please check: https://github.com/pandorafms/pandorafms/tree/develop/extras/docker/centos8'
# Check memomry greather or equal to 2G
execute_cmd "[ $(grep MemTotal /proc/meminfo | awk '{print $2}') -ge 1700000 ]" 'Checking memory (required: 2 GB)'
# Check disk size at least 10 Gb free space
execute_cmd "[ $(df -BM / | tail -1 | awk '{print $4}' | tr -d M) -gt 10000 ]" 'Checking Disk (required: 10 GB free min)'
# Setting timezone
rm -rf /etc/localtime &>> "$LOGFILE"
execute_cmd "timedatectl set-timezone $TZ" "Setting Timezone $TZ"
# Execute tools check
execute_cmd "awk --version" 'Checking needed tools: awk'
execute_cmd "grep --version" 'Checking needed tools: grep'
execute_cmd "sed --version" 'Checking needed tools: sed'
execute_cmd "apt --version" 'Checking needed tools: apt'
# Creating working directory
rm -rf "$WORKDIR" &>> "$LOGFILE"
mkdir -p "$WORKDIR" &>> "$LOGFILE"
execute_cmd "cd $WORKDIR" "Moving to workdir: $WORKDIR"
## Install utils
execute_cmd "apt update" "Updating repos"
execute_cmd "apt install -y net-tools vim curl wget software-properties-common apt-transport-https" "Installing utils"
# Disabling apparmor and ufw
systemctl stop ufw.service &>> "$LOGFILE"
systemctl disable ufw &>> "$LOGFILE"
systemctl stop apparmor &>> "$LOGFILE"
systemctl disable apparmor &>> "$LOGFILE"
#install mysql
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}"
echo "create database $DBNAME" | mysql -uroot -P$DBPORT -h$DBHOST
check_cmd_status "Error creating database $DBNAME, is this an empty node? if you have a previus installation please contact with support."
echo "CREATE USER \"$DBUSER\"@'%' IDENTIFIED BY \"$DBPASS\";" | mysql -uroot -P$DBPORT -h$DBHOST
echo "ALTER USER \"$DBUSER\"@'%' IDENTIFIED WITH mysql_native_password BY \"$DBPASS\"" | mysql -uroot -P$DBPORT -h$DBHOST
echo "GRANT ALL PRIVILEGES ON $DBNAME.* TO \"$DBUSER\"@'%'" | mysql -uroot -P$DBPORT -h$DBHOST
fi
export MYSQL_PWD=$DBPASS
#Generating my.cnf
cat > /etc/mysql/my.cnf << EOF_DB
[mysqld]
datadir=/var/lib/mysql
user=mysql
character-set-server=utf8
skip-character-set-client-handshake
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
# Mysql optimizations for Pandora FMS
# Please check the documentation in http://pandorafms.com for better results
max_allowed_packet = 64M
innodb_buffer_pool_size = $POOL_SIZE
innodb_lock_wait_timeout = 90
innodb_file_per_table
innodb_flush_log_at_trx_commit = 0
innodb_flush_method = O_DIRECT
innodb_log_file_size = 64M
innodb_log_buffer_size = 16M
innodb_io_capacity = 100
thread_cache_size = 8
thread_stack = 256K
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
[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
EOF_DB
execute_cmd "systemctl restart mysql" "Configuring and restarting database engine"
# Kernel optimization
if [ "$SKIP_KERNEL_OPTIMIZATIONS" -eq '0' ] ; then
cat >> /etc/sysctl.conf <<EO_KO
# Pandora FMS Optimization
# default=5
net.ipv4.tcp_syn_retries = 3
# default=5
net.ipv4.tcp_synack_retries = 3
# default=1024
net.ipv4.tcp_max_syn_backlog = 65536
# default=124928
net.core.wmem_max = 8388608
# default=131071
net.core.rmem_max = 8388608
# default = 128
net.core.somaxconn = 1024
# default = 20480
net.core.optmem_max = 81920
EO_KO
[ -d /dev/lxd/ ] || execute_cmd "sysctl --system" "Applying Kernel optimization"
fi
# Remove temporary files
execute_cmd "echo done" "Percona server installed"
cd "$HOME"
execute_cmd "rm -rf $WORKDIR" "Removing temporary files"

View File

@ -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

View File

@ -258,6 +258,7 @@ console_dependencies=" \
mod_ssl \
libzstd \
openldap-clients \
chromium \
http://firefly.artica.es/centos8/phantomjs-2.1.1-1.el7.x86_64.rpm"
execute_cmd "yum install -y $console_dependencies" "Installing Pandora FMS Console dependencies"
@ -284,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 \
@ -409,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"
@ -633,8 +639,8 @@ systemctl enable tentacle_serverd &>> $LOGFILE
execute_cmd "service tentacle_serverd start" "Starting Tentacle Server"
# Enabling condole cron
execute_cmd "echo \"* * * * * root wget -q -O - --no-check-certificate http://127.0.0.1/pandora_console/enterprise/cron.php >> $PANDORA_CONSOLE/log/cron.log\" >> /etc/crontab" "Enabling Pandora FMS Console cron"
echo "* * * * * root wget -q -O - --no-check-certificate http://127.0.0.1/pandora_console/enterprise/cron.php >> $PANDORA_CONSOLE/log/cron.log" >> /etc/crontab
execute_cmd "echo \"* * * * * root wget -q -O - --no-check-certificate --load-cookies /tmp/cron-session-cookies --save-cookies /tmp/cron-session-cookies --keep-session-cookies http://127.0.0.1/pandora_console/enterprise/cron.php >> $PANDORA_CONSOLE/log/cron.log\" >> /etc/crontab" "Enabling Pandora FMS Console cron"
echo "* * * * * root wget -q -O - --no-check-certificate --load-cookies /tmp/cron-session-cookies --save-cookies /tmp/cron-session-cookies --keep-session-cookies http://127.0.0.1/pandora_console/enterprise/cron.php >> $PANDORA_CONSOLE/log/cron.log" >> /etc/crontab
## Enabling agent
systemctl enable pandora_agent_daemon &>> $LOGFILE
execute_cmd "systemctl start pandora_agent_daemon" "Starting Pandora FMS Agent"

View File

@ -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,7 +14,7 @@ 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
@ -32,6 +32,7 @@ LOGFILE="/tmp/pandora-deploy-community-$(date +%F).log"
[ "$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")
[ "$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
@ -312,6 +315,7 @@ console_dependencies=" \
mod_ssl \
libzstd \
openldap-clients \
chromium \
http://firefly.artica.es/centos8/perl-Net-Telnet-3.04-1.el8.noarch.rpm \
http://firefly.artica.es/centos7/wmic-1.4-1.el7.x86_64.rpm \
http://firefly.artica.es/centos8/phantomjs-2.1.1-1.el7.x86_64.rpm"
@ -466,6 +470,8 @@ query_cache_size = 64M
query_cache_min_res_unit = 2k
query_cache_limit = 256K
#skip-log-bin
sql_mode=""
[mysqld_safe]
@ -476,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"
@ -484,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"
@ -718,8 +732,8 @@ systemctl enable tentacle_serverd &>> "$LOGFILE"
execute_cmd "service tentacle_serverd start" "Starting Tentacle Server"
# Enabling condole cron
execute_cmd "echo \"* * * * * root wget -q -O - --no-check-certificate http://127.0.0.1/pandora_console/enterprise/cron.php >> $PANDORA_CONSOLE/log/cron.log\" >> /etc/crontab" "Enabling Pandora FMS Console cron"
echo "* * * * * root wget -q -O - --no-check-certificate http://127.0.0.1/pandora_console/enterprise/cron.php >> $PANDORA_CONSOLE/log/cron.log" >> /etc/crontab
execute_cmd "echo \"* * * * * root wget -q -O - --no-check-certificate --load-cookies /tmp/cron-session-cookies --save-cookies /tmp/cron-session-cookies --keep-session-cookies http://127.0.0.1/pandora_console/enterprise/cron.php >> $PANDORA_CONSOLE/log/cron.log\" >> /etc/crontab" "Enabling Pandora FMS Console cron"
echo "* * * * * root wget -q -O - --no-check-certificate --load-cookies /tmp/cron-session-cookies --save-cookies /tmp/cron-session-cookies --keep-session-cookies http://127.0.0.1/pandora_console/enterprise/cron.php >> $PANDORA_CONSOLE/log/cron.log" >> /etc/crontab
## Enabling agent
systemctl enable pandora_agent_daemon &>> "$LOGFILE"
execute_cmd "systemctl start pandora_agent_daemon" "Starting Pandora FMS Agent"

View File

@ -16,8 +16,9 @@ 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
# define default variables
[ "$TZ" ] || TZ="Europe/Madrid"
@ -33,6 +34,8 @@ LOGFILE="/tmp/pandora-deploy-community-$(date +%F).log"
[ "$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"
@ -133,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
@ -271,6 +277,15 @@ 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="\
@ -345,10 +360,12 @@ 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"
@ -356,6 +373,10 @@ check_cmd_status "Error Installing MySql Server"
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}"
echo "create database $DBNAME" | mysql -uroot -P$DBPORT -h$DBHOST
@ -394,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
@ -412,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
@ -427,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}"
@ -444,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
@ -704,8 +732,8 @@ execute_cmd "service tentacle_serverd start" "Starting Tentacle Server"
systemctl enable tentacle_serverd &>> "$LOGFILE"
# Enabling condole cron
execute_cmd "echo \"* * * * * root wget -q -O - --no-check-certificate http://127.0.0.1/pandora_console/enterprise/cron.php >> $PANDORA_CONSOLE/log/cron.log\" >> /etc/crontab" "Enabling Pandora FMS Console cron"
echo "* * * * * root wget -q -O - --no-check-certificate http://127.0.0.1/pandora_console/enterprise/cron.php >> $PANDORA_CONSOLE/log/cron.log" >> /etc/crontab
execute_cmd "echo \"* * * * * root wget -q -O - --no-check-certificate --load-cookies /tmp/cron-session-cookies --save-cookies /tmp/cron-session-cookies --keep-session-cookies http://127.0.0.1/pandora_console/enterprise/cron.php >> $PANDORA_CONSOLE/log/cron.log\" >> /etc/crontab" "Enabling Pandora FMS Console cron"
echo "* * * * * root wget -q -O - --no-check-certificate --load-cookies /tmp/cron-session-cookies --save-cookies /tmp/cron-session-cookies --keep-session-cookies http://127.0.0.1/pandora_console/enterprise/cron.php >> $PANDORA_CONSOLE/log/cron.log" >> /etc/crontab
## Enabling agent adn configuring Agente
sed -i "s/^remote_config.*$/remote_config 1/g" $PANDORA_AGENT_CONF &>> "$LOGFILE"

View File

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

View File

@ -277,8 +277,8 @@ export ORACLE_HOME=/usr/lib/oracle/$VERSION/client64
EOF_ENV
echo ">> Enable discovery cron: "
#while true ; do wget -q -O - --no-check-certificate http://localhost/pandora_console/enterprise/cron.php >> /var/www/html/pandora_console/pandora_console.log && sleep 60 ; done &
echo "*/5 * * * * wget -q -O - --no-check-certificate http://localhost/pandora_console/enterprise/cron.php >> /var/www/html/pandora_console/log/cron.log" >> /opt/pandora/crontasks
#while true ; do wget -q -O - --no-check-certificate --load-cookies /tmp/cron-session-cookies --save-cookies /tmp/cron-session-cookies --keep-session-cookies http://localhost/pandora_console/enterprise/cron.php >> /var/www/html/pandora_console/pandora_console.log && sleep 60 ; done &
echo "*/5 * * * * wget -q -O - --no-check-certificate --load-cookies /tmp/cron-session-cookies --save-cookies /tmp/cron-session-cookies --keep-session-cookies http://localhost/pandora_console/enterprise/cron.php >> /var/www/html/pandora_console/log/cron.log" >> /opt/pandora/crontasks
echo ">> Enable pandora_db cron: "
/usr/bin/perl /usr/share/pandora_server/util/pandora_db.pl /etc/pandora/pandora_server.conf

View File

@ -4,9 +4,9 @@ Release: 140223.sp3%{?dist}
Summary: Host/service/network agent for Pandora FMS monitoring system
License: GPLv2
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
#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

View File

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

View File

@ -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

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.766, 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

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.766, 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

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.766, 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

View File

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

View File

@ -31,14 +31,14 @@ Install procedure
Step 1 - Get the latest package and copy to /tmp, you can get the latest package at:
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

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.766, Solaris Version
# Version 7.0NG.768, Solaris Version
# Licensed under GPL license v2,
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
# http://www.pandorafms.com

View File

@ -1,6 +1,6 @@
# Base config file for Pandora FMS Windows Agent
# (c) 2006-2021 Artica Soluciones Tecnologicas
# Version 7.0NG.766
# 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

View File

@ -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

View File

@ -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

View File

@ -1,15 +1,8 @@
#!/usr/bin/perl
##########################################################################
# pandora_agent_exec
################################################################################
# pandora_exec - Execute a command with a time limit.
#
# Executes the given command and prints its output to stdout. If the
# execution times out or the command does not exist nothing is printed
# to stdout. This is part of Pandora FMS Plugin server, do not delete!.
#
# Usage: pandora_agent_exec <timeout in seconds> <command>
##########################################################################
# Copyright (c) 2008-2010 Ramon Novoa, rnovoa@gmail.com
# (c) 2008-2010 Artica Soluciones Tecnologicas S.L
# Copyright (c) 2008-2023 Artica PFMS S.L.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
@ -22,37 +15,41 @@
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
##########################################################################
################################################################################
use strict;
use warnings;
use POSIX qw(WEXITSTATUS WIFEXITED);
# Check command line parameters
# Check command line arguments.
if ($#ARGV < 1) {
print("Usage: $0 <timeout in seconds> <command>\n");
exit 1;
}
my @opts = @ARGV;
my $timeout = shift(@opts);
my $command = join(' ', @opts);
my $output = '';
my $ReturnCode = 0;
my $command = ($0 =~ m/_agent_exec$/) ? # For backward compatibility with pandora_agent.
join(' ', @opts) :
join(' ', map { quotemeta($_) } @opts);
# Execute the command
# Fork:
# * The child will run the command.
# * The parent will timeout if needed
# and exit with the appropriate exit status.
my $pid = fork();
if ($pid == 0) {
setpgrp();
exec($command);
} else {
eval {
local $SIG{ALRM} = sub { die "alarm\n" };
local $SIG{ALRM} = sub { kill(9, -$pid); exit 1; };
alarm $timeout;
$output = `$command`;
$ReturnCode = ($? >> 8) & 0xff;
waitpid($pid, 0);
alarm 0;
if (WIFEXITED(${^CHILD_ERROR_NATIVE})) {
exit WEXITSTATUS(${^CHILD_ERROR_NATIVE});
}
};
# Timeout
if ($@ eq "alarm\n") {
exit 3;
}
print $output;
exit $ReturnCode;
exit 1;

View File

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

View File

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

View File

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

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.766
# 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

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.766
# 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

View File

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

View File

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

View File

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

View File

@ -1,5 +1,5 @@
package: pandorafms-agent-unix
Version: 7.0NG.766-221128
Version: 7.0NG.768-230213
Architecture: all
Priority: optional
Section: admin

View File

@ -14,7 +14,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
pandora_version="7.0NG.766-221128"
pandora_version="7.0NG.768-230213"
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

View File

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

View File

@ -19,11 +19,11 @@
<choice id="com.pandorafms.pandorafms_src" visible="false">
<pkg-ref id="com.pandorafms.pandorafms_src"/>
</choice>
<pkg-ref id="com.pandorafms.pandorafms_src" version="7.0NG.766" 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">
<pkg-ref id="com.pandorafms.pandorafms_uninstall"/>
</choice>
<pkg-ref id="com.pandorafms.pandorafms_uninstall" version="7.0NG.766" 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()" />
<script>
<![CDATA[

View File

@ -5,9 +5,9 @@
<key>CFBundleIconFile</key> <string>pandorafms.icns</string>
<key>CFBundleIdentifier</key> <string>com.pandorafms.pandorafms_uninstall</string>
<key>CFBundleVersion</key> <string>7.0NG.766</string>
<key>CFBundleGetInfoString</key> <string>7.0NG.766 Pandora FMS Agent uninstaller for MacOS by Artica ST on Aug 2020</string>
<key>CFBundleShortVersionString</key> <string>7.0NG.766</string>
<key>CFBundleVersion</key> <string>7.0NG.768</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.768</string>
<key>NSPrincipalClass</key><string>NSApplication</string>
<key>NSMainNibFile</key><string>MainMenu</string>

View File

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

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.766, FreeBSD Version
# Version 7.0NG.768, FreeBSD Version
# Licensed under GPL license v2,
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
# http://www.pandorafms.com
@ -272,7 +272,7 @@ module_plugin pandora_df_free
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
# Log collection modules. Only for enterprise version, this will collect log files for forensic analysis.

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.766, 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

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.766, 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 pandora_netusage
# Service autodiscovery plugin
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
# Log collection modules. Only for enterprise version, this will collect log files for forensic analysis.

View File

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

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.766, NetBSD Version
# Version 7.0NG.768, NetBSD Version
# Licensed under GPL license v2,
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
# http://www.pandorafms.com
@ -232,6 +232,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

View File

@ -31,14 +31,14 @@ Install procedure
Step 1 - Get the latest package and copy to /tmp, you can get the latest package at:
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

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.766, Solaris Version
# Version 7.0NG.768, Solaris Version
# Licensed under GPL license v2,
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
# http://www.pandorafms.com

View File

@ -1014,8 +1014,8 @@ my $Sem = undef;
# Semaphore used to control the number of threads
my $ThreadSem = undef;
use constant AGENT_VERSION => '7.0NG.766';
use constant AGENT_BUILD => '221128';
use constant AGENT_VERSION => '7.0NG.768';
use constant AGENT_BUILD => '230213';
# Agent log default file size maximum and instances
use constant DEFAULT_MAX_LOG_SIZE => 600000;
@ -2403,6 +2403,11 @@ sub check_collections () {
if (open (MD5_FILE, "< $ConfDir/collections/$collection_md5_file")) {
$local_collection_md5 = <MD5_FILE>;
close MD5_FILE;
if ( ! defined ($local_collection_md5) ) {
log_message ('Collection', "Size of $ConfDir/collections/$collection_md5_file is 0");
unlink ("$ConfDir/collections/$collection_md5_file");
$local_collection_md5 = "Size 0";
}
} else {
log_message ('Collection', "Could not open dir $ConfDir/collections/$collection_md5_file");
next;

View File

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

View File

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

View File

@ -1,15 +1,8 @@
#!/usr/bin/perl
##########################################################################
# pandora_agent_exec
################################################################################
# pandora_exec - Execute a command with a time limit.
#
# Executes the given command and prints its output to stdout. If the
# execution times out or the command does not exist nothing is printed
# to stdout. This is part of Pandora FMS Plugin server, do not delete!.
#
# Usage: pandora_agent_exec <timeout in seconds> <command>
##########################################################################
# Copyright (c) 2008-2010 Ramon Novoa, rnovoa@gmail.com
# (c) 2008-2010 Artica Soluciones Tecnologicas S.L
# Copyright (c) 2008-2023 Artica PFMS S.L.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
@ -22,37 +15,41 @@
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
##########################################################################
################################################################################
use strict;
use warnings;
use POSIX qw(WEXITSTATUS WIFEXITED);
# Check command line parameters
# Check command line arguments.
if ($#ARGV < 1) {
print("Usage: $0 <timeout in seconds> <command>\n");
exit 1;
}
my @opts = @ARGV;
my $timeout = shift(@opts);
my $command = join(' ', @opts);
my $output = '';
my $ReturnCode = 0;
my $command = ($0 =~ m/_agent_exec$/) ? # For backward compatibility with pandora_agent.
join(' ', @opts) :
join(' ', map { quotemeta($_) } @opts);
# Execute the command
# Fork:
# * The child will run the command.
# * The parent will timeout if needed
# and exit with the appropriate exit status.
my $pid = fork();
if ($pid == 0) {
setpgrp();
exec($command);
} else {
eval {
local $SIG{ALRM} = sub { die "alarm\n" };
local $SIG{ALRM} = sub { kill(9, -$pid); exit 1; };
alarm $timeout;
$output = `$command`;
$ReturnCode = ($? >> 8) & 0xff;
waitpid($pid, 0);
alarm 0;
if (WIFEXITED(${^CHILD_ERROR_NATIVE})) {
exit WEXITSTATUS(${^CHILD_ERROR_NATIVE});
}
};
# Timeout
if ($@ eq "alarm\n") {
exit 3;
}
print $output;
exit $ReturnCode;
exit 1;

View File

@ -9,8 +9,8 @@
# Please see http://www.pandorafms.org. This code is licensed under GPL 2.0 license.
# **********************************************************************
PI_VERSION="7.0NG.766"
PI_BUILD="221128"
PI_VERSION="7.0NG.768"
PI_BUILD="230213"
OS_NAME=`uname -s`
FORCE=0

View File

@ -12,8 +12,8 @@
#
###################################################
try:
from sys import argv
from sys import path
from sys import stderr
from sys import exit
from subprocess import Popen
@ -21,10 +21,12 @@ from subprocess import PIPE
from subprocess import DEVNULL
from subprocess import getstatusoutput
import psutil
except ModuleNotFoundError as err:
print("{} error: {}. Exiting...".format(argv[0], err), file=stderr)
exit(1)
global module_list
module_list = []
version = "1.1"
VERSION = "1.2"
#########################################################################################
@ -50,15 +52,15 @@ class PSCheck:
procname = PSCheck.get_serviceprocess(element)
# Get process status
parstatus = PSCheck.getstatus(element)
if memcpu == True and parstatus == 1:
if memcpu and parstatus == 1:
usage = get_memcpu(str(procname), str(element))
output += usage
# Generate module with name and status
parent = service_module(str(element), parstatus)
output += parent
if option == True:
if option:
children = PSCheck.getchildren(element, memcpu)
if type(children) == list and len(children) > 1:
if isinstance(children, list) and len(children) > 1:
for child in children:
output += child
else:
@ -66,7 +68,6 @@ class PSCheck:
else:
next
#if output != '':
if output and element and procname:
return ({"name" : element, "process" : procname, "modules": output})
else:
@ -84,13 +85,13 @@ class PSCheck:
status = PSCheck.getstatus(child)
kids += service_module(str(child), status, "Service " + str(servicename) + " - Status")
if status:
if memcpu == True:
if memcpu:
kidsusage = get_memcpu(str(child))
for usage in kidsusage:
kids += usage
else:
next
return (kids)
return kids
@staticmethod
def getstatus(servicename):
@ -99,7 +100,7 @@ class PSCheck:
"' |", "Select-Object", "-ExpandProperty", "Status"],
stdout=PIPE, stdin=DEVNULL, stderr=DEVNULL, universal_newlines=True)
status = running.communicate()[0].strip()
return (int(status == "Running"))
return int(status == "Running")
@staticmethod
def get_serviceprocess(servicename):
@ -108,7 +109,7 @@ class PSCheck:
srv_pid = service.pid()
process = psutil.Process(srv_pid)
proc_name = process.name()
return (proc_name)
return proc_name
#########################################################################################
@ -124,13 +125,13 @@ def service_module(name, value, parent=None):
"module_parent" : parent,
}]
#print ("service_module END "+str(now(0,1)))
return (module)
return module
def get_memcpu (process, servicename):
def get_memcpu (process, servicename=None):
"""Creates a module for Memory and CPU for a given process. Returns a list of dictionaries."""
modules = []
if process:
if servicename != None:
if servicename is not None:
parentname = servicename
else:
parentname = process
@ -147,7 +148,7 @@ def get_memcpu (process, servicename):
"unit" : "%",
"module_parent" : "Service "+ parentname + " - Status",
}]
return (modules)
return modules
def proc_percentbyname(procname): ############# 03/03/2020
"""Gets Memory and CPU usage for a given process. Returns a list."""
@ -165,7 +166,7 @@ def proc_percentbyname(procname): ############# 03/03/2020
except psutil.NoSuchProcess:
next
#print ("proc_percentbyname END "+str(now(0,1)))
return ([sum(memory),sum(cpu)])
return [sum(memory),sum(cpu)]
def win_service(servicelist, option=False, memcpu=False):
"""Creates modules for Windows servers."""
@ -173,7 +174,7 @@ def win_service(servicelist, option=False, memcpu=False):
for srvc in servicelist:
if srvc and len(srvc) > 2:
output = PSCheck.check_service(srvc, option, memcpu)
if output != None and output["modules"]:
if output is not None and output["modules"]:
modules += PSCheck.check_service(srvc.strip(), option, memcpu)["modules"]
module_list.append(srvc)
#winprocess = output["name"]
@ -227,7 +228,7 @@ def lnx_service(services_list, memcpu=False):
exit()
if status:
module_list.append(srvc)
if memcpu == True:
if memcpu:
modules += get_memcpu(srvc, None)
for m in modules:
@ -383,7 +384,7 @@ def discover(osyst, servicelist):
elif osyst == "Linux":
lnx_service(servicelist, memcpu)
else:
print ("\nPandora FMS Autodiscovery plugin v{}".format(version))
print("\nPandora FMS Autodiscovery plugin v{}".format(VERSION))
print("Checks the status of the services in list and monitors CPU and Memory for each of them.\n")
print("Usage:")
print("{} [options] [--usage]".format(argv[0]))

View File

@ -1,6 +1,6 @@
# Base config file for Pandora FMS Windows Agent
# (c) 2006-2021 Artica Soluciones Tecnologicas
# Version 7.0NG.766
# 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

View File

@ -3,7 +3,7 @@ AllowLanguageSelection
{Yes}
AppName
{Pandora FMS Windows Agent v7.0NG.766}
{Pandora FMS Windows Agent v7.0NG.768}
ApplicationID
{17E3D2CF-CA02-406B-8A80-9D31C17BD08F}
@ -186,7 +186,7 @@ UpgradeApplicationID
{}
Version
{221128}
{230213}
ViewReadme
{Yes}

View File

@ -30,7 +30,7 @@ using namespace Pandora;
using namespace Pandora_Strutils;
#define PATH_SIZE _MAX_PATH+1
#define PANDORA_VERSION ("7.0NG.766 Build 221128")
#define PANDORA_VERSION ("7.0NG.768 Build 230213")
string pandora_path;
string pandora_dir;

View File

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

View File

@ -1,5 +1,5 @@
package: pandorafms-console
Version: 7.0NG.766-221128
Version: 7.0NG.768-230213
Architecture: all
Priority: optional
Section: admin

View File

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

View File

@ -1 +0,0 @@

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -2,4 +2,8 @@ START TRANSACTION;
ALTER TABLE `tevent_filter` MODIFY COLUMN `server_id` TEXT;
UPDATE tconfig SET value = 'Hope' WHERE token LIKE 'lts_name';
ALTER TABLE `tlayout_template` ADD COLUMN `maintenance_mode` TEXT;
COMMIT;

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,47 @@
START TRANSACTION;
ALTER TABLE `tserver` ADD COLUMN `server_keepalive_utimestamp` BIGINT NOT NULL DEFAULT 0;
CREATE TABLE IF NOT EXISTS `tmonitor_filter` (
`id_filter` INT UNSIGNED NOT NULL AUTO_INCREMENT,
`id_name` VARCHAR(600) NOT NULL,
`id_group_filter` INT NOT NULL DEFAULT 0,
`ag_group` INT NOT NULL DEFAULT 0,
`recursion` TEXT,
`status` INT NOT NULL DEFAULT -1,
`ag_modulename` TEXT,
`ag_freestring` TEXT,
`tag_filter` TEXT,
`moduletype` TEXT,
`module_option` INT DEFAULT 1,
`modulegroup` INT NOT NULL DEFAULT -1,
`min_hours_status` TEXT,
`datatype` TEXT,
`not_condition` TEXT,
`ag_custom_fields` TEXT,
PRIMARY KEY (`id_filter`)
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4;
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;
CREATE INDEX `tusuario_perfil_user` ON `tusuario_perfil` (`id_usuario`);
CREATE INDEX `tusuario_perfil_group` ON `tusuario_perfil` (`id_grupo`);
CREATE INDEX `tusuario_perfil_profile` ON `tusuario_perfil` (`id_perfil`);
CREATE INDEX `tlayout_data_layout` ON `tlayout_data` (`id_layout`);
CREATE INDEX `taddress_agent_agent` ON `taddress_agent` (`id_agent`);
CREATE INDEX `ttag_name` ON `ttag` (name(15));
CREATE INDEX `tservice_element_service` ON `tservice_element` (`id_service`);
CREATE INDEX `tservice_element_agent` ON `tservice_element` (`id_agent`);
CREATE INDEX `tservice_element_am` ON `tservice_element` (`id_agente_modulo`);
CREATE INDEX `tagent_module_log_agent` ON `tagent_module_log` (`id_agent`);
COMMIT;

Binary file not shown.

Binary file not shown.

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -238,7 +238,15 @@ if ($create_agent) {
$field_values = [];
foreach ($fields as $field) {
$field_values[$field['id_field']] = (string) get_parameter_post('customvalue_'.$field['id_field'], '');
$field_value = get_parameter_post('customvalue_'.$field['id_field'], '');
if ($field['is_link_enabled']) {
$field_value = json_encode($field_value);
} else {
$field_value = (string) $field_value;
}
$field_values[$field['id_field']] = $field_value;
}
// Check if agent exists (BUG WC-50518-2).
@ -451,7 +459,20 @@ if ($id_agente) {
// 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) {
$inventorytab = '';
@ -477,11 +498,13 @@ if ($id_agente) {
}
// Collection.
if ((int) $config['license_nms'] !== 1) {
$collectiontab = enterprise_hook('collection_tab');
if ($collectiontab == -1) {
$collectiontab = '';
}
}
// NetworkConfigManager tab.
$ncm_tab = enterprise_hook('networkconfigmanager_tab');
@ -999,7 +1022,22 @@ if ($update_agent) {
$field_values = [];
foreach ($fields as $field) {
$field_values[$field['id_field']] = (string) get_parameter_post('customvalue_'.$field['id_field'], '');
$field_value = get_parameter_post('customvalue_'.$field['id_field'], '');
if ($field['is_link_enabled']) {
if ($field_value[1] !== '') {
$parsed_url = parse_url($field_value[1]);
if (empty($parsed_url['scheme']) === true) {
$field_value[1] = 'http://'.ltrim($field_value[1], '/');
}
}
$field_value = json_encode($field_value);
} else {
$field_value = (string) $field_value;
}
$field_values[$field['id_field']] = $field_value;
}
foreach ($field_values as $key => $value) {
@ -1958,7 +1996,7 @@ if ($create_module) {
$agent = db_get_row('tagente', 'id_agente', $id_agente);
db_pandora_audit(
AUDIT_LOG_AGENT_MANAGEMENT,
"Added module '".io_safe_output($name)."' for agent ".io_safe_output($agent['alias']),
"Added module '".db_escape_string_sql($name)."' for agent ".io_safe_output($agent['alias']),
false,
true,
io_json_mb_encode($values)
@ -2095,6 +2133,9 @@ if ($delete_module) {
exit;
}
// Before delete the main module, check and delete the childrens from the original module.
module_check_childrens_and_delete($id_borrar_modulo);
// Also call base function to delete modules.
modules_delete_agent_module($id_borrar_modulo);
@ -2358,6 +2399,10 @@ switch ($tab) {
include 'agent_wizard.php';
break;
case 'inventory':
include 'inventory_manager.php';
break;
default:
if (enterprise_hook('switch_agent_tab', [$tab])) {
// This will make sure that blank pages will have at least some
@ -2451,6 +2496,11 @@ switch ($tab) {
});
});
// Change description when edit port
$( "#text-tcp_port" ).change(function() {
$( "#textarea_description" ).text(`Checks port ${$( "#text-tcp_port" ).val()} is opened`);
});
// Set the position and width of the subtab
/*
function agent_wizard_tab_setup() {

View File

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

View File

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

View File

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

View File

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

View File

@ -52,13 +52,13 @@ if (!isset($policy_page)) {
echo '<form id="create_module_type" method="post" action="'.$url.'">';
echo '<table width="100%" cellpadding="2" cellspacing="2" class="databox filters" >';
echo "<tr><td class='datos bolder w20p'>";
echo __('Search').' '.html_print_input_text(
echo "<tr><td class='datos bolder w12p'><span class='mrgn_right_7px'>";
echo __('Search').'</span>'.html_print_input_text(
'search_string',
$search_string,
'',
15,
255,
5,
5,
true
);
html_print_input_hidden('search', 1);
@ -73,7 +73,6 @@ echo '</td>';
echo "<td class='datos w10p'>";
html_print_submit_button(__('Filter'), 'filter', false, 'class="sub search"');
echo '</td>';
echo "<td class='datos w10p'></td>";
echo '</form>';
// Check if there is at least one server of each type available to assign that
// kind of modules. If not, do not show server type in combo.
@ -179,7 +178,7 @@ if (($policy_page) || (isset($agent))) {
// Create module/type combo.
echo '<form id="create_module_type" method="post" action="'.$url.'">';
if (!$policy_page) {
echo '<td class="datos w20p bolder">';
echo '<td class="datos w15p bolder">';
echo __('Show in hierachy mode');
if ($checked == 'true') {
$checked = true;
@ -198,8 +197,8 @@ if (($policy_page) || (isset($agent))) {
echo '</td>';
}
echo '<td class="datos w20p bolder">';
echo __('<p>Type</p>');
echo '<td class="datos w20p bolder lign_right"><span class="mrgn_right_7px">';
echo __('Type').'</span>';
html_print_select(
$modules,
'moduletype',
@ -216,7 +215,7 @@ if (($policy_page) || (isset($agent))) {
);
html_print_input_hidden('edit_module', 1);
echo '</td>';
echo '<td class="datos w10p">';
echo '<td class="datos w5p">';
echo '<input align="right" name="updbutton" type="submit" class="sub next" value="'.__('Create').'">';
echo '</td>';
echo '</tr>';
@ -247,6 +246,8 @@ if ($module_action === 'delete') {
$print_result_msg = true;
$count_correct_delete_modules = 0;
foreach ($id_agent_modules_delete as $id_agent_module_del) {
// Before delete the main module, check and delete the childrens from the original module.
module_check_childrens_and_delete($id_agent_module_del);
$id_grupo = (int) agents_get_agent_group($id_agente);
$all_groups = agents_get_all_groups_agent($id_agente, $id_grupo);
@ -445,8 +446,6 @@ if ($module_action === 'delete') {
}
} else if ($module_action === 'disable') {
$id_agent_modules_disable = (array) get_parameter('id_delete');
$count_correct_delete_modules = 0;
$updated_count = 0;
foreach ($id_agent_modules_disable as $id_agent_module_disable) {
@ -490,6 +489,52 @@ if ($module_action === 'delete') {
);
}
}
} else if ($module_action === 'enable') {
$id_agent_modules_enable = (array) get_parameter('id_delete');
$updated_count = 0;
foreach ($id_agent_modules_enable as $id_agent_module_enable) {
$sql = sprintf(
'UPDATE tagente_modulo
SET disabled = 0
WHERE id_agente_modulo = %d',
$id_agent_module_enable
);
$id_agent_changed[] = modules_get_agentmodule_agent($id_agent_module_enable);
$agent_update_result = db_process_sql_update(
'tagente',
['update_module_count' => 1],
['id_agente' => $id_agent_changed]
);
if (db_process_sql($sql) !== false && $agent_update_result !== false) {
$updated_count++;
}
}
$count_modules_to_enable = count($id_agent_modules_enable);
if ($updated_count === 0) {
ui_print_error_message(
sprintf(
__('There was a problem completing the operation. Applied to 0/%d modules.'),
$count_modules_to_enable
)
);
} else {
if ($updated_count == $count_modules_to_enable) {
ui_print_success_message(__('Operation finished successfully.'));
} else {
ui_print_error_message(
sprintf(
__('There was a problem completing the operation. Applied to %d/%d modules.'),
$updated_count,
$count_modules_to_enable
)
);
}
}
}
@ -1132,7 +1177,11 @@ foreach ($modules as $module) {
$data[6] = ui_print_status_image(
$status,
htmlspecialchars($title),
true
true,
false,
false,
false,
($module['ip_target']) ? 'IP: '.$module['ip_target'] : false
);
// MAX / MIN values.
@ -1234,9 +1283,13 @@ foreach ($modules as $module) {
}
if (check_acl_one_of_groups($config['id_user'], $all_groups, 'AW')) {
// Check module relatonships to show warning message.
$url = htmlentities('index.php?sec=gagente&tab=module&sec2=godmode/agentes/configurar_agente&id_agente='.$id_agente.'&delete_module='.$module['id_agente_modulo']);
// Delete module.
$data[9] = '<a href="index.php?sec=gagente&tab=module&sec2=godmode/agentes/configurar_agente&id_agente='.$id_agente.'&delete_module='.$module['id_agente_modulo'].'"
onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">';
$data[9] = '<a href="#"
onClick="get_children_modules(false, \''.$module['id_agente_modulo'].'\', \''.$url.'\')">';
$data[9] .= html_print_image(
'images/cross.png',
true,
@ -1260,8 +1313,7 @@ foreach ($modules as $module) {
}
if (check_acl_one_of_groups($config['id_user'], $all_groups, 'AW')) {
echo '<form method="post" action="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&id_agente='.$id_agente.'&tab=module"
onsubmit="if (! confirm (\''.__('Are you sure?').'\')) return false">';
echo '<form method="post" action="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&id_agente='.$id_agente.'&tab=module" id="form_multiple_delete">';
}
html_print_table($table);
@ -1274,6 +1326,7 @@ if (check_acl_one_of_groups($config['id_user'], $all_groups, 'AW')) {
html_print_select(
[
'disable' => 'Disable selected modules',
'enable' => 'Enable selected modules',
'delete' => 'Delete selected modules',
],
'module_action',
@ -1286,12 +1339,16 @@ if (check_acl_one_of_groups($config['id_user'], $all_groups, 'AW')) {
false
);
echo '&nbsp&nbsp&nbsp&nbsp';
html_print_submit_button(
__('Execute action'),
'submit_modules_action',
false,
'class="sub next"'
);
echo '</div>';
echo '</form>';
}
@ -1301,6 +1358,17 @@ if (check_acl_one_of_groups($config['id_user'], $all_groups, 'AW')) {
$(document).ready (function () {
$("input[name=submit_modules_action]").click(function (event) {
event.preventDefault();
var module_action = $('#module_action').val();
if(module_action !== 'delete') {
$("#form_multiple_delete").submit();
} else {
get_children_modules(true);
}
});
$('[id^=checkbox-id_delete]').change(function(){
if($(this).parent().parent().hasClass('checkselected')){
$(this).parent().parent().removeClass('checkselected');
@ -1342,4 +1410,60 @@ if (check_acl_one_of_groups($config['id_user'], $all_groups, 'AW')) {
window.location = window.location + "&checked=true";
}
}
function get_children_modules(multiple, id_module, url) {
var selected_modules = [];
if(typeof(id_module) === 'undefined' && multiple === true) {
$("input[id^='checkbox-id_delete']:checked").each(function () {
selected_modules.push(this.value);
});
} else {
selected_modules = [id_module];
}
$.ajax({
type: "POST",
url: "ajax.php",
dataType: "json",
data: {
page: 'include/ajax/module',
get_children_modules: true,
parent_modulues: JSON.parse(JSON.stringify(selected_modules)),
},
success: function (data) {
delete_module_warning(data, multiple, id_module, url);
}
});
}
function delete_module_warning(children, multiple, id_module, url) {
var message = '<?php echo __('Are you sure?'); ?>';
var ret = false;
if(children != false) {
message += '<br><strong>' + '<?php echo __('This module has children modules.The following modules will also be deleted: '); ?>' + '</strong><ul>';
$.each(children, function (key, value) {
message += '<li>' + value['nombre'] + '</li>';
});
message += '</ul>';
}
confirmDialog({
title: "<?php echo __('Delete module'); ?>",
message: message,
onAccept: function() {
if(multiple === true) {
$("#form_multiple_delete").submit();
return true;
} else {
window.location.href = url;
}
}
});
return true;
}
</script>

View File

@ -69,7 +69,7 @@ if (strstr($page, 'policy_modules') === false) {
define('ID_NETWORK_COMPONENT_TYPE', 2);
if (empty($update_module_id)) {
if (empty($edit_module)) {
// Function in module_manager_editor_common.php.
add_component_selection(ID_NETWORK_COMPONENT_TYPE);
}
@ -393,7 +393,7 @@ $data[1] = html_print_input_text(
$data[2] = __('Auth password').ui_print_help_tip(__('The pass length must be eight character minimum.'), true);
$data[3] = html_print_input_password(
'snmp3_auth_pass',
$snmp3_auth_pass,
'',
'',
15,
60,
@ -415,7 +415,7 @@ $data[1] = html_print_select(['DES' => __('DES'), 'AES' => __('AES')], 'snmp3_pr
$data[2] = __('Privacy pass').ui_print_help_tip(__('The pass length must be eight character minimum.'), true);
$data[3] = html_print_input_password(
'snmp3_privacy_pass',
$snmp3_privacy_pass,
'',
'',
15,
60,
@ -711,6 +711,12 @@ $(document).ready (function () {
$("#text-custom_ip_target").hide();
}
});
// Add input password values with js to hide it in browser inspector.
$('#password-snmp3_auth_pass').val('<?php echo $snmp3_auth_pass; ?>');
$('#password-snmp3_privacy_pass').val('<?php echo $snmp3_privacy_pass; ?>');
observerInputPassword();
});

View File

@ -36,7 +36,7 @@ if (strstr($page, 'policy_modules') === false) {
define('ID_NETWORK_COMPONENT_TYPE', 4);
if (empty($update_module_id)) {
if (empty($edit_module)) {
// Function in module_manager_editor_common.php
add_component_selection(ID_NETWORK_COMPONENT_TYPE);
} else {
@ -85,6 +85,8 @@ $table_simple->rowstyle['macro_field'] = 'display:none';
push_table_simple($data, 'macro_field');
$password_fields = [];
// If there are $macros, we create the form fields
if (!empty($macros)) {
$macros = json_decode($macros, true);
@ -102,7 +104,8 @@ if (!empty($macros)) {
}
if ($m_hide) {
$data[1] = html_print_input_password($m['macro'], io_output_password($m['value']), '', 100, 1024, true);
$data[1] = html_print_input_password($m['macro'], '', '', 100, 1024, true);
array_push($password_fields, $m);
} else {
$data[1] = html_print_input_text(
$m['macro'],
@ -125,6 +128,17 @@ if (!empty($macros)) {
}
}
// Add input password values with js to hide it in browser inspector.
foreach ($password_fields as $k => $p) {
echo "
<script>
$(document).ready(() => {
$('input[name=\"".$p['macro']."\"]').val('".$p['value']."');
});
</script>
";
}
?>
<script type="text/javascript">
function changePluginSelect() {
@ -140,4 +154,8 @@ if (!empty($macros)) {
forced_title_callback();
}
$(document).ready(function () {
observerInputPassword();
});
</script>

View File

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

View File

@ -34,7 +34,7 @@ $extra_title = __('WMI server module');
define('ID_NETWORK_COMPONENT_TYPE', 6);
if (empty($update_module_id)) {
if (empty($edit_module)) {
// Function in module_manager_editor_common.php
add_component_selection(ID_NETWORK_COMPONENT_TYPE);
} else {
@ -116,7 +116,7 @@ $data[1] = html_print_input_text(
$data[2] = __('Password');
$data[3] = html_print_input_password(
'plugin_pass',
$plugin_pass,
'',
'',
15,
60,
@ -191,6 +191,11 @@ $(document).ready (function () {
$("#text-custom_ip_target").hide();
}
});
// Add input password values with js to hide it in browser inspector.
$('#password-plugin_pass').val('<?php echo $plugin_pass; ?>');
observerInputPassword();
});
</script>

View File

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

View File

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

View File

@ -290,7 +290,7 @@ $search_text = (string) get_parameter('search_text');
$date_from = (string) get_parameter('date_from');
$date_to = (string) get_parameter('date_to');
$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_name = (string) ((empty($agent_id) === false) ? get_parameter('agent_name') : '');
$module_id = (int) get_parameter('module_name_hidden');
@ -313,12 +313,20 @@ $table_form = new StdClass();
$table_form->class = 'databox filters';
$table_form->width = '100%';
$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 = [];
$row = [];
// Search text.
$row[] = __('Search').'&nbsp;'.html_print_input_text(
$row[] = __('Search');
$row[] = html_print_input_text(
'search_text',
$search_text,
'',
@ -356,7 +364,8 @@ $execution_type_fields = [
'periodically' => __('Periodically'),
'cron' => __('Cron'),
];
$row[] = __('Execution type').'&nbsp;'.html_print_select(
$row[] = __('Execution type');
$row[] = html_print_select(
$execution_type_fields,
'execution_type',
$execution_type,
@ -368,11 +377,11 @@ $row[] = __('Execution type').'&nbsp;'.html_print_select(
false
);
// Show past downtimes.
$row[] = __('Show past downtimes').'&nbsp;'.html_print_checkbox(
'archived',
1,
$show_archived,
true
$row[] = __('Show past downtimes').'&nbsp;&nbsp;&nbsp;&nbsp;'.html_print_switch(
[
'name' => 'archived',
'value' => $show_archived,
]
);
$table_form->data[] = $row;
@ -388,8 +397,8 @@ $params['return'] = true;
$params['print_hidden_input_idagent'] = true;
$params['hidden_input_idagent_name'] = 'agent_id';
$params['hidden_input_idagent_value'] = $agent_id;
$agent_input = __('Agent').'&nbsp;'.ui_print_agent_autocomplete_input($params);
$row[] = $agent_input;
$row[] = __('Agent');
$row[] = ui_print_agent_autocomplete_input($params);
// Module.
$row[] = __('Module').'&nbsp;'.html_print_autocomplete_modules(
@ -402,6 +411,10 @@ $row[] = __('Module').'&nbsp;'.html_print_autocomplete_modules(
true
);
$table_form->data[] = $row;
$row = [];
$row[] = html_print_submit_button(
__('Search'),
'search',
@ -907,7 +920,7 @@ if ($downtimes === false && $filter_performed === false) {
__('Export to CSV'),
'csv_export',
false,
'location.href="godmode/agentes/planned_downtime.export_csv.php?'.$filter_params_str.'"',
'blockResubmit($(this)); location.href=\'godmode/agentes/planned_downtime.export_csv.php?'.$filter_params_str.'\'',
'class="sub next"'
);
echo '</div>';

View File

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

View File

@ -231,7 +231,7 @@ if (strlen(trim($agentName)) > 0) {
}
if ($actionID != -1 && $actionID != '') {
$where .= ' AND talert_template_modules.id IN (SELECT id_alert_template_module FROM talert_template_module_actions WHERE id_alert_action = '.$actionID.') OR talert_template_modules.id IN (SELECT id FROM talert_template_modules ttm WHERE ttm.id_alert_template IN (SELECT tat.id FROM talert_templates tat WHERE tat.id_alert_action = '.$actionID.'))';
$where .= ' AND (talert_template_modules.id IN (SELECT id_alert_template_module FROM talert_template_module_actions WHERE id_alert_action = '.$actionID.') OR talert_template_modules.id IN (SELECT id FROM talert_template_modules ttm WHERE ttm.id_alert_template IN (SELECT tat.id FROM talert_templates tat WHERE tat.id_alert_action = '.$actionID.')))';
}
if ($status_alert === 'disabled') {
@ -570,7 +570,7 @@ foreach ($simple_alerts as $alert) {
if ($alert['times_fired'] > 0) {
$status = STATUS_ALERT_FIRED;
$title = __('Alert fired').' '.$alert['internal_counter'].' '.__('time(s)');
$title = __('Alert fired').' '.$alert['times_fired'].' '.__('time(s)');
} else if ($alert['disabled'] > 0) {
$status = STATUS_ALERT_DISABLED;
$title = __('Alert disabled');

View File

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

View File

@ -102,7 +102,7 @@ $table_details->data[] = $data;
if ($alert['times_fired'] > 0) {
$status = STATUS_ALERT_FIRED;
$title = __('Alert fired').' '.$alert['internal_counter'].' '.__('time(s)');
$title = __('Alert fired').' '.$alert['times_fired'].' '.__('time(s)');
} else if ($alert['disabled'] > 0) {
$status = STATUS_ALERT_DISABLED;
$title = __('Alert disabled');

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -550,7 +550,22 @@ $table->data['form_agents_3'][3] = html_print_select(
$table->data['edit0'][0] = __('Dynamic Interval');
$table->data['edit0'][1] = html_print_extended_select_for_time('dynamic_interval', '', '', 'None', '0', 10, true, 'width:150px', false);
$table->data['edit0'][1] = html_print_extended_select_for_time(
'dynamic_interval',
-2,
'',
'None',
'0',
10,
true,
'width:150px',
false,
'',
false,
false,
'',
true
);
$table->data['edit0'][2] = '<table width="100%"><tr><td><em>'.__('Dynamic Min.').'</em></td>';
$table->data['edit0'][2] .= '<td align="right">'.html_print_input_text('dynamic_min', '', '', 10, 255, true).'</td></tr>';
$table->data['edit0'][2] .= '<tr><td><em>'.__('Dynamic Max.').'</em></td>';
@ -2128,6 +2143,12 @@ function process_manage_edit($module_name, $agents_select=null, $module_status='
}
break;
case 'dynamic_interval':
if ($value !== '-2') {
$values[$field] = $value;
}
break;
case 'plugin_pass':
if ($value != '') {
$values['plugin_pass'] = io_input_password($value);

View File

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

View File

@ -100,16 +100,15 @@ if (! check_acl($config['id_user'], 0, 'AW')) {
$options_policies = [];
$policies_options = enterprise_hook('massive_policies_options');
$policies_options = array_unique($policies_options);
if ($policies_options != ENTERPRISE_NOT_HOOK) {
$policies_options = array_unique($policies_options);
$options_policies = array_merge($options_policies, $policies_options);
}
$options_snmp = [];
$snmp_options = enterprise_hook('massive_snmp_options');
$snmp_options = array_reverse($snmp_options);
if ($snmp_options != ENTERPRISE_NOT_HOOK) {
$snmp_options = array_reverse($snmp_options);
$options_snmp = array_merge($options_snmp, $snmp_options);
}

View File

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

View File

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

View File

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

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