Merge remote-tracking branch 'origin/develop' into ent-8222-Nueva-grafica-desde-la-vista-de-modulos-Histograma
Conflicts: pandora_console/include/styles/pandora.css
@ -1,14 +1,14 @@
|
||||
#docker build -t pandorafms/pandorafms-open-base-el8 -f $HOME/code/pandorafms/extras/docker/centos8/base/Dockerfile $HOME/code/pandorafms/extras/docker/centos8/base/
|
||||
#docker push pandorafms/pandorafms-open-base-el8
|
||||
|
||||
FROM centos:8
|
||||
FROM rockylinux:8
|
||||
|
||||
RUN dnf install -y --setopt=tsflags=nodocs \
|
||||
epel-release \
|
||||
dnf-utils \
|
||||
http://rpms.remirepo.net/enterprise/remi-release-8.rpm
|
||||
|
||||
RUN dnf module reset -y php && dnf module install -y php:remi-7.3
|
||||
RUN dnf module reset -y php && dnf module install -y php:remi-7.4
|
||||
RUN dnf config-manager --set-enabled powertools
|
||||
|
||||
# Install console dependencies
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.758.1, AIX version
|
||||
# Version 7.0NG.759, AIX version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.758.1, FreeBSD Version
|
||||
# Version 7.0NG.759, FreeBSD Version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.758.1, HP-UX Version
|
||||
# Version 7.0NG.759, HP-UX Version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.758.1, GNU/Linux
|
||||
# Version 7.0NG.759, GNU/Linux
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.758.1, GNU/Linux
|
||||
# Version 7.0NG.759, GNU/Linux
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.758.1, Solaris Version
|
||||
# Version 7.0NG.759, Solaris Version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
Before Width: | Height: | Size: 32 KiB |
Before Width: | Height: | Size: 82 KiB |
Before Width: | Height: | Size: 9.8 KiB |
Before Width: | Height: | Size: 29 KiB |
Before Width: | Height: | Size: 67 KiB |
Before Width: | Height: | Size: 109 KiB |
Before Width: | Height: | Size: 14 KiB |
@ -1,6 +1,6 @@
|
||||
# Base config file for Pandora FMS Windows Agent
|
||||
# (c) 2006-2021 Artica Soluciones Tecnologicas
|
||||
# Version 7.0NG.758.1
|
||||
# Version 7.0NG.759
|
||||
# This program is Free Software, you can redistribute it and/or modify it
|
||||
# under the terms of the GNU General Public Licence as published by the Free Software
|
||||
# Foundation; either version 2 of the Licence or any later version
|
||||
|
@ -1,6 +1,6 @@
|
||||
# Fichero de configuracion base de agentes de Pandora
|
||||
# Base config file for Pandora agents
|
||||
# Version 7.0NG.758.1, AIX version
|
||||
# Version 7.0NG.759, AIX version
|
||||
|
||||
# General Parameters
|
||||
# ==================
|
||||
|
@ -1,6 +1,6 @@
|
||||
# Fichero de configuracion base de agentes de Pandora
|
||||
# Base config file for Pandora agents
|
||||
# Version 7.0NG.758.1
|
||||
# Version 7.0NG.759
|
||||
# FreeBSD/IPSO version
|
||||
# Licenced under GPL licence, 2003-2007 Sancho Lerena
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
# Fichero de configuracion base de agentes de Pandora
|
||||
# Base config file for Pandora agents
|
||||
# Version 7.0NG.758.1, HPUX Version
|
||||
# Version 7.0NG.759, HPUX Version
|
||||
|
||||
# General Parameters
|
||||
# ==================
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.758.1
|
||||
# Version 7.0NG.759
|
||||
# Licensed under GPL license v2,
|
||||
# (c) 2003-2021 Artica Soluciones Tecnologicas
|
||||
# please visit http://pandora.sourceforge.net
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.758.1
|
||||
# Version 7.0NG.759
|
||||
# Licensed under GPL license v2,
|
||||
# (c) 2003-2021 Artica Soluciones Tecnologicas
|
||||
# please visit http://pandora.sourceforge.net
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.758.1
|
||||
# Version 7.0NG.759
|
||||
# Licensed under GPL license v2,
|
||||
# please visit http://pandora.sourceforge.net
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
# Fichero de configuracion base de agentes de Pandora
|
||||
# Base config file for Pandora agents
|
||||
# Version 7.0NG.758.1, Solaris version
|
||||
# Version 7.0NG.759, Solaris version
|
||||
|
||||
# General Parameters
|
||||
# ==================
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.758.1, AIX version
|
||||
# Version 7.0NG.759, AIX version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
@ -1,5 +1,5 @@
|
||||
package: pandorafms-agent-unix
|
||||
Version: 7.0NG.758.1-211214
|
||||
Version: 7.0NG.759-220118
|
||||
Architecture: all
|
||||
Priority: optional
|
||||
Section: admin
|
||||
|
@ -14,7 +14,7 @@
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
pandora_version="7.0NG.758.1-211214"
|
||||
pandora_version="7.0NG.759-220118"
|
||||
|
||||
echo "Test if you has the tools for to make the packages."
|
||||
whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null
|
||||
|
@ -31,7 +31,7 @@ fi
|
||||
if [ "$#" -ge 2 ]; then
|
||||
VERSION="$2"
|
||||
else
|
||||
VERSION="7.0NG.758.1"
|
||||
VERSION="7.0NG.759"
|
||||
fi
|
||||
|
||||
# Path for the generated DMG file
|
||||
|
@ -19,11 +19,11 @@
|
||||
<choice id="com.pandorafms.pandorafms_src" visible="false">
|
||||
<pkg-ref id="com.pandorafms.pandorafms_src"/>
|
||||
</choice>
|
||||
<pkg-ref id="com.pandorafms.pandorafms_src" version="7.0NG.758.1" onConclusion="none">pandorafms_src.pdk</pkg-ref>
|
||||
<pkg-ref id="com.pandorafms.pandorafms_src" version="7.0NG.759" onConclusion="none">pandorafms_src.pdk</pkg-ref>
|
||||
<choice id="com.pandorafms.pandorafms_uninstall" visible="true" customLocation="/Applications">
|
||||
<pkg-ref id="com.pandorafms.pandorafms_uninstall"/>
|
||||
</choice>
|
||||
<pkg-ref id="com.pandorafms.pandorafms_uninstall" version="7.0NG.758.1" onConclusion="none">pandorafms_uninstall.pdk</pkg-ref>
|
||||
<pkg-ref id="com.pandorafms.pandorafms_uninstall" version="7.0NG.759" onConclusion="none">pandorafms_uninstall.pdk</pkg-ref>
|
||||
<!-- <installation-check script="check()" />
|
||||
<script>
|
||||
<![CDATA[
|
||||
|
@ -5,9 +5,9 @@
|
||||
<key>CFBundleIconFile</key> <string>pandorafms.icns</string>
|
||||
<key>CFBundleIdentifier</key> <string>com.pandorafms.pandorafms_uninstall</string>
|
||||
|
||||
<key>CFBundleVersion</key> <string>7.0NG.758.1</string>
|
||||
<key>CFBundleGetInfoString</key> <string>7.0NG.758.1 Pandora FMS Agent uninstaller for MacOS by Artica ST on Aug 2020</string>
|
||||
<key>CFBundleShortVersionString</key> <string>7.0NG.758.1</string>
|
||||
<key>CFBundleVersion</key> <string>7.0NG.759</string>
|
||||
<key>CFBundleGetInfoString</key> <string>7.0NG.759 Pandora FMS Agent uninstaller for MacOS by Artica ST on Aug 2020</string>
|
||||
<key>CFBundleShortVersionString</key> <string>7.0NG.759</string>
|
||||
|
||||
<key>NSPrincipalClass</key><string>NSApplication</string>
|
||||
<key>NSMainNibFile</key><string>MainMenu</string>
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.758.1, GNU/Linux
|
||||
# Version 7.0NG.759, GNU/Linux
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.758.1, FreeBSD Version
|
||||
# Version 7.0NG.759, FreeBSD Version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.758.1, HP-UX Version
|
||||
# Version 7.0NG.759, HP-UX Version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.758.1, GNU/Linux
|
||||
# Version 7.0NG.759, GNU/Linux
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.758.1, GNU/Linux
|
||||
# Version 7.0NG.759, GNU/Linux
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.758.1, NetBSD Version
|
||||
# Version 7.0NG.759, NetBSD Version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.758.1, Solaris Version
|
||||
# Version 7.0NG.759, Solaris Version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
@ -1014,8 +1014,8 @@ my $Sem = undef;
|
||||
# Semaphore used to control the number of threads
|
||||
my $ThreadSem = undef;
|
||||
|
||||
use constant AGENT_VERSION => '7.0NG.758.1';
|
||||
use constant AGENT_BUILD => '211214';
|
||||
use constant AGENT_VERSION => '7.0NG.759';
|
||||
use constant AGENT_BUILD => '220118';
|
||||
|
||||
# Agent log default file size maximum and instances
|
||||
use constant DEFAULT_MAX_LOG_SIZE => 600000;
|
||||
|
@ -2,8 +2,8 @@
|
||||
#Pandora FMS Linux Agent
|
||||
#
|
||||
%define name pandorafms_agent_unix
|
||||
%define version 7.0NG.758.1
|
||||
%define release 211214
|
||||
%define version 7.0NG.759
|
||||
%define release 220118
|
||||
|
||||
Summary: Pandora FMS Linux agent, PERL version
|
||||
Name: %{name}
|
||||
|
@ -2,8 +2,8 @@
|
||||
#Pandora FMS Linux Agent
|
||||
#
|
||||
%define name pandorafms_agent_unix
|
||||
%define version 7.0NG.758.1
|
||||
%define release 211214
|
||||
%define version 7.0NG.759
|
||||
%define release 220118
|
||||
|
||||
Summary: Pandora FMS Linux agent, PERL version
|
||||
Name: %{name}
|
||||
|
@ -9,8 +9,8 @@
|
||||
# Please see http://www.pandorafms.org. This code is licensed under GPL 2.0 license.
|
||||
# **********************************************************************
|
||||
|
||||
PI_VERSION="7.0NG.758.1"
|
||||
PI_BUILD="211214"
|
||||
PI_VERSION="7.0NG.759"
|
||||
PI_BUILD="220118"
|
||||
OS_NAME=`uname -s`
|
||||
|
||||
FORCE=0
|
||||
|
@ -1,59 +0,0 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<title>Fandora FMS - Generate SSH keys step-by-step</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<meta name="resource-type" content="document" />
|
||||
<meta name="distribution" content="global" />
|
||||
<meta name="author" content="Sancho Lerena, Raul Mateos and others" />
|
||||
<meta
|
||||
name="copyright"
|
||||
content="This is GPL software. Created by Sancho Lerena and others"
|
||||
/>
|
||||
</head>
|
||||
<body>
|
||||
<center>
|
||||
<img src="images/logo.png" alt="" />
|
||||
</center>
|
||||
|
||||
<h2>Step-by-step generating SSH keys</h2>
|
||||
|
||||
From
|
||||
<a
|
||||
href="https://pandorafms.com/docs/index.php?title=Pandora:FAQ#How_to_generate_a_pair_of_SSH_keys_for_Pandora_Windows_agent.3F_.28SSH_Transfer_only.29"
|
||||
>Pandora FMS FAQ</a
|
||||
>.
|
||||
|
||||
<ol>
|
||||
<li>
|
||||
Go to <code>.\util</code> of your Pandora FMS agent for Windows and run
|
||||
<code>puttygen.exe</code>.<br />
|
||||
Generate keys, SSH-2_DSA, 1024:<br /><br />
|
||||
<img src="images/1.jpg" /><br /><br />
|
||||
</li>
|
||||
<li>
|
||||
Press Generate<br />
|
||||
Export key to OpenSSH key (Cygwin uses a port of OpenSSH)<br /><br />
|
||||
<img src="images/2.jpg" /><br /><br />
|
||||
</li>
|
||||
<li>
|
||||
We have no chosen password, so press YES:<br /><br />
|
||||
<img src="images/3.jpg" /><br /><br />
|
||||
</li>
|
||||
<li>
|
||||
Save it as <code>c:\pandora\keys\id_dsa:</code><br /><br />
|
||||
<img src="images/4.jpg" /><br /><br />
|
||||
</li>
|
||||
<li>
|
||||
Now let's copy the public key to clipboard:<br /><br />
|
||||
<img src="images/5.jpg" /><br /><br />
|
||||
</li>
|
||||
<li>
|
||||
and paste it as <code>c:\pandora_agent\keys\id_dsa.pub</code>, and also
|
||||
to the <code>/home/pandora/.ssh/authorized_keys</code> file.
|
||||
<br /><br />
|
||||
<img src="images/6.jpg" /><br /><br />
|
||||
</li>
|
||||
</ol>
|
||||
</body>
|
||||
</html>
|
@ -1,62 +0,0 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<title>
|
||||
Pandora FMS - Generación de claves SSH en Windows paso por paso
|
||||
</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<meta name="resource-type" content="document" />
|
||||
<meta name="distribution" content="global" />
|
||||
<meta name="author" content="Sancho Lerena, Raul Mateos y otros" />
|
||||
<meta
|
||||
name="copyright"
|
||||
content="This is GPL software. Created by Sancho Lerena and others"
|
||||
/>
|
||||
</head>
|
||||
<body>
|
||||
<center>
|
||||
<img src="images/logo.png" alt="" />
|
||||
</center>
|
||||
<h2 class="print">Generación de claves SSH en Windows paso por paso</h2>
|
||||
|
||||
Extraído de las
|
||||
<a
|
||||
href="https://pandorafms.com/docs/index.php?title=Pandora:FAQ_ES#.C2.BFC.C3.B3mo_puedo_generar_un_par_de_claves_SHH_para_el_agente_para_Windows_.28SSH_Transfer.29_.3F"
|
||||
>
|
||||
FAQ</a
|
||||
>.
|
||||
|
||||
<ol>
|
||||
<li>
|
||||
Desde el directorio <code>.\util</code> del agente Pandora FMS para
|
||||
windows ejecutamos <code>puttygen.exe</code>.<br />
|
||||
Generamos claves SSH-2_DSA, 1024:<br /><br />
|
||||
<img src="images/1.jpg" /><br /><br />
|
||||
</li>
|
||||
<li>
|
||||
Pulsamos «Generate» para generar la clave.<br />
|
||||
Exportamos la clave a formato OpenSSH<br /><br />
|
||||
<img src="images/2.jpg" /><br /><br />
|
||||
</li>
|
||||
<li>
|
||||
No elegimos contraseña, con lo cual pulsamos «Sí»:<br /><br />
|
||||
<img src="images/3.jpg" /><br /><br />
|
||||
</li>
|
||||
<li>
|
||||
Guardamos la clave como <code>C:\pandora\keys\id_dsa:</code><br /><br />
|
||||
<img src="images/4.jpg" /><br /><br />
|
||||
</li>
|
||||
<li>
|
||||
Ahora copiamos la clave pública al portapapeles:<br /><br />
|
||||
<img src="images/5.jpg" /><br /><br />
|
||||
</li>
|
||||
<li>
|
||||
Pegamos la clave en un nuevo fichero
|
||||
<code>C:\pandora_agent\keys\id_dsa.pub</code>, y debemos también
|
||||
añadirla al fichero <code>/home/pandora/.ssh/authorized_keys</code>.
|
||||
<br /><br />
|
||||
<img src="images/6.jpg" /><br /><br />
|
||||
</li>
|
||||
</ol>
|
||||
</body>
|
||||
</html>
|
Before Width: | Height: | Size: 32 KiB |
Before Width: | Height: | Size: 82 KiB |
Before Width: | Height: | Size: 9.8 KiB |
Before Width: | Height: | Size: 29 KiB |
Before Width: | Height: | Size: 67 KiB |
Before Width: | Height: | Size: 109 KiB |
Before Width: | Height: | Size: 14 KiB |
@ -1,6 +1,6 @@
|
||||
# Base config file for Pandora FMS Windows Agent
|
||||
# (c) 2006-2021 Artica Soluciones Tecnologicas
|
||||
# Version 7.0NG.758.1
|
||||
# Version 7.0NG.759
|
||||
# This program is Free Software, you can redistribute it and/or modify it
|
||||
# under the terms of the GNU General Public Licence as published by the Free Software
|
||||
# Foundation; either version 2 of the Licence or any later version
|
||||
|
@ -3,7 +3,7 @@ AllowLanguageSelection
|
||||
{Yes}
|
||||
|
||||
AppName
|
||||
{Pandora FMS Windows Agent v7.0NG.758.1}
|
||||
{Pandora FMS Windows Agent v7.0NG.759}
|
||||
|
||||
ApplicationID
|
||||
{17E3D2CF-CA02-406B-8A80-9D31C17BD08F}
|
||||
@ -186,7 +186,7 @@ UpgradeApplicationID
|
||||
{}
|
||||
|
||||
Version
|
||||
{211214}
|
||||
{220118}
|
||||
|
||||
ViewReadme
|
||||
{Yes}
|
||||
|
@ -30,7 +30,7 @@ using namespace Pandora;
|
||||
using namespace Pandora_Strutils;
|
||||
|
||||
#define PATH_SIZE _MAX_PATH+1
|
||||
#define PANDORA_VERSION ("7.0NG.758.1 Build 211214")
|
||||
#define PANDORA_VERSION ("7.0NG.759 Build 220118")
|
||||
|
||||
string pandora_path;
|
||||
string pandora_dir;
|
||||
|
@ -11,7 +11,7 @@ BEGIN
|
||||
VALUE "LegalCopyright", "Artica ST"
|
||||
VALUE "OriginalFilename", "PandoraAgent.exe"
|
||||
VALUE "ProductName", "Pandora FMS Windows Agent"
|
||||
VALUE "ProductVersion", "(7.0NG.758.1(Build 211214))"
|
||||
VALUE "ProductVersion", "(7.0NG.759(Build 220118))"
|
||||
VALUE "FileVersion", "1.0.0.0"
|
||||
END
|
||||
END
|
||||
|
@ -1,5 +1,5 @@
|
||||
package: pandorafms-console
|
||||
Version: 7.0NG.758.1-211214
|
||||
Version: 7.0NG.759-220118
|
||||
Architecture: all
|
||||
Priority: optional
|
||||
Section: admin
|
||||
|
@ -14,7 +14,7 @@
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
pandora_version="7.0NG.758.1-211214"
|
||||
pandora_version="7.0NG.759-220118"
|
||||
|
||||
package_pear=0
|
||||
package_pandora=1
|
||||
|
@ -114,4 +114,7 @@ enterprise/include/javascript/tooltipster.bundle.min.js
|
||||
enterprise/include/styles/tooltipster.bundle.min.css
|
||||
mobile/include/javascript/jquery.mobile-1.3.1.js
|
||||
mobile/include/style/jquery.mobile-1.3.1.css
|
||||
godmode/alerts/configure_alert_special_days.php
|
||||
godmode/alerts/configure_alert_special_days.php
|
||||
godmode/admin_access_logs.php
|
||||
enterprise/extensions/backup/main.php
|
||||
enterprise/extensions/backup.php
|
@ -11,6 +11,33 @@ ALTER TABLE `tpolicy_modules` ADD COLUMN `percentage_critical` tinyint(1) UNSIGN
|
||||
ALTER TABLE `tsync_queue` ADD COLUMN `result` TEXT;
|
||||
ALTER TABLE tagente_modulo MODIFY debug_content TEXT;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `tncm_queue` (
|
||||
`id` SERIAL,
|
||||
`id_agent` INT(10) UNSIGNED NOT NULL,
|
||||
`id_script` BIGINT(20) UNSIGNED NOT NULL,
|
||||
`utimestamp` INT UNSIGNED NOT NULL,
|
||||
`scheduled` INT UNSIGNED DEFAULT NULL,
|
||||
FOREIGN KEY (`id_agent`) REFERENCES `tagente`(`id_agente`) ON UPDATE CASCADE ON DELETE CASCADE,
|
||||
FOREIGN KEY (`id_script`) REFERENCES `tncm_script`(`id`) ON UPDATE CASCADE ON DELETE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `tncm_snippet` (
|
||||
`id` SERIAL,
|
||||
`name` TEXT,
|
||||
`content` TEXT,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `tncm_firmware` (
|
||||
`id` SERIAL,
|
||||
`name` varchar(255),
|
||||
`shortname` varchar(255) unique,
|
||||
`vendor` bigint(20) unsigned,
|
||||
`models` text,
|
||||
`path` text,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `talert_calendar` (
|
||||
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`name` varchar(100) NOT NULL default '',
|
||||
@ -36,12 +63,15 @@ CREATE TABLE IF NOT EXISTS `tipam_sites` (
|
||||
FOREIGN KEY (`parent`) REFERENCES `tipam_sites`(`id`) ON UPDATE CASCADE ON DELETE SET NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
INSERT IGNORE INTO `talert_calendar` VALUES (1, 'Default', 0, 'Default calendar');
|
||||
INSERT IGNORE INTO `tipam_network_location` (`name`) SELECT `location` FROM `tipam_network` WHERE `location` <> '';
|
||||
UPDATE `tipam_network` INNER JOIN `tipam_network_location` ON tipam_network_location.name=tipam_network.location SET tipam_network.location=tipam_network_location.id;
|
||||
|
||||
ALTER TABLE `tipam_network` MODIFY `location` int(10) unsigned NULL;
|
||||
ALTER TABLE `tipam_network` ADD FOREIGN KEY (`location`) REFERENCES `tipam_network_location`(`id`) ON DELETE CASCADE;
|
||||
ALTER TABLE `tagent_repository` ADD COLUMN `deployment_timeout` INT UNSIGNED DEFAULT 600 AFTER `path`;
|
||||
ALTER TABLE `talert_special_days` ADD COLUMN `id_calendar` int(10) unsigned NOT NULL DEFAULT 1;
|
||||
ALTER TABLE `talert_special_days` ADD COLUMN `day_code` tinyint(2) unsigned NOT NULL DEFAULT 0;
|
||||
ALTER TABLE `talert_special_days` DROP COLUMN `same_day`;
|
||||
ALTER TABLE `talert_special_days` ADD FOREIGN KEY (`id_calendar`) REFERENCES `talert_calendar`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
ALTER TABLE `tipam_network` ADD COLUMN `id_site` bigint unsigned;
|
||||
@ -50,8 +80,11 @@ ALTER TABLE `tipam_supernet` ADD COLUMN `id_site` bigint unsigned;
|
||||
ALTER TABLE `tipam_supernet` ADD CONSTRAINT FOREIGN KEY (`id_site`) REFERENCES `tipam_sites`(`id`) ON DELETE SET NULL ON UPDATE CASCADE;
|
||||
ALTER TABLE `tipam_network` ADD COLUMN `vrf` int(10) unsigned;
|
||||
ALTER TABLE `tipam_network` ADD CONSTRAINT FOREIGN KEY (`vrf`) REFERENCES `tagente`(`id_agente`) ON DELETE SET NULL ON UPDATE CASCADE;
|
||||
ALTER TABLE `tncm_agent` ADD COLUMN `cron_interval` varchar(100) default '' AFTER `execute`;
|
||||
ALTER TABLE `tncm_agent` ADD COLUMN `event_on_change` int unsigned default null AFTER `cron_interval`;
|
||||
ALTER TABLE `tncm_vendor` ADD COLUMN `icon` VARCHAR(255) DEFAULT '';
|
||||
ALTER TABLE `tevento` MODIFY COLUMN `event_type` ENUM('going_unknown','unknown','alert_fired','alert_recovered','alert_ceased','alert_manual_validation','recon_host_detected','system','error','new_agent','going_up_warning','going_up_critical','going_down_warning','going_down_normal','going_down_critical','going_up_normal', 'configuration_change', 'ncm') DEFAULT 'unknown';
|
||||
|
||||
INSERT IGNORE INTO `talert_calendar` VALUES (1, 'Default', 0, 'Default calendar');
|
||||
UPDATE `talert_special_days` set `day_code` = 1 WHERE `same_day` = 'monday';
|
||||
UPDATE `talert_special_days` set `day_code` = 2 WHERE `same_day` = 'tuesday';
|
||||
UPDATE `talert_special_days` set `day_code` = 3 WHERE `same_day` = 'wednesday';
|
||||
@ -60,8 +93,7 @@ UPDATE `talert_special_days` set `day_code` = 5 WHERE `same_day` = 'friday';
|
||||
UPDATE `talert_special_days` set `day_code` = 6 WHERE `same_day` = 'saturday';
|
||||
UPDATE `talert_special_days` set `day_code` = 7 WHERE `same_day` = 'sunday';
|
||||
|
||||
INSERT IGNORE INTO `tipam_network_location` (`name`) SELECT `location` FROM `tipam_network` WHERE `location` <> '';
|
||||
UPDATE `tipam_network` INNER JOIN `tipam_network_location` ON tipam_network_location.name=tipam_network.location SET tipam_network.location=tipam_network_location.id;
|
||||
ALTER TABLE `talert_special_days` DROP COLUMN `same_day`;
|
||||
UPDATE `tconfig` c1 JOIN (select count(*) as n FROM `tconfig` c2 WHERE (c2.`token` = "node_metaconsole" AND c2.`value` = 1) OR (c2.`token` = "centralized_management" AND c2.`value` = 1) ) v SET c1. `value` = 0 WHERE c1.token = "autocreate_remote_users" AND v.n = 2;
|
||||
|
||||
COMMIT;
|
||||
|
5
pandora_console/extras/mr/52.sql
Normal file
@ -0,0 +1,5 @@
|
||||
START TRANSACTION;
|
||||
ALTER TABLE `tpolicy_queue` MODIFY COLUMN `progress` int(10) NOT NULL default '0';
|
||||
CREATE INDEX `IDX_tservice_element` ON `tservice_element`(`id_service`,`id_agente_modulo`);
|
||||
|
||||
COMMIT;
|
@ -480,7 +480,8 @@ CREATE TABLE IF NOT EXISTS `tservice_element` (
|
||||
`id_agent` int(10) unsigned NOT NULL default 0,
|
||||
`id_service_child` int(10) unsigned NOT NULL default 0,
|
||||
`id_server_meta` int(10) unsigned NOT NULL default 0,
|
||||
PRIMARY KEY (`id`)
|
||||
PRIMARY KEY (`id`),
|
||||
INDEX `IDX_tservice_element` (`id_service`,`id_agente_modulo`)
|
||||
) ENGINE=InnoDB
|
||||
COMMENT = 'Table to define the modules and the weights of the modules that define a service'
|
||||
DEFAULT CHARSET=utf8;
|
||||
@ -578,7 +579,7 @@ CREATE TABLE IF NOT EXISTS `tpolicy_queue` (
|
||||
`id_policy` int(10) unsigned NOT NULL default '0',
|
||||
`id_agent` int(10) unsigned NOT NULL default '0',
|
||||
`operation` varchar(15) default '',
|
||||
`progress` int(10) unsigned NOT NULL default '0',
|
||||
`progress` int(10) NOT NULL default '0',
|
||||
`end_utimestamp` int(10) unsigned NOT NULL default 0,
|
||||
`priority` int(10) unsigned NOT NULL default '0',
|
||||
PRIMARY KEY (`id`)
|
||||
@ -4135,6 +4136,7 @@ UPDATE `tlanguage` SET `name` = 'Deutsch' WHERE `id_language` = 'de';
|
||||
CREATE TABLE IF NOT EXISTS `tncm_vendor` (
|
||||
`id` serial,
|
||||
`name` varchar(255) UNIQUE,
|
||||
`icon` VARCHAR(255) DEFAULT '',
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
@ -4199,6 +4201,8 @@ CREATE TABLE IF NOT EXISTS `tncm_agent` (
|
||||
`id_template` bigint(20) unsigned,
|
||||
`execute_type` int(2) UNSIGNED NOT NULL default 0,
|
||||
`execute` int(2) UNSIGNED NOT NULL default 0,
|
||||
`cron_interval` varchar(100) default '',
|
||||
`event_on_change` int unsigned default null,
|
||||
`last_error` text,
|
||||
PRIMARY KEY (`id_agent`),
|
||||
FOREIGN KEY (`id_agent`) REFERENCES `tagente`(`id_agente`) ON UPDATE CASCADE ON DELETE CASCADE,
|
||||
@ -4221,6 +4225,41 @@ CREATE TABLE IF NOT EXISTS `tncm_agent_data` (
|
||||
FOREIGN KEY (`id_agent`) REFERENCES `tagente`(`id_agente`) ON UPDATE CASCADE ON DELETE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
-- ----------------------------------------------------------------------
|
||||
-- Table `tncm_queue`
|
||||
-- ----------------------------------------------------------------------
|
||||
CREATE TABLE IF NOT EXISTS `tncm_queue` (
|
||||
`id` SERIAL,
|
||||
`id_agent` INT(10) UNSIGNED NOT NULL,
|
||||
`id_script` BIGINT(20) UNSIGNED NOT NULL,
|
||||
`utimestamp` INT UNSIGNED NOT NULL,
|
||||
`scheduled` INT UNSIGNED DEFAULT NULL,
|
||||
FOREIGN KEY (`id_agent`) REFERENCES `tagente`(`id_agente`) ON UPDATE CASCADE ON DELETE CASCADE,
|
||||
FOREIGN KEY (`id_script`) REFERENCES `tncm_script`(`id`) ON UPDATE CASCADE ON DELETE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
-- ----------------------------------------------------------------------
|
||||
-- Table `tncm_snippet`
|
||||
-- ----------------------------------------------------------------------
|
||||
CREATE TABLE IF NOT EXISTS `tncm_snippet` (
|
||||
`id` SERIAL,
|
||||
`name` TEXT,
|
||||
`content` TEXT,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
-- ----------------------------------------------------------------------
|
||||
-- Table `tncm_firmware`
|
||||
-- ----------------------------------------------------------------------
|
||||
CREATE TABLE IF NOT EXISTS `tncm_firmware` (
|
||||
`id` SERIAL,
|
||||
`name` varchar(255),
|
||||
`shortname` varchar(255) unique,
|
||||
`vendor` bigint(20) unsigned,
|
||||
`models` text,
|
||||
`path` text,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
INSERT INTO `tncm_vendor` VALUES
|
||||
(1,'Cisco'),
|
||||
@ -4247,9 +4286,9 @@ INSERT INTO `tncm_script` VALUES
|
||||
(2,1,'enable
expect:Password:\s*
_enablepass_
term length 0
capture:show running-config
exit
'),
|
||||
(3,2,'enable
expect:Password:\s*
_enablepass_
term length 0
config terminal
_applyconfigbackup_
exit
'),
|
||||
(4,3,'enable
expect:Password:\s*
_enablepass_
term length 0
capture:show version | i IOS Software
exit
'),
|
||||
(5,5,'enable
expect:Password:\s*
_enablepass_
term length 0
config term
end
end
exit
');
|
||||
|
||||
INSERT INTO `tncm_template_scripts`(`id_template`, `id_script`) VALUES (1,1),(1,2),(1,3),(1,4),(1,5);
|
||||
(5,5,'enable
expect:Password:\s*
_enablepass_
term length 0
config term
end
end
exit
'),
|
||||
(6,4,'copy tftp flash
expect:\]\?
_TFTP_SERVER_IP_
expect:\]\?
_SOURCE_FILE_NAME_
expect:\]\?
_DESTINATION_FILE_NAME_
show flash
reload
expect:confirm
y
config terminal
boot system _DESTINATION_FILE_NAME_');
|
||||
INSERT INTO `tncm_template_scripts`(`id_template`, `id_script`) VALUES (1,1),(1,2),(1,3),(1,4),(1,5),(1,6);
|
||||
|
||||
-- ----------------------------------------------------------------------
|
||||
-- Table `talert_calendar`
|
||||
|
@ -330,8 +330,30 @@ if ($config['enterprise_installed']) {
|
||||
$reset_pass_link = 'reset_pass.php';
|
||||
// Reset password link.
|
||||
echo '<div class="reset_password">';
|
||||
echo '<a href="index.php?reset=true&first=true">'.__('Forgot your password?');
|
||||
echo '</a>';
|
||||
if ((!$config['centralized_management'])) {
|
||||
echo '<a href="index.php?reset=true&first=true">'.__('Forgot your password?');
|
||||
echo '</a>';
|
||||
} else {
|
||||
echo '<a href="javascript:centralized_mode_reset_dialog();">'.__('Forgot your password?');
|
||||
echo '</a>';
|
||||
|
||||
echo '<div id="centralized_mode_reset_dialog" title="'.__('Password reset').'" style="display:none">';
|
||||
echo '<div class="content_alert">';
|
||||
echo '<div class="icon_message_alert">';
|
||||
echo html_print_image('images/icono_stop.png', true, ['alt' => __('Password reset'), 'border' => 0]);
|
||||
echo '</div>';
|
||||
echo '<div class="content_message_alert">';
|
||||
echo '<div class="text_message_alert">';
|
||||
echo '<p>'.__('This node is configured with centralized mode. Go to metaconsole to reset the password').'</p>';
|
||||
echo '</div>';
|
||||
echo '<div class="button_message_alert">';
|
||||
html_print_submit_button('Ok', 'centralized_mode_reset_button', false);
|
||||
echo '</div>';
|
||||
echo '</div>';
|
||||
echo '</div>';
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
echo '</div>';
|
||||
}
|
||||
}
|
||||
@ -826,5 +848,23 @@ html_print_div(['id' => 'forced_title_layer', 'class' => 'forced_title_layer', '
|
||||
});
|
||||
});
|
||||
|
||||
function centralized_mode_reset_dialog() {
|
||||
$("#centralized_mode_reset_dialog").dialog({
|
||||
resizable: true,
|
||||
draggable: true,
|
||||
modal: true,
|
||||
height: 220,
|
||||
width: 528,
|
||||
overlay: {
|
||||
opacity: 0.5,
|
||||
background: "black"
|
||||
}
|
||||
});
|
||||
|
||||
$("#submit-centralized_mode_reset_button").click (function () {
|
||||
$("#centralized_mode_reset_dialog").dialog('close');
|
||||
});
|
||||
}
|
||||
|
||||
/* ]]> */
|
||||
</script>
|
||||
|
@ -1,277 +0,0 @@
|
||||
<?php
|
||||
|
||||
// Pandora FMS - http://pandorafms.com
|
||||
// ==================================================
|
||||
// Copyright (c) 2005-2021 Artica Soluciones Tecnologicas
|
||||
// Please see http://pandorafms.org for full contribution list
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; version 2
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
global $config;
|
||||
|
||||
require_once $config['homedir'].'/include/functions_graph.php';
|
||||
|
||||
check_login();
|
||||
|
||||
$enterprise_include = enterprise_include_once('godmode/admin_access_logs.php');
|
||||
|
||||
if (! check_acl($config['id_user'], 0, 'PM')) {
|
||||
db_pandora_audit('ACL Violation', 'Trying to access audit view');
|
||||
include 'general/noaccess.php';
|
||||
exit;
|
||||
}
|
||||
|
||||
$offset = (int) get_parameter('offset');
|
||||
$filter_type = (string) get_parameter('filter_type');
|
||||
$filter_user = (string) get_parameter('filter_user');
|
||||
$filter_text = (string) get_parameter('filter_text');
|
||||
$filter_period = get_parameter('filter_period', null);
|
||||
$filter_period = ($filter_period !== null) ? (int) $filter_period : 24;
|
||||
$filter_ip = (string) get_parameter('filter_ip');
|
||||
|
||||
$filter_query = '&filter_type='.$filter_type.'&filter_user='.$filter_user.'&filter_text='.$filter_text.'&filter_period='.$filter_period.'&filter_ip='.$filter_ip;
|
||||
|
||||
$csv_url = ui_get_full_url(
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false
|
||||
).'index.php?sec=gextensions&sec2=godmode/audit_log_csv'.$filter_query;
|
||||
$csv_img = html_print_image(
|
||||
'images/csv.png',
|
||||
true,
|
||||
[
|
||||
'title' => __(
|
||||
'Export to CSV'
|
||||
),'class' => 'invert_filter',
|
||||
]
|
||||
);
|
||||
$header_buttons = [
|
||||
'csv' => [
|
||||
'active' => false,
|
||||
'text' => '<a href="'.$csv_url.'">'.$csv_img.'</a>',
|
||||
],
|
||||
];
|
||||
|
||||
ui_print_page_header(__('%s audit', get_product_name()).' » '.__('Review Logs'), 'images/gm_log.png', false, '', true, $header_buttons);
|
||||
|
||||
$table = new stdClass();
|
||||
$table->class = 'databox filters';
|
||||
$table->cellstyle = [];
|
||||
$table->cellstyle[0] = [];
|
||||
$table->cellstyle[1] = [];
|
||||
$table->cellstyle[0][0] = 'text-align: right;';
|
||||
$table->cellstyle[0][1] = 'text-align: left;';
|
||||
$table->cellstyle[0][2] = 'text-align: right;';
|
||||
$table->cellstyle[0][3] = 'text-align: left;';
|
||||
$table->cellstyle[0][4] = 'text-align: right;';
|
||||
$table->cellstyle[0][5] = 'text-align: left;';
|
||||
$table->cellstyle[1][0] = 'text-align: right;';
|
||||
$table->cellstyle[1][1] = 'text-align: left;';
|
||||
$table->cellstyle[1][2] = 'text-align: right;';
|
||||
$table->cellstyle[1][3] = 'text-align: left;';
|
||||
$table->cellstyle[1][5] = 'text-align: right;';
|
||||
$table->data = [];
|
||||
|
||||
$data = [];
|
||||
|
||||
$data[0] = '<b>'.__('Search').'</b>';
|
||||
$data[1] = html_print_input_text('filter_text', $filter_text, __('Free text for search (*)'), 20, 40, true);
|
||||
|
||||
$data[2] = '<b>'.__('Max. hours old').'</b>';
|
||||
$data[3] = html_print_input_text('filter_period', $filter_period, __('Max. hours old'), 3, 6, true);
|
||||
|
||||
$data[4] = '<b>'.__('IP').'</b>';
|
||||
$data[5] = html_print_input_text('filter_ip', $filter_ip, __('IP'), 15, 15, true);
|
||||
|
||||
$table->data[0] = $data;
|
||||
$data = [];
|
||||
|
||||
$actions_sql = 'SELECT DISTINCT(accion), accion AS text FROM tsesion';
|
||||
$data[0] = '<b>'.__('Action').'</b>';
|
||||
$data[1] = html_print_select_from_sql($actions_sql, 'filter_type', $filter_type, '', __('All'), '', true);
|
||||
|
||||
$users_sql = 'SELECT id_user, id_user AS text FROM tusuario';
|
||||
$data[2] = '<b>'.__('User').'</b>';
|
||||
$data[3] = html_print_select_from_sql($users_sql, 'filter_user', $filter_user, '', __('All'), '', true);
|
||||
|
||||
$data[4] = '';
|
||||
$data[5] = html_print_submit_button(__('Filter'), 'filter', false, 'class="sub search"', true);
|
||||
|
||||
$table->data[1] = $data;
|
||||
|
||||
$form = '<form name="query_sel" method="post" action="index.php?sec=glog&sec2=godmode/admin_access_logs">';
|
||||
$form .= html_print_table($table, true);
|
||||
$form .= '</form>';
|
||||
ui_toggle($form, __('Filter'), '', '', false);
|
||||
|
||||
$filter = '1=1';
|
||||
|
||||
if (!empty($filter_type)) {
|
||||
$filter .= sprintf(" AND accion = '%s'", $filter_type);
|
||||
}
|
||||
|
||||
if (!empty($filter_user)) {
|
||||
$filter .= sprintf(" AND id_usuario = '%s'", $filter_user);
|
||||
}
|
||||
|
||||
if (!empty($filter_text)) {
|
||||
$filter .= sprintf(" AND (accion LIKE '%%%s%%' OR descripcion LIKE '%%%s%%')", $filter_text, $filter_text);
|
||||
}
|
||||
|
||||
if (!empty($filter_ip)) {
|
||||
$filter .= sprintf(" AND ip_origen LIKE '%%%s%%'", $filter_ip);
|
||||
}
|
||||
|
||||
if (!empty($filter_period)) {
|
||||
switch ($config['dbtype']) {
|
||||
case 'mysql':
|
||||
$filter .= ' AND fecha >= DATE_ADD(NOW(), INTERVAL -'.$filter_period.' HOUR)';
|
||||
break;
|
||||
|
||||
case 'postgresql':
|
||||
$filter .= ' AND fecha >= NOW() - INTERVAL \''.$filter_period.' HOUR \'';
|
||||
break;
|
||||
|
||||
case 'oracle':
|
||||
$filter .= ' AND fecha >= (SYSTIMESTAMP - INTERVAL \''.$filter_period.'\' HOUR)';
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$count_sql = sprintf('SELECT COUNT(*) FROM tsesion WHERE %s', $filter);
|
||||
$count = (int) db_get_value_sql($count_sql);
|
||||
$url = 'index.php?sec=godmode&sec2=godmode/admin_access_logs'.$filter_query;
|
||||
ui_pagination($count, $url);
|
||||
|
||||
switch ($config['dbtype']) {
|
||||
case 'mysql':
|
||||
$sql = sprintf(
|
||||
'SELECT *
|
||||
FROM tsesion
|
||||
WHERE %s
|
||||
ORDER BY fecha DESC
|
||||
LIMIT %d, %d',
|
||||
$filter,
|
||||
$offset,
|
||||
$config['block_size']
|
||||
);
|
||||
break;
|
||||
|
||||
case 'postgresql':
|
||||
$sql = sprintf(
|
||||
'SELECT *
|
||||
FROM tsesion
|
||||
WHERE %s
|
||||
ORDER BY fecha DESC
|
||||
LIMIT %d OFFSET %d',
|
||||
$filter,
|
||||
$config['block_size'],
|
||||
$offset
|
||||
);
|
||||
break;
|
||||
|
||||
case 'oracle':
|
||||
$set = [];
|
||||
$set['limit'] = $config['block_size'];
|
||||
$set['offset'] = $offset;
|
||||
$sql = sprintf(
|
||||
'SELECT *
|
||||
FROM tsesion
|
||||
WHERE %s
|
||||
ORDER BY fecha DESC',
|
||||
$filter
|
||||
);
|
||||
$result = oracle_recode_query($sql, $set);
|
||||
break;
|
||||
}
|
||||
|
||||
$result = db_get_all_rows_sql($sql);
|
||||
if (empty($result)) {
|
||||
$result = [];
|
||||
}
|
||||
|
||||
$table = new stdClass();
|
||||
$table->cellpadding = 0;
|
||||
$table->cellspacing = 0;
|
||||
$table->width = '100%';
|
||||
$table->class = 'info_table';
|
||||
$table->size = [];
|
||||
$table->data = [];
|
||||
$table->head = [];
|
||||
$table->align = [];
|
||||
$table->rowclass = [];
|
||||
|
||||
$table->head[0] = __('User');
|
||||
$table->head[1] = __('Action');
|
||||
$table->head[2] = __('Date');
|
||||
$table->head[3] = __('Source IP');
|
||||
$table->head[4] = __('Comments');
|
||||
if ($enterprise_include !== ENTERPRISE_NOT_HOOK) {
|
||||
$table->head[5] = enterprise_hook('tableHeadEnterpriseAudit', ['title1']);
|
||||
$table->head[6] = enterprise_hook('tableHeadEnterpriseAudit', ['title2']);
|
||||
}
|
||||
|
||||
$table->size[0] = 80;
|
||||
$table->size[2] = 130;
|
||||
$table->size[3] = 100;
|
||||
$table->size[4] = 200;
|
||||
if ($enterprise_include !== ENTERPRISE_NOT_HOOK) {
|
||||
$table->size[5] = enterprise_hook('tableHeadEnterpriseAudit', ['size1']);
|
||||
$table->size[6] = enterprise_hook('tableHeadEnterpriseAudit', ['size2']);
|
||||
$table->align[5] = enterprise_hook('tableHeadEnterpriseAudit', ['align']);
|
||||
$table->align[6] = enterprise_hook('tableHeadEnterpriseAudit', ['align2']);
|
||||
}
|
||||
|
||||
$table->colspan = [];
|
||||
$table->rowstyle = [];
|
||||
|
||||
$rowPair = true;
|
||||
$iterator = 0;
|
||||
|
||||
// Get data
|
||||
foreach ($result as $row) {
|
||||
$iterator++;
|
||||
|
||||
$table->rowclass[] = $rowPair ? 'rowPair' : 'rowOdd';
|
||||
$rowPair = !$rowPair;
|
||||
|
||||
$data = [];
|
||||
$data[0] = io_safe_output($row['id_usuario']);
|
||||
$data[1] = ui_print_session_action_icon($row['accion'], true).$row['accion'];
|
||||
$data[2] = ui_print_help_tip(date($config['date_format'], $row['utimestamp']), true).ui_print_timestamp($row['utimestamp'], true);
|
||||
$data[3] = io_safe_output($row['ip_origen']);
|
||||
$data[4] = io_safe_output($row['descripcion']);
|
||||
|
||||
if ($enterprise_include !== ENTERPRISE_NOT_HOOK) {
|
||||
$data[5] = enterprise_hook('cell1EntepriseAudit', [$row['id_sesion']]);
|
||||
$data[6] = enterprise_hook('cell2EntepriseAudit', [$row['id_sesion']]);
|
||||
}
|
||||
|
||||
$table->data[] = $data;
|
||||
|
||||
if ($enterprise_include !== ENTERPRISE_NOT_HOOK) {
|
||||
rowEnterpriseAudit($table, $iterator, $row['id_sesion']);
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($table->rowclass as $key => $value) {
|
||||
if (strpos($value, 'limit_scroll') !== false) {
|
||||
$table->colspan[$key] = [7];
|
||||
} else {
|
||||
if ($enterprise_include !== ENTERPRISE_NOT_HOOK) {
|
||||
$table->cellclass[$key][6] = 'action_buttons';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
html_print_table($table);
|
||||
ui_pagination($count, $url, 0, 0, false, 'offset', true, 'pagination-bottom');
|
||||
|
||||
if ($enterprise_include !== ENTERPRISE_NOT_HOOK) {
|
||||
enterprise_hook('enterpriseAuditFooter');
|
||||
}
|
@ -103,10 +103,10 @@ if (is_ajax()) {
|
||||
} else {
|
||||
$commons = array_intersect($out, $oid_snmp);
|
||||
if ($get_common_modules) {
|
||||
// Common modules is selected (default)
|
||||
// Common modules is selected (default).
|
||||
$out = $commons;
|
||||
} else {
|
||||
// All modules is selected
|
||||
// All modules is selected.
|
||||
$array1 = array_diff($out, $oid_snmp);
|
||||
$array2 = array_diff($oid_snmp, $out);
|
||||
$out = array_merge($commons, $array1, $array2);
|
||||
@ -135,12 +135,12 @@ if (is_ajax()) {
|
||||
'agents_update_secondary_groups',
|
||||
[
|
||||
$id_agent,
|
||||
($add_secondary_groups) ? $groups_to_add : [],
|
||||
($remove_secondary_groups) ? $groups_to_add : [],
|
||||
(($add_secondary_groups) ? $groups_to_add : []),
|
||||
(($remove_secondary_groups) ? $groups_to_add : []),
|
||||
]
|
||||
);
|
||||
// Echo 0 in case of error. 0 Otherwise.
|
||||
echo ($ret) ? 1 : 0;
|
||||
echo ((bool) $ret === true) ? 1 : 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1385,9 +1385,15 @@ if ($update_module || $create_module) {
|
||||
$custom_integer_2_default = $module['custom_integer_2'];
|
||||
}
|
||||
|
||||
if ($id_module_type == 25) {
|
||||
if ($id_module_type === 25) {
|
||||
// Web analysis, from MODULE_WUX.
|
||||
$custom_string_1 = base64_encode((string) get_parameter('custom_string_1', $custom_string_1_default));
|
||||
$custom_string_1 = base64_encode((string) get_parameter('custom_string_1'));
|
||||
// If the custom_string_1 parameter come empty, set the content
|
||||
// of the module (it is base64_encoded).
|
||||
if (empty($custom_string_1) === true) {
|
||||
$custom_string_1 = $custom_string_1_default;
|
||||
}
|
||||
|
||||
$custom_integer_1 = (int) get_parameter('custom_integer_1', $custom_integer_1_default);
|
||||
} else {
|
||||
$custom_string_1 = (string) get_parameter('custom_string_1', $custom_string_1_default);
|
||||
@ -1402,7 +1408,7 @@ if ($update_module || $create_module) {
|
||||
$macros = (string) get_parameter('macros');
|
||||
$macros_names = (array) get_parameter('macro_name', []);
|
||||
|
||||
if (!empty($macros)) {
|
||||
if (empty($macros) === false) {
|
||||
$macros = json_decode(base64_decode($macros), true);
|
||||
|
||||
foreach ($macros as $k => $m) {
|
||||
@ -2422,7 +2428,7 @@ switch ($tab) {
|
||||
|
||||
var aget_id_os = '<?php echo agents_get_os(modules_get_agentmodule_agent(get_parameter('id_agent_module'))); ?>';
|
||||
|
||||
if('<?php echo modules_get_agentmodule_name(get_parameter('id_agent_module')); ?>' != $('#text-name').val() &&
|
||||
if('<?php echo io_safe_output(modules_get_agentmodule_name(get_parameter('id_agent_module'))); ?>' != $('#text-name').val() &&
|
||||
'<?php echo agents_get_os(modules_get_agentmodule_agent(get_parameter('id_agent_module'))); ?>' == 19){
|
||||
|
||||
event.preventDefault();
|
||||
@ -2456,7 +2462,7 @@ switch ($tab) {
|
||||
|
||||
var module_type_snmp = '<?php echo modules_get_agentmodule_type(get_parameter('id_agent_module')); ?>';
|
||||
|
||||
if('<?php echo modules_get_agentmodule_name(get_parameter('id_agent_module')); ?>' != $('#text-name').val() && (
|
||||
if('<?php echo io_safe_output(modules_get_agentmodule_name(get_parameter('id_agent_module'))); ?>' != $('#text-name').val() && (
|
||||
module_type_snmp == 15 || module_type_snmp == 16 || module_type_snmp == 17 || module_type_snmp == 18)){
|
||||
|
||||
event.preventDefault();
|
||||
|
@ -253,6 +253,7 @@ $module_action = (string) get_parameter('module_action');
|
||||
if ($module_action === 'delete') {
|
||||
$id_agent_modules_delete = (array) get_parameter('id_delete');
|
||||
|
||||
$print_result_msg = true;
|
||||
$count_correct_delete_modules = 0;
|
||||
foreach ($id_agent_modules_delete as $id_agent_module_del) {
|
||||
$id_grupo = (int) agents_get_agent_group($id_agente);
|
||||
@ -268,12 +269,19 @@ if ($module_action === 'delete') {
|
||||
}
|
||||
|
||||
if ($id_agent_module_del < 1) {
|
||||
db_pandora_audit(
|
||||
'HACK Attempt',
|
||||
'Expected variable from form is not correct'
|
||||
);
|
||||
die(__('Nice try buddy'));
|
||||
exit;
|
||||
if (count($id_agent_modules_delete) === 1) {
|
||||
ui_print_error_message(
|
||||
__('No modules selected')
|
||||
);
|
||||
|
||||
$print_result_msg = false;
|
||||
} else {
|
||||
ui_print_error_message(
|
||||
__('There was a problem completing the operation')
|
||||
);
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
enterprise_include_once('include/functions_config_agents.php');
|
||||
@ -421,25 +429,27 @@ if ($module_action === 'delete') {
|
||||
}
|
||||
}
|
||||
|
||||
$count_modules_to_delete = count($id_agent_modules_delete);
|
||||
if ($count_correct_delete_modules == 0) {
|
||||
ui_print_error_message(
|
||||
sprintf(
|
||||
__('There was a problem completing the operation. Applied to 0/%d modules.'),
|
||||
$count_modules_to_delete
|
||||
)
|
||||
);
|
||||
} else {
|
||||
if ($count_correct_delete_modules == $count_modules_to_delete) {
|
||||
ui_print_success_message(__('Operation finished successfully.'));
|
||||
} else {
|
||||
if ($print_result_msg === true) {
|
||||
$count_modules_to_delete = count($id_agent_modules_delete);
|
||||
if ($count_correct_delete_modules == 0) {
|
||||
ui_print_error_message(
|
||||
sprintf(
|
||||
__('There was a problem completing the operation. Applied to %d/%d modules.'),
|
||||
$count_correct_delete_modules,
|
||||
__('There was a problem completing the operation. Applied to 0/%d modules.'),
|
||||
$count_modules_to_delete
|
||||
)
|
||||
);
|
||||
} else {
|
||||
if ($count_correct_delete_modules == $count_modules_to_delete) {
|
||||
ui_print_success_message(__('Operation finished successfully.'));
|
||||
} else {
|
||||
ui_print_error_message(
|
||||
sprintf(
|
||||
__('There was a problem completing the operation. Applied to %d/%d modules.'),
|
||||
$count_correct_delete_modules,
|
||||
$count_modules_to_delete
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if ($module_action === 'disable') {
|
||||
|
@ -250,6 +250,7 @@ if ($create_downtime || $update_downtime) {
|
||||
} else if ($type_execution == 'periodically'
|
||||
&& $type_periodicity == 'monthly'
|
||||
&& $periodically_day_from == $periodically_day_to
|
||||
&& $periodically_time_from >= $periodically_time_to
|
||||
) {
|
||||
ui_print_error_message(
|
||||
__('Not created. Error inserting data').'. '.__('The end time must be higher than the start time')
|
||||
@ -627,20 +628,20 @@ $table->data[5][1] = "
|
||||
<tr><td>".ui_get_using_system_timezone_warning().'</td></tr>
|
||||
<tr>
|
||||
<td>'.__('Type Periodicity:').' '.html_print_select(
|
||||
[
|
||||
'weekly' => __('Weekly'),
|
||||
'monthly' => __('Monthly'),
|
||||
],
|
||||
'type_periodicity',
|
||||
$type_periodicity,
|
||||
'change_type_periodicity();',
|
||||
'',
|
||||
0,
|
||||
true,
|
||||
false,
|
||||
true,
|
||||
'',
|
||||
$disabled_in_execution
|
||||
[
|
||||
'weekly' => __('Weekly'),
|
||||
'monthly' => __('Monthly'),
|
||||
],
|
||||
'type_periodicity',
|
||||
$type_periodicity,
|
||||
'change_type_periodicity();',
|
||||
'',
|
||||
0,
|
||||
true,
|
||||
false,
|
||||
true,
|
||||
'',
|
||||
$disabled_in_execution
|
||||
)."</td>
|
||||
</tr>
|
||||
<tr>
|
||||
@ -660,31 +661,31 @@ $table->data[5][1] = "
|
||||
<tr>
|
||||
<td>".__('From day:').'</td>
|
||||
<td>'.html_print_select(
|
||||
$days,
|
||||
'periodically_day_from',
|
||||
$periodically_day_from,
|
||||
'',
|
||||
'',
|
||||
0,
|
||||
true,
|
||||
false,
|
||||
true,
|
||||
'',
|
||||
$disabled_in_execution
|
||||
$days,
|
||||
'periodically_day_from',
|
||||
$periodically_day_from,
|
||||
'',
|
||||
'',
|
||||
0,
|
||||
true,
|
||||
false,
|
||||
true,
|
||||
'',
|
||||
$disabled_in_execution
|
||||
).'</td>
|
||||
<td>'.__('To day:').'</td>
|
||||
<td>'.html_print_select(
|
||||
$days,
|
||||
'periodically_day_to',
|
||||
$periodically_day_to,
|
||||
'',
|
||||
'',
|
||||
0,
|
||||
true,
|
||||
false,
|
||||
true,
|
||||
'',
|
||||
$disabled_in_execution
|
||||
$days,
|
||||
'periodically_day_to',
|
||||
$periodically_day_to,
|
||||
'',
|
||||
'',
|
||||
0,
|
||||
true,
|
||||
false,
|
||||
true,
|
||||
'',
|
||||
$disabled_in_execution
|
||||
).'</td>
|
||||
<td>'.ui_print_help_tip(__('The end day must be higher than the start day'), true).'</td>
|
||||
</tr>
|
||||
@ -693,26 +694,26 @@ $table->data[5][1] = "
|
||||
<tr>
|
||||
<td>'.__('From hour:').'</td>
|
||||
<td>'.html_print_input_text(
|
||||
'periodically_time_from',
|
||||
$periodically_time_from,
|
||||
'',
|
||||
7,
|
||||
7,
|
||||
true,
|
||||
$disabled_in_execution
|
||||
'periodically_time_from',
|
||||
$periodically_time_from,
|
||||
'',
|
||||
7,
|
||||
7,
|
||||
true,
|
||||
$disabled_in_execution
|
||||
).ui_print_help_tip(
|
||||
__('The end time must be higher than the start time'),
|
||||
true
|
||||
).'</td>
|
||||
<td>'.__('To hour:').'</td>
|
||||
<td>'.html_print_input_text(
|
||||
'periodically_time_to',
|
||||
$periodically_time_to,
|
||||
'',
|
||||
7,
|
||||
7,
|
||||
true,
|
||||
$disabled_in_execution
|
||||
'periodically_time_to',
|
||||
$periodically_time_to,
|
||||
'',
|
||||
7,
|
||||
7,
|
||||
true,
|
||||
$disabled_in_execution
|
||||
).ui_print_help_tip(
|
||||
__('The end time must be higher than the start time'),
|
||||
true
|
||||
@ -946,9 +947,7 @@ if (empty($downtimes_agents)) {
|
||||
|
||||
if (!$running) {
|
||||
$data[5] = '';
|
||||
if ($type_downtime != 'disable_agents_alerts'
|
||||
&& $type_downtime != 'disable_agents'
|
||||
) {
|
||||
if ($type_downtime !== 'disable_agents') {
|
||||
$data[5] = '<a href="javascript:show_editor_module('.$downtime_agent['id_agente'].');">'.html_print_image('images/config.png', true, ['border' => '0', 'alt' => __('Delete'), 'class' => 'invert_filter']).'</a>';
|
||||
}
|
||||
|
||||
@ -998,13 +997,13 @@ $table->data['module'][1] = "
|
||||
<td class='cell_delete_button' style='text-align: right; width:10%;' id=''>".'<a class="link_delete"
|
||||
onclick="if(!confirm(\''.__('Are you sure?').'\')) return false;"
|
||||
href="">'.html_print_image(
|
||||
'images/cross.png',
|
||||
true,
|
||||
[
|
||||
'border' => '0',
|
||||
'alt' => __('Delete'),
|
||||
'class' => 'invert_filter',
|
||||
]
|
||||
'images/cross.png',
|
||||
true,
|
||||
[
|
||||
'border' => '0',
|
||||
'alt' => __('Delete'),
|
||||
'class' => 'invert_filter',
|
||||
]
|
||||
).'</a>'."</td>
|
||||
</tr>
|
||||
<tr class='datos2' id='add_modules_row'>
|
||||
|
@ -235,7 +235,7 @@ $search_string = (string) get_parameter('search_string', '');
|
||||
$group = (int) get_parameter('group', 0);
|
||||
$group_search = (int) get_parameter('group_search', 0);
|
||||
$id_command_search = (int) get_parameter('id_command_search', 0);
|
||||
$url = 'index.php?sec='.$sec.'&sec2=godmode/alerts/alert_actions';
|
||||
$url = 'index.php?sec='.$sec.'&sec2=godmode/alerts/alert_actions&search_string='.$search_string.'&group_search='.$group_search.'&id_command_search='.$id_command_search;
|
||||
|
||||
// Filter table.
|
||||
$table_filter = new stdClass();
|
||||
|
@ -1134,7 +1134,7 @@ function show_add_action(id_alert) {
|
||||
},
|
||||
open: function() {
|
||||
$(`#add_action-div-${id_alert}`).css('overflow', 'hidden');
|
||||
$("#action_select, #action_select").select2({
|
||||
$("select[id^='action_select'], select[id^='action_select']").select2({
|
||||
tags: true,
|
||||
dropdownParent: $("#add_action-div-" + id_alert)
|
||||
});
|
||||
|
@ -21,8 +21,6 @@ enterprise_include_once('meta/include/functions_alerts_meta.php');
|
||||
|
||||
check_login();
|
||||
|
||||
enterprise_hook('open_meta_frame');
|
||||
|
||||
if (! check_acl($config['id_user'], 0, 'LM')) {
|
||||
db_pandora_audit(
|
||||
'ACL Violation',
|
||||
@ -50,6 +48,8 @@ if (is_ajax()) {
|
||||
}
|
||||
}
|
||||
|
||||
enterprise_hook('open_meta_frame');
|
||||
|
||||
if (defined('METACONSOLE')) {
|
||||
$sec = 'advanced';
|
||||
} else {
|
||||
@ -694,8 +694,19 @@ $(document).ready (function () {
|
||||
}
|
||||
}
|
||||
else {
|
||||
var is_element_select = $("[name=field" + i + "_value]").is("select");
|
||||
|
||||
$("[name=field" + i + "_value]").val(old_value);
|
||||
if (is_element_select === true) {
|
||||
$("[name=field" + i + "_value]").trigger('change');
|
||||
}
|
||||
|
||||
|
||||
$("[name=field" + i + "_recovery_value]").val(old_recovery_value);
|
||||
|
||||
if (is_element_select === true) {
|
||||
$("[name=field" + i + "_recovery_value]").trigger('change');
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
@ -747,6 +758,7 @@ $(document).ready (function () {
|
||||
|
||||
if ($('#field5_value').val() !== '') {
|
||||
ajax_get_integria_custom_fields($('#field5_value').val(), integria_custom_fields_values, integria_custom_fields_rvalues);
|
||||
$('#field5_value').trigger('change');
|
||||
}
|
||||
|
||||
$('#field5_value').on('change', function() {
|
||||
|
71
pandora_console/godmode/audit_log.php
Normal file
@ -0,0 +1,71 @@
|
||||
<?php
|
||||
/**
|
||||
* Audit log View.
|
||||
*
|
||||
* @category Audit log
|
||||
* @package Pandora FMS
|
||||
* @subpackage Community
|
||||
* @version 1.0.0
|
||||
* @license See below
|
||||
*
|
||||
* ______ ___ _______ _______ ________
|
||||
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
|
||||
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
|
||||
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
||||
*
|
||||
* ============================================================================
|
||||
* Copyright (c) 2005-2022 Artica Soluciones Tecnologicas
|
||||
* Please see http://pandorafms.org for full contribution list
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation for version 2.
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
* ============================================================================
|
||||
*/
|
||||
|
||||
// Begin.
|
||||
global $config;
|
||||
|
||||
require_once $config['homedir'].'/include/class/AuditLog.class.php';
|
||||
|
||||
$ajaxPage = 'godmode/audit_log';
|
||||
|
||||
// Control call flow.
|
||||
try {
|
||||
// User access and validation is being processed on class constructor.
|
||||
$controller = new AuditLog($ajaxPage);
|
||||
} catch (Exception $e) {
|
||||
if ((bool) is_ajax() === true) {
|
||||
echo json_encode(['error' => '[AuditLog]'.$e->getMessage() ]);
|
||||
exit;
|
||||
} else {
|
||||
echo '[AuditLog]'.$e->getMessage();
|
||||
}
|
||||
|
||||
// Stop this execution, but continue 'globally'.
|
||||
return;
|
||||
}
|
||||
|
||||
// AJAX controller.
|
||||
if ((bool) is_ajax() === true) {
|
||||
$method = get_parameter('method');
|
||||
|
||||
if (method_exists($controller, $method) === true) {
|
||||
if ($controller->ajaxMethod($method) === true) {
|
||||
$controller->{$method}();
|
||||
} else {
|
||||
$controller->error('Unavailable method.');
|
||||
}
|
||||
} else {
|
||||
$controller->error('Method not found. ['.$method.']');
|
||||
}
|
||||
|
||||
// Stop any execution.
|
||||
exit;
|
||||
} else {
|
||||
// Run.
|
||||
$controller->run();
|
||||
}
|
@ -385,8 +385,8 @@ if (check_acl($config['id_user'], 0, 'PM') || check_acl($config['id_user'], 0, '
|
||||
|
||||
if (check_acl($config['id_user'], 0, 'PM')) {
|
||||
// Audit //meter en extensiones.
|
||||
$sub['godmode/admin_access_logs']['text'] = __('System audit log');
|
||||
$sub['godmode/admin_access_logs']['id'] = 'System audit log';
|
||||
$sub['godmode/audit_log']['text'] = __('System audit log');
|
||||
$sub['godmode/audit_log']['id'] = 'System audit log';
|
||||
$sub['godmode/setup/links']['text'] = __('Links');
|
||||
$sub['godmode/setup/links']['id'] = 'Links';
|
||||
$sub['tools/diagnostics']['text'] = __('Diagnostic info');
|
||||
@ -406,6 +406,7 @@ if (check_acl($config['id_user'], 0, 'PM') || check_acl($config['id_user'], 0, '
|
||||
$sub['extensions/dbmanager']['text'] = __('DB Interface');
|
||||
$sub['extensions/dbmanager']['id'] = 'DB Interface';
|
||||
$sub['extensions/dbmanager']['sec'] = 'gbman';
|
||||
enterprise_hook('dbBackupManager');
|
||||
enterprise_hook('elasticsearch_interface_menu');
|
||||
}
|
||||
}
|
||||
|
@ -211,7 +211,7 @@ switch ($action) {
|
||||
$failover_type = REPORT_FAILOVER_TYPE_NORMAL;
|
||||
$server_name = '';
|
||||
$server_id = 0;
|
||||
$dyn_height = 230;
|
||||
$dyn_height = (empty($config['graph_image_height']) === false) ? $config['graph_image_height'] : REPORT_ITEM_DYNAMIC_HEIGHT;
|
||||
$landscape = false;
|
||||
$pagebreak = false;
|
||||
$summary = 0;
|
||||
@ -252,7 +252,7 @@ switch ($action) {
|
||||
$server_name = '';
|
||||
$server_id = 0;
|
||||
$get_data_editor = false;
|
||||
$dyn_height = 230;
|
||||
$dyn_height = (empty($config['graph_image_height']) === false) ? $config['graph_image_height'] : REPORT_ITEM_DYNAMIC_HEIGHT;
|
||||
break;
|
||||
}
|
||||
|
||||
@ -893,6 +893,10 @@ switch ($action) {
|
||||
$select_by_group = $es['select_by_group'];
|
||||
break;
|
||||
|
||||
case 'ncm':
|
||||
$idAgent = $item['id_agent'];
|
||||
break;
|
||||
|
||||
default:
|
||||
// It's not possible.
|
||||
break;
|
||||
@ -4000,23 +4004,23 @@ function print_SLA_list($width, $action, $idItem=null)
|
||||
],
|
||||
]
|
||||
);
|
||||
if (!empty($services_tmp)
|
||||
&& $services_tmp != ENTERPRISE_NOT_HOOK
|
||||
) {
|
||||
foreach ($services_tmp as $service) {
|
||||
$check_module_sla = modules_check_agentmodule_exists(
|
||||
$service['sla_id_module']
|
||||
);
|
||||
$check_module_sla_value = modules_check_agentmodule_exists(
|
||||
$service['sla_value_id_module']
|
||||
);
|
||||
if ($check_module_sla
|
||||
&& $check_module_sla_value
|
||||
if (!empty($services_tmp)
|
||||
&& $services_tmp != ENTERPRISE_NOT_HOOK
|
||||
) {
|
||||
$services[$service['id']] = $service['name'];
|
||||
foreach ($services_tmp as $service) {
|
||||
$check_module_sla = modules_check_agentmodule_exists(
|
||||
$service['sla_id_module']
|
||||
);
|
||||
$check_module_sla_value = modules_check_agentmodule_exists(
|
||||
$service['sla_value_id_module']
|
||||
);
|
||||
if ($check_module_sla
|
||||
&& $check_module_sla_value
|
||||
) {
|
||||
$services[$service['id']] = $service['name'];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
echo '<td class="sla_list_service_col">';
|
||||
echo html_print_select(
|
||||
@ -6593,6 +6597,11 @@ function chooseType() {
|
||||
} else {
|
||||
$("#row_profiles_group").hide();
|
||||
}
|
||||
break;
|
||||
|
||||
case 'ncm':
|
||||
$("#row_agent").show();
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
|
BIN
pandora_console/images/ncm/cisco.png
Executable file
After Width: | Height: | Size: 490 B |
BIN
pandora_console/images/ncm/default.png
Normal file
After Width: | Height: | Size: 5.1 KiB |
@ -1362,6 +1362,10 @@ if ($get_extended_event) {
|
||||
$timestamp_first = $event['min_timestamp'];
|
||||
$timestamp_last = $event['max_timestamp'];
|
||||
$server_id = $event['server_id'];
|
||||
if (empty($server_id) && !empty($event['server_name']) && is_metaconsole()) {
|
||||
$server_id = metaconsole_get_id_server($event['server_name']);
|
||||
}
|
||||
|
||||
$comments = $event['comments'];
|
||||
|
||||
$event['similar_ids'] = $similar_ids;
|
||||
@ -1537,7 +1541,7 @@ if ($get_extended_event) {
|
||||
|
||||
$console_url = '';
|
||||
// If metaconsole switch to node to get details and custom fields.
|
||||
if ($meta) {
|
||||
if ($meta || (is_metaconsole() && !empty($server_id))) {
|
||||
$server = metaconsole_get_connection_by_id($server_id);
|
||||
} else {
|
||||
$server = '';
|
||||
@ -1550,7 +1554,7 @@ if ($get_extended_event) {
|
||||
}
|
||||
|
||||
$connected = true;
|
||||
if ($meta) {
|
||||
if ($meta || (is_metaconsole() && !empty($server_id))) {
|
||||
if (metaconsole_connect($server) === NOERR) {
|
||||
$connected = true;
|
||||
} else {
|
||||
|
@ -36,6 +36,7 @@ $ajax = true;
|
||||
|
||||
$render_map = (bool) get_parameter('render_map', false);
|
||||
$graph_javascript = (bool) get_parameter('graph_javascript', false);
|
||||
$force_remote_check = (bool) get_parameter('force_remote_check', false);
|
||||
|
||||
if ($render_map) {
|
||||
$width = (int) get_parameter('width', '400');
|
||||
@ -55,3 +56,36 @@ if ($render_map) {
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
if ($force_remote_check) {
|
||||
$id_layout = (int) get_parameter('id_layout', false);
|
||||
$data = db_get_all_rows_sql(
|
||||
sprintf(
|
||||
'SELECT id_agent FROM tlayout_data WHERE id_layout = %d AND id_agent <> 0',
|
||||
$id_layout
|
||||
)
|
||||
);
|
||||
|
||||
if (empty($data)) {
|
||||
echo '0';
|
||||
} else {
|
||||
$ids = [];
|
||||
foreach ($data as $key => $value) {
|
||||
$ids[] = $value['id_agent'];
|
||||
}
|
||||
|
||||
$sql = sprintf(
|
||||
'UPDATE `tagente_modulo` SET flag = 1 WHERE `id_agente` IN (%s)',
|
||||
implode(',', $ids)
|
||||
);
|
||||
|
||||
$result = db_process_sql($sql);
|
||||
if ($result) {
|
||||
echo true;
|
||||
} else {
|
||||
echo '0';
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
@ -1389,7 +1389,10 @@ class AgentWizard extends HTML
|
||||
foreach (array_keys($data) as $k) {
|
||||
foreach ($modulesActivated as $key => $value) {
|
||||
$valueStr = preg_replace('/\//', '\/', $value);
|
||||
if (empty(preg_match('/-'.$valueStr.'$/', $k)) === false) {
|
||||
|
||||
if (empty(preg_match('/-'.$valueStr.'$/', $k)) === false
|
||||
|| empty(preg_match('/-'.$valueStr.'_sent$/', $k)) === false
|
||||
) {
|
||||
if (empty(preg_match('/module-name-set/', $k)) === false) {
|
||||
$result[$value]['name'] = $data[$k];
|
||||
} else if (empty(preg_match('/module-description-set/', $k)) === false) {
|
||||
@ -1417,6 +1420,42 @@ class AgentWizard extends HTML
|
||||
continue;
|
||||
} else if (empty(preg_match('/module-unit/', $k)) === false) {
|
||||
$result[$value]['unit'] = $data['module-unit-'.$key];
|
||||
continue;
|
||||
} else if (empty(preg_match('/module-warning-min/', $k)) === false) {
|
||||
$result[$value]['warningMin'] = $data['module-warning-min-0_0-0'];
|
||||
continue;
|
||||
} else if (empty(preg_match('/module-warning-max/', $k)) === false) {
|
||||
$result[$value]['warningMax'] = $data['module-warning-max-0_0-0'];
|
||||
continue;
|
||||
} else if (empty(preg_match('/module-critical-min/', $k)) === false) {
|
||||
$result[$value]['criticalMin'] = $data['module-critical-min-0_0-0'];
|
||||
continue;
|
||||
} else if (empty(preg_match('/module-critical-max/', $k)) === false) {
|
||||
$result[$value]['criticalMax'] = $data['module-critical-max-0_0-0'];
|
||||
continue;
|
||||
} else if (empty(preg_match('/module-critical-inv/', $k)) === false) {
|
||||
if (isset($data['module-critical-inv-0_0-0'])) {
|
||||
$result[$value]['criticalInv'] = $data['module-critical-inv-0_0-0_sent'];
|
||||
}
|
||||
|
||||
continue;
|
||||
} else if (empty(preg_match('/module-warning-inv/', $k)) === false) {
|
||||
if (isset($data['module-warning-inv-0_0-0'])) {
|
||||
$result[$value]['warningInv'] = $data['module-warning-inv-0_0-0_sent'];
|
||||
}
|
||||
|
||||
continue;
|
||||
} else if (empty(preg_match('/module-warning-perc/', $k)) === false) {
|
||||
if (isset($data['module-warning-perc-0_0-0'])) {
|
||||
$result[$value]['warningPerc'] = $data['module-warning-perc-0_0-0_sent'];
|
||||
}
|
||||
|
||||
continue;
|
||||
} else if (empty(preg_match('/module-critical-perc/', $k)) === false) {
|
||||
if (isset($data['module-critical-perc-0_0-0'])) {
|
||||
$result[$value]['criticalPerc'] = $data['module-critical-perc-0_0-0_sent'];
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -1429,6 +1468,10 @@ class AgentWizard extends HTML
|
||||
}
|
||||
}
|
||||
|
||||
if (empty(preg_match('/-'.$valueStr.'_sent$/', $k)) === false) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (empty(preg_match('/module-warning-min/', $k)) === false) {
|
||||
$result[$value]['warningMin'] = $data[$k];
|
||||
} else if (empty(preg_match('/module-warning-max/', $k)) === false) {
|
||||
@ -1438,9 +1481,9 @@ class AgentWizard extends HTML
|
||||
} else if (empty(preg_match('/module-critical-max/', $k)) === false) {
|
||||
$result[$value]['criticalMax'] = $data[$k];
|
||||
} else if (empty(preg_match('/module-critical-inv/', $k)) === false) {
|
||||
$result[$value]['criticalInv'] = $data[$k];
|
||||
$result[$value]['criticalInv'] = $data[$k.'_sent'];
|
||||
} else if (empty(preg_match('/module-warning-inv/', $k)) === false) {
|
||||
$result[$value]['warningInv'] = $data[$k];
|
||||
$result[$value]['warningInv'] = $data[$k.'_sent'];
|
||||
} else if (empty(preg_match('/module-warning-perc/', $k)) === false) {
|
||||
$result[$value]['warningPerc'] = $data[$k.'_sent'];
|
||||
} else if (empty(preg_match('/module-critical-perc/', $k)) === false) {
|
||||
|
410
pandora_console/include/class/AuditLog.class.php
Normal file
@ -0,0 +1,410 @@
|
||||
<?php
|
||||
// phpcs:disable Squiz.NamingConventions.ValidVariableName.MemberNotCamelCaps
|
||||
/**
|
||||
* Controller for Audit Logs
|
||||
*
|
||||
* @category Controller
|
||||
* @package Pandora FMS
|
||||
* @subpackage Community
|
||||
* @version 1.0.0
|
||||
* @license See below
|
||||
*
|
||||
* ______ ___ _______ _______ ________
|
||||
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
|
||||
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
|
||||
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
||||
*
|
||||
* ============================================================================
|
||||
* Copyright (c) 2005-2022 Artica Soluciones Tecnologicas
|
||||
* Please see http://pandorafms.org for full contribution list
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation for version 2.
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
* ============================================================================
|
||||
*/
|
||||
// Begin.
|
||||
global $config;
|
||||
|
||||
// Necessary classes for extends.
|
||||
require_once $config['homedir'].'/include/class/HTML.class.php';
|
||||
enterprise_include_once('godmode/admin_access_logs.php');
|
||||
|
||||
/**
|
||||
* Class AuditLog
|
||||
*/
|
||||
class AuditLog extends HTML
|
||||
{
|
||||
|
||||
/**
|
||||
* Allowed methods to be called using AJAX request.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $AJAXMethods = [ 'draw' ];
|
||||
|
||||
/**
|
||||
* Ajax page.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $ajaxController;
|
||||
|
||||
|
||||
/**
|
||||
* Class constructor
|
||||
*
|
||||
* @param string $ajaxController Ajax controller.
|
||||
*/
|
||||
public function __construct(string $ajaxController)
|
||||
{
|
||||
global $config;
|
||||
|
||||
check_login();
|
||||
|
||||
if (check_acl($config['id_user'], 0, 'PM') === false
|
||||
&& is_user_admin($config['id_user']) === true
|
||||
) {
|
||||
db_pandora_audit(
|
||||
'ACL Violation',
|
||||
'Trying to access Audit Logs'
|
||||
);
|
||||
include 'general/noaccess.php';
|
||||
return;
|
||||
}
|
||||
|
||||
// Set the ajax controller.
|
||||
$this->ajaxController = $ajaxController;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Run view
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
// Javascript.
|
||||
ui_require_jquery_file('pandora');
|
||||
// CSS.
|
||||
ui_require_css_file('wizard');
|
||||
ui_require_css_file('discovery');
|
||||
// Datatables list.
|
||||
try {
|
||||
$columns = [
|
||||
'id_usuario',
|
||||
'accion',
|
||||
'fecha',
|
||||
'ip_origen',
|
||||
'descripcion',
|
||||
];
|
||||
|
||||
$column_names = [
|
||||
__('User'),
|
||||
__('Action'),
|
||||
__('Date'),
|
||||
__('Source IP'),
|
||||
__('Comments'),
|
||||
];
|
||||
|
||||
if (enterprise_installed() === true) {
|
||||
array_push(
|
||||
$columns,
|
||||
[
|
||||
'text' => 'security',
|
||||
'class' => 'w80px action_buttons show_security_info',
|
||||
],
|
||||
[
|
||||
'text' => 'action',
|
||||
'class' => 'w80px action_buttons show_extended_info',
|
||||
]
|
||||
);
|
||||
|
||||
array_push($column_names, __('S.'), __('A.'));
|
||||
}
|
||||
|
||||
$this->tableId = 'audit_logs';
|
||||
|
||||
// Header (only in Node).
|
||||
if (is_metaconsole() === false) {
|
||||
ui_print_standard_header(
|
||||
__('%s audit', get_product_name()).' » '.__('Review Logs'),
|
||||
'images/gm_log.png',
|
||||
false,
|
||||
'',
|
||||
false,
|
||||
[],
|
||||
[
|
||||
[
|
||||
'link' => '',
|
||||
'label' => __('Admin Tools'),
|
||||
],
|
||||
[
|
||||
'link' => '',
|
||||
'label' => __('System Audit log'),
|
||||
],
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
if (is_metaconsole() === true) {
|
||||
// Only in case of Metaconsole, format the frame.
|
||||
open_meta_frame();
|
||||
}
|
||||
|
||||
// Load datatables user interface.
|
||||
ui_print_datatable(
|
||||
[
|
||||
'id' => $this->tableId,
|
||||
'class' => 'info_table',
|
||||
'style' => 'width: 100%',
|
||||
'columns' => $columns,
|
||||
'column_names' => $column_names,
|
||||
'ajax_url' => $this->ajaxController,
|
||||
'ajax_data' => ['method' => 'draw'],
|
||||
'ajax_postprocces' => 'process_datatables_item(item)',
|
||||
'no_sortable_columns' => [-1],
|
||||
'order' => [
|
||||
'field' => 'date',
|
||||
'direction' => 'asc',
|
||||
],
|
||||
'search_button_class' => 'sub filter float-right',
|
||||
'form' => [
|
||||
'inputs' => [
|
||||
[
|
||||
'label' => __('Search'),
|
||||
'type' => 'text',
|
||||
'class' => 'w200px',
|
||||
'id' => 'filter_text',
|
||||
'name' => 'filter_text',
|
||||
],
|
||||
[
|
||||
'label' => __('Max. hours old'),
|
||||
'type' => 'text',
|
||||
'class' => 'w100px',
|
||||
'id' => 'filter_period',
|
||||
'name' => 'filter_period',
|
||||
],
|
||||
[
|
||||
'label' => __('IP'),
|
||||
'type' => 'text',
|
||||
'class' => 'w100px',
|
||||
'id' => 'filter_ip',
|
||||
'name' => 'filter_ip',
|
||||
],
|
||||
[
|
||||
'label' => __('Action'),
|
||||
'type' => 'select_from_sql',
|
||||
'nothing' => __('All'),
|
||||
'nothing_value' => '-1',
|
||||
'sql' => 'SELECT DISTINCT(accion), accion AS text FROM tsesion',
|
||||
'class' => 'mw250px',
|
||||
'id' => 'filter_type',
|
||||
'name' => 'filter_type',
|
||||
],
|
||||
[
|
||||
'label' => __('User'),
|
||||
'type' => 'select_from_sql',
|
||||
'nothing' => __('All'),
|
||||
'nothing_value' => '-1',
|
||||
'sql' => 'SELECT id_user, id_user AS text FROM tusuario',
|
||||
'class' => 'mw250px',
|
||||
'id' => 'filter_user',
|
||||
'name' => 'filter_user',
|
||||
],
|
||||
],
|
||||
],
|
||||
]
|
||||
);
|
||||
} catch (Exception $e) {
|
||||
echo $e->getMessage();
|
||||
}
|
||||
|
||||
if (is_metaconsole() === true) {
|
||||
// Close the frame.
|
||||
close_meta_frame();
|
||||
}
|
||||
|
||||
// Load own javascript file.
|
||||
echo $this->loadJS();
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the data for draw the table.
|
||||
*
|
||||
* @return void.
|
||||
*/
|
||||
public function draw()
|
||||
{
|
||||
global $config;
|
||||
// Initialice filter.
|
||||
$filter = '1=1';
|
||||
// Init data.
|
||||
$data = [];
|
||||
// Count of total records.
|
||||
$count = 0;
|
||||
// Catch post parameters.
|
||||
$start = get_parameter('start', 0);
|
||||
$length = get_parameter('length', $config['block_size']);
|
||||
$order = get_datatable_order();
|
||||
$filters = get_parameter('filter', []);
|
||||
$this->filterType = $filters['filter_type'];
|
||||
$this->filterUser = $filters['filter_user'];
|
||||
$this->filterText = $filters['filter_text'];
|
||||
$this->filterPeriod = (empty($filters['filter_period']) === false) ? $filters['filter_period'] : 24;
|
||||
$this->filterIp = $filters['filter_ip'];
|
||||
|
||||
if (empty($this->filterType) === false && $this->filterType !== '-1') {
|
||||
$filter .= sprintf(" AND accion = '%s'", $this->filterType);
|
||||
}
|
||||
|
||||
if (empty($this->filterUser) === false && $this->filterUser !== '-1') {
|
||||
$filter .= sprintf(" AND id_usuario = '%s'", $this->filterUser);
|
||||
}
|
||||
|
||||
if (empty($this->filterText) === false) {
|
||||
$filter .= sprintf(
|
||||
" AND (accion LIKE '%%%s%%' OR descripcion LIKE '%%%s%%')",
|
||||
$this->filterText,
|
||||
$this->filterText
|
||||
);
|
||||
}
|
||||
|
||||
if (empty($this->filterIp) === false) {
|
||||
$filter .= sprintf(" AND ip_origen LIKE '%%%s%%'", $this->filterIp);
|
||||
}
|
||||
|
||||
if (empty($this->filterPeriod) === false) {
|
||||
$filter .= sprintf(' AND fecha >= DATE_ADD(NOW(), INTERVAL -%d HOUR)', $this->filterPeriod);
|
||||
}
|
||||
|
||||
$count = (int) db_get_value_sql(sprintf('SELECT COUNT(*) as "total" FROM tsesion WHERE %s', $filter));
|
||||
|
||||
$sql = sprintf(
|
||||
'SELECT *
|
||||
FROM tsesion
|
||||
WHERE %s
|
||||
ORDER BY %s
|
||||
LIMIT %d, %d',
|
||||
$filter,
|
||||
$order,
|
||||
$start,
|
||||
$length
|
||||
);
|
||||
$data = db_get_all_rows_sql($sql);
|
||||
|
||||
if (empty($data) === false) {
|
||||
$data = array_reduce(
|
||||
$data,
|
||||
function ($carry, $item) {
|
||||
global $config;
|
||||
// Transforms array of arrays $data into an array
|
||||
// of objects, making a post-process of certain fields.
|
||||
$tmp = (object) $item;
|
||||
|
||||
$tmp->id_usuario = io_safe_output($tmp->id_usuario);
|
||||
$tmp->ip_origen = io_safe_output($tmp->ip_origen);
|
||||
$tmp->descripcion = io_safe_output($tmp->descripcion);
|
||||
$tmp->accion = ui_print_session_action_icon($tmp->accion, true).$tmp->accion;
|
||||
$tmp->utimestamp = ui_print_help_tip(
|
||||
date(
|
||||
$config['date_format'],
|
||||
$tmp->utimestamp
|
||||
),
|
||||
true
|
||||
).ui_print_timestamp($tmp->utimestamp, true);
|
||||
|
||||
if (enterprise_installed() === true) {
|
||||
$tmp->security = enterprise_hook('cell1EntepriseAudit', [$tmp->id_sesion]);
|
||||
$tmp->action = enterprise_hook('cell2EntepriseAudit', []);
|
||||
$tmp->extendedInfo = enterprise_hook('rowEnterpriseAudit', [$tmp->id_sesion]);
|
||||
}
|
||||
|
||||
$carry[] = $tmp;
|
||||
return $carry;
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
echo json_encode(
|
||||
[
|
||||
'data' => $data,
|
||||
'recordsTotal' => $count,
|
||||
'recordsFiltered' => $count,
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Checks if target method is available to be called using AJAX.
|
||||
*
|
||||
* @param string $method Target method.
|
||||
*
|
||||
* @return boolean True allowed, false not.
|
||||
*/
|
||||
public function ajaxMethod(string $method)
|
||||
{
|
||||
return in_array($method, $this->AJAXMethods);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Load Javascript code.
|
||||
*
|
||||
* @return string.
|
||||
*/
|
||||
public function loadJS()
|
||||
{
|
||||
// Nothing for this moment.
|
||||
ob_start();
|
||||
|
||||
// Javascript content.
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
function format ( d ) {
|
||||
var output = '';
|
||||
|
||||
if (d.extendedInfo === '') {
|
||||
output = "<?php echo __('There is no additional information to display'); ?>";
|
||||
} else {
|
||||
output = d.extendedInfo;
|
||||
}
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
// Add event listener for opening and closing details
|
||||
$('#audit_logs tbody').on('click', 'td.show_extended_info', function () {
|
||||
var tr = $(this).closest('tr');
|
||||
var table = <?php echo 'dt_'.$this->tableId; ?>;
|
||||
var row = table.row( tr );
|
||||
|
||||
if ( row.child.isShown() ) {
|
||||
// This row is already open - close it
|
||||
row.child.hide();
|
||||
tr.removeClass('shown');
|
||||
}
|
||||
else {
|
||||
// Open this row
|
||||
row.child( format(row.data()) ).show();
|
||||
tr.addClass('shown');
|
||||
}
|
||||
} );
|
||||
} );
|
||||
</script>
|
||||
<?php
|
||||
// EOF Javascript content.
|
||||
return ob_get_clean();
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -1256,8 +1256,7 @@ class ConsoleSupervisor
|
||||
unix_timestamp() - unix_timestamp(keepalive) as downtime
|
||||
FROM tserver
|
||||
WHERE
|
||||
unix_timestamp() - unix_timestamp(keepalive) > server_keepalive
|
||||
OR status = 0'
|
||||
unix_timestamp() - unix_timestamp(keepalive) > server_keepalive'
|
||||
);
|
||||
|
||||
if ($servers === false) {
|
||||
@ -1298,13 +1297,12 @@ class ConsoleSupervisor
|
||||
FROM tserver
|
||||
WHERE
|
||||
unix_timestamp() - unix_timestamp(keepalive) <= server_keepalive
|
||||
OR status != 0'
|
||||
AND status = 1'
|
||||
);
|
||||
|
||||
if (is_array($servers_working) === true) {
|
||||
foreach ($servers_working as $server) {
|
||||
$this->cleanNotifications(
|
||||
'NOTIF.SERVER.STATUS'.$server['id_server']
|
||||
'NOTIF.SERVER.STATUS.'.$server['id_server']
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -20,8 +20,8 @@
|
||||
/**
|
||||
* Pandora build version and version
|
||||
*/
|
||||
$build_version = 'PC211214';
|
||||
$pandora_version = 'v7.0NG.758.1';
|
||||
$build_version = 'PC220118';
|
||||
$pandora_version = 'v7.0NG.759';
|
||||
|
||||
// Do not overwrite default timezone set if defined.
|
||||
$script_tz = @date_default_timezone_get();
|
||||
|
@ -456,6 +456,8 @@ define('REPORT_ITEM_ORDER_BY_ASCENDING', 2);
|
||||
define('REPORT_ITEM_ORDER_BY_DESCENDING', 1);
|
||||
define('REPORT_ITEM_ORDER_BY_UNSORT', 0);
|
||||
|
||||
define('REPORT_ITEM_DYNAMIC_HEIGHT', 230);
|
||||
|
||||
define('REPORT_OLD_TYPE_SIMPLE_GRAPH', 1);
|
||||
define('REPORT_OLD_TYPE_CUSTOM_GRAPH', 2);
|
||||
define('REPORT_OLD_TYPE_SLA', 3);
|
||||
|
@ -778,8 +778,59 @@ function mysql_db_format_array_where_clause_sql($values, $join='AND', $prefix=fa
|
||||
$not = (($negative === true) ? ' !' : '');
|
||||
$query .= sprintf('%s %s= %f', $field, $not, $value);
|
||||
} else if (is_array($value)) {
|
||||
$not = (($negative === true) ? 'NOT' : '');
|
||||
$query .= sprintf('%s %s IN ("%s")', $field, $not, implode('", "', $value));
|
||||
$values_check = array_keys($value);
|
||||
$ranges = false;
|
||||
$initialized = false;
|
||||
foreach ($values_check as $operation) {
|
||||
if ($ranges === true && $initialized === true) {
|
||||
$query .= ' '.$join.' ';
|
||||
} else {
|
||||
$initialized = true;
|
||||
}
|
||||
|
||||
if ($operation === '>') {
|
||||
$query .= sprintf("%s > '%s'", $field, $value[$operation]);
|
||||
$ranges = true;
|
||||
} else if ($operation === '>=') {
|
||||
$query .= sprintf("%s >= '%s'", $field, $value[$operation]);
|
||||
$ranges = true;
|
||||
} else if ($operation === '<') {
|
||||
$query .= sprintf("%s < '%s'", $field, $value[$operation]);
|
||||
$ranges = true;
|
||||
} else if ($operation === '<=') {
|
||||
$query .= sprintf("%s <= '%s'", $field, $value[$operation]);
|
||||
$ranges = true;
|
||||
} else if ($operation === '!=') {
|
||||
$query .= sprintf("%s != '%s'", $field, $value[$operation]);
|
||||
$ranges = true;
|
||||
} else if ($operation === '=') {
|
||||
$query .= sprintf("%s = '%s'", $field, $value[$operation]);
|
||||
$ranges = true;
|
||||
} else if ($negative === true && $operation === '>') {
|
||||
$query .= sprintf("%s <= '%s'", $field, $value[$operation]);
|
||||
$ranges = true;
|
||||
} else if ($negative === true && $operation === '>=') {
|
||||
$query .= sprintf("%s < '%s'", $field, $value[$operation]);
|
||||
$ranges = true;
|
||||
} else if ($negative === true && $operation === '<') {
|
||||
$query .= sprintf("%s >= '%s'", $field, $value[$operation]);
|
||||
$ranges = true;
|
||||
} else if ($negative === true && $operation === '<=') {
|
||||
$query .= sprintf("%s > '%s'", $field, $value[$operation]);
|
||||
$ranges = true;
|
||||
} else if ($negative === true && $operation === '!=') {
|
||||
$query .= sprintf("%s = '%s'", $field, $value[$operation]);
|
||||
$ranges = true;
|
||||
} else if ($negative === true && $operation === '=') {
|
||||
$query .= sprintf("%s != '%s'", $field, $value[$operation]);
|
||||
$ranges = true;
|
||||
}
|
||||
}
|
||||
|
||||
if ($ranges !== true) {
|
||||
$not = (($negative === true) ? 'NOT' : '');
|
||||
$query .= sprintf('%s %s IN ("%s")', $field, $not, implode('", "', $value));
|
||||
}
|
||||
} else {
|
||||
if ($value === '') {
|
||||
// Search empty string.
|
||||
@ -823,10 +874,10 @@ function mysql_db_format_array_where_clause_sql($values, $join='AND', $prefix=fa
|
||||
*
|
||||
* @return the first value of the first row of a table result from query.
|
||||
*/
|
||||
function mysql_db_get_value_sql($sql, $dbconnection=false)
|
||||
function mysql_db_get_value_sql($sql, $dbconnection=false, $search_history_db=false)
|
||||
{
|
||||
$sql .= ' LIMIT 1';
|
||||
$result = mysql_db_get_all_rows_sql($sql, false, true, $dbconnection);
|
||||
$result = mysql_db_get_all_rows_sql($sql, $search_history_db, true, $dbconnection);
|
||||
|
||||
if ($result === false) {
|
||||
return false;
|
||||
|
@ -977,10 +977,10 @@ function oracle_recode_query($sql, $values, $join='AND', $return=true)
|
||||
*
|
||||
* @return the first value of the first row of a table result from query.
|
||||
*/
|
||||
function oracle_db_get_value_sql($sql, $dbconnection=false)
|
||||
function oracle_db_get_value_sql($sql, $dbconnection=false, $search_history_db=false)
|
||||
{
|
||||
$sql = 'SELECT * FROM ('.$sql.') WHERE rownum < 2';
|
||||
$result = oracle_db_get_all_rows_sql($sql, false, true, $dbconnection);
|
||||
$result = oracle_db_get_all_rows_sql($sql, $search_history_db, true, $dbconnection);
|
||||
|
||||
if ($result === false) {
|
||||
return false;
|
||||
|
@ -686,10 +686,10 @@ function postgresql_db_format_array_where_clause_sql($values, $join='AND', $pref
|
||||
*
|
||||
* @return the first value of the first row of a table result from query.
|
||||
*/
|
||||
function postgresql_db_get_value_sql($sql, $dbconnection=false)
|
||||
function postgresql_db_get_value_sql($sql, $dbconnection=false, $search_history_db=false)
|
||||
{
|
||||
$sql .= ' LIMIT 1';
|
||||
$result = postgresql_db_get_all_rows_sql($sql, false, true, $dbconnection);
|
||||
$result = postgresql_db_get_all_rows_sql($sql, $search_history_db, true, $dbconnection);
|
||||
|
||||
if ($result === false) {
|
||||
return false;
|
||||
|
@ -1234,6 +1234,7 @@ function get_event_types($id_type=false)
|
||||
$types['system'] = __('System');
|
||||
$types['error'] = __('Error');
|
||||
$types['configuration_change'] = __('Configuration change');
|
||||
$types['ncm'] = __('Network configuration manager');
|
||||
|
||||
// This types are impersonated by the monitor 'x' types
|
||||
// $types['going_up_normal'] = __('Going Normal');
|
||||
@ -5965,3 +5966,24 @@ function send_test_email(
|
||||
return $result;
|
||||
|
||||
}
|
||||
|
||||
|
||||
if (function_exists('str_contains') === false) {
|
||||
|
||||
|
||||
/**
|
||||
* Checks if $needle is found in $haystack and returns a boolean value.
|
||||
* For lower than PHP8 versions.
|
||||
*
|
||||
* @param string $haystack The string who can have the needle.
|
||||
* @param string $needle The needle.
|
||||
*
|
||||
* @return boolean True if haystack contains the needle.
|
||||
*/
|
||||
function str_contains(string $haystack, string $needle)
|
||||
{
|
||||
return $needle !== '' && mb_strpos($haystack, $needle) !== false;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -162,9 +162,13 @@ function agents_locate_agent(string $field)
|
||||
*
|
||||
* @return array|boolean Agents ids or false if error.
|
||||
*/
|
||||
function agents_get_agent_id_by_alias($alias)
|
||||
function agents_get_agent_id_by_alias($alias, $is_metaconsole=false)
|
||||
{
|
||||
return db_get_all_rows_sql("SELECT id_agente FROM tagente WHERE upper(alias) LIKE upper('%$alias%')");
|
||||
if ($is_metaconsole === true) {
|
||||
return db_get_all_rows_sql("SELECT id_tagente FROM tmetaconsole_agent WHERE upper(alias) LIKE upper('%$alias%')");
|
||||
} else {
|
||||
return db_get_all_rows_sql("SELECT id_agente FROM tagente WHERE upper(alias) LIKE upper('%$alias%')");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -9925,12 +9925,19 @@ function otherParameter2Filter($other, $return_as_array=false, $use_agent_name=f
|
||||
|
||||
if (isset($other['data'][2]) && $other['data'][2] != '') {
|
||||
if ($use_agent_name === false) {
|
||||
$idAgents = agents_get_agent_id_by_alias($other['data'][2]);
|
||||
$idAgents = agents_get_agent_id_by_alias($other['data'][2], is_metaconsole());
|
||||
|
||||
if (!empty($idAgents)) {
|
||||
$idAgent = [];
|
||||
|
||||
$id_agent_field = 'id_agente';
|
||||
|
||||
if (is_metaconsole() === true) {
|
||||
$id_agent_field = 'id_tagente';
|
||||
}
|
||||
|
||||
foreach ($idAgents as $key => $value) {
|
||||
$idAgent[] .= $value['id_agente'];
|
||||
$idAgent[] .= $value[$id_agent_field];
|
||||
}
|
||||
|
||||
$filter[] = 'id_agente IN ('.implode(',', $idAgent).')';
|
||||
@ -9985,6 +9992,10 @@ function otherParameter2Filter($other, $return_as_array=false, $use_agent_name=f
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($idTemplate) && $idTemplate != '') {
|
||||
$filter['id_alert_template'] = $idTemplate;
|
||||
}
|
||||
|
||||
if (isset($other['data'][5]) && $other['data'][5] != '') {
|
||||
$filter['id_usuario'] = $other['data'][5];
|
||||
}
|
||||
@ -11434,7 +11445,7 @@ function get_events_with_user($trash1, $trash2, $other, $returnType, $user_in_db
|
||||
global $config;
|
||||
|
||||
$table_events = 'tevento';
|
||||
if (defined('METACONSOLE')) {
|
||||
if (is_metaconsole() === true) {
|
||||
$table_events = 'tmetaconsole_event';
|
||||
}
|
||||
|
||||
@ -11451,10 +11462,9 @@ function get_events_with_user($trash1, $trash2, $other, $returnType, $user_in_db
|
||||
$event_view_hr = 0;
|
||||
$tag = '';
|
||||
$group_rep = 0;
|
||||
$offset = 0;
|
||||
$pagination = 40;
|
||||
$utimestamp_upper = 0;
|
||||
$utimestamp_bottom = 0;
|
||||
$id_alert_template = -1;
|
||||
|
||||
$use_agent_name = ($other['data'][16] === '1') ? true : false;
|
||||
|
||||
@ -11469,7 +11479,7 @@ function get_events_with_user($trash1, $trash2, $other, $returnType, $user_in_db
|
||||
}
|
||||
|
||||
if (isset($filter['id_agentmodule'])) {
|
||||
$id_agentmodule = $filter['id_agentmodule'];
|
||||
$id_agentmodule = $filter['id_agentmodule'][0];
|
||||
}
|
||||
|
||||
if (isset($filter['id_alert_am'])) {
|
||||
@ -11488,12 +11498,8 @@ function get_events_with_user($trash1, $trash2, $other, $returnType, $user_in_db
|
||||
$search = $filter['evento'];
|
||||
}
|
||||
|
||||
if (isset($filter['limit'])) {
|
||||
$pagination = $filter['limit'];
|
||||
}
|
||||
|
||||
if (isset($filter['offset'])) {
|
||||
$offset = $filter['offset'];
|
||||
if (isset($filter['id_alert_template'])) {
|
||||
$id_alert_template = $filter['id_alert_template'];
|
||||
}
|
||||
|
||||
$id_group = (int) $filter['id_group'];
|
||||
@ -11611,10 +11617,6 @@ function get_events_with_user($trash1, $trash2, $other, $returnType, $user_in_db
|
||||
$sql_post .= ' AND id_agentmodule = '.$id_agentmodule;
|
||||
}
|
||||
|
||||
if ($id_alert_am != -1) {
|
||||
$sql_post .= ' AND id_alert_am = '.$id_alert_am;
|
||||
}
|
||||
|
||||
if ($id_event != -1) {
|
||||
$sql_post .= ' AND id_evento = '.$id_event;
|
||||
}
|
||||
@ -11647,6 +11649,21 @@ function get_events_with_user($trash1, $trash2, $other, $returnType, $user_in_db
|
||||
$sql_post .= ' AND ('.$filter['sql'].') ';
|
||||
}
|
||||
|
||||
// Inject agent ID filter (it is set as the first numeric key in filter array).
|
||||
if (isset($filter[0]) === true) {
|
||||
$sql_post .= ' AND '.$filter[0];
|
||||
}
|
||||
|
||||
if ($id_alert_template !== -1) {
|
||||
$sql_post .= ' AND talert_template_modules.id_alert_template = '.$id_alert_template;
|
||||
}
|
||||
|
||||
$alert_join = '';
|
||||
|
||||
if ($id_alert_template !== -1) {
|
||||
$alert_join = ' INNER JOIN talert_template_modules ON '.$table_events.'.id_alert_am=talert_template_modules.id';
|
||||
}
|
||||
|
||||
if ($group_rep == 0) {
|
||||
switch ($config['dbtype']) {
|
||||
case 'mysql':
|
||||
@ -11661,7 +11678,7 @@ function get_events_with_user($trash1, $trash2, $other, $returnType, $user_in_db
|
||||
ORDER BY criticity DESC
|
||||
LIMIT 1';
|
||||
} else {
|
||||
if (defined('METACONSOLE')) {
|
||||
if (is_metaconsole() === true) {
|
||||
$sql = 'SELECT *,
|
||||
(SELECT t2.nombre
|
||||
FROM tgrupo t2
|
||||
@ -11669,10 +11686,9 @@ function get_events_with_user($trash1, $trash2, $other, $returnType, $user_in_db
|
||||
(SELECT t2.icon
|
||||
FROM tgrupo t2
|
||||
WHERE t2.id_grupo = '.$table_events.'.id_grupo) AS group_icon
|
||||
FROM '.$table_events.'
|
||||
FROM '.$table_events.$alert_join.'
|
||||
WHERE 1=1 '.$sql_post.'
|
||||
ORDER BY utimestamp DESC
|
||||
LIMIT '.$offset.','.$pagination;
|
||||
ORDER BY utimestamp DESC';
|
||||
} else {
|
||||
$sql = 'SELECT *,
|
||||
(SELECT t1.alias
|
||||
@ -11690,10 +11706,9 @@ function get_events_with_user($trash1, $trash2, $other, $returnType, $user_in_db
|
||||
SELECT tagente_modulo.id_modulo
|
||||
FROM tagente_modulo
|
||||
WHERE tagente_modulo.id_agente_modulo=tevento.id_agentmodule)) AS module_name
|
||||
FROM '.$table_events.'
|
||||
FROM '.$table_events.$alert_join.'
|
||||
WHERE 1=1 '.$sql_post.'
|
||||
ORDER BY utimestamp DESC
|
||||
LIMIT '.$offset.','.$pagination;
|
||||
ORDER BY utimestamp DESC';
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -11718,15 +11733,12 @@ function get_events_with_user($trash1, $trash2, $other, $returnType, $user_in_db
|
||||
WHERE tagente_modulo.id_agente_modulo=tevento.id_agentmodule)) AS module_name
|
||||
FROM tevento
|
||||
WHERE 1=1 '.$sql_post.'
|
||||
ORDER BY utimestamp DESC
|
||||
LIMIT '.$pagination.' OFFSET '.$offset;
|
||||
ORDER BY utimestamp DESC';
|
||||
break;
|
||||
|
||||
case 'oracle':
|
||||
// TODO TOTAL
|
||||
$set = [];
|
||||
$set['limit'] = $pagination;
|
||||
$set['offset'] = $offset;
|
||||
|
||||
$sql = 'SELECT *,
|
||||
(SELECT t1.alias
|
||||
@ -11764,8 +11776,7 @@ function get_events_with_user($trash1, $trash2, $other, $returnType, $user_in_db
|
||||
FROM ".$table_events.'
|
||||
WHERE 1=1 '.$sql_post.'
|
||||
GROUP BY evento, id_agentmodule
|
||||
ORDER BY timestamp_rep DESC
|
||||
LIMIT '.$offset.','.$pagination;
|
||||
ORDER BY timestamp_rep DESC';
|
||||
break;
|
||||
|
||||
case 'postgresql':
|
||||
@ -11776,14 +11787,11 @@ function get_events_with_user($trash1, $trash2, $other, $returnType, $user_in_db
|
||||
FROM ".$table_events.'
|
||||
WHERE 1=1 '.$sql_post.'
|
||||
GROUP BY evento, id_agentmodule
|
||||
ORDER BY timestamp_rep DESC
|
||||
LIMIT '.$pagination.' OFFSET '.$offset;
|
||||
ORDER BY timestamp_rep DESC';
|
||||
break;
|
||||
|
||||
case 'oracle':
|
||||
$set = [];
|
||||
$set['limit'] = $pagination;
|
||||
$set['offset'] = $offset;
|
||||
// TODO: Remove duplicate user comments
|
||||
$sql = 'SELECT a.*, b.event_rep, b.timestamp_rep
|
||||
FROM (SELECT *
|
||||
@ -11971,7 +11979,7 @@ function api_set_event($id_event, $unused1, $params, $unused2, $unused3)
|
||||
* @param $returnType
|
||||
* @param $user_in_db
|
||||
*/
|
||||
function api_get_events($trash1, $trash2, $other, $returnType, $user_in_db=null)
|
||||
function api_get_events($node_id, $trash2, $other, $returnType, $user_in_db=null)
|
||||
{
|
||||
if ($user_in_db !== null) {
|
||||
$correct = get_events_with_user(
|
||||
@ -12016,6 +12024,10 @@ function api_get_events($trash1, $trash2, $other, $returnType, $user_in_db=null)
|
||||
}
|
||||
|
||||
if (is_metaconsole()) {
|
||||
if ((int) $node_id !== 0) {
|
||||
$filterString .= ' AND server_id = '.$node_id;
|
||||
}
|
||||
|
||||
$dataRows = db_get_all_rows_filter('tmetaconsole_event', $filterString);
|
||||
} else {
|
||||
$dataRows = db_get_all_rows_filter('tevento', $filterString);
|
||||
@ -15159,12 +15171,24 @@ function api_set_add_cluster_item($thrash1, $thrash2, $other, $thrash3)
|
||||
}
|
||||
|
||||
if ($element['type'] == 'AA') {
|
||||
$id_agent = db_get_value_sql('SELECT id_agent FROM tcluster WHERE id = '.$element['id_cluster']);
|
||||
|
||||
$module_exists_sql = sprintf(
|
||||
'SELECT id_agente_modulo FROM tagente_modulo tam INNER JOIN tcluster_agent tca WHERE tam.id_agente=tca.id_agent AND tca.id_cluster=%d AND tam.nombre="%s"',
|
||||
$element['id_cluster'],
|
||||
io_safe_input($element['name'])
|
||||
);
|
||||
|
||||
$module_exists = db_process_sql($module_exists_sql);
|
||||
|
||||
if ($module_exists === false) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$tcluster_module = db_process_sql_insert('tcluster_item', ['name' => io_safe_input($element['name']), 'id_cluster' => $element['id_cluster'], 'critical_limit' => $element['critical_limit'], 'warning_limit' => $element['warning_limit']]);
|
||||
|
||||
$id_agent = db_process_sql('select id_agent from tcluster where id = '.$element['id_cluster']);
|
||||
|
||||
$id_parent_modulo = db_process_sql(
|
||||
'select id_agente_modulo from tagente_modulo where id_agente = '.$id_agent[0]['id_agent'].' and nombre = "'.io_safe_input('Cluster status').'"'
|
||||
'select id_agente_modulo from tagente_modulo where id_agente = '.$id_agent.' and nombre = "'.io_safe_input('Cluster status').'"'
|
||||
);
|
||||
|
||||
$get_module_type = db_process_sql('select id_tipo_modulo,descripcion,min_warning,min_critical,module_interval from tagente_modulo where nombre = "'.io_safe_input($element['name']).'" limit 1');
|
||||
@ -15179,7 +15203,7 @@ function api_set_add_cluster_item($thrash1, $thrash2, $other, $thrash3)
|
||||
'nombre' => io_safe_input($element['name']),
|
||||
'id_modulo' => 0,
|
||||
'prediction_module' => 6,
|
||||
'id_agente' => $id_agent[0]['id_agent'],
|
||||
'id_agente' => $id_agent,
|
||||
'parent_module_id' => $id_parent_modulo[0]['id_agente_modulo'],
|
||||
'custom_integer_1' => $element['id_cluster'],
|
||||
'custom_integer_2' => $tcluster_module,
|
||||
@ -15203,15 +15227,27 @@ function api_set_add_cluster_item($thrash1, $thrash2, $other, $thrash3)
|
||||
db_pandora_audit('Report management', 'Failed to assign AA item module to cluster '.$element['name']);
|
||||
}
|
||||
} else if ($element['type'] == 'AP') {
|
||||
$id_agent = db_process_sql('select id_agent from tcluster where id = '.$element['id_cluster']);
|
||||
$id_agent = db_get_value_sql('SELECT id_agent FROM tcluster WHERE id = '.$element['id_cluster']);
|
||||
|
||||
$id_parent_modulo = db_process_sql(
|
||||
'select id_agente_modulo from tagente_modulo where id_agente = '.$id_agent[0]['id_agent'].' and nombre = "'.io_safe_input('Cluster status').'"'
|
||||
$module_exists_sql = sprintf(
|
||||
'SELECT id_agente_modulo FROM tagente_modulo tam INNER JOIN tcluster_agent tca WHERE tam.id_agente=tca.id_agent AND tca.id_cluster=%d AND tam.nombre="%s"',
|
||||
$element['id_cluster'],
|
||||
io_safe_input($element['name'])
|
||||
);
|
||||
|
||||
$tcluster_balanced_module = db_process_sql_insert('tcluster_item', ['name' => $element['name'], 'id_cluster' => $element['id_cluster'], 'item_type' => 'AP', 'is_critical' => $element['is_critical']]);
|
||||
$module_exists = db_process_sql($module_exists_sql);
|
||||
|
||||
$get_module_type = db_process_sql('select id_tipo_modulo,descripcion,min_warning,min_critical,module_interval from tagente_modulo where nombre = "'.io_safe_input($element['name']).'" limit 1');
|
||||
if ($module_exists === false) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$id_parent_modulo = db_process_sql(
|
||||
'select id_agente_modulo from tagente_modulo where id_agente = '.$id_agent.' and nombre = "'.io_safe_input('Cluster status').'"'
|
||||
);
|
||||
|
||||
$tcluster_balanced_module = db_process_sql_insert('tcluster_item', ['name' => io_safe_input($element['name']), 'id_cluster' => $element['id_cluster'], 'item_type' => 'AP', 'is_critical' => $element['is_critical']]);
|
||||
|
||||
$get_module_type = db_process_sql('select id_tipo_modulo,descripcion,min_warning,min_critical,module_interval,ip_target,id_module_group from tagente_modulo where nombre = "'.io_safe_input($element['name']).'" limit 1');
|
||||
|
||||
$get_module_type_value = $get_module_type[0]['id_tipo_modulo'];
|
||||
$get_module_description_value = $get_module_type[0]['descripcion'];
|
||||
@ -15220,33 +15256,28 @@ function api_set_add_cluster_item($thrash1, $thrash2, $other, $thrash3)
|
||||
$get_module_interval_value = $get_module_type[0]['module_interval'];
|
||||
$get_module_type_nombre = db_process_sql('select nombre from ttipo_modulo where id_tipo = '.$get_module_type_value);
|
||||
$get_module_type_nombre_value = $get_module_type_nombre[0]['nombre'];
|
||||
|
||||
if (strpos($get_module_type_nombre_value, 'inc') != false) {
|
||||
$get_module_type_value_normal = 4;
|
||||
} else if (strpos($get_module_type_nombre_value, 'proc') != false) {
|
||||
$get_module_type_value_normal = 2;
|
||||
} else if (strpos($get_module_type_nombre_value, 'data') != false) {
|
||||
$get_module_type_value_normal = 1;
|
||||
} else if (strpos($get_module_type_nombre_value, 'string') != false) {
|
||||
$get_module_type_value_normal = 3;
|
||||
} else {
|
||||
$get_module_type_value_normal = 1;
|
||||
}
|
||||
$get_module_ip_target = $get_module_type[0]['ip_target'];
|
||||
$get_module_id_module_group = $get_module_type[0]['id_module_group'];
|
||||
$get_module_id_flag = $get_module_type[0]['flag'];
|
||||
$get_module_dynamic_two_tailed = $get_module_type[0]['dynamic_two_tailed'];
|
||||
|
||||
$values_module = [
|
||||
'nombre' => $element['name'],
|
||||
'id_modulo' => 5,
|
||||
'id_modulo' => 0,
|
||||
'prediction_module' => 7,
|
||||
'id_agente' => $id_agent[0]['id_agent'],
|
||||
'id_agente' => $id_agent,
|
||||
'parent_module_id' => $id_parent_modulo[0]['id_agente_modulo'],
|
||||
'custom_integer_1' => $element['id_cluster'],
|
||||
'custom_integer_2' => $tcluster_balanced_module,
|
||||
'id_tipo_modulo' => $get_module_type_value_normal,
|
||||
'id_tipo_modulo' => 1,
|
||||
'descripcion' => $get_module_description_value,
|
||||
'min_warning' => $get_module_warning_value,
|
||||
'min_critical' => $get_module_critical_value,
|
||||
'tcp_port' => $element['is_critical'],
|
||||
'module_interval' => $get_module_interval_value,
|
||||
'ip_target' => $get_module_ip_target,
|
||||
'tcp_port' => 1,
|
||||
'id_module_group' => $get_module_id_module_group,
|
||||
];
|
||||
|
||||
$id_module = modules_create_agent_module($values_module['id_agente'], $values_module['nombre'], $values_module, true);
|
||||
|
@ -414,21 +414,21 @@ function db_get_value_filter($field, $table, $filter, $where_join='AND', $search
|
||||
*
|
||||
* @return mixed the first value of the first row of a table result from query.
|
||||
*/
|
||||
function db_get_value_sql($sql, $dbconnection=false)
|
||||
function db_get_value_sql($sql, $dbconnection=false, $search_history_db=false)
|
||||
{
|
||||
global $config;
|
||||
|
||||
switch ($config['dbtype']) {
|
||||
case 'mysql':
|
||||
return mysql_db_get_value_sql($sql, $dbconnection);
|
||||
return mysql_db_get_value_sql($sql, $dbconnection, $search_history_db);
|
||||
|
||||
break;
|
||||
case 'postgresql':
|
||||
return postgresql_db_get_value_sql($sql, $dbconnection);
|
||||
return postgresql_db_get_value_sql($sql, $dbconnection, $search_history_db);
|
||||
|
||||
break;
|
||||
case 'oracle':
|
||||
return oracle_db_get_value_sql($sql, $dbconnection);
|
||||
return oracle_db_get_value_sql($sql, $dbconnection, $search_history_db);
|
||||
|
||||
break;
|
||||
}
|
||||
|
@ -3248,6 +3248,10 @@ function events_get_event_types($type_id)
|
||||
$type_desc = __('Not normal');
|
||||
break;
|
||||
|
||||
case 'ncm':
|
||||
$type_desc = __('Network configuration manager');
|
||||
break;
|
||||
|
||||
default:
|
||||
if (isset($config['text_char_long'])) {
|
||||
foreach ($diferent_types as $key => $type) {
|
||||
|
@ -609,24 +609,15 @@ function groups_get_groups_tree_recursive($groups, $trash=0, $trash2=0)
|
||||
*
|
||||
* @return integer Status of the agents.
|
||||
*/
|
||||
function groups_get_status($id_group=0, $strict_user=false)
|
||||
function groups_get_status($id_group=0, $ignore_alerts=false)
|
||||
{
|
||||
global $config;
|
||||
|
||||
include_once $config['homedir'].'/include/functions_reporting.php';
|
||||
|
||||
if ($strict_user) {
|
||||
$acltags = tags_get_user_groups_and_tags($config['id_user'], 'AR', $strict_user);
|
||||
$group_status = group_get_data($config['id_user'], $strict_user, $acltags, false, 'group');
|
||||
$data['monitor_alerts_fired'] = $groups_status['_monitors_alerts_fired_'];
|
||||
$data['agent_critical'] = $groups_status['_agents_critical_'];
|
||||
$data['agent_warning'] = $groups_status['_agents_warning_'];
|
||||
$data['agent_unknown'] = $groups_status['_agents_unknown_'];
|
||||
} else {
|
||||
$data = reporting_get_group_stats_resume($id_group);
|
||||
}
|
||||
$data = reporting_get_group_stats_resume($id_group);
|
||||
|
||||
if ($data['monitor_alerts_fired'] > 0) {
|
||||
if ($data['monitor_alerts_fired'] > 0 && $ignore_alerts == false) {
|
||||
return AGENT_STATUS_ALERT_FIRED;
|
||||
} else if ($data['agent_critical'] > 0) {
|
||||
return AGENT_STATUS_CRITICAL;
|
||||
@ -991,31 +982,31 @@ function groups_get_agents_counter($group, $agent_filter=[], $module_filter=[],
|
||||
switch ($agent_status) {
|
||||
case AGENT_STATUS_CRITICAL:
|
||||
if ($critical > 0) {
|
||||
$count ++;
|
||||
$count++;
|
||||
}
|
||||
break;
|
||||
|
||||
case AGENT_STATUS_WARNING:
|
||||
if (($total > 0) && ($critical == 0) && ($warning > 0)) {
|
||||
$count ++;
|
||||
$count++;
|
||||
}
|
||||
break;
|
||||
|
||||
case AGENT_STATUS_UNKNOWN:
|
||||
if ($critical == 0 && $warning == 0 && $unknown > 0) {
|
||||
$count ++;
|
||||
$count++;
|
||||
}
|
||||
break;
|
||||
|
||||
case AGENT_STATUS_NOT_INIT:
|
||||
if ($total == 0 || $total == $not_init) {
|
||||
$count ++;
|
||||
$count++;
|
||||
}
|
||||
break;
|
||||
|
||||
case AGENT_STATUS_NORMAL:
|
||||
if ($critical == 0 && $warning == 0 && $unknown == 0 && $normal > 0) {
|
||||
$count ++;
|
||||
$count++;
|
||||
}
|
||||
break;
|
||||
|
||||
@ -1026,23 +1017,23 @@ function groups_get_agents_counter($group, $agent_filter=[], $module_filter=[],
|
||||
} else {
|
||||
if (array_search(AGENT_STATUS_CRITICAL, $agent_status) !== false) {
|
||||
if ($critical > 0) {
|
||||
$count ++;
|
||||
$count++;
|
||||
}
|
||||
} else if (array_search(AGENT_STATUS_WARNING, $agent_status) !== false) {
|
||||
if ($total > 0 && $critical = 0 && $warning > 0) {
|
||||
$count ++;
|
||||
$count++;
|
||||
}
|
||||
} else if (array_search(AGENT_STATUS_UNKNOWN, $agent_status) !== false) {
|
||||
if ($critical == 0 && $warning == 0 && $unknown > 0) {
|
||||
$count ++;
|
||||
$count++;
|
||||
}
|
||||
} else if (array_search(AGENT_STATUS_NOT_INIT, $agent_status) !== false) {
|
||||
if ($total == 0 || $total == $not_init) {
|
||||
$count ++;
|
||||
$count++;
|
||||
}
|
||||
} else if (array_search(AGENT_STATUS_NORMAL, $agent_status) !== false) {
|
||||
if ($critical == 0 && $warning == 0 && $unknown == 0 && $normal > 0) {
|
||||
$count ++;
|
||||
$count++;
|
||||
}
|
||||
}
|
||||
// Invalid status
|
||||
|
@ -1181,6 +1181,7 @@ function html_print_select_multiple_filtered(
|
||||
) {
|
||||
$output .= '<div class="item-filter flex-row-vcenter">';
|
||||
|
||||
$output .= '<div style="display:none">';
|
||||
$output .= html_print_input(
|
||||
[
|
||||
'style' => 'display:none;',
|
||||
@ -1190,6 +1191,7 @@ function html_print_select_multiple_filtered(
|
||||
'return' => true,
|
||||
]
|
||||
);
|
||||
$output .= '</div>';
|
||||
|
||||
$f = "filterAvailableItems(this.value,'".$rid."','".__('None')."')";
|
||||
$output .= html_print_input(
|
||||
@ -1312,7 +1314,7 @@ function html_print_select_multiple_filtered(
|
||||
'input_class' => 'flex-row-vcenter',
|
||||
'label' => __('Group recursion'),
|
||||
'name' => 'id-group-recursion-selected-select-'.$rid,
|
||||
'type' => 'checkbox',
|
||||
'type' => 'switch',
|
||||
'script' => $reload_content,
|
||||
'return' => true,
|
||||
]
|
||||
@ -1329,6 +1331,8 @@ function html_print_select_multiple_filtered(
|
||||
) {
|
||||
$output .= '<div class="item-filter flex-row-vcenter">';
|
||||
|
||||
$output .= '<div style="display:none">';
|
||||
|
||||
$output .= html_print_input(
|
||||
[
|
||||
'style' => 'display:none;',
|
||||
@ -1338,6 +1342,7 @@ function html_print_select_multiple_filtered(
|
||||
'return' => true,
|
||||
]
|
||||
);
|
||||
$output .= '</div>';
|
||||
|
||||
$f = "filterSelectedItems(this.value,'".$rid."','".__('None')."')";
|
||||
$output .= html_print_input(
|
||||
@ -2430,6 +2435,38 @@ function html_print_div(
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Render an <pre> tag for show code.
|
||||
* For debug purposes, see for `hd()` function.
|
||||
*
|
||||
* @param string $content Content of tag.
|
||||
* @param boolean $return Return the tag string formed.
|
||||
* @param array $attributes Attributes availables for pre tags.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function html_print_code(
|
||||
string $content,
|
||||
bool $return=true,
|
||||
array $attributes=[]
|
||||
) {
|
||||
$output = '<pre';
|
||||
if (empty($attributes) === false) {
|
||||
foreach ($attributes as $attribute => $value) {
|
||||
$output .= ' '.$attribute.'="'.io_safe_input_html($value).'"';
|
||||
}
|
||||
}
|
||||
|
||||
$output .= sprintf('>%s</pre>', $content);
|
||||
|
||||
if ($return === true) {
|
||||
return $output;
|
||||
} else {
|
||||
echo $output;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Render an anchor <a> html element.
|
||||
*
|
||||
@ -4096,6 +4133,10 @@ function html_print_input_file($name, $return=false, $options=false)
|
||||
if (isset($options['required'])) {
|
||||
$output .= ' required';
|
||||
}
|
||||
|
||||
if (isset($options['onchange'])) {
|
||||
$output .= ' onchange="'.$options['onchange'].'"';
|
||||
}
|
||||
}
|
||||
|
||||
$output .= ' />';
|
||||
@ -4488,7 +4529,7 @@ function html_print_switch($attributes=[])
|
||||
|
||||
$disabled_class = (bool) ($attributes['disabled']) ? ' p-slider-disabled' : '';
|
||||
|
||||
return "<label class='p-switch' style='".$attributes['style']."'>
|
||||
return "<label class='p-switch ".$attributes['container-class']."' style='".$attributes['style']."'>
|
||||
<input type='checkbox' ".$html_expand.">
|
||||
<span class='p-slider".$disabled_class."'></span>
|
||||
</label>";
|
||||
|
@ -158,35 +158,86 @@ function integria_api_call($api_hostname=null, $user=null, $user_pass=null, $api
|
||||
{
|
||||
global $config;
|
||||
|
||||
if ($user_level_conf === null) {
|
||||
$user_level_conf = (bool) $config['integria_user_level_conf'];
|
||||
}
|
||||
if (is_metaconsole()) {
|
||||
$servers = metaconsole_get_connection_names();
|
||||
foreach ($servers as $key => $server) {
|
||||
$connection = metaconsole_get_connection($server);
|
||||
if (metaconsole_connect($connection) != NOERR) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$user_info = users_get_user_by_id($config['id_user']);
|
||||
$integria_enabled = db_get_sql(
|
||||
'SELECT `value` FROM tconfig WHERE `token` = "integria_enabled"'
|
||||
);
|
||||
|
||||
// API access data.
|
||||
if ($api_hostname === null) {
|
||||
$api_hostname = $config['integria_hostname'];
|
||||
}
|
||||
if (!$integria_enabled) {
|
||||
metaconsole_restore_db();
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($api_pass === null) {
|
||||
$api_pass = $config['integria_api_pass'];
|
||||
}
|
||||
// integria_user_level_conf, integria_hostname, integria_api_pass, integria_user, integria_user_level_user, integria_pass, integria_user_level_pass
|
||||
$config_aux = db_get_all_rows_sql('SELECT `token`, `value` FROM `tconfig` WHERE `token` IN ("integria_user_level_conf", "integria_hostname", "integria_api_pass", "integria_user", "integria_user_level_user", "integria_pass", "integria_user_level_pass")');
|
||||
$user_info = users_get_user_by_id($config['id_user']);
|
||||
foreach ($config_aux as $key => $conf) {
|
||||
if ($conf['token'] === 'integria_user_level_conf') {
|
||||
$user_level_conf = $conf['value'];
|
||||
}
|
||||
|
||||
// Integria user and password.
|
||||
if ($user === null || $user_level_conf === true) {
|
||||
$user = $config['integria_user'];
|
||||
if ($conf['token'] === 'integria_hostname') {
|
||||
$api_hostname = $conf['value'];
|
||||
}
|
||||
|
||||
if ($user_level_conf === true) {
|
||||
$user = $user_info['integria_user_level_user'];
|
||||
if ($conf['token'] === 'integria_api_pass') {
|
||||
$api_pass = $conf['value'];
|
||||
}
|
||||
|
||||
if ($conf['token'] === 'integria_user') {
|
||||
$user = $conf['value'];
|
||||
}
|
||||
|
||||
if ($conf['token'] === 'integria_pass') {
|
||||
$user_pass = $conf['value'];
|
||||
}
|
||||
}
|
||||
|
||||
if ($user_level_conf == true) {
|
||||
$user = $user_info['integria_user_level_user'];
|
||||
$user_pass = $user_info['integria_user_level_pass'];
|
||||
}
|
||||
|
||||
metaconsole_restore_db();
|
||||
}
|
||||
} else {
|
||||
if ($user_level_conf === null) {
|
||||
$user_level_conf = (bool) $config['integria_user_level_conf'];
|
||||
}
|
||||
}
|
||||
|
||||
if ($user_pass === null || $user_level_conf === true) {
|
||||
$user_pass = $config['integria_pass'];
|
||||
$user_info = users_get_user_by_id($config['id_user']);
|
||||
|
||||
if ($user_level_conf === true) {
|
||||
$user_pass = $user_info['integria_user_level_pass'];
|
||||
// API access data.
|
||||
if ($api_hostname === null) {
|
||||
$api_hostname = $config['integria_hostname'];
|
||||
}
|
||||
|
||||
if ($api_pass === null) {
|
||||
$api_pass = $config['integria_api_pass'];
|
||||
}
|
||||
|
||||
// Integria user and password.
|
||||
if ($user === null || $user_level_conf === true) {
|
||||
$user = $config['integria_user'];
|
||||
|
||||
if ($user_level_conf === true) {
|
||||
$user = $user_info['integria_user_level_user'];
|
||||
}
|
||||
}
|
||||
|
||||
if ($user_pass === null || $user_level_conf === true) {
|
||||
$user_pass = $config['integria_pass'];
|
||||
|
||||
if ($user_level_conf === true) {
|
||||
$user_pass = $user_info['integria_user_level_pass'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -545,11 +545,12 @@ function io_input_password($password)
|
||||
* Process the given password read from the Pandora FMS Database,
|
||||
* decrypting it if necessary.
|
||||
*
|
||||
* @param string password Password read from the DB.
|
||||
* @param string $password Password read from the DB.
|
||||
* @param string $wrappedBy Wrap the password with the informed character.
|
||||
*
|
||||
* @return string The processed password.
|
||||
*/
|
||||
function io_output_password($password)
|
||||
function io_output_password($password, $wrappedBy='')
|
||||
{
|
||||
global $config;
|
||||
|
||||
@ -562,11 +563,14 @@ function io_output_password($password)
|
||||
]
|
||||
);
|
||||
|
||||
if ($plaintext === ENTERPRISE_NOT_HOOK) {
|
||||
return io_safe_output($password);
|
||||
}
|
||||
$output = ($plaintext === ENTERPRISE_NOT_HOOK) ? $password : $plaintext;
|
||||
|
||||
return io_safe_output($plaintext);
|
||||
return sprintf(
|
||||
'%s%s%s',
|
||||
$wrappedBy,
|
||||
io_safe_output($output),
|
||||
$wrappedBy
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
@ -880,6 +880,14 @@ function reporting_make_reporting_data(
|
||||
);
|
||||
break;
|
||||
|
||||
case 'ncm':
|
||||
$report['contents'][] = reporting_ncm_config(
|
||||
$report,
|
||||
$content,
|
||||
$pdf
|
||||
);
|
||||
break;
|
||||
|
||||
default:
|
||||
// Default.
|
||||
break;
|
||||
@ -8767,6 +8775,8 @@ function reporting_increment($report, $content)
|
||||
|
||||
$return['data'] = [];
|
||||
|
||||
$search_in_history_db = db_search_in_history_db($return['from']);
|
||||
|
||||
if (is_metaconsole()) {
|
||||
$sql1 = 'SELECT datos FROM tagente_datos WHERE id_agente_modulo = '.$id_agent_module.'
|
||||
AND utimestamp <= '.(time() - $period).' ORDER BY utimestamp DESC';
|
||||
@ -8793,17 +8803,23 @@ function reporting_increment($report, $content)
|
||||
$connection = false;
|
||||
}
|
||||
|
||||
$old_data = db_get_value_sql($sql1);
|
||||
$old_data = db_get_value_sql($sql1, false, $search_in_history_db);
|
||||
|
||||
$last_data = db_get_value_sql($sql2);
|
||||
$last_data = db_get_value_sql($sql2, false, $search_in_history_db);
|
||||
}
|
||||
} else {
|
||||
$old_data = db_get_value_sql(
|
||||
'SELECT datos FROM tagente_datos WHERE id_agente_modulo = '.$id_agent_module.'
|
||||
AND utimestamp <= '.(time() - $period).' ORDER BY utimestamp DESC'
|
||||
AND utimestamp <= '.(time() - $period).' ORDER BY utimestamp DESC',
|
||||
false,
|
||||
$search_in_history_db
|
||||
);
|
||||
|
||||
$last_data = db_get_value_sql('SELECT datos FROM tagente_datos WHERE id_agente_modulo = '.$id_agent_module.' ORDER BY utimestamp DESC');
|
||||
$last_data = db_get_value_sql(
|
||||
'SELECT datos FROM tagente_datos WHERE id_agente_modulo = '.$id_agent_module.' ORDER BY utimestamp DESC',
|
||||
false,
|
||||
$search_in_history_db
|
||||
);
|
||||
}
|
||||
|
||||
if (!is_metaconsole()) {
|
||||
@ -9366,7 +9382,7 @@ function reporting_custom_graph(
|
||||
$modules = [];
|
||||
foreach ($module_source as $key => $value) {
|
||||
$modules[$key]['module'] = $value['id_agent_module'];
|
||||
$modules[$key]['server'] = $value['id_server'];
|
||||
$modules[$key]['id_server'] = $value['id_server'];
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -9809,19 +9825,21 @@ function reporting_set_conf_charts(
|
||||
$content,
|
||||
&$ttl
|
||||
) {
|
||||
global $config;
|
||||
|
||||
switch ($type) {
|
||||
case 'dinamic':
|
||||
default:
|
||||
$only_image = false;
|
||||
$width = 900;
|
||||
$height = isset($content['style']['dyn_height']) ? $content['style']['dyn_height'] : 230;
|
||||
$height = isset($content['style']['dyn_height']) ? $content['style']['dyn_height'] : $config['graph_image_height'];
|
||||
$ttl = 1;
|
||||
break;
|
||||
|
||||
case 'static':
|
||||
$ttl = 2;
|
||||
$only_image = true;
|
||||
$height = isset($content['style']['dyn_height']) ? $content['style']['dyn_height'] : 230;
|
||||
$height = isset($content['style']['dyn_height']) ? $content['style']['dyn_height'] : $config['graph_image_height'];
|
||||
$width = 650;
|
||||
break;
|
||||
|
||||
|
@ -441,6 +441,10 @@ function reporting_html_print_report($report, $mini=false, $report_info=1)
|
||||
$mini
|
||||
);
|
||||
break;
|
||||
|
||||
case 'ncm':
|
||||
reporting_html_ncm_config($table, $item);
|
||||
break;
|
||||
}
|
||||
|
||||
if ($item['type'] == 'agent_module') {
|
||||
@ -5342,7 +5346,7 @@ function reporting_get_agents_by_status($data, $graph_width=250, $graph_height=1
|
||||
|
||||
$agent_data = [];
|
||||
$agent_data[0] = html_print_image('images/agent_notinit.png', true, ['title' => __('Agents not init')]);
|
||||
$agent_data[1] = "<a style='color: ".COL_NOTINIT.";' href='".$links['agents_not_init']."'><b><span class='blue_color_ligther font_12pt bolder big_data'>".format_numeric($data['agent_not_init']).'</span></b></a>';
|
||||
$agent_data[1] = "<a style='color: ".COL_NOTINIT.";' href='".$links['agents_not_init']."'><b><span class='blue_color font_12pt bolder big_data'>".format_numeric($data['agent_not_init']).'</span></b></a>';
|
||||
|
||||
$agent_data[2] = '';
|
||||
$agent_data[3] = '';
|
||||
@ -6076,3 +6080,43 @@ function reporting_html_permissions($table, $item, $pdf=0)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* HTML content for ncm configuration diff report.
|
||||
*
|
||||
* @param array $item Content generated by reporting_ncm_config.
|
||||
*
|
||||
* @return string HTML code.
|
||||
*/
|
||||
function reporting_html_ncm_config($table, $item, $pdf=0)
|
||||
{
|
||||
$key = uniqid();
|
||||
if ($pdf === 0) {
|
||||
ui_require_javascript_file('diff2html-ui.min');
|
||||
ui_require_css_file('diff2html.min');
|
||||
$script = "$(document).ready(function() {
|
||||
const configuration = {
|
||||
drawFileList: false,
|
||||
collapsed: true,
|
||||
matching: 'lines',
|
||||
outputFormat: 'side-by-side',
|
||||
};
|
||||
const diff2htmlUi = new Diff2HtmlUI(
|
||||
document.getElementById('".$key."'),
|
||||
atob('".base64_encode($item['data'])."'),
|
||||
configuration
|
||||
);
|
||||
diff2htmlUi.draw();
|
||||
});";
|
||||
$content = '<div class="w100p" id="'.$key.'"></div class="w100p">';
|
||||
$content .= '<script>'.$script.'</script>';
|
||||
$table->data[1] = $content;
|
||||
$table->colspan[1][0] = 2;
|
||||
} else {
|
||||
$content = '<div style="text-align:left;margin-left: 14px;">';
|
||||
$content .= str_replace("\n", '<br>', $item['data']);
|
||||
$content .= '</div>';
|
||||
return $content;
|
||||
}
|
||||
}
|
||||
|
@ -917,6 +917,11 @@ function reports_get_report_types($template=false, $not_editor=false)
|
||||
];
|
||||
}
|
||||
|
||||
$types['ncm'] = [
|
||||
'optgroup' => __('NCM'),
|
||||
'name' => __('Network configuration changes'),
|
||||
];
|
||||
|
||||
return $types;
|
||||
}
|
||||
|
||||
|
@ -1347,7 +1347,16 @@ function servers_get_server_string_name(int $server)
|
||||
return __('WUX server');
|
||||
|
||||
case SERVER_TYPE_ENTERPRISE_SATELLITE:
|
||||
return __('Satellite');
|
||||
return __('Satellite server');
|
||||
|
||||
case SERVER_TYPE_ENTERPRISE_TRANSACTIONAL:
|
||||
return __('Transactional server');
|
||||
|
||||
case SERVER_TYPE_ALERT:
|
||||
return __('Alert server');
|
||||
|
||||
case SERVER_TYPE_NCM:
|
||||
return __('NCM server');
|
||||
|
||||
default:
|
||||
return __('N/A');
|
||||
|
@ -794,7 +794,7 @@ function tags_get_acl_tags(
|
||||
|
||||
$acltags = [];
|
||||
foreach ($raw_acltags as $group => $taglist) {
|
||||
if (!empty($id_group) && !in_array($group, $id_group)) {
|
||||
if (empty($id_group) === false && array_key_exists($group, $id_group) === false) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -1627,31 +1627,31 @@ function tags_get_agents_counter($id_tag, $groups_and_tags=[], $agent_filter=[],
|
||||
switch ($agent_status) {
|
||||
case AGENT_STATUS_CRITICAL:
|
||||
if ($critical > 0) {
|
||||
$count ++;
|
||||
$count++;
|
||||
}
|
||||
break;
|
||||
|
||||
case AGENT_STATUS_WARNING:
|
||||
if ($total > 0 && $critical = 0 && $warning > 0) {
|
||||
$count ++;
|
||||
$count++;
|
||||
}
|
||||
break;
|
||||
|
||||
case AGENT_STATUS_UNKNOWN:
|
||||
if ($critical == 0 && $warning == 0 && $unknown > 0) {
|
||||
$count ++;
|
||||
$count++;
|
||||
}
|
||||
break;
|
||||
|
||||
case AGENT_STATUS_NOT_INIT:
|
||||
if ($total == 0 || $total == $not_init) {
|
||||
$count ++;
|
||||
$count++;
|
||||
}
|
||||
break;
|
||||
|
||||
case AGENT_STATUS_NORMAL:
|
||||
if ($critical == 0 && $warning == 0 && $unknown == 0 && $normal > 0) {
|
||||
$count ++;
|
||||
$count++;
|
||||
}
|
||||
break;
|
||||
|
||||
@ -1662,23 +1662,23 @@ function tags_get_agents_counter($id_tag, $groups_and_tags=[], $agent_filter=[],
|
||||
} else {
|
||||
if (array_search(AGENT_STATUS_CRITICAL, $agent_status) !== false) {
|
||||
if ($critical > 0) {
|
||||
$count ++;
|
||||
$count++;
|
||||
}
|
||||
} else if (array_search(AGENT_STATUS_WARNING, $agent_status) !== false) {
|
||||
if ($total > 0 && $critical = 0 && $warning > 0) {
|
||||
$count ++;
|
||||
$count++;
|
||||
}
|
||||
} else if (array_search(AGENT_STATUS_UNKNOWN, $agent_status) !== false) {
|
||||
if ($critical == 0 && $warning == 0 && $unknown > 0) {
|
||||
$count ++;
|
||||
$count++;
|
||||
}
|
||||
} else if (array_search(AGENT_STATUS_NOT_INIT, $agent_status) !== false) {
|
||||
if ($total == 0 || $total == $not_init) {
|
||||
$count ++;
|
||||
$count++;
|
||||
}
|
||||
} else if (array_search(AGENT_STATUS_NORMAL, $agent_status) !== false) {
|
||||
if ($critical == 0 && $warning == 0 && $unknown == 0 && $normal > 0) {
|
||||
$count ++;
|
||||
$count++;
|
||||
}
|
||||
}
|
||||
// Invalid status.
|
||||
|
@ -2748,7 +2748,8 @@ function ui_print_module_status(
|
||||
|
||||
$output = '<div style="background: '.$color;
|
||||
$output .= '" class="'.$class;
|
||||
$output .= '" title="'.$title.'"></div>';
|
||||
$output .= ' forced_title" data-title="'.$title.'" title="';
|
||||
$output .= $title.'" data-use_title_for_force_title="1"></div>';
|
||||
|
||||
if ($return === false) {
|
||||
echo $output;
|
||||
|
@ -2850,9 +2850,6 @@ function get_donut_module_data($id_module)
|
||||
foreach ($values as $val) {
|
||||
if ($index < $max_elements) {
|
||||
$data = explode(',', $val);
|
||||
if ($data[1] == 0) {
|
||||
$data[1] = __('No data');
|
||||
}
|
||||
|
||||
if ($no_data_to_show) {
|
||||
$values_to_return[$index]['tag_name'] = $data[0];
|
||||
@ -2865,10 +2862,6 @@ function get_donut_module_data($id_module)
|
||||
$total += (int) $data[1];
|
||||
$index++;
|
||||
} else {
|
||||
if ($data[1] == 0) {
|
||||
$data[1] = __('No data');
|
||||
}
|
||||
|
||||
$data = explode(',', $val);
|
||||
$values_to_return[$index]['tag_name'] = __('Others').': '.$data[1];
|
||||
$values_to_return[$index]['color'] = $colors[$index];
|
||||
@ -2881,6 +2874,7 @@ function get_donut_module_data($id_module)
|
||||
$values_to_return[$ind]['percent'] = (($donut_data['value'] * 100) / $total);
|
||||
}
|
||||
|
||||
// sort array
|
||||
$new_values_to_return = [];
|
||||
while (!empty($values_to_return)) {
|
||||
$first = true;
|
||||
@ -3426,7 +3420,7 @@ function visual_map_get_status_element($layoutData)
|
||||
break;
|
||||
|
||||
case GROUP_ITEM:
|
||||
$group_status = groups_get_status($layoutData['id_group']);
|
||||
$group_status = groups_get_status($layoutData['id_group'], true);
|
||||
|
||||
switch ($group_status) {
|
||||
case AGENT_STATUS_ALERT_FIRED:
|
||||
|
@ -335,7 +335,7 @@ function pandoraFlotHBars(
|
||||
"#e63c52",
|
||||
"#FFA631",
|
||||
"#f3b200",
|
||||
"#5BB6E5",
|
||||
"#4a83f3",
|
||||
"#F2919D",
|
||||
"#82b92e"
|
||||
];
|
||||
@ -437,25 +437,23 @@ function pandoraFlotHBars(
|
||||
var format = new Array();
|
||||
for (var i = 0; i < labels_total.length; i++) {
|
||||
var label = labels_total[i][1];
|
||||
// var shortLabel = reduceText(label, 25);
|
||||
var title = label;
|
||||
if (label.length > 30) {
|
||||
label = reduceText(label, 30);
|
||||
}
|
||||
var div_attributes =
|
||||
'style="font-size:' +
|
||||
font_size +
|
||||
"pt !important;" +
|
||||
" margin: 0; max-width: 150px;" +
|
||||
"margin-right:5px";
|
||||
+"margin-left: -1.5em";
|
||||
+"text-align: right";
|
||||
"margin: 0; max-width: 200px;" +
|
||||
"margin-right:5px;" +
|
||||
"margin-left: -1.5em" +
|
||||
"text-align: right" +
|
||||
"text-overflow: ellipsis;" +
|
||||
"overflow: hidden;" +
|
||||
"white-space: pre;";
|
||||
|
||||
if (label.indexOf("<br>") != -1) {
|
||||
div_attributes += "min-height: 2.5em;";
|
||||
}
|
||||
|
||||
div_attributes += '" title="' + title + '" style="overflow: hidden;"';
|
||||
div_attributes += '" title="' + label + '" style="overflow: hidden;"';
|
||||
|
||||
format.push([i, "<div " + div_attributes + ">" + label + "</div>"]);
|
||||
}
|
||||
@ -3270,5 +3268,6 @@ function reduceText(text, maxLength) {
|
||||
if (text.length <= maxLength) return text;
|
||||
var firstSlideEnd = parseInt((maxLength - 3) / 1.6);
|
||||
var str_cut = text.substr(0, firstSlideEnd);
|
||||
return str_cut + "...<br>" + text.substr(-firstSlideEnd - 3);
|
||||
//return str_cut + "...<br>" + text.substr(-firstSlideEnd - 3);
|
||||
return str_cut + "..." + text.substr(-firstSlideEnd - 3);
|
||||
}
|
||||
|