Merge branch 'develop' into ent-11791-any-user-can-change-any-other-user-s-notification-settings

This commit is contained in:
miguel angel rasteu 2023-11-10 09:24:39 +01:00
commit c5e30c774b
411 changed files with 44127 additions and 17111 deletions

View File

@ -78,16 +78,16 @@ cd unix && ./pandora_agent_installer --install
} }
install_autodiscover () { # install_autodiscover () {
local arch=$1 # local arch=$1
wget http://firefly.pandorafms.com/projects/autodiscover-linux.zip # wget http://firefly.pandorafms.com/projects/autodiscover-linux.zip
unzip autodiscover-linux.zip # unzip autodiscover-linux.zip
chmod +x $arch/autodiscover # chmod +x $arch/autodiscover
mv -f $arch/autodiscover /etc/pandora/plugins/autodiscover # mv -f $arch/autodiscover /etc/pandora/plugins/autodiscover
} # }
## Main ## Main
echo "Starting PandoraFMS Agent deployment ver. $S_VERSION" echo "Starting PandoraFMS Agent binary deployment ver. $S_VERSION"
execute_cmd "[ $PANDORA_SERVER_IP ]" 'Check Server IP Address' 'Please define env variable PANDORA_SERVER_IP' execute_cmd "[ $PANDORA_SERVER_IP ]" 'Check Server IP Address' 'Please define env variable PANDORA_SERVER_IP'
@ -104,8 +104,6 @@ OS=$([[ $(grep '^ID_LIKE=' /etc/os-release) ]] && grep ^ID_LIKE= /etc/os-release
[[ $OS =~ 'rhel' ]] && OS_RELEASE=$OS [[ $OS =~ 'rhel' ]] && OS_RELEASE=$OS
[[ $OS =~ 'fedora' ]] && OS_RELEASE=$OS [[ $OS =~ 'fedora' ]] && OS_RELEASE=$OS
[[ $OS =~ 'debian' ]] && OS_RELEASE=$OS [[ $OS =~ 'debian' ]] && OS_RELEASE=$OS
#[[ $OS == 'rhel fedora' ]] && OS_RELEASE=$OS
#[[ $OS == 'centos rhel fedora' ]] && OS_RELEASE=$OS
# initialice logfile # initialice logfile
execute_cmd "echo 'Starting community deployment' > $LOGFILE" "All installer activity is logged on $LOGFILE" execute_cmd "echo 'Starting community deployment' > $LOGFILE" "All installer activity is logged on $LOGFILE"
@ -126,6 +124,30 @@ check_repo_connection
execute_cmd "grep --version" 'Checking needed tools: grep' execute_cmd "grep --version" 'Checking needed tools: grep'
execute_cmd "sed --version" 'Checking needed tools: sed' execute_cmd "sed --version" 'Checking needed tools: sed'
# Arch check
arch=$(uname -m)
case $arch in
x86_64)
echo -e "${cyan}Arch: $arch ${reset} "
;;
x86)
echo -e "${yellow}Skiping installation arch: $arch not suported by binary agent please consider to install source agent${reset}"
exit -1
;;
armv7l)
echo -e "${yellow}Skiping installation arch: $arch not suported by binary agent please consider to install source agent${reset}"
exit -1
;;
*)
echo -e "${yellow}Skiping installation arch: $arch not suported by binary agent please consider to install source agent${reset}"
exit -1
;;
esac
# Creating working directory # Creating working directory
rm -rf $HOME/pandora_deploy_tmp/ &>> $LOGFILE rm -rf $HOME/pandora_deploy_tmp/ &>> $LOGFILE
mkdir $HOME/pandora_deploy_tmp &>> $LOGFILE mkdir $HOME/pandora_deploy_tmp &>> $LOGFILE
@ -148,6 +170,10 @@ if [[ $OS_RELEASE =~ 'rhel' ]] || [[ $OS_RELEASE =~ 'fedora' ]]; then
# Check rh version # Check rh version
if [ $(sed -nr 's/VERSION_ID+=\s*"([0-9]).*"$/\1/p' /etc/os-release) -eq '8' ] ; then if [ $(sed -nr 's/VERSION_ID+=\s*"([0-9]).*"$/\1/p' /etc/os-release) -eq '8' ] ; then
package_manager_cmd=dnf package_manager_cmd=dnf
execute_cmd "$package_manager_cmd install -y libnsl" "Installing dependencies"
elif [ $(sed -nr 's/VERSION_ID+=\s*"([0-9]).*"$/\1/p' /etc/os-release) -eq '9' ] ; then
package_manager_cmd=dnf
execute_cmd "$package_manager_cmd install -y libnsl libxcrypt-compat" "Installing dependencies"
elif [ $(sed -nr 's/VERSION_ID+=\s*"([0-9]).*"$/\1/p' /etc/os-release) -eq '7' ] ; then elif [ $(sed -nr 's/VERSION_ID+=\s*"([0-9]).*"$/\1/p' /etc/os-release) -eq '7' ] ; then
package_manager_cmd=yum package_manager_cmd=yum
@ -158,24 +184,23 @@ if [[ $OS_RELEASE =~ 'rhel' ]] || [[ $OS_RELEASE =~ 'fedora' ]]; then
echo -e "${cyan}Installing agent dependencies...${reset}" ${green}OK${reset} echo -e "${cyan}Installing agent dependencies...${reset}" ${green}OK${reset}
# Insatall pandora agent # Insatall pandora agent
$package_manager_cmd install -y http://firefly.pandorafms.com/pandorafms/latest/RHEL_CentOS/pandorafms_agent_linux-7.0NG.noarch.rpm &>> $LOGFILE [ "$PANDORA_AGENT_PACKAGE_EL" ] || PANDORA_AGENT_PACKAGE_EL="https://firefly.pandorafms.com/pandorafms/latest/RHEL_CentOS/pandorafms_agent_linux_bin-7.0NG.x86_64.rpm "
echo -en "${cyan}Installing Pandora FMS agent...${reset}" execute_cmd "$package_manager_cmd install -y ${PANDORA_AGENT_PACKAGE_EL}" 'Installing Pandora FMS agent package'
check_cmd_status 'Error installing Pandora FMS agent' #[[ $PANDORA_AGENT_SSL ]] && execute_cmd "$package_manager_cmd install -y perl-IO-Socket-SSL" "Installing SSL libraries for encrypted connection"
[[ $PANDORA_AGENT_SSL ]] && execute_cmd "$package_manager_cmd install -y perl-IO-Socket-SSL" "Installing SSL libraries for encrypted connection"
fi fi
if [[ $OS_RELEASE == 'debian' ]]; then if [[ $OS_RELEASE == 'debian' ]]; then
[ "$PANDORA_AGENT_PACKAGE_UBUNTU" ] || PANDORA_AGENT_PACKAGE_UBUNTU='https://firefly.pandorafms.com/pandorafms/latest/Tarball/pandorafms_agent_linux-7.0NG_x86_64.tar.gz'
execute_cmd "apt update" 'Updating repos' execute_cmd "apt update" 'Updating repos'
execute_cmd "apt install -y perl wget curl unzip procps python3 python3-pip" 'Installing agent dependencies' execute_cmd "apt install -y perl wget curl unzip procps python3 python3-pip" 'Installing agent dependencies'
execute_cmd 'wget http://firefly.pandorafms.com/pandorafms/latest/Tarball/pandorafms_agent_linux-7.0NG.tar.gz' 'Downloading Pandora FMS agent package' execute_cmd "curl --output pandorafms_agent_linux-7.0NG.tar.gz ${PANDORA_AGENT_PACKAGE_UBUNTU}" 'Downloading Pandora FMS agent package'
execute_cmd 'install_tarball pandorafms_agent_linux-7.0NG.tar.gz' 'Installing Pandora FMS agent' execute_cmd 'install_tarball pandorafms_agent_linux-7.0NG.tar.gz' 'Installing Pandora FMS agent'
[[ $PANDORA_AGENT_SSL ]] && execute_cmd 'apt install -y libio-socket-ssl-perl' "Installing SSL libraries for encrypted connection" #[[ $PANDORA_AGENT_SSL ]] && execute_cmd 'apt install -y libio-socket-ssl-perl' "Installing SSL libraries for encrypted connection"
cd $HOME/pandora_deploy_tmp cd $HOME/pandora_deploy_tmp
fi fi
# Configuring Agente # Configuring Agente
[[ $PANDORA_SERVER_IP ]] && sed -i "s/^server_ip.*$/server_ip $PANDORA_SERVER_IP/g" $PANDORA_AGENT_CONF [[ $PANDORA_SERVER_IP ]] && sed -i "s/^server_ip.*$/server_ip $PANDORA_SERVER_IP/g" $PANDORA_AGENT_CONF
[[ $PANDORA_REMOTE_CONFIG ]] && sed -i "s/^remote_config.*$/remote_config $PANDORA_REMOTE_CONFIG/g" $PANDORA_AGENT_CONF [[ $PANDORA_REMOTE_CONFIG ]] && sed -i "s/^remote_config.*$/remote_config $PANDORA_REMOTE_CONFIG/g" $PANDORA_AGENT_CONF
[[ $PANDORA_GROUP ]] && sed -i "s/^group.*$/group $PANDORA_GROUP/g" $PANDORA_AGENT_CONF [[ $PANDORA_GROUP ]] && sed -i "s/^group.*$/group $PANDORA_GROUP/g" $PANDORA_AGENT_CONF
@ -187,27 +212,6 @@ fi
[[ $PANDORA_AGENT_SSL ]] && sed -i "s/^#server_ssl.*$/server_ssl $PANDORA_AGENT_SSL/g" $PANDORA_AGENT_CONF [[ $PANDORA_AGENT_SSL ]] && sed -i "s/^#server_ssl.*$/server_ssl $PANDORA_AGENT_SSL/g" $PANDORA_AGENT_CONF
#installing autodiscover
arch=$(uname -m)
case $arch in
x86_64)
execute_cmd 'install_autodiscover x86_64' "installing service autodiscover on $arch" 'Error unable to install autodiscovery'
;;
x86)
execute_cmd 'install_autodiscover x84' "installing service autodiscover on $arch" 'Error unable to install autodiscovery'
;;
armv7l)
echo -e "${cyan}Skiping autodiscover installation arch $arch not suported${reset}"
;;
*)
echo -e "${yellow}Skiping autodiscover installation arch $arch not suported${reset}"
;;
esac
#Starting pandora agent daemon. #Starting pandora agent daemon.
execute_cmd '/etc/init.d/pandora_agent_daemon restart' 'Starting Pandora Agent' execute_cmd '/etc/init.d/pandora_agent_daemon restart' 'Starting Pandora Agent'

1
extras/pandora_gotty/.gitattributes vendored Normal file
View File

@ -0,0 +1 @@
src/pandora_gotty filter=lfs diff=lfs merge=lfs -text

2
extras/pandora_gotty/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
*.rpm
*.deb

View File

@ -0,0 +1,8 @@
FROM rockylinux:8
RUN dnf install -y rpm-build rpmdevtools
RUN rpmdev-setuptree
RUN mkdir /root/pandora_gotty
WORKDIR /root/pandora_gotty
#CMD bash build.sh

View File

@ -0,0 +1,6 @@
FROM ubuntu:22.04
RUN apt-get update
RUN apt-get install -y dh-make debhelper build-essential
RUN mkdir /root/pandora_gotty
WORKDIR /root/pandora_gotty

View File

@ -0,0 +1 @@
To create the .deb and .rpm package need to hace docker installed on main system and execit `build_all_docker.sh`

View File

@ -0,0 +1,11 @@
#Build RPM
docker build -t pandora_gotty_builder_rpm -f Dockerfile-RPM . || exit 1
docker run --rm -it -v `pwd`:/root/pandora_gotty pandora_gotty_builder_rpm /root/pandora_gotty/build_rpm.sh || exit 1
#Buikd DEB
docker build -t pandora_gotty_builder_deb -f Dockerfile-deb . || exit 1
docker run --rm -it -v `pwd`:/root/pandora_gotty pandora_gotty_builder_deb /root/pandora_gotty/build_deb.sh || exit 1
echo " - Done"
pwd
ls -l | grep -E "(\.deb|\.rpm)"

View File

@ -0,0 +1,17 @@
#!/bin/bash
#DEB
cd deb
VERSION=$(grep 'Version:' pandora_gotty/DEBIAN/control | awk '{print $2}')
mkdir -p pandora_gotty/usr/bin
mkdir -p pandora_gotty/etc/pandora_gotty
cp -a ../src/pandora_gotty pandora_gotty/usr/bin
cp -a ../src/pandora_gotty.conf pandora_gotty/etc/pandora_gotty
curl -SsL --output pandora_gotty/usr/bin/pandora_gotty_exec http://192.168.50.31/installers/installers/Linux/x86_64/pandora_gotty_exec
chmod +x pandora_gotty/usr/bin/pandora_gotty_exec
dpkg-deb --build pandora_gotty
mv pandora_gotty.deb ../
rm -rf pandora_gotty/usr/
rm -rf pandora_gotty/etc/
cd ..
mv pandora_gotty.deb pandora_gotty_${VERSION}.deb
chmod 777 pandora_gotty_${VERSION}.deb

View File

@ -0,0 +1,15 @@
#!/bin/bash
#RPM
VERSION=$(grep '%define version' pandora_gotty.spec | awk '{print $3}')
mkdir -p pandora_gotty-${VERSION}
cp src/pandora_gotty pandora_gotty-${VERSION}/
cp src/pandora_gotty.conf pandora_gotty-${VERSION}/
curl -SsL --output pandora_gotty-${VERSION}/pandora_gotty_exec http://192.168.50.31/installers/installers/Linux/x86_64/pandora_gotty_exec
chmod +x pandora_gotty-${VERSION}/pandora_gotty_exec
tar -cvzf pandora_gotty-${VERSION}.tar.gz pandora_gotty-${VERSION}/*
mv pandora_gotty-${VERSION}.tar.gz ${HOME}/rpmbuild/SOURCES/
rm -rf ${HOME}/rpmbuild/RPMS/x86_64/pandora_gotty*
rpmbuild -ba pandora_gotty.spec
rm -rf pandora_gotty-${VERSION}
mv ${HOME}/rpmbuild/RPMS/x86_64/pandora_gotty* .
chmod 777 *.rpm

3
extras/pandora_gotty/deb/.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
*.deb
**/usr
**/etc

View File

@ -0,0 +1,5 @@
pandora_gotty (1.0-1) stable; urgency=low
* Initial release.
-- PandoraFMS Mon, 18 Sep 2023 00:00:00 +0000

View File

@ -0,0 +1,9 @@
Source: pandora_gotty
Section: utils
Version: 1.1.0
Priority: optional
Maintainer: PandoraFMS
Build-Depends: debhelper (>= 12)
Package: pandora-gotty
Architecture: amd64
Description: pandora_gotty for Pandora FMS.

View File

@ -0,0 +1,41 @@
%define name pandora_gotty
%define version 1.1
%define release 1%{?dist}
Summary: pandora_gptty for Pandora FMS
Name: %{name}
Version: %{version}
Release: %{release}
License: GPL
Vendor: PandoraFMS
Source0: %{name}-%{version}.tar.gz
URL: https://pandorafms.com
Group: System/Monitoring
Packager: PandoraFMS
BuildArch: x86_64
Provides: %{name}-%{version}
%description
pandora_gotty for Pandora FMS.
%prep
%setup -q
%install
rm -rf $RPM_BUILD_ROOT
mkdir -p $RPM_BUILD_ROOT/%{_bindir}
mkdir -p %{buildroot}/etc/pandora_gotty/
cp %{name} $RPM_BUILD_ROOT/%{_bindir}
cp pandora_gotty_exec $RPM_BUILD_ROOT/%{_bindir}
cp pandora_gotty.conf %{buildroot}/etc/pandora_gotty/
%clean
rm -Rf $RPM_BUILD_ROOT
%files
%defattr(-,root,root,-)
%config(noreplace) /etc/pandora_gotty/pandora_gotty.conf
%{_bindir}/%{name}
%{_bindir}/pandora_gotty_exec
%changelog
* Mon Sep 18 2023 PandoraFMS - 1.0-1
- Initial RPM release

2
extras/pandora_gotty/src/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
*rpm
bin/*

View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:3758eddb64db79c6ea1dac4cb200ee8ec86ef3f51723dad5be4365a1315b952b
size 13642854

View File

@ -0,0 +1,29 @@
//Pandora Gotty config file
// [bool] Permit clients to write to the TTY
permit_write = true
// [bool] Permit clients to send command line arguments in URL (e.g. http://example.com:8080/?arg=AAA&arg=BBB)
permit_arguments = true
// [bool] Enable random URL generation
enable_random_url = true
// [int] Default length of random strings appended to URL
// To enable random URL generation, set `true` to `enable_random_url`
random_url_length = 32
// [bool] Enable TLS/SSL
// enable_tls = false
// [string] Default TLS certificate file path
// tls_crt_file = "~/.gotty.crt"
// [string] Default TLS key file path
// tls_key_file = "~/.gotty.key"
// [bool] Enable client certificate authentication
// enable_tls_client_auth = false
// [string] Certificate file of CA for client certificates
// tls_ca_crt_file = "~/.gotty.ca.crt"

View File

@ -0,0 +1,110 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = "PandoraFMS Team"
__copyright__ = "Copyright 2023, PandoraFMS"
#__credits__ = ["Rob Knight", "Peter Maxwell", "Gavin Huttley", "Matthew Wakefield"]
__maintainer__ = "Projects/QA department"
__status__ = "Prod"
__version__ = "1.0"
import sys, argparse, signal, re, datetime, subprocess
info= f"""
SSH and TELNET helper for pandora_gotty.
Version: {__version__}
"""
parser = argparse.ArgumentParser(description= info, formatter_class=argparse.RawTextHelpFormatter)
parser.add_argument('exec_cmd',
help='Aplication to be executed, avalibles: ssh or telnet',type=str, choices=['ssh', 'telnet'])
parser.add_argument('address',
help='IP addres or dns name to connect', type=str, default="")
parser.add_argument('port',
help='Port to connect', type=int, default=23)
parser.add_argument('user',
help='Username, only requiered for ssh connection', type=str, default="", nargs='?')
args = parser.parse_args()
# Define a function to handle the SIGINT signal
def sigint_handler(signal, frame):
print ('\nInterrupted by user', file=sys.stderr)
sys.exit(0)
signal.signal(signal.SIGINT, sigint_handler)
# Define a function to handle the SIGTERM signal
def sigterm_handler(signum, frame):
print("Received SIGTERM signal.", file=sys.stderr)
sys.exit(0)
signal.signal(signal.SIGTERM, sigterm_handler)
# Functions
def is_valid_add(add:str):
# Regular expression to match an IP address
ip_pattern = r'^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$'
# Regular expression to match a DNS name (domain name)
dns_pattern = r'^[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$'
if re.match(ip_pattern, add) or re.match(dns_pattern, add):
return True
else:
print(f"Error not valid address: {add}", file=sys.stderr)
return False
def is_valid_username(username:str):
# Regular expression to match a valid Linux username
username_pattern = r'^[a-zA-Z_][a-zA-Z0-9_]{0,31}$'
if re.match(username_pattern, username) is not None:
return True
else:
print(f"Error not valid username: {username}", file=sys.stderr)
return False
def exec_ssh (user:str, add:str, port:int):
# Previus checks
if is_valid_username(user) == False:
return False
if is_valid_add(add) == False:
return False
if port == 0 :
return False
try:
print("> Starting SSH connection...")
ssh_command = f"ssh {user}@{add} -p {port}"
subprocess.run(ssh_command, shell=True, encoding='utf-8', text=True)
except subprocess.CalledProcessError as e:
raise SystemExit(e)
return True
def exec_telnet (add:str, port:int):
# Previus checks
if is_valid_add(add) == False:
return False
try:
print("> Starting Telnet connection...")
ssh_command = f"telnet -E {add} {port}"
subprocess.run(ssh_command, shell=True, encoding='utf-8', text=True)
except subprocess.CalledProcessError as e:
raise SystemExit(e)
return True
# Main
if __name__ == "__main__":
if args.exec_cmd == "ssh":
exec_ssh(args.user, args.address, args.port)
print ("> ssh session finished")
sys.exit(0)
if args.exec_cmd == "telnet":
exec_telnet(args.address, args.port)
print ("> telnet session finished")
sys.exit(0)
sys.exit(0)

View File

@ -22,13 +22,16 @@ else
fi fi
SPEC_FILES="$CODEHOME/pandora_console/pandora_console.spec \ SPEC_FILES="$CODEHOME/pandora_console/pandora_console.spec \
$CODEHOME/pandora_agents/unix/pandora_agent.spec \ $CODEHOME/pandora_agents/unix/pandora_agent.spec \
$CODEHOME/pandora_agents/unix/pandora_agent.redhat_bin.el8.spec \
$CODEHOME/pandora_agents/unix/pandora_agent.redhat_bin.el9.spec \
$CODEHOME/pandora_agents/unix/pandora_agent.redhat_bin.spec \
$CODEHOME/pandora_agents/unix/pandora_agent.redhat.spec \
$CODEHOME/pandora_server/pandora_server.spec \ $CODEHOME/pandora_server/pandora_server.spec \
$PANDHOME_ENT/pandora_console/enterprise/pandora_console_enterprise.spec \ $PANDHOME_ENT/pandora_console/enterprise/pandora_console_enterprise.spec \
$PANDHOME_ENT/pandora_server/PandoraFMS-Enterprise/pandora_server_enterprise.spec \ $PANDHOME_ENT/pandora_server/PandoraFMS-Enterprise/pandora_server_enterprise.spec \
$CODEHOME/pandora_console/pandora_console.redhat.spec \ $CODEHOME/pandora_console/pandora_console.redhat.spec \
$CODEHOME/pandora_console/pandora_console.rhel7.spec \ $CODEHOME/pandora_console/pandora_console.rhel7.spec \
$CODEHOME/pandora_agents/unix/pandora_agent.redhat.spec \ $CODEHOME/pandora_agents/unix/pandora_agent.redhat.spec \
$CODEHOME/pandora_agents/unix/pandora_agent.redhat_bin.spec \
$CODEHOME/pandora_server/pandora_server.redhat.spec \ $CODEHOME/pandora_server/pandora_server.redhat.spec \
$PANDHOME_ENT/pandora_agents/pandora_agent.spec \ $PANDHOME_ENT/pandora_agents/pandora_agent.spec \
$PANDHOME_ENT/pandora_server/pandora_server_enterprise.redhat.spec \ $PANDHOME_ENT/pandora_server/pandora_server_enterprise.redhat.spec \

View File

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

View File

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

View File

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

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.773.3, GNU/Linux # Version 7.0NG.774, GNU/Linux
# Licensed under GPL license v2, # Licensed under GPL license v2,
# Copyright (c) 2003-2023 Pandora FMS # Copyright (c) 2003-2023 Pandora FMS
# http://www.pandorafms.com # http://www.pandorafms.com
@ -166,7 +166,7 @@ module_description User CPU Usage (%)
module_min_warning 70 module_min_warning 70
module_max_warning 90 module_max_warning 90
module_min_critical 91 module_min_critical 91
module_max_critical 100 module_max_critical 0
module_unit % module_unit %
module_end module_end
@ -300,3 +300,7 @@ module_plugin grep_log /var/log/syslog Syslog ssh
#module_exec echo 5 #module_exec echo 5
#module_description Postcondition test module #module_description Postcondition test module
#module_end #module_end
# This plugin runs several security checks in a Linux system
#module_plugin pandora_security_check

View File

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

View File

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

View File

@ -1,6 +1,6 @@
# Base config file for Pandora FMS Windows Agent # Base config file for Pandora FMS Windows Agent
# (c) 2006-2023 Pandora FMS # (c) 2006-2023 Pandora FMS
# Version 7.0NG.773.3 # Version 7.0NG.774
# This program is Free Software, you can redistribute it and/or modify it # This program is Free Software, you can redistribute it and/or modify it
# under the terms of the GNU General Public Licence as published by the Free Software # under the terms of the GNU General Public Licence as published by the Free Software
# Foundation; either version 2 of the Licence or any later version # Foundation; either version 2 of the Licence or any later version
@ -119,7 +119,7 @@ module_description CPU Load (%)
module_min_warning 80 module_min_warning 80
module_max_warning 90 module_max_warning 90
module_min_critical 91 module_min_critical 91
module_max_critical 100 module_max_critical 0
module_end module_end
# Number processes # Number processes

View File

@ -1,2 +1,3 @@
@at 00:00 /every:1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30 "%CD%\restart_pandora_agent.bat" @at 00:00 /every:1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30 "'%CD%\restart_pandora_agent.bat'"
schtasks /change /tn pandora_agent_restart /tr "'%CD%\restart_pandora_agent.bat'"

View File

@ -54,7 +54,6 @@ if (!$@) {
use constant AGENT_VERSION => '4.0.1'; use constant AGENT_VERSION => '4.0.1';
use constant AGENT_BUILD => '111213'; use constant AGENT_BUILD => '111213';
# Commands to retrieve total memory information in kB # Commands to retrieve total memory information in kB
use constant TOTALMEMORY_CMDS => { use constant TOTALMEMORY_CMDS => {
linux => 'cat /proc/meminfo | grep MemTotal: | awk \'{ print $2 }\'', linux => 'cat /proc/meminfo | grep MemTotal: | awk \'{ print $2 }\'',
@ -117,7 +116,6 @@ my $ConfDir = '';
# Pandora FMS agent configuration file # Pandora FMS agent configuration file
my $ConfFile = 'pandora_agent.conf'; my $ConfFile = 'pandora_agent.conf';
# Broker agent configuration files # Broker agent configuration files
my @BrokerPid; my @BrokerPid;
@ -264,7 +262,6 @@ sub valid_regexp ($) {
sub rmrf { sub rmrf {
my $path = shift; my $path = shift;
local *DIR; local *DIR;
if (-d $path) { if (-d $path) {
opendir (DIR, $path) || return; opendir (DIR, $path) || return;
while (defined (my $file_name = readdir(DIR))) { while (defined (my $file_name = readdir(DIR))) {
@ -348,7 +345,6 @@ sub log_message ($$;$) {
} }
} }
} }
################################################################################ ################################################################################
# Add the given directory to the PATH. # Add the given directory to the PATH.
################################################################################ ################################################################################
@ -582,7 +578,6 @@ sub write_broker_conf($){
} }
while (my $line = <CONF_FILE>){ while (my $line = <CONF_FILE>){
# Skip broker definitions # Skip broker definitions
if ($line =~ m/^\s*broker_agent/) { if ($line =~ m/^\s*broker_agent/) {
next; next;
@ -1810,7 +1805,6 @@ sub exec_plugin ($) {
$Sem->down () if (defined ($Sem)); $Sem->down () if (defined ($Sem));
$Xml .= $output; $Xml .= $output;
$Sem->up () if (defined ($Sem)); $Sem->up () if (defined ($Sem));
$ThreadSem->up () if (defined ($ThreadSem) && $Conf{'agent_threads'} > 1); $ThreadSem->up () if (defined ($ThreadSem) && $Conf{'agent_threads'} > 1);
} }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,5 +1,5 @@
package: pandorafms-agent-unix package: pandorafms-agent-unix
Version: 7.0NG.773.3-230904 Version: 7.0NG.774-231110
Architecture: all Architecture: all
Priority: optional Priority: optional
Section: admin Section: admin

View File

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

View File

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

View File

@ -19,11 +19,11 @@
<choice id="com.pandorafms.pandorafms_src" visible="false"> <choice id="com.pandorafms.pandorafms_src" visible="false">
<pkg-ref id="com.pandorafms.pandorafms_src"/> <pkg-ref id="com.pandorafms.pandorafms_src"/>
</choice> </choice>
<pkg-ref id="com.pandorafms.pandorafms_src" version="7.0NG.773.3" onConclusion="none">pandorafms_src.pdk</pkg-ref> <pkg-ref id="com.pandorafms.pandorafms_src" version="7.0NG.774" onConclusion="none">pandorafms_src.pdk</pkg-ref>
<choice id="com.pandorafms.pandorafms_uninstall" visible="true" customLocation="/Applications"> <choice id="com.pandorafms.pandorafms_uninstall" visible="true" customLocation="/Applications">
<pkg-ref id="com.pandorafms.pandorafms_uninstall"/> <pkg-ref id="com.pandorafms.pandorafms_uninstall"/>
</choice> </choice>
<pkg-ref id="com.pandorafms.pandorafms_uninstall" version="7.0NG.773.3" onConclusion="none">pandorafms_uninstall.pdk</pkg-ref> <pkg-ref id="com.pandorafms.pandorafms_uninstall" version="7.0NG.774" onConclusion="none">pandorafms_uninstall.pdk</pkg-ref>
<!-- <installation-check script="check()" /> <!-- <installation-check script="check()" />
<script> <script>
<![CDATA[ <![CDATA[

View File

@ -5,9 +5,9 @@
<key>CFBundleIconFile</key> <string>pandorafms.icns</string> <key>CFBundleIconFile</key> <string>pandorafms.icns</string>
<key>CFBundleIdentifier</key> <string>com.pandorafms.pandorafms_uninstall</string> <key>CFBundleIdentifier</key> <string>com.pandorafms.pandorafms_uninstall</string>
<key>CFBundleVersion</key> <string>7.0NG.773.3</string> <key>CFBundleVersion</key> <string>7.0NG.774</string>
<key>CFBundleGetInfoString</key> <string>7.0NG.773.3 Pandora FMS on Aug 2020</string> <key>CFBundleGetInfoString</key> <string>7.0NG.774 Pandora FMS on Aug 2020</string>
<key>CFBundleShortVersionString</key> <string>7.0NG.773.3</string> <key>CFBundleShortVersionString</key> <string>7.0NG.774</string>
<key>NSPrincipalClass</key><string>NSApplication</string> <key>NSPrincipalClass</key><string>NSApplication</string>
<key>NSMainNibFile</key><string>MainMenu</string> <key>NSMainNibFile</key><string>MainMenu</string>

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.773.3, GNU/Linux # Version 7.0NG.774, GNU/Linux
# Licensed under GPL license v2, # Licensed under GPL license v2,
# Copyright (c) 2003-2023 Pandora FMS # Copyright (c) 2003-2023 Pandora FMS
# http://www.pandorafms.com # http://www.pandorafms.com
@ -187,7 +187,7 @@ module_description User CPU Usage (%)
module_min_warning 70 module_min_warning 70
module_max_warning 90 module_max_warning 90
module_min_critical 91 module_min_critical 91
module_max_critical 100 module_max_critical 0
module_end module_end
#Get load average #Get load average
@ -239,8 +239,34 @@ module_exec df -kh / | tail -1 | awk '{ print 100-$5 }'
module_max 100 module_max 100
module_min 0 module_min 0
module_description Free disk Percentage of root partition module_description Free disk Percentage of root partition
module_min_warning 70 module_min_warning 10
module_max_warning 90 module_max_warning 20
module_min_critical 91 module_min_critical 0
module_max_critical 100 module_max_critical 10
module_end module_end
# Sample modules to check connectivity from your mac
#module_begin
#module_name Packet_loss
#module_type generic_data
#module_exec ping 8.8.8.8 -c 5 | grep "packet loss" | cut -d " " -f 7 | grep -o "[0-9\.]*"
#module_end
#module_begin
#module_name Internet_Latency
#module_type generic_data
#module_exec ping -c 1 8.8.8.8 | grep "time"| cut -f 4 -d "=" | grep -o "[0-9\.]*"
#module_end
#module_begin
#module_name Internet_check
#module_type generic_proc
#module_exec ping 8.8.8.8 -c 2 | grep "2 packets received" | wc -l
#module_end
# Check a running process
#module_begin
#module_name Cyberduck
#module_type generic_proc
#module_exec ps aux | grep cyberduck | grep -v grep | wc -l
#module_end

View File

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

View File

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

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.773.3 # Version 7.0NG.774
# Licensed under GPL license v2, # Licensed under GPL license v2,
# Copyright (c) 2004-2023 Pandora FMS # Copyright (c) 2004-2023 Pandora FMS
# https://pandorafms.com # https://pandorafms.com
@ -219,7 +219,7 @@ module_description User CPU Usage (%)
module_min_warning 70 module_min_warning 70
module_max_warning 90 module_max_warning 90
module_min_critical 91 module_min_critical 91
module_max_critical 100 module_max_critical 0
module_unit % module_unit %
module_group System module_group System
module_end module_end
@ -313,6 +313,15 @@ module_plugin autodiscover --default
#Hardening plugin for security compliance analysis. Enable to use it. #Hardening plugin for security compliance analysis. Enable to use it.
#module_begin #module_begin
#module_plugin /usr/share/pandora_agent/plugins/pandora_sca #module_plugin /usr/share/pandora_agent/plugins/pandora_hardening -t 150
#module_absoluteinterval 7d #module_absoluteinterval 7d
#module_end #module_end
# Logs extraction
#module_begin
#module_name Syslog
#module_description Logs extraction module
#module_type log
#module_regexp /var/log/logfile.log
#module_pattern .*
#module_end

View File

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

View File

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

View File

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

View File

@ -39,6 +39,14 @@ BEGIN {
use File::Copy; use File::Copy;
use Scalar::Util qw(looks_like_number); use Scalar::Util qw(looks_like_number);
use File::Basename;
BEGIN {
eval {
require MIME::Base64;
};
}
BEGIN { push @INC, '/usr/lib/perl5'; } BEGIN { push @INC, '/usr/lib/perl5'; }
################################################################################ ################################################################################
@ -1030,8 +1038,8 @@ my $Sem = undef;
# Semaphore used to control the number of threads # Semaphore used to control the number of threads
my $ThreadSem = undef; my $ThreadSem = undef;
use constant AGENT_VERSION => '7.0NG.773.3'; use constant AGENT_VERSION => '7.0NG.774';
use constant AGENT_BUILD => '230904'; use constant AGENT_BUILD => '231110';
# Agent log default file size maximum and instances # Agent log default file size maximum and instances
use constant DEFAULT_MAX_LOG_SIZE => 600000; use constant DEFAULT_MAX_LOG_SIZE => 600000;
@ -1562,6 +1570,9 @@ sub parse_conf_modules($) {
} elsif ($line =~ /^\s*module_occupiedpercentdisk\s+(.*)$/) { } elsif ($line =~ /^\s*module_occupiedpercentdisk\s+(.*)$/) {
$module->{'func'} = \&module_occupiedpercentdisk; $module->{'func'} = \&module_occupiedpercentdisk;
$module->{'params'} = $1; $module->{'params'} = $1;
}elsif ($line =~ /^\s*module_regexp\s+(.*)$/) {
$module->{'func'} = \&module_logger;
$module->{'params'} = $1;
} elsif ($line =~ /^\s*module_max\s+(.*)\s*$/) { } elsif ($line =~ /^\s*module_max\s+(.*)\s*$/) {
$module->{'max'} = $1; $module->{'max'} = $1;
} elsif ($line =~ /^\s*module_min\s+(.*)\s*$/) { } elsif ($line =~ /^\s*module_min\s+(.*)\s*$/) {
@ -1817,6 +1828,10 @@ sub parse_conf_modules($) {
# Macros # Macros
} elsif ($line =~ /^\s*module_macro(\S+)\s+(.*)\s*$/) { } elsif ($line =~ /^\s*module_macro(\S+)\s+(.*)\s*$/) {
$module->{'macros'}{$1} = $2; $module->{'macros'}{$1} = $2;
# Regexp
}
elsif ($line =~ /^\s*module_pattern(\S+)\s+(.*)\s*$/) {
$module->{'filter'} = $1;
} }
} }
return; return;
@ -3663,6 +3678,11 @@ sub write_module_xml ($@) {
return; return;
} }
if ($module->{'func'} == \&module_logger) {
$Xml .= $data[0];
return
}
# Critical section # Critical section
$Sem->down () if (defined ($Sem)); $Sem->down () if (defined ($Sem));
@ -3860,6 +3880,237 @@ sub module_plugin ($) {
return ($output); return ($output);
} }
################################################################################
# Read the logs
################################################################################
sub module_logger ($) {
my $module = shift;
my $status = grep_logs(
$module->{'name'},
$module->{'params'},
$module->{'filter'}
);
return $status;
}
my $encode_sub = defined(&MIME::Base64::encode_base64) ? \&MIME::Base64::encode_base64 : sub {
my ($str, $endl) = @_;
my @ALPHABET = ('A'..'Z', 'a'..'z', 0..9, '+', '/');
my $str_len = length($str);
my $str_base64 = '';
for (my $i = 0; $i < $str_len; $i += 3) {
my $chunk = substr($str, $i, 3);
my $chunk_len = length($chunk);
my $num = 0;
$num |= ord(substr($chunk, 0, 1)) << 16 if ($chunk_len >= 1);
$num |= ord(substr($chunk, 1, 1)) << 8 if ($chunk_len >= 2);
$num |= ord(substr($chunk, 2, 1)) if ($chunk_len == 3);
my $enc_1 = ($num & 0xfc0000) >> 18;
my $enc_2 = ($num & 0x03f000) >> 12;
my $enc_3 = ($num & 0x000fc0) >> 6;
my $enc_4 = ($num & 0x00003f);
$str_base64 .= $ALPHABET[$enc_1];
$str_base64 .= $ALPHABET[$enc_2];
$str_base64 .= $chunk_len >= 2 ? $ALPHABET[$enc_3] : '=';
$str_base64 .= $chunk_len == 3 ? $ALPHABET[$enc_4] : '=';
}
return $str_base64;
};
sub grep_logs {
my ($str_name, $str_file, $str_regex) = @_;
if(!$str_name){
log_message("module_logger", "Missing module name");
return;
}
if(!$str_file){
log_message("module_logger", "Missing file name");
return;
}
if(!$str_regex){
$str_regex = '.*';
}
my $idx_dir = '/tmp/';
my $idx_file = '';
my $idx_pos = 0;
my $idx_size = 0;
my $idx_ino = '';
my $module_name = $str_name;
my $log_file = $str_file;
my $reg_exp = $str_regex;
# Check that log file exists
if (! -e $log_file) {
log_message("module_logger", "File $log_file does not exist");
return;
}
# Create index file storage directory
if (! -d $idx_dir) {
if (!mkdir($idx_dir)){
log_message("module_logger", "Error creating directory $idx_dir: " . $!);
return;
}
}
# Create index file if it does not exist
$idx_file = $idx_dir.$module_name."_".basename($log_file).".idx";
if (! -e $idx_file) {
return if create_idx(\$idx_pos, \$idx_ino, \$idx_file, \$log_file, \$idx_size) == 1;
return
} else{
return if load_idx(\$idx_pos, \$idx_ino, \$idx_file, \$idx_size) == 1;
my @data = parse_log(\$idx_pos, \$idx_ino, \$idx_file, \$log_file, \$module_name, \$reg_exp, \$idx_size);
my $output = create_log($module_name, @data);
return $output;
}
# Start the function definition
sub create_idx {
my ($idx_pos_ref, $idx_ino_ref, $idx_file_ref, $log_file_ref, $idx_size_ref) = @_;
my $first_line;
log_message("module_logger", "Creating index file $$idx_file_ref");
if (!open(LOGFILE, $$log_file_ref)){
log_message("module_logger", "Error opening file $$log_file_ref: ".$!);
return 1;
}
# Go to EOF and save the position
seek(LOGFILE, 0, 2);
$$idx_pos_ref = tell(LOGFILE);
close(LOGFILE);
# Save the file inode number
$$idx_ino_ref = (stat($$log_file_ref))[1];
return 1 if save_idx($idx_pos_ref, $idx_ino_ref, $idx_file_ref, $idx_size_ref) == 1;
return 0;
}
sub save_idx {
my ($idx_pos_ref, $idx_ino_ref, $idx_file_ref, $idx_size_ref) = @_;
log_message("module_logger", "Saving index file $$idx_file_ref");
if (!open(IDXFILE, "> $$idx_file_ref")){
log_message("module_logger", "Error opening file $$idx_file_ref: ". $!);
return 1;
}
print (IDXFILE $$idx_pos_ref . " " . $$idx_ino_ref . " " . $$idx_size_ref);
close(IDXFILE);
return 0;
}
sub load_idx {
my ($idx_pos_ref, $idx_ino_ref, $idx_file_ref, $idx_size_ref) = @_;
my $line;
my $current_ino;
my $current_size;
log_message("module_logger", "Loading index file $$idx_file_ref");
if (!open(IDXFILE, $$idx_file_ref)){
log_message("module_logger", "Error opening file $$idx_file_ref: " .$!);
return 1;
}
# Read position and date
$line = <IDXFILE>;
($$idx_pos_ref, $$idx_ino_ref, $$idx_size_ref) = split(' ', $line);
close(IDXFILE);
# Reset the file index if the file has changed
$current_ino = (stat($$idx_file_ref))[1];
$current_size = -s "$$idx_file_ref";
if ($current_ino != $$idx_ino_ref || $current_size < $$idx_size_ref) {
log_message("module_logger", "File changed, resetting index");
$$idx_pos_ref = 0;
$$idx_ino_ref = $current_ino;
}
$$idx_size_ref = $current_size;
return 0;
}
sub parse_log {
my ($idx_pos_ref, $idx_ino_ref, $idx_file_ref, $log_file_ref, $module_name_ref, $reg_exp_ref, $idx_size_ref) = @_;
my $line;
log_message("module_logger", "Parsing log file $$log_file_ref");
# Open log file for reading
if (!open(LOGFILE, $$log_file_ref)){
log_message("module_logger", "Error opening file $$log_file_ref: " . $!);
return 1;
}
# Go to starting position.
seek(LOGFILE, $$idx_pos_ref, 0);
# Parse log file
my @data;
while ($line = <LOGFILE>) {
if ($line =~ m/$$reg_exp_ref/i) {
push (@data, $line);
}
}
$$idx_pos_ref = tell(LOGFILE);
close(LOGFILE);
# Save the index file
return 1 if save_idx($idx_pos_ref, $idx_ino_ref, $idx_file_ref, $idx_size_ref) == 1;
return @data;
}
sub create_log {
my ($module_name, @data) = @_;
# No data
if ($#data < 0) {
return;
}
# Log module
my $output = "<log_module>\n";
$output .= "<source><![CDATA[" . $module_name . "]]></source>\n";
$output .= "<encoding>base64</encoding>\n";
$output .= "<data><![CDATA[";
$output .= &$encode_sub(join('', @data), '');
$output .= "]]></data>\n";
$output .= "</log_module>\n";
return $output;
}
}
################################################################################ ################################################################################
# TERM Handler # TERM Handler
################################################################################ ################################################################################
@ -4030,6 +4281,8 @@ sub init_module ($) {
$module->{'module_ff_interval'} = undef; $module->{'module_ff_interval'} = undef;
$module->{'macros'} = {}; $module->{'macros'} = {};
$module->{'alert_template'} = undef; $module->{'alert_template'} = undef;
$module->{'filter'} = undef;
$module->{'absoluteinterval'} = undef;
} }
################################################################################ ################################################################################

View File

@ -3,8 +3,8 @@
# #
%global __os_install_post %{nil} %global __os_install_post %{nil}
%define name pandorafms_agent_linux %define name pandorafms_agent_linux
%define version 7.0NG.773.3 %define version 7.0NG.774
%define release 230904 %define release 231110
Summary: Pandora FMS Linux agent, PERL version Summary: Pandora FMS Linux agent, PERL version
Name: %{name} Name: %{name}

View File

@ -0,0 +1,169 @@
#
#Pandora FMS Linux Agent
#
%global __os_install_post %{nil}
%define name pandorafms_agent_linux_bin
%define source_name pandorafms_agent_linux
%define version 7.0NG.774
%define release 231110
%define debug_package %{nil}
Summary: Pandora FMS Linux agent, binary version
Name: %{name}
Version: %{version}
Release: %{release}
License: GPL
Vendor: ArticaST <http://www.artica.es>
Source0: %{source_name}-%{version}.tar.gz
URL: http://pandorafms.org
Group: System/Monitoring
Packager: Sancho Lerena <slerena@artica.es>
Prefix: /usr/share
BuildRoot: %{_tmppath}/%{name}-%{version}-buildroot
BuildArch: x86_64
Requires(pre): shadow-utils
Requires(post): chkconfig /bin/ln
Requires(preun): chkconfig /bin/rm /usr/sbin/userdel
Requires: coreutils unzip
Requires: util-linux procps grep
Requires: /sbin/ip /bin/awk
Requires: perl-interpreter
Requires: perl-IO-Compress
Requires: libnsl
AutoReq: 0
Provides: %{name}-%{version}
%description
Pandora FMS agent for unix. Pandora FMS is an OpenSource full-featured monitoring software.
%prep
rm -rf $RPM_BUILD_ROOT
%setup -q -n unix
%build
%install
rm -rf $RPM_BUILD_ROOT
mkdir -p $RPM_BUILD_ROOT%{prefix}/pandora_agent/
mkdir -p $RPM_BUILD_ROOT/usr/bin/
mkdir -p $RPM_BUILD_ROOT/usr/sbin/
mkdir -p $RPM_BUILD_ROOT/etc/pandora/
mkdir -p $RPM_BUILD_ROOT/etc/rc.d/init.d/
mkdir -p $RPM_BUILD_ROOT/var/log/pandora/
mkdir -p $RPM_BUILD_ROOT/usr/share/man/man1/
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/
cp -aRf * $RPM_BUILD_ROOT%{prefix}/pandora_agent/
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/tentacle_client $RPM_BUILD_ROOT/usr/bin/
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/pandora_agent $RPM_BUILD_ROOT/usr/bin/
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/pandora_agent_exec $RPM_BUILD_ROOT/usr/bin/
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/pandora_agent_daemon $RPM_BUILD_ROOT/etc/rc.d/init.d/pandora_agent_daemon
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/man/man1/pandora_agent.1.gz $RPM_BUILD_ROOT/usr/share/man/man1/
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/man/man1/tentacle_client.1.gz $RPM_BUILD_ROOT/usr/share/man/man1/
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/Linux/pandora_agent.conf $RPM_BUILD_ROOT/usr/share/pandora_agent/pandora_agent.conf.rpmnew
install -m 0644 pandora_agent_logrotate $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/pandora_agent
if [ -f $RPM_BUILD_ROOT%{prefix}/pandora_agent/pandora_agent.spec ] ; then
rm $RPM_BUILD_ROOT%{prefix}/pandora_agent/pandora_agent.spec
fi
%clean
rm -Rf $RPM_BUILD_ROOT
%pre
getent passwd pandora >/dev/null || \
/usr/sbin/useradd -d %{prefix}/pandora -s /bin/false -M -g 0 pandora
exit 0
chown pandora:root /var/log/pandora
%post
if [ ! -d /etc/pandora ] ; then
mkdir -p /etc/pandora
fi
if [ ! -f /usr/share/pandora_agent/pandora_agent.conf ] ; then
cp /usr/share/pandora_agent/pandora_agent.conf.rpmnew /usr/share/pandora_agent/pandora_agent.conf
fi
if [ ! -f /etc/pandora/pandora_agent.conf ] ; then
ln -s /usr/share/pandora_agent/pandora_agent.conf /etc/pandora/pandora_agent.conf
else
[[ ! -f /etc/pandora/pandora_agent.conf.rpmnew ]] && ln -s /usr/share/pandora_agent/pandora_agent.conf.rpmnew /etc/pandora/pandora_agent.conf.rpmnew
fi
if [ ! -e /etc/pandora/plugins ]; then
ln -s /usr/share/pandora_agent/plugins /etc/pandora
fi
if [ ! -e /etc/pandora/collections ]; then
mkdir -p /usr/share/pandora_agent/collections
ln -s /usr/share/pandora_agent/collections /etc/pandora
fi
if [ ! -e /etc/pandora/commands ]; then
mkdir -p /usr/share/pandora_agent/commands
ln -s /usr/share/pandora_agent/commands /etc/pandora
fi
mkdir -p /var/spool/pandora/data_out
if [ ! -d /var/log/pandora ]; then
mkdir -p /var/log/pandora
fi
if [ `command -v systemctl` ];
then
echo "Copying new version of pandora_agent_daemon service"
cp -f /usr/share/pandora_agent/pandora_agent_daemon.service /usr/lib/systemd/system/
chmod -x /usr/lib/systemd/system/pandora_agent_daemon.service
# Enable the services on SystemD
systemctl enable pandora_agent_daemon.service
else
/sbin/chkconfig --add pandora_agent_daemon
/sbin/chkconfig pandora_agent_daemon on
fi
if [ "$1" -gt 1 ]
then
echo "If Pandora Agent daemon was running with init.d script,"
echo "please stop it manually and start the service with systemctl"
fi
%preun
# Upgrading
if [ "$1" = "1" ]; then
exit 0
fi
/sbin/chkconfig --del pandora_agent_daemon
/etc/rc.d/init.d/pandora_agent_daemon stop >/dev/null 2>&1 || :
# Remove symbolic links
pushd /etc/pandora
for f in pandora_agent.conf plugins collections
do
[ -L $f ] && rm -f $f
done
exit 0
%files
%defattr(750,root,root)
/usr/bin/pandora_agent
%defattr(755,pandora,root)
%{prefix}/pandora_agent
%defattr(755,root,root)
/usr/bin/pandora_agent_exec
/usr/bin/tentacle_client
/etc/rc.d/init.d/pandora_agent_daemon
%defattr(644,root,root)
/usr/share/man/man1/pandora_agent.1.gz
/usr/share/man/man1/tentacle_client.1.gz
%config(noreplace) %{_sysconfdir}/logrotate.d/pandora_agent

View File

@ -0,0 +1,170 @@
#
#Pandora FMS Linux Agent
#
%global __os_install_post %{nil}
%define name pandorafms_agent_linux_bin
%define source_name pandorafms_agent_linux
%define version 7.0NG.774
%define release 231110
%define debug_package %{nil}
Summary: Pandora FMS Linux agent, binary version
Name: %{name}
Version: %{version}
Release: %{release}
License: GPL
Vendor: ArticaST <http://www.artica.es>
Source0: %{source_name}-%{version}.tar.gz
URL: http://pandorafms.org
Group: System/Monitoring
Packager: Sancho Lerena <slerena@artica.es>
Prefix: /usr/share
BuildRoot: %{_tmppath}/%{name}-%{version}-buildroot
BuildArch: x86_64
Requires(pre): shadow-utils
Requires(post): chkconfig /bin/ln
Requires(preun): chkconfig /bin/rm /usr/sbin/userdel
Requires: coreutils unzip
Requires: util-linux procps grep
Requires: /sbin/ip /bin/awk
Requires: perl-interpreter
Requires: perl-IO-Compress
Requires: libnsl
Requires: libxcrypt-compat
AutoReq: 0
Provides: %{name}-%{version}
%description
Pandora FMS agent for unix. Pandora FMS is an OpenSource full-featured monitoring software.
%prep
rm -rf $RPM_BUILD_ROOT
%setup -q -n unix
%build
%install
rm -rf $RPM_BUILD_ROOT
mkdir -p $RPM_BUILD_ROOT%{prefix}/pandora_agent/
mkdir -p $RPM_BUILD_ROOT/usr/bin/
mkdir -p $RPM_BUILD_ROOT/usr/sbin/
mkdir -p $RPM_BUILD_ROOT/etc/pandora/
mkdir -p $RPM_BUILD_ROOT/etc/rc.d/init.d/
mkdir -p $RPM_BUILD_ROOT/var/log/pandora/
mkdir -p $RPM_BUILD_ROOT/usr/share/man/man1/
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/
cp -aRf * $RPM_BUILD_ROOT%{prefix}/pandora_agent/
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/tentacle_client $RPM_BUILD_ROOT/usr/bin/
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/pandora_agent $RPM_BUILD_ROOT/usr/bin/
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/pandora_agent_exec $RPM_BUILD_ROOT/usr/bin/
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/pandora_agent_daemon $RPM_BUILD_ROOT/etc/rc.d/init.d/pandora_agent_daemon
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/man/man1/pandora_agent.1.gz $RPM_BUILD_ROOT/usr/share/man/man1/
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/man/man1/tentacle_client.1.gz $RPM_BUILD_ROOT/usr/share/man/man1/
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/Linux/pandora_agent.conf $RPM_BUILD_ROOT/usr/share/pandora_agent/pandora_agent.conf.rpmnew
install -m 0644 pandora_agent_logrotate $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/pandora_agent
if [ -f $RPM_BUILD_ROOT%{prefix}/pandora_agent/pandora_agent.spec ] ; then
rm $RPM_BUILD_ROOT%{prefix}/pandora_agent/pandora_agent.spec
fi
%clean
rm -Rf $RPM_BUILD_ROOT
%pre
getent passwd pandora >/dev/null || \
/usr/sbin/useradd -d %{prefix}/pandora -s /bin/false -M -g 0 pandora
exit 0
chown pandora:root /var/log/pandora
%post
if [ ! -d /etc/pandora ] ; then
mkdir -p /etc/pandora
fi
if [ ! -f /usr/share/pandora_agent/pandora_agent.conf ] ; then
cp /usr/share/pandora_agent/pandora_agent.conf.rpmnew /usr/share/pandora_agent/pandora_agent.conf
fi
if [ ! -f /etc/pandora/pandora_agent.conf ] ; then
ln -s /usr/share/pandora_agent/pandora_agent.conf /etc/pandora/pandora_agent.conf
else
[[ ! -f /etc/pandora/pandora_agent.conf.rpmnew ]] && ln -s /usr/share/pandora_agent/pandora_agent.conf.rpmnew /etc/pandora/pandora_agent.conf.rpmnew
fi
if [ ! -e /etc/pandora/plugins ]; then
ln -s /usr/share/pandora_agent/plugins /etc/pandora
fi
if [ ! -e /etc/pandora/collections ]; then
mkdir -p /usr/share/pandora_agent/collections
ln -s /usr/share/pandora_agent/collections /etc/pandora
fi
if [ ! -e /etc/pandora/commands ]; then
mkdir -p /usr/share/pandora_agent/commands
ln -s /usr/share/pandora_agent/commands /etc/pandora
fi
mkdir -p /var/spool/pandora/data_out
if [ ! -d /var/log/pandora ]; then
mkdir -p /var/log/pandora
fi
if [ `command -v systemctl` ];
then
echo "Copying new version of pandora_agent_daemon service"
cp -f /usr/share/pandora_agent/pandora_agent_daemon.service /usr/lib/systemd/system/
chmod -x /usr/lib/systemd/system/pandora_agent_daemon.service
# Enable the services on SystemD
systemctl enable pandora_agent_daemon.service
else
/sbin/chkconfig --add pandora_agent_daemon
/sbin/chkconfig pandora_agent_daemon on
fi
if [ "$1" -gt 1 ]
then
echo "If Pandora Agent daemon was running with init.d script,"
echo "please stop it manually and start the service with systemctl"
fi
%preun
# Upgrading
if [ "$1" = "1" ]; then
exit 0
fi
/sbin/chkconfig --del pandora_agent_daemon
/etc/rc.d/init.d/pandora_agent_daemon stop >/dev/null 2>&1 || :
# Remove symbolic links
pushd /etc/pandora
for f in pandora_agent.conf plugins collections
do
[ -L $f ] && rm -f $f
done
exit 0
%files
%defattr(750,root,root)
/usr/bin/pandora_agent
%defattr(755,pandora,root)
%{prefix}/pandora_agent
%defattr(755,root,root)
/usr/bin/pandora_agent_exec
/usr/bin/tentacle_client
/etc/rc.d/init.d/pandora_agent_daemon
%defattr(644,root,root)
/usr/share/man/man1/pandora_agent.1.gz
/usr/share/man/man1/tentacle_client.1.gz
%config(noreplace) %{_sysconfdir}/logrotate.d/pandora_agent

View File

@ -4,8 +4,8 @@
%global __os_install_post %{nil} %global __os_install_post %{nil}
%define name pandorafms_agent_linux_bin %define name pandorafms_agent_linux_bin
%define source_name pandorafms_agent_linux %define source_name pandorafms_agent_linux
%define version 7.0NG.773.3 %define version 7.0NG.774
%define release 230904 %define release 231110
Summary: Pandora FMS Linux agent, binary version Summary: Pandora FMS Linux agent, binary version
Name: %{name} Name: %{name}
@ -26,6 +26,7 @@ Requires(preun): chkconfig /bin/rm /usr/sbin/userdel
Requires: coreutils unzip Requires: coreutils unzip
Requires: util-linux procps grep Requires: util-linux procps grep
Requires: /sbin/ip /bin/awk Requires: /sbin/ip /bin/awk
Requires: perl
#Requires: libnsl #Requires: libnsl
AutoReq: 0 AutoReq: 0
Provides: %{name}-%{version} Provides: %{name}-%{version}

View File

@ -3,8 +3,8 @@
# #
%global __os_install_post %{nil} %global __os_install_post %{nil}
%define name pandorafms_agent_linux %define name pandorafms_agent_linux
%define version 7.0NG.773.3 %define version 7.0NG.774
%define release 230904 %define release 231110
Summary: Pandora FMS Linux agent, PERL version Summary: Pandora FMS Linux agent, PERL version
Name: %{name} Name: %{name}

View File

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

View File

@ -0,0 +1,631 @@
#!/usr/bin/perl
################################################################################
# Author: Enrique Martin Garcia
# Copyright: 2023, PandoraFMS
# Maintainer: Operations department
# Version: 1.0
################################################################################
use strict;
use warnings;
use Getopt::Long;
use File::Basename;
use File::Spec;
use Digest::MD5 qw(md5_hex);
use Scalar::Util 'looks_like_number';
use Socket;
# Define signal handlers
sub sigint_handler {
print STDERR "\nInterrupted by user\n";
exit 0;
}
sub sigterm_handler {
print STDERR "Received SIGTERM signal.\n";
exit 0;
}
$SIG{INT} = \&sigint_handler;
$SIG{TERM} = \&sigterm_handler;
# Add lib dir path
my $lib_dir = File::Spec->catdir(dirname($0), 'lib');
unshift @INC, $lib_dir;
###
# GLOBALS
##################
my %options = ();
my $modules_group = 'Security';
my $b_ports = 'PORTS';
my $b_files = 'FILES';
my $b_passwords = 'PASSWORDS';
my @blocks = ($b_ports, $b_files, $b_passwords);
my $configuration_block;
my $integrity_file = '/tmp/' . md5_hex(File::Spec->rel2abs($0)) . '.integrity';
# Enable all checks by default
my $check_selinux = 1;
my $check_ssh_root_access = 1;
my $check_ssh_root_keys = 1;
my $check_ports = 1;
my $check_files = 1;
my $check_passwords = 1;
# Include all values for checks by default
my $include_defaults = 1;
# Initialize check lists
my @l_ports = (
80,
22
);
my @l_files = (
'/etc/shadow',
'/etc/passwd',
'/etc/hosts',
'/etc/resolv.conf',
'/etc/ssh/sshd_config',
'/etc/rsyslog.conf'
);
my @l_passwords = (
'123456',
'12345678',
'123456789',
'12345',
'1234567',
'password',
'1password',
'abc123',
'qwerty',
'111111',
'1234',
'iloveyou',
'sunshine',
'monkey',
'1234567890',
'123123',
'princess',
'baseball',
'dragon',
'football',
'shadow',
'soccer',
'unknown',
'000000',
'myspace1',
'purple',
'fuckyou',
'superman',
'Tigger',
'buster',
'pepper',
'ginger',
'qwerty123',
'qwerty1',
'peanut',
'summer',
'654321',
'michael1',
'cookie',
'LinkedIn',
'whatever',
'mustang',
'qwertyuiop',
'123456a',
'123abc',
'letmein',
'freedom',
'basketball',
'babygirl',
'hello',
'qwe123',
'fuckyou1',
'love',
'family',
'yellow',
'trustno1',
'jesus1',
'chicken',
'diamond',
'scooter',
'booboo',
'welcome',
'smokey',
'cheese',
'computer',
'butterfly',
'696969',
'midnight',
'princess1',
'orange',
'monkey1',
'killer',
'snoopy ',
'qwerty12 ',
'1qaz2wsx ',
'bandit',
'sparky',
'666666',
'football1',
'master',
'asshole',
'batman',
'sunshine1',
'bubbles',
'friends',
'1q2w3e4r',
'chocolate',
'Yankees',
'Tinkerbell',
'iloveyou1',
'abcd1234',
'flower',
'121212',
'passw0rd',
'pokemon',
'StarWars',
'iloveyou2',
'123qwe',
'Pussy',
'angel1'
);
###
# ARGS PARSER
##################
my $HELP = <<EO_HELP;
Run several security checks in a Linux system
Usage: $0
[-h,--help]
[--check_selinux {0,1}]
[--check_ssh_root_access {0,1}]
[--check_ssh_root_keys {0,1}]
[--check_ports {0,1}]
[--check_files {0,1}]
[--check_passwords {0,1}]
[--include_defaults {0,1}]
[--integrity_file <integrity_file>]
[--conf <conf_file>]
Optional arguments:
-h, --help Show this help message and exit
--check_selinux {0,1} Enable/Disable check SElinux module
--check_ssh_root_access {0,1} Enable/Disable check SSH root access module
--check_ssh_root_keys {0,1} Enable/Disable check SSH root keys module
--check_ports {0,1} Enable/Disable check ports module
--check_files {0,1} Enable/Disable check files module
--check_passwords {0,1} Enable/Disable check passwords module
--include_defaults {0,1} Enable/Disable default plugin checks for ports, files and passwords
--integrity_file <integrity_file> Path to integrity check file
Default: $integrity_file
--conf <conf_file> Path to plugin configuration file
Available configuration blocks:
[$b_ports], [$b_files] and [$b_passwords]
Content example:
[$b_ports]
3306
443
[$b_files]
/etc/httpd/httpd.conf
/etc/my.cnf
[$b_passwords]
pandora
PANDORA
P4nd0r4
EO_HELP
sub help {
my ($extra_message) = @_;
print $HELP;
print $extra_message if defined($extra_message);
exit 0;
}
sub parse_bool_arg {
my ($arg, $default) = @_;
if (defined $options{$arg}) {
if (looks_like_number($options{$arg}) && ($options{$arg} == 1 || $options{$arg} == 0)) {
return $options{$arg};
} else {
help("Invalid value for argument: $arg\n");
}
} else {
return $default;
}
}
# Parse arguments
GetOptions(
"help|h" => \$options{help},
"check_selinux=s" => \$options{check_selinux},
"check_ssh_root_access=s" => \$options{check_ssh_root_access},
"check_ssh_root_keys=s" => \$options{check_ssh_root_keys},
"check_ports=s" => \$options{check_ports},
"check_files=s" => \$options{check_files},
"check_passwords=s" => \$options{check_passwords},
"include_defaults=s" => \$options{include_defaults},
"integrity_file=s" => \$options{integrity_file},
"conf=s" => \$options{conf}
);
help() if ($options{help});
$check_selinux = parse_bool_arg('check_selinux', $check_selinux);
$check_ssh_root_access = parse_bool_arg('check_ssh_root_access', $check_ssh_root_access);
$check_ssh_root_keys = parse_bool_arg('check_ssh_root_keys', $check_ssh_root_keys);
$check_ports = parse_bool_arg('check_ports', $check_ports);
$check_files = parse_bool_arg('check_files', $check_files);
$check_passwords = parse_bool_arg('check_passwords', $check_passwords);
$include_defaults = parse_bool_arg('include_defaults', $include_defaults);
if (!$include_defaults) {
@l_ports = ();
@l_files = ();
@l_passwords = ();
}
$integrity_file = $options{integrity_file} if defined $options{integrity_file};
parse_configuration($options{conf}) if defined $options{conf};
###
# FUNCTIONS
##################
# Function to parse configuration file
sub parse_configuration {
my ($conf_file) = @_;
open my $conf_fh, '<', $conf_file or die "Error opening configuration file [$conf_file]: $!\n";
while (my $line = <$conf_fh>) {
chomp $line;
$line =~ s/^\s+//;
$line =~ s/\s+$//;
if ($line =~ /^\[($b_ports|$b_files|$b_passwords)\]$/) {
$configuration_block = $1;
}
elsif ($configuration_block) {
if ($configuration_block eq $b_ports) {
push @l_ports, $line;
}
elsif ($configuration_block eq $b_files) {
push @l_files, $line;
}
elsif ($configuration_block eq $b_passwords) {
push @l_passwords, $line;
}
}
}
close $conf_fh;
}
# Function to print module XML to STDOUT
sub print_xml_module {
my ($m_name, $m_type, $m_desc, $m_value) = @_;
print "<module>\n";
print "\t<name><![CDATA[$m_name]]></name>\n";
print "\t<type>$m_type</type>\n";
print "\t<data><![CDATA[$m_value]]></data>\n";
print "\t<description><![CDATA[$m_desc]]></description>\n";
print "\t<module_group>$modules_group</module_group>\n";
print "</module>\n";
}
# Make unique array
sub uniq {
my %seen;
return grep { !$seen{$_}++ } @_;
}
###
# MAIN
##################
# Check SELinux status
if ($check_selinux) {
my $value = 0;
my $desc = 'SELinux is disabled.';
my $output = `sestatus 2> /dev/null`;
if ($? == 0) {
if ($output =~ /SELinux status: enabled/) {
$value = 1;
$desc = 'SELinux is enabled.';
}
} else {
$value = 0;
$desc = 'Can not determine if SELinux is enabled.';
}
print_xml_module('SELinux status', 'generic_proc', $desc, $value);
}
# Check if SSH allows root access
if ($check_ssh_root_access) {
my $value = 1;
my $desc = 'SSH does not allow root access.';
my $ssh_config_file = '/etc/ssh/sshd_config';
if (-e $ssh_config_file && open my $ssh_fh, '<', $ssh_config_file) {
while (my $line = <$ssh_fh>) {
chomp $line;
$line =~ s/^\s+//;
$line =~ s/\s+$//;
next if $line =~ /^$/ or $line =~ /^#/;
my ($option, $val) = split /\s+/, $line, 2;
if ($option eq 'PermitRootLogin' && lc($val) ne 'no') {
$value = 0;
$desc = 'SSH config allows root access.';
last;
}
}
close $ssh_fh;
} else {
$value = 0;
$desc = 'Can not read '.$ssh_config_file.' to check if root access allowed.';
}
print_xml_module('SSH root access status', 'generic_proc', $desc, $value);
}
# Specific function for recursive directory check
sub find_files {
my ($dir) = @_;
my @files = ();
opendir my $dh, $dir or return;
while (my $file = readdir $dh) {
next if $file eq '.' or $file eq '..';
my $file_path = File::Spec->catfile($dir, $file);
if (-f $file_path) {
push @files, $file_path;
} elsif (-d $file_path) {
push @files, find_files($file_path);
}
}
closedir $dh;
return @files;
}
# Check if /root has SSH keys
if ($check_ssh_root_keys) {
my $value = 1;
my $desc = 'SSH root keys not found.';
my $ssh_keys = {'private' => [], 'public' => []};
my $ssh_dir = '/root/.ssh';
my @all_files = find_files($ssh_dir);
foreach my $file (@all_files) {
if (open my $fh, '<:raw', $file) {
my $content = '';
while(my $l = <$fh>) {
$content .= $l;
}
if ($content) {
my ($filename, $directories) = fileparse($file);
if ($content =~ /-----BEGIN RSA PRIVATE KEY-----.*?-----END RSA PRIVATE KEY-----/s) {
push @{$ssh_keys->{'private'}}, $file;
} elsif ($content =~ /ssh-rsa/ && $filename ne 'known_hosts' && $filename ne 'authorized_keys') {
push @{$ssh_keys->{'public'}}, $file;
}
}
}
}
if (@{$ssh_keys->{'private'}} > 0 || @{$ssh_keys->{'public'}} > 0) {
$value = 0;
$desc = "SSH root keys found:\n" . join("\n", @{$ssh_keys->{'private'}}, @{$ssh_keys->{'public'}});
}
print_xml_module('SSH root keys status', 'generic_proc', $desc, $value);
}
# Check authorized ports
if ($check_ports) {
my $value = 1;
my $desc = 'No unauthorized ports found.';
my @open_ports;
my @not_allowed_ports;
my @net_tcp_files = ('/proc/net/tcp', '/proc/net/tcp6');
foreach my $net_tcp_file (@net_tcp_files) {
if (-e $net_tcp_file && open my $tcp_fh, '<', $net_tcp_file) {
while (my $line = <$tcp_fh>) {
chomp $line;
my @parts = split /\s+/, $line;
if (scalar @parts >= 12) {
my $local_addr_hex = (split /:/, $parts[2])[0];
my $local_port_hex = (split /:/, $parts[2])[1];
my $state = $parts[4];
# Check if the connection is in state 0A (listening)
if ($state eq "0A") {
my $local_addr_4 = join('.', reverse split(/\./, inet_ntoa(pack("N", hex($local_addr_hex)))));
my $local_addr_6 = join(':', map { hex($_) } unpack("(A4)*", $local_addr_hex));
# Skip localhost listening ports
if ($local_addr_4 eq "127.0.0.1" || $local_addr_6 eq "0:0:0:0:0:0:0:1") {
next;
}
my $local_port = hex($local_port_hex);
push @open_ports, $local_port;
}
}
}
close $tcp_fh;
}
}
@open_ports = uniq(@open_ports);
my %allowed_ports;
foreach my $port (@l_ports) {
$allowed_ports{$port} = 1;
}
foreach my $port (@open_ports) {
if (!exists $allowed_ports{$port}) {
push @not_allowed_ports, $port;
}
}
if (@not_allowed_ports) {
$value = 0;
$desc = "Unauthorized ports found:\n" . join("\n", @not_allowed_ports);
}
print_xml_module('Authorized ports status', 'generic_proc', $desc, $value);
}
# Check files integrity
if ($check_files) {
my $value = 1;
my $desc = 'No changed files found.';
my %integrity;
my $can_check_files = 0;
if (-e $integrity_file) {
if (-r $integrity_file && -w $integrity_file) {
# Read integrity file content
open my $integrity_fh, '<', $integrity_file;
while (my $line = <$integrity_fh>) {
chomp $line;
if ($line =~ /^\s*(.*?)=(.*?)\s*$/) {
$integrity{$1} = $2;
}
}
close $integrity_fh;
$can_check_files = 1;
} else {
$value = 0;
$desc = 'Integrity check file can not be read or written: ' . $integrity_file;
}
} else {
if (open my $integrity_fh, '>', $integrity_file) {
close $integrity_fh;
$can_check_files = 1;
} else {
$value = 0;
$desc = 'Integrity check file can not be created: ' . $integrity_file;
}
}
if ($can_check_files) {
# Check each file integrity
my @errored_files;
my @no_integrity_files;
# Create unique check files list
@l_files = uniq(@l_files);
foreach my $file (@l_files) {
my $file_key = md5_hex($file);
if (open my $fh, '<:raw', $file) {
my $md5 = Digest::MD5->new;
$md5->addfile($fh);
my $file_md5 = $md5->hexdigest;
chomp $file_md5;
close $fh;
if (exists $integrity{$file_key} && $integrity{$file_key} ne $file_md5) {
push @no_integrity_files, $file;
}
$integrity{$file_key} = $file_md5;
} else {
push @errored_files, $file;
}
}
# Overwrite integrity file content
open my $file_handle, '>', $integrity_file;
print $file_handle map { "$_=$integrity{$_}\n" } keys %integrity;
close $file_handle;
# Check module status
if (@no_integrity_files) {
$value = 0;
$desc = "Changed files found:\n" . join("\n", @no_integrity_files);
}
if (@errored_files) {
$value = 0;
$desc .= "\nUnable to check integrity of some files:\n" . join("\n", @errored_files);
}
}
print_xml_module('Files check status', 'generic_proc', $desc, $value);
}
# Check weak passwords
if ($check_passwords) {
my $value = 1;
my $desc = 'No insecure passwords found.';
# Create unique check passwords list
@l_passwords = uniq(@l_passwords);
my @insecure_users;
my $shadow_file = '/etc/shadow';
if (-e $shadow_file && -r $shadow_file) {
open my $shadow_fh, '<', $shadow_file;
while (my $line = <$shadow_fh>) {
chomp $line;
my ($username, $password_hash, @rest) = split /:/, $line;
# Skip users with no password hash
if ($password_hash ne "*" && $password_hash ne "!!" && $password_hash ne "!locked") {
my $salt = substr($password_hash, 0, rindex($password_hash, '$') + 1);
my $user_hash = crypt($username, $salt);
if ($user_hash eq $password_hash) {
push @insecure_users, $username;
} else {
foreach my $weak_password (@l_passwords) {
my $weak_password_hash = crypt($weak_password, $salt);
if ($weak_password_hash eq $password_hash) {
push @insecure_users, $username;
last;
}
}
}
}
}
close $shadow_fh;
} else {
$value = 0;
$desc = 'Can not read '.$shadow_file.' to check passwords.';
}
if (@insecure_users) {
$value = 0;
$desc = "Users with insecure passwords found:\n" . join("\n", @insecure_users);
}
print_xml_module('Insecure passwords status', 'generic_proc', $desc, $value);
}

View File

@ -1,6 +1,6 @@
# Base config file for Pandora FMS Windows Agent # Base config file for Pandora FMS Windows Agent
# (c) 2006-2023 Pandora FMS # (c) 2006-2023 Pandora FMS
# Version 7.0NG.773.3 # Version 7.0NG.774
# This program is Free Software, you can redistribute it and/or modify it # This program is Free Software, you can redistribute it and/or modify it
# under the terms of the GNU General Public Licence as published by the Free Software # under the terms of the GNU General Public Licence as published by the Free Software
# Foundation; either version 2 of the Licence or any later version # Foundation; either version 2 of the Licence or any later version
@ -165,7 +165,7 @@ module_description User CPU Usage (%)
module_min_warning 70 module_min_warning 70
module_max_warning 90 module_max_warning 90
module_min_critical 91 module_min_critical 91
module_max_critical 100 module_max_critical 0
module_unit % module_unit %
module_group System module_group System
module_end module_end
@ -526,7 +526,15 @@ module_plugin "%PROGRAMFILES%\Pandora_Agent\util\autodiscover.exe" --default
# Hardening plugin for security compliance analysis. # Hardening plugin for security compliance analysis.
#module_begin #module_begin
#module_plugin "%PROGRAMFILES%\Pandora_Agent\util\pandora_sca.exe" #module_plugin "%PROGRAMFILES%\Pandora_Agent\util\pandora_hardening.exe -t 150"
#module_absoluteinterval 7d #module_absoluteinterval 7d
#module_end #module_end
# Logs extraction
#module_begin
#module_name X_Server_log
#module_description Logs extraction module
#module_type log
#module_regexp C:\server\logs\xserver.log
#module_pattern .*
#module_end

View File

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

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:6d93bd9d56c938063045fa2093198d324746f84df2b74567648f3baebd635657
size 5248006

View File

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

View File

@ -1,2 +1,3 @@
@at 00:00 /every:1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30 "%CD%\restart_pandora_agent.bat" @at 00:00 /every:1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30 "'%CD%\restart_pandora_agent.bat'"
schtasks /change /tn pandora_agent_restart /tr "'%CD%\restart_pandora_agent.bat'"

View File

@ -30,7 +30,7 @@ using namespace Pandora;
using namespace Pandora_Strutils; using namespace Pandora_Strutils;
#define PATH_SIZE _MAX_PATH+1 #define PATH_SIZE _MAX_PATH+1
#define PANDORA_VERSION ("7.0NG.773.3 Build 230904") #define PANDORA_VERSION ("7.0NG.774 Build 231110")
string pandora_path; string pandora_path;
string pandora_dir; string pandora_dir;

View File

@ -11,7 +11,7 @@ BEGIN
VALUE "LegalCopyright", "Pandora FMS" VALUE "LegalCopyright", "Pandora FMS"
VALUE "OriginalFilename", "PandoraAgent.exe" VALUE "OriginalFilename", "PandoraAgent.exe"
VALUE "ProductName", "Pandora FMS Windows Agent" VALUE "ProductName", "Pandora FMS Windows Agent"
VALUE "ProductVersion", "(7.0NG.773.3(Build 230904))" VALUE "ProductVersion", "(7.0NG.774(Build 231110))"
VALUE "FileVersion", "1.0.0.0" VALUE "FileVersion", "1.0.0.0"
END END
END END

View File

@ -1,5 +1,5 @@
package: pandorafms-console package: pandorafms-console
Version: 7.0NG.773.3-230904 Version: 7.0NG.774-231110
Architecture: all Architecture: all
Priority: optional Priority: optional
Section: admin Section: admin

View File

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

31
pandora_console/cron.php Normal file
View File

@ -0,0 +1,31 @@
<?php
require_once 'include/config.php';
require_once 'include/auth/mysql.php';
require_once 'include/functions.php';
require_once 'include/functions_db.php';
global $config;
if ((bool) $config['enterprise_installed'] === true) {
return;
}
// Load classes.
require_once 'include/class/DiscoveryConsoleTask.php';
require_once 'include/class/ConsoleSupervisor.php';
db_process_sql_update(
'tconfig',
['value' => get_system_time()],
['token' => 'cron_last_run']
);
$tasks = new DiscoveryConsoleTask();
$tasks->run();
if (is_reporting_console_node() === true) {
$supervisor = new ConsoleSupervisor();
$supervisor->run();
}

View File

@ -31,6 +31,7 @@ global $config;
require_once $config['homedir'].'/include/functions_agents.php'; require_once $config['homedir'].'/include/functions_agents.php';
require_once $config['homedir'].'/godmode/wizards/Wizard.main.php'; require_once $config['homedir'].'/godmode/wizards/Wizard.main.php';
require_once $config['homedir'].'/include/functions_cron_task.php';
/** /**
@ -78,91 +79,78 @@ function quickShell()
return; return;
} }
$form_sent = get_parameter('form-sent', false);
$method = get_parameter('method', null);
$setup_anchor = html_print_anchor(
[
'href' => 'index.php?sec=gsetup&sec2=godmode/setup/setup&section=quickshell',
'content' => __('GoTTY setup'),
],
true
);
if ((bool) $config['gotty_ssh_enabled'] === false
&& (bool) $config['gotty_telnet_enabled'] === false
) {
ui_print_warning_message(__('Please, enable GoTTY in %s', $setup_anchor));
return;
}
$agent_id = get_parameter('id_agente', 0); $agent_id = get_parameter('id_agente', 0);
$username = get_parameter('username', null); $username = get_parameter('username', null);
$method = get_parameter('method', null);
$method_port = get_parameter('port', null); $method_port = get_parameter('port', null);
// Retrieve main IP Address. // Retrieve main IP Address.
$address = agents_get_address($agent_id); $agent_address = agents_get_address($agent_id);
ui_require_css_file('wizard'); ui_require_css_file('wizard');
ui_require_css_file('discovery'); ui_require_css_file('discovery');
// Settings. // Build URL args.
// WebSocket host, where client should connect. if ($method === 'ssh') {
if (isset($config['ws_port']) === false) { // SSH.
config_update_value('ws_port', 8080); $args .= '&arg='.$agent_address.'&arg='.$method_port.'&arg='.$username;
} else if ($method == 'telnet') {
// Telnet.
$args .= '&arg='.$agent_address.'&arg='.$method_port;
} }
if (empty($config['ws_proxy_url']) === true) { $connectionURL = buildConnectionURL($method);
$ws_url = 'http://'.$_SERVER['SERVER_ADDR'].':'.$config['ws_port']; $gotty_addr = $connectionURL.$args;
} else {
preg_match('/\/\/(.*)/', $config['ws_proxy_url'], $matches);
if (isset($_SERVER['HTTPS']) === true) {
$ws_url = 'https://'.$matches[1];
} else {
$ws_url = 'http://'.$matches[1];
}
}
// Gotty settings. Internal communication (WS).
if (isset($config['gotty_host']) === false) {
config_update_value('gotty_host', '127.0.0.1');
}
if (isset($config['gotty_telnet_port']) === false) {
config_update_value('gotty_telnet_port', 8082);
}
if (isset($config['gotty_ssh_port']) === false) {
config_update_value('gotty_ssh_port', 8081);
}
// Context to allow self-signed certs.
$context = stream_context_create(
[
'http' => [ 'method' => 'GET'],
'ssl' => [
'verify_peer' => false,
'verify_peer_name' => false,
],
]
);
// Username. Retrieve from form. // Username. Retrieve from form.
if (empty($username) === true) { if ($form_sent === false) {
// No username provided, ask for it. // No username provided, ask for it.
$wiz = new Wizard(); $wiz = new Wizard();
$test = curl($ws_url, []); $method_fields = [];
if ($test === false) {
ui_print_error_message(__('WebService engine has not been started, please check documentation.'));
$wiz->printForm(
[
'form' => [
'method' => 'POST',
'action' => '#',
'id' => 'retry_form',
],
]
);
html_print_action_buttons( if ($config['gotty_telnet_enabled']) {
html_print_submit_button( $method_fields['telnet'] = __('Telnet');
__('Retry'), $port_value = 23;
'submit',
false,
[
'icon' => 'next',
'form' => 'retry_form',
],
true
)
);
return;
} }
if ($config['gotty_ssh_enabled']) {
$method_fields['ssh'] = __('SSH');
$port_value = 22;
}
$method_script = "
var wizard = document.querySelector('.wizard');
p=22;
wizard.querySelector('ul > li').classList.remove('invisible_important');
wizard.querySelector('ul > li').classList.add('visible');
if(this.value == 'telnet') {
p=23;
wizard.querySelector('ul > li').classList.remove('visible');
wizard.querySelector('ul > li').classList.add('invisible_important');
$('#text-username').prop('required', false);
} else {
$('#text-username').prop('required', true);
}
$('#text-port').val(p);";
$wiz->printForm( $wiz->printForm(
[ [
'form' => [ 'form' => [
@ -175,8 +163,9 @@ function quickShell()
[ [
'label' => __('Username'), 'label' => __('Username'),
'arguments' => [ 'arguments' => [
'type' => 'text', 'type' => 'text',
'name' => 'username', 'name' => 'username',
'required' => true,
], ],
], ],
[ [
@ -185,7 +174,7 @@ function quickShell()
'type' => 'text', 'type' => 'text',
'id' => 'port', 'id' => 'port',
'name' => 'port', 'name' => 'port',
'value' => 22, 'value' => $port_value,
], ],
], ],
[ [
@ -193,11 +182,15 @@ function quickShell()
'arguments' => [ 'arguments' => [
'type' => 'select', 'type' => 'select',
'name' => 'method', 'name' => 'method',
'fields' => [ 'fields' => $method_fields,
'ssh' => __('SSH'), 'script' => $method_script,
'telnet' => __('Telnet'), ],
], ],
'script' => "p=22; if(this.value == 'telnet') { p=23; } $('#text-port').val(p);", [
'arguments' => [
'type' => 'hidden',
'name' => 'form-sent',
'value' => true,
], ],
], ],
], ],
@ -221,119 +214,73 @@ function quickShell()
return; return;
} }
// Initialize Gotty Client. // Check gotty connection before trying to load iframe.
$host = $config['gotty_host']; $ch = curl_init($gotty_addr);
if ($method == 'ssh') { curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
// SSH. // Maximum time for the entire request.
$port = $config['gotty_ssh_port']; curl_setopt($ch, CURLOPT_TIMEOUT, 3);
$command_arguments = "var args = '?arg=".$username.'@'.$address; // Maximum time to establish a connection.
$command_arguments .= '&arg=-p '.$method_port."';"; curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 2);
} else if ($method == 'telnet') { curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
// Telnet. curl_setopt($ch, CURLOPT_MAXREDIRS, 10);
$port = $config['gotty_telnet_port']; curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
$username = preg_replace('/[^a-zA-Z0-9\-\.]/', '', $username); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
$command_arguments = "var args = '?arg=-l ".$username;
$command_arguments .= '&arg='.$address; $response = curl_exec($ch);
$command_arguments .= '&arg='.$method_port."&arg=-E';"; $responseCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
} else { $finalUrl = curl_getinfo($ch, CURLINFO_EFFECTIVE_URL);
ui_print_error_message(__('Please use SSH or Telnet.'));
return; curl_close($ch);
if ($responseCode !== 200) {
ui_print_error_message(__('Connection error. Please check your settings at %s', $setup_anchor));
exit;
} }
// If rediretion is enabled, we will try to connect using
// http:// or https:// endpoint.
$test = get_headers($ws_url, false, $context);
if ($test === false) {
if (empty($wiz) === true) {
$wiz = new Wizard();
}
ui_print_error_message(__('WebService engine has not been started, please check documentation.'));
echo $wiz->printGoBackButton('#');
return;
}
// Check credentials.
$auth_str = '';
$gotty_url = $host.':'.$port;
if (empty($config['gotty_user']) === false
&& empty($config['gotty_pass']) === false
) {
$auth_str = io_safe_output($config['gotty_user']);
$auth_str .= ':'.io_output_password($config['gotty_pass']);
$gotty_url = $auth_str.'@'.$host.':'.$port;
}
$r = file_get_contents('http://'.$gotty_url.'/js/hterm.js');
if (empty($r) === true) {
if (empty($wiz) === true) {
$wiz = new Wizard();
}
ui_print_error_message(__('WebService engine is not working properly, please check documentation.'));
echo $wiz->printGoBackButton('#');
return;
}
// Override gotty client settings.
if (empty($auth_str) === true) {
$r .= "var gotty_auth_token = '';";
} else {
$r .= "var gotty_auth_token = '";
$r .= $auth_str."';";
}
// Set websocket target and method.
$gotty = file_get_contents('http://'.$gotty_url.'/js/gotty.js');
$url = "var url = (httpsEnabled ? 'wss://' : 'ws://') + window.location.host + window.location.pathname + 'ws';";
if (empty($config['ws_proxy_url']) === true) {
$new = "var url = (httpsEnabled ? 'wss://' : 'ws://')";
$new .= " + window.location.host + ':";
$new .= $config['ws_port'].'/'.$method."';";
} else {
$new = "var url = '";
$new .= $config['ws_proxy_url'].'/'.$method."';";
}
// Update firefox issue.
$original = ' this.iframe_.src = \'#\';';
$trick = 'this.iframe_.src = \'javascript:\';';
$r = str_replace($original, $trick, $r);
// Update url.
$gotty = str_replace($url, $new, $gotty);
// Update websocket arguments.
$args = 'var args = window.location.search;';
$new = $command_arguments;
// Update arguments.
$gotty = str_replace($args, $new, $gotty);
?> ?>
<style>#terminal { <style>#terminal {
height: 650px;
width: 100%; width: 100%;
margin: 0px; margin: 0px;
padding: 0; padding: 0;
display: flex;
flex-direction: column;
min-height: calc(100vh - 205px);
} }
#terminal > iframe { #terminal > iframe {
width:100%;
height:100%;
position: relative!important; position: relative!important;
flex-grow: 1;
border: 0px;
} }
</style> </style>
<div id="terminal"></div>
<script type="text/javascript"> <div id="terminal"><iframe id="gotty-iframe" src="<?php echo $gotty_addr; ?>"></iframe></div>
<?php echo $r; ?>
</script>
<script type="text/javascript">
<?php echo $gotty; ?>
</script>
<?php <?php
} }
/**
* Build Connection URL based on provided connection method.
*
* @param string $method Connection method (SSH/Telnet).
*
* @return string
*/
function buildConnectionURL($method)
{
global $config;
$address = (empty($config['gotty_addr']) === true) ? $_SERVER['SERVER_ADDR'] : $config['gotty_addr'];
$use_ssl = ($method === 'ssh') ? $config['gotty_ssh_use_ssl'] : $config['gotty_telnet_use_ssl'];
$protocol = ((bool) $use_ssl === true) ? 'https://' : 'http://';
return $protocol.$address.':'.$config['gotty_port'].'/'.$config['gotty_connection_hash'].'/?arg='.$method;
}
/** /**
* Provide an interface where configure all settings. * Provide an interface where configure all settings.
* *
@ -347,116 +294,107 @@ function quickShellSettings()
ui_require_css_file('discovery'); ui_require_css_file('discovery');
// Gotty settings. Internal communication (WS). // Gotty settings. Internal communication (WS).
if (isset($config['gotty_ssh_enabled']) === false) {
config_update_value('gotty_ssh_enabled', 1);
}
if (isset($config['gotty_telnet_enabled']) === false) {
config_update_value('gotty_telnet_enabled', 0);
}
if (isset($config['gotty_host']) === false) { if (isset($config['gotty_host']) === false) {
config_update_value('gotty_host', '127.0.0.1'); config_update_value('gotty_host', '127.0.0.1');
} }
if (isset($config['gotty_telnet_port']) === false) { if (isset($config['gotty_port']) === false) {
config_update_value('gotty_telnet_port', 8082); config_update_value('gotty_port', 8080);
} }
if (isset($config['gotty_ssh_port']) === false) { $changes = 0;
config_update_value('gotty_ssh_port', 8081); $critical = 0;
}
// Parser. // Parser.
if (get_parameter('update_config', false) !== false) { if (get_parameter('update_config', false) !== false) {
// Gotty settings. Internal communication (WS). $gotty_ssh_enabled = get_parameter(
$gotty = get_parameter( 'gotty_ssh_enabled',
'gotty', 0
''
); );
$gotty_host = get_parameter(
'gotty_host', $gotty_telnet_enabled = get_parameter(
'' 'gotty_telnet_enabled',
0
); );
$gotty_ssh_port = get_parameter(
'gotty_ssh_port', $gotty_addr = get_parameter(
'' 'gotty_addr',
);
$gotty_telnet_port = get_parameter(
'gotty_telnet_port',
'' ''
); );
$gotty_user = get_parameter( $gotty_port = get_parameter(
'gotty_user', 'gotty_port',
'' ''
); );
$gotty_pass = get_parameter( $gotty_ssh_use_ssl = get_parameter(
'gotty_pass', 'gotty_ssh_use_ssl',
'' false
); );
$gotty_pass = io_input_password($gotty_pass); $gotty_telnet_use_ssl = get_parameter(
'gotty_telnet_use_ssl',
false
);
$changes = 0; if ($config['gotty_ssh_enabled'] != $gotty_ssh_enabled) {
$critical = 0; config_update_value('gotty_ssh_enabled', $gotty_ssh_enabled);
if ($config['gotty'] != $gotty) {
config_update_value('gotty', $gotty);
$changes++;
$critical++;
} }
if ($config['gotty_host'] != $gotty_host) { if ($config['gotty_telnet_enabled'] != $gotty_telnet_enabled) {
config_update_value('gotty_host', $gotty_host); config_update_value('gotty_telnet_enabled', $gotty_telnet_enabled);
$changes++;
} }
if ($config['gotty_telnet_port'] != $gotty_telnet_port) { if ($config['gotty_addr'] != $gotty_addr) {
config_update_value('gotty_telnet_port', $gotty_telnet_port); config_update_value('gotty_addr', $gotty_addr);
$changes++;
} }
if ($config['gotty_ssh_port'] != $gotty_ssh_port) { if ($config['gotty_port'] != $gotty_port) {
config_update_value('gotty_ssh_port', $gotty_ssh_port); // Mark gotty for restart (should kill the process in the current port).
$changes++; if ($config['restart_gotty_next_cron_port'] === ''
|| $config['restart_gotty_next_cron_port'] === null
) {
config_update_value('restart_gotty_next_cron_port', $config['gotty_port']);
}
config_update_value('gotty_port', $gotty_port);
} }
if ($config['gotty_user'] != $gotty_user) { if ($config['gotty_ssh_use_ssl'] != $gotty_ssh_use_ssl) {
config_update_value('gotty_user', $gotty_user); config_update_value('gotty_ssh_use_ssl', $gotty_ssh_use_ssl);
$changes++;
$critical++;
} }
if ($config['gotty_pass'] != $gotty_pass) { if ($config['gotty_telnet_use_ssl'] != $gotty_telnet_use_ssl) {
$gotty_pass = io_input_password($gotty_pass); config_update_value('gotty_telnet_use_ssl', $gotty_telnet_use_ssl);
config_update_value('gotty_pass', $gotty_pass);
$changes++;
$critical++;
} }
cron_task_start_gotty();
} }
if ($changes > 0) {
$msg = __('%d Updated', $changes);
if ($critical > 0) {
$msg = __(
'%d Updated, please restart WebSocket engine service',
$changes
);
}
ui_print_success_message($msg);
}
// Form. Using old style.
echo '<fieldset class="margin-bottom-10">'; echo '<fieldset class="margin-bottom-10">';
echo '<legend>'.__('Quickshell').'</legend>'; echo '<legend>'.__('GoTTY general parameters').'</legend>';
$t = new StdClass(); $general_table = new StdClass();
$t->data = []; $general_table->data = [];
$t->width = '100%'; $general_table->width = '100%';
$t->class = 'filter-table-adv'; $general_table->class = 'filter-table-adv';
$t->data = []; $general_table->data = [];
$t->style = []; $general_table->style = [];
$t->style[0] = 'width: 50%;'; $general_table->style[0] = 'width: 50%;';
$t->data[0][] = html_print_label_input_block( $general_table->data[0][] = html_print_label_input_block(
__('Gotty path'), __('Address'),
html_print_input_text( html_print_input_text(
'gotty', 'gotty_addr',
$config['gotty'], $config['gotty_addr'],
'', '',
30, 30,
100, 100,
@ -464,11 +402,11 @@ function quickShellSettings()
) )
); );
$t->data[0][] = html_print_label_input_block( $general_table->data[0][] = html_print_label_input_block(
__('Gotty host'), __('Port'),
html_print_input_text( html_print_input_text(
'gotty_host', 'gotty_port',
$config['gotty_host'], $config['gotty_port'],
'', '',
30, 30,
100, 100,
@ -476,79 +414,157 @@ function quickShellSettings()
) )
); );
$t->data[1][] = html_print_label_input_block( html_print_table($general_table);
__('Gotty ssh port'), echo '</fieldset>';
html_print_input_text(
'gotty_ssh_port', echo '<fieldset class="margin-bottom-10">';
$config['gotty_ssh_port'], echo '<legend>'.__('GoTTY SSH connection parameters').'</legend>';
'',
30, $ssh_table = new StdClass();
100, $ssh_table->data = [];
$ssh_table->width = '100%';
$ssh_table->class = 'filter-table-adv';
$ssh_table->data = [];
$ssh_table->style = [];
$ssh_table->style[0] = 'width: 50%;';
$ssh_table->data[0][] = html_print_label_input_block(
__('Enable SSH method'),
html_print_checkbox_switch(
'gotty_ssh_enabled',
1,
$config['gotty_ssh_enabled'],
true true
) )
); );
$t->data[1][] = html_print_label_input_block( $ssh_table->data[1][] = html_print_label_input_block(
__('Gotty telnet port'), __('Use SSL'),
html_print_input_text( html_print_checkbox_switch(
'gotty_telnet_port', 'gotty_ssh_use_ssl',
$config['gotty_telnet_port'], 1,
'', $config['gotty_ssh_use_ssl'],
30, true,
100, $disable_agentaccess
true
) )
); );
$hidden = new stdClass(); // Test.
$hidden->data = []; $row = [];
$hidden->width = '100%'; $test_start = '<span id="test-gotty-spinner-ssh" class="invisible">&nbsp;'.html_print_image('images/spinner.gif', true).'</span>';
$hidden->class = 'filter-table-adv'; $test_start .= '&nbsp;<span id="test-gotty-message-ssh" class="invisible"></span>';
$hidden->data = [];
$hidden->style[0] = 'width: 50%;';
$hidden->data[0][] = html_print_label_input_block( $ssh_table->data[3][] = html_print_button(
__('Gotty user'), __('Test'),
html_print_input_text( 'test-gotty-ssh',
'gotty_user', false,
$config['gotty_user'], 'handleTestSSH()',
'',
30,
100,
true
)
);
$hidden->data[0][] = html_print_label_input_block(
__('Gotty password'),
html_print_input_password(
'gotty_pass',
io_output_password($config['gotty_pass']),
'',
30,
100,
true
)
);
html_print_table($t);
ui_print_toggle(
[ [
'content' => html_print_table($hidden, true), 'icon' => 'cog',
'name' => __('Advanced options'), 'mode' => 'secondary',
'clean' => false, 'style' => 'width: 115px;',
'main_class' => 'no-border-imp', ],
'container_class' => 'no-border-imp', true
] ).$test_start;
);
html_print_table($ssh_table);
echo '</fieldset>'; echo '</fieldset>';
echo '<fieldset class="margin-bottom-10">';
echo '<legend>'.__('GoTTY telnet connection parameters').'</legend>';
$telnet_table = new StdClass();
$telnet_table->data = [];
$telnet_table->width = '100%';
$telnet_table->class = 'filter-table-adv';
$telnet_table->data = [];
$telnet_table->style = [];
$telnet_table->style[0] = 'width: 50%;';
$telnet_table->data[0][] = html_print_label_input_block(
__('Enable telnet method'),
html_print_checkbox_switch(
'gotty_telnet_enabled',
1,
$config['gotty_telnet_enabled'],
true
)
);
$telnet_table->data[1][] = html_print_label_input_block(
__('Use SSL'),
html_print_checkbox_switch(
'gotty_telnet_use_ssl',
1,
$config['gotty_telnet_use_ssl'],
true
)
);
// Test.
$row = [];
$test_start = '<span id="test-gotty-spinner-telnet" class="invisible">&nbsp;'.html_print_image('images/spinner.gif', true).'</span>';
$test_start .= '&nbsp;<span id="test-gotty-message-telnet" class="invisible"></span>';
$telnet_table->data[3][] = html_print_button(
__('Test'),
'test-gotty-telnet',
false,
'handleTestTelnet()',
[
'icon' => 'cog',
'mode' => 'secondary',
'style' => 'width: 115px;',
],
true
).$test_start;
html_print_table($telnet_table);
html_print_input_hidden('update_config', 1);
echo '</fieldset>';
} }
// This extension is usefull only if the agent has associated IP. if (is_ajax() === true) {
$method = (string) get_parameter('method', '');
if (empty($method) === false) {
$address = buildConnectionURL($method);
$ch = curl_init($address);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
// Maximum time for the entire request.
curl_setopt($ch, CURLOPT_TIMEOUT, 2);
// Maximum time to establish a connection.
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_exec($ch);
$response_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
if ($response_code === 200) {
$result = ['status' => 'success'];
} else {
$result = ['status' => 'error'];
}
echo json_encode($result);
return;
}
$result = ['status' => 'error'];
return;
}
// This extension is useful only if the agent has associated IP.
$agent_id = get_parameter('id_agente'); $agent_id = get_parameter('id_agente');
if (empty($agent_id) === false if (empty($agent_id) === false
&& get_parameter('sec2', '') == 'operation/agentes/ver_agente' && get_parameter('sec2', '') == 'operation/agentes/ver_agente'
@ -573,4 +589,136 @@ if (empty($agent_id) === false
} }
} }
echo '<script>';
echo 'var server_addr = "'.$_SERVER['SERVER_ADDR'].'";';
echo "function checkAddressReachability(method, callback) {
$.ajax({
url: 'ajax.php',
data: {
page: 'extensions/quick_shell',
method
},
type: 'GET',
async: false,
dataType: 'json',
success: function (data) {
if (data.status === 'success') {
callback(true);
} else {
callback(false);
}
},
error: function () {
callback(false);
}
});
}";
$handle_test_telnet = "var handleTestTelnet = function (event) {
var gotty_addr = $('input#text-gotty_addr').val();
var gotty_port = $('input#text-gotty_port').val();
var gotty_telnet_use_ssl = $('input#checkbox-gotty_telnet_use_ssl').is(':checked');
if (gotty_addr === '') {
url = (gotty_telnet_use_ssl ? 'https://' : 'http://') + server_addr + ':' + gotty_port;
} else {
url = (gotty_telnet_use_ssl ? 'https://' : 'http://') + gotty_addr + ':' + gotty_port;
}
var showLoadingImage = function () {
$('#button-test-gotty-telnet').children('div').attr('class', 'subIcon cog rotation secondary mini');
}
var showSuccessImage = function () {
$('#button-test-gotty-telnet').children('div').attr('class', 'subIcon tick secondary mini');
}
var showFailureImage = function () {
$('#button-test-gotty-telnet').children('div').attr('class', 'subIcon fail secondary mini');
}
var hideMessage = function () {
$('span#test-gotty-message-telnet').hide();
}
var showMessage = function () {
$('span#test-gotty-message-telnet').show();
}
var changeTestMessage = function (message) {
$('span#test-gotty-message-telnet').text(message);
}
var errorMessage = '".__('Unable to connect.')."';
hideMessage();
showLoadingImage();
checkAddressReachability('telnet', function(isReachable) {
if (isReachable) {
showSuccessImage();
hideMessage();
} else {
showFailureImage();
changeTestMessage(errorMessage);
showMessage();
}
});
};";
$handle_test_ssh = "var handleTestSSH = function (event) {
var gotty_addr = $('input#text-gotty_addr').val();
var gotty_port = $('input#text-gotty_port').val();
var gotty_ssh_use_ssl = $('input#checkbox-gotty_ssh_use_ssl').is(':checked');
if (gotty_addr === '') {
url = (gotty_ssh_use_ssl ? 'https://' : 'http://') + server_addr + ':' + gotty_port;
} else {
url = (gotty_ssh_use_ssl ? 'https://' : 'http://') + gotty_addr + ':' + gotty_port;
}
var showLoadingImage = function () {
$('#button-test-gotty-ssh').children('div').attr('class', 'subIcon cog rotation secondary mini');
}
var showSuccessImage = function () {
$('#button-test-gotty-ssh').children('div').attr('class', 'subIcon tick secondary mini');
}
var showFailureImage = function () {
$('#button-test-gotty-ssh').children('div').attr('class', 'subIcon fail secondary mini');
}
var hideMessage = function () {
$('span#test-gotty-message-ssh').hide();
}
var showMessage = function () {
$('span#test-gotty-message-ssh').show();
}
var changeTestMessage = function (message) {
$('span#test-gotty-message-ssh').text(message);
}
var errorMessage = '".__('Unable to connect.')."';
hideMessage();
showLoadingImage();
checkAddressReachability('ssh', function(isReachable) {
if (isReachable) {
showSuccessImage();
hideMessage();
} else {
showFailureImage();
changeTestMessage(errorMessage);
showMessage();
}
});
};";
echo $handle_test_ssh;
echo $handle_test_telnet;
echo '</script>';
extensions_add_godmode_function('quickShellSettings'); extensions_add_godmode_function('quickShellSettings');

View File

@ -106,6 +106,7 @@ enterprise/godmode/alerts/alert_events.php
enterprise/godmode/alerts/alert_events_list.php enterprise/godmode/alerts/alert_events_list.php
enterprise/godmode/alerts/alert_events_rules.php enterprise/godmode/alerts/alert_events_rules.php
enterprise/godmode/alerts/configure_alert_rule.php enterprise/godmode/alerts/configure_alert_rule.php
enterprise/godmode/alerts/alert_correlation.php
enterprise/include/functions_networkmap.php enterprise/include/functions_networkmap.php
enterprise/operation/agentes/pandora_networkmap.view.php enterprise/operation/agentes/pandora_networkmap.view.php
enterprise/include/ajax/map_enterprise.ajax.php enterprise/include/ajax/map_enterprise.ajax.php
@ -1708,3 +1709,14 @@ enterprise/godmode/wizards/Cloud.class.php
enterprise/images/wizard/applications.png enterprise/images/wizard/applications.png
enterprise/images/wizard/cloud.png enterprise/images/wizard/cloud.png
enterprise/images/wizard/consoletasks.png enterprise/images/wizard/consoletasks.png
pandora_websocket_engine
operation/incidents/configure_integriaims_incident.php
operation/incidents/dashboard_detail_integriaims_incident.php
operation/incidents/incident_statistics.php
operation/incidents/integriaims_export_csv.php
operation/incidents/list_integriaims_incidents.php
include/functions_incidents.php
include/functions_integriaims.php
include/ajax/integria_incidents.ajax.php
enterprise/operation/log/log_source.php
enterprise/include/class/LogSource.class.php

View File

@ -0,0 +1,11 @@
pandorafms.vmware=9959cc3e5cc6bfcfadd6d05b56d4a11b
pandorafms.mysql=fadb4750d18285c0eca34f47c6aa3cfe
pandorafms.mssql=1cc215409741d19080269ffba112810e
pandorafms.oracle=2d9320a514d1e48a0b2804e1653c31c6
pandorafms.db2=122f2abff0ec1d668c35ee0911483021
pandorafms.sap.deset=9bb72b7f7497a8b543f25cd71f96878f
pandorafms.gcp.ce=6743d39452f8e1ad85d0d56a30843973
pandorafms.aws.ec2=07416081f11d92a7d5d9441dabb5c5cb
pandorafms.aws.s3=eff053a212ea112e2a37efd9debbe6a0
pandorafms.aws.rds=47d7b02019329e1698f96db4959f9516
pandorafms.azure.mc=04a1072d1ece8583645ad88204fbeed3

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,600 @@
-- Insert new RDS APP
SET @current_app_type = 7;
SET @short_name = 'pandorafms.aws.rds';
SET @name = 'Amazon&#x20;RDS';
SET @section = 'cloud';
SET @description = 'Monitor&#x20;AWS&#x20;RDS&#x20;instances';
SET @version = '1.0';
INSERT IGNORE INTO `tdiscovery_apps` (`id_app`, `short_name`, `name`, `section`, `description`, `version`) VALUES ('', @short_name, @name, @section, @description, @version);
SELECT @id_app := `id_app` FROM `tdiscovery_apps` WHERE `short_name` = @short_name;
-- Insert into tdiscovery_apps_scripts
INSERT IGNORE INTO `tdiscovery_apps_scripts` (`id_app`, `macro`, `value`) VALUES (@id_app, '_exec1_', 'bin/pandora_aws_rds');
INSERT IGNORE INTO `tdiscovery_apps_scripts` (`id_app`, `macro`, `value`) VALUES (@id_app, '_exec2_', 'bin/aws_rds');
-- Insert into tdiscovery_apps_executions
INSERT IGNORE INTO `tdiscovery_apps_executions` (`id`, `id_app`, `execution`) VALUES (1, @id_app, '&#039;_exec1_&#039;&#x20;--conf&#x20;&#039;_tempfileRDS_&#039;');
-- Insert new MySQL APP
SET @short_name = 'pandorafms.mysql';
SET @name = 'MySQL';
SET @section = 'app';
SET @description = 'Monitor&#x20;MySQL&#x20;databases';
SET @version = '1.0';
INSERT IGNORE INTO `tdiscovery_apps` (`id_app`, `short_name`, `name`, `section`, `description`, `version`) VALUES ('', @short_name, @name, @section, @description, @version);
SELECT @id_app_mysql := `id_app` FROM `tdiscovery_apps` WHERE `short_name` = @short_name;
-- Insert into tdiscovery_apps_scripts
INSERT IGNORE INTO `tdiscovery_apps_scripts` (`id_app`, `macro`, `value`) VALUES (@id_app, '_exec1_', 'bin/pandora_mysql');
-- Insert into tdiscovery_apps_executions
INSERT IGNORE INTO `tdiscovery_apps_executions` (`id`, `id_app`, `execution`) VALUES ('', @id_app, '&#039;_exec1_&#039;&#x20;--conf&#x20;&#039;_tempfileConf_&#039;&#x20;--target_databases&#x20;&#039;_tempfileTargetDatabases_&#039;&#x20;--target_agents&#x20;&#039;_tempfileTargetAgents_&#039;&#x20;--custom_queries&#x20;&#039;_tempfileCustomQueries_&#039;');
-- Insert new Oracle APP
SET @short_name = 'pandorafms.oracle';
SET @name = 'Oracle';
SET @section = 'app';
SET @description = 'Monitor&#x20;Oracle&#x20;databases';
SET @version = '1.0';
INSERT IGNORE INTO `tdiscovery_apps` (`id_app`, `short_name`, `name`, `section`, `description`, `version`) VALUES ('', @short_name, @name, @section, @description, @version);
SELECT @id_app_oracle := `id_app` FROM `tdiscovery_apps` WHERE `short_name` = @short_name;
-- Insert into tdiscovery_apps_scripts
INSERT IGNORE INTO `tdiscovery_apps_scripts` (`id_app`, `macro`, `value`) VALUES (@id_app, '_exec1_', 'bin/pandora_oracle');
-- Insert into tdiscovery_apps_executions
INSERT IGNORE INTO `tdiscovery_apps_executions` (`id`, `id_app`, `execution`) VALUES ('', @id_app, '&#039;_exec1_&#039;&#x20;--conf&#x20;&#039;_tempfileConf_&#039;&#x20;--target_databases&#x20;&#039;_tempfileTargetDatabases_&#039;&#x20;--target_agents&#x20;&#039;_tempfileTargetAgents_&#039;&#x20;--custom_queries&#x20;&#039;_tempfileCustomQueries_&#039;');
-- Migrate current RDS tasks configurations
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`, '_tentacleIP_', 'custom', '127.0.0.1', 0
FROM `trecon_task`
WHERE `type` = @current_app_type
;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`, '_tentaclePort_', 'custom', '41121', 0
FROM `trecon_task`
WHERE `type` = @current_app_type
;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`, '_tentacleExtraOpt_', 'custom', '', 0
FROM `trecon_task`
WHERE `type` = @current_app_type
;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`, '_credentials_', 'credentials.aws', `auth_strings`, 0
FROM `trecon_task`
WHERE `trecon_task`.`type` = @current_app_type
;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`, '_threads_', 'custom', 1, 0
FROM `trecon_task`
WHERE `type` = @current_app_type
;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`, '_useProxy_', 'custom', 0, 0
FROM `trecon_task`
WHERE `type` = @current_app_type
;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`, '_proxyUrl_', 'custom', '', 0
FROM `trecon_task`
WHERE `type` = @current_app_type
;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`, '_sslCheck_', 'custom', 0, 0
FROM `trecon_task`
WHERE `type` = @current_app_type
;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`, '_rdsInstance_', 'custom', JSON_UNQUOTE(JSON_EXTRACT(CONVERT(FROM_BASE64(`field1`) USING UTF8MB4), '$.dbtargets')), 0
FROM `trecon_task`
WHERE `type` = @current_app_type
;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`, '_rdsZones_', 'custom', '[]', 0
FROM `trecon_task`
WHERE `type` = @current_app_type
;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`, '_rdsZonesInstance_', 'custom', '[]', 0
FROM `trecon_task`
WHERE `type` = @current_app_type
;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`, '_rdsInstanceSummary_', 'custom', 0, 0
FROM `trecon_task`
WHERE `type` = @current_app_type
;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`, '_rdsCpuPerfSummary_', 'custom', 0, 0
FROM `trecon_task`
WHERE `type` = @current_app_type
;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`, '_rdsIopsPerfSummary_', 'custom', 0, 0
FROM `trecon_task`
WHERE `type` = @current_app_type
;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`, '_rdsDiskPerfSummary_', 'custom', 0, 0
FROM `trecon_task`
WHERE `type` = @current_app_type
;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`, '_rdsNetworkPerfSummary_', 'custom', 0, 0
FROM `trecon_task`
WHERE `type` = @current_app_type
;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`, '_tempfileRDS_', 'custom', 'interval=__taskInterval__&#x0d;&#x0a;agents_group_name=__taskGroup__&#x0d;&#x0a;advance_monitoring=_rdsInstanceSummary_&#x0d;&#x0a;cpu_summary=_rdsCpuPerfSummary_&#x0d;&#x0a;iops_summary=_rdsIopsPerfSummary_&#x0d;&#x0a;disk_summary=_rdsDiskPerfSummary_&#x0d;&#x0a;network_summary=_rdsNetworkPerfSummary_&#x0d;&#x0a;aws_instances=_rdsInstance_&#x0d;&#x0a;aws_regions=_rdsZones_&#x0d;&#x0a;creds_b64=_credentials_&#x0d;&#x0a;temporal=__temp__&#x0d;&#x0a;transfer_mode=tentacle&#x0d;&#x0a;tentacle_ip=_tentacleIP_&#x0d;&#x0a;tentacle_port=_tentaclePort_&#x0d;&#x0a;tentacle_opts=_tentacleExtraOpt_&#x0d;&#x0a;threads=_threads_&#x0d;&#x0a;stats_agent=_statsAgent_&#x0d;&#x0a;stats_agent_name=_statsAgentName_', 1
FROM `trecon_task`
WHERE `type` = @current_app_type
;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`, '_statsAgent_', 'custom', 0, 0
FROM `trecon_task`
WHERE `type` = @current_app_type
;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`, '_statsAgentName_', 'custom', '', 0
FROM `trecon_task`
WHERE `type` = @current_app_type
;
-- Migrate current RDS tasks to MySQL tasks
INSERT IGNORE INTO `trecon_task`
(
`id_rt`,
`name`,
`description`,
`id_group`,
`utimestamp`,
`status`,
`interval_sweep`,
`id_recon_server`,
`disabled`,
`summary`,
`type`,
`id_app`,
`setup_complete`,
`field1`
)
SELECT
'',
CONCAT('MySQL&#x20;-&#x20;', `name`),
CONCAT('Migrated&#x20;from&#x20;-&#x20;', `name`),
`id_group`,
`utimestamp`,
`status`,
`interval_sweep`,
`id_recon_server`,
`disabled`,
`summary`,
`type`,
@id_app_mysql,
0,
`field1`
FROM `trecon_task`
WHERE `type` = @current_app_type AND JSON_UNQUOTE(JSON_EXTRACT(CONVERT(FROM_BASE64(`field1`) USING UTF8MB4), '$.dbengine')) = 'mysql'
;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`, '_dbstrings_', 'custom', REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(JSON_UNQUOTE(JSON_EXTRACT(CONVERT(FROM_BASE64(`field1`) USING UTF8MB4), '$.dbtargets')),'","',','),'["',''),'"]',''),'[',''),']',''), 0
FROM `trecon_task`
WHERE `type` = @current_app_type AND `id_app` = @id_app_mysql
;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`, '_dbuser_', 'custom', JSON_UNQUOTE(JSON_EXTRACT(CONVERT(FROM_BASE64(`field1`) USING UTF8MB4), '$.dbuser')), 0
FROM `trecon_task`
WHERE `type` = @current_app_type AND `id_app` = @id_app_mysql
;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`, '_dbpass_', 'custom', JSON_UNQUOTE(JSON_EXTRACT(CONVERT(FROM_BASE64(`field1`) USING UTF8MB4), '$.dbpass')), 0
FROM `trecon_task`
WHERE `type` = @current_app_type AND `id_app` = @id_app_mysql
;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`, '_threads_', 'custom', '1', 0
FROM `trecon_task`
WHERE `type` = @current_app_type AND `id_app` = @id_app_mysql
;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`, '_engineAgent_', 'custom', '', 0
FROM `trecon_task`
WHERE `type` = @current_app_type AND `id_app` = @id_app_mysql
;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`, '_prefixModuleName_', 'custom', JSON_UNQUOTE(JSON_EXTRACT(CONVERT(FROM_BASE64(`field1`) USING UTF8MB4), '$.prefix_module_name')), 0
FROM `trecon_task`
WHERE `type` = @current_app_type AND `id_app` = @id_app_mysql
;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`, '_scanDatabases_', 'custom', JSON_UNQUOTE(JSON_EXTRACT(CONVERT(FROM_BASE64(`field1`) USING UTF8MB4), '$.scan_databases')), 0
FROM `trecon_task`
WHERE `type` = @current_app_type AND `id_app` = @id_app_mysql
;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`, '_agentPerDatabase_', 'custom', JSON_UNQUOTE(JSON_EXTRACT(CONVERT(FROM_BASE64(`field1`) USING UTF8MB4), '$.agent_per_database')), 0
FROM `trecon_task`
WHERE `type` = @current_app_type AND `id_app` = @id_app_mysql
;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`, '_prefixAgent_', 'custom', JSON_UNQUOTE(JSON_EXTRACT(CONVERT(FROM_BASE64(`field1`) USING UTF8MB4), '$.prefix_agent')), 0
FROM `trecon_task`
WHERE `type` = @current_app_type AND `id_app` = @id_app_mysql
;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`, '_checkUptime_', 'custom', JSON_UNQUOTE(JSON_EXTRACT(CONVERT(FROM_BASE64(`field1`) USING UTF8MB4), '$.check_uptime')), 0
FROM `trecon_task`
WHERE `type` = @current_app_type AND `id_app` = @id_app_mysql
;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`, '_queryStats_', 'custom', JSON_UNQUOTE(JSON_EXTRACT(CONVERT(FROM_BASE64(`field1`) USING UTF8MB4), '$.query_stats')), 0
FROM `trecon_task`
WHERE `type` = @current_app_type AND `id_app` = @id_app_mysql
;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`, '_checkConnections_', 'custom', JSON_UNQUOTE(JSON_EXTRACT(CONVERT(FROM_BASE64(`field1`) USING UTF8MB4), '$.check_connections')), 0
FROM `trecon_task`
WHERE `type` = @current_app_type AND `id_app` = @id_app_mysql
;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`, '_checkInnodb_', 'custom', JSON_UNQUOTE(JSON_EXTRACT(CONVERT(FROM_BASE64(`field1`) USING UTF8MB4), '$.check_innodb')), 0
FROM `trecon_task`
WHERE `type` = @current_app_type AND `id_app` = @id_app_mysql
;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`, '_checkCache_', 'custom', JSON_UNQUOTE(JSON_EXTRACT(CONVERT(FROM_BASE64(`field1`) USING UTF8MB4), '$.check_cache')), 0
FROM `trecon_task`
WHERE `type` = @current_app_type AND `id_app` = @id_app_mysql
;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`, '_executeCustomQueries_', 'custom', JSON_UNQUOTE(JSON_EXTRACT(CONVERT(FROM_BASE64(`field1`) USING UTF8MB4), '$.execute_custom_queries')), 0
FROM `trecon_task`
WHERE `type` = @current_app_type AND `id_app` = @id_app_mysql
;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`, '_customQueries_', 'custom', JSON_UNQUOTE(JSON_EXTRACT(CONVERT(FROM_BASE64(`field1`) USING UTF8MB4), '$.custom_queries')), 0
FROM `trecon_task`
WHERE `type` = @current_app_type AND `id_app` = @id_app_mysql
;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`, '_tempfileConf_', 'custom', 'agents_group_id&#x20;=&#x20;__taskGroupID__&#x0d;&#x0a;interval&#x20;=&#x20;__taskInterval__&#x0d;&#x0a;user&#x20;=&#x20;_dbuser_&#x0d;&#x0a;password&#x20;=&#x20;_dbpass_&#x0d;&#x0a;threads&#x20;=&#x20;_threads_&#x0d;&#x0a;modules_prefix&#x20;=&#x20;_prefixModuleName_&#x0d;&#x0a;execute_custom_queries&#x20;=&#x20;_executeCustomQueries_&#x0d;&#x0a;analyze_connections&#x20;=&#x20;_checkConnections_&#x0d;&#x0a;scan_databases&#x20;=&#x20;_scanDatabases_&#x0d;&#x0a;agent_per_database&#x20;=&#x20;_agentPerDatabase_&#x0d;&#x0a;db_agent_prefix&#x20;=&#x20;_prefixAgent_&#x0d;&#x0a;innodb_stats&#x20;=&#x20;_checkInnodb_&#x0d;&#x0a;engine_uptime&#x20;=&#x20;_checkUptime_&#x0d;&#x0a;query_stats&#x20;=&#x20;_queryStats_&#x0d;&#x0a;cache_stats&#x20;=&#x20;_checkCache_', 1
FROM `trecon_task`
WHERE `type` = @current_app_type AND `id_app` = @id_app_mysql
;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`, '_tempfileTargetDatabases_', 'custom', '_dbstrings_', 1
FROM `trecon_task`
WHERE `type` = @current_app_type AND `id_app` = @id_app_mysql
;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`, '_tempfileTargetAgents_', 'custom', '_engineAgent_', 1
FROM `trecon_task`
WHERE `type` = @current_app_type AND `id_app` = @id_app_mysql
;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`, '_tempfileCustomQueries_', 'custom', '_customQueries_', 1
FROM `trecon_task`
WHERE `type` = @current_app_type AND `id_app` = @id_app_mysql
;
-- Migrate current RDS tasks to Oracle tasks
INSERT IGNORE INTO `trecon_task`
(
`id_rt`,
`name`,
`description`,
`id_group`,
`utimestamp`,
`status`,
`interval_sweep`,
`id_recon_server`,
`disabled`,
`summary`,
`type`,
`id_app`,
`setup_complete`,
`field1`
)
SELECT
'',
CONCAT('Oracle&#x20;-&#x20;', `name`),
CONCAT('Migrated&#x20;from&#x20;-&#x20;', `name`),
`id_group`,
`utimestamp`,
`status`,
`interval_sweep`,
`id_recon_server`,
`disabled`,
`summary`,
`type`,
@id_app_oracle,
0,
`field1`
FROM `trecon_task`
WHERE `type` = @current_app_type AND JSON_UNQUOTE(JSON_EXTRACT(CONVERT(FROM_BASE64(`field1`) USING UTF8MB4), '$.dbengine')) = 'oracle'
;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`, '_dbstrings_', 'custom', REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(JSON_UNQUOTE(JSON_EXTRACT(CONVERT(FROM_BASE64(`field1`) USING UTF8MB4), '$.dbtargets')),'","',','),'["',''),'"]',''),'[',''),']',''), 0
FROM `trecon_task`
WHERE `type` = @current_app_type AND `id_app` = @id_app_oracle
;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`, '_dbuser_', 'custom', JSON_UNQUOTE(JSON_EXTRACT(CONVERT(FROM_BASE64(`field1`) USING UTF8MB4), '$.dbuser')), 0
FROM `trecon_task`
WHERE `type` = @current_app_type AND `id_app` = @id_app_oracle
;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`, '_dbpass_', 'custom', JSON_UNQUOTE(JSON_EXTRACT(CONVERT(FROM_BASE64(`field1`) USING UTF8MB4), '$.dbpass')), 0
FROM `trecon_task`
WHERE `type` = @current_app_type AND `id_app` = @id_app_oracle
;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`, '_threads_', 'custom', '1', 0
FROM `trecon_task`
WHERE `type` = @current_app_type AND `id_app` = @id_app_oracle
;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`, '_engineAgent_', 'custom', '', 0
FROM `trecon_task`
WHERE `type` = @current_app_type AND `id_app` = @id_app_oracle
;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`, '_prefixModuleName_', 'custom', JSON_UNQUOTE(JSON_EXTRACT(CONVERT(FROM_BASE64(`field1`) USING UTF8MB4), '$.prefix_module_name')), 0
FROM `trecon_task`
WHERE `type` = @current_app_type AND `id_app` = @id_app_oracle
;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`, '_checkUptime_', 'custom', JSON_UNQUOTE(JSON_EXTRACT(CONVERT(FROM_BASE64(`field1`) USING UTF8MB4), '$.check_uptime')), 0
FROM `trecon_task`
WHERE `type` = @current_app_type AND `id_app` = @id_app_oracle
;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`, '_queryStats_', 'custom', JSON_UNQUOTE(JSON_EXTRACT(CONVERT(FROM_BASE64(`field1`) USING UTF8MB4), '$.query_stats')), 0
FROM `trecon_task`
WHERE `type` = @current_app_type AND `id_app` = @id_app_oracle
;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`, '_checkConnections_', 'custom', JSON_UNQUOTE(JSON_EXTRACT(CONVERT(FROM_BASE64(`field1`) USING UTF8MB4), '$.check_connections')), 0
FROM `trecon_task`
WHERE `type` = @current_app_type AND `id_app` = @id_app_oracle
;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`, '_checkFragmentation_', 'custom', JSON_UNQUOTE(JSON_EXTRACT(CONVERT(FROM_BASE64(`field1`) USING UTF8MB4), '$.check_fragmentation')), 0
FROM `trecon_task`
WHERE `type` = @current_app_type AND `id_app` = @id_app_oracle
;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`, '_checkTablespaces_', 'custom', JSON_UNQUOTE(JSON_EXTRACT(CONVERT(FROM_BASE64(`field1`) USING UTF8MB4), '$.check_tablespaces')), 0
FROM `trecon_task`
WHERE `type` = @current_app_type AND `id_app` = @id_app_oracle
;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`, '_checkCache_', 'custom', JSON_UNQUOTE(JSON_EXTRACT(CONVERT(FROM_BASE64(`field1`) USING UTF8MB4), '$.check_cache')), 0
FROM `trecon_task`
WHERE `type` = @current_app_type AND `id_app` = @id_app_oracle
;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`, '_executeCustomQueries_', 'custom', JSON_UNQUOTE(JSON_EXTRACT(CONVERT(FROM_BASE64(`field1`) USING UTF8MB4), '$.execute_custom_queries')), 0
FROM `trecon_task`
WHERE `type` = @current_app_type AND `id_app` = @id_app_oracle
;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`, '_customQueries_', 'custom', JSON_UNQUOTE(JSON_EXTRACT(CONVERT(FROM_BASE64(`field1`) USING UTF8MB4), '$.custom_queries')), 0
FROM `trecon_task`
WHERE `type` = @current_app_type AND `id_app` = @id_app_oracle
;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`, '_tempfileConf_', 'custom', 'agents_group_id&#x20;=&#x20;__taskGroupID__&#x0d;&#x0a;interval&#x20;=&#x20;__taskInterval__&#x0d;&#x0a;user&#x20;=&#x20;_dbuser_&#x0d;&#x0a;password&#x20;=&#x20;_dbpass_&#x0d;&#x0a;threads&#x20;=&#x20;_threads_&#x0d;&#x0a;modules_prefix&#x20;=&#x20;_prefixModuleName_&#x0d;&#x0a;execute_custom_queries&#x20;=&#x20;_executeCustomQueries_&#x0d;&#x0a;analyze_connections&#x20;=&#x20;_checkConnections_&#x0d;&#x0a;engine_uptime&#x20;=&#x20;_checkUptime_&#x0d;&#x0a;query_stats&#x20;=&#x20;_queryStats_&#x0d;&#x0a;cache_stats&#x20;=&#x20;_checkCache_&#x0d;&#x0a;fragmentation_ratio&#x20;=&#x20;_checkFragmentation_&#x0d;&#x0a;check_tablescpaces&#x20;=&#x20;_checkTablespaces_', 1
FROM `trecon_task`
WHERE `type` = @current_app_type AND `id_app` = @id_app_oracle
;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`, '_tempfileTargetDatabases_', 'custom', '_dbstrings_', 1
FROM `trecon_task`
WHERE `type` = @current_app_type AND `id_app` = @id_app_oracle
;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`, '_tempfileTargetAgents_', 'custom', '_engineAgent_', 1
FROM `trecon_task`
WHERE `type` = @current_app_type AND `id_app` = @id_app_oracle
;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`, '_tempfileCustomQueries_', 'custom', '_customQueries_', 1
FROM `trecon_task`
WHERE `type` = @current_app_type AND `id_app` = @id_app_oracle
;
-- Migrate current RDS tasks
UPDATE `trecon_task`
SET
`setup_complete` = 1,
`type` = 15
WHERE `type` = @current_app_type AND `id_app` = @id_app_mysql
;
UPDATE `trecon_task`
SET
`setup_complete` = 1,
`type` = 15
WHERE `type` = @current_app_type AND `id_app` = @id_app_oracle
;
UPDATE `trecon_task`
SET
`id_app` = @id_app,
`setup_complete` = 1,
`type` = 15
WHERE `type` = @current_app_type AND `id_app` IS NULL
;

View File

@ -0,0 +1,442 @@
-- Insert new S3 APP
SET @current_app_type = 14;
SET @short_name = 'pandorafms.aws.s3';
SET @name = 'Amazon&#x20;S3';
SET @section = 'cloud';
SET @description = 'Monitor&#x20;AWS&#x20;S3&#x20;buckets';
SET @version = '1.0';
INSERT IGNORE INTO `tdiscovery_apps` (`id_app`, `short_name`, `name`, `section`, `description`, `version`) VALUES ('', @short_name, @name, @section, @description, @version);
SELECT @id_app := `id_app` FROM `tdiscovery_apps` WHERE `short_name` = @short_name;
-- Insert into tdiscovery_apps_scripts
INSERT IGNORE INTO `tdiscovery_apps_scripts` (`id_app`, `macro`, `value`) VALUES (@id_app, '_exec1_', 'bin/pandora_aws_s3');
INSERT IGNORE INTO `tdiscovery_apps_scripts` (`id_app`, `macro`, `value`) VALUES (@id_app, '_exec2_', 'bin/aws_s3');
-- Insert into tdiscovery_apps_executions
INSERT IGNORE INTO `tdiscovery_apps_executions` (`id`, `id_app`, `execution`) VALUES (1, @id_app, '&#039;_exec1_&#039;&#x20;--conf&#x20;&#039;_tempfileS3_&#039;');
-- Migrate current S3 tasks configurations
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`, '_tentacleIP_', 'custom', JSON_UNQUOTE(JSON_EXTRACT(`field2`, '$.tentacle_ip')), 0
FROM `trecon_task`
WHERE `type` = @current_app_type
;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`, '_tentaclePort_', 'custom', JSON_UNQUOTE(JSON_EXTRACT(`field2`, '$.tentacle_port')), 0
FROM `trecon_task`
WHERE `type` = @current_app_type
;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`, '_tentacleExtraOpt_', 'custom', JSON_UNQUOTE(JSON_EXTRACT(`field2`, '$.tentacle_opts')), 0
FROM `trecon_task`
WHERE `type` = @current_app_type
;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`, '_credentials_', 'credentials.aws', `auth_strings`, 0
FROM `trecon_task`
WHERE `trecon_task`.`type` = @current_app_type
;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`, '_threads_', 'custom', 1, 0
FROM `trecon_task`
WHERE `type` = @current_app_type
;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`, '_useProxy_', 'custom', 0, 0
FROM `trecon_task`
WHERE `type` = @current_app_type
;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`, '_proxyUrl_', 'custom', '', 0
FROM `trecon_task`
WHERE `type` = @current_app_type
;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`, '_sslCheck_', 'custom', 0, 0
FROM `trecon_task`
WHERE `type` = @current_app_type
;
SET @position = 3;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`,
IF(
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",-1),"\n",1),"\n"),"")),"s3_bucket ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",-1),"\n",1),"\n"),"")),"s3_bucket ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",-1),"\n",1),"\n"),"")),"s3_bucket ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", 1) = 's3_monitoring',
'_s3Monitoring_',
IF(
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",-1),"\n",1),"\n"),"")),"s3_bucket ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",-1),"\n",1),"\n"),"")),"s3_bucket ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",-1),"\n",1),"\n"),"")),"s3_bucket ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", 1) = 's3_size',
'_s3Size_',
IF(
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",-1),"\n",1),"\n"),"")),"s3_bucket ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",-1),"\n",1),"\n"),"")),"s3_bucket ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",-1),"\n",1),"\n"),"")),"s3_bucket ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", 1) = 's3_items',
'_s3Items_',
NULL
)
)
),
'custom',
IF(
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",-1),"\n",1),"\n"),"")),"s3_bucket ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",-1),"\n",1),"\n"),"")),"s3_bucket ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",-1),"\n",1),"\n"),"")),"s3_bucket ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", 1) = 's3_monitoring',
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",-1),"\n",1),"\n"),"")),"s3_bucket ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",-1),"\n",1),"\n"),"")),"s3_bucket ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",-1),"\n",1),"\n"),"")),"s3_bucket ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", -1),
IF(
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",-1),"\n",1),"\n"),"")),"s3_bucket ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",-1),"\n",1),"\n"),"")),"s3_bucket ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",-1),"\n",1),"\n"),"")),"s3_bucket ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", 1) = 's3_size',
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",-1),"\n",1),"\n"),"")),"s3_bucket ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",-1),"\n",1),"\n"),"")),"s3_bucket ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",-1),"\n",1),"\n"),"")),"s3_bucket ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", -1),
IF(
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",-1),"\n",1),"\n"),"")),"s3_bucket ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",-1),"\n",1),"\n"),"")),"s3_bucket ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",-1),"\n",1),"\n"),"")),"s3_bucket ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", 1) = 's3_items',
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",-1),"\n",1),"\n"),"")),"s3_bucket ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",-1),"\n",1),"\n"),"")),"s3_bucket ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",-1),"\n",1),"\n"),"")),"s3_bucket ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", -1),
"0"
)
)
),
0
FROM `trecon_task`
WHERE `type` = @current_app_type
;
SET @position = 4;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`,
IF(
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",-1),"\n",1),"\n"),"")),"s3_bucket ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",-1),"\n",1),"\n"),"")),"s3_bucket ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",-1),"\n",1),"\n"),"")),"s3_bucket ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", 1) = 's3_monitoring',
'_s3Monitoring_',
IF(
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",-1),"\n",1),"\n"),"")),"s3_bucket ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",-1),"\n",1),"\n"),"")),"s3_bucket ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",-1),"\n",1),"\n"),"")),"s3_bucket ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", 1) = 's3_size',
'_s3Size_',
IF(
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",-1),"\n",1),"\n"),"")),"s3_bucket ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",-1),"\n",1),"\n"),"")),"s3_bucket ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",-1),"\n",1),"\n"),"")),"s3_bucket ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", 1) = 's3_items',
'_s3Items_',
NULL
)
)
),
'custom',
IF(
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",-1),"\n",1),"\n"),"")),"s3_bucket ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",-1),"\n",1),"\n"),"")),"s3_bucket ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",-1),"\n",1),"\n"),"")),"s3_bucket ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", 1) = 's3_monitoring',
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",-1),"\n",1),"\n"),"")),"s3_bucket ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",-1),"\n",1),"\n"),"")),"s3_bucket ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",-1),"\n",1),"\n"),"")),"s3_bucket ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", -1),
IF(
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",-1),"\n",1),"\n"),"")),"s3_bucket ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",-1),"\n",1),"\n"),"")),"s3_bucket ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",-1),"\n",1),"\n"),"")),"s3_bucket ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", 1) = 's3_size',
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",-1),"\n",1),"\n"),"")),"s3_bucket ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",-1),"\n",1),"\n"),"")),"s3_bucket ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",-1),"\n",1),"\n"),"")),"s3_bucket ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", -1),
IF(
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",-1),"\n",1),"\n"),"")),"s3_bucket ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",-1),"\n",1),"\n"),"")),"s3_bucket ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",-1),"\n",1),"\n"),"")),"s3_bucket ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", 1) = 's3_items',
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",-1),"\n",1),"\n"),"")),"s3_bucket ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",-1),"\n",1),"\n"),"")),"s3_bucket ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",-1),"\n",1),"\n"),"")),"s3_bucket ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", -1),
"0"
)
)
),
0
FROM `trecon_task`
WHERE `type` = @current_app_type
;
SET @position = 5;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`,
IF(
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",-1),"\n",1),"\n"),"")),"s3_bucket ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",-1),"\n",1),"\n"),"")),"s3_bucket ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",-1),"\n",1),"\n"),"")),"s3_bucket ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", 1) = 's3_monitoring',
'_s3Monitoring_',
IF(
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",-1),"\n",1),"\n"),"")),"s3_bucket ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",-1),"\n",1),"\n"),"")),"s3_bucket ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",-1),"\n",1),"\n"),"")),"s3_bucket ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", 1) = 's3_size',
'_s3Size_',
IF(
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",-1),"\n",1),"\n"),"")),"s3_bucket ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",-1),"\n",1),"\n"),"")),"s3_bucket ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",-1),"\n",1),"\n"),"")),"s3_bucket ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", 1) = 's3_items',
'_s3Items_',
NULL
)
)
),
'custom',
IF(
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",-1),"\n",1),"\n"),"")),"s3_bucket ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",-1),"\n",1),"\n"),"")),"s3_bucket ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",-1),"\n",1),"\n"),"")),"s3_bucket ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", 1) = 's3_monitoring',
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",-1),"\n",1),"\n"),"")),"s3_bucket ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",-1),"\n",1),"\n"),"")),"s3_bucket ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",-1),"\n",1),"\n"),"")),"s3_bucket ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", -1),
IF(
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",-1),"\n",1),"\n"),"")),"s3_bucket ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",-1),"\n",1),"\n"),"")),"s3_bucket ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",-1),"\n",1),"\n"),"")),"s3_bucket ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", 1) = 's3_size',
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",-1),"\n",1),"\n"),"")),"s3_bucket ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",-1),"\n",1),"\n"),"")),"s3_bucket ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",-1),"\n",1),"\n"),"")),"s3_bucket ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", -1),
IF(
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",-1),"\n",1),"\n"),"")),"s3_bucket ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",-1),"\n",1),"\n"),"")),"s3_bucket ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",-1),"\n",1),"\n"),"")),"s3_bucket ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", 1) = 's3_items',
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",-1),"\n",1),"\n"),"")),"s3_bucket ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",-1),"\n",1),"\n"),"")),"s3_bucket ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"s3_zone ",-1),"\n",1),"\n"),"")),"s3_bucket ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", -1),
"0"
)
)
),
0
FROM `trecon_task`
WHERE `type` = @current_app_type
;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`, '_statsAgent_', 'custom', 0, 0
FROM `trecon_task`
WHERE `type` = @current_app_type
;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`, '_statsAgentName_', 'custom', '', 0
FROM `trecon_task`
WHERE `type` = @current_app_type
;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`, '_s3Monitoring_', 'custom', 0, 0
FROM `trecon_task`
WHERE `type` = @current_app_type
;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`, '_s3Size_', 'custom', 0, 0
FROM `trecon_task`
WHERE `type` = @current_app_type
;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`, '_s3Items_', 'custom', 0, 0
FROM `trecon_task`
WHERE `type` = @current_app_type
;
SET @param = 's3_bucket';
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`,
'_s3Bucket_',
'custom',
REPLACE(
REPLACE(
CONCAT(
'["',
REPLACE(
REPLACE(
REPLACE(
REPLACE(
CONVERT(FROM_BASE64(`field1`) USING UTF8MB4),
SUBSTRING_INDEX(
CONVERT(FROM_BASE64(`field1`) USING UTF8MB4),
CONCAT(@param, " "), 1
),
""
),
REPLACE(
SUBSTRING_INDEX(
REPLACE(
CONVERT(FROM_BASE64(`field1`) USING UTF8MB4),
SUBSTRING_INDEX(
CONVERT(FROM_BASE64(`field1`) USING UTF8MB4),
CONCAT(@param, " "), 1
),
""
),
CONCAT(@param, " "), -1
),
SUBSTRING_INDEX(SUBSTRING_INDEX(
REPLACE(
CONVERT(FROM_BASE64(`field1`) USING UTF8MB4),
SUBSTRING_INDEX(
CONVERT(FROM_BASE64(`field1`) USING UTF8MB4),
CONCAT(@param, " "), 1
),
""
),
CONCAT(@param, " "), -1
), "\n", 1),
""
),
"\n"
),
CONCAT(@param, " "),
""
),
"\n",
'","'
),
'"]'
),
',""]',
']'
),
'[""]',
'[]'
),
0
FROM `trecon_task`
WHERE `type` = @current_app_type
;
SET @param = 's3_zone';
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`,
'_s3Zone_',
'custom',
REPLACE(
REPLACE(
CONCAT(
'["',
REPLACE(
REPLACE(
REPLACE(
REPLACE(
CONVERT(FROM_BASE64(`field1`) USING UTF8MB4),
SUBSTRING_INDEX(
CONVERT(FROM_BASE64(`field1`) USING UTF8MB4),
CONCAT(@param, " "), 1
),
""
),
REPLACE(
SUBSTRING_INDEX(
REPLACE(
CONVERT(FROM_BASE64(`field1`) USING UTF8MB4),
SUBSTRING_INDEX(
CONVERT(FROM_BASE64(`field1`) USING UTF8MB4),
CONCAT(@param, " "), 1
),
""
),
CONCAT(@param, " "), -1
),
SUBSTRING_INDEX(SUBSTRING_INDEX(
REPLACE(
CONVERT(FROM_BASE64(`field1`) USING UTF8MB4),
SUBSTRING_INDEX(
CONVERT(FROM_BASE64(`field1`) USING UTF8MB4),
CONCAT(@param, " "), 1
),
""
),
CONCAT(@param, " "), -1
), "\n", 1),
""
),
"\n"
),
CONCAT(@param, " "),
""
),
"\n",
'","'
),
'"]'
),
',""]',
']'
),
'[""]',
'[]'
),
0
FROM `trecon_task`
WHERE `type` = @current_app_type
;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`, '_tempfileS3_', 'custom', 'interval=__taskInterval__&#x0d;&#x0a;agents_group_name=__taskGroup__&#x0d;&#x0a;aws_regions=_s3Zone_&#x0d;&#x0a;aws_buckets=_s3Bucket_&#x0d;&#x0a;s3_monitoring=_s3Monitoring_&#x0d;&#x0a;size_monitoring=_s3Size_&#x0d;&#x0a;items_monitoring=_s3Items_&#x0d;&#x0a;creds_b64=_credentials_&#x0d;&#x0a;temporal=__temp__&#x0d;&#x0a;transfer_mode=tentacle&#x0d;&#x0a;tentacle_ip=_tentacleIP_&#x0d;&#x0a;tentacle_port=_tentaclePort_&#x0d;&#x0a;tentacle_opts=_tentacleExtraOpt_&#x0d;&#x0a;threads=_threads_&#x0d;&#x0a;stats_agent=_statsAgent_&#x0d;&#x0a;stats_agent_name=_statsAgentName_', 1
FROM `trecon_task`
WHERE `type` = @current_app_type
;
-- Delete NULL macros
DELETE FROM `tdiscovery_apps_tasks_macros` WHERE `macro` = '';
-- Migrate current S3 tasks
UPDATE `trecon_task`
SET
`id_app` = @id_app,
`setup_complete` = 1,
`type` = 15
WHERE `type` = @current_app_type
;

View File

@ -0,0 +1,716 @@
-- Insert new Azure APP
SET @current_app_type = 8;
SET @short_name = 'pandorafms.azure.mc';
SET @name = 'Azure&#x20;Microsoft&#x20;Compute';
SET @section = 'cloud';
SET @description = 'Monitor&#x20;Azure&#x20;Microsoft&#x20;Compute&#x20;VMs';
SET @version = '1.0';
INSERT IGNORE INTO `tdiscovery_apps` (`id_app`, `short_name`, `name`, `section`, `description`, `version`) VALUES ('', @short_name, @name, @section, @description, @version);
SELECT @id_app := `id_app` FROM `tdiscovery_apps` WHERE `short_name` = @short_name;
-- Insert into tdiscovery_apps_scripts
INSERT IGNORE INTO `tdiscovery_apps_scripts` (`id_app`, `macro`, `value`) VALUES (@id_app, '_exec1_', 'bin/pandora_azure_mc');
INSERT IGNORE INTO `tdiscovery_apps_scripts` (`id_app`, `macro`, `value`) VALUES (@id_app, '_exec2_', 'bin/azure_vm');
-- Insert into tdiscovery_apps_executions
INSERT IGNORE INTO `tdiscovery_apps_executions` (`id`, `id_app`, `execution`) VALUES (1, @id_app, '&#039;_exec1_&#039;&#x20;--conf&#x20;&#039;_tempfileAzureMC_&#039;');
-- Migrate current Azure tasks configurations
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`, '_tentacleIP_', 'custom', JSON_UNQUOTE(JSON_EXTRACT(`field2`, '$.tentacle_ip')), 0
FROM `trecon_task`
WHERE `type` = @current_app_type
;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`, '_tentaclePort_', 'custom', JSON_UNQUOTE(JSON_EXTRACT(`field2`, '$.tentacle_port')), 0
FROM `trecon_task`
WHERE `type` = @current_app_type
;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`, '_tentacleExtraOpt_', 'custom', JSON_UNQUOTE(JSON_EXTRACT(`field2`, '$.tentacle_opts')), 0
FROM `trecon_task`
WHERE `type` = @current_app_type
;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`, '_credentials_', 'credentials.azure', `auth_strings`, 0
FROM `trecon_task`
WHERE `trecon_task`.`type` = @current_app_type
;
SET @position = 4;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`,
IF(
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", 1) = 'ec2_instance_summary',
'_azureMCInstanceSummary_',
IF(
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", 1) = 'ec2_cpu_perf_summary',
'_azureMCCpuPerfSummary_',
IF(
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", 1) = 'ec2_iops_perf_summary',
'_azureMCIopsPerfSummary_',
IF(
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", 1) = 'ec2_disk_perf_summary',
'_azureMCDiskPerfSummary_',
IF(
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", 1) = 'ec2_network_perf_summary',
'_azureMCNetworkPerfSummary_',
NULL
)
)
)
)
),
'custom',
IF(
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", 1) = 'ec2_instance_summary',
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", -1),
IF(
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", 1) = 'ec2_cpu_perf_summary',
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", -1),
IF(
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", 1) = 'ec2_iops_perf_summary',
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", -1),
IF(
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", 1) = 'ec2_disk_perf_summary',
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", -1),
IF(
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", 1) = 'ec2_network_perf_summary',
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", -1),
"0"
)
)
)
)
),
0
FROM `trecon_task`
WHERE `type` = @current_app_type
;
SET @position = 5;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`,
IF(
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", 1) = 'ec2_instance_summary',
'_azureMCInstanceSummary_',
IF(
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", 1) = 'ec2_cpu_perf_summary',
'_azureMCCpuPerfSummary_',
IF(
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", 1) = 'ec2_iops_perf_summary',
'_azureMCIopsPerfSummary_',
IF(
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", 1) = 'ec2_disk_perf_summary',
'_azureMCDiskPerfSummary_',
IF(
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", 1) = 'ec2_network_perf_summary',
'_azureMCNetworkPerfSummary_',
NULL
)
)
)
)
),
'custom',
IF(
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", 1) = 'ec2_instance_summary',
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", -1),
IF(
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", 1) = 'ec2_cpu_perf_summary',
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", -1),
IF(
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", 1) = 'ec2_iops_perf_summary',
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", -1),
IF(
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", 1) = 'ec2_disk_perf_summary',
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", -1),
IF(
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", 1) = 'ec2_network_perf_summary',
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", -1),
"0"
)
)
)
)
),
0
FROM `trecon_task`
WHERE `type` = @current_app_type
;
SET @position = 6;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`,
IF(
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", 1) = 'ec2_instance_summary',
'_azureMCInstanceSummary_',
IF(
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", 1) = 'ec2_cpu_perf_summary',
'_azureMCCpuPerfSummary_',
IF(
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", 1) = 'ec2_iops_perf_summary',
'_azureMCIopsPerfSummary_',
IF(
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", 1) = 'ec2_disk_perf_summary',
'_azureMCDiskPerfSummary_',
IF(
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", 1) = 'ec2_network_perf_summary',
'_azureMCNetworkPerfSummary_',
NULL
)
)
)
)
),
'custom',
IF(
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", 1) = 'ec2_instance_summary',
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", -1),
IF(
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", 1) = 'ec2_cpu_perf_summary',
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", -1),
IF(
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", 1) = 'ec2_iops_perf_summary',
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", -1),
IF(
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", 1) = 'ec2_disk_perf_summary',
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", -1),
IF(
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", 1) = 'ec2_network_perf_summary',
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", -1),
"0"
)
)
)
)
),
0
FROM `trecon_task`
WHERE `type` = @current_app_type
;
SET @position = 7;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`,
IF(
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", 1) = 'ec2_instance_summary',
'_azureMCInstanceSummary_',
IF(
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", 1) = 'ec2_cpu_perf_summary',
'_azureMCCpuPerfSummary_',
IF(
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", 1) = 'ec2_iops_perf_summary',
'_azureMCIopsPerfSummary_',
IF(
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", 1) = 'ec2_disk_perf_summary',
'_azureMCDiskPerfSummary_',
IF(
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", 1) = 'ec2_network_perf_summary',
'_azureMCNetworkPerfSummary_',
NULL
)
)
)
)
),
'custom',
IF(
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", 1) = 'ec2_instance_summary',
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", -1),
IF(
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", 1) = 'ec2_cpu_perf_summary',
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", -1),
IF(
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", 1) = 'ec2_iops_perf_summary',
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", -1),
IF(
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", 1) = 'ec2_disk_perf_summary',
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", -1),
IF(
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", 1) = 'ec2_network_perf_summary',
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", -1),
"0"
)
)
)
)
),
0
FROM `trecon_task`
WHERE `type` = @current_app_type
;
SET @position = 8;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`,
IF(
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", 1) = 'ec2_instance_summary',
'_azureMCInstanceSummary_',
IF(
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", 1) = 'ec2_cpu_perf_summary',
'_azureMCCpuPerfSummary_',
IF(
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", 1) = 'ec2_iops_perf_summary',
'_azureMCIopsPerfSummary_',
IF(
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", 1) = 'ec2_disk_perf_summary',
'_azureMCDiskPerfSummary_',
IF(
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", 1) = 'ec2_network_perf_summary',
'_azureMCNetworkPerfSummary_',
NULL
)
)
)
)
),
'custom',
IF(
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", 1) = 'ec2_instance_summary',
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", -1),
IF(
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", 1) = 'ec2_cpu_perf_summary',
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", -1),
IF(
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", 1) = 'ec2_iops_perf_summary',
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", -1),
IF(
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", 1) = 'ec2_disk_perf_summary',
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", -1),
IF(
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", 1) = 'ec2_network_perf_summary',
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", -1),
"0"
)
)
)
)
),
0
FROM `trecon_task`
WHERE `type` = @current_app_type
;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`, '_statsAgent_', 'custom', 0, 0
FROM `trecon_task`
WHERE `type` = @current_app_type
;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`, '_statsAgentName_', 'custom', '', 0
FROM `trecon_task`
WHERE `type` = @current_app_type
;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`, '_threads_', 'custom', 1, 0
FROM `trecon_task`
WHERE `type` = @current_app_type
;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`, '_useProxy_', 'custom', 0, 0
FROM `trecon_task`
WHERE `type` = @current_app_type
;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`, '_proxyUrl_', 'custom', '', 0
FROM `trecon_task`
WHERE `type` = @current_app_type
;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`, '_sslCheck_', 'custom', 0, 0
FROM `trecon_task`
WHERE `type` = @current_app_type
;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`, '_azureMCInstanceSummary_', 'custom', 0, 0
FROM `trecon_task`
WHERE `type` = @current_app_type
;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`, '_azureMCCpuPerfSummary_', 'custom', 0, 0
FROM `trecon_task`
WHERE `type` = @current_app_type
;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`, '_azureMCIopsPerfSummary_', 'custom', 0, 0
FROM `trecon_task`
WHERE `type` = @current_app_type
;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`, '_azureMCDiskPerfSummary_', 'custom', 0, 0
FROM `trecon_task`
WHERE `type` = @current_app_type
;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`, '_azureMCNetworkPerfSummary_', 'custom', 0, 0
FROM `trecon_task`
WHERE `type` = @current_app_type
;
SET @param = 'ec2_instance';
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`,
'_azureMCInstance_',
'custom',
REPLACE(
REPLACE(
CONCAT(
'["',
REPLACE(
REPLACE(
REPLACE(
REPLACE(
CONVERT(FROM_BASE64(`field1`) USING UTF8MB4),
SUBSTRING_INDEX(
CONVERT(FROM_BASE64(`field1`) USING UTF8MB4),
CONCAT(@param, " "), 1
),
""
),
REPLACE(
SUBSTRING_INDEX(
REPLACE(
CONVERT(FROM_BASE64(`field1`) USING UTF8MB4),
SUBSTRING_INDEX(
CONVERT(FROM_BASE64(`field1`) USING UTF8MB4),
CONCAT(@param, " "), 1
),
""
),
CONCAT(@param, " "), -1
),
SUBSTRING_INDEX(SUBSTRING_INDEX(
REPLACE(
CONVERT(FROM_BASE64(`field1`) USING UTF8MB4),
SUBSTRING_INDEX(
CONVERT(FROM_BASE64(`field1`) USING UTF8MB4),
CONCAT(@param, " "), 1
),
""
),
CONCAT(@param, " "), -1
), "\n", 1),
""
),
"\n"
),
CONCAT(@param, " "),
""
),
"\n",
'","'
),
'"]'
),
',""]',
']'
),
'[""]',
'[]'
),
0
FROM `trecon_task`
WHERE `type` = @current_app_type
;
SET @param = 'ec2_zones';
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`,
'_azureMCZones_',
'custom',
REPLACE(
REPLACE(
CONCAT(
'["',
REPLACE(
REPLACE(
REPLACE(
REPLACE(
CONVERT(FROM_BASE64(`field1`) USING UTF8MB4),
SUBSTRING_INDEX(
CONVERT(FROM_BASE64(`field1`) USING UTF8MB4),
CONCAT(@param, " "), 1
),
""
),
REPLACE(
SUBSTRING_INDEX(
REPLACE(
CONVERT(FROM_BASE64(`field1`) USING UTF8MB4),
SUBSTRING_INDEX(
CONVERT(FROM_BASE64(`field1`) USING UTF8MB4),
CONCAT(@param, " "), 1
),
""
),
CONCAT(@param, " "), -1
),
SUBSTRING_INDEX(SUBSTRING_INDEX(
REPLACE(
CONVERT(FROM_BASE64(`field1`) USING UTF8MB4),
SUBSTRING_INDEX(
CONVERT(FROM_BASE64(`field1`) USING UTF8MB4),
CONCAT(@param, " "), 1
),
""
),
CONCAT(@param, " "), -1
), "\n", 1),
""
),
"\n"
),
CONCAT(@param, " "),
""
),
"\n",
'","'
),
'"]'
),
',""]',
']'
),
'[""]',
'[]'
),
0
FROM `trecon_task`
WHERE `type` = @current_app_type
;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`, '_azureMCZonesInstance_', 'custom', '[]', 0
FROM `trecon_task`
WHERE `type` = @current_app_type
;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`, '_tempfileAzureMC_', 'custom', 'agents_group_name=__taskGroup__&#x0d;&#x0a;threads=_threads_&#x0d;&#x0a;interval=__taskInterval__&#x0d;&#x0a;transfer_mode=tentacle&#x0d;&#x0a;tentacle_ip=_tentacleIP_&#x0d;&#x0a;tentacle_port=_tentaclePort_&#x0d;&#x0a;tentacle_opts=_tentacleExtraOpt_&#x0d;&#x0a;advance_monitoring=_azureMCInstanceSummary_&#x0d;&#x0a;cpu_summary=_azureMCCpuPerfSummary_&#x0d;&#x0a;iops_summary=_azureMCIopsPerfSummary_&#x0d;&#x0a;disk_summary=_azureMCDiskPerfSummary_&#x0d;&#x0a;network_summary=_azureMCNetworkPerfSummary_&#x0d;&#x0a;azure_zones=_azureMCZones_&#x0d;&#x0a;azure_instances=_azureMCInstance_&#x0d;&#x0a;creds_b64=_credentials_&#x0d;&#x0a;stats_agent=_statsAgent_&#x0d;&#x0a;stats_agent_name=_statsAgentName_', 1
FROM `trecon_task`
WHERE `type` = @current_app_type
;
-- Delete NULL macros
DELETE FROM `tdiscovery_apps_tasks_macros` WHERE `macro` = '';
-- Migrate current Azure tasks
UPDATE `trecon_task`
SET
`id_app` = @id_app,
`setup_complete` = 1,
`type` = 15
WHERE `type` = @current_app_type
;

View File

@ -0,0 +1,161 @@
-- Insert new DB2 APP
SET @current_app_type = 11;
SET @short_name = 'pandorafms.db2';
SET @name = 'DB2';
SET @section = 'app';
SET @description = 'Monitor&#x20;DB2&#x20;databases';
SET @version = '1.0';
INSERT IGNORE INTO `tdiscovery_apps` (`id_app`, `short_name`, `name`, `section`, `description`, `version`) VALUES ('', @short_name, @name, @section, @description, @version);
SELECT @id_app := `id_app` FROM `tdiscovery_apps` WHERE `short_name` = @short_name;
-- Insert into tdiscovery_apps_scripts
INSERT IGNORE INTO `tdiscovery_apps_scripts` (`id_app`, `macro`, `value`) VALUES (@id_app, '_exec1_', 'bin/pandora_db2');
-- Insert into tdiscovery_apps_executions
INSERT IGNORE INTO `tdiscovery_apps_executions` (`id`, `id_app`, `execution`) VALUES (1, @id_app, '&#039;_exec1_&#039;&#x20;--conf&#x20;&#039;_tempfileConf_&#039;&#x20;--target_databases&#x20;&#039;_tempfileTargetDatabases_&#039;&#x20;--target_agents&#x20;&#039;_tempfileTargetAgents_&#039;&#x20;--custom_queries&#x20;&#039;_tempfileCustomQueries_&#039;');
-- Migrate current DB2 tasks configurations
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`, '_dbstrings_', 'custom', JSON_UNQUOTE(JSON_EXTRACT(CONVERT(FROM_BASE64(`field1`) USING UTF8MB4), '$.dbstrings')), 0
FROM `trecon_task`
WHERE `type` = @current_app_type
;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`, '_dbuser_', 'custom', JSON_UNQUOTE(JSON_EXTRACT(CONVERT(FROM_BASE64(`field1`) USING UTF8MB4), '$.dbuser')), 0
FROM `trecon_task`
WHERE `type` = @current_app_type
;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`, '_dbpass_', 'custom', JSON_UNQUOTE(JSON_EXTRACT(CONVERT(FROM_BASE64(`field1`) USING UTF8MB4), '$.dbpass')), 0
FROM `trecon_task`
WHERE `type` = @current_app_type
;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`, '_threads_', 'custom', 1, 0
FROM `trecon_task`
WHERE `type` = @current_app_type
;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`, '_engineAgent_', 'custom', JSON_UNQUOTE(JSON_EXTRACT(CONVERT(FROM_BASE64(`field1`) USING UTF8MB4), '$.engine_agent')), 0
FROM `trecon_task`
WHERE `type` = @current_app_type
;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`, '_prefixModuleName_', 'custom', JSON_UNQUOTE(JSON_EXTRACT(CONVERT(FROM_BASE64(`field1`) USING UTF8MB4), '$.prefix_module_name')), 0
FROM `trecon_task`
WHERE `type` = @current_app_type
;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`, '_checkDbSummary_', 'custom', JSON_UNQUOTE(JSON_EXTRACT(CONVERT(FROM_BASE64(`field1`) USING UTF8MB4), '$.check_db_summary')), 0
FROM `trecon_task`
WHERE `type` = @current_app_type
;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`, '_checkTransactionalLogUtilization_', 'custom', JSON_UNQUOTE(JSON_EXTRACT(CONVERT(FROM_BASE64(`field1`) USING UTF8MB4), '$.check_transactional_log_utilization')), 0
FROM `trecon_task`
WHERE `type` = @current_app_type
;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`, '_checkConnections_', 'custom', JSON_UNQUOTE(JSON_EXTRACT(CONVERT(FROM_BASE64(`field1`) USING UTF8MB4), '$.check_connections')), 0
FROM `trecon_task`
WHERE `type` = @current_app_type
;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`, '_checkDbSize_', 'custom', JSON_UNQUOTE(JSON_EXTRACT(CONVERT(FROM_BASE64(`field1`) USING UTF8MB4), '$.check_db_size')), 0
FROM `trecon_task`
WHERE `type` = @current_app_type
;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`, '_checkCache_', 'custom', JSON_UNQUOTE(JSON_EXTRACT(CONVERT(FROM_BASE64(`field1`) USING UTF8MB4), '$.check_cache')), 0
FROM `trecon_task`
WHERE `type` = @current_app_type
;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`, '_executeCustomQueries_', 'custom', JSON_UNQUOTE(JSON_EXTRACT(CONVERT(FROM_BASE64(`field1`) USING UTF8MB4), '$.execute_custom_queries')), 0
FROM `trecon_task`
WHERE `type` = @current_app_type
;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`, '_customQueries_', 'custom', JSON_UNQUOTE(JSON_EXTRACT(CONVERT(FROM_BASE64(`field1`) USING UTF8MB4), '$.custom_queries')), 0
FROM `trecon_task`
WHERE `type` = @current_app_type
;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`, '_tempfileConf_', 'custom', 'agents_group_id&#x20;=&#x20;__taskGroupID__&#x0d;&#x0a;interval&#x20;=&#x20;__taskInterval__&#x0d;&#x0a;user&#x20;=&#x20;_dbuser_&#x0d;&#x0a;password&#x20;=&#x20;_dbpass_&#x0d;&#x0a;threads&#x20;=&#x20;_threads_&#x0d;&#x0a;modules_prefix&#x20;=&#x20;_prefixModuleName_&#x0d;&#x0a;execute_custom_queries&#x20;=&#x20;_executeCustomQueries_&#x0d;&#x0a;analyze_connections&#x20;=&#x20;_checkConnections_&#x0d;&#x0a;cache_stats&#x20;=&#x20;_checkCache_&#x0d;&#x0a;database_summary&#x20;=&#x20;_checkDbSummary_&#x0d;&#x0a;transactional_log&#x20;=&#x20;_checkTransactionalLogUtilization_&#x0d;&#x0a;db_size&#x20;=&#x20;_checkDbSize_', 1
FROM `trecon_task`
WHERE `type` = @current_app_type
;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`, '_tempfileTargetDatabases_', 'custom', '_dbstrings_', 1
FROM `trecon_task`
WHERE `type` = @current_app_type
;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`, '_tempfileTargetAgents_', 'custom', '_engineAgent_', 1
FROM `trecon_task`
WHERE `type` = @current_app_type
;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`, '_tempfileCustomQueries_', 'custom', '_customQueries_', 1
FROM `trecon_task`
WHERE `type` = @current_app_type
;
-- Migrate current DB2 tasks
UPDATE `trecon_task`
SET
`id_app` = @id_app,
`setup_complete` = 1,
`type` = 15
WHERE `type` = @current_app_type
;

View File

@ -0,0 +1,716 @@
-- Insert new Google APP
SET @current_app_type = 13;
SET @short_name = 'pandorafms.gcp.ce';
SET @name = 'Google&#x20;Cloud&#x20;Compute&#x20;Engine';
SET @section = 'cloud';
SET @description = 'Monitor&#x20;Google&#x20;Cloud&#x20;Platform&#x20;Compute&#x20;Engine&#x20;VMs';
SET @version = '1.0';
INSERT IGNORE INTO `tdiscovery_apps` (`id_app`, `short_name`, `name`, `section`, `description`, `version`) VALUES ('', @short_name, @name, @section, @description, @version);
SELECT @id_app := `id_app` FROM `tdiscovery_apps` WHERE `short_name` = @short_name;
-- Insert into tdiscovery_apps_scripts
INSERT IGNORE INTO `tdiscovery_apps_scripts` (`id_app`, `macro`, `value`) VALUES (@id_app, '_exec1_', 'bin/pandora_gcp_ce');
INSERT IGNORE INTO `tdiscovery_apps_scripts` (`id_app`, `macro`, `value`) VALUES (@id_app, '_exec2_', 'bin/google_instances');
-- Insert into tdiscovery_apps_executions
INSERT IGNORE INTO `tdiscovery_apps_executions` (`id`, `id_app`, `execution`) VALUES (1, @id_app, '&#039;_exec1_&#039;&#x20;--conf&#x20;&#039;_tempfileGoogleCE_&#039;');
-- Migrate current Google tasks configurations
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`, '_tentacleIP_', 'custom', '127.0.0.1', 0
FROM `trecon_task`
WHERE `type` = @current_app_type
;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`, '_tentaclePort_', 'custom', '41121', 0
FROM `trecon_task`
WHERE `type` = @current_app_type
;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`, '_tentacleExtraOpt_', 'custom', '', 0
FROM `trecon_task`
WHERE `type` = @current_app_type
;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`, '_credentials_', 'credentials.gcp', `auth_strings`, 0
FROM `trecon_task`
WHERE `trecon_task`.`type` = @current_app_type
;
SET @position = 4;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`,
IF(
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", 1) = 'ec2_instance_summary',
'_googleCEInstanceSummary_',
IF(
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", 1) = 'ec2_cpu_perf_summary',
'_googleCECpuPerfSummary_',
IF(
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", 1) = 'ec2_iops_perf_summary',
'_googleCEIopsPerfSummary_',
IF(
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", 1) = 'ec2_disk_perf_summary',
'_googleCEDiskPerfSummary_',
IF(
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", 1) = 'ec2_network_perf_summary',
'_googleCENetworkPerfSummary_',
NULL
)
)
)
)
),
'custom',
IF(
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", 1) = 'ec2_instance_summary',
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", -1),
IF(
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", 1) = 'ec2_cpu_perf_summary',
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", -1),
IF(
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", 1) = 'ec2_iops_perf_summary',
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", -1),
IF(
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", 1) = 'ec2_disk_perf_summary',
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", -1),
IF(
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", 1) = 'ec2_network_perf_summary',
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", -1),
"0"
)
)
)
)
),
0
FROM `trecon_task`
WHERE `type` = @current_app_type
;
SET @position = 5;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`,
IF(
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", 1) = 'ec2_instance_summary',
'_googleCEInstanceSummary_',
IF(
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", 1) = 'ec2_cpu_perf_summary',
'_googleCECpuPerfSummary_',
IF(
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", 1) = 'ec2_iops_perf_summary',
'_googleCEIopsPerfSummary_',
IF(
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", 1) = 'ec2_disk_perf_summary',
'_googleCEDiskPerfSummary_',
IF(
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", 1) = 'ec2_network_perf_summary',
'_googleCENetworkPerfSummary_',
NULL
)
)
)
)
),
'custom',
IF(
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", 1) = 'ec2_instance_summary',
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", -1),
IF(
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", 1) = 'ec2_cpu_perf_summary',
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", -1),
IF(
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", 1) = 'ec2_iops_perf_summary',
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", -1),
IF(
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", 1) = 'ec2_disk_perf_summary',
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", -1),
IF(
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", 1) = 'ec2_network_perf_summary',
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", -1),
"0"
)
)
)
)
),
0
FROM `trecon_task`
WHERE `type` = @current_app_type
;
SET @position = 6;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`,
IF(
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", 1) = 'ec2_instance_summary',
'_googleCEInstanceSummary_',
IF(
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", 1) = 'ec2_cpu_perf_summary',
'_googleCECpuPerfSummary_',
IF(
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", 1) = 'ec2_iops_perf_summary',
'_googleCEIopsPerfSummary_',
IF(
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", 1) = 'ec2_disk_perf_summary',
'_googleCEDiskPerfSummary_',
IF(
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", 1) = 'ec2_network_perf_summary',
'_googleCENetworkPerfSummary_',
NULL
)
)
)
)
),
'custom',
IF(
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", 1) = 'ec2_instance_summary',
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", -1),
IF(
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", 1) = 'ec2_cpu_perf_summary',
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", -1),
IF(
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", 1) = 'ec2_iops_perf_summary',
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", -1),
IF(
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", 1) = 'ec2_disk_perf_summary',
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", -1),
IF(
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", 1) = 'ec2_network_perf_summary',
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", -1),
"0"
)
)
)
)
),
0
FROM `trecon_task`
WHERE `type` = @current_app_type
;
SET @position = 7;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`,
IF(
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", 1) = 'ec2_instance_summary',
'_googleCEInstanceSummary_',
IF(
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", 1) = 'ec2_cpu_perf_summary',
'_googleCECpuPerfSummary_',
IF(
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", 1) = 'ec2_iops_perf_summary',
'_googleCEIopsPerfSummary_',
IF(
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", 1) = 'ec2_disk_perf_summary',
'_googleCEDiskPerfSummary_',
IF(
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", 1) = 'ec2_network_perf_summary',
'_googleCENetworkPerfSummary_',
NULL
)
)
)
)
),
'custom',
IF(
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", 1) = 'ec2_instance_summary',
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", -1),
IF(
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", 1) = 'ec2_cpu_perf_summary',
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", -1),
IF(
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", 1) = 'ec2_iops_perf_summary',
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", -1),
IF(
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", 1) = 'ec2_disk_perf_summary',
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", -1),
IF(
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", 1) = 'ec2_network_perf_summary',
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", -1),
"0"
)
)
)
)
),
0
FROM `trecon_task`
WHERE `type` = @current_app_type
;
SET @position = 8;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`,
IF(
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", 1) = 'ec2_instance_summary',
'_googleCEInstanceSummary_',
IF(
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", 1) = 'ec2_cpu_perf_summary',
'_googleCECpuPerfSummary_',
IF(
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", 1) = 'ec2_iops_perf_summary',
'_googleCEIopsPerfSummary_',
IF(
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", 1) = 'ec2_disk_perf_summary',
'_googleCEDiskPerfSummary_',
IF(
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", 1) = 'ec2_network_perf_summary',
'_googleCENetworkPerfSummary_',
NULL
)
)
)
)
),
'custom',
IF(
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", 1) = 'ec2_instance_summary',
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", -1),
IF(
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", 1) = 'ec2_cpu_perf_summary',
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", -1),
IF(
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", 1) = 'ec2_iops_perf_summary',
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", -1),
IF(
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", 1) = 'ec2_disk_perf_summary',
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", -1),
IF(
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", 1) = 'ec2_network_perf_summary',
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
CONCAT(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",1),REPLACE(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",1),REPLACE(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(CONVERT(FROM_BASE64(field1) USING UTF8MB4),"ec2_zones ",-1),"\n",1),"\n"),"")),"ec2_instance ",-1),"\n",1),"\n"),""))
, "\n", @position), "\n", -1), " ", -1),
"0"
)
)
)
)
),
0
FROM `trecon_task`
WHERE `type` = @current_app_type
;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`, '_statsAgent_', 'custom', 0, 0
FROM `trecon_task`
WHERE `type` = @current_app_type
;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`, '_statsAgentName_', 'custom', '', 0
FROM `trecon_task`
WHERE `type` = @current_app_type
;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`, '_googleCEInstanceSummary_', 'custom', 0, 0
FROM `trecon_task`
WHERE `type` = @current_app_type
;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`, '_googleCECpuPerfSummary_', 'custom', 0, 0
FROM `trecon_task`
WHERE `type` = @current_app_type
;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`, '_googleCEIopsPerfSummary_', 'custom', 0, 0
FROM `trecon_task`
WHERE `type` = @current_app_type
;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`, '_googleCEDiskPerfSummary_', 'custom', 0, 0
FROM `trecon_task`
WHERE `type` = @current_app_type
;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`, '_googleCENetworkPerfSummary_', 'custom', 0, 0
FROM `trecon_task`
WHERE `type` = @current_app_type
;
SET @param = 'ec2_instance';
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`,
'_googleCEInstance_',
'custom',
REPLACE(
REPLACE(
CONCAT(
'["',
REPLACE(
REPLACE(
REPLACE(
REPLACE(
CONVERT(FROM_BASE64(`field1`) USING UTF8MB4),
SUBSTRING_INDEX(
CONVERT(FROM_BASE64(`field1`) USING UTF8MB4),
CONCAT(@param, " "), 1
),
""
),
REPLACE(
SUBSTRING_INDEX(
REPLACE(
CONVERT(FROM_BASE64(`field1`) USING UTF8MB4),
SUBSTRING_INDEX(
CONVERT(FROM_BASE64(`field1`) USING UTF8MB4),
CONCAT(@param, " "), 1
),
""
),
CONCAT(@param, " "), -1
),
SUBSTRING_INDEX(SUBSTRING_INDEX(
REPLACE(
CONVERT(FROM_BASE64(`field1`) USING UTF8MB4),
SUBSTRING_INDEX(
CONVERT(FROM_BASE64(`field1`) USING UTF8MB4),
CONCAT(@param, " "), 1
),
""
),
CONCAT(@param, " "), -1
), "\n", 1),
""
),
"\n"
),
CONCAT(@param, " "),
""
),
"\n",
'","'
),
'"]'
),
',""]',
']'
),
'[""]',
'[]'
),
0
FROM `trecon_task`
WHERE `type` = @current_app_type
;
SET @param = 'ec2_zones';
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`,
'_googleCEZones_',
'custom',
REPLACE(
REPLACE(
CONCAT(
'["',
REPLACE(
REPLACE(
REPLACE(
REPLACE(
CONVERT(FROM_BASE64(`field1`) USING UTF8MB4),
SUBSTRING_INDEX(
CONVERT(FROM_BASE64(`field1`) USING UTF8MB4),
CONCAT(@param, " "), 1
),
""
),
REPLACE(
SUBSTRING_INDEX(
REPLACE(
CONVERT(FROM_BASE64(`field1`) USING UTF8MB4),
SUBSTRING_INDEX(
CONVERT(FROM_BASE64(`field1`) USING UTF8MB4),
CONCAT(@param, " "), 1
),
""
),
CONCAT(@param, " "), -1
),
SUBSTRING_INDEX(SUBSTRING_INDEX(
REPLACE(
CONVERT(FROM_BASE64(`field1`) USING UTF8MB4),
SUBSTRING_INDEX(
CONVERT(FROM_BASE64(`field1`) USING UTF8MB4),
CONCAT(@param, " "), 1
),
""
),
CONCAT(@param, " "), -1
), "\n", 1),
""
),
"\n"
),
CONCAT(@param, " "),
""
),
"\n",
'","'
),
'"]'
),
',""]',
']'
),
'[""]',
'[]'
),
0
FROM `trecon_task`
WHERE `type` = @current_app_type
;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`, '_googleCEZonesInstance_', 'custom', '[]', 0
FROM `trecon_task`
WHERE `type` = @current_app_type
;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`, '_threads_', 'custom', 1, 0
FROM `trecon_task`
WHERE `type` = @current_app_type
;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`, '_useProxy_', 'custom', 0, 0
FROM `trecon_task`
WHERE `type` = @current_app_type
;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`, '_proxyUrl_', 'custom', '', 0
FROM `trecon_task`
WHERE `type` = @current_app_type
;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`, '_sslCheck_', 'custom', 0, 0
FROM `trecon_task`
WHERE `type` = @current_app_type
;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`, '_tempfileGoogleCE_', 'custom', 'agents_group_name=__taskGroup__&#x0d;&#x0a;interval=__taskInterval__&#x0d;&#x0a;threads=_threads_&#x0d;&#x0a;temporal=__temp__&#x0d;&#x0a;transfer_mode=tentacle&#x0d;&#x0a;tentacle_ip=_tentacleIP_&#x0d;&#x0a;tentacle_port=_tentaclePort_&#x0d;&#x0a;tentacle_opts=_tentacleExtraOpt_&#x0d;&#x0a;advance_monitoring=_googleCEInstanceSummary_&#x0d;&#x0a;cpu_summary=_googleCECpuPerfSummary_&#x0d;&#x0a;iops_summary=_googleCEIopsPerfSummary_&#x0d;&#x0a;disk_summary=_googleCEDiskPerfSummary_&#x0d;&#x0a;network_summary=_googleCENetworkPerfSummary_&#x0d;&#x0a;creds_b64=_credentials_&#x0d;&#x0a;gcp_zones=_googleCEZones_&#x0d;&#x0a;gcp_instances=_googleCEInstances_&#x0d;&#x0a;stats_agent=_statsAgent_&#x0d;&#x0a;stats_agent_name=_statsAgentName_', 1
FROM `trecon_task`
WHERE `type` = @current_app_type
;
-- Delete NULL macros
DELETE FROM `tdiscovery_apps_tasks_macros` WHERE `macro` = '';
-- Migrate current Google tasks
UPDATE `trecon_task`
SET
`id_app` = @id_app,
`setup_complete` = 1,
`type` = 15
WHERE `type` = @current_app_type
;

View File

@ -0,0 +1,145 @@
-- Insert new MSSQL APP
SET @current_app_type = 12;
SET @short_name = 'pandorafms.mssql';
SET @name = 'Microsoft&#x20;SQL&#x20;Server';
SET @section = 'app';
SET @description = 'Monitor&#x20;Microsoft&#x20;SQL&#x20;Server&#x20;databases';
SET @version = '1.0';
INSERT IGNORE INTO `tdiscovery_apps` (`id_app`, `short_name`, `name`, `section`, `description`, `version`) VALUES ('', @short_name, @name, @section, @description, @version);
SELECT @id_app := `id_app` FROM `tdiscovery_apps` WHERE `short_name` = @short_name;
-- Insert into tdiscovery_apps_scripts
INSERT IGNORE INTO `tdiscovery_apps_scripts` (`id_app`, `macro`, `value`) VALUES (@id_app, '_exec1_', 'bin/pandora_mssql');
-- Insert into tdiscovery_apps_executions
INSERT IGNORE INTO `tdiscovery_apps_executions` (`id`, `id_app`, `execution`) VALUES (1, @id_app, '&#039;_exec1_&#039;&#x20;--conf&#x20;&#039;_tempfileConf_&#039;&#x20;--target_databases&#x20;&#039;_tempfileTargetDatabases_&#039;&#x20;--target_agents&#x20;&#039;_tempfileTargetAgents_&#039;&#x20;--custom_queries&#x20;&#039;_tempfileCustomQueries_&#039;');
-- Migrate current MSSQL tasks configurations
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`, '_dbstrings_', 'custom', JSON_UNQUOTE(JSON_EXTRACT(CONVERT(FROM_BASE64(`field1`) USING UTF8MB4), '$.dbstrings')), 0
FROM `trecon_task`
WHERE `type` = @current_app_type
;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`, '_dbuser_', 'custom', JSON_UNQUOTE(JSON_EXTRACT(CONVERT(FROM_BASE64(`field1`) USING UTF8MB4), '$.dbuser')), 0
FROM `trecon_task`
WHERE `type` = @current_app_type
;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`, '_dbpass_', 'custom', JSON_UNQUOTE(JSON_EXTRACT(CONVERT(FROM_BASE64(`field1`) USING UTF8MB4), '$.dbpass')), 0
FROM `trecon_task`
WHERE `type` = @current_app_type
;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`, '_threads_', 'custom', 1, 0
FROM `trecon_task`
WHERE `type` = @current_app_type
;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`, '_engineAgent_', 'custom', JSON_UNQUOTE(JSON_EXTRACT(CONVERT(FROM_BASE64(`field1`) USING UTF8MB4), '$.engine_agent')), 0
FROM `trecon_task`
WHERE `type` = @current_app_type
;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`, '_prefixModuleName_', 'custom', JSON_UNQUOTE(JSON_EXTRACT(CONVERT(FROM_BASE64(`field1`) USING UTF8MB4), '$.prefix_module_name')), 0
FROM `trecon_task`
WHERE `type` = @current_app_type
;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`, '_checkUptime_', 'custom', JSON_UNQUOTE(JSON_EXTRACT(CONVERT(FROM_BASE64(`field1`) USING UTF8MB4), '$.check_uptime')), 0
FROM `trecon_task`
WHERE `type` = @current_app_type
;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`, '_queryStats_', 'custom', JSON_UNQUOTE(JSON_EXTRACT(CONVERT(FROM_BASE64(`field1`) USING UTF8MB4), '$.query_stats')), 0
FROM `trecon_task`
WHERE `type` = @current_app_type
;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`, '_checkConnections_', 'custom', JSON_UNQUOTE(JSON_EXTRACT(CONVERT(FROM_BASE64(`field1`) USING UTF8MB4), '$.check_connections')), 0
FROM `trecon_task`
WHERE `type` = @current_app_type
;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`, '_executeCustomQueries_', 'custom', JSON_UNQUOTE(JSON_EXTRACT(CONVERT(FROM_BASE64(`field1`) USING UTF8MB4), '$.execute_custom_queries')), 0
FROM `trecon_task`
WHERE `type` = @current_app_type
;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`, '_customQueries_', 'custom', JSON_UNQUOTE(JSON_EXTRACT(CONVERT(FROM_BASE64(`field1`) USING UTF8MB4), '$.custom_queries')), 0
FROM `trecon_task`
WHERE `type` = @current_app_type
;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`, '_tempfileConf_', 'custom', 'agents_group_id&#x20;=&#x20;__taskGroupID__&#x0d;&#x0a;interval&#x20;=&#x20;__taskInterval__&#x0d;&#x0a;user&#x20;=&#x20;_dbuser_&#x0d;&#x0a;password&#x20;=&#x20;_dbpass_&#x0d;&#x0a;threads&#x20;=&#x20;_threads_&#x0d;&#x0a;modules_prefix&#x20;=&#x20;_prefixModuleName_&#x0d;&#x0a;execute_custom_queries&#x20;=&#x20;_executeCustomQueries_&#x0d;&#x0a;analyze_connections&#x20;=&#x20;_checkConnections_&#x0d;&#x0a;engine_uptime&#x20;=&#x20;_checkUptime_&#x0d;&#x0a;query_stats&#x20;=&#x20;_queryStats_', 1
FROM `trecon_task`
WHERE `type` = @current_app_type
;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`, '_tempfileTargetDatabases_', 'custom', '_dbstrings_', 1
FROM `trecon_task`
WHERE `type` = @current_app_type
;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`, '_tempfileTargetAgents_', 'custom', '_engineAgent_', 1
FROM `trecon_task`
WHERE `type` = @current_app_type
;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`, '_tempfileCustomQueries_', 'custom', '_customQueries_', 1
FROM `trecon_task`
WHERE `type` = @current_app_type
;
-- Migrate current MSSQL tasks
UPDATE `trecon_task`
SET
`id_app` = @id_app,
`setup_complete` = 1,
`type` = 15
WHERE `type` = @current_app_type
;

View File

@ -0,0 +1,206 @@
-- Insert new MySQL APP
SET @current_app_type = 4;
SET @short_name = 'pandorafms.mysql';
SET @name = 'MySQL';
SET @section = 'app';
SET @description = 'Monitor&#x20;MySQL&#x20;databases';
SET @version = '1.0';
INSERT IGNORE INTO `tdiscovery_apps` (`id_app`, `short_name`, `name`, `section`, `description`, `version`) VALUES ('', @short_name, @name, @section, @description, @version);
SELECT @id_app := `id_app` FROM `tdiscovery_apps` WHERE `short_name` = @short_name;
-- Insert into tdiscovery_apps_scripts
INSERT IGNORE INTO `tdiscovery_apps_scripts` (`id_app`, `macro`, `value`) VALUES (@id_app, '_exec1_', 'bin/pandora_mysql');
-- Insert into tdiscovery_apps_executions
INSERT IGNORE INTO `tdiscovery_apps_executions` (`id`, `id_app`, `execution`) VALUES (1, @id_app, '&#039;_exec1_&#039;&#x20;--conf&#x20;&#039;_tempfileConf_&#039;&#x20;--target_databases&#x20;&#039;_tempfileTargetDatabases_&#039;&#x20;--target_agents&#x20;&#039;_tempfileTargetAgents_&#039;&#x20;--custom_queries&#x20;&#039;_tempfileCustomQueries_&#039;');
-- Migrate current MySQL tasks configurations
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
WITH RECURSIVE `cte` AS (
SELECT
`id_rt`,
REPLACE(JSON_UNQUOTE(JSON_EXTRACT(CONVERT(FROM_BASE64(`field1`) USING UTF8MB4), '$.dbport')), '&#x20;', '') AS `port`,
1 AS `pos`,
SUBSTRING_INDEX(
REPLACE(JSON_UNQUOTE(JSON_EXTRACT(CONVERT(FROM_BASE64(`field1`) USING UTF8MB4), '$.dbhost')), '&#x20;', ''),
',', 1
) AS `host`,
SUBSTRING(
REPLACE(JSON_UNQUOTE(JSON_EXTRACT(CONVERT(FROM_BASE64(`field1`) USING UTF8MB4), '$.dbhost')), '&#x20;', ''),
LENGTH(SUBSTRING_INDEX(
REPLACE(JSON_UNQUOTE(JSON_EXTRACT(CONVERT(FROM_BASE64(`field1`) USING UTF8MB4), '$.dbhost')), '&#x20;', ''),
',', 1
)) + 2
) AS `remaining`
FROM `trecon_task` WHERE `type` = @current_app_type
UNION ALL
SELECT `id_rt`, `port`, `pos` + 1, SUBSTRING_INDEX(`remaining`, ',', 1) AS `host`, SUBSTRING(`remaining`, LENGTH(SUBSTRING_INDEX(`remaining`, ',', 1)) + 2)
FROM `cte`
WHERE `remaining` != ''
)
SELECT `id_rt`, '_dbstrings_', 'custom', GROUP_CONCAT(CONCAT(`host`, ':', `port`) SEPARATOR ','), 0
FROM `cte`
GROUP BY `id_rt`
;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`, '_dbuser_', 'custom', JSON_UNQUOTE(JSON_EXTRACT(CONVERT(FROM_BASE64(`field1`) USING UTF8MB4), '$.dbuser')), 0
FROM `trecon_task`
WHERE `type` = @current_app_type
;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`, '_dbpass_', 'custom', JSON_UNQUOTE(JSON_EXTRACT(CONVERT(FROM_BASE64(`field1`) USING UTF8MB4), '$.dbpass')), 0
FROM `trecon_task`
WHERE `type` = @current_app_type
;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`, '_threads_', 'custom', 1, 0
FROM `trecon_task`
WHERE `type` = @current_app_type
;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`, '_engineAgent_', 'custom', JSON_UNQUOTE(JSON_EXTRACT(CONVERT(FROM_BASE64(`field1`) USING UTF8MB4), '$.engine_agent')), 0
FROM `trecon_task`
WHERE `type` = @current_app_type
;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`, '_prefixModuleName_', 'custom', JSON_UNQUOTE(JSON_EXTRACT(CONVERT(FROM_BASE64(`field1`) USING UTF8MB4), '$.prefix_module_name')), 0
FROM `trecon_task`
WHERE `type` = @current_app_type
;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`, '_scanDatabases_', 'custom', JSON_UNQUOTE(JSON_EXTRACT(CONVERT(FROM_BASE64(`field1`) USING UTF8MB4), '$.scan_databases')), 0
FROM `trecon_task`
WHERE `type` = @current_app_type
;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`, '_agentPerDatabase_', 'custom', JSON_UNQUOTE(JSON_EXTRACT(CONVERT(FROM_BASE64(`field1`) USING UTF8MB4), '$.agent_per_database')), 0
FROM `trecon_task`
WHERE `type` = @current_app_type
;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`, '_prefixAgent_', 'custom', JSON_UNQUOTE(JSON_EXTRACT(CONVERT(FROM_BASE64(`field1`) USING UTF8MB4), '$.prefix_agent')), 0
FROM `trecon_task`
WHERE `type` = @current_app_type
;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`, '_checkUptime_', 'custom', JSON_UNQUOTE(JSON_EXTRACT(CONVERT(FROM_BASE64(`field1`) USING UTF8MB4), '$.check_uptime')), 0
FROM `trecon_task`
WHERE `type` = @current_app_type
;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`, '_queryStats_', 'custom', JSON_UNQUOTE(JSON_EXTRACT(CONVERT(FROM_BASE64(`field1`) USING UTF8MB4), '$.query_stats')), 0
FROM `trecon_task`
WHERE `type` = @current_app_type
;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`, '_checkConnections_', 'custom', JSON_UNQUOTE(JSON_EXTRACT(CONVERT(FROM_BASE64(`field1`) USING UTF8MB4), '$.check_connections')), 0
FROM `trecon_task`
WHERE `type` = @current_app_type
;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`, '_checkInnodb_', 'custom', JSON_UNQUOTE(JSON_EXTRACT(CONVERT(FROM_BASE64(`field1`) USING UTF8MB4), '$.check_innodb')), 0
FROM `trecon_task`
WHERE `type` = @current_app_type
;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`, '_checkCache_', 'custom', JSON_UNQUOTE(JSON_EXTRACT(CONVERT(FROM_BASE64(`field1`) USING UTF8MB4), '$.check_cache')), 0
FROM `trecon_task`
WHERE `type` = @current_app_type
;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`, '_executeCustomQueries_', 'custom', JSON_UNQUOTE(JSON_EXTRACT(CONVERT(FROM_BASE64(`field1`) USING UTF8MB4), '$.execute_custom_queries')), 0
FROM `trecon_task`
WHERE `type` = @current_app_type
;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`, '_customQueries_', 'custom', JSON_UNQUOTE(JSON_EXTRACT(CONVERT(FROM_BASE64(`field1`) USING UTF8MB4), '$.custom_queries')), 0
FROM `trecon_task`
WHERE `type` = @current_app_type
;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`, '_tempfileConf_', 'custom', 'agents_group_id&#x20;=&#x20;__taskGroupID__&#x0d;&#x0a;interval&#x20;=&#x20;__taskInterval__&#x0d;&#x0a;user&#x20;=&#x20;_dbuser_&#x0d;&#x0a;password&#x20;=&#x20;_dbpass_&#x0d;&#x0a;threads&#x20;=&#x20;_threads_&#x0d;&#x0a;modules_prefix&#x20;=&#x20;_prefixModuleName_&#x0d;&#x0a;execute_custom_queries&#x20;=&#x20;_executeCustomQueries_&#x0d;&#x0a;analyze_connections&#x20;=&#x20;_checkConnections_&#x0d;&#x0a;scan_databases&#x20;=&#x20;_scanDatabases_&#x0d;&#x0a;agent_per_database&#x20;=&#x20;_agentPerDatabase_&#x0d;&#x0a;db_agent_prefix&#x20;=&#x20;_prefixAgent_&#x0d;&#x0a;innodb_stats&#x20;=&#x20;_checkInnodb_&#x0d;&#x0a;engine_uptime&#x20;=&#x20;_checkUptime_&#x0d;&#x0a;query_stats&#x20;=&#x20;_queryStats_&#x0d;&#x0a;cache_stats&#x20;=&#x20;_checkCache_', 1
FROM `trecon_task`
WHERE `type` = @current_app_type
;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`, '_tempfileTargetDatabases_', 'custom', '_dbstrings_', 1
FROM `trecon_task`
WHERE `type` = @current_app_type
;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`, '_tempfileTargetAgents_', 'custom', '_engineAgent_', 1
FROM `trecon_task`
WHERE `type` = @current_app_type
;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`, '_tempfileCustomQueries_', 'custom', '_customQueries_', 1
FROM `trecon_task`
WHERE `type` = @current_app_type
;
-- Migrate current MySQL tasks
UPDATE `trecon_task`
SET
`id_app` = @id_app,
`setup_complete` = 1,
`type` = 15
WHERE `type` = @current_app_type
;

View File

@ -0,0 +1,169 @@
-- Insert new Oracle APP
SET @current_app_type = 5;
SET @short_name = 'pandorafms.oracle';
SET @name = 'Oracle';
SET @section = 'app';
SET @description = 'Monitor&#x20;Oracle&#x20;databases';
SET @version = '1.0';
INSERT IGNORE INTO `tdiscovery_apps` (`id_app`, `short_name`, `name`, `section`, `description`, `version`) VALUES ('', @short_name, @name, @section, @description, @version);
SELECT @id_app := `id_app` FROM `tdiscovery_apps` WHERE `short_name` = @short_name;
-- Insert into tdiscovery_apps_scripts
INSERT IGNORE INTO `tdiscovery_apps_scripts` (`id_app`, `macro`, `value`) VALUES (@id_app, '_exec1_', 'bin/pandora_oracle');
-- Insert into tdiscovery_apps_executions
INSERT IGNORE INTO `tdiscovery_apps_executions` (`id`, `id_app`, `execution`) VALUES (1, @id_app, '&#039;_exec1_&#039;&#x20;--conf&#x20;&#039;_tempfileConf_&#039;&#x20;--target_databases&#x20;&#039;_tempfileTargetDatabases_&#039;&#x20;--target_agents&#x20;&#039;_tempfileTargetAgents_&#039;&#x20;--custom_queries&#x20;&#039;_tempfileCustomQueries_&#039;');
-- Migrate current Oracle tasks configurations
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`, '_dbstrings_', 'custom', JSON_UNQUOTE(JSON_EXTRACT(CONVERT(FROM_BASE64(`field1`) USING UTF8MB4), '$.dbstrings')), 0
FROM `trecon_task`
WHERE `type` = @current_app_type
;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`, '_dbuser_', 'custom', JSON_UNQUOTE(JSON_EXTRACT(CONVERT(FROM_BASE64(`field1`) USING UTF8MB4), '$.dbuser')), 0
FROM `trecon_task`
WHERE `type` = @current_app_type
;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`, '_dbpass_', 'custom', JSON_UNQUOTE(JSON_EXTRACT(CONVERT(FROM_BASE64(`field1`) USING UTF8MB4), '$.dbpass')), 0
FROM `trecon_task`
WHERE `type` = @current_app_type
;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`, '_threads_', 'custom', 1, 0
FROM `trecon_task`
WHERE `type` = @current_app_type
;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`, '_engineAgent_', 'custom', JSON_UNQUOTE(JSON_EXTRACT(CONVERT(FROM_BASE64(`field1`) USING UTF8MB4), '$.engine_agent')), 0
FROM `trecon_task`
WHERE `type` = @current_app_type
;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`, '_prefixModuleName_', 'custom', JSON_UNQUOTE(JSON_EXTRACT(CONVERT(FROM_BASE64(`field1`) USING UTF8MB4), '$.prefix_module_name')), 0
FROM `trecon_task`
WHERE `type` = @current_app_type
;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`, '_checkUptime_', 'custom', JSON_UNQUOTE(JSON_EXTRACT(CONVERT(FROM_BASE64(`field1`) USING UTF8MB4), '$.check_uptime')), 0
FROM `trecon_task`
WHERE `type` = @current_app_type
;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`, '_queryStats_', 'custom', JSON_UNQUOTE(JSON_EXTRACT(CONVERT(FROM_BASE64(`field1`) USING UTF8MB4), '$.query_stats')), 0
FROM `trecon_task`
WHERE `type` = @current_app_type
;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`, '_checkConnections_', 'custom', JSON_UNQUOTE(JSON_EXTRACT(CONVERT(FROM_BASE64(`field1`) USING UTF8MB4), '$.check_connections')), 0
FROM `trecon_task`
WHERE `type` = @current_app_type
;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`, '_checkFragmentation_', 'custom', JSON_UNQUOTE(JSON_EXTRACT(CONVERT(FROM_BASE64(`field1`) USING UTF8MB4), '$.check_fragmentation')), 0
FROM `trecon_task`
WHERE `type` = @current_app_type
;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`, '_checkTablespaces_', 'custom', JSON_UNQUOTE(JSON_EXTRACT(CONVERT(FROM_BASE64(`field1`) USING UTF8MB4), '$.check_tablespaces')), 0
FROM `trecon_task`
WHERE `type` = @current_app_type
;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`, '_checkCache_', 'custom', JSON_UNQUOTE(JSON_EXTRACT(CONVERT(FROM_BASE64(`field1`) USING UTF8MB4), '$.check_cache')), 0
FROM `trecon_task`
WHERE `type` = @current_app_type
;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`, '_executeCustomQueries_', 'custom', JSON_UNQUOTE(JSON_EXTRACT(CONVERT(FROM_BASE64(`field1`) USING UTF8MB4), '$.execute_custom_queries')), 0
FROM `trecon_task`
WHERE `type` = @current_app_type
;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`, '_customQueries_', 'custom', JSON_UNQUOTE(JSON_EXTRACT(CONVERT(FROM_BASE64(`field1`) USING UTF8MB4), '$.custom_queries')), 0
FROM `trecon_task`
WHERE `type` = @current_app_type
;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`, '_tempfileConf_', 'custom', 'agents_group_id&#x20;=&#x20;__taskGroupID__&#x0d;&#x0a;interval&#x20;=&#x20;__taskInterval__&#x0d;&#x0a;user&#x20;=&#x20;_dbuser_&#x0d;&#x0a;password&#x20;=&#x20;_dbpass_&#x0d;&#x0a;threads&#x20;=&#x20;_threads_&#x0d;&#x0a;modules_prefix&#x20;=&#x20;_prefixModuleName_&#x0d;&#x0a;execute_custom_queries&#x20;=&#x20;_executeCustomQueries_&#x0d;&#x0a;analyze_connections&#x20;=&#x20;_checkConnections_&#x0d;&#x0a;engine_uptime&#x20;=&#x20;_checkUptime_&#x0d;&#x0a;query_stats&#x20;=&#x20;_queryStats_&#x0d;&#x0a;cache_stats&#x20;=&#x20;_checkCache_&#x0d;&#x0a;fragmentation_ratio&#x20;=&#x20;_checkFragmentation_&#x0d;&#x0a;check_tablescpaces&#x20;=&#x20;_checkTablespaces_', 1
FROM `trecon_task`
WHERE `type` = @current_app_type
;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`, '_tempfileTargetDatabases_', 'custom', '_dbstrings_', 1
FROM `trecon_task`
WHERE `type` = @current_app_type
;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`, '_tempfileTargetAgents_', 'custom', '_engineAgent_', 1
FROM `trecon_task`
WHERE `type` = @current_app_type
;
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros`
(`id_task`, `macro`, `type`, `value`, `temp_conf`)
SELECT
`id_rt`, '_tempfileCustomQueries_', 'custom', '_customQueries_', 1
FROM `trecon_task`
WHERE `type` = @current_app_type
;
-- Migrate current Oracle tasks
UPDATE `trecon_task`
SET
`id_app` = @id_app,
`setup_complete` = 1,
`type` = 15
WHERE `type` = @current_app_type
;

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,102 @@
START TRANSACTION; START TRANSACTION;
ALTER TABLE tevent_filter ADD private_filter_user text NULL;
ALTER TABLE `ttrap` ADD COLUMN `utimestamp` INT UNSIGNED NOT NULL DEFAULT 0;
UPDATE ttrap SET utimestamp=UNIX_TIMESTAMP(timestamp);
CREATE TABLE IF NOT EXISTS `tlog_alert` (
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
`name` TEXT ,
`description` MEDIUMTEXT,
`order` INT UNSIGNED DEFAULT 0,
`mode` ENUM('PASS','DROP'),
`field1` TEXT ,
`field2` TEXT ,
`field3` TEXT ,
`field4` TEXT ,
`field5` TEXT ,
`field6` TEXT ,
`field7` TEXT ,
`field8` TEXT ,
`field9` TEXT ,
`field10` TEXT ,
`time_threshold` INT NOT NULL DEFAULT 86400,
`max_alerts` INT UNSIGNED NOT NULL DEFAULT 1,
`min_alerts` INT UNSIGNED NOT NULL DEFAULT 0,
`time_from` time DEFAULT '00:00:00',
`time_to` time DEFAULT '00:00:00',
`monday` TINYINT DEFAULT 1,
`tuesday` TINYINT DEFAULT 1,
`wednesday` TINYINT DEFAULT 1,
`thursday` TINYINT DEFAULT 1,
`friday` TINYINT DEFAULT 1,
`saturday` TINYINT DEFAULT 1,
`sunday` TINYINT DEFAULT 1,
`recovery_notify` TINYINT DEFAULT 0,
`field1_recovery` TEXT,
`field2_recovery` TEXT,
`field3_recovery` TEXT,
`field4_recovery` TEXT,
`field5_recovery` TEXT,
`field6_recovery` TEXT,
`field7_recovery` TEXT,
`field8_recovery` TEXT,
`field9_recovery` TEXT,
`field10_recovery` TEXT,
`id_group` MEDIUMINT UNSIGNED NULL DEFAULT 0,
`internal_counter` INT DEFAULT 0,
`last_fired` BIGINT NOT NULL DEFAULT 0,
`last_reference` BIGINT NOT NULL DEFAULT 0,
`times_fired` INT NOT NULL DEFAULT 0,
`disabled` TINYINT DEFAULT 0,
`standby` TINYINT DEFAULT 0,
`priority` TINYINT DEFAULT 0,
`force_execution` TINYINT DEFAULT 0,
`group_by` enum ('','id_agente','id_agentmodule','id_alert_am','id_grupo') DEFAULT '',
`special_days` TINYINT DEFAULT 0,
`disable_event` TINYINT DEFAULT 0,
`id_template_conditions` INT UNSIGNED NOT NULL DEFAULT 0,
`id_template_fields` INT UNSIGNED NOT NULL DEFAULT 0,
`last_evaluation` BIGINT NOT NULL DEFAULT 0,
`pool_occurrences` INT UNSIGNED NOT NULL DEFAULT 0,
`schedule` TEXT,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4;
CREATE TABLE IF NOT EXISTS `tlog_rule` (
`id_log_rule` INT UNSIGNED NOT NULL AUTO_INCREMENT,
`id_log_alert` INT UNSIGNED NOT NULL,
`operation` ENUM('NOP', 'AND','OR','XOR','NAND','NOR','NXOR'),
`order` INT UNSIGNED DEFAULT 0,
`window` INT NOT NULL DEFAULT 0,
`count` INT NOT NULL DEFAULT 1,
`name` TEXT,
`log_content` TEXT,
`log_source` TEXT,
`log_agent` TEXT,
`operator_log_content` TEXT COMMENT 'Operator for log_content',
`operator_log_source` TEXT COMMENT 'Operator for log_source',
`operator_log_agent` TEXT COMMENT 'Operator for log_agent',
PRIMARY KEY (`id_log_rule`),
KEY `idx_id_log_alert` (`id_log_alert`)
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4;
CREATE TABLE IF NOT EXISTS `tlog_alert_action` (
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
`id_log_alert` INT UNSIGNED NOT NULL,
`id_alert_action` INT UNSIGNED NOT NULL,
`fires_min` INT UNSIGNED DEFAULT 0,
`fires_max` INT UNSIGNED DEFAULT 0,
`module_action_threshold` INT NOT NULL DEFAULT 0,
`last_execution` BIGINT NOT NULL DEFAULT 0,
PRIMARY KEY (`id`),
FOREIGN KEY (`id_log_alert`) REFERENCES tlog_alert(`id`)
ON DELETE CASCADE ON UPDATE CASCADE,
FOREIGN KEY (`id_alert_action`) REFERENCES talert_actions(`id`)
ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4;
CREATE TABLE IF NOT EXISTS `tgraph_analytics_filter` ( CREATE TABLE IF NOT EXISTS `tgraph_analytics_filter` (
`id` INT NOT NULL auto_increment, `id` INT NOT NULL auto_increment,
`filter_name` VARCHAR(45) NULL, `filter_name` VARCHAR(45) NULL,
@ -9,6 +106,51 @@ CREATE TABLE IF NOT EXISTS `tgraph_analytics_filter` (
PRIMARY KEY (`id`) PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4; ) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4;
CREATE TABLE IF NOT EXISTS `tconfig_os_version` (
`id_os_version` INT UNSIGNED NOT NULL AUTO_INCREMENT,
`product` TEXT,
`version` TEXT,
`end_of_support` VARCHAR(10) DEFAULT NULL,
PRIMARY KEY (`id_os_version`)
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4;
ALTER TABLE `tusuario` MODIFY COLUMN `integria_user_level_pass` TEXT;
DROP TABLE `tincidencia`;
DROP TABLE `tnota`;
DROP TABLE `tattachment`;
ALTER TABLE `talert_commands` ADD CONSTRAINT UNIQUE (`name`);
ALTER TABLE `talert_actions` MODIFY COLUMN `name` VARCHAR(500);
ALTER TABLE `talert_actions` ADD CONSTRAINT UNIQUE (`name`);
SET @command_name = 'Pandora&#x20;ITSM&#x20;Ticket';
SET @command_description = 'Create&#x20;a&#x20;ticket&#x20;in&#x20;Pandora&#x20;ITSM';
SET @action_name = 'Create&#x20;Pandora&#x20;ITSM&#x20;ticket';
UPDATE `talert_commands` SET `name` = @command_name, `description` = @command_description WHERE `name` = 'Integria&#x20;IMS&#x20;Ticket' AND `internal` = 1;
INSERT IGNORE INTO `talert_commands` (`name`, `command`, `description`, `internal`, `fields_descriptions`, `fields_values`) VALUES (@command_name,'Internal&#x20;type',@command_description,1,'["Ticket&#x20;title","Ticket&#x20;group&#x20;ID","Ticket&#x20;priority","Ticket&#x20;owner","Ticket&#x20;type","Ticket&#x20;status","Ticket&#x20;description","_custom_field_ITSM_","_custom_field_ITSM_","_custom_field_ITSM_","_custom_field_ITSM_","_custom_field_ITSM_","_custom_field_ITSM_","_custom_field_ITSM_","_custom_field_ITSM_","_custom_field_ITSM_","_custom_field_ITSM_","_custom_field_ITSM_","_custom_field_ITSM_","_custom_field_ITSM_"]','["", "_ITSM_groups_", "_ITSM_priorities_","_ITSM_users_","_ITSM_types_","_ITSM_status_","_html_editor_","_custom_field_ITSM_","_custom_field_ITSM_","_custom_field_ITSM_","_custom_field_ITSM_","_custom_field_ITSM_","_custom_field_ITSM_","_custom_field_ITSM_","_custom_field_ITSM_","_custom_field_ITSM_","_custom_field_ITSM_","_custom_field_ITSM_","_custom_field_ITSM_","_custom_field_ITSM_"]');
SELECT @id_alert_command := `id` FROM `talert_commands` WHERE `name` = @command_name;
UPDATE `talert_actions` SET `name` = @action_name WHERE `name` = 'Create&#x20;Integria&#x20;IMS&#x20;ticket' AND `id_alert_command` = @id_alert_command;
INSERT IGNORE INTO `talert_actions` (`name`, `id_alert_command`) VALUES (@action_name,@id_alert_command);
SET @event_response_name = 'Create&#x20;ticket&#x20;in&#x20;Pandora&#x20;ITSM&#x20;from&#x20;event';
SET @event_response_description = 'Create&#x20;a&#x20;ticket&#x20;in&#x20;Pandora&#x20;ITSM&#x20;from&#x20;an&#x20;event';
SET @event_response_target = 'index.php?sec=manageTickets&amp;sec2=operation/ITSM/itsm&amp;operation=edit&amp;from_event=_event_id_';
SET @event_response_type = 'url';
SET @event_response_id_group = 0;
SET @event_response_modal_width = 0;
SET @event_response_modal_height = 0;
SET @event_response_new_window = 1;
SET @event_response_params = '';
SET @event_response_server_to_exec = 0;
SET @event_response_command_timeout = 90;
SET @event_response_display_command = 1;
UPDATE `tevent_response` SET `name` = @event_response_name, `description` = @event_response_description, `target` = @event_response_target, `display_command` = @event_response_display_command WHERE `name` = 'Create&#x20;ticket&#x20;in&#x20;IntegriaIMS&#x20;from&#x20;event';
INSERT IGNORE INTO `tevent_response` (`name`, `description`, `target`,`type`,`id_group`,`modal_width`,`modal_height`,`new_window`,`params`,`server_to_exec`,`command_timeout`,`display_command`) VALUES (@event_response_name, @event_response_description, @event_response_target, @event_response_type, @event_response_id_group, @event_response_modal_width, @event_response_modal_height, @event_response_new_window, @event_response_params, @event_response_server_to_exec, @event_response_command_timeout, @event_response_display_command);
UPDATE `twelcome_tip` UPDATE `twelcome_tip`
SET title = 'Scheduled&#x20;downtimes', SET title = 'Scheduled&#x20;downtimes',
url = 'https://pandorafms.com/manual/en/documentation/04_using/11_managing_and_administration#scheduled_downtimes' url = 'https://pandorafms.com/manual/en/documentation/04_using/11_managing_and_administration#scheduled_downtimes'
@ -18,4 +160,292 @@ UPDATE tagente_modulo SET `tcp_send` = '2c' WHERE `tcp_send` = '2';
UPDATE tpolicy_modules SET `tcp_send` = '2c' WHERE `tcp_send` = '2'; UPDATE tpolicy_modules SET `tcp_send` = '2c' WHERE `tcp_send` = '2';
UPDATE tnetwork_component SET `tcp_send` = '2c' WHERE `tcp_send` = '2'; UPDATE tnetwork_component SET `tcp_send` = '2c' WHERE `tcp_send` = '2';
ALTER TABLE tagente_modulo ADD COLUMN `made_enabled` TINYINT UNSIGNED DEFAULT 0;
ALTER TABLE tpolicy_modules ADD COLUMN `made_enabled` TINYINT UNSIGNED DEFAULT 0;
ALTER TABLE talert_templates
ADD COLUMN `time_window` ENUM ('thirty_days','this_month','seven_days','this_week','one_day','today'),
ADD COLUMN `math_function` ENUM ('avg', 'min', 'max', 'sum'),
ADD COLUMN `condition` ENUM ('lower', 'greater', 'equal'),
MODIFY COLUMN `type` ENUM ('regex', 'max_min', 'max', 'min', 'equal', 'not_equal', 'warning', 'critical', 'onchange', 'unknown', 'always', 'not_normal', 'complex');
ALTER TABLE `tsesion_filter_log_viewer`
CHANGE COLUMN `date_range` `custom_date` INT NULL DEFAULT NULL ,
CHANGE COLUMN `start_date_defined` `date` VARCHAR(45) NULL DEFAULT NULL ,
CHANGE COLUMN `start_date_time` `date_text` VARCHAR(45) NULL DEFAULT NULL ,
CHANGE COLUMN `start_date_date` `date_units` VARCHAR(45) NULL DEFAULT NULL ,
CHANGE COLUMN `start_date_date_range` `date_init` VARCHAR(45) NULL DEFAULT NULL ,
CHANGE COLUMN `start_date_time_range` `time_init` VARCHAR(45) NULL DEFAULT NULL ,
CHANGE COLUMN `end_date_date_range` `date_end` VARCHAR(45) NULL DEFAULT NULL ,
CHANGE COLUMN `end_date_time_range` `time_end` VARCHAR(45) NULL DEFAULT NULL ;
ALTER TABLE `tsesion_filter`
CHANGE COLUMN `period` `date_text` VARCHAR(45) NULL DEFAULT NULL AFTER `user`;
ALTER TABLE `tsesion_filter`
ADD COLUMN `custom_date` INT NULL AFTER `user`,
ADD COLUMN `date` VARCHAR(45) NULL AFTER `custom_date`,
ADD COLUMN `date_units` VARCHAR(45) NULL AFTER `date_text`,
ADD COLUMN `date_init` VARCHAR(45) NULL AFTER `date_units`,
ADD COLUMN `time_init` VARCHAR(45) NULL AFTER `date_init`,
ADD COLUMN `date_end` VARCHAR(45) NULL AFTER `time_init`,
ADD COLUMN `time_end` VARCHAR(45) NULL AFTER `date_end`;
INSERT INTO `tconfig_os_version` (`id_os_version`, `product`, `version`, `end_of_support`) VALUES (1,'Windows.*','7.*','2020/01/14');
INSERT INTO `tconfig_os_version` (`id_os_version`, `product`, `version`, `end_of_support`) VALUES (2,'Cisco.*','IOS 3.4.3','2017/05/12');
INSERT INTO `tconfig_os_version` (`id_os_version`, `product`, `version`, `end_of_support`) VALUES (3,'Linux.*','Centos 7.*','2022/01/01');
UPDATE `tdiscovery_apps` SET `version` = '1.1' WHERE `short_name` = 'pandorafms.vmware';
-- Insert new Proxmox APP
SET @short_name = 'pandorafms.proxmox';
SET @name = 'Proxmox';
SET @section = 'app';
SET @description = 'Monitor&#x20;Proxmox&#x20;VMs,&#x20;LXC,&#x20;backups&#x20;and&#x20;nodes&#x20;from&#x20;a&#x20;specific&#x20;host';
SET @version = '1.0';
INSERT IGNORE INTO `tdiscovery_apps` (`id_app`, `short_name`, `name`, `section`, `description`, `version`) VALUES ('', @short_name, @name, @section, @description, @version);
SELECT @id_app := `id_app` FROM `tdiscovery_apps` WHERE `short_name` = @short_name;
-- Insert into tdiscovery_apps_scripts
INSERT IGNORE INTO `tdiscovery_apps_scripts` (`id_app`, `macro`, `value`) VALUES (@id_app, '_exec1_', 'bin/pandora_proxmox');
-- Insert into tdiscovery_apps_executions
INSERT IGNORE INTO `tdiscovery_apps_executions` (`id`, `id_app`, `execution`) VALUES (1, @id_app, '&#039;_exec1_&#039;&#x20;-g&#x20;&#039;__taskGroup__&#039;&#x20;--host&#x20;&#039;_host_&#039;&#x20;--port&#x20;&#039;_port_&#039;&#x20;--user&#x20;&#039;_user_&#039;&#x20;--password&#x20;&#039;_password_&#039;&#x20;--vm&#x20;&#039;_scanVM_&#039;&#x20;--lxc&#x20;&#039;_scanLXC_&#039;&#x20;--backups&#x20;&#039;_scanBackups_&#039;&#x20;--nodes&#x20;&#039;_scanNodes_&#039;&#x20;--transfer_mode&#x20;tentacle&#x20;--tentacle_address&#x20;&#039;_tentacleIP_&#039;&#x20;--tentacle_port&#x20;&#039;_tentaclePort_&#039;&#x20;--as_discovery_plugin&#x20;1');
-- Insert new SAP APP
SET @short_name = 'pandorafms.sap.deset';
SET @name = 'SAP&#x20;R3&#x20;-&#x20;Deset';
SET @section = 'app';
SET @description = 'Monitor&#x20;SAP&#x20;R3&#x20;environments';
SET @version = '1.0';
INSERT IGNORE INTO `tdiscovery_apps` (`id_app`, `short_name`, `name`, `section`, `description`, `version`) VALUES ('', @short_name, @name, @section, @description, @version);
SELECT @id_app := `id_app` FROM `tdiscovery_apps` WHERE `short_name` = @short_name;
-- Insert into tdiscovery_apps_scripts
INSERT IGNORE INTO `tdiscovery_apps_scripts` (`id_app`, `macro`, `value`) VALUES (@id_app, '_exec1_', 'bin/pandora_sap_deset');
INSERT IGNORE INTO `tdiscovery_apps_scripts` (`id_app`, `macro`, `value`) VALUES (@id_app, '_java_', 'bin/lib/jre/bin/java');
-- Insert into tdiscovery_apps_executions
INSERT IGNORE INTO `tdiscovery_apps_executions` (`id`, `id_app`, `execution`) VALUES (1, @id_app, '&#039;_exec1_&#039;&#x20;--conf&#x20;&#039;_tempfileConf_&#039;&#x20;--custom_modules&#x20;&#039;_tempfileCustomModules_&#039;');
-- Insert new EC2 APP
SET @short_name = 'pandorafms.aws.ec2';
SET @name = 'Amazon&#x20;EC2';
SET @section = 'cloud';
SET @description = 'Monitor&#x20;AWS&#x20;EC2&#x20;instances';
SET @version = '1.0';
INSERT IGNORE INTO `tdiscovery_apps` (`id_app`, `short_name`, `name`, `section`, `description`, `version`) VALUES ('', @short_name, @name, @section, @description, @version);
SELECT @id_app := `id_app` FROM `tdiscovery_apps` WHERE `short_name` = @short_name;
-- Insert into tdiscovery_apps_scripts
INSERT IGNORE INTO `tdiscovery_apps_scripts` (`id_app`, `macro`, `value`) VALUES (@id_app, '_exec1_', 'bin/pandora_aws_ec2');
INSERT IGNORE INTO `tdiscovery_apps_scripts` (`id_app`, `macro`, `value`) VALUES (@id_app, '_exec2_', 'bin/aws_ec2');
-- Insert into tdiscovery_apps_executions
INSERT IGNORE INTO `tdiscovery_apps_executions` (`id`, `id_app`, `execution`) VALUES (1, @id_app, '&#039;_exec1_&#039;&#x20;--conf&#x20;&#039;_tempfileEC2_&#039;');
-- Insert new RDS APP
SET @short_name = 'pandorafms.aws.rds';
SET @name = 'Amazon&#x20;RDS';
SET @section = 'cloud';
SET @description = 'Monitor&#x20;AWS&#x20;RDS&#x20;instances';
SET @version = '1.0';
INSERT IGNORE INTO `tdiscovery_apps` (`id_app`, `short_name`, `name`, `section`, `description`, `version`) VALUES ('', @short_name, @name, @section, @description, @version);
SELECT @id_app := `id_app` FROM `tdiscovery_apps` WHERE `short_name` = @short_name;
-- Insert into tdiscovery_apps_scripts
INSERT IGNORE INTO `tdiscovery_apps_scripts` (`id_app`, `macro`, `value`) VALUES (@id_app, '_exec1_', 'bin/pandora_aws_rds');
INSERT IGNORE INTO `tdiscovery_apps_scripts` (`id_app`, `macro`, `value`) VALUES (@id_app, '_exec2_', 'bin/aws_rds');
-- Insert into tdiscovery_apps_executions
INSERT IGNORE INTO `tdiscovery_apps_executions` (`id`, `id_app`, `execution`) VALUES (1, @id_app, '&#039;_exec1_&#039;&#x20;--conf&#x20;&#039;_tempfileRDS_&#039;');
-- Insert new S3 APP
SET @short_name = 'pandorafms.aws.s3';
SET @name = 'Amazon&#x20;S3';
SET @section = 'cloud';
SET @description = 'Monitor&#x20;AWS&#x20;S3&#x20;buckets';
SET @version = '1.0';
INSERT IGNORE INTO `tdiscovery_apps` (`id_app`, `short_name`, `name`, `section`, `description`, `version`) VALUES ('', @short_name, @name, @section, @description, @version);
SELECT @id_app := `id_app` FROM `tdiscovery_apps` WHERE `short_name` = @short_name;
-- Insert into tdiscovery_apps_scripts
INSERT IGNORE INTO `tdiscovery_apps_scripts` (`id_app`, `macro`, `value`) VALUES (@id_app, '_exec1_', 'bin/pandora_aws_s3');
INSERT IGNORE INTO `tdiscovery_apps_scripts` (`id_app`, `macro`, `value`) VALUES (@id_app, '_exec2_', 'bin/aws_s3');
-- Insert into tdiscovery_apps_executions
INSERT IGNORE INTO `tdiscovery_apps_executions` (`id`, `id_app`, `execution`) VALUES (1, @id_app, '&#039;_exec1_&#039;&#x20;--conf&#x20;&#039;_tempfileS3_&#039;');
-- Insert new Azure APP
SET @short_name = 'pandorafms.azure.mc';
SET @name = 'Azure&#x20;Microsoft&#x20;Compute';
SET @section = 'cloud';
SET @description = 'Monitor&#x20;Azure&#x20;Microsoft&#x20;Compute&#x20;VMs';
SET @version = '1.0';
INSERT IGNORE INTO `tdiscovery_apps` (`id_app`, `short_name`, `name`, `section`, `description`, `version`) VALUES ('', @short_name, @name, @section, @description, @version);
SELECT @id_app := `id_app` FROM `tdiscovery_apps` WHERE `short_name` = @short_name;
-- Insert into tdiscovery_apps_scripts
INSERT IGNORE INTO `tdiscovery_apps_scripts` (`id_app`, `macro`, `value`) VALUES (@id_app, '_exec1_', 'bin/pandora_azure_mc');
INSERT IGNORE INTO `tdiscovery_apps_scripts` (`id_app`, `macro`, `value`) VALUES (@id_app, '_exec2_', 'bin/azure_vm');
-- Insert into tdiscovery_apps_executions
INSERT IGNORE INTO `tdiscovery_apps_executions` (`id`, `id_app`, `execution`) VALUES (1, @id_app, '&#039;_exec1_&#039;&#x20;--conf&#x20;&#039;_tempfileAzureMC_&#039;');
-- Insert new Google APP
SET @short_name = 'pandorafms.gcp.ce';
SET @name = 'Google&#x20;Cloud&#x20;Compute&#x20;Engine';
SET @section = 'cloud';
SET @description = 'Monitor&#x20;Google&#x20;Cloud&#x20;Platform&#x20;Compute&#x20;Engine&#x20;VMs';
SET @version = '1.0';
INSERT IGNORE INTO `tdiscovery_apps` (`id_app`, `short_name`, `name`, `section`, `description`, `version`) VALUES ('', @short_name, @name, @section, @description, @version);
SELECT @id_app := `id_app` FROM `tdiscovery_apps` WHERE `short_name` = @short_name;
-- Insert into tdiscovery_apps_scripts
INSERT IGNORE INTO `tdiscovery_apps_scripts` (`id_app`, `macro`, `value`) VALUES (@id_app, '_exec1_', 'bin/pandora_gcp_ce');
INSERT IGNORE INTO `tdiscovery_apps_scripts` (`id_app`, `macro`, `value`) VALUES (@id_app, '_exec2_', 'bin/google_instances');
-- Insert into tdiscovery_apps_executions
INSERT IGNORE INTO `tdiscovery_apps_executions` (`id`, `id_app`, `execution`) VALUES (1, @id_app, '&#039;_exec1_&#039;&#x20;--conf&#x20;&#039;_tempfileGoogleCE_&#039;');
ALTER TABLE `treport_content` ADD COLUMN `cat_security_hardening` INT NOT NULL DEFAULT 0;
ALTER TABLE `treport_content` ADD COLUMN `ignore_skipped` INT NOT NULL DEFAULT 0;
ALTER TABLE `treport_content` ADD COLUMN `status_of_check` TINYTEXT;
ALTER TABLE `tservice` ADD COLUMN `enable_horizontal_tree` TINYINT NOT NULL DEFAULT 0;
INSERT INTO tmodule_group (name) SELECT ('Security') WHERE NOT EXISTS (SELECT name FROM tmodule_group WHERE LOWER(name) = 'security');
SET @tmodule_name = 'CPU';
SET @tmodule_description = 'CPU';
SET @id_os = 2;
INSERT INTO tmodule_inventory (`id_os`, `name`, `description`, `interpreter`, `data_format`, `code`, `block_mode`,`script_mode`)
SELECT * FROM (SELECT @id_os id_os, @tmodule_name name, @tmodule_description description, '' interpreter, 'Brand;Clock;Model' data_format, '' code, '0' block_mode, 2 script_mode) AS tmp
WHERE NOT EXISTS (SELECT name, description FROM tmodule_inventory WHERE name = @tmodule_name and description = @tmodule_description and id_os = @id_os);
SET @tmodule_name = 'RAM';
SET @tmodule_description = 'RAM';
SET @id_os = 2;
INSERT INTO tmodule_inventory (`id_os`, `name`, `description`, `interpreter`, `data_format`, `code`, `block_mode`,`script_mode`)
SELECT * FROM (SELECT @id_os id_os, @tmodule_name name, @tmodule_description description, '' interpreter, 'Size' data_format, '' code, '0' block_mode, 2 script_mode) AS tmp
WHERE NOT EXISTS (SELECT name, description FROM tmodule_inventory WHERE name = @tmodule_name and description = @tmodule_description and id_os = @id_os);
SET @tmodule_name = 'NIC';
SET @tmodule_description = 'NIC';
SET @id_os = 2;
INSERT INTO tmodule_inventory (`id_os`, `name`, `description`, `interpreter`, `data_format`, `code`, `block_mode`,`script_mode`)
SELECT * FROM (SELECT @id_os id_os, @tmodule_name name, @tmodule_description description, '' interpreter, 'NIC;Mac;Speed' data_format, '' code, '0' block_mode, 2 script_mode) AS tmp
WHERE NOT EXISTS (SELECT name, description FROM tmodule_inventory WHERE name = @tmodule_name and description = @tmodule_description and id_os = @id_os);
SET @tmodule_name = 'Software';
SET @tmodule_description = 'Software';
SET @id_os = 2;
INSERT INTO tmodule_inventory (`id_os`, `name`, `description`, `interpreter`, `data_format`, `code`, `block_mode`,`script_mode`)
SELECT * FROM (SELECT @id_os id_os, @tmodule_name name, @tmodule_description description, '' interpreter, 'PKGINST;VERSION;NAME' data_format, '' code, '0' block_mode, 2 script_mode) AS tmp
WHERE NOT EXISTS (SELECT name, description FROM tmodule_inventory WHERE name = @tmodule_name and description = @tmodule_description and id_os = @id_os);
SET @tmodule_name = 'Security';
SET @tmodule_description = 'Hardening&#x20;plugin&#x20;for&#x20;security&#x20;compliance&#x20;analysis';
SET @id_os = 1;
INSERT INTO tmodule_inventory (`id_os`, `name`, `description`, `interpreter`, `data_format`, `code`, `block_mode`,`script_mode`)
SELECT * FROM (SELECT @id_os id_os, @tmodule_name name, @tmodule_description description, '' interpreter, 'ID:STATUS' data_format, '' code, '0' block_mode, 2 script_mode) AS tmp
WHERE NOT EXISTS (SELECT name, description FROM tmodule_inventory WHERE name = @tmodule_name and description = @tmodule_description and id_os = @id_os);
SET @tmodule_name = 'Security';
SET @tmodule_description = 'Hardening&#x20;plugin&#x20;for&#x20;security&#x20;compliance&#x20;analysis';
SET @id_os = 9;
INSERT INTO tmodule_inventory (`id_os`, `name`, `description`, `interpreter`, `data_format`, `code`, `block_mode`,`script_mode`)
SELECT * FROM (SELECT @id_os id_os, @tmodule_name name, @tmodule_description description, '' interpreter, 'ID:STATUS' data_format, '' code, '0' block_mode, 2 script_mode) AS tmp
WHERE NOT EXISTS (SELECT name, description FROM tmodule_inventory WHERE name = @tmodule_name and description = @tmodule_description and id_os = @id_os);
INSERT INTO tmodule_group (name) SELECT ('Security') WHERE NOT EXISTS (SELECT name FROM tmodule_group WHERE LOWER(name) = 'security');
ALTER TABLE tagente_modulo ADD COLUMN `last_compact` TIMESTAMP NOT NULL DEFAULT 0;
UPDATE `tevent_alert` ea INNER JOIN `tevent_rule` er ON ea.id = er.id_event_alert SET disabled=1 WHERE er.log_agent IS NOT NULL OR er.log_content IS NOT NULL OR er.log_source IS NOT NULL;
ALTER TABLE `tnetwork_explorer_filter`
MODIFY COLUMN `id` INT NOT NULL AUTO_INCREMENT;
-- Add messaging alerts
SET @command_name = 'Pandora&#x20;Google&#x20;chat';
SET @action_name = 'Pandora&#x20;Google&#x20;chat';
-- Get command ID in case it exists
SET @id_command = NULL;
SELECT @id_command := `id` FROM `talert_commands` WHERE `name` = @command_name;
INSERT IGNORE INTO `talert_commands` (`id`, `name`, `command`, `description`, `internal`, `fields_descriptions`, `fields_values`) VALUES (@id_command, @command_name, '/usr/share/pandora_server/util/plugin/pandora-gchat-cli&#x20;-u&#x20;&quot;_field1_&quot;&#x20;-d&#x20;&quot;_field2_&quot;&#x20;-t&#x20;&quot;_field3_&quot;&#x20;-D&#x20;&quot;_field4_&quot;', 'Send&#x20;messages&#x20;using&#x20;Google&#x20;chat&#x20;API', 0, '["Google&#x20;chat&#x20;webhook&#x20;URL","Data&#x20;in&#x20;coma&#x20;separate&#x20;keypairs","Title","Description"]', '["","","",""]');
-- Get command ID again in case it has been created
SET @id_command = NULL;
SET @id_action = NULL;
SELECT @id_command := `id` FROM `talert_commands` WHERE `name` = @command_name;
SELECT @id_action := `id` FROM `talert_actions` WHERE `name` = @action_name;
INSERT IGNORE INTO `talert_actions` (`id`, `name`, `id_alert_command`, `field1`, `field2`, `field3`, `field4`, `field5`, `field6`, `field7`, `field8`, `field9`, `field10`, `id_group`, `action_threshold`, `field1_recovery`, `field2_recovery`, `field3_recovery`, `field4_recovery`, `field5_recovery`, `field6_recovery`, `field7_recovery`, `field8_recovery`, `field9_recovery`, `field10_recovery`) VALUES (@id_action, @action_name, @id_command, "", "data=_data_", "[PANDORA] Alert FIRED on _agent_ / _module_", "_agent_ | _module_ | _data_ | _timestamp_", "", "", "", "", "", "", 0, 0, "", "data=_data_", "[PANDORA] Alert RECOVERED on _agent_ / _module_", "_agent_ | _module_ | _data_ | _timestamp_", "", "", "", "", "", "");
SET @command_name = 'Pandora&#x20;Slack';
SET @action_name = 'Pandora&#x20;Slack';
-- Get command ID in case it exists
SET @id_command = NULL;
SELECT @id_command := `id` FROM `talert_commands` WHERE `name` = @command_name;
INSERT IGNORE INTO `talert_commands` (`id`, `name`, `command`, `description`, `internal`, `fields_descriptions`, `fields_values`) VALUES (@id_command, @command_name, '/usr/share/pandora_server/util/plugin/pandora-slack-cli&#x20;-t&#x20;&quot;TOKEN&quot;&#x20;-d&#x20;&quot;_field1_&quot;&#x20;-c&#x20;&quot;_field2_&quot;&#x20;-e&#x20;&quot;_field3_&quot;&#x20;-T&#x20;&quot;_field4_&quot;&#x20;-D&#x20;&quot;_field5_&quot;', 'Send&#x20;messages&#x20;using&#x20;Slack&#x20;API', 0, '["Data&#x20;in&#x20;coma&#x20;separate&#x20;keypairs","Slack&#x20;channel&#x20;id/name","Title&#x20;emoji","Title","Description"]', '["","",":red_circle:,Red&#x20;circle;:green_circle:,Green&#x20;circle","",""]');
-- Get command ID again in case it has been created
SET @id_command = NULL;
SET @id_action = NULL;
SELECT @id_command := `id` FROM `talert_commands` WHERE `name` = @command_name;
SELECT @id_action := `id` FROM `talert_actions` WHERE `name` = @action_name;
INSERT IGNORE INTO `talert_actions` (`id`, `name`, `id_alert_command`, `field1`, `field2`, `field3`, `field4`, `field5`, `field6`, `field7`, `field8`, `field9`, `field10`, `id_group`, `action_threshold`, `field1_recovery`, `field2_recovery`, `field3_recovery`, `field4_recovery`, `field5_recovery`, `field6_recovery`, `field7_recovery`, `field8_recovery`, `field9_recovery`, `field10_recovery`) VALUES (@id_action, @action_name, @id_command, "data=_data_", "", ":red_circle:", "[PANDORA] Alert FIRED on _agent_ / _module_", "_agent_ | _module_ | _data_ | _timestamp_", "", "", "", "", "", 0, 0, "data=_data_", "", ":green_circle:", "[PANDORA] Alert RECOVERED on _agent_ / _module_", "_agent_ | _module_ | _data_ | _timestamp_", "", "", "", "", "");
SET @command_name = 'Pandora&#x20;Telegram';
SET @action_name = 'Pandora&#x20;Telegram';
-- Get command ID in case it exists
SET @id_command = NULL;
SELECT @id_command := `id` FROM `talert_commands` WHERE `name` = @command_name;
INSERT IGNORE INTO `talert_commands` (`id`, `name`, `command`, `description`, `internal`, `fields_descriptions`, `fields_values`) VALUES (@id_command, @command_name, '/usr/share/pandora_server/util/plugin/pandora-telegram-cli&#x20;-t&#x20;&quot;TOKEN&quot;&#x20;-c&#x20;&quot;_field1_&quot;&#x20;-m&#x20;&quot;_field2_&quot;', 'Send&#x20;messages&#x20;using&#x20;Telegram&#x20;API', 0, '["Chat&#x20;ID","Message"]', '["",""]');
-- Get command ID again in case it has been created
SET @id_command = NULL;
SET @id_action = NULL;
SELECT @id_command := `id` FROM `talert_commands` WHERE `name` = @command_name;
SELECT @id_action := `id` FROM `talert_actions` WHERE `name` = @action_name;
INSERT IGNORE INTO `talert_actions` (`id`, `name`, `id_alert_command`, `field1`, `field2`, `field3`, `field4`, `field5`, `field6`, `field7`, `field8`, `field9`, `field10`, `id_group`, `action_threshold`, `field1_recovery`, `field2_recovery`, `field3_recovery`, `field4_recovery`, `field5_recovery`, `field6_recovery`, `field7_recovery`, `field8_recovery`, `field9_recovery`, `field10_recovery`) VALUES (@id_action, @action_name, @id_command, "", "[PANDORA] Alert FIRED on _agent_ / _module_ / _tiemstamp_ / _data_", "", "", "", "", "", "", "", "", 0, 0, "", "[PANDORA] Alert RECOVERED on _agent_ / _module_ / _tiemstamp_ / _data_", "", "", "", "", "", "", "", "");
SET @command_name = 'Pandora&#x20;ilert';
SET @action_name = 'Pandora&#x20;ilert';
-- Get command ID in case it exists
SET @id_command = NULL;
SELECT @id_command := `id` FROM `talert_commands` WHERE `name` = @command_name;
INSERT IGNORE INTO `talert_commands` (`id`, `name`, `command`, `description`, `internal`, `fields_descriptions`, `fields_values`) VALUES (@id_command, @command_name, '/usr/share/pandora_server/util/plugin/pandora_ilert&#x20;-a&#x20;&quot;API_KEY&quot;&#x20;-t&#x20;&quot;_field1_&quot;&#x20;-k&#x20;&quot;_field2_&quot;&#x20;-T&#x20;&quot;_field3_&quot;&#x20;-d&#x20;&quot;_field4_&quot;&#x20;-A&#x20;&quot;_agentname_&quot;&#x20;-m&#x20;&quot;_module_&quot;&#x20;-p&#x20;&quot;_alert_text_severity_&quot;&#x20;-D&#x20;&quot;_data_&quot;&#x20;-C&#x20;&quot;_timestamp_&quot;', 'Send&#x20;SMS&#x20;using&#x20;ilert&#x20;API:&#x20;https://docs.ilert.com/integrations/pandorafms/', 0, '["Event&#x20;type","Event&#x20;title","Title","Description"]', '["alert,Alert;resolved,Resolved","","",""]');
-- Get command ID again in case it has been created
SET @id_command = NULL;
SET @id_action = NULL;
SELECT @id_command := `id` FROM `talert_commands` WHERE `name` = @command_name;
SELECT @id_action := `id` FROM `talert_actions` WHERE `name` = @action_name;
INSERT IGNORE INTO `talert_actions` (`id`, `name`, `id_alert_command`, `field1`, `field2`, `field3`, `field4`, `field5`, `field6`, `field7`, `field8`, `field9`, `field10`, `id_group`, `action_threshold`, `field1_recovery`, `field2_recovery`, `field3_recovery`, `field4_recovery`, `field5_recovery`, `field6_recovery`, `field7_recovery`, `field8_recovery`, `field9_recovery`, `field10_recovery`) VALUES (@id_action, @action_name, @id_command, "alert", "", "[PANDORA] Alert FIRED on _agent_ / _module_", "_agent_ | _module_ | _data_ | _timestamp_", "", "", "", "", "", "", 0, 0, "resolved", "", "[PANDORA] Alert RECOVERED on _agent_ / _module_", "_agent_ | _module_ | _data_ | _timestamp_", "", "", "", "", "", "");
SET @command_name = 'Pandora&#x20;Vonage';
SET @action_name = 'Pandora&#x20;Vonage';
-- Get command ID in case it exists
SET @id_command = NULL;
SELECT @id_command := `id` FROM `talert_commands` WHERE `name` = @command_name;
INSERT IGNORE INTO `talert_commands` (`id`, `name`, `command`, `description`, `internal`, `fields_descriptions`, `fields_values`) VALUES (@id_command, @command_name, '/usr/share/pandora_server/util/plugin/pandora_vonage&#x20;-a&#x20;&quot;API_KEY&quot;&#x20;-s&#x20;&quot;SECRET&quot;&#x20;-f&#x20;&quot;FROM_ALIAS&quot;&#x20;-n&#x20;&quot;_field1_&quot;&#x20;-m&#x20;&quot;_field2_&quot;', 'Send&#x20;SMS&#x20;using&#x20;Vonage&#x20;API:&#x20;https://www.vonage.com/communications-apis/sms/', 0, '["Phone&#x20;number","Message"]', '["",""]');
-- Get command ID again in case it has been created
SET @id_command = NULL;
SET @id_action = NULL;
SELECT @id_command := `id` FROM `talert_commands` WHERE `name` = @command_name;
SELECT @id_action := `id` FROM `talert_actions` WHERE `name` = @action_name;
INSERT IGNORE INTO `talert_actions` (`id`, `name`, `id_alert_command`, `field1`, `field2`, `field3`, `field4`, `field5`, `field6`, `field7`, `field8`, `field9`, `field10`, `id_group`, `action_threshold`, `field1_recovery`, `field2_recovery`, `field3_recovery`, `field4_recovery`, `field5_recovery`, `field6_recovery`, `field7_recovery`, `field8_recovery`, `field9_recovery`, `field10_recovery`) VALUES (@id_action, @action_name, @id_command, "", "[PANDORA] Alert FIRED on _agent_ / _module_ / _tiemstamp_ / _data_", "", "", "", "", "", "", "", "", 0, 0, "", "[PANDORA] Alert RECOVERED on _agent_ / _module_ / _tiemstamp_ / _data_", "", "", "", "", "", "", "", "");
COMMIT; COMMIT;

View File

@ -352,6 +352,21 @@ echo sprintf('<div id="header_table" class="header_table_%s">', $menuTypeClass);
$display_counter = 'display:none'; $display_counter = 'display:none';
} }
$header_setup = '';
if ((bool) check_acl($config['id_user'], 0, 'PM') === true) {
$header_setup .= '<div id="header_logout"><a class="white" href="'.ui_get_full_url('index.php?sec=general&sec2=godmode/setup/setup&section=general').'">';
$header_setup .= html_print_image(
'images/configuration@svg.svg',
true,
[
'alt' => __('Setup'),
'class' => 'bot invert_filter main_menu_icon',
'title' => __('Setup'),
]
);
$header_setup .= '</a></div>';
}
$header_autorefresh = '<div id="header_autorefresh">'; $header_autorefresh = '<div id="header_autorefresh">';
$header_autorefresh .= $autorefresh_link_open_img; $header_autorefresh .= $autorefresh_link_open_img;
$header_autorefresh .= $autorefresh_img; $header_autorefresh .= $autorefresh_img;
@ -428,7 +443,7 @@ echo sprintf('<div id="header_table" class="header_table_%s">', $menuTypeClass);
); );
// Logout. // Logout.
$header_logout = '<div id="header_logout"><a class="white" href="'.ui_get_full_url('index.php?bye=bye').'">'; $header_logout = '<div id="header_logout"><a onClick=\'if (!confirm("'.__('Are you sure?').'")) return false;\' class="white" href="'.ui_get_full_url('index.php?bye=bye').'">';
$header_logout .= html_print_image( $header_logout .= html_print_image(
'images/sign_out@header.svg', 'images/sign_out@header.svg',
true, true,
@ -454,7 +469,7 @@ echo sprintf('<div id="header_table" class="header_table_%s">', $menuTypeClass);
} else { } else {
echo '<div class="header_left"><span class="header_title">'.$config['custom_title_header'].'</span><span class="header_subtitle">'.$config['custom_subtitle_header'].'</span></div> echo '<div class="header_left"><span class="header_title">'.$config['custom_title_header'].'</span><span class="header_subtitle">'.$config['custom_subtitle_header'].'</span></div>
<div class="header_center">'.$header_searchbar.'</div> <div class="header_center">'.$header_searchbar.'</div>
<div class="header_right">'.$header_autorefresh, $header_autorefresh_counter, $header_discovery, $header_welcome, $servers_list, $modal_help, $header_user, $header_logout.'</div>'; <div class="header_right">'.$header_autorefresh, $header_autorefresh_counter, $header_discovery, $header_welcome, $servers_list, $modal_help, $header_setup, $header_user, $header_logout.'</div>';
} }
?> ?>
</div> <!-- Closes #table_header_inner --> </div> <!-- Closes #table_header_inner -->

View File

@ -26,14 +26,16 @@
* ============================================================================ * ============================================================================
*/ */
use PandoraFMS\TacticalView\GeneralTacticalView;
// Config functions. // Config functions.
require_once 'include/config.php'; require_once 'include/config.php';
// This solves problems in enterprise load. // This solves problems in enterprise load.
global $config; global $config;
check_login(); check_login();
// ACL Check. // ACL Check.
if (check_acl($config['id_user'], 0, 'AR') === 0) { if (check_acl($config['id_user'], 0, 'AR') === 0) {
db_pandora_audit( db_pandora_audit(
AUDIT_LOG_ACL_VIOLATION, AUDIT_LOG_ACL_VIOLATION,
@ -43,322 +45,5 @@ if (check_acl($config['id_user'], 0, 'AR') === 0) {
exit; exit;
} }
require_once 'include/functions_reporting.php'; $tacticalView = new GeneralTacticalView();
require_once 'include/functions_tactical.php'; $tacticalView->render();
require_once $config['homedir'].'/include/functions_graph.php';
if (tags_has_user_acl_tags()) {
ui_print_tags_warning();
}
$all_data = tactical_status_modules_agents(
$config['id_user'],
false,
'AR'
);
$data = [];
$data['monitor_not_init'] = (int) $all_data['_monitors_not_init_'];
$data['monitor_unknown'] = (int) $all_data['_monitors_unknown_'];
$data['monitor_ok'] = (int) $all_data['_monitors_ok_'];
$data['monitor_warning'] = (int) $all_data['_monitors_warning_'];
$data['monitor_critical'] = (int) $all_data['_monitors_critical_'];
$data['monitor_not_normal'] = (int) $all_data['_monitor_not_normal_'];
$data['monitor_alerts'] = (int) $all_data['_monitors_alerts_'];
$data['monitor_alerts_fired'] = (int) $all_data['_monitors_alerts_fired_'];
$data['monitor_total'] = (int) $all_data['_monitor_total_'];
$data['total_agents'] = (int) $all_data['_total_agents_'];
$data['monitor_checks'] = (int) $all_data['_monitor_checks_'];
if (!empty($all_data)) {
if ($data['monitor_not_normal'] > 0 && $data['monitor_checks'] > 0) {
$data['monitor_health'] = format_numeric((100 - ($data['monitor_not_normal'] / ($data['monitor_checks'] / 100))), 1);
} else {
$data['monitor_health'] = 100;
}
if ($data['monitor_not_init'] > 0 && $data['monitor_checks'] > 0) {
$data['module_sanity'] = format_numeric((100 - ($data['monitor_not_init'] / ($data['monitor_checks'] / 100))), 1);
} else {
$data['module_sanity'] = 100;
}
if (isset($data['alerts'])) {
if ($data['monitor_alerts_fired'] > 0 && $data['alerts'] > 0) {
$data['alert_level'] = format_numeric((100 - ($data['monitor_alerts_fired'] / ($data['alerts'] / 100))), 1);
} else {
$data['alert_level'] = 100;
}
} else {
$data['alert_level'] = 100;
$data['alerts'] = 0;
}
$data['monitor_bad'] = ($data['monitor_critical'] + $data['monitor_warning']);
if ($data['monitor_bad'] > 0 && $data['monitor_checks'] > 0) {
$data['global_health'] = format_numeric((100 - ($data['monitor_bad'] / ($data['monitor_checks'] / 100))), 1);
} else {
$data['global_health'] = 100;
}
$data['server_sanity'] = format_numeric((100 - $data['module_sanity']), 1);
}
ui_require_css_file('logon');
echo '<div id="welcome_panel">';
//
// Overview Table.
//
$table = new stdClass();
$table->class = 'no-class';
$table->cellpadding = 4;
$table->cellspacing = 4;
$table->head = [];
$table->data = [];
$table->headstyle[0] = 'text-align:center;';
$table->width = '100%';
$table->head_colspan[0] = 4;
// Indicators.
$tdata = [];
$stats = reporting_get_stats_indicators($data, 120, 10, false);
$status = '<table class="status_tactical">';
foreach ($stats as $stat) {
$status .= '<tr><td><b>'.$stat['title'].'</b></td><td>'.$stat['graph'].'</td></tr>';
}
$status .= '</table>';
$table->rowclass = [];
$table->rowclass[0] = 'w100p';
$table->rowclass[1] = 'w100p';
$table->rowclass[2] = 'w100p';
$table->rowclass[3] = 'w100p';
$table->rowclass[4] = 'w100p';
$table->rowclass[5] = 'w100p';
$table->data[0][0] = $status;
$table->data[] = $tdata;
// Alerts.
$tdata = [];
$tdata[0] = reporting_get_stats_alerts($data);
$table->rowclass[] = '';
$table->data[] = $tdata;
// Modules by status.
$tdata = [];
$data_agents = [
__('Critical') => $data['monitor_critical'],
__('Warning') => $data['monitor_warning'],
__('Normal') => $data['monitor_ok'],
__('Unknown') => $data['monitor_unknown'],
__('Not init') => $data['monitor_not_init'],
];
$tdata[0] = reporting_get_stats_modules_status($data, 180, 100, false, $data_agents);
$table->rowclass[] = '';
$table->data[] = $tdata;
// Total agents and modules.
$tdata = [];
$tdata[0] = reporting_get_stats_agents_monitors($data);
$table->rowclass[] = '';
$table->data[] = $tdata;
// Users.
if (users_is_admin() || check_acl($config['id_user'], 0, 'UM')) {
$tdata = [];
$tdata[0] = reporting_get_stats_users($data);
$table->rowclass[] = '';
$table->data[] = $tdata;
}
ui_toggle(
html_print_table($table, true),
__('%s Overview', get_product_name()),
'',
'overview',
false
);
unset($table);
echo '<div id="right">';
// News.
require_once 'general/news_dialog.php';
$options = [];
$options['id_user'] = $config['id_user'];
$options['modal'] = false;
$options['limit'] = 3;
$news = get_news($options);
if (!empty($news)) {
ui_require_css_file('news');
// NEWS BOARD.
if ($config['prominent_time'] == 'timestamp') {
$comparation_suffix = '';
} else {
$comparation_suffix = __('ago');
}
$output_news = '<div id="news_board" class="new">';
foreach ($news as $article) {
$default = false;
if ($article['text'] == '&amp;lt;p&#x20;style=&quot;text-align:&#x20;center;&#x20;font-size:&#x20;13px;&quot;&amp;gt;Hello,&#x20;congratulations,&#x20;if&#x20;you&apos;ve&#x20;arrived&#x20;here&#x20;you&#x20;already&#x20;have&#x20;an&#x20;operational&#x20;monitoring&#x20;console.&#x20;Remember&#x20;that&#x20;our&#x20;forums&#x20;and&#x20;online&#x20;documentation&#x20;are&#x20;available&#x20;24x7&#x20;to&#x20;get&#x20;you&#x20;out&#x20;of&#x20;any&#x20;trouble.&#x20;You&#x20;can&#x20;replace&#x20;this&#x20;message&#x20;with&#x20;a&#x20;personalized&#x20;one&#x20;at&#x20;Admin&#x20;tools&#x20;-&amp;amp;gt;&#x20;Site&#x20;news.&amp;lt;/p&amp;gt;&#x20;') {
$article['subject'] = __('Welcome to Pandora FMS Console');
$default = true;
}
$text_bbdd = io_safe_output($article['text']);
$text = html_entity_decode($text_bbdd);
$output_news .= '<div class="new-board">';
$output_news .= '<div class="new-board-header">';
$output_news .= '<span class="new-board-title">'.$article['subject'].'</span>';
$output_news .= '<span class="new-board-author">'.__('By').' '.$article['author'].' '.ui_print_timestamp($article['timestamp'], true).'</span>';
$output_news .= '</div>';
$output_news .= '<div class="new content">';
if ($default) {
$output_news .= '<div class="default-new">';
$output_news .= '<div class="default-image-new">';
$output_news .= '<img src="./images/welcome_image.svg" alt="img colabora con nosotros - Support">';
$output_news .= '</div><div class="default-text-new">';
$output_news .= '
<p>'.__('Welcome to our monitoring tool so grand,').'
<br>'.__('Where data insights are at your command.').'
<br>'.__('Sales, marketing, operations too,').'
<br>'.__("Customer support, we've got you.").'
</p>
<p>'.__('Our interface is user-friendly,').'
<br>'.__("Customize your dashboard, it's easy.").'
<br>'.__('Set up alerts and gain insights so keen,').'
<br>'.__("Optimize your data, like you've never seen.").'
</p>
<p>'.__('Unleash its power now, and join the pro league,').'
<br>'.__('Unlock the potential of your data to intrigue.').'
<br>'.__('Monitoring made simple, efficient and fun,').'
<br>'.__('Discover a whole new way to get things done.').'
</p>
<p>'.__('And take control of your IT once and for all.').'</p>
<span>'.__('You can replace this message with a personalized one at Admin tools -> Site news.').'</span>
';
$output_news .= '</div></div>';
} else {
$text = str_replace('<script', '&lt;script', $text);
$text = str_replace('</script', '&lt;/script', $text);
$output_news .= nl2br($text);
}
$output_news .= '</div></div>';
}
$output_news .= '</div>';
// News board.
ui_toggle(
$output_news,
__('News board'),
'',
'news',
false
);
// END OF NEWS BOARD.
}
// LAST ACTIVITY.
// Show last activity from this user.
$table = new stdClass();
$table->class = 'no-td-padding info_table';
$table->cellpadding = 0;
$table->cellspacing = 0;
$table->width = '100%';
// Don't specify px.
$table->data = [];
$table->size = [];
$table->headstyle = [];
$table->size[0] = '5%';
$table->size[1] = '15%';
$table->headstyle[1] = 'min-width: 12em;';
$table->size[2] = '5%';
$table->headstyle[2] = 'min-width: 65px;';
$table->size[3] = '10%';
$table->size[4] = '25%';
$table->head = [];
$table->head[0] = __('User');
$table->head[1] = __('Action');
$table->head[2] = __('Date');
$table->head[3] = __('Source IP');
$table->head[4] = __('Comments');
$table->align[4] = 'left';
$sql = sprintf(
'SELECT id_usuario,accion, ip_origen,descripcion,utimestamp
FROM tsesion
WHERE (`utimestamp` > UNIX_TIMESTAMP(NOW()) - '.SECONDS_1WEEK.")
AND `id_usuario` = '%s' ORDER BY `utimestamp` DESC LIMIT 10",
$config['id_user']
);
$sessions = db_get_all_rows_sql($sql);
if ($sessions === false) {
$sessions = [];
}
foreach ($sessions as $session) {
$data = [];
$session_id_usuario = $session['id_usuario'];
$session_ip_origen = $session['ip_origen'];
$data[0] = '<strong>'.$session_id_usuario.'</strong>';
$data[1] = ui_print_session_action_icon($session['accion'], true).' '.$session['accion'];
$data[2] = ui_print_help_tip(
date($config['date_format'], $session['utimestamp']),
true
).human_time_comparation($session['utimestamp'], 'tiny');
$data[3] = $session_ip_origen;
$description = io_safe_output(str_replace([',', ', '], ', ', $session['descripcion']));
if (strlen($description) > 100) {
$data[4] = '<div >'.io_safe_input(substr($description, 0, 150)).'...</div>';
} else {
$data[4] = '<div >'.io_safe_input($description).'</div>';
}
array_push($table->data, $data);
}
$activity = html_print_table($table, true);
unset($table);
ui_toggle(
$activity,
__('Latest activity'),
'',
'activity',
false,
false,
'',
'white-box-content padded'
);
// END OF LAST ACTIVIYY.
// Close right panel.
echo '</div>';
// Close welcome panel.
echo '</div>';

View File

@ -1,31 +1,43 @@
<?php <?php
/**
* ITSM.
*
* @category ITSM view
* @package Pandora FMS
* @subpackage Opensource
* @version 1.0.0
* @license See below
*
* ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2005-2023 Pandora FMS
* Please see https://pandorafms.com/community/ 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.
* ============================================================================
*/
use PandoraFMS\ITSM\ITSM;
// Pandora FMS - https://pandorafms.com
// ==================================================
// Copyright (c) 2005-2023 Pandora FMS
// Please see https://pandorafms.com/community/ 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.
// Load global vars
global $config; global $config;
require_once 'include/functions_incidents.php';
check_login(); check_login();
if (!$config['integria_enabled']) { if (!$config['ITSM_enabled']) {
ui_print_error_message(__('In order to access ticket management system, integration with Integria IMS must be enabled and properly configured')); ui_print_error_message(__('In order to access ticket management system, integration with ITSM must be enabled and properly configured'));
return; return;
} }
$group = $id_grupo; if (! check_acl($config['id_user'], $id_grupo, 'AW', $id_agente)) {
if (! check_acl($config['id_user'], $group, 'AW', $id_agente)) {
db_pandora_audit( db_pandora_audit(
AUDIT_LOG_ACL_VIOLATION, AUDIT_LOG_ACL_VIOLATION,
'Trying to access agent manager' 'Trying to access agent manager'
@ -34,104 +46,11 @@ if (! check_acl($config['id_user'], $group, 'AW', $id_agente)) {
return; return;
} }
$offset = (int) get_parameter('offset', 0); try {
$ITSM = new ITSM();
echo $ITSM->getTableIncidencesForAgent($id_agente);
// See if id_agente is set (either POST or GET, otherwise -1 } catch (Exception $e) {
$id_agent = (int) get_parameter('id_agente'); echo $e->getMessage();
$groups = users_get_groups($config['id_user'], 'AR');
$filter = ' AND id_agent = '.$id_agent;
$url = 'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=incident&id_agente='.$id_agent;
$params = [
'',
'-10',
'1',
'-1',
'0',
'',
'',
'',
agents_get_name($id_agent),
];
$result = integria_api_call(null, null, null, null, 'get_incidents', $params, false, 'json', ',');
$result = json_decode($result, true);
if (empty($result) === true) {
$result = [];
$count = 0;
echo '<div class="nf">'.__('No incidents associated to this agent').'</div><br />';
return;
} else {
$count = count($result);
$result = array_slice($result, $offset, $config['block_size']);
} }
// Show pagination. html_print_action_buttons('');
ui_pagination($count, $url, $offset, 0, false, 'offset');
// ($count + $offset) it's real count of incidents because it's use LIMIT $offset in query.
echo '<br />';
// Show headers.
$table->width = '100%';
$table->class = 'databox';
$table->cellpadding = 4;
$table->cellspacing = 4;
$table->head = [];
$table->data = [];
$table->size = [];
$table->align = [];
$table->head[0] = __('ID');
$table->head[1] = __('Status');
$table->head[2] = __('Incident');
$table->head[3] = __('Priority');
$table->head[4] = __('Group');
$table->head[5] = __('Updated');
$table->size[0] = 43;
$table->size[7] = 50;
$table->align[1] = 'center';
$table->align[3] = 'center';
$table->align[4] = 'center';
$rowPair = true;
$iterator = 0;
foreach ($result as $row) {
if ($rowPair) {
$table->rowclass[$iterator] = 'rowPair';
} else {
$table->rowclass[$iterator] = 'rowOdd';
}
$rowPair = !$rowPair;
$iterator++;
$data = [];
$data[0] = '<a href="index.php?sec=incident&sec2=operation/incidents/dashboard_detail_integriaims_incident&incident_id='.$row['id_incidencia'].'">'.$row['id_incidencia'].'</a>';
$attach = incidents_get_attach($row['id_incidencia']);
if (!empty($attach)) {
$data[0] .= '&nbsp;&nbsp;'.html_print_image('images/attachment.png', true, ['style' => 'align:middle;']);
}
$data[1] = incidents_print_status_img($row['estado'], true);
$data[2] = '<a href="index.php?sec=incident&sec2=operation/incidents/dashboard_detail_integriaims_incident&incident_id='.$row['id_incidencia'].'">'.substr(io_safe_output($row['titulo']), 0, 45).'</a>';
$data[3] = incidents_print_priority_img($row['prioridad'], true);
$data[4] = $row['id_grupo'];
$data[5] = ui_print_timestamp($row['actualizacion'], true);
array_push($table->data, $data);
}
html_print_table($table);
echo '</div>';
unset($table);
echo '<br><br>';
echo '<div id="both">&nbsp;</div>';

View File

@ -548,6 +548,21 @@ $tableAgent->data['os'][0] .= html_print_div(
true true
); );
$tableAgent->data['caption_os_version'][0] = __('OS version');
$tableAgent->rowclass['os_version'] = 'w540px';
$tableAgent->data['os_version'][0] = html_print_input_text(
'os_version',
$os_version,
'',
16,
100,
true,
false,
false,
'',
'w540px'
);
$tableAgent->data['caption_server'][0] = __('Server'); $tableAgent->data['caption_server'][0] = __('Server');
$tableAgent->rowclass['server'] = 'w540px'; $tableAgent->rowclass['server'] = 'w540px';
$tableAgent->data['server'][0] = html_print_select( $tableAgent->data['server'][0] = html_print_select(

View File

@ -39,6 +39,7 @@ ui_require_javascript_file('encode_decode_base64');
ui_require_css_file('agent_manager'); ui_require_css_file('agent_manager');
use PandoraFMS\Event; use PandoraFMS\Event;
use PandoraFMS\ITSM\ITSM;
check_login(); check_login();
@ -215,6 +216,7 @@ if ($create_agent) {
$id_parent = (int) get_parameter_post('id_agent_parent'); $id_parent = (int) get_parameter_post('id_agent_parent');
$server_name = (string) get_parameter_post('server_name'); $server_name = (string) get_parameter_post('server_name');
$id_os = (int) get_parameter_post('id_os'); $id_os = (int) get_parameter_post('id_os');
$os_version = (string) get_parameter_post('os_version');
$disabled = (int) get_parameter_post('disabled'); $disabled = (int) get_parameter_post('disabled');
$custom_id_safe_output = strip_tags(io_safe_output(get_parameter('custom_id', ''))); $custom_id_safe_output = strip_tags(io_safe_output(get_parameter('custom_id', '')));
$custom_id = io_safe_input(trim(preg_replace('/[\/\\\|%#&$]/', '', $custom_id_safe_output))); $custom_id = io_safe_input(trim(preg_replace('/[\/\\\|%#&$]/', '', $custom_id_safe_output)));
@ -283,6 +285,7 @@ if ($create_agent) {
'comentarios' => $comentarios, 'comentarios' => $comentarios,
'modo' => $modo, 'modo' => $modo,
'id_os' => $id_os, 'id_os' => $id_os,
'os_version' => $os_version,
'disabled' => $disabled, 'disabled' => $disabled,
'cascade_protection' => $cascade_protection, 'cascade_protection' => $cascade_protection,
'cascade_protection_module' => $cascade_protection_module, 'cascade_protection_module' => $cascade_protection_module,
@ -437,7 +440,7 @@ if ($id_agente) {
[ [
'href' => 'index.php?sec=gagente&amp;sec2=godmode/agentes/configurar_agente&amp;tab=alert&amp;id_agente='.$id_agente, 'href' => 'index.php?sec=gagente&amp;sec2=godmode/agentes/configurar_agente&amp;tab=alert&amp;id_agente='.$id_agente,
'content' => html_print_image( 'content' => html_print_image(
'images/alert@svg.svg', 'images/add-alert.svg',
true, true,
[ [
'title' => __('Alerts'), 'title' => __('Alerts'),
@ -607,23 +610,6 @@ if ($id_agente) {
$agent_wizard['active'] = false; $agent_wizard['active'] = false;
} }
$total_incidents = agents_get_count_incidents($id_agente);
// Incident tab.
if ($total_incidents > 0) {
$incidenttab['text'] = html_print_menu_button(
[
'href' => 'index.php?sec=gagente&amp;sec2=godmode/agentes/configurar_agente&amp;tab=incident&amp;id_agente='.$id_agente,
'image' => 'images/logs@svg.svg',
'title' => __('Incidents'),
],
true
);
$incidenttab['active'] = ($tab === 'incident');
}
if (check_acl_one_of_groups($config['id_user'], $all_groups, 'AW') === true) { if (check_acl_one_of_groups($config['id_user'], $all_groups, 'AW') === true) {
if ($has_remote_conf !== false) { if ($has_remote_conf !== false) {
$agent_name = agents_get_name($id_agente); $agent_name = agents_get_name($id_agente);
@ -998,6 +984,7 @@ if ($update_agent) {
$modo = (int) get_parameter_post('modo', 0); $modo = (int) get_parameter_post('modo', 0);
// Mode: Learning, Normal or Autodisabled. // Mode: Learning, Normal or Autodisabled.
$id_os = (int) get_parameter_post('id_os'); $id_os = (int) get_parameter_post('id_os');
$os_version = (string) get_parameter_post('os_version');
$disabled = (bool) get_parameter_post('disabled'); $disabled = (bool) get_parameter_post('disabled');
$server_name = (string) get_parameter_post('server_name', ''); $server_name = (string) get_parameter_post('server_name', '');
$id_parent = (int) get_parameter_post('id_agent_parent'); $id_parent = (int) get_parameter_post('id_agent_parent');
@ -1123,6 +1110,7 @@ if ($update_agent) {
'disabled' => $disabled, 'disabled' => $disabled,
'id_parent' => $id_parent, 'id_parent' => $id_parent,
'id_os' => $id_os, 'id_os' => $id_os,
'os_version' => $os_version,
'modo' => $modo, 'modo' => $modo,
'alias' => $alias, 'alias' => $alias,
'alias_as_name' => $alias_as_name, 'alias_as_name' => $alias_as_name,
@ -1284,6 +1272,7 @@ if ($id_agente) {
$server_name = $agent['server_name']; $server_name = $agent['server_name'];
$modo = $agent['modo']; $modo = $agent['modo'];
$id_os = $agent['id_os']; $id_os = $agent['id_os'];
$os_version = $agent['os_version'];
$disabled = $agent['disabled']; $disabled = $agent['disabled'];
$id_parent = $agent['id_parent']; $id_parent = $agent['id_parent'];
$custom_id = $agent['custom_id']; $custom_id = $agent['custom_id'];
@ -1337,6 +1326,12 @@ if ($update_module === true || $create_module === true) {
*/ */
$post_process = (string) get_parameter('post_process', 0.0); $post_process = (string) get_parameter('post_process', 0.0);
if (modules_made_compatible($id_module_type) === true) {
$made_enabled = (bool) get_parameter_checkbox('made_enabled', 0);
} else {
$made_enabled = false;
}
$prediction_module = (int) get_parameter('prediction_module'); $prediction_module = (int) get_parameter('prediction_module');
$max_timeout = (int) get_parameter('max_timeout'); $max_timeout = (int) get_parameter('max_timeout');
$max_retries = (int) get_parameter('max_retries'); $max_retries = (int) get_parameter('max_retries');
@ -1359,6 +1354,14 @@ if ($update_module === true || $create_module === true) {
} }
$configuration_data = (string) get_parameter('configuration_data'); $configuration_data = (string) get_parameter('configuration_data');
$array_configuration_data = explode(PHP_EOL, io_safe_output($configuration_data));
$configuration_data = '';
foreach ($array_configuration_data as $value) {
$configuration_data .= trim($value).PHP_EOL;
}
$configuration_data = io_safe_input($configuration_data);
$old_configuration_data = (string) get_parameter('old_configuration_data'); $old_configuration_data = (string) get_parameter('old_configuration_data');
$new_configuration_data = ''; $new_configuration_data = '';
@ -1475,13 +1478,13 @@ if ($update_module === true || $create_module === true) {
$plugin_pass = io_input_password( $plugin_pass = io_input_password(
(string) get_parameter('snmp3_auth_pass') (string) get_parameter('snmp3_auth_pass')
); );
$plugin_parameter = (string) get_parameter('snmp3_auth_method'); $plugin_parameter = (string) get_parameter('snmp3_auth_method', 'MD5');
$custom_string_1 = (string) get_parameter('snmp3_privacy_method'); $custom_string_1 = (string) get_parameter('snmp3_privacy_method', 'DES');
$custom_string_2 = io_input_password( $custom_string_2 = io_input_password(
(string) get_parameter('snmp3_privacy_pass') (string) get_parameter('snmp3_privacy_pass')
); );
$custom_string_3 = (string) get_parameter('snmp3_security_level'); $custom_string_3 = (string) get_parameter('snmp3_security_level', 'noAuthNoPriv');
} else if ($id_module_type >= 34 && $id_module_type <= 37) { } else if ($id_module_type >= 34 && $id_module_type <= 37) {
$tcp_send = (string) get_parameter('command_text'); $tcp_send = (string) get_parameter('command_text');
$custom_string_1 = (string) get_parameter( $custom_string_1 = (string) get_parameter(
@ -1499,6 +1502,14 @@ if ($update_module === true || $create_module === true) {
} }
$plugin_parameter = (string) get_parameter('plugin_parameter'); $plugin_parameter = (string) get_parameter('plugin_parameter');
$array_plugin_parameter = explode(PHP_EOL, io_safe_output($plugin_parameter));
$plugin_parameter = '';
foreach ($array_plugin_parameter as $value) {
$plugin_parameter .= trim($value).PHP_EOL;
}
$plugin_parameter = io_safe_input($plugin_parameter);
} }
$parent_module_id = (int) get_parameter('parent_module_id'); $parent_module_id = (int) get_parameter('parent_module_id');
@ -1715,6 +1726,7 @@ if ($update_module) {
'plugin_parameter' => $plugin_parameter, 'plugin_parameter' => $plugin_parameter,
'id_plugin' => $id_plugin, 'id_plugin' => $id_plugin,
'post_process' => $post_process, 'post_process' => $post_process,
'made_enabled' => $made_enabled,
'prediction_module' => $prediction_module, 'prediction_module' => $prediction_module,
'max_timeout' => $max_timeout, 'max_timeout' => $max_timeout,
'max_retries' => $max_retries, 'max_retries' => $max_retries,
@ -1913,6 +1925,7 @@ if ($create_module) {
'plugin_parameter' => $plugin_parameter, 'plugin_parameter' => $plugin_parameter,
'id_plugin' => $id_plugin, 'id_plugin' => $id_plugin,
'post_process' => $post_process, 'post_process' => $post_process,
'made_enabled' => $made_enabled,
'prediction_module' => $prediction_module, 'prediction_module' => $prediction_module,
'max_timeout' => $max_timeout, 'max_timeout' => $max_timeout,
'max_retries' => $max_retries, 'max_retries' => $max_retries,
@ -2092,7 +2105,6 @@ if ($create_module) {
if ($disable_module) { if ($disable_module) {
hd($disable_module, true);
$result = modules_change_disabled($disable_module, 1); $result = modules_change_disabled($disable_module, 1);
$module_name = modules_get_agentmodule_name($disable_module); $module_name = modules_get_agentmodule_name($disable_module);
@ -2116,13 +2128,11 @@ if ($create_module) {
if ($result === NOERR) { if ($result === NOERR) {
hd($disable_module, true);
db_pandora_audit( db_pandora_audit(
AUDIT_LOG_MODULE_MANAGEMENT, AUDIT_LOG_MODULE_MANAGEMENT,
'Disable #'.$disable_module.' | '.$module_name.' | '.io_safe_output($agent['alias']) 'Disable #'.$disable_module.' | '.$module_name.' | '.io_safe_output($agent['alias'])
); );
} else { } else {
hd($disable_module, true);
db_pandora_audit( db_pandora_audit(
AUDIT_LOG_MODULE_MANAGEMENT, AUDIT_LOG_MODULE_MANAGEMENT,
'Fail to disable #'.$disable_module.' | '.$module_name.' | '.io_safe_output($agent['alias']) 'Fail to disable #'.$disable_module.' | '.$module_name.' | '.io_safe_output($agent['alias'])

View File

@ -751,6 +751,10 @@ if ($agents !== false) {
'index.php?sec=reporting&sec2=operation/cluster/cluster&op=view&id=%s', 'index.php?sec=reporting&sec2=operation/cluster/cluster&op=view&id=%s',
$cluster->id() $cluster->id()
); );
$agentAlertUrl = sprintf(
'index.php?sec=estado&sec2=operation/cluster/cluster&op=update&id=%s&page=6',
$cluster->id()
);
} else { } else {
$main_tab = ($check_aw === true) ? 'main' : 'module'; $main_tab = ($check_aw === true) ? 'main' : 'module';
$agentNameUrl = sprintf( $agentNameUrl = sprintf(
@ -762,6 +766,10 @@ if ($agents !== false) {
'index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=%s', 'index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=%s',
$agent['id_agente'] $agent['id_agente']
); );
$agentAlertUrl = sprintf(
'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=alert&id_agente=%s',
$agent['id_agente']
);
} }
if (empty($agent['alias']) === true) { if (empty($agent['alias']) === true) {
@ -825,7 +833,7 @@ if ($agents !== false) {
); );
} }
if ((int) $agent['id_os'] !== 100) { if ((int) $agent['id_os'] != CLUSTER_OS_ID) {
$additionalOptionsAgentName[] = html_print_anchor( $additionalOptionsAgentName[] = html_print_anchor(
[ [
'href' => ui_get_full_url('index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=module&id_agente='.$agent['id_agente']), 'href' => ui_get_full_url('index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=module&id_agente='.$agent['id_agente']),
@ -837,7 +845,7 @@ if ($agents !== false) {
$additionalOptionsAgentName[] = html_print_anchor( $additionalOptionsAgentName[] = html_print_anchor(
[ [
'href' => ui_get_full_url('index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=alert&id_agente='.$agent['id_agente']), 'href' => ui_get_full_url($agentAlertUrl),
'content' => __('Alerts'), 'content' => __('Alerts'),
], ],
true true
@ -942,7 +950,7 @@ if ($agents !== false) {
$os $os
) )
), ),
'onClick' => ($agent['id_os'] === CLUSTER_OS_ID) ? sprintf('if (!confirm(\'%s\')) return false', $agentDisableEnableCaption) : 'return true;', 'onClick' => ($agent['id_os'] == CLUSTER_OS_ID) ? sprintf('if (!confirm(\'%s\')) return false', $agentDisableEnableCaption) : 'return true;',
'image' => sprintf('images/%s', $agentDisableEnableIcon), 'image' => sprintf('images/%s', $agentDisableEnableIcon),
'title' => $agentDisableEnableTitle, 'title' => $agentDisableEnableTitle,
], ],
@ -950,7 +958,7 @@ if ($agents !== false) {
); );
if ($check_aw === true && is_management_allowed() === true) { if ($check_aw === true && is_management_allowed() === true) {
if ($agent['id_os'] !== CLUSTER_OS_ID) { if ($agent['id_os'] != CLUSTER_OS_ID) {
$onClickActionDeleteAgent = 'if (!confirm(\' '.__('Are you sure?').'\')) return false;'; $onClickActionDeleteAgent = 'if (!confirm(\' '.__('Are you sure?').'\')) return false;';
} else { } else {
$onClickActionDeleteAgent = 'if (!confirm(\' '.__('WARNING! - You are going to delete a cluster agent. Are you sure?').'\')) return false;'; $onClickActionDeleteAgent = 'if (!confirm(\' '.__('WARNING! - You are going to delete a cluster agent. Are you sure?').'\')) return false;';

View File

@ -294,6 +294,7 @@ if ($id_agent_module) {
$plugin_parameter = $module['plugin_parameter']; $plugin_parameter = $module['plugin_parameter'];
$id_plugin = $module['id_plugin']; $id_plugin = $module['id_plugin'];
$post_process = $module['post_process']; $post_process = $module['post_process'];
$made_enabled = $module['made_enabled'];
$prediction_module = $module['prediction_module']; $prediction_module = $module['prediction_module'];
$custom_integer_1 = $module['custom_integer_1']; $custom_integer_1 = $module['custom_integer_1'];
$custom_integer_2 = $module['custom_integer_2']; $custom_integer_2 = $module['custom_integer_2'];
@ -408,6 +409,7 @@ if ($id_agent_module) {
$id_module_group = 1; $id_module_group = 1;
$id_module_type = 1; $id_module_type = 1;
$post_process = ''; $post_process = '';
$made_enabled = false;
$max_timeout = 0; $max_timeout = 0;
$max_retries = 0; $max_retries = 0;
$min = ''; $min = '';
@ -459,10 +461,10 @@ if ($id_agent_module) {
$snmp_version = 1; $snmp_version = 1;
$snmp3_auth_user = ''; $snmp3_auth_user = '';
$snmp3_auth_pass = ''; $snmp3_auth_pass = '';
$snmp3_auth_method = ''; $snmp3_auth_method = 'MD5';
$snmp3_privacy_method = ''; $snmp3_privacy_method = 'DES';
$snmp3_privacy_pass = ''; $snmp3_privacy_pass = '';
$snmp3_security_level = ''; $snmp3_security_level = 'noAuthNoPriv';
// For Remote CMD. // For Remote CMD.
$command_text = ''; $command_text = '';

View File

@ -405,7 +405,22 @@ push_table_simple($data, 'field_snmpv3_row1');
$data = []; $data = [];
$data[0] = __('Privacy method'); $data[0] = __('Privacy method');
$data[1] = html_print_select(['DES' => __('DES'), 'AES' => __('AES')], 'snmp3_privacy_method', $snmp3_privacy_method, '', '', '', true, false, false, '', $disabledBecauseInPolicy); $data[1] = html_print_select(
[
'DES' => __('DES'),
'AES' => __('AES'),
],
'snmp3_privacy_method',
$snmp3_privacy_method,
'',
'',
'',
true,
false,
false,
'',
$disabledBecauseInPolicy
);
$data[2] = __('Privacy pass').ui_print_help_tip(__('The pass length must be eight character minimum.'), true); $data[2] = __('Privacy pass').ui_print_help_tip(__('The pass length must be eight character minimum.'), true);
$data[3] = html_print_input_password( $data[3] = html_print_input_password(
'snmp3_privacy_pass', 'snmp3_privacy_pass',

View File

@ -318,7 +318,7 @@ foreach ($texts as $code => $text) {
return; return;
} }
$(plugin_parameter).val('task_begin\ncookie 0\nresource 0\ntask_end'); $(plugin_parameter).val('task_begin\nget https://demoweb.com/page/\ncheck_string text string or HTML code to search (regexp)\ntask_end\n');
$('#button-btn_loadbasic').attr('disabled', 'disabled'); $('#button-btn_loadbasic').attr('disabled', 'disabled');

View File

@ -405,6 +405,12 @@ $actions = array_slice($actions, $offset, $limit);
$rowPair = true; $rowPair = true;
$iterator = 0; $iterator = 0;
foreach ($actions as $action) { foreach ($actions as $action) {
if ((isset($config['ITSM_enabled']) === false || (bool) $config['ITSM_enabled'] === false)
&& $action['name'] === 'Create&#x20;Pandora&#x20;ITSM&#x20;ticket'
) {
continue;
}
if ($rowPair) { if ($rowPair) {
$table->rowclass[$iterator] = 'rowPair'; $table->rowclass[$iterator] = 'rowPair';
} else { } else {

View File

@ -1,16 +1,33 @@
<?php <?php
/**
* Alerts commands.
*
* @category Alerts
* @package Pandora FMS
* @subpackage Opensource
* @version 1.0.0
* @license See below
*
* ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2005-2023 Pandora FMS
* Please see https://pandorafms.com/community/ 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.
* ============================================================================
*/
use PandoraFMS\ITSM\ITSM;
// Pandora FMS - https://pandorafms.com
// ==================================================
// Copyright (c) 2005-2023 Pandora FMS
// Please see https://pandorafms.com/community/ 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.
// Load global vars. // Load global vars.
global $config; global $config;
@ -51,9 +68,9 @@ if (is_ajax()) {
$get_recovery_fields = (int) get_parameter('get_recovery_fields', 1); $get_recovery_fields = (int) get_parameter('get_recovery_fields', 1);
// Snmp alerts are not in the metaconsole so they cannot be centralized. // Snmp alerts are not in the metaconsole so they cannot be centralized.
$is_management_allowed = false; $management_is_not_allowed = false;
if ($get_recovery_fields !== 0) { if ($get_recovery_fields !== 0) {
$is_management_allowed = !is_management_allowed(); $management_is_not_allowed = !is_management_allowed();
} }
// If command ID is not provided, check for action id. // If command ID is not provided, check for action id.
@ -97,7 +114,7 @@ if (is_ajax()) {
if (!empty($field_description)) { if (!empty($field_description)) {
// If the value is 5, this because severity in snmp alerts is not permit to show. // If the value is 5, this because severity in snmp alerts is not permit to show.
if (($i > 5) && ($command['id'] == 3)) { if (($i > 5) && ($command['id'] === 3)) {
$fdesc = $field_description.' <br><span class="normal xx-small">'.sprintf( $fdesc = $field_description.' <br><span class="normal xx-small">'.sprintf(
__('Field %s'), __('Field %s'),
($i - 1) ($i - 1)
@ -118,7 +135,7 @@ if (is_ajax()) {
} }
} else { } else {
// If the macro hasn't description and doesnt appear in command, set with empty description to dont show it. // If the macro hasn't description and doesnt appear in command, set with empty description to dont show it.
if (($i > 5) && ($command['id'] == 3)) { if (($i > 5) && ($command['id'] === 3)) {
if (substr_count($command['command'], '_field'.($i - 1).'_') > 0) { if (substr_count($command['command'], '_field'.($i - 1).'_') > 0) {
$fdesc = sprintf(__('Field %s'), ($i - 1)); $fdesc = sprintf(__('Field %s'), ($i - 1));
} else { } else {
@ -135,6 +152,17 @@ if (is_ajax()) {
$style = ((int) $field_hidden === 1) ? '-webkit-text-security: disc; font-family: text-security-disc;' : ''; $style = ((int) $field_hidden === 1) ? '-webkit-text-security: disc; font-family: text-security-disc;' : '';
$recovery_disabled = 0;
if (empty($command) === false && $command['name'] === io_safe_input('Pandora ITSM Ticket')) {
if ($management_is_not_allowed == 0) {
if (preg_match('/^_html_editor_$/i', $field_value) || $field_description === 'Ticket status') {
$recovery_disabled = 0;
} else {
$recovery_disabled = 1;
}
}
}
if (!empty($field_value)) { if (!empty($field_value)) {
$field_value = io_safe_output($field_value); $field_value = io_safe_output($field_value);
// HTML type. // HTML type.
@ -150,7 +178,7 @@ if (is_ajax()) {
0, 0,
'', '',
false, false,
$is_management_allowed, $management_is_not_allowed,
"UndefineTinyMCE('#textarea_field".$i."_value')", "UndefineTinyMCE('#textarea_field".$i."_value')",
'', '',
true true
@ -162,7 +190,7 @@ if (is_ajax()) {
0, 0,
'', '',
true, true,
$is_management_allowed, $management_is_not_allowed,
"defineTinyMCE('#textarea_field".$i."_value')", "defineTinyMCE('#textarea_field".$i."_value')",
'', '',
true true
@ -177,7 +205,7 @@ if (is_ajax()) {
'class="fields w100p"', 'class="fields w100p"',
true, true,
'', '',
$is_management_allowed $management_is_not_allowed
); );
$editor_type_chkbx = '<div id="command_div"><b><small>'; $editor_type_chkbx = '<div id="command_div"><b><small>';
@ -187,7 +215,7 @@ if (is_ajax()) {
0, 0,
'', '',
false, false,
$is_management_allowed, $management_is_not_allowed,
"UndefineTinyMCE('#textarea_field".$i."_recovery_value')", "UndefineTinyMCE('#textarea_field".$i."_recovery_value')",
'', '',
true true
@ -199,7 +227,7 @@ if (is_ajax()) {
0, 0,
'', '',
true, true,
$is_management_allowed, $management_is_not_allowed,
"defineTinyMCE('#textarea_field".$i."_recovery_value')", "defineTinyMCE('#textarea_field".$i."_recovery_value')",
'', '',
true true
@ -214,7 +242,7 @@ if (is_ajax()) {
'class="fields_recovery"', 'class="fields_recovery"',
true, true,
'', '',
$is_management_allowed $management_is_not_allowed || $recovery_disabled
); );
} else if (preg_match('/^_content_type_$/i', $field_value)) { } else if (preg_match('/^_content_type_$/i', $field_value)) {
$editor_type_chkbx = '<div id="command_div"><b><small>'; $editor_type_chkbx = '<div id="command_div"><b><small>';
@ -228,7 +256,7 @@ if (is_ajax()) {
'text/plain', 'text/plain',
'', '',
'', '',
$is_management_allowed, $management_is_not_allowed,
'', '',
'', '',
true true
@ -240,7 +268,7 @@ if (is_ajax()) {
'text/html', 'text/html',
'', '',
'text/html', 'text/html',
$is_management_allowed, $management_is_not_allowed,
'', '',
'', '',
true true
@ -259,7 +287,7 @@ if (is_ajax()) {
'text/plain', 'text/plain',
'', '',
'', '',
$is_management_allowed, $management_is_not_allowed,
'', '',
'', '',
true true
@ -271,7 +299,7 @@ if (is_ajax()) {
'text/html', 'text/html',
'', '',
'text/html', 'text/html',
$is_management_allowed, $management_is_not_allowed,
'', '',
'', '',
true true
@ -279,78 +307,304 @@ if (is_ajax()) {
$editor_type_chkbx .= '</small></b></div>'; $editor_type_chkbx .= '</small></b></div>';
$rfield = $editor_type_chkbx; $rfield = $editor_type_chkbx;
// Select type. // Select type.
} else if (preg_match('/^_integria_type_custom_field_$/i', $field_value)) { } else if (preg_match('/^_custom_field_ITSM_$/i', $field_value)) {
$ffield = ''; $ffield = '';
$rfield = ''; $rfield = '';
$ffield .= '<div name="field'.$i.'_value_container">'.html_print_switch( $ffield .= '<div name="field'.$i.'_value_container">'.html_print_switch(
[ [
'name' => 'field'.$i.'_value[]', 'name' => 'field'.$i.'_value[]',
'value' => '', 'value' => '',
] ]
).'</div>'; ).'</div>';
$rfield .= '<div name="field'.$i.'_recovery_value_container">'.html_print_switch( $rfield .= '<div name="field'.$i.'_recovery_value_container">'.html_print_switch(
[ [
'name' => 'field'.$i.'_recovery_value[]', 'name' => 'field'.$i.'_recovery_value[]',
'value' => '', 'value' => '',
] 'disabled' => $management_is_not_allowed || $recovery_disabled,
).'</div>'; ]
).'</div>';
$ffield .= html_print_select( $ffield .= html_print_select(
'', '',
'field'.$i.'_value[]', 'field'.$i.'_value[]',
'',
'',
__('None'),
'',
true,
false,
false,
'fields',
$management_is_not_allowed,
'width: 100%;',
false,
false,
false,
'',
false,
false,
false,
false,
false
);
$rfield .= html_print_select(
'',
'field'.$i.'_recovery_value[]',
'',
'',
__('None'),
'',
true,
false,
false,
'fields',
$management_is_not_allowed || $recovery_disabled,
'width: 100%;',
false,
false,
false,
'',
false,
false,
false,
false,
false
);
$ffield .= html_print_input_text(
'field'.$i.'_value[]',
'',
'',
50,
50,
true,
false,
false,
'',
'datepicker',
'',
'off',
false,
'',
'',
'',
$management_is_not_allowed
);
$rfield .= html_print_input_text(
'field'.$i.'_recovery_value[]',
'',
'',
50,
50,
true,
false,
false,
'',
'datepicker',
'',
'off',
false,
'',
'',
'',
$management_is_not_allowed || $recovery_disabled
);
$ffield .= html_print_textarea(
'field'.$i.'_value[]',
5,
1,
'',
'style="min-height:40px; '.$style.'" class="fields"',
true,
'',
$management_is_not_allowed
);
$rfield .= html_print_textarea(
'field'.$i.'_recovery_value[]',
5,
1,
'',
'style="min-height:40px; '.$style.'" class="fields_recovery',
true,
'',
$management_is_not_allowed || $recovery_disabled
);
$values_input_number = [
'name' => 'field'.$i.'_value[]',
'value' => 0,
'id' => 'field'.$i.'_value',
'return' => true,
];
if ($management_is_not_allowed === true) {
$values_input_number['disabled'] = true;
}
$ffield .= html_print_input_number($values_input_number);
$values_input_number_recovery = [
'name' => 'field'.$i.'_recovery_value[]',
'value' => 0,
'id' => 'field'.$i.'_recovery_value',
'return' => true,
];
if ($management_is_not_allowed || $recovery_disabled) {
$values_input_number_recovery['disabled'] = true;
}
$rfield .= html_print_input_number($values_input_number_recovery);
$ffield .= html_print_input_text(
'field'.$i.'_value[]',
'',
'',
50,
255,
true,
false,
false,
'',
'normal w98p',
'',
'off',
false,
false,
'',
'',
$management_is_not_allowed
);
$rfield .= html_print_input_text(
'field'.$i.'_recovery_value[]',
'',
'',
50,
255,
true,
false,
false,
'',
'normal w98p',
'',
'off',
false,
false,
'',
'',
$management_is_not_allowed || $recovery_disabled
);
} else if (str_starts_with($field_value, '_ITSM_')) {
$nothing = '';
$nothing_value = 0;
$mode = 'select';
switch ($field_value) {
case '_ITSM_groups_':
$fields_array = [];
try {
$ITSM = new ITSM();
$fields_array = $ITSM->getGroups();
} catch (\Throwable $th) {
$error = $th->getMessage();
$fields_array = [];
}
break;
case '_ITSM_priorities_':
$fields_array = [];
try {
$ITSM = new ITSM();
$fields_array = $ITSM->getPriorities();
} catch (\Throwable $th) {
$error = $th->getMessage();
$fields_array = [];
}
break;
case '_ITSM_types_':
$fields_array = [];
try {
$ITSM = new ITSM();
$fields_array = $ITSM->getObjectypes();
} catch (\Throwable $th) {
$error = $th->getMessage();
$fields_array = [];
}
$nothing = __('None');
$nothing_value = 0;
break;
case '_ITSM_status_':
$fields_array = [];
try {
$ITSM = new ITSM();
$fields_array = $ITSM->getStatus();
} catch (\Throwable $th) {
$error = $th->getMessage();
$fields_array = [];
}
break;
default:
// Nothing.
$mode = '';
break;
}
if ($mode === 'select') {
$ffield = html_print_select(
$fields_array,
'field'.$i.'_value',
'', '',
'', '',
__('None'), $nothing,
'', $nothing_value,
true, true,
false, false,
false, false,
'fields', 'fields',
$is_management_allowed, $management_is_not_allowed
'width: 100%;'
); );
$rfield .= html_print_select( $rfield = html_print_select(
'', $fields_array,
'field'.$i.'_recovery_value[]', 'field'.$i.'_recovery_value',
'', '',
'', '',
__('None'), $nothing,
'', $nothing_value,
true, true,
false, false,
false, false,
'fields', 'fields_recovery',
$is_management_allowed, $management_is_not_allowed || $recovery_disabled
'width: 100%;'
); );
} else {
$ffield .= html_print_input_text('field'.$i.'_value[]', '', '', 10, 10, true, false, false, '', 'datepicker'); $ffield = html_print_autocomplete_users_from_pandora_itsm(
$rfield .= html_print_input_text('field'.$i.'_recovery_value[]', '', '', 10, 10, true, false, false, '', 'datepicker'); 'field'.$i.'_value',
$ffield .= html_print_textarea(
'field'.$i.'_value[]',
5,
1,
'', '',
'style="min-height:40px; '.$style.'" class="fields"',
true, true,
'', 0,
$is_management_allowed $management_is_not_allowed,
false,
'ITSM_users'
); );
$rfield = html_print_autocomplete_users_from_pandora_itsm(
$rfield .= html_print_textarea( 'field'.$i.'_recovery_value',
'field'.$i.'_recovery_value[]',
5,
1,
'', '',
'style="min-height:40px; '.$style.'" class="fields_recovery',
true, true,
'', 0,
$is_management_allowed $management_is_not_allowed || $recovery_disabled,
false,
'ITSM_users'
); );
}
} else { } else {
$fields_value_select = []; $fields_value_select = [];
$force_print_select = false; $force_print_select = false;
@ -468,7 +722,7 @@ if (is_ajax()) {
false, false,
false, false,
'fields', 'fields',
$is_management_allowed $management_is_not_allowed
); );
$rfield = html_print_select( $rfield = html_print_select(
$fields_value_select, $fields_value_select,
@ -481,7 +735,7 @@ if (is_ajax()) {
false, false,
false, false,
'fields_recovery', 'fields_recovery',
$is_management_allowed $management_is_not_allowed || $recovery_disabled
); );
} else { } else {
$ffield = html_print_textarea( $ffield = html_print_textarea(
@ -492,7 +746,7 @@ if (is_ajax()) {
'style="'.$style.'" class="fields min-height-40px w100p"', 'style="'.$style.'" class="fields min-height-40px w100p"',
true, true,
'', '',
$is_management_allowed $management_is_not_allowed
); );
$rfield = html_print_textarea( $rfield = html_print_textarea(
'field'.$i.'_recovery_value', 'field'.$i.'_recovery_value',
@ -502,7 +756,7 @@ if (is_ajax()) {
'style="'.$style.'" class="fields_recovery min-height-40px w100p', 'style="'.$style.'" class="fields_recovery min-height-40px w100p',
true, true,
'', '',
$is_management_allowed $management_is_not_allowed || $recovery_disabled
); );
} }
} }
@ -515,7 +769,7 @@ if (is_ajax()) {
'style="'.$style.'" class="fields min-height-40px w100p"', 'style="'.$style.'" class="fields min-height-40px w100p"',
true, true,
'', '',
$is_management_allowed $management_is_not_allowed
); );
$rfield = html_print_textarea( $rfield = html_print_textarea(
'field'.$i.'_recovery_value', 'field'.$i.'_recovery_value',
@ -525,7 +779,7 @@ if (is_ajax()) {
'style="'.$style.'" class="fields_recovery min-height-40px w100p"', 'style="'.$style.'" class="fields_recovery min-height-40px w100p"',
true, true,
'', '',
$is_management_allowed $management_is_not_allowed || $recovery_disabled
); );
} }
@ -684,9 +938,7 @@ if ($delete_command) {
$result = alerts_delete_alert_command($id); $result = alerts_delete_alert_command($id);
$auditMessage = ((bool) $result === true) $auditMessage = ((bool) $result === true) ? sprintf('Delete alert command #%s', $id) : sprintf('Fail try to delete alert command #%s', $id);
? sprintf('Delete alert command #%s', $id)
: sprintf('Fail try to delete alert command #%s', $id);
db_pandora_audit( db_pandora_audit(
AUDIT_LOG_ALERT_MANAGEMENT, AUDIT_LOG_ALERT_MANAGEMENT,
@ -775,6 +1027,12 @@ $commands = array_slice($commands, $offset, $limit);
foreach ($commands as $command) { foreach ($commands as $command) {
$data = []; $data = [];
if ((isset($config['ITSM_enabled']) === false || (bool) $config['ITSM_enabled'] === false)
&& $command['name'] === 'Pandora&#x20;ITSM&#x20;Ticket'
) {
continue;
}
$data['name'] = '<span>'; $data['name'] = '<span>';
// (IMPORTANT, DO NOT CHANGE!) only users with permissions over "All" group have access to edition of commands belonging to "All" group. // (IMPORTANT, DO NOT CHANGE!) only users with permissions over "All" group have access to edition of commands belonging to "All" group.

View File

@ -105,8 +105,8 @@ $groups_user = users_get_groups($config['id_user']);
if (!empty($groups_user)) { if (!empty($groups_user)) {
$groups = implode(',', array_keys($groups_user)); $groups = implode(',', array_keys($groups_user));
if ($config['integria_enabled'] == 0) { if ($config['ITSM_enabled'] == 0) {
$integria_command = 'Integria&#x20;IMS&#x20;Ticket'; $integria_command = 'Pandora&#x20;ITSM&#x20;Ticket';
$sql = sprintf('SELECT taa.id, taa.name FROM talert_actions taa INNER JOIN talert_commands tac ON taa.id_alert_command = tac.id WHERE tac.name <> "%s" AND taa.id_group IN (%s)', $integria_command, $groups); $sql = sprintf('SELECT taa.id, taa.name FROM talert_actions taa INNER JOIN talert_commands tac ON taa.id_alert_command = tac.id WHERE tac.name <> "%s" AND taa.id_group IN (%s)', $integria_command, $groups);
} else { } else {
$sql = "SELECT id, name FROM talert_actions WHERE id_group IN ($groups)"; $sql = "SELECT id, name FROM talert_actions WHERE id_group IN ($groups)";
@ -206,9 +206,10 @@ $table->data[2][0] = html_print_label_input_block(
if (isset($step) === false) { if (isset($step) === false) {
echo '<form id="form_alerts" class="add_alert_form max_floating_element_size" method="post">'; echo '<form id="form_alerts" class="add_alert_form max_floating_element_size" method="post">';
html_print_table($table);
} }
html_print_table($table);
if (isset($step) === false) { if (isset($step) === false) {
$output = ''; $output = '';

View File

@ -620,7 +620,21 @@ foreach ($simple_alerts as $alert) {
$main_tab = 'module'; $main_tab = 'module';
} }
$data[0] = '<a href="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab='.$main_tab.'&id_agente='.$id_agent.'">'; if ((int) agents_get_os($id_agent) === CLUSTER_OS_ID) {
$cluster = PandoraFMS\Cluster::loadFromAgentId($id_agent);
$agentAlertUrl = sprintf(
'index.php?sec=estado&sec2=operation/cluster/cluster&op=update&id=%s&page=6',
$cluster->id()
);
} else {
$agentAlertUrl = sprintf(
'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=%s&id_agente=%s',
$main_tab,
$id_agent
);
}
$data[0] = '<a href="'.$agentAlertUrl.'">';
if ($alert['disabled']) { if ($alert['disabled']) {
$data[0] .= '<span class="italic_a">'; $data[0] .= '<span class="italic_a">';
@ -811,7 +825,7 @@ foreach ($simple_alerts as $alert) {
$data[3] .= '<tr class="datos2">'; $data[3] .= '<tr class="datos2">';
$data[3] .= '<td class="w50p">'.html_print_label_input_block( $data[3] .= '<td class="w50p">'.html_print_label_input_block(
__('Agent'), __('Agent'),
ui_print_truncate_text($alias, 'agent_small', false, true, true, '[&hellip;]') ui_print_truncate_text($alias, 'agent_medium', false, true, true, '[&hellip;]')
).'</td>'; ).'</td>';
$data[3] .= '<td class="w50p">'.html_print_label_input_block( $data[3] .= '<td class="w50p">'.html_print_label_input_block(
__('Module'), __('Module'),

View File

@ -650,6 +650,11 @@ if ($id_agente) {
echo $messageAction; echo $messageAction;
include_once 'godmode/alerts/alert_list.list.php'; include_once 'godmode/alerts/alert_list.list.php';
if (isset($step) === true && $step === true) {
return;
}
$all_groups = agents_get_all_groups_agent($id_agente, $agent['id_grupo']); $all_groups = agents_get_all_groups_agent($id_agente, $agent['id_grupo']);
if (check_acl_one_of_groups($config['id_user'], $all_groups, 'LW') || check_acl_one_of_groups($config['id_user'], $all_groups, 'LM')) { if (check_acl_one_of_groups($config['id_user'], $all_groups, 'LW') || check_acl_one_of_groups($config['id_user'], $all_groups, 'LM')) {
include_once 'godmode/alerts/alert_list.builder.php'; include_once 'godmode/alerts/alert_list.builder.php';

View File

@ -11,12 +11,12 @@
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU General Public License for more details.
// Load global vars use PandoraFMS\ITSM\ITSM;
// Load global vars.
global $config; global $config;
require_once $config['homedir'].'/include/functions_alerts.php'; require_once $config['homedir'].'/include/functions_alerts.php';
require_once $config['homedir'].'/include/functions_users.php'; require_once $config['homedir'].'/include/functions_users.php';
require_once $config['homedir'].'/include/functions_integriaims.php';
enterprise_include_once('meta/include/functions_alerts_meta.php'); enterprise_include_once('meta/include/functions_alerts_meta.php');
check_login(); check_login();
@ -39,11 +39,19 @@ if (is_ajax()) {
$get_integria_ticket_custom_types = (bool) get_parameter('get_integria_ticket_custom_types'); $get_integria_ticket_custom_types = (bool) get_parameter('get_integria_ticket_custom_types');
if ($get_integria_ticket_custom_types) { if ($get_integria_ticket_custom_types) {
$ticket_type_id = get_parameter('ticket_type_id'); $ticket_type_id = (int) get_parameter('ticket_type_id', 0);
if (empty($ticket_type_id) === false) {
$error = '';
try {
$ITSM = new ITSM();
$fields = $ITSM->getObjecTypesFields($ticket_type_id);
} catch (\Throwable $th) {
$error = $th->getMessage();
}
$api_call = integria_api_call(null, null, null, null, 'get_incident_fields', $ticket_type_id, false, 'json'); echo json_encode($fields);
}
echo $api_call;
return; return;
} }
} }
@ -150,6 +158,22 @@ if ($id) {
$action = alerts_get_alert_action($id); $action = alerts_get_alert_action($id);
$name = $action['name']; $name = $action['name'];
$id_command = $action['id_alert_command']; $id_command = $action['id_alert_command'];
$command = alerts_get_alert_command($id_command);
if (empty($command) === false && $command['name'] === io_safe_input('Pandora ITSM Ticket')) {
$action['field1'] = io_safe_output(($action['field1'] ?? $config['incident_title']));
$action['field2'] = io_safe_output(($action['field2'] ?? $config['default_group']));
$action['field3'] = io_safe_output(($action['field3'] ?? $config['default_criticity']));
$action['field4'] = io_safe_output(($action['field4'] ?? $config['default_owner']));
$action['field5'] = io_safe_output(($action['field5'] ?? $config['incident_type']));
$action['field6'] = io_safe_output(($action['field6'] ?? $config['incident_status']));
$action['field7'] = io_safe_output(($action['field7'] ?? $config['incident_content']));
$action['field2_recovery'] = io_safe_output(($action['field2'] ?? $config['default_group']));
$action['field3_recovery'] = io_safe_output(($action['field3'] ?? $config['default_criticity']));
$action['field4_recovery'] = io_safe_output(($action['field4'] ?? $config['default_owner']));
$action['field5_recovery'] = io_safe_output(($action['field5'] ?? $config['incident_type']));
$action['field6_recovery'] = io_safe_output(($action['field6_recovery'] ?? $config['incident_status']));
$action['field7_recovery'] = io_safe_output(($action['field7_recovery'] ?? $config['incident_content']));
}
$group = $action['id_group']; $group = $action['id_group'];
$action_threshold = $action['action_threshold']; $action_threshold = $action['action_threshold'];
@ -235,11 +259,11 @@ $table->data[0][1] = html_print_label_input_block(
) )
); );
$create_ticket_command_id = db_get_value('id', 'talert_commands', 'name', io_safe_input('Integria IMS Ticket')); $create_ticket_command_id = db_get_value('id', 'talert_commands', 'name', io_safe_input('Pandora ITSM Ticket'));
$sql_exclude_command_id = ''; $sql_exclude_command_id = '';
if (!is_metaconsole() && $config['integria_enabled'] == 0 && $create_ticket_command_id !== false) { if (!is_metaconsole() && $config['ITSM_enabled'] == 0 && $create_ticket_command_id !== false) {
$sql_exclude_command_id = ' AND id <> '.$create_ticket_command_id; $sql_exclude_command_id = ' AND id <> '.$create_ticket_command_id;
} }
@ -355,24 +379,26 @@ $table_macros->data[1][2] = html_print_label_input_block(
) )
); );
// Selector will work only with Integria activated. if (empty($command) === false && $command['name'] === io_safe_input('Pandora ITSM Ticket')) {
$integriaIdName = 'integria_wu'; // Selector will work only with Integria activated.
$table_macros->colspan[$integriaIdName][0] = 3; $integriaIdName = 'integria_wu';
$table_macros->data[$integriaIdName][0] = html_print_label_input_block( $table_macros->colspan[$integriaIdName][0] = 3;
__('Create workunit on recovery').ui_print_help_tip( $table_macros->data[$integriaIdName][0] = html_print_label_input_block(
__('If closed status is set on recovery, a workunit will be added to the ticket in Integria IMS rather that closing the ticket.'), __('Create workunit on recovery').ui_print_help_tip(
true __('If closed status is set on recovery, a workunit will be added to the ticket in Pandora ITSM rather that closing the ticket.'),
), true
html_print_checkbox_switch_extended( ),
'create_wu_integria', html_print_checkbox_switch_extended(
1, 'create_wu_integria',
$create_wu_integria, 1,
false, $create_wu_integria,
'', false,
$disabled_attr, '',
true $disabled_attr,
) true
); )
);
}
for ($i = 1; $i <= $config['max_macro_fields']; $i++) { for ($i = 1; $i <= $config['max_macro_fields']; $i++) {
$table_macros->data['field'.$i][0] = html_print_image( $table_macros->data['field'.$i][0] = html_print_image(
@ -458,6 +484,7 @@ echo '</form>';
ui_require_javascript_file('pandora_alerts'); ui_require_javascript_file('pandora_alerts');
ui_require_javascript_file('tinymce', 'vendor/tinymce/tinymce/'); ui_require_javascript_file('tinymce', 'vendor/tinymce/tinymce/');
ui_require_javascript_file('alert');
?> ?>
<script type="text/javascript"> <script type="text/javascript">
@ -474,185 +501,25 @@ $(document).ready (function () {
render_command_description(command_description); render_command_description(command_description);
} }
function ajax_get_integria_custom_fields(ticket_type_id, values, recovery_values) {
var values = values || [];
var recovery_values = recovery_values || [];
var max_macro_fields = <?php echo $config['max_macro_fields']; ?>;
if (ticket_type_id === null || ticket_type_id === '' || (Array.isArray(values) && values.length === 0 && Array.isArray(recovery_values) && recovery_values.length === 0)) {
for (var i=8; i <= max_macro_fields; i++) {
$('[name=field'+i+'_value\\[\\]').val('');
$('[name=field'+i+'_recovery_value\\[\\]').val('');
}
}
// On ticket type change, hide all table rows and inputs corresponding to custom fields, regardless of what its type is.
for (var i=8; i <= max_macro_fields; i++) {
$('[name=field'+i+'_value\\[\\]').hide();
$('[name=field'+i+'_recovery_value\\[\\]').hide();
$('#table_macros-field'+i).hide();
$('[name=field'+i+'_value_container').hide();
$('[name=field'+i+'_recovery_value_container').hide();
}
jQuery.post(
"ajax.php",
{
page: "godmode/alerts/configure_alert_action",
get_integria_ticket_custom_types: 1,
ticket_type_id: ticket_type_id
},
function(data) {
var max_macro_fields = <?php echo $config['max_macro_fields']; ?>;
data.forEach(function(custom_field, key) {
var custom_field_key = key+8; // Custom fields start from field 8.
if (custom_field_key > max_macro_fields) {
return;
}
// Display field row for current input.
var custom_field_row = $('#table_macros-field'+custom_field_key);
custom_field_row.show();
// Replace label text of field row for current input.
var label_html = $('#table_macros-field'+custom_field_key+' td').first().html();
var label_name = label_html.split('<br>')[0];
var new_html_content = custom_field_row.html().replace(label_name, custom_field.label);
custom_field_row.html(new_html_content);
switch (custom_field.type) {
case 'checkbox':
var checkbox_selector = $('input:not(.datepicker)[name=field'+custom_field_key+'_value\\[\\]]');
var checkbox_recovery_selector = $('input:not(.datepicker)[name=field'+custom_field_key+'_recovery_value\\[\\]]');
checkbox_selector.on('change', function() {
if (checkbox_selector.prop('checked')) {
checkbox_selector.attr('value', "1");
} else {
checkbox_selector.attr('value', "0");
}
});
checkbox_recovery_selector.on('change', function() {
if (checkbox_recovery_selector.prop('checked')) {
checkbox_recovery_selector.attr('value', "1");
} else {
checkbox_recovery_selector.attr('value', "0");
}
});
if (typeof values[key] !== "undefined") {
if (values[key] == 1) {
checkbox_selector.prop('checked', true);
checkbox_selector.attr('value', "1");
} else {
checkbox_selector.prop('checked', false);
checkbox_selector.attr('value', "0");
}
}
if (typeof recovery_values[key] !== "undefined") {
if (recovery_values[key] == 1) {
checkbox_recovery_selector.prop('checked', true);
checkbox_recovery_selector.attr('value', "1");
} else {
checkbox_recovery_selector.prop('checked', false);
checkbox_recovery_selector.attr('value', "0");
}
}
$('[name=field'+custom_field_key+'_value_container]').show();
$('[name=field'+custom_field_key+'_recovery_value_container]').show();
$('input:not(.datepicker)[name=field'+custom_field_key+'_value\\[\\]]').show();
$('input:not(.datepicker)[name=field'+custom_field_key+'_recovery_value\\[\\]]').show();
break;
case 'combo':
var combo_input = $('select[name=field'+custom_field_key+'_value\\[\\]]');
var combo_input_recovery = $('select[name=field'+custom_field_key+'_recovery_value\\[\\]]');
combo_input.find('option').remove();
combo_input_recovery.find('option').remove();
var combo_values_array = custom_field.combo_value.split(',');
combo_values_array.forEach(function(value) {
combo_input.append($('<option>', {
value: value,
text: value
}));
combo_input_recovery.append($('<option>', {
value: value,
text: value
}));
});
if (typeof values[key] !== "undefined") {
combo_input.val(values[key]);
}
if (typeof recovery_values[key] !== "undefined") {
combo_input_recovery.val(recovery_values[key]);
}
combo_input.show();
combo_input_recovery.show();
break;
case 'date':
$('input.datepicker[type="text"][name=field'+custom_field_key+'_value\\[\\]]').removeClass("hasDatepicker");
$('input.datepicker[type="text"][name=field'+custom_field_key+'_recovery_value\\[\\]]').removeClass("hasDatepicker");
$('input.datepicker[type="text"][name=field'+custom_field_key+'_value\\[\\]]').datepicker("destroy");
$('input.datepicker[type="text"][name=field'+custom_field_key+'_recovery_value\\[\\]]').datepicker("destroy");
$('input.datepicker[type="text"][name=field'+custom_field_key+'_value\\[\\]]').show();
$('input.datepicker[type="text"][name=field'+custom_field_key+'_recovery_value\\[\\]]').show();
$('input.datepicker[type="text"][name=field'+custom_field_key+'_value\\[\\]]').datepicker({dateFormat: "<?php echo DATE_FORMAT_JS; ?>"});
$('input.datepicker[type="text"][name=field'+custom_field_key+'_recovery_value\\[\\]]').datepicker({dateFormat: "<?php echo DATE_FORMAT_JS; ?>"});
$.datepicker.setDefaults($.datepicker.regional[ "<?php echo get_user_language(); ?>"]);
if (typeof values[key] !== "undefined") {
$('input.datepicker[type="text"][name=field'+custom_field_key+'_value\\[\\]]').val(values[key]);
}
if (typeof recovery_values[key] !== "undefined") {
$('input.datepicker[type="text"][name=field'+custom_field_key+'_recovery_value\\[\\]]').val(recovery_values[key]);
}
break;
case 'text':
case 'textarea':
case 'numeric':
if (typeof values[key] !== "undefined") {
$('textarea[name=field'+custom_field_key+'_value\\[\\]]').val(values[key]);
}
if (typeof recovery_values[key] !== "undefined") {
$('textarea[name=field'+custom_field_key+'_recovery_value\\[\\]]').val(recovery_values[key]);
}
$('textarea[name=field'+custom_field_key+'_value\\[\\]]').show();
$('textarea[name=field'+custom_field_key+'_recovery_value\\[\\]]').show();
break;
}
});
},
"json"
);
}
$("#id_command").change (function () { $("#id_command").change (function () {
values = Array (); values = Array ();
// No se envia el valor del commando. // No se envia el valor del commando.
values.push({ values.push({
name: "page", name: "page",
value: "godmode/alerts/alert_commands"}); value: "godmode/alerts/alert_commands"
});
values.push({ values.push({
name: "get_alert_command", name: "get_alert_command",
value: "1"}); value: "1"
});
values.push({ values.push({
name: "id", name: "id",
value: this.value}); value: this.value
});
values.push({
name: "id_action",
value: "<?php echo (int) $id; ?>"
});
jQuery.post (<?php echo "'".ui_get_full_url('ajax.php', false, false, false)."'"; ?>, jQuery.post (<?php echo "'".ui_get_full_url('ajax.php', false, false, false)."'"; ?>,
values, values,
@ -664,14 +531,6 @@ $(document).ready (function () {
render_command_description(command_description); render_command_description(command_description);
} else { } else {
render_command_description(''); render_command_description('');
}
// Allow create workunit if Integria IMS Ticket is selected.
if (data['id'] == '14') {
$("#table_macros-"+integriaWorkUnitName).css('display', 'table-row');
} else {
$("#table_macros-"+integriaWorkUnitName).css('display', 'none');
} }
var max_fields = parseInt('<?php echo $config['max_macro_fields']; ?>'); var max_fields = parseInt('<?php echo $config['max_macro_fields']; ?>');
@ -699,13 +558,74 @@ $(document).ready (function () {
old_value = ''; old_value = '';
old_recovery_value = ''; old_recovery_value = '';
// Only keep the value if is provided from hidden (first time) // Only keep the value if is provided from hidden (first time)
if (($("[name=field" + i + "_value]").attr('id')) if (($("[name=field" + i + "_value]").attr('id')) == ("hidden-field" + i + "_value")) {
== ("hidden-field" + i + "_value")) {
old_value = $("[name=field" + i + "_value]").val(); old_value = $("[name=field" + i + "_value]").val();
disabled = $("[name=field" + i + "_value]").attr('disabled'); disabled = $("[name=field" + i + "_value]").attr('disabled');
} }
if ($("#id_command option:selected").text() === "Pandora ITSM Ticket" && (!old_value || !old_recovery_value) ) {
if (i === 1) {
if(!old_value) {
old_value = '<?php echo io_safe_output($config['incident_title']); ?>';
}
if(!old_recovery_value) {
old_recovery_value = '<?php echo io_safe_output($config['incident_title']); ?>';
}
} else if (i === 2) {
if(!old_value || old_value == 0) {
old_value = '<?php echo io_safe_output($config['default_group']); ?>';
}
if(!old_recovery_value) {
old_recovery_value = '<?php echo io_safe_output($config['default_group']); ?>';
}
} else if (i === 3) {
if(!old_value) {
old_value = '<?php echo io_safe_output($config['default_criticity']); ?>';
}
if(!old_recovery_value) {
old_recovery_value = '<?php echo io_safe_output($config['default_criticity']); ?>';
}
} else if (i === 4) {
if(!old_value) {
old_value = '<?php echo io_safe_output($config['default_owner']); ?>';
}
if(!old_recovery_value) {
old_recovery_value = '<?php echo io_safe_output($config['default_owner']); ?>';
}
} else if (i === 5) {
if(!old_value) {
old_value = '<?php echo io_safe_output($config['incident_type']); ?>';
}
if(!old_recovery_value) {
old_recovery_value = '<?php echo io_safe_output($config['incident_type']); ?>';
}
} else if (i === 6) {
if(!old_value) {
old_value = '<?php echo io_safe_output($config['incident_status']); ?>';
}
if(!old_recovery_value) {
old_recovery_value = '<?php echo io_safe_output($config['incident_status']); ?>';
}
} else if (i === 7) {
var text = '<?php echo $config['incident_content']; ?>';
if(!old_value) {
old_value = text;
}
if(!old_recovery_value) {
old_recovery_value = text;
}
}
}
if (($("[name=field" + i + "_recovery_value]").attr('id')) if (($("[name=field" + i + "_recovery_value]").attr('id'))
== ("hidden-field" + i + "_recovery_value")) { == ("hidden-field" + i + "_recovery_value")) {
@ -742,17 +662,20 @@ $(document).ready (function () {
} }
else { else {
var is_element_select = $("[name=field" + i + "_value]").is("select"); var is_element_select = $("[name=field" + i + "_value]").is("select");
var is_element_autocomplete_users_itsm = $("[name=field" + i + "_value]").hasClass("ITSM_users");
$("[name=field" + i + "_value]").val(old_value); $("[name=field" + i + "_value]").val(old_value);
if (is_element_select === true) { if (is_element_select === true) {
$("[name=field" + i + "_value]").trigger('change'); $("[name=field" + i + "_value]").trigger('change');
} else if (is_element_autocomplete_users_itsm === true) {
$("[name=field" + i + "_value_hidden]").val(old_value);
} }
$("[name=field" + i + "_recovery_value]").val(old_recovery_value); $("[name=field" + i + "_recovery_value]").val(old_recovery_value);
if (is_element_select === true) { if (is_element_select === true) {
$("[name=field" + i + "_recovery_value]").trigger('change'); $("[name=field" + i + "_recovery_value]").trigger('change');
} else if (is_element_autocomplete_users_itsm === true) {
$("[name=field" + i + "_recovery_value_hidden]").val(old_recovery_value);
} }
} }
} }
@ -767,7 +690,7 @@ $(document).ready (function () {
} }
} }
if ($("#id_command option:selected").text() === "Integria IMS Ticket" && i > 7) { if ($("#id_command option:selected").text() === "Pandora ITSM Ticket" && i > 7) {
integria_custom_fields_values.push(old_value); integria_custom_fields_values.push(old_value);
integria_custom_fields_rvalues.push(old_recovery_value); integria_custom_fields_rvalues.push(old_recovery_value);
} }
@ -789,9 +712,9 @@ $(document).ready (function () {
$table_macros_field.show(); $table_macros_field.show();
} }
// Ad-hoc solution for Integria IMS command: get Integia IMS Ticket custom fields only when this command is selected and we selected a ticket type to retrieve fields from. // Ad-hoc solution for Pandora ITSM command: get Integia IMS Ticket custom fields only when this command is selected and we selected a ticket type to retrieve fields from.
// Check command by name since it is unvariable in any case, unlike its ID. // Check command by name since it is unvariable in any case, unlike its ID.
if ($("#id_command option:selected").text() === "Integria IMS Ticket") { if ($("#id_command option:selected").text() === "Pandora ITSM Ticket") {
var max_macro_fields = <?php echo $config['max_macro_fields']; ?>; var max_macro_fields = <?php echo $config['max_macro_fields']; ?>;
// At start hide all rows and inputs corresponding to custom fields, regardless of what its type is. // At start hide all rows and inputs corresponding to custom fields, regardless of what its type is.
@ -804,12 +727,22 @@ $(document).ready (function () {
} }
if ($('#field5_value').val() !== '') { if ($('#field5_value').val() !== '') {
ajax_get_integria_custom_fields($('#field5_value').val(), integria_custom_fields_values, integria_custom_fields_rvalues); ajax_get_integria_custom_fields(
$('#field5_value').val(),
integria_custom_fields_values,
integria_custom_fields_rvalues,
max_macro_fields
);
$('#field5_value').trigger('change'); $('#field5_value').trigger('change');
} }
$('#field5_value').on('change', function() { $('#field5_value').on('change', function() {
ajax_get_integria_custom_fields($(this).val()); ajax_get_integria_custom_fields(
$(this).val(),
[],
[],
max_macro_fields
);
}); });
} }

View File

@ -374,6 +374,9 @@ function update_template($step)
$max = (float) get_parameter('max'); $max = (float) get_parameter('max');
$min = (float) get_parameter('min'); $min = (float) get_parameter('min');
$matches = (bool) get_parameter('matches_value'); $matches = (bool) get_parameter('matches_value');
$math_function = (string) get_parameter('math_function');
$condition = (string) get_parameter('condition');
$time_window = (string) get_parameter('time_window');
$default_action = (int) get_parameter('default_action'); $default_action = (int) get_parameter('default_action');
if (empty($default_action) === true) { if (empty($default_action) === true) {
@ -394,6 +397,9 @@ function update_template($step)
'min_value' => $min, 'min_value' => $min,
'matches_value' => $matches, 'matches_value' => $matches,
'disable_event' => $disable_event, 'disable_event' => $disable_event,
'math_function' => $math_function,
'condition' => $condition,
'time_window' => $time_window,
]; ];
$result = alerts_update_alert_template($id, $values); $result = alerts_update_alert_template($id, $values);
@ -607,6 +613,9 @@ if ($id && ! $create_template) {
$max = $template['max_value']; $max = $template['max_value'];
$min = $template['min_value']; $min = $template['min_value'];
$matches = $template['matches_value']; $matches = $template['matches_value'];
$math_function = $template['math_function'];
$condition = $template['condition'];
$time_window = $template['time_window'];
$schedule = json_encode( $schedule = json_encode(
$default_events_calendar $default_events_calendar
@ -856,6 +865,58 @@ if ($step == 2) {
).'</span>' ).'</span>'
); );
$table->data['math_function'][0] = html_print_label_input_block(
__('Math function'),
html_print_select(
alerts_get_alert_templates_functions(),
'math_function',
$math_function,
'',
__('None'),
0,
true,
false,
false,
'w100p',
(!$is_management_allowed | $disabled)
)
);
$table->data['time_window'][0] = html_print_label_input_block(
__('Time window').ui_print_help_tip(__('Limits to data in the following time window.'), true),
html_print_select(
alerts_get_alert_templates_windows(),
'time_window',
$time_window,
'',
__('None'),
0,
true,
false,
false,
'w100p',
(!$is_management_allowed | $disabled)
)
);
$table->data['condition'][0] = html_print_label_input_block(
__('Alert condition'),
html_print_select(
alerts_get_alert_templates_conditions(),
'condition',
$condition,
'',
__('None'),
0,
true,
false,
false,
'w100p',
(!$is_management_allowed | $disabled)
)
);
$table->data['value'][1] = html_print_label_input_block( $table->data['value'][1] = html_print_label_input_block(
__('Value'), __('Value'),
html_print_input_text( html_print_input_text(
@ -1088,6 +1149,12 @@ if ($step == 2) {
$table->rowstyle['min'] = ''; $table->rowstyle['min'] = '';
break; break;
case 'complex':
$table->rowstyle['math_function'] = '';
$table->rowstyle['condition'] = '';
$table->rowstyle['time_window'] = '';
break;
case 'onchange': case 'onchange':
$show_matches = true; $show_matches = true;
break; break;
@ -1299,6 +1366,7 @@ var onchange_not = <?php echo '"'.__('The alert would fire when the module value
var unknown = <?php echo "'".__('The alert would fire when the module is in unknown status')."'"; ?>; var unknown = <?php echo "'".__('The alert would fire when the module is in unknown status')."'"; ?>;
var error_message_min_max_zero = <?php echo "'".__('The alert template cannot have the same value for min and max thresholds.')."'"; ?>; var error_message_min_max_zero = <?php echo "'".__('The alert template cannot have the same value for min and max thresholds.')."'"; ?>;
var not_normal = <?php echo "'".__('The alert would fire when the module is in not normal status')."'"; ?>; var not_normal = <?php echo "'".__('The alert would fire when the module is in not normal status')."'"; ?>;
var complex = <?php echo "'".__('Alert would fire when the <span id="math_function"></span> within <span id="time_window"></span> <span id="condition"></span> <span id="value"></span>')."'"; ?>;
function check_fields_step2() { function check_fields_step2() {
var correct = true; var correct = true;
@ -1361,6 +1429,68 @@ function render_example () {
else { else {
$("span#value").empty ().append (vvalue); $("span#value").empty ().append (vvalue);
} }
/* Set math function */
var vfunction = $("select#math_function").val();
var functionMessage = "";
if (vfunction == "0") {
functionMessage = "<em><?php echo __('[function]'); ?></em>";
} else {
if (vfunction == "avg"){
$("span#value").empty ();
}
functionMessage = vfunction;
}
$("span#math_function").empty ().append (functionMessage);
/* Set complex value */
if($("select#type").val() == "complex"){
var valueMessage = "";
if(vfunction == "avg"){
valueMessage = "";
}else if (vvalue == "") {
valueMessage = "<em><?php echo __('[value]'); ?></em>" ;
} else {
valueMessage = vvalue;
}
$("span#value").empty ().append (valueMessage);
}
/* Set condition */
var vCondition = $("select#condition").val();
var conditionMessage = "<em><?php echo __('[condition]'); ?></em>" ;
switch (vCondition){
case "greater":
conditionMessage = (vfunction == "avg") ? "increases" : "is more than";
break
case "lower":
conditionMessage = (vfunction == "avg") ? "decreases" : "is less than";
break
case "equal":
conditionMessage = (vfunction == "avg") ? "remains the same" : "is equal to";
break
}
$("span#condition").empty ().append (conditionMessage);
var vWindow = $("select#time_window").val();
/* Set time window */
var timeWindowMessages = {
"thirty_days": "the last 30 days",
"month": "the last month",
"seven_days": "the last 7 days",
"week": "the last week",
"one_day": "the last 24 hours",
"today": "today"
};
var windowMessage = timeWindowMessages[vWindow] || "<em><?php echo __(' the last [window]'); ?></em>";
$("span#time_window").empty().append(windowMessage);
} }
// Fix for metaconsole toggle // Fix for metaconsole toggle
@ -1388,6 +1518,18 @@ if ($step == 2) {
$("input#text-value").keyup (render_example); $("input#text-value").keyup (render_example);
$("input#text-max").keyup (render_example); $("input#text-max").keyup (render_example);
$("input#text-min").keyup (render_example); $("input#text-min").keyup (render_example);
$("#condition").change (render_example);
$("#time_window").change (render_example);
$("#math_function").change (function () {
if (["0", 'avg'].includes(this.value)) {
$("#template-value").hide();
} else {
$("#template-value").show ();
}
render_example ();
})
$("#type").change (function () { $("#type").change (function () {
switch (this.value) { switch (this.value) {
@ -1395,6 +1537,7 @@ if ($step == 2) {
case "not_equal": case "not_equal":
$("img#regex_good, img#regex_bad, span#matches_value").hide (); $("img#regex_good, img#regex_bad, span#matches_value").hide ();
$("#template-max, #template-min").hide (); $("#template-max, #template-min").hide ();
$("#template-math_function, #template-condition, #template-time_window").hide ();
$("#template-value, #template-example").show (); $("#template-value, #template-example").show ();
/* Show example */ /* Show example */
@ -1405,6 +1548,7 @@ if ($step == 2) {
break; break;
case "regex": case "regex":
$("#template-max, #template-min").hide (); $("#template-max, #template-min").hide ();
$("#template-math_function, #template-condition, #template-time_window").hide ();
$("#template-value, #template-example, span#matches_value").show (); $("#template-value, #template-example, span#matches_value").show ();
check_regex (); check_regex ();
@ -1416,6 +1560,7 @@ if ($step == 2) {
break; break;
case "max_min": case "max_min":
$("#template-value").hide (); $("#template-value").hide ();
$("#template-math_function, #template-condition, #template-time_window").hide ();
$("#template-max, #template-min, #template-example, span#matches_value").show (); $("#template-max, #template-min, #template-example, span#matches_value").show ();
/* Show example */ /* Show example */
@ -1424,9 +1569,25 @@ if ($step == 2) {
else else
$("span#example").empty ().append (between_not); $("span#example").empty ().append (between_not);
break;
case "complex":
$("pan#matches_value, #template-example, #template-value, #template-max, #template-min").hide ();
$("#template-math_function, #template-condition, #template-time_window").show ();
$("#template-example").show ();
if (["0", 'avg'].includes($("#math_function").val())) {
$("#template-value").hide();
}else {
$("#template-value").show();
}
/* Show example */
$("span#example").empty ().append (complex);
break; break;
case "max": case "max":
$("#template-value, #template-min, span#matches_value").hide (); $("#template-value, #template-min, span#matches_value").hide ();
$("#template-math_function, #template-condition, #template-time_window").hide ();
$("#template-max, #template-example").show (); $("#template-max, #template-example").show ();
/* Show example */ /* Show example */
@ -1434,6 +1595,7 @@ if ($step == 2) {
break; break;
case "min": case "min":
$("#template-value, #template-max, span#matches_value").hide (); $("#template-value, #template-max, span#matches_value").hide ();
$("#template-math_function, #template-condition, #template-time_window").hide ();
$("#template-min, #template-example").show (); $("#template-min, #template-example").show ();
/* Show example */ /* Show example */
@ -1441,6 +1603,7 @@ if ($step == 2) {
break; break;
case "warning": case "warning":
$("#template-value, #template-max, span#matches_value, #template-min").hide (); $("#template-value, #template-max, span#matches_value, #template-min").hide ();
$("#template-math_function, #template-condition, #template-time_window").hide ();
$("#template-example").show (); $("#template-example").show ();
/* Show example */ /* Show example */
@ -1448,6 +1611,7 @@ if ($step == 2) {
break; break;
case "critical": case "critical":
$("#template-value, #template-max, span#matches_value, #template-min").hide (); $("#template-value, #template-max, span#matches_value, #template-min").hide ();
$("#template-math_function, #template-condition, #template-time_window").hide ();
$("#template-example").show (); $("#template-example").show ();
/* Show example */ /* Show example */
@ -1455,6 +1619,7 @@ if ($step == 2) {
break; break;
case "not_normal": case "not_normal":
$("#template-value, #template-max, span#matches_value, #template-min").hide (); $("#template-value, #template-max, span#matches_value, #template-min").hide ();
$("#template-math_function, #template-condition, #template-time_window").hide ();
$("#template-example").show (); $("#template-example").show ();
/* Show example */ /* Show example */
@ -1462,6 +1627,7 @@ if ($step == 2) {
break; break;
case "onchange": case "onchange":
$("#template-value, #template-max, #template-min").hide (); $("#template-value, #template-max, #template-min").hide ();
$("#template-math_function, #template-condition, #template-time_window").hide ();
$("#template-example, span#matches_value").show (); $("#template-example, span#matches_value").show ();
/* Show example */ /* Show example */
@ -1472,6 +1638,7 @@ if ($step == 2) {
break; break;
case "unknown": case "unknown":
$("#template-value, #template-max, span#matches_value, #template-min").hide (); $("#template-value, #template-max, span#matches_value, #template-min").hide ();
$("#template-math_function, #template-condition, #template-time_window").hide ();
$("#template-example").show (); $("#template-example").show ();
if ($("#text-min_alerts").val() > 0 ) { if ($("#text-min_alerts").val() > 0 ) {
@ -1483,6 +1650,7 @@ if ($step == 2) {
break; break;
default: default:
$("#template-value, #template-max, #template-min, #template-example, span#matches_value").hide (); $("#template-value, #template-max, #template-min, #template-example, span#matches_value").hide ();
$("#template-math_function, #template-condition, #template-time_window").hide ();
break; break;
} }

View File

@ -61,6 +61,9 @@ if ($id) {
$filter = events_get_event_filter($id); $filter = events_get_event_filter($id);
$id_group_filter = $filter['id_group_filter']; $id_group_filter = $filter['id_group_filter'];
$id_group = $filter['id_group']; $id_group = $filter['id_group'];
// Get owner user private filter.
$private_filter = ($filter['private_filter_user'] === null || $filter['private_filter_user'] === '') ? 0 : 1;
$private_filter_user = $filter['private_filter_user'];
$id_name = $filter['id_name']; $id_name = $filter['id_name'];
$event_type = $filter['event_type']; $event_type = $filter['event_type'];
$severity = explode(',', $filter['severity']); $severity = explode(',', $filter['severity']);
@ -113,6 +116,7 @@ if ($id) {
$server_id = ($filter['server_id'] ?? ''); $server_id = ($filter['server_id'] ?? '');
} else { } else {
$id_group = ''; $id_group = '';
$private_filter = 0;
$id_group_filter = ''; $id_group_filter = '';
$id_name = ''; $id_name = '';
$event_type = ''; $event_type = '';
@ -167,8 +171,8 @@ if ($update || $create) {
$id_user_ack = get_parameter('id_user_ack', ''); $id_user_ack = get_parameter('id_user_ack', '');
$owner_user = get_parameter('owner_user', ''); $owner_user = get_parameter('owner_user', '');
$group_rep = get_parameter('group_rep', ''); $group_rep = get_parameter('group_rep', '');
$date_from = get_parameter('date_from', ''); $date_from = get_parameter('date_from', '0000-00-00');
$date_to = get_parameter('date_to', ''); $date_to = get_parameter('date_to', '0000-00-00');
$source = get_parameter('source'); $source = get_parameter('source');
$id_extra = get_parameter('id_extra'); $id_extra = get_parameter('id_extra');
$user_comment = get_parameter('user_comment'); $user_comment = get_parameter('user_comment');
@ -192,6 +196,16 @@ if ($update || $create) {
$server_id = implode(',', $servers_array); $server_id = implode(',', $servers_array);
} }
// Get private filter from user.
$private_filter = get_parameter_switch('private_filter_event', 0);
if ((int) $private_filter === 1 && $create) {
$private_filter_user = $_SESSION['id_usuario'];
} else if ((int) $private_filter === 1 && $update) {
$private_filter_user = ($private_filter_user === $_SESSION['id_usuario']) ? $private_filter_user : $_SESSION['id_usuario'];
} else if ((int) $private_filter === 0) {
$private_filter_user = null;
}
$values = [ $values = [
'id_name' => $id_name, 'id_name' => $id_name,
'id_group_filter' => $id_group_filter, 'id_group_filter' => $id_group_filter,
@ -222,6 +236,7 @@ if ($update || $create) {
'custom_data' => $custom_data, 'custom_data' => $custom_data,
'custom_data_filter_type' => $custom_data_filter_type, 'custom_data_filter_type' => $custom_data_filter_type,
'server_id' => $server_id, 'server_id' => $server_id,
'private_filter_user' => $private_filter_user,
]; ];
$severity = explode(',', $severity); $severity = explode(',', $severity);
@ -293,6 +308,17 @@ $table->data[0][0] = html_print_label_input_block(
false, false,
'', '',
'w100p' 'w100p'
).html_print_label_input_block(
__('Private'),
html_print_checkbox_switch(
'private_filter_event',
$private_filter,
$private_filter,
true,
false,
'checked_slide_events(this);',
true
)
) )
); );

View File

@ -133,6 +133,18 @@ $filters = db_get_all_rows_sql($sql);
if ($filters === false) { if ($filters === false) {
$filters = []; $filters = [];
} else {
foreach ($filters as $key => $filter) {
$permission = users_is_admin($config['id_user']);
// Validate permission and private filter user.
if ($permission || $filter['private_filter_user'] === $config['id_user']) {
if ($filter['private_filter_user'] !== null) {
$filters[$key]['id_name'] = $filter['id_name'].' (P)';
}
} else if ($filter['private_filter_user'] !== null) {
unset($filters[$key]);
}
}
} }
$table = new stdClass(); $table = new stdClass();

View File

@ -75,6 +75,12 @@ foreach ($event_responses as $response) {
continue; continue;
} }
if ((isset($config['ITSM_enabled']) === false || (bool) $config['ITSM_enabled'] === false)
&& $response['name'] === 'Create&#x20;ticket&#x20;in&#x20;Pandora&#x20;ITSM&#x20;from&#x20;event'
) {
continue;
}
$data = []; $data = [];
$data[0] = '<a href="index.php?sec=geventos&sec2=godmode/events/events&section=responses&mode=editor&id_response='.$response['id'].'&amp;pure='.$config['pure'].'">'.$response['name'].'</a>'; $data[0] = '<a href="index.php?sec=geventos&sec2=godmode/events/events&section=responses&mode=editor&id_response='.$response['id'].'&amp;pure='.$config['pure'].'">'.$response['name'].'</a>';
$data[1] = $response['description']; $data[1] = $response['description'];

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