Merge remote-tracking branch 'origin/develop' into ent-4132-custom-fields-url

This commit is contained in:
Luis Calvo 2019-08-27 09:10:37 +02:00
commit e2e7eeee92
360 changed files with 20598 additions and 15297 deletions

View File

@ -1,15 +1,15 @@
var max_events;
var bg;
$(document).ready(function(){
max_events=localStorage["events"];
if(localStorage["events"]==undefined){
localStorage["events"]="20";
$(document).ready(function() {
max_events = localStorage["events"];
if (localStorage["events"] == undefined) {
localStorage["events"] = "20";
}
bg=chrome.extension.getBackgroundPage();
bg = chrome.extension.getBackgroundPage();
// Display the information
if (bg.fetchEvents().length == 0) {
showError("Error in fetching data!! Check your internet connection");
showError("No events");
} else {
showEvents();
}
@ -18,7 +18,7 @@ $(document).ready(function(){
document.getElementById("m_refresh").addEventListener("click", mrefresh);
// Added listener to background messages
chrome.runtime.onMessage.addListener(function(message,sender,sendResponse){
chrome.runtime.onMessage.addListener(function(message, sender, sendResponse) {
switch (message.text) {
case "FETCH_EVENTS":
setSpinner();
@ -34,7 +34,9 @@ $(document).ready(function(){
break;
case "FETCH_EVENTS_URL_ERROR":
unsetSpinner();
showError("Configure ip address,API password, user name and password with correct values");
showError(
"Configure ip address,API password, user name and password with correct values"
);
break;
default:
console.log("Unrecognized message: ", message.text);
@ -43,126 +45,137 @@ $(document).ready(function(){
});
});
function setSpinner () {
$('#refr_img_id').attr("src", "images/spinny.gif");
function setSpinner() {
$("#refr_img_id").attr("src", "images/spinny.gif");
}
function unsetSpinner() {
$('#refr_img_id').attr("src", "images/refresh.png");
$("#refr_img_id").attr("src", "images/refresh.png");
}
function clearError() {
$('.error').hide();
$('.error a').text("");
$('.result').css('height', null);
$(".error").hide();
$(".error a").text("");
$(".result").css("height", null);
}
function showError(text){
$('.error a').text(text);
$('.error').show();
$('.result').height(420);
function showError(text) {
$(".error a").text(text);
$(".error").show();
$(".result").height(420);
}
function showEvents(){
function showEvents() {
clearError();
$('#events').empty();
var e_refr = document.getElementById('event_temp');
if(e_refr){
$("#events").empty();
var e_refr = document.getElementById("event_temp");
if (e_refr) {
wrapper.removeChild(e_refr);
}
var allEvents = bg.fetchEvents();
var notVisitedEvents = bg.fetchNotVisited();
var eve=document.createElement('div');
eve.id="event_temp";
eve.setAttribute("class","b");
var eve = document.createElement("div");
eve.id = "event_temp";
eve.setAttribute("class", "b");
var i=0;
if(allEvents.length>0){
while(i<max_events && i<allEvents.length){
var eve_title=document.createElement('div');
eve_title.id = 'e_' + i + '_' + allEvents[i]['id'];
var img = document.createElement('img');
img.src = 'images/plus.png';
img.className ='pm';
img.id='i_' + i + '_' + allEvents[i]['id'];
var i = 0;
if (allEvents.length > 0) {
while (i < max_events && i < allEvents.length) {
var eve_title = document.createElement("div");
eve_title.id = "e_" + i + "_" + allEvents[i]["id"];
var img = document.createElement("img");
img.src = "images/plus.png";
img.className = "pm";
img.id = "i_" + i + "_" + allEvents[i]["id"];
eve_title.appendChild(img);
var div_empty = document.createElement('img');
var a = document.createElement('a');
var div_empty = document.createElement("img");
var a = document.createElement("a");
var temp_style;
var agent_url = (allEvents[i]["agent"] == 0)
? localStorage["ip_address"]
+ "/index.php?sec=eventos&sec2=operation/events/events"
: localStorage["ip_address"]
+ "/index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente="
+ allEvents[i]['agent'];
a.setAttribute("href",agent_url);
var agent_url =
allEvents[i]["agent"] == 0
? localStorage["ip_address"] +
"/index.php?sec=eventos&sec2=operation/events/events"
: localStorage["ip_address"] +
"/index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=" +
allEvents[i]["agent"];
a.setAttribute("href", agent_url);
a.target = "_blank";
a.className = 'a_2_mo';
a.className = "a_2_mo";
a.innerText = allEvents[i]["title"];
eve_title.setAttribute("class", "event sev-" + allEvents[i]["severity"]);
a.innerText = allEvents[i]['title'];
eve_title.setAttribute("class","event sev-" + allEvents[i]['severity']);
if (notVisitedEvents[allEvents[i]['id']] === true) {
if (notVisitedEvents[allEvents[i]["id"]] === true) {
eve_title.style.fontWeight = 600;
}
eve_title.appendChild(a);
eve.appendChild(eve_title);
var time=allEvents[i]['date'].split(" ");
var time_text = time[0]+" "+time[1];
var time = allEvents[i]["date"].split(" ");
var time_text = time[0] + " " + time[1];
var p = document.createElement('p');
var id = (allEvents[i]['module']==0)
var p = document.createElement("p");
var id =
allEvents[i]["module"] == 0
? "."
: " in the module with Id "+ allEvents[i]['module'] + ".";
: " in the module with Id " + allEvents[i]["module"] + ".";
p.innerText = allEvents[i]['type']+" : "+allEvents[i]['source']+". Event occured at "+ time_text+id;
p.id = 'p_' + i;
p.innerText =
allEvents[i]["type"] +
" : " +
allEvents[i]["source"] +
". Event occured at " +
time_text +
id;
p.id = "p_" + i;
eve_title.appendChild(p);
i++;
}
$('#events').append(eve);
$("#events").append(eve);
$('img.pm').click(showHide);
$('div.b').show();
$("img.pm").click(showHide);
$("div.b").show();
} else {
showError("Error in fetching data!! Check your internet connection");
showError("No events");
}
localStorage["new_events"]=0;
localStorage["new_events"] = 0;
bg.updateBadge();
}
function showHide() {
var id = $(this).attr('id');
var id = $(this).attr("id");
// Image id has the form i_<position>_<eventId>
var nums = id.split('_');
var nums = id.split("_");
var pid = "p_" + nums[1];
// Mark as visited if visited
if($(this).parent().css('font-weight') == '600') {
if (
$(this)
.parent()
.css("font-weight") == "600"
) {
bg.removeNotVisited(nums[2]);
$(this).parent().css('font-weight', '');
$(this)
.parent()
.css("font-weight", "");
}
// Toggle information
if($('#' + pid).css('display') == 'none') {
$('#' + pid).slideDown();
$(this).attr({src: 'images/minus.png'});
}
else {
$('#' + pid).slideUp();
$(this).attr({src: 'images/plus.png'});
if ($("#" + pid).css("display") == "none") {
$("#" + pid).slideDown();
$(this).attr({ src: "images/minus.png" });
} else {
$("#" + pid).slideUp();
$(this).attr({ src: "images/plus.png" });
}
}
function mrefresh(){
localStorage["new_events"]=0;
function mrefresh() {
localStorage["new_events"] = 0;
bg.updateBadge();
clearError();
bg.resetInterval();

View File

@ -1,6 +1,6 @@
{
"name": "__MSG_name__",
"version": "2.1",
"version": "2.2",
"manifest_version": 2,
"description": "Pandora FMS Event viewer Chrome extension",
"homepage_url": "http://pandorafms.com",
@ -27,4 +27,4 @@
"background"
],
"default_locale": "en"
}
}

49
pandora_agents/Dockerfile Normal file
View File

@ -0,0 +1,49 @@
FROM centos:centos7
MAINTAINER Pandora FMS Team <info@pandorafms.com>
# Add Pandora FMS agent installer
ADD unix /tmp/pandora_agent/unix
# Install dependencies
RUN yum -y install \
epel-release \
unzip \
perl \
sed \
"perl(Sys::Syslog)"
# Install Pandora FMS agent
RUN cd /tmp/pandora_agent/unix \
&& ./pandora_agent_installer --install
# Set default variables
ENV SERVER_IP '127.0.0.1'
ENV REMOTE_CONFIG '0'
ENV GROUP 'Servers'
ENV DEBUG '0'
ENV AGENT_NAME 'agent_docker'
ENV AGENT_ALIAS 'agent_docker'
ENV TIMEZONE 'UTC'
ENV SECONDARY_GROUPS ''
# Create the entrypoint script.
RUN echo -e '#/bin/bash\n \
sed -i "s/^server_ip.*$/server_ip $SERVER_IP/g" /etc/pandora/pandora_agent.conf\n \
sed -i "s/^remote_config.*$/remote_config $REMOTE_CONFIG/g" /etc/pandora/pandora_agent.conf\n \
sed -i "s/^group.*$/group $GROUP/g" /etc/pandora/pandora_agent.conf\n \
sed -i "s/^debug.*$/debug $DEBUG/g" /etc/pandora/pandora_agent.conf\n \
sed -i "s/^#agent_name.*$/agent_name $AGENT_NAME/g" /etc/pandora/pandora_agent.conf\n \
sed -i "s/^#agent_alias.*$/agent_alias $AGENT_ALIAS/g" /etc/pandora/pandora_agent.conf\n \
sed -i "s/^# secondary_groups.*$/secondary_groups $SECONDARY_GROUPS/g" /etc/pandora/pandora_agent.conf\n \
if [ $TIMEZONE != "" ]; then\n \
\tln -sfn /usr/share/zoneinfo/$TIMEZONE /etc/localtime\n \
fi\n \
/etc/init.d/pandora_agent_daemon start\n \
rm -f $0\n \
bash' \
>> /entrypoint.sh && \
chmod +x /entrypoint.sh
# Entrypoint + CMD
ENTRYPOINT ["bash"]
CMD ["/entrypoint.sh"]

View File

@ -0,0 +1,18 @@
#!/bin/bash
source /root/code/pandorafms/extras/build_vars.sh
# Set tag for docker build
if [ "$1" == "nightly" ]; then
LOCAL_VERSION="latest"
else
LOCAL_VERSION=$VERSION
fi
# Build image with code
docker build --rm=true --pull --no-cache -t pandorafms/pandorafms-agent:$LOCAL_VERSION -f $CODEHOME/pandora_agents/Dockerfile $CODEHOME/pandora_agents/
# Push image
docker push pandorafms/pandorafms-agent:$LOCAL_VERSION
# Delete local image
docker image rm -f pandorafms/pandorafms-agent:$LOCAL_VERSION

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.735
# Version 7.0NG.738
# Licensed under GPL license v2,
# (c) 2003-2010 Artica Soluciones Tecnologicas
# please visit http://pandora.sourceforge.net

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.735
# Version 7.0NG.738
# Licensed under GPL license v2,
# (c) 2003-2009 Artica Soluciones Tecnologicas
# please visit http://pandora.sourceforge.net

View File

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

View File

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

View File

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

View File

@ -1,5 +1,5 @@
package: pandorafms-agent-unix
Version: 7.0NG.735-190619
Version: 7.0NG.738-190827
Architecture: all
Priority: optional
Section: admin

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -41,8 +41,8 @@ my $Sem = undef;
# Semaphore used to control the number of threads
my $ThreadSem = undef;
use constant AGENT_VERSION => '7.0NG.735';
use constant AGENT_BUILD => '190619';
use constant AGENT_VERSION => '7.0NG.738';
use constant AGENT_BUILD => '190827';
# Agent log default file size maximum and instances
use constant DEFAULT_MAX_LOG_SIZE => 600000;

View File

@ -2,8 +2,8 @@
#Pandora FMS Linux Agent
#
%define name pandorafms_agent_unix
%define version 7.0NG.735
%define release 190619
%define version 7.0NG.738
%define release 190827
Summary: Pandora FMS Linux agent, PERL version
Name: %{name}

View File

@ -2,8 +2,8 @@
#Pandora FMS Linux Agent
#
%define name pandorafms_agent_unix
%define version 7.0NG.735
%define release 190619
%define version 7.0NG.738
%define release 190827
Summary: Pandora FMS Linux agent, PERL version
Name: %{name}

View File

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

View File

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

View File

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

View File

@ -30,7 +30,7 @@ using namespace Pandora;
using namespace Pandora_Strutils;
#define PATH_SIZE _MAX_PATH+1
#define PANDORA_VERSION ("7.0NG.735(Build 190619)")
#define PANDORA_VERSION ("7.0NG.738(Build 190827)")
string pandora_path;
string pandora_dir;

View File

@ -11,7 +11,7 @@ BEGIN
VALUE "LegalCopyright", "Artica ST"
VALUE "OriginalFilename", "PandoraAgent.exe"
VALUE "ProductName", "Pandora FMS Windows Agent"
VALUE "ProductVersion", "(7.0NG.735(Build 190619))"
VALUE "ProductVersion", "(7.0NG.738(Build 190827))"
VALUE "FileVersion", "1.0.0.0"
END
END

View File

@ -1,5 +1,5 @@
package: pandorafms-console
Version: 7.0NG.735-190619
Version: 7.0NG.738-190827
Architecture: all
Priority: optional
Section: admin

View File

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

View File

@ -1,17 +1,34 @@
<?php
/**
* Ajax handler.
*
* @category Ajax handler.
* @package Pandora FMS.
* @subpackage OpenSource.
* @version 1.0.0
* @license See below
*
* ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2005-2019 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.
define('AJAX', true);
// Pandora FMS - http://pandorafms.com
// ==================================================
// Copyright (c) 2005-2011 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 Lesser 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.
// Enable profiler for testing
if (!defined('__PAN_XHPROF__')) {
define('__PAN_XHPROF__', 0);
}
@ -56,7 +73,7 @@ if (isset($_GET['loginhash'])) {
$public_hash = get_parameter('hash', false);
// Check user
// Check user.
if ($public_hash == false) {
check_login();
} else {
@ -68,9 +85,9 @@ if ($public_hash == false) {
}
}
define('AJAX', true);
// Enterprise support
// Enterprise support.
if (file_exists(ENTERPRISE_DIR.'/load_enterprise.php')) {
include_once ENTERPRISE_DIR.'/load_enterprise.php';
}
@ -86,11 +103,9 @@ if ($isFunctionSkins !== ENTERPRISE_NOT_HOOK) {
$config['relative_path'] = enterprise_hook('skins_set_image_skin_path', [$config['id_user']]);
}
if (isset($config['metaconsole'])) {
// Not cool way of know if we are executing from metaconsole or normal console
if ($config['metaconsole']) {
if (is_metaconsole()) {
// Backward compatibility.
define('METACONSOLE', true);
}
}
if (file_exists($page)) {

View File

@ -69,7 +69,7 @@ function extension_db_status()
echo "<div style='text-align: right;'>";
html_print_input_hidden('db_status_execute', 1);
html_print_submit_button(__('Execute Test'), 'submit', false, 'class="sub"');
html_print_submit_button(__('Execute Test'), 'submit', false, 'class="sub next"');
echo '</div>';
echo '</form>';

View File

@ -1,17 +1,32 @@
<?php
/**
* Module groups.
*
* @category Extensions
* @package Pandora FMS
* @subpackage Module groups view.
* @version 1.0.0
* @license See below
*
* ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2005-2019 Artica Soluciones Tecnologicas
* Please see http://pandorafms.org for full contribution list
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation for version 2.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* ============================================================================
*/
// Pandora FMS - http://pandorafms.com
// ==================================================
// Copyright (c) 2005-2011 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.
// Load global vars
// Begin.
global $config;
check_login();
@ -32,9 +47,11 @@ if (is_ajax()) {
}
/**
/**
* The main function of module groups and the enter point to
* execute the code.
*
* @return void
*/
function mainModuleGroups()
{
@ -68,13 +85,20 @@ function mainModuleGroups()
$info = array_filter(
$info,
function ($v, $k) use ($agent_group_search) {
return preg_match("/$agent_group_search/i", $v['name']);
return preg_match(
'/'.$agent_group_search.'/i',
$v['name']
);
},
ARRAY_FILTER_USE_BOTH
);
if (!empty($info)) {
$groups_view = $is_not_paginated ? $info : array_slice($info, $offset, $config['block_size']);
$groups_view = ($is_not_paginated) ? $info : array_slice(
$info,
$offset,
$config['block_size']
);
$agents_counters = array_reduce(
$groups_view,
function ($carry, $item) {
@ -113,7 +137,7 @@ function mainModuleGroups()
$array_module_group = array_filter(
$array_module_group,
function ($v, $k) use ($module_group_search) {
return preg_match("/$module_group_search/i", $v);
return preg_match('/'.$module_group_search.'/i', $v);
},
ARRAY_FILTER_USE_BOTH
);
@ -125,12 +149,13 @@ function mainModuleGroups()
$array_for_defect[$key]['data']['icon'] = $value['icon'];
}
$sql = "SELECT SUM(IF(tae.alert_fired <> 0, 1, 0)) AS alerts_module_count,
SUM(IF($condition_warning, 1, 0)) AS warning_module_count,
SUM(IF($condition_unknown, 1, 0)) AS unknown_module_count,
SUM(IF($condition_not_init, 1, 0)) AS notInit_module_count,
SUM(IF($condition_critical, 1, 0)) AS critical_module_count,
SUM(IF($condition_normal, 1, 0)) AS normal_module_count,
$sql = sprintf(
"SELECT SUM(IF(tae.alert_fired <> 0, 1, 0)) AS alerts_module_count,
SUM(IF(%s, 1, 0)) AS warning_module_count,
SUM(IF(%s, 1, 0)) AS unknown_module_count,
SUM(IF(%s, 1, 0)) AS notInit_module_count,
SUM(IF(%s, 1, 0)) AS critical_module_count,
SUM(IF(%s, 1, 0)) AS normal_module_count,
COUNT(tae.id_agente_modulo) AS total_count,
tmg.id_mg,
tmg.name as n,
@ -152,7 +177,7 @@ function mainModuleGroups()
WHERE ta.disabled = 0
AND tam.disabled = 0
AND tam.delete_pending = 0
AND ta.id_grupo IN ($ids_group)
AND ta.id_grupo IN (%s)
GROUP BY tam.id_agente_modulo
UNION ALL
SELECT tam.id_agente_modulo,
@ -173,7 +198,7 @@ function mainModuleGroups()
WHERE ta.disabled = 0
AND tam.disabled = 0
AND tam.delete_pending = 0
AND tasg.id_group IN ($ids_group)
AND tasg.id_group IN (%s)
GROUP BY tam.id_agente_modulo, tasg.id_group
) AS tae
RIGHT JOIN tgrupo tg
@ -184,7 +209,15 @@ function mainModuleGroups()
SELECT 0 AS 'id_mg', 'Nothing' AS 'name'
) AS tmg
ON tae.id_module_group = tmg.id_mg
GROUP BY tae.g, tmg.id_mg";
GROUP BY tae.g, tmg.id_mg",
$condition_warning,
$condition_unknown,
$condition_not_init,
$condition_critical,
$condition_normal,
$ids_group,
$ids_group
);
$array_data_prev = db_get_all_rows_sql($sql);
@ -220,11 +253,29 @@ function mainModuleGroups()
echo '<td>';
echo '</tr></table>';
$cell_style = '
min-width: 60px;
width: 100%;
margin: 0;
overflow:hidden;
text-align: center;
padding: 5px;
padding-bottom:10px;
font-size: 18px;
text-align: center;
';
if (true) {
$table = new StdClass();
$table->style[0] = 'color: #ffffff; background-color: #373737; font-weight: bolder; padding-right: 10px; min-width: 230px;';
$table->style[0] = 'color: #ffffff; background-color: #373737; font-weight: bolder; min-width: 230px;';
$table->width = '100%';
if ($config['style'] === 'pandora_black') {
$background_color = '#333';
} else {
$background_color = '#fff';
}
$head[0] = __('Groups');
$headstyle[0] = 'width: 20%; font-weight: bolder;';
foreach ($array_module_group as $key => $value) {
@ -248,28 +299,28 @@ function mainModuleGroups()
$color = '#FFA631';
// Orange when the cell for this model group and agent has at least one alert fired.
} else if ($array_data[$key][$k]['critical_module_count'] != 0) {
$color = '#FC4444';
$color = '#e63c52';
// Red when the cell for this model group and agent has at least one module in critical state and the rest in any state.
} else if ($array_data[$key][$k]['warning_module_count'] != 0) {
$color = '#FAD403';
$color = '#f3b200';
// Yellow when the cell for this model group and agent has at least one in warning state and the rest in green state.
} else if ($array_data[$key][$k]['unknown_module_count'] != 0) {
$color = '#B2B2B2 ';
// Grey when the cell for this model group and agent has at least one module in unknown state and the rest in any state.
} else if ($array_data[$key][$k]['normal_module_count'] != 0) {
$color = '#80BA27';
$color = '#82b92e';
// Green when the cell for this model group and agent has OK state all modules.
} else if ($array_data[$key][$k]['notInit_module_count'] != 0) {
$color = '#5BB6E5';
// Blue when the cell for this module group and all modules have not init value.
}
$data[$i][$j] = "<div style='background:$color; height: 20px;min-width: 60px;max-width:5%;overflow:hidden; margin-left: auto; margin-right: auto; text-align: center; padding: 5px;padding-bottom:10px;font-size: 18px;line-height:25px;'>";
$data[$i][$j] = "<div style='".$cell_style.'background:'.$color.";'>";
$data[$i][$j] .= "<a class='info_cell' rel='$rel' href='$url' style='color:white;font-size: 18px;'>";
$data[$i][$j] .= $array_data[$key][$k]['total_count'];
$data[$i][$j] .= '</a></div>';
} else {
$data[$i][$j] = "<div style='background:white; height: 20px;min-width: 60px;max-width:5%;overflow:hidden; margin-left: auto; margin-right: auto; text-align: center; padding: 5px;padding-bottom:10px;font-size: 18px;line-height:25px;'>";
$data[$i][$j] = "<div style='background:".$background_color.';'.$cell_style."'>";
$data[$i][$j] .= 0;
$data[$i][$j] .= '</div>';
}
@ -278,7 +329,7 @@ function mainModuleGroups()
}
} else {
foreach ($value['gm'] as $k => $v) {
$data[$i][$j] = "<div style='background:white; height: 20px;min-width: 60px;max-width:5%;overflow:hidden; margin-left: auto; margin-right: auto; text-align: center; padding: 5px;padding-bottom:10px;font-size: 18px;line-height:25px;'>";
$data[$i][$j] = "<div style='background:".$background_color."; min-width: 60px;max-width:5%;overflow:hidden; margin-left: auto; margin-right: auto; text-align: center; padding: 5px;padding-bottom:10px;font-size: 18px;line-height:25px;'>";
$data[$i][$j] .= 0;
$data[$i][$j] .= '</div>';
$j++;

View File

@ -1,26 +1,60 @@
<?php
/**
* Net tools utils.
*
* @category Extensions
* @package Pandora FMS
* @subpackage NetTools
* @version 1.0.0
* @license See below
*
* ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2005-2019 Artica Soluciones Tecnologicas
* Please see http://pandorafms.org for full contribution list
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation for version 2.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* ============================================================================
*/
// Pandora FMS - http://pandorafms.com
// ==================================================
// Copyright (c) 2005-2011 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.
// Begin.
global $config;
// Requires.
require_once $config['homedir'].'/include/functions.php';
// This extension is usefull only if the agent has associated IP.
$id_agente = get_parameter('id_agente');
// This extension is usefull only if the agent has associated IP
$address = agents_get_address($id_agente);
if (!empty($address) || empty($id_agente)) {
extensions_add_opemode_tab_agent('network_tools', 'Network Tools', 'extensions/net_tools/nettool.png', 'main_net_tools', 'v1r1', 'AW');
extensions_add_opemode_tab_agent(
'network_tools',
'Network Tools',
'extensions/net_tools/nettool.png',
'main_net_tools',
'v1r1',
'AW'
);
}
/**
* Searchs for command.
*
* @param string $command Command.
*
* @return string Path.
*/
function whereis_the_command($command)
{
global $config;
@ -63,6 +97,9 @@ function whereis_the_command($command)
return $snmpget_path;
}
break;
default:
return null;
}
}
@ -87,83 +124,18 @@ function whereis_the_command($command)
}
function main_net_tools()
/**
* Execute net tools action.
*
* @param integer $operation Operation.
* @param string $ip Ip.
* @param string $community Community.
* @param string $snmp_version SNMP version.
*
* @return void
*/
function net_tools_execute($operation, $ip, $community, $snmp_version)
{
$id_agente = get_parameter('id_agente');
$principal_ip = db_get_sql("SELECT direccion FROM tagente WHERE id_agente = $id_agente");
$list_address = db_get_all_rows_sql('select id_a from taddress_agent where id_agent = '.$id_agente);
foreach ($list_address as $address) {
$ids[] = join(',', $address);
}
$ids_address = implode(',', $ids);
$ips = db_get_all_rows_sql('select ip from taddress where id_a in ('.$ids_address.')');
if ($ips == '') {
echo "<div class='error' style='margin-top:5px'>".__('The agent hasn\'t got IP').'</div>';
return;
}
echo "
<script type='text/javascript'>
function mostrarColumns(ValueSelect) {
value = ValueSelect.value;
if (value == 3) {
$('netToolTable').css('width','100%');
$('#snmpcolumn').show();
}
else {
$('netToolTable').css('width','100%');
$('#snmpcolumn').hide();
}
}
</script>";
echo '<div>';
echo "<form name='actionbox' method='post'>";
echo "<table class='databox filters' width=100% id=netToolTable>";
echo '<tr><td>';
echo __('Operation');
ui_print_help_tip(
__('You can set the command path in the menu Administration -&gt; Extensions -&gt; Config Network Tools')
);
echo '</td><td>';
echo "<select name='operation' onChange='mostrarColumns(this);'>";
echo "<option value='1'>".__('Traceroute');
echo "<option value='2'>".__('Ping host & Latency');
echo "<option value='3'>".__('SNMP Interface status');
echo "<option value='4'>".__('Basic TCP Port Scan');
echo "<option value='5'>".__('DiG/Whois Lookup');
echo '</select>';
echo '</td>';
echo '<td>';
echo __('IP address');
echo '</td><td>';
echo "<select name='select_ips'>";
foreach ($ips as $ip) {
if ($ip['ip'] == $principal_ip) {
echo "<option value='".$ip['ip']."' selected = 'selected'>".$ip['ip'];
} else {
echo "<option value='".$ip['ip']."'>".$ip['ip'];
}
}
echo '</select>';
echo '</td>';
echo "<td id='snmpcolumn' style=\"display:none;\">";
echo __('SNMP Community').'&nbsp;';
echo "<input name=community type=text value='public'>";
echo '</td><td>';
echo "<input style='margin:0px;' name=submit type=submit class='sub next' value='".__('Execute')."'>";
echo '</td>';
echo '</tr></table>';
echo '</form>';
$operation = get_parameter('operation', 0);
$community = get_parameter('community', 'public');
$ip = get_parameter('select_ips');
if (!validate_address($ip)) {
ui_print_error_message(__('The ip or dns name entered cannot be resolved'));
} else {
@ -175,7 +147,7 @@ function main_net_tools()
} else {
echo '<h3>'.__('Traceroute to ').$ip.'</h3>';
echo '<pre>';
echo system("$traceroute $ip");
echo system($traceroute.' '.$ip);
echo '</pre>';
}
break;
@ -187,7 +159,7 @@ function main_net_tools()
} else {
echo '<h3>'.__('Ping to %s', $ip).'</h3>';
echo '<pre>';
echo system("$ping -c 5 $ip");
echo system($ping.' -c 5 '.$ip);
echo '</pre>';
}
break;
@ -199,7 +171,7 @@ function main_net_tools()
} else {
echo '<h3>'.__('Basic TCP Scan on ').$ip.'</h3>';
echo '<pre>';
echo system("$nmap -F $ip");
echo system($nmap.' -F '.$ip);
echo '</pre>';
}
break;
@ -212,7 +184,7 @@ function main_net_tools()
ui_print_error_message(__('Dig executable does not exist.'));
} else {
echo '<pre>';
echo system("dig $ip");
echo system('dig '.$ip);
echo '</pre>';
}
@ -221,51 +193,227 @@ function main_net_tools()
ui_print_error_message(__('Whois executable does not exist.'));
} else {
echo '<pre>';
echo system("whois $ip");
echo system('whois '.$ip);
echo '</pre>';
}
break;
case 3:
echo '<h3>'.__('SNMP information for ').$ip.'</h3>';
$snmp_obj = [
'ip_target' => $ip,
'snmp_version' => $snmp_version,
'snmp_community' => $community,
'format' => '-Oqn',
];
$snmpget = whereis_the_command('snmpget');
if (empty($snmpget)) {
ui_print_error_message(__('SNMPget executable does not exist.'));
} else {
$snmp_obj['base_oid'] = '.1.3.6.1.2.1.1.3.0';
$result = get_h_snmpwalk($snmp_obj);
echo '<h3>'.__('SNMP information for ').$ip.'</h3>';
echo '<h4>'.__('Uptime').'</h4>';
echo '<pre>';
echo exec("$snmpget -Ounv -v1 -c $community $ip .1.3.6.1.2.1.1.3.0 ");
if (empty($result)) {
ui_print_error_message(__('Target unreachable.'));
break;
} else {
echo array_pop($result);
}
echo '</pre>';
echo '<h4>'.__('Device info').'</h4>';
echo '<pre>';
$snmp_obj['base_oid'] = '.1.3.6.1.2.1.1.1.0';
$result = get_h_snmpwalk($snmp_obj);
if (empty($result)) {
ui_print_error_message(__('Target unreachable.'));
break;
} else {
echo array_pop($result);
}
echo system("$snmpget -Ounv -v1 -c $community $ip .1.3.6.1.2.1.1.1.0 ");
echo '</pre>';
echo '<h4>Interface Information</h4>';
echo '<table class=databox>';
echo '<tr><th>'.__('Interface');
echo '<th>'.__('Status');
$int_max = exec("$snmpget -Oqunv -v1 -c $community $ip .1.3.6.1.2.1.2.1.0 ");
$table = new StdClass();
$table->class = 'databox';
$table->head = [];
$table->head[] = __('Interface');
$table->head[] = __('Status');
for ($ax = 0; $ax < $int_max; $ax++) {
$interface = exec("$snmpget -Oqunv -v1 -c $community $ip .1.3.6.1.2.1.2.2.1.2.$ax ");
$estado = exec("$snmpget -Oqunv -v1 -c $community $ip .1.3.6.1.2.1.2.2.1.8.$ax ");
echo "<tr><td>$interface<td>$estado";
$i = 0;
$base_oid = '.1.3.6.1.2.1.2.2.1';
$idx_oids = '.1';
$names_oids = '.2';
$status_oids = '.8';
$snmp_obj['base_oid'] = $base_oid.$idx_oids;
$idx = get_h_snmpwalk($snmp_obj);
$snmp_obj['base_oid'] = $base_oid.$names_oids;
$names = get_h_snmpwalk($snmp_obj);
$snmp_obj['base_oid'] = $base_oid.$status_oids;
$statuses = get_h_snmpwalk($snmp_obj);
foreach ($idx as $k => $v) {
$index = str_replace($base_oid.$idx_oids, '', $k);
$name = $names[$base_oid.$names_oids.$index];
$status = $statuses[$base_oid.$status_oids.$index];
$table->data[$i][0] = $name;
$table->data[$i++][1] = $status;
}
echo '</table>';
}
html_print_table($table);
break;
default:
// Ignore.
break;
}
}
}
/**
* Main function.
*
* @return void
*/
function main_net_tools()
{
$operation = get_parameter('operation', 0);
$community = get_parameter('community', 'public');
$ip = get_parameter('select_ips');
$snmp_version = get_parameter('select_version');
// Show form.
$id_agente = get_parameter('id_agente', 0);
$principal_ip = db_get_sql(
sprintf(
'SELECT direccion FROM tagente WHERE id_agente = %d',
$id_agente
)
);
$list_address = db_get_all_rows_sql(
sprintf(
'SELECT id_a FROM taddress_agent WHERE id_agent = %d',
$id_agente
)
);
foreach ($list_address as $address) {
$ids[] = join(',', $address);
}
$ips = db_get_all_rows_sql(
sprintf(
'SELECT ip FROM taddress WHERE id_a IN (%s)',
join($ids)
)
);
if ($ips == '') {
echo "<div class='error' style='margin-top:5px'>".__('The agent hasn\'t got IP').'</div>';
return;
}
// Javascript.
?>
<script type='text/javascript'>
$(document).ready(function(){
mostrarColumns($('#operation :selected').val());
});
function mostrarColumns(value) {
if (value == 3) {
$('.snmpcolumn').show();
}
else {
$('.snmpcolumn').hide();
}
}
</script>
<?php
echo '<div>';
echo "<form name='actionbox' method='post'>";
echo "<table class='databox filters' width=100% id=netToolTable>";
echo '<tr><td>';
echo __('Operation');
ui_print_help_tip(
__('You can set the command path in the menu Administration -&gt; Extensions -&gt; Config Network Tools')
);
echo '</td><td>';
html_print_select(
[
1 => __('Traceroute'),
2 => __('Ping host & Latency'),
3 => __('SNMP Interface status'),
4 => __('Basic TCP Port Scan'),
5 => __('DiG/Whois Lookup'),
],
'operation',
$operation,
'mostrarColumns(this.value)',
__('Please select')
);
echo '</td>';
echo '<td>';
echo __('IP address');
echo '</td><td>';
$ips_for_select = array_reduce(
$ips,
function ($carry, $item) {
$carry[$item['ip']] = $item['ip'];
return $carry;
}
);
html_print_select(
$ips_for_select,
'select_ips',
$principal_ip
);
echo '</td>';
echo "<td class='snmpcolumn'>";
echo __('SNMP Version');
html_print_select(
[
'1' => 'v1',
'2c' => 'v2c',
],
'select_version',
$snmp_version
);
echo '</td><td class="snmpcolumn">';
echo __('SNMP Community').'&nbsp;';
html_print_input_text('community', $community);
echo '</td><td>';
echo "<input style='margin:0px;' name=submit type=submit class='sub next' value='".__('Execute')."'>";
echo '</td>';
echo '</tr></table>';
echo '</form>';
if ($operation) {
// Execute form.
net_tools_execute($operation, $ip, $community, $snmp_version);
}
echo '</div>';
}
/**
* Add option.
*
* @return void
*/
function godmode_net_tools()
{
global $config;

View File

@ -173,7 +173,7 @@ function pandora_realtime_graphs()
$table->colspan[2]['snmp_oid'] = 2;
$data['snmp_ver'] = __('Version').'&nbsp;&nbsp;'.html_print_select($snmp_versions, 'snmp_version', $snmp_ver, '', '', 0, true);
$data['snmp_ver'] .= '&nbsp;&nbsp;'.html_print_button(__('SNMP walk'), 'snmp_walk', false, 'javascript:realtimeGraphs.snmpBrowserWindow();', 'class="sub next"', true);
$data['snmp_ver'] .= '&nbsp;&nbsp;'.html_print_button(__('SNMP walk'), 'snmp_walk', false, 'javascript:snmpBrowserWindow();', 'class="sub next"', true);
$table->colspan[2]['snmp_ver'] = 2;
$table->data[] = $data;

View File

@ -11,5 +11,5 @@
#graph_container {
width: 800px;
margin: 20px auto !important;
margin: 20px auto;
}

View File

@ -10,7 +10,9 @@
var plot;
var plotOptions = {
legend: { container: $("#chartLegend") },
legend: {
container: $("#chartLegend")
},
xaxis: {
tickFormatter: function(timestamp, axis) {
var date = new Date(timestamp * 1000);
@ -131,47 +133,6 @@
resetDataPooling();
}
// Set the form OID to the value selected in the SNMP browser
function setOID() {
if ($("#snmp_browser_version").val() == "3") {
$("#text-snmp_oid").val($("#table1-0-1").text());
} else {
$("#text-snmp_oid").val($("#snmp_selected_oid").text());
}
// Close the SNMP browser
$(".ui-dialog-titlebar-close").trigger("click");
}
// Show the SNMP browser window
function snmpBrowserWindow() {
// Keep elements in the form and the SNMP browser synced
$("#text-target_ip").val($("#text-ip_target").val());
$("#text-community").val($("#text-snmp_community").val());
$("#snmp_browser_version").val($("#snmp_version").val());
$("#snmp3_browser_auth_user").val($("#snmp3_auth_user").val());
$("#snmp3_browser_security_level").val($("#snmp3_security_level").val());
$("#snmp3_browser_auth_method").val($("#snmp3_auth_method").val());
$("#snmp3_browser_auth_pass").val($("#snmp3_auth_pass").val());
$("#snmp3_browser_privacy_method").val($("#snmp3_privacy_method").val());
$("#snmp3_browser_privacy_pass").val($("#snmp3_privacy_pass").val());
$("#snmp_browser_container")
.show()
.dialog({
title: "",
resizable: true,
draggable: true,
modal: true,
overlay: {
opacity: 0.5,
background: "black"
},
width: 920,
height: 500
});
}
function shortNumber(number) {
if (Math.round(number) != number) return number;
number = Number.parseInt(number);
@ -187,6 +148,7 @@
return number + " " + shorts[pos];
}
function roundToTwo(num) {
return +(Math.round(num + "e+2") + "e-2");
}

View File

@ -0,0 +1 @@
operation/servers/recon_view.php

View File

@ -1,6 +1,28 @@
START TRANSACTION;
ALTER TABLE `tmetaconsole_agent` ADD INDEX `id_tagente_idx` (`id_tagente`);
DELETE FROM `ttipo_modulo` WHERE `nombre` LIKE 'log4x';
CREATE TABLE IF NOT EXISTS `tcredential_store` (
`identifier` varchar(100) NOT NULL,
`id_group` mediumint(4) unsigned NOT NULL DEFAULT 0,
`product` enum('CUSTOM', 'AWS', 'AZURE', 'GOOGLE') default 'CUSTOM',
`username` text,
`password` text,
`extra_1` text,
`extra_2` text,
PRIMARY KEY (`identifier`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
INSERT INTO `tcredential_store` (`identifier`, `id_group`, `product`, `username`, `password`) VALUES ("imported_aws_account", 0, "AWS", (SELECT `value` FROM `tconfig` WHERE `token` = "aws_access_key_id" LIMIT 1), (SELECT `value` FROM `tconfig` WHERE `token` = "aws_secret_access_key" LIMIT 1));
DELETE FROM `tcredential_store` WHERE `username` IS NULL AND `password` IS NULL;
UPDATE `tagente` ta INNER JOIN `tagente` taa on ta.`id_parent` = taa.`id_agente` AND taa.`nombre` IN ("us-east-1", "us-east-2", "us-west-1", "us-west-2", "ca-central-1", "eu-central-1", "eu-west-1", "eu-west-2", "eu-west-3", "ap-northeast-1", "ap-northeast-2", "ap-southeast-1", "ap-southeast-2", "ap-south-1", "sa-east-1") SET ta.nombre = md5(concat((SELECT `username` FROM `tcredential_store` WHERE `identifier` = "imported_aws_account" LIMIT 1), ta.`nombre`));
UPDATE `tagente` SET `nombre` = md5(concat((SELECT `username` FROM `tcredential_store` WHERE `identifier` = "imported_aws_account" LIMIT 1), `nombre`)) WHERE `nombre` IN ("Aws", "us-east-1", "us-east-2", "us-west-1", "us-west-2", "ca-central-1", "eu-central-1", "eu-west-1", "eu-west-2", "eu-west-3", "ap-northeast-1", "ap-northeast-2", "ap-southeast-1", "ap-southeast-2", "ap-south-1", "sa-east-1");
UPDATE `trecon_task` SET `auth_strings` = "imported_aws_account" WHERE `type` IN (2,6,7);
COMMIT;

View File

@ -0,0 +1,51 @@
START TRANSACTION;
ALTER TABLE `treport_content_sla_combined` ADD `id_agent_module_failover` int(10) unsigned NOT NULL;
ALTER TABLE `treport_content` ADD COLUMN `failover_mode` tinyint(1) DEFAULT '0';
ALTER TABLE `treport_content` ADD COLUMN `failover_type` tinyint(1) DEFAULT '0';
ALTER TABLE `treport_content_template` ADD COLUMN `failover_mode` tinyint(1) DEFAULT '1';
ALTER TABLE `treport_content_template` ADD COLUMN `failover_type` tinyint(1) DEFAULT '1';
ALTER TABLE `tmodule_relationship` ADD COLUMN `type` ENUM('direct', 'failover') DEFAULT 'direct';
ALTER TABLE `treport_content` MODIFY COLUMN `name` varchar(300) NULL;
CREATE TABLE `tagent_repository` (
`id` SERIAL,
`id_os` INT(10) UNSIGNED DEFAULT 0,
`arch` ENUM('x64', 'x86') DEFAULT 'x64',
`version` VARCHAR(10) DEFAULT '',
`path` text,
`uploaded_by` VARCHAR(100) DEFAULT '',
`uploaded` bigint(20) NOT NULL DEFAULT 0 COMMENT "When it was uploaded",
`last_err` text,
PRIMARY KEY (`id`),
FOREIGN KEY (`id_os`) REFERENCES `tconfig_os`(`id_os`)
ON UPDATE CASCADE ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `tdeployment_hosts` (
`id` SERIAL,
`id_cs` VARCHAR(100),
`ip` VARCHAR(100) NOT NULL UNIQUE,
`id_os` INT(10) UNSIGNED DEFAULT 0,
`os_version` VARCHAR(100) DEFAULT '' COMMENT "OS version in STR format",
`arch` ENUM('x64', 'x86') DEFAULT 'x64',
`current_agent_version` VARCHAR(100) DEFAULT '' COMMENT "String latest installed agent",
`target_agent_version_id` BIGINT UNSIGNED,
`deployed` bigint(20) NOT NULL DEFAULT 0 COMMENT "When it was deployed",
`server_ip` varchar(100) default NULL COMMENT "Where to point target agent",
`last_err` text,
PRIMARY KEY (`id`),
FOREIGN KEY (`id_cs`) REFERENCES `tcredential_store`(`identifier`)
ON UPDATE CASCADE ON DELETE SET NULL,
FOREIGN KEY (`id_os`) REFERENCES `tconfig_os`(`id_os`)
ON UPDATE CASCADE ON DELETE CASCADE,
FOREIGN KEY (`target_agent_version_id`) REFERENCES `tagent_repository`(`id`)
ON UPDATE CASCADE ON DELETE SET NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
COMMIT;

View File

@ -0,0 +1,12 @@
START TRANSACTION;
UPDATE `tconfig` SET `value` = 'mini_severity,evento,id_agente,estado,timestamp' WHERE `token` LIKE 'event_fields';
DELETE FROM `talert_commands` WHERE `id` = 11;
DELETE FROM `tconfig` WHERE `token` LIKE 'integria_enabled';
DELETE FROM `tconfig` WHERE `token` LIKE 'integria_api_password';
DELETE FROM `tconfig` WHERE `token` LIKE 'integria_inventory';
DELETE FROM `tconfig` WHERE `token` LIKE 'integria_url';
COMMIT;

View File

@ -362,7 +362,7 @@ if ($console_mode == 1) {
true
);
echo "<table width='1000px' border='0' style='border:0px;' class='databox data' cellpadding='4' cellspacing='4'>";
echo "<table id='diagnostic_info' width='1000px' border='0' style='border:0px;' class='databox data' cellpadding='4' cellspacing='4'>";
echo "<tr><th style='background-color:#b1b1b1;font-weight:bold;font-style:italic;border-radius:2px;' align=center colspan='2'>".__('Pandora status info').'</th></tr>';
}

View File

@ -796,6 +796,8 @@ ALTER TABLE `treport_content_template` ADD COLUMN `unknown_checks` TINYINT(1) DE
ALTER TABLE `treport_content_template` ADD COLUMN `agent_max_value` TINYINT(1) DEFAULT '1';
ALTER TABLE `treport_content_template` ADD COLUMN `agent_min_value` TINYINT(1) DEFAULT '1';
ALTER TABLE `treport_content_template` ADD COLUMN `current_month` TINYINT(1) DEFAULT '1';
ALTER TABLE `treport_content_template` ADD COLUMN `failover_mode` tinyint(1) DEFAULT '1';
ALTER TABLE `treport_content_template` ADD COLUMN `failover_type` tinyint(1) DEFAULT '1';
-- -----------------------------------------------------
-- Table `treport_content_sla_com_temp` (treport_content_sla_combined_template)
@ -1007,10 +1009,12 @@ CREATE TABLE IF NOT EXISTS `tmetaconsole_agent` (
`agent_version` varchar(100) default '',
`ultimo_contacto_remoto` datetime default '1970-01-01 00:00:00',
`disabled` tinyint(2) NOT NULL default '0',
`remote` tinyint(1) NOT NULL default '0',
`id_parent` int(10) unsigned default '0',
`custom_id` varchar(255) default '',
`server_name` varchar(100) default '',
`cascade_protection` tinyint(2) NOT NULL default '0',
`cascade_protection_module` int(10) unsigned default '0',
`timezone_offset` TINYINT(2) NULL DEFAULT '0' COMMENT 'number of hours of diference with the server timezone' ,
`icon_path` VARCHAR(127) NULL DEFAULT NULL COMMENT 'path in the server to the image of the icon representing the agent' ,
`update_gis_data` TINYINT(1) NOT NULL DEFAULT '1' COMMENT 'set it to one to update the position data (altitude, longitude, latitude) when getting information from the agent or to 0 to keep the last value and do not update it' ,
@ -1025,19 +1029,21 @@ CREATE TABLE IF NOT EXISTS `tmetaconsole_agent` (
`fired_count` bigint(20) NOT NULL default '0',
`update_module_count` tinyint(1) NOT NULL default '0',
`update_alert_count` tinyint(1) NOT NULL default '0',
`update_secondary_groups` tinyint(1) NOT NULL default '0',
`transactional_agent` tinyint(1) NOT NULL default '0',
`alias` varchar(600) BINARY NOT NULL default '',
`alias_as_name` tinyint(2) NOT NULL default '0',
`safe_mode_module` int(10) unsigned NOT NULL default '0',
`cps` int NOT NULL default 0,
PRIMARY KEY (`id_agente`),
KEY `nombre` (`nombre`(255)),
KEY `direccion` (`direccion`),
KEY `id_tagente_idx` (`id_tagente`),
KEY `disabled` (`disabled`),
KEY `id_grupo` (`id_grupo`),
FOREIGN KEY (`id_tmetaconsole_setup`) REFERENCES tmetaconsole_setup(`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
ALTER TABLE tmetaconsole_agent ADD COLUMN `remote` tinyint(1) NOT NULL default '0';
ALTER TABLE tmetaconsole_agent ADD COLUMN `cascade_protection_module` int(10) default '0';
ALTER TABLE tmetaconsole_agent ADD COLUMN `transactional_agent` tinyint(1) NOT NULL default '0';
ALTER TABLE tmetaconsole_agent ADD COLUMN `alias` VARCHAR(600) not null DEFAULT '';
-- ---------------------------------------------------------------------
-- Table `ttransaction`
-- ---------------------------------------------------------------------
@ -1219,6 +1225,8 @@ ALTER TABLE `talert_commands` ADD COLUMN `fields_hidden` text;
UPDATE `talert_actions` SET `field4` = 'text/html', `field4_recovery` = 'text/html' WHERE id = 1;
DELETE FROM `talert_commands` WHERE `id` = 11;
-- ---------------------------------------------------------------------
-- Table `tmap`
-- ---------------------------------------------------------------------
@ -1235,14 +1243,19 @@ ALTER TABLE titem MODIFY `source_data` int(10) unsigned;
INSERT INTO `tconfig` (`token`, `value`) VALUES ('big_operation_step_datos_purge', '100');
INSERT INTO `tconfig` (`token`, `value`) VALUES ('small_operation_step_datos_purge', '1000');
INSERT INTO `tconfig` (`token`, `value`) VALUES ('days_autodisable_deletion', '30');
INSERT INTO `tconfig` (`token`, `value`) VALUES ('MR', 28);
INSERT INTO `tconfig` (`token`, `value`) VALUES ('MR', 30);
INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_docs_logo', 'default_docs.png');
INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_support_logo', 'default_support.png');
INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_logo_white_bg_preview', 'pandora_logo_head_white_bg.png');
UPDATE tconfig SET value = 'https://licensing.artica.es/pandoraupdate7/server.php' WHERE token='url_update_manager';
DELETE FROM `tconfig` WHERE `token` = 'current_package_enterprise';
INSERT INTO `tconfig` (`token`, `value`) VALUES ('current_package_enterprise', '735');
INSERT INTO `tconfig` (`token`, `value`) VALUES ('current_package_enterprise', '737');
INSERT INTO `tconfig` (`token`, `value`) VALUES ('status_monitor_fields', 'policy,agent,data_type,module_name,server_type,interval,status,graph,warn,data,timestamp');
UPDATE `tconfig` SET `value` = 'mini_severity,evento,id_agente,estado,timestamp' WHERE `token` LIKE 'event_fields';
DELETE FROM `tconfig` WHERE `token` LIKE 'integria_enabled';
DELETE FROM `tconfig` WHERE `token` LIKE 'integria_api_password';
DELETE FROM `tconfig` WHERE `token` LIKE 'integria_inventory';
DELETE FROM `tconfig` WHERE `token` LIKE 'integria_url';
-- ---------------------------------------------------------------------
-- Table `tconfig_os`
@ -1438,11 +1451,15 @@ ALTER TABLE `treport_content` ADD COLUMN `unknown_checks` TINYINT(1) DEFAULT '1'
ALTER TABLE `treport_content` ADD COLUMN `agent_max_value` TINYINT(1) DEFAULT '1';
ALTER TABLE `treport_content` ADD COLUMN `agent_min_value` TINYINT(1) DEFAULT '1';
ALTER TABLE `treport_content` ADD COLUMN `current_month` TINYINT(1) DEFAULT '1';
ALTER TABLE `treport_content` ADD COLUMN `failover_mode` tinyint(1) DEFAULT '0';
ALTER TABLE `treport_content` ADD COLUMN `failover_type` tinyint(1) DEFAULT '0';
ALTER table `treport_content` MODIFY COLUMN `name` varchar(300) NULL;
-- ---------------------------------------------------------------------
-- Table `tmodule_relationship`
-- ---------------------------------------------------------------------
ALTER TABLE tmodule_relationship ADD COLUMN `id_server` varchar(100) NOT NULL DEFAULT '';
ALTER TABLE `tmodule_relationship` ADD COLUMN `type` ENUM('direct', 'failover') DEFAULT 'direct';
-- ---------------------------------------------------------------------
-- Table `tpolicy_module`
@ -2192,3 +2209,62 @@ CREATE TABLE `tvisual_console_elements_cache` (
ON UPDATE CASCADE
) engine=InnoDB DEFAULT CHARSET=utf8;
-- ---------------------------------------------------------------------
-- Table `tcredential_store`
-- ---------------------------------------------------------------------
CREATE TABLE IF NOT EXISTS `tcredential_store` (
`identifier` varchar(100) NOT NULL,
`id_group` mediumint(4) unsigned NOT NULL DEFAULT 0,
`product` enum('CUSTOM', 'AWS', 'AZURE', 'GOOGLE') default 'CUSTOM',
`username` text,
`password` text,
`extra_1` text,
`extra_2` text,
PRIMARY KEY (`identifier`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ---------------------------------------------------------------------
-- Table `treport_content_sla_combined`
-- ---------------------------------------------------------------------
ALTER TABLE `treport_content_sla_combined` ADD `id_agent_module_failover` int(10) unsigned NOT NULL;
-- ---------------------------------------------------------------------
-- Table `tagent_repository`
-- ---------------------------------------------------------------------
CREATE TABLE `tagent_repository` (
`id` SERIAL,
`id_os` INT(10) UNSIGNED DEFAULT 0,
`arch` ENUM('x64', 'x86') DEFAULT 'x64',
`version` VARCHAR(10) DEFAULT '',
`path` text,
`uploaded_by` VARCHAR(100) DEFAULT '',
`uploaded` bigint(20) NOT NULL DEFAULT 0 COMMENT "When it was uploaded",
`last_err` text,
PRIMARY KEY (`id`),
FOREIGN KEY (`id_os`) REFERENCES `tconfig_os`(`id_os`)
ON UPDATE CASCADE ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ----------------------------------------------------------------------
-- Table `tdeployment_hosts`
-- ----------------------------------------------------------------------
CREATE TABLE `tdeployment_hosts` (
`id` SERIAL,
`id_cs` VARCHAR(100),
`ip` VARCHAR(100) NOT NULL UNIQUE,
`id_os` INT(10) UNSIGNED DEFAULT 0,
`os_version` VARCHAR(100) DEFAULT '' COMMENT "OS version in STR format",
`arch` ENUM('x64', 'x86') DEFAULT 'x64',
`current_agent_version` VARCHAR(100) DEFAULT '' COMMENT "String latest installed agent",
`target_agent_version_id` BIGINT UNSIGNED,
`deployed` bigint(20) NOT NULL DEFAULT 0 COMMENT "When it was deployed",
`server_ip` varchar(100) default NULL COMMENT "Where to point target agent",
`last_err` text,
PRIMARY KEY (`id`),
FOREIGN KEY (`id_cs`) REFERENCES `tcredential_store`(`identifier`)
ON UPDATE CASCADE ON DELETE SET NULL,
FOREIGN KEY (`id_os`) REFERENCES `tconfig_os`(`id_os`)
ON UPDATE CASCADE ON DELETE CASCADE,
FOREIGN KEY (`target_agent_version_id`) REFERENCES `tagent_repository`(`id`)
ON UPDATE CASCADE ON DELETE SET NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

View File

@ -35,6 +35,7 @@ ui_require_css_file('firts_task');
</p>
<form action="index.php?sec=gservers&sec2=godmode/servers/discovery" method="post">
<input type="submit" class="button_task" value="<?php echo __('Discover'); ?>" />
<input type="hidden" name="discovery_hint" value="1"/>
</form>
</div>
</div>

View File

@ -20,6 +20,8 @@ if (isset($_SERVER['REQUEST_TIME'])) {
$time = get_system_time();
}
ui_require_css_file('footer');
$license_file = 'general/license/pandora_info_'.$config['language'].'.html';
if (! file_exists($config['homedir'].$license_file)) {
$license_file = 'general/license/pandora_info_en.html';
@ -41,9 +43,17 @@ if ($current_package == 0) {
$build_package_version = $current_package;
}
echo sprintf(__('%s %s - Build %s - MR %s', get_product_name(), $pandora_version, $build_package_version, $config['MR']));
echo __(
'%s %s - Build %s - MR %s',
get_product_name(),
$pandora_version,
$build_package_version,
$config['MR']
);
echo '</a><br />';
echo '<small><span>'.__('Page generated on %s', date('Y-m-d H:i:s')).'</span></small>';
echo '</a> ';
if (isset($config['debug'])) {
$cache_info = [];

View File

@ -670,8 +670,35 @@ if ($config['menu_type'] == 'classic') {
<?php
if ($_GET['refr'] || $do_refresh === true) {
if ($_GET['sec2'] == 'operation/events/events') {
$autorefresh_draw = true;
}
?>
var autorefresh_draw = '<?php echo $autorefresh_draw; ?>';
$("#header_autorefresh").css('padding-right', '5px');
if(autorefresh_draw == true) {
var refresh_interval = parseInt('<?php echo ($config['refr'] * 1000); ?>');
var until_time='';
function events_refresh() {
until_time = new Date();
until_time.setTime (until_time.getTime () + parseInt(<?php echo ($config['refr'] * 1000); ?>));
$("#refrcounter").countdown ({
until: until_time,
layout: '%M%nn%M:%S%nn%S',
labels: ['', '', '', '', '', '', ''],
onExpiry: function () {
dt_events.draw(false);
}
});
}
// Start the countdown when page is loaded (first time).
events_refresh();
// Repeat countdown according to refresh_interval.
setInterval(events_refresh, refresh_interval);
} else {
var refr_time = <?php echo (int) get_parameter('refr', $config['refr']); ?>;
var t = new Date();
t.setTime (t.getTime () + parseInt(<?php echo ($config['refr'] * 1000); ?>));
@ -685,6 +712,7 @@ if ($config['menu_type'] == 'classic') {
$(document).attr ("location", href);
}
});
}
<?php
}
?>
@ -694,7 +722,37 @@ if ($config['menu_type'] == 'classic') {
$("#combo_refr").toggle ();
$("select#ref").change (function () {
href = $("a.autorefresh").attr ("href");
if(autorefresh_draw == true){
inputs = $("#events_form :input");
values = {};
inputs.each(function() {
values[this.name] = $(this).val();
})
var newValue = btoa(JSON.stringify(values));
<?php
// Check if the url has the parameter fb64.
if ($_GET['fb64']) {
$fb64 = $_GET['fb64'];
?>
var fb64 = '<?php echo $fb64; ?>';
// Check if the filters have changed.
if(fb64 !== newValue){
href = href.replace(fb64, newValue);
}
$(document).attr("location", href+ '&refr=' + this.value);
<?php
} else {
?>
$(document).attr("location", href+'&fb64=' + newValue + '&refr=' + this.value);
<?php
}
?>
} else {
$(document).attr ("location", href + this.value);
}
});
return false;

View File

@ -376,6 +376,9 @@ if (isset($correct_reset_pass_process)) {
}
if (isset($login_failed)) {
$nick = get_parameter_post('nick');
$fails = db_get_value('failed_attempt', 'tusuario', 'id_user', $nick);
$attemps = ($config['number_attempts'] - $fails);
echo '<div id="login_failed" title="'.__('Login failed').'">';
echo '<div class="content_alert">';
echo '<div class="icon_message_alert">';
@ -386,6 +389,9 @@ if (isset($login_failed)) {
echo '<h1>'.__('ERROR').'</h1>';
echo '<p>'.$config['auth_error'].'</p>';
echo '</div>';
echo '<div class="text_message_alert">';
echo '<p><strong>Remaining attempts: '.$attemps.'</strong></p>';
echo '</div>';
echo '<div class="button_message_alert">';
html_print_submit_button('Ok', 'hide-login-error', false);
echo '</div>';
@ -518,6 +524,7 @@ if ($login_screen == 'error_authconfig' || $login_screen == 'error_emptyconfig'
ui_require_css_file('dialog');
ui_require_css_file('jquery-ui.min', 'include/styles/js/');
ui_require_jquery_file('jquery-ui.min');
ui_require_jquery_file('jquery-ui_custom');
?>
<?php
@ -679,5 +686,6 @@ html_print_div(['id' => 'forced_title_layer', 'class' => 'forced_title_layer', '
$("#final_process_correct").dialog('close');
});
});
/* ]]> */
</script>

View File

@ -103,99 +103,92 @@ if (!empty($all_data)) {
$data['server_sanity'] = format_numeric((100 - $data['module_sanity']), 1);
}
ui_require_css_file('logon');
?>
<table border="0" width="100%" cellspacing="0" cellpadding="0">
<tr>
echo '<div id="welcome_panel">';
<td width="25%" style="padding-right: 20px;" valign="top">
//
// Overview Table.
//
$table = new stdClass();
$table->class = 'no-class';
$table->cellpadding = 4;
$table->cellspacing = 4;
$table->head = [];
$table->data = [];
$table->headstyle[0] = 'text-align:center;';
$table->width = '100%';
$table->head_colspan[0] = 4;
<?php
//
// Overview Table.
//
$table = new stdClass();
$table->class = 'databox';
$table->cellpadding = 4;
$table->cellspacing = 4;
$table->head = [];
$table->data = [];
$table->headstyle[0] = 'text-align:center;';
$table->width = '100%';
$table->head[0] = '<span>'.__('%s Overview', get_product_name()).'</span>';
$table->head_colspan[0] = 4;
// Indicators.
$tdata = [];
$stats = reporting_get_stats_indicators($data, 120, 10, false);
$status = '<table class="status_tactical">';
foreach ($stats as $stat) {
// Indicators.
$tdata = [];
$stats = reporting_get_stats_indicators($data, 120, 10, false);
$status = '<table class="status_tactical">';
foreach ($stats as $stat) {
$status .= '<tr><td><b>'.$stat['title'].'</b></td><td>'.$stat['graph'].'</td></tr>';
}
}
$status .= '</table>';
$table->data[0][0] = $status;
$table->rowclass[] = '';
$status .= '</table>';
$table->data[0][0] = $status;
$table->rowclass[] = '';
$table->data[] = $tdata;
$table->data[] = $tdata;
// Alerts.
$tdata = [];
$tdata[0] = reporting_get_stats_alerts($data);
$table->rowclass[] = '';
$table->data[] = $tdata;
// Alerts.
$tdata = [];
$tdata[0] = reporting_get_stats_alerts($data);
$table->rowclass[] = '';
$table->data[] = $tdata;
// Modules by status.
$tdata = [];
$tdata[0] = reporting_get_stats_modules_status($data, 180, 100);
$table->rowclass[] = '';
$table->data[] = $tdata;
// Modules by status.
$tdata = [];
$tdata[0] = reporting_get_stats_modules_status($data, 180, 100);
$table->rowclass[] = '';
$table->data[] = $tdata;
// Total agents and modules.
$tdata = [];
$tdata[0] = reporting_get_stats_agents_monitors($data);
$table->rowclass[] = '';
$table->data[] = $tdata;
// Total agents and modules.
$tdata = [];
$tdata[0] = reporting_get_stats_agents_monitors($data);
$table->rowclass[] = '';
$table->data[] = $tdata;
// Users.
if (users_is_admin()) {
// Users.
if (users_is_admin()) {
$tdata = [];
$tdata[0] = reporting_get_stats_users($data);
$table->rowclass[] = '';
$table->data[] = $tdata;
}
}
html_print_table($table);
unset($table);
?>
ui_toggle(
html_print_table($table, true),
__('%s Overview', get_product_name()),
'',
'overview',
false
);
unset($table);
echo '<div id="right">';
// News.
$options = [];
$options['id_user'] = $config['id_user'];
$options['modal'] = false;
$options['limit'] = 3;
$news = get_news($options);
</td>
<td width="75%" valign="top">
<?php
$options = [];
$options['id_user'] = $config['id_user'];
$options['modal'] = false;
$options['limit'] = 3;
$news = get_news($options);
if (!empty($news)) {
if (!empty($news)) {
ui_require_css_file('news');
// NEWS BOARD.
echo '<div id="news_board">';
echo '<table cellpadding="0" width=100% cellspacing="0" class="databox filters">';
echo '<tr><th style="text-align:center;"><span >'.__('News board').'</span></th></tr>';
if ($config['prominent_time'] == 'timestamp') {
$comparation_suffix = '';
} else {
$comparation_suffix = __('ago');
}
$output_news = '<div id="news_board" class="new">';
foreach ($news as $article) {
$image = false;
if ($article['text'] == '&amp;lt;p&#x20;style=&quot;text-align:&#x20;center;&#x20;font-size:&#x20;13px;&quot;&amp;gt;Hello,&#x20;congratulations,&#x20;if&#x20;you&apos;ve&#x20;arrived&#x20;here&#x20;you&#x20;already&#x20;have&#x20;an&#x20;operational&#x20;monitoring&#x20;console.&#x20;Remember&#x20;that&#x20;our&#x20;forums&#x20;and&#x20;online&#x20;documentation&#x20;are&#x20;available&#x20;24x7&#x20;to&#x20;get&#x20;you&#x20;out&#x20;of&#x20;any&#x20;trouble.&#x20;You&#x20;can&#x20;replace&#x20;this&#x20;message&#x20;with&#x20;a&#x20;personalized&#x20;one&#x20;at&#x20;Admin&#x20;tools&#x20;-&amp;amp;gt;&#x20;Site&#x20;news.&amp;lt;/p&amp;gt;&#x20;') {
@ -204,71 +197,76 @@ if (!empty($all_data)) {
$text_bbdd = io_safe_output($article['text']);
$text = html_entity_decode($text_bbdd);
echo '<tr><th class="green_title">'.$article['subject'].'</th></tr>';
echo '<tr><td>'.__('by').' <b>'.$article['author'].'</b> <i>'.ui_print_timestamp($article['timestamp'], true).'</i> '.$comparation_suffix.'</td></tr>';
echo '<tr><td class="datos">';
$output_news .= '<span class="green_title">'.$article['subject'].'</span>';
$output_news .= '<div class="new content">';
$output_news .= '<p>'.__('by').' <b>'.$article['author'].'</b> <i>'.ui_print_timestamp($article['timestamp'], true).'</i> '.$comparation_suffix.'</p>';
if ($image) {
echo '<center><img src="./images/welcome_image.png" alt="img colabora con nosotros - Support" width="191" height="207"></center>';
$output_news .= '<center><img src="./images/welcome_image.png" alt="img colabora con nosotros - Support" width="191" height="207"></center>';
}
echo nl2br($text);
echo '</td></tr>';
$output_news .= nl2br($text);
$output_news .= '</div>';
}
echo '</table>';
echo '</div>';
$output_news .= '</div>';
// News board.
echo '<br><br>';
ui_toggle(
$output_news,
__('News board'),
'',
'news',
false
);
// END OF NEWS BOARD.
}
}
// LAST ACTIVITY.
// Show last activity from this user.
echo '<div id="activity">';
$table = new stdClass();
$table->class = 'info_table';
$table->cellpadding = 0;
$table->cellspacing = 0;
$table->width = '100%';
// Don't specify px.
$table->data = [];
$table->size = [];
$table->size[0] = '5%';
$table->size[1] = '15%';
$table->size[2] = '15%';
$table->size[3] = '10%';
$table->size[4] = '25%';
$table->head = [];
$table->head[0] = __('User');
$table->head[1] = __('Action');
$table->head[2] = __('Date');
$table->head[3] = __('Source IP');
$table->head[4] = __('Comments');
$table->title = '<span>'.__('This is your last activity performed on the %s console', get_product_name()).'</span>';
$sql = sprintf(
// LAST ACTIVITY.
// Show last activity from this user.
$table = new stdClass();
$table->class = 'no-td-padding info_table';
$table->cellpadding = 0;
$table->cellspacing = 0;
$table->width = '100%';
// Don't specify px.
$table->data = [];
$table->size = [];
$table->headstyle = [];
$table->size[0] = '5%';
$table->size[1] = '15%';
$table->headstyle[1] = 'min-width: 12em;';
$table->size[2] = '5%';
$table->headstyle[2] = 'min-width: 65px;';
$table->size[3] = '10%';
$table->size[4] = '25%';
$table->head = [];
$table->head[0] = __('User');
$table->head[1] = __('Action');
$table->head[2] = __('Date');
$table->head[3] = __('Source IP');
$table->head[4] = __('Comments');
$table->align[4] = 'left';
$sql = sprintf(
'SELECT id_usuario,accion, ip_origen,descripcion,utimestamp
FROM tsesion
WHERE (`utimestamp` > UNIX_TIMESTAMP(NOW()) - '.SECONDS_1WEEK.")
AND `id_usuario` = '%s' ORDER BY `utimestamp` DESC LIMIT 10",
$config['id_user']
);
);
$sessions = db_get_all_rows_sql($sql);
$sessions = db_get_all_rows_sql($sql);
if ($sessions === false) {
if ($sessions === false) {
$sessions = [];
}
}
foreach ($sessions as $session) {
foreach ($sessions as $session) {
$data = [];
$session_id_usuario = $session['id_usuario'];
$session_ip_origen = $session['ip_origen'];
$data[0] = '<strong>'.$session_id_usuario.'</strong>';
$data[1] = ui_print_session_action_icon($session['accion'], true).' '.$session['accion'];
$data[2] = ui_print_help_tip(
@ -284,18 +282,24 @@ if (!empty($all_data)) {
}
array_push($table->data, $data);
}
}
echo "<div style='width:100%; overflow-x:auto;'>";
html_print_table($table);
unset($table);
echo '</div>';
echo '</div>';
// END OF LAST ACTIVIYY.
?>
$activity .= html_print_table($table, true);
unset($table);
ui_toggle(
$activity,
__('Latest activity'),
'',
'activity',
false,
false,
'',
'white-box-content padded'
);
// END OF LAST ACTIVIYY.
// Close right panel.
echo '</div>';
</td>
</tr>
</table>
// Close welcome panel.
echo '</div>';

View File

@ -30,12 +30,6 @@ $(document).ready(function(){
}
});
// Set the height of the menu.
$(window).on('load', function (){
$("#menu_full").height($("#container").height());
});
</script>
<?php
$autohidden_menu = 0;

View File

@ -0,0 +1,164 @@
<html>
<head>
<style>
#alert_messages_na{
z-index:2;
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
-webkit-transform: translate(-50%, -50%);
width:650px;
height: 400px;
background:white;
background-image:url('images/imagen-no-acceso.jpg');
background-repeat:no-repeat;
justify-content: center;
display: flex;
flex-direction: column;
box-shadow:4px 5px 10px 3px rgba(0, 0, 0, 0.4);
}
.modalheade{
text-align:center;
width:100%;
position:absolute;
top:0;
}
.modalheadertex{
color:#000;
font-family:Nunito;
line-height: 40px;
font-size: 23pt;
margin-bottom:30px;
}
.modalclose{
cursor:pointer;
display:inline;
float:right;
margin-right:10px;
margin-top:10px;
}
.modalconten{
color:black;
width:300px;
margin-left: 30px;
}
.modalcontenttex{
text-align:left;
color:black;
font-size: 11pt;
line-height:13pt;
margin-bottom:30px;
}
.modalokbutto{
cursor:pointer;
text-align:center;
display: inline-block;
padding: 6px 45px;
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
border-radius: 3px;
background-color:white;
border: 1px solid #82b92e;
}
.modalokbuttontex{
color:#82b92e;
font-family:Nunito;
font-size:13pt;
}
.modalgobutto{
cursor:pointer;
text-align:center;
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
border-radius: 3px;
background-color:white;
border: 1px solid #82b92e;
}
.modalgobuttontex{
color:#82b92e;
font-family:Nunito;
font-size:10pt;
}
#opacidad{
position:fixed;
background:black;
opacity:0.6;
z-index:-1;
left:0px;
top:0px;
width:100%;
height:100%;
}
/*
.textodialog{
margin-left: 0px;
color:#333;
padding:20px;
font-size:9pt;
}
.cargatextodialog{
max-width:58.5%;
width:58.5%;
min-width:58.5%;
float:left;
margin-left: 0px;
font-size:18pt;
padding:20px;
text-align:center;
}
.cargatextodialog p, .cargatextodialog b, .cargatextodialog a{
font-size:18pt;
}
*/
</style>
</head>
<body>
<div id="alert_messages_na">
<div class='modalheade'>
<img class='modalclose cerrar' src='<?php echo $config['homeurl']; ?>images/input_cross.png'>
</div>
<div class='modalconten'>
<div class='modalheadertex'>
<?php echo __("You don't have access to this page"); ?>
</div>
<div class='modalcontenttex'>
<?php
echo __('Access to this page is restricted to authorized users SAML only, please contact system administrator if you need assistance.');
echo '<br/> <br/>';
echo __('Please make sure you have SAML authentication properly configured. For more information the error to access this page are recorded in security logs of %s System Database', get_product_name());
?>
</div>
<div class='modalokbutto cerrar'>
<span class='modalokbuttontex'>OK</span>
</div>
</div>
</div>
<div id="opacidad"></div>
</body>
</html>
<script>
$(".cerrar").click(function(){
window.location=".";
});
$('div#page').css('background-color','#d3d3d3');
</script>

View File

@ -122,7 +122,6 @@ if (is_ajax()) {
exit();
}
ui_require_css_file('register');
$initial = isset($config['initial_wizard']) !== true
@ -150,7 +149,8 @@ if ($initial && users_is_admin()) {
);
}
if ($registration && users_is_admin()) {
if (!$config['disabled_newsletter']) {
if ($registration && users_is_admin()) {
// Prepare registration wizard, not launch. leave control to flow.
registration_wiz_modal(
false,
@ -158,7 +158,7 @@ if ($registration && users_is_admin()) {
!$initial,
(($show_newsletter === true) ? 'force_run_newsletter()' : null)
);
} else {
} else {
if ($show_newsletter) {
// Show newsletter wizard for current user.
newsletter_wiz_modal(
@ -167,9 +167,9 @@ if ($registration && users_is_admin()) {
!$registration && !$initial
);
}
}
}
$newsletter = null;
?>

View File

@ -94,7 +94,7 @@ $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);
ui_toggle($form, __('Filter'), '', '', false);
$filter = '1=1';

View File

@ -77,6 +77,7 @@ if (is_ajax()) {
}
$get_modules_json_for_multiple_snmp = (bool) get_parameter('get_modules_json_for_multiple_snmp', 0);
$get_common_modules = (bool) get_parameter('get_common_modules', 1);
if ($get_modules_json_for_multiple_snmp) {
include_once 'include/graphs/functions_utils.php';
@ -100,7 +101,16 @@ if (is_ajax()) {
if ($out === false) {
$out = $oid_snmp;
} else {
$out = array_intersect($out, $oid_snmp);
$commons = array_intersect($out, $oid_snmp);
if ($get_common_modules) {
// Common modules is selected (default)
$out = $commons;
} else {
// All modules is selected
$array1 = array_diff($out, $oid_snmp);
$array2 = array_diff($oid_snmp, $out);
$out = array_merge($commons, $array1, $array2);
}
}
$oid_snmp = [];
@ -176,7 +186,7 @@ if ($disk_conf_delete) {
@unlink($filename['conf']);
}
echo '<form name="conf_agent" method="post" action="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente">';
echo '<form autocomplete="new-password" name="conf_agent" method="post" action="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente">';
// Custom ID.
$custom_id_div = '<div class="label_select">';
@ -201,7 +211,7 @@ if (!$new_agent && $alias != '') {
$table_agent_name .= '<div class="label_select_child_right agent_options_agent_name" style="width: 40%;">';
if ($id_agente) {
$table_agent_name .= '<label>'.__('ID').'</label><input style="width: 50%;" type="text" disabled="true" value="'.$id_agente.'" />';
$table_agent_name .= '<label>'.__('ID').'</label><input style="width: 50%;" type="text" readonly value="'.$id_agente.'" />';
$table_agent_name .= '<a href="index.php?sec=gagente&sec2=operation/agentes/ver_agente&id_agente='.$id_agente.'">';
$table_agent_name .= html_print_image(
'images/zoom.png',
@ -245,7 +255,7 @@ if (!$new_agent && $alias != '') {
$table_agent_name .= '</div></div></div>';
// QR code div.
$table_qr_code = '<div class="agent_qr white_box">';
$table_qr_code = '<div class="box-shadow agent_qr white_box">';
$table_qr_code .= '<p class="input_label">'.__('QR Code Agent view').': </p>';
$table_qr_code .= '<div id="qr_container_image"></div>';
if ($id_agente) {
@ -372,13 +382,13 @@ $table_server = '<div class="label_select"><p class="input_label">'.__('Server')
$table_server .= '<div class="label_select_parent">';
if ($new_agent) {
// Set first server by default.
$servers_get_names = servers_get_names();
$servers_get_names = $servers;
$array_keys_servers_get_names = array_keys($servers_get_names);
$server_name = reset($array_keys_servers_get_names);
}
$table_server .= html_print_select(
servers_get_names(),
$servers,
'server_name',
$server_name,
'',
@ -401,7 +411,7 @@ $table_description .= html_print_textarea(
// QR code.
echo '<div class="first_row">
<div class="agent_options '.$agent_options_update.' white_box">
<div class="box-shadow agent_options '.$agent_options_update.' white_box">
<div class="agent_options_column_left">'.$table_agent_name.$table_alias.$table_ip.$table_primary_group.'</div>
<div class="agent_options_column_right">'.$table_interval.$table_os.$table_server.$table_description.'</div>
</div>';
@ -413,8 +423,8 @@ echo '</div>';
if (enterprise_installed()) {
$secondary_groups_selected = enterprise_hook('agents_get_secondary_groups', [$id_agente]);
$table_adv_secondary_groups = '<div class="label_select"><p class="input_label">'.__('Secondary groups').': </p></div>';
$table_adv_secondary_groups_left = html_print_select_groups(
$adv_secondary_groups_label = '<div class="label_select"><p class="input_label">'.__('Secondary groups').': </p></div>';
$adv_secondary_groups_left = html_print_select_groups(
false,
// Use the current user to select the groups.
'AR',
@ -441,7 +451,7 @@ if (enterprise_installed()) {
// CSS classnames (default).
false,
// Not disabled (default).
'width:50%; min-width:170px;',
'min-width:170px;',
// Inline styles (default).
false,
// Option style select (default).
@ -455,7 +465,7 @@ if (enterprise_installed()) {
// Do not show the primary group in this selection.
);
$table_adv_secondary_groups_arrows = html_print_input_image(
$adv_secondary_groups_arrows = html_print_input_image(
'add_secondary',
'images/darrowright_green.png',
1,
@ -479,7 +489,7 @@ if (enterprise_installed()) {
]
);
$table_adv_secondary_groups_right .= html_print_select(
$adv_secondary_groups_right .= html_print_select(
$secondary_groups_selected['for_select'],
// Values.
'secondary_groups_selected',
@ -502,7 +512,7 @@ if (enterprise_installed()) {
// Class.
false,
// Disabled.
'width:50%; min-width:170px;'
'min-width:170px;'
// Style.
);
@ -514,9 +524,11 @@ if (enterprise_installed()) {
);
$safe_mode_modules = [];
$safe_mode_modules[0] = __('Any');
if (is_array($sql_modules)) {
foreach ($sql_modules as $m) {
$safe_mode_modules[$m['id_module']] = $m['name'];
}
}
$table_adv_safe = '<div class="label_select_simple label_simple_items"><p class="input_label input_label_simple">'.__('Safe operation mode').': '.ui_print_help_tip(
__(
@ -579,7 +591,7 @@ if (enterprise_installed()) {
}
$table_adv_parent = '<div class="label_select"><p class="input_label">'.__('Parent').': </p>';
$table_adv_parent = '<div class="label_select"><label class="input_label">'.__('Parent').': </label>';
$params = [];
$params['return'] = true;
$params['show_helptip'] = true;
@ -648,13 +660,15 @@ $table_adv_module_mode .= html_print_radio_button_extended(
$table_adv_module_mode .= '</div></div>';
// Status (Disabled / Enabled).
$table_adv_status = '<div class="label_select_simple label_simple_one_item"><p class="input_label input_label_simple">'.__('Disabled').': '.ui_print_help_tip(__('If the remote configuration is enabled, it will also go into standby mode when disabling it.'), true).'</p>';
$table_adv_status = '<div class="label_select_simple label_simple_one_item">';
$table_adv_status .= html_print_checkbox_switch(
'disabled',
1,
$disabled,
true
).'</div>';
);
$table_adv_status .= '<p class="input_label input_label_simple">'.__('Disabled').': '.ui_print_help_tip(__('If the remote configuration is enabled, it will also go into standby mode when disabling it.'), true).'</p>';
$table_adv_status .= '</div>';
// Url address.
if (enterprise_installed()) {
@ -665,7 +679,14 @@ if (enterprise_installed()) {
'',
45,
255,
true
true,
false,
false,
'',
'',
'',
// Autocomplete.
'new-password'
).'</div>';
} else {
$table_adv_url = '<div class="label_select"><p class="input_label">'.__('Url address').': </p></div>';
@ -679,9 +700,11 @@ if (enterprise_installed()) {
).'</div>';
}
$table_adv_quiet = '<div class="label_select_simple label_simple_one_item"><p class="input_label input_label_simple">'.__('Quiet').': ';
$table_adv_quiet = '<div class="label_select_simple label_simple_one_item">';
$table_adv_quiet .= html_print_checkbox_switch('quiet', 1, $quiet, true);
$table_adv_quiet .= '<p class="input_label input_label_simple">'.__('Quiet').': ';
$table_adv_quiet .= ui_print_help_tip(__('The agent still runs but the alerts and events will be stop'), true).'</p>';
$table_adv_quiet .= html_print_checkbox_switch('quiet', 1, $quiet, true).'</div>';
$table_adv_quiet .= '</div>';
$listIcons = gis_get_array_list_icons();
@ -753,33 +776,48 @@ if ($config['activate_gis']) {
// General display distribution.
$table_adv_options = $table_adv_secondary_groups.'<div class="secondary_groups_select" style="margin-bottom:30px;">
<div class="secondary_groups_list_left">
'.$table_adv_secondary_groups_left.'
$table_adv_options = '
<div class="secondary_groups_list">
'.$adv_secondary_groups_label.'
<div class="sg_source">
'.$adv_secondary_groups_left.'
</div>
<div class="secondary_groups_select_arrows">
'.$table_adv_secondary_groups_arrows.'
<div class="secondary_group_arrows">
'.$adv_secondary_groups_arrows.'
</div>
<div class="secondary_groups_list_right">
'.$table_adv_secondary_groups_right.'
<div class="sg_target">
'.$adv_secondary_groups_right.'
</div>
</div>
<div class="agent_options agent_options_adv">
<div class="agent_options_column_left" >'.$table_adv_parent.$table_adv_module_mode.$table_adv_cascade;
<div class="agent_av_opt_right" >
'.$table_adv_parent.$table_adv_module_mode.$table_adv_cascade;
if ($new_agent) {
// If agent is new, show custom id as old style format.
$table_adv_options .= $custom_id_div;
}
$table_adv_options .= $table_adv_gis.'</div>
<div class="agent_options_column_right" >'.$table_adv_agent_icon.$table_adv_url.$table_adv_quiet.$table_adv_status.$table_adv_remote.$table_adv_safe.'</div>
$table_adv_options .= '</div>';
$table_adv_options .= '
<div class="agent_av_opt_left" >
'.$table_adv_gis.$table_adv_agent_icon.$table_adv_url.$table_adv_quiet.$table_adv_status.$table_adv_remote.$table_adv_safe.'
</div>';
echo '<div class="ui_toggle">';
ui_toggle($table_adv_options, __('Advanced options'), '', true, false, 'white_box white_box_opened');
echo '</div>';
if (enterprise_installed()) {
echo '<div class="ui_toggle">';
ui_toggle(
$table_adv_options,
__('Advanced options'),
'',
'',
true,
false,
'white_box white_box_opened',
'no-border flex'
);
echo '</div>';
}
$table = new stdClass();
$table->width = '100%';
@ -831,7 +869,7 @@ foreach ($fields as $field) {
$custom_value = '';
}
$table->rowstyle[$i] = 'cursor: pointer;';
$table->rowstyle[$i] = 'cursor: pointer;user-select: none;';
if (!empty($custom_value)) {
$table->rowstyle[($i + 1)] = 'display: table-row;';
} else {
@ -893,16 +931,48 @@ foreach ($fields as $field) {
$i += 2;
}
if (!empty($fields)) {
if (enterprise_installed()) {
if (!empty($fields)) {
echo '<div class="ui_toggle">';
ui_toggle(
html_print_table($table, true),
__('Custom fields'),
'',
'',
true,
false,
'white_box white_box_opened'
'white_box white_box_opened',
'no-border'
);
echo '</div>';
}
} else {
echo '<div class="ui_toggle">';
ui_toggle(
$table_adv_options,
__('Advanced options'),
'',
'',
true,
false,
'white_box white_box_opened',
'no-border flex'
);
if (!empty($fields)) {
ui_toggle(
html_print_table($table, true),
__('Custom fields'),
'',
'',
true,
false,
'white_box white_box_opened',
'no-border'
);
}
echo '<div class="action-buttons" style="display: flex; justify-content: flex-end; align-items: center; width: '.$table->width.'">';
echo '</div>';
}
@ -1134,6 +1204,19 @@ ui_require_jquery_file('bgiframe');
}
$(document).ready (function() {
var previous_primary_group_select;
$("#grupo").on('focus', function () {
previous_primary_group_select = this.value;
}).change(function() {
if ($("#secondary_groups_selected option[value="+$("#grupo").val()+"]").length) {
alert("<?php echo __('Secondary group cannot be primary too.'); ?>");
$("#grupo").val(previous_primary_group_select);
} else {
previous_primary_group_select = this.value;
}
});
$("select#id_os").pandoraSelectOS ();
var checked = $("#checkbox-cascade_protection").is(":checked");
@ -1182,7 +1265,7 @@ ui_require_jquery_file('bgiframe');
128,
128
);
$("#text-agente").prop('disabled', true);
$("#text-agente").prop('readonly', true);
});
</script>

View File

@ -1,16 +1,32 @@
<?php
/**
* Extension to manage a list of gateways and the node address where they should
* point to.
*
* @category SNMP interfaces.
* @package Pandora FMS
* @subpackage Community
* @version 1.0.0
* @license See below
*
* ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2005-2019 Artica Soluciones Tecnologicas
* Please see http://pandorafms.org for full contribution list
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation for version 2.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* ============================================================================
*/
// Pandora FMS - http://pandorafms.com
// ==================================================
// Copyright (c) 2005-2011 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_agents.php';
require_once 'include/functions_modules.php';
@ -23,7 +39,6 @@ $idAgent = (int) get_parameter('id_agente', 0);
$ipAgent = db_get_value('direccion', 'tagente', 'id_agente', $idAgent);
check_login();
$ip_target = (string) get_parameter('ip_target', $ipAgent);
$use_agent = get_parameter('use_agent');
$snmp_community = (string) get_parameter('snmp_community', 'public');
@ -37,10 +52,10 @@ $snmp3_privacy_method = get_parameter('snmp3_privacy_method');
$snmp3_privacy_pass = io_safe_output(get_parameter('snmp3_privacy_pass'));
$tcp_port = (string) get_parameter('tcp_port');
// See if id_agente is set (either POST or GET, otherwise -1
// See if id_agente is set (either POST or GET, otherwise -1.
$id_agent = $idAgent;
// Get passed variables
// Get passed variables.
$snmpwalk = (int) get_parameter('snmpwalk', 0);
$create_modules = (int) get_parameter('create_modules', 0);
@ -48,7 +63,7 @@ $interfaces = [];
$interfaces_ip = [];
if ($snmpwalk) {
// OID Used is for SNMP MIB-2 Interfaces
// OID Used is for SNMP MIB-2 Interfaces.
$snmpis = get_snmpwalk(
$ip_target,
$snmp_version,
@ -64,7 +79,7 @@ if ($snmpwalk) {
$tcp_port,
$server_to_exec
);
// ifXTable is also used
// IfXTable is also used.
$ifxitems = get_snmpwalk(
$ip_target,
$snmp_version,
@ -81,7 +96,7 @@ if ($snmpwalk) {
$server_to_exec
);
// Get the interfaces IPV4/IPV6
// Get the interfaces IPV4/IPV6.
$snmp_int_ip = get_snmpwalk(
$ip_target,
$snmp_version,
@ -98,12 +113,12 @@ if ($snmpwalk) {
$server_to_exec
);
// Build a [<interface id>] => [<interface ip>] array
// Build a [<interface id>] => [<interface ip>] array.
if (!empty($snmp_int_ip)) {
foreach ($snmp_int_ip as $key => $value) {
// The key is something like IP-MIB::ipAddressIfIndex.ipv4."<ip>"
// or IP-MIB::ipAddressIfIndex.ipv6."<ip>"
// The value is something like INTEGER: <interface id>
// The key is something like IP-MIB::ipAddressIfIndex.ipv4."<ip>".
// or IP-MIB::ipAddressIfIndex.ipv6."<ip>".
// The value is something like INTEGER: <interface id>.
$data = explode(': ', $value);
$interface_id = !empty($data) && isset($data[1]) ? $data[1] : false;
@ -111,7 +126,7 @@ if ($snmpwalk) {
$interface_ip = $matches[1];
}
// Get the first ip
// Get the first ip.
if ($interface_id !== false && !empty($interface_ip) && !isset($interfaces_ip[$interface_id])) {
$interfaces_ip[$interface_id] = $interface_ip;
}
@ -120,17 +135,17 @@ if ($snmpwalk) {
unset($snmp_int_ip);
}
$snmpis = array_merge(($snmpis === false ? [] : $snmpis), ($ifxitems === false ? [] : $ifxitems));
$snmpis = array_merge((($snmpis === false) ? [] : $snmpis), (($ifxitems === false) ? [] : $ifxitems));
$interfaces = [];
// We get here only the interface part of the MIB, not full mib
// We get here only the interface part of the MIB, not full mib.
foreach ($snmpis as $key => $snmp) {
$data = explode(': ', $snmp, 2);
$keydata = explode('::', $key);
$keydata2 = explode('.', $keydata[1]);
// Avoid results without index and interfaces without name
// Avoid results without index and interfaces without name.
if (!isset($keydata2[1]) || !isset($data[1])) {
continue;
}
@ -240,24 +255,22 @@ if ($create_modules) {
$oid_array[(count($oid_array) - 1)] = $id;
$oid = implode('.', $oid_array);
// Get the name
// Get the name.
$name_array = explode('::', $oid_array[0]);
$name = $ifname.'_'.$name_array[1];
// Clean the name
// Clean the name.
$name = str_replace('"', '', $name);
// Proc moduletypes
// Proc moduletypes.
if (preg_match('/Status/', $name_array[1])) {
$module_type = 18;
} else if (preg_match('/Present/', $name_array[1])) {
$module_type = 18;
} else if (preg_match('/PromiscuousMode/', $name_array[1])) {
$module_type = 18;
}
// String moduletypes
else if (preg_match('/Alias/', $name_array[1])) {
} else if (preg_match('/Alias/', $name_array[1])) {
// String moduletypes.
$module_type = 17;
} else if (preg_match('/Address/', $name_array[1])) {
$module_type = 17;
@ -267,15 +280,11 @@ if ($create_modules) {
$module_type = 17;
} else if (preg_match('/Descr/', $name_array[1])) {
$module_type = 17;
}
// Specific counters (ends in s)
else if (preg_match('/s$/', $name_array[1])) {
} else if (preg_match('/s$/', $name_array[1])) {
// Specific counters (ends in s).
$module_type = 16;
}
// Otherwise, numeric
else {
} else {
// Otherwise, numeric.
$module_type = 15;
}
@ -331,7 +340,7 @@ if ($create_modules) {
$output_oid = '';
exec('ssh pandora_exec_proxy@'.$row['ip_address'].' snmptranslate -On '.$oid, $output_oid, $rc);
exec('snmptranslate -On '.$oid, $output_oid, $rc);
$conf_oid = $output_oid[0];
$oid = $conf_oid;
@ -398,7 +407,9 @@ if ($create_modules) {
}
if ($done > 0) {
ui_print_success_message(__('Successfully modules created')." ($done)");
ui_print_success_message(
__('Successfully modules created').' ('.$done.')'
);
}
if (!empty($errors)) {
@ -408,17 +419,17 @@ if ($create_modules) {
foreach ($errors as $code => $number) {
switch ($code) {
case ERR_EXIST:
$msg .= '<br>'.__('Another module already exists with the same name')." ($number)";
$msg .= '<br>'.__('Another module already exists with the same name').' ('.$number.')';
break;
case ERR_INCOMPLETE:
$msg .= '<br>'.__('Some required fields are missed').': ('.__('name').') '." ($number)";
$msg .= '<br>'.__('Some required fields are missed').': ('.__('name').') ('.$number.')';
break;
case ERR_DB:
case ERR_GENERIC:
default:
$msg .= '<br>'.__('Processing error')." ($number)";
$msg .= '<br>'.__('Processing error').' ('.$number.')';
break;
}
}
@ -427,10 +438,10 @@ if ($create_modules) {
}
}
// Create the interface list for the interface
// Create the interface list for the interface.
$interfaces_list = [];
foreach ($interfaces as $interface) {
// Get the interface name, removing " " characters and avoid "blank" interfaces
// Get the interface name, removing " " characters and avoid "blank" interfaces.
if (isset($interface['ifDescr']) && $interface['ifDescr']['value'] != '') {
$ifname = $interface['ifDescr']['value'];
} else if (isset($interface['ifName']) && $interface['ifName']['value'] != '') {
@ -443,7 +454,7 @@ foreach ($interfaces as $interface) {
}
echo '<span id ="none_text" style="display: none;">'.__('None').'</span>';
echo "<form method='post' id='walk_form' action='index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=agent_wizard&wizard_section=snmp_interfaces_explorer&id_agente=$id_agent'>";
echo "<form method='post' id='walk_form' action='index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=agent_wizard&wizard_section=snmp_interfaces_explorer&id_agente=".$id_agent."'>";
$table->width = '100%';
$table->cellpadding = 0;
@ -465,10 +476,15 @@ if (enterprise_installed()) {
enterprise_include_once('include/functions_satellite.php');
$rows = get_proxy_servers();
// Check if satellite server has remote configuration enabled.
$satellite_remote = config_agents_has_remote_configuration($id_agent);
foreach ($rows as $row) {
if ($row['server_type'] != 13) {
$s_type = ' (Standard)';
} else {
$id_satellite = $row['id_server'];
$s_type = ' (Satellite)';
}
@ -477,7 +493,16 @@ if (enterprise_installed()) {
}
$table->data[1][2] = '<b>'.__('Server to execute command').'</b>';
$table->data[1][3] = html_print_select($servers_to_exec, 'server_to_exec', $server_to_exec, '', '', '', true);
$table->data[1][2] .= '<span id=satellite_remote_tip>'.ui_print_help_tip(__('In order to use remote executions you need to enable remote execution in satellite server'), true, 'images/tip_help.png', false, 'display:').'</span>';
$table->data[1][4] = html_print_select(
$servers_to_exec,
'server_to_exec',
$server_to_exec,
'satellite_remote_warn('.$id_satellite.','.$satellite_remote.')',
'',
'',
true
);
$snmp_versions['1'] = 'v. 1';
$snmp_versions['2'] = 'v. 2';
@ -497,7 +522,7 @@ html_print_table($table);
unset($table);
// SNMP3 OPTIONS
// SNMP3 OPTIONS.
$table->width = '100%';
$table->data[2][1] = '<b>'.__('Auth user').'</b>';
@ -552,7 +577,7 @@ echo '</form>';
if (!empty($interfaces_list)) {
echo '<span id ="none_text" style="display: none;">'.__('None').'</span>';
echo "<form method='post' action='index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=agent_wizard&wizard_section=snmp_interfaces_explorer&id_agente=$id_agent'>";
echo "<form method='post' action='index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=agent_wizard&wizard_section=snmp_interfaces_explorer&id_agente=".$id_agent."'>";
echo '<span id="form_interfaces">';
$id_snmp_serialize = serialize_in_temp($interfaces, $config['id_user'].'_snmp');
@ -577,13 +602,30 @@ if (!empty($interfaces_list)) {
$table->width = '100%';
// Agent selector
// Agent selector.
$table->data[0][0] = '<b>'.__('Interfaces').'</b>';
$table->data[0][1] = '';
$table->data[0][2] = '<b>'.__('Modules').'</b>';
$table->data[1][0] = html_print_select($interfaces_list, 'id_snmp[]', 0, false, '', '', true, true, true, '', false, 'width:500px; overflow: auto;');
$table->data[1][1] = html_print_image('images/darrowright.png', true);
$table->data[1][1] = __('When selecting interfaces');
$table->data[1][1] .= '<br>';
$table->data[1][1] .= html_print_select(
[
1 => __('Show common modules'),
0 => __('Show all modules'),
],
'modules_selection_mode',
1,
false,
'',
'',
true,
false,
false
);
$table->data[1][2] = html_print_select([], 'module[]', 0, false, '', 0, true, true, true, '', false, 'width:200px;');
$table->data[1][2] .= html_print_input_hidden('agent', $id_agent, true);
@ -609,6 +651,8 @@ ui_require_jquery_file('bgiframe');
$(document).ready (function () {
var inputActive = true;
$('#server_to_exec option').trigger('change');
$(document).data('text_for_module', $("#none_text").html());
$("#id_snmp").change(snmp_changed_by_multiple_snmp);
@ -628,10 +672,17 @@ $(document).ready (function () {
$("#no_snmp").hide ();
$("#form_interfaces").hide ();
});
// When select interfaces changes
$("#modules_selection_mode").change (function() {
$("#id_snmp").trigger('change');
});
});
function snmp_changed_by_multiple_snmp (event, id_snmp, selected) {
var idSNMP = Array();
var get_common_modules = $("#modules_selection_mode option:selected").val();
jQuery.each ($("#id_snmp option:selected"), function (i, val) {
idSNMP.push($(val).val());
@ -643,6 +694,7 @@ function snmp_changed_by_multiple_snmp (event, id_snmp, selected) {
jQuery.post ('ajax.php',
{"page" : "godmode/agentes/agent_manager",
"get_modules_json_for_multiple_snmp": 1,
"get_common_modules" : get_common_modules,
"id_snmp[]": idSNMP,
"id_snmp_serialize": $("#hidden-id_snmp_serialize").val()
},
@ -682,5 +734,20 @@ function snmp_changed_by_multiple_snmp (event, id_snmp, selected) {
"json");
}
function satellite_remote_warn(id_satellite, remote)
{
if(!remote)
{
$('#server_to_exec option[value='+id_satellite+']').prop('disabled', true);
$('#satellite_remote_tip').removeAttr("style").show();
}
else
{
$('#satellite_remote_tip').removeAttr("style").hide();
}
}
/* ]]> */
</script>

View File

@ -1213,7 +1213,7 @@ if ($update_module || $create_module) {
$max_timeout = (int) get_parameter('max_timeout');
$max_retries = (int) get_parameter('max_retries');
$min = (int) get_parameter_post('min');
$min = (int) get_parameter('min');
$max = (int) get_parameter('max');
$interval = (int) get_parameter('module_interval', $intervalo);
$ff_interval = (int) get_parameter('module_ff_interval');
@ -1276,19 +1276,11 @@ if ($update_module || $create_module) {
$m_hide = $m['hide'];
}
if ($update_module) {
if ($m_hide == '1') {
$macros[$k]['value'] = io_input_password(get_parameter($m['macro'], ''));
} else {
$macros[$k]['value'] = get_parameter($m['macro'], '');
}
} else {
if ($m_hide == '1') {
$macros[$k]['value'] = io_input_password($macros_names[$k]);
} else {
$macros[$k]['value'] = $macros_names[$k];
}
}
}
$macros = io_json_mb_encode($macros);

View File

@ -163,7 +163,7 @@ echo '<td>';
echo __('Group').'&nbsp;';
$own_info = get_user_info($config['id_user']);
if (!$own_info['is_admin'] && !check_acl($config['id_user'], 0, 'AW')) {
if (!$own_info['is_admin'] && !check_acl($config['id_user'], 0, 'AR') && !check_acl($config['id_user'], 0, 'AW')) {
$return_all_group = false;
} else {
$return_all_group = true;
@ -680,7 +680,7 @@ if ($agents !== false) {
}
echo '</table>';
ui_pagination($total_agents, "index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&group_id=$ag_group&search=$search&sort_field=$sortField&sort=$sort&disabled=$disabled&os=$os", $offset, 0, false, 'offset', true, 'pagination-bottom');
ui_pagination($total_agents, "index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&group_id=$ag_group&recursion=$recursion&search=$search&sort_field=$sortField&sort=$sort&disabled=$disabled&os=$os", $offset);
echo "<table width='100%'><tr><td align='right'>";
} else {
ui_print_info_message(['no_close' => true, 'message' => __('There are no defined agents') ]);

View File

@ -267,10 +267,10 @@ if ($id_agent_module) {
$cron_interval = explode(' ', $module['cron_interval']);
if (isset($cron_interval[4])) {
$minute_from = $cron_interval[0];
$min = explode('-', $minute_from);
$minute_from = $min[0];
if (isset($min[1])) {
$minute_to = $min[1];
$minute = explode('-', $minute_from);
$minute_from = $minute[0];
if (isset($minute[1])) {
$minute_to = $minute[1];
}
$hour_from = $cron_interval[1];
@ -583,7 +583,13 @@ echo '<h3 id="message" class="error invisible"></h3>';
// TODO: Change to the ui_print_error system
echo '<form method="post" id="module_form">';
html_print_table($table_simple);
ui_toggle(
html_print_table($table_simple, true),
__('Base options'),
'',
'',
false
);
ui_toggle(
html_print_table($table_advanced, true),

View File

@ -78,6 +78,13 @@ function push_table_advanced($row, $id=false)
function add_component_selection($id_network_component_type)
{
global $table_simple;
global $config;
if ($config['style'] === 'pandora_black') {
$background_row = 'background-color: #444';
} else {
$background_row = 'background-color: #cfcfcf';
}
$data = [];
$data[0] = __('Using module component').' ';
@ -116,7 +123,7 @@ function add_component_selection($id_network_component_type)
$data[1] .= '</span>';
$table_simple->colspan['module_component'][1] = 3;
$table_simple->rowstyle['module_component'] = 'background-color: #cfcfcf';
$table_simple->rowstyle['module_component'] = $background_row;
prepend_table_simple($data, 'module_component');
}
@ -134,7 +141,9 @@ $largeClassDisabledBecauseInPolicy = '';
$page = get_parameter('page', '');
if (strstr($page, 'policy_modules') === false && $id_agent_module) {
$in_policies_page = strstr($page, 'policy_modules');
if ($in_policies_page === false && $id_agent_module) {
if ($config['enterprise_installed']) {
if (policies_is_module_linked($id_agent_module) == 1) {
$disabledBecauseInPolicy = 1;
@ -162,7 +171,7 @@ $edit_module = (bool) get_parameter_get('edit_module');
$table_simple = new stdClass();
$table_simple->id = 'simple';
$table_simple->width = '100%';
$table_simple->class = 'databox';
$table_simple->class = 'no-class';
$table_simple->data = [];
$table_simple->style = [];
$table_simple->style[0] = 'font-weight: bold; width: 25%;';
@ -243,6 +252,12 @@ $table_simple->data[0][3] .= html_print_select_from_sql(
$disabledBecauseInPolicy
);
if ((isset($id_agent_module) && $id_agent_module) || $id_policy_module != 0) {
$edit = false;
} else {
$edit = true;
}
$in_policy = strstr($page, 'policy_modules');
if (!$in_policy) {
// Cannot select the current module to be itself parent
@ -273,17 +288,6 @@ if (!$in_policy) {
$table_simple->data[2][0] = __('Type').' '.ui_print_help_icon($help_type, true, '', 'images/help_green.png', '', 'module_type_help');
$table_simple->data[2][0] .= html_print_input_hidden('id_module_type_hidden', $id_module_type, true);
if (isset($id_agent_module)) {
if ($id_agent_module) {
$edit = false;
} else {
$edit = true;
}
} else {
// Run into a policy
$edit = true;
}
if (!$edit) {
$sql = sprintf(
'SELECT id_tipo, nombre
@ -637,7 +641,7 @@ if ($disabledBecauseInPolicy) {
$table_advanced = new stdClass();
$table_advanced->id = 'advanced';
$table_advanced->width = '100%';
$table_advanced->class = 'databox filters';
$table_advanced->class = 'no-class';
$table_advanced->data = [];
$table_advanced->style = [];
$table_advanced->style[0] = $table_advanced->style[3] = $table_advanced->style[5] = 'font-weight: bold;';
@ -1066,7 +1070,7 @@ if (check_acl($config['id_user'], 0, 'PM')) {
$table_macros = new stdClass();
$table_macros->id = 'module_macros';
$table_macros->width = '100%';
$table_macros->class = 'databox filters';
$table_macros->class = 'no-class';
$table_macros->data = [];
$table_macros->style = [];
$table_macros->style[0] = 'font-weight: bold;';
@ -1101,20 +1105,20 @@ $macro_count++;
html_print_input_hidden('module_macro_count', $macro_count);
/*
Advanced form part */
// Add relationships
// Advanced form part.
// Add relationships.
$table_new_relations = new stdClass();
$table_new_relations->id = 'module_new_relations';
$table_new_relations->width = '100%';
$table_new_relations->class = 'databox filters';
$table_new_relations->class = 'no-class';
$table_new_relations->data = [];
$table_new_relations->style = [];
$table_new_relations->style[0] = 'width: 10%; font-weight: bold;';
$table_new_relations->style[1] = 'width: 25%; text-align: center;';
$table_new_relations->style[2] = 'width: 10%; font-weight: bold;';
$table_new_relations->style[3] = 'width: 25%; text-align: center;';
$table_new_relations->style[4] = 'width: 30%; text-align: center;';
$table_new_relations->style[4] = 'width: 10%; font-weight: bold;';
$table_new_relations->style[5] = 'width: 25%; text-align: center;';
$table_new_relations->data[0][0] = __('Agent');
$params = [];
@ -1128,10 +1132,35 @@ $params['javascript_function_action_after_select_js_call'] = 'change_modules_aut
$table_new_relations->data[0][1] = ui_print_agent_autocomplete_input($params);
$table_new_relations->data[0][2] = __('Module');
$table_new_relations->data[0][3] = "<div id='module_autocomplete'></div>";
$table_new_relations->data[0][4] = html_print_button(__('Add relationship'), 'add_relation', false, 'javascript: add_new_relation();', 'class="sub add"', true);
$table_new_relations->data[0][4] .= "&nbsp;&nbsp;<div id='add_relation_status' style='display: inline;'></div>";
// Relationship list
$array_rel_type = [];
$array_rel_type['direct'] = __('Direct');
$array_rel_type['failover'] = __('Failover');
$table_new_relations->data[0][4] = __('Rel. type');
$table_new_relations->data[0][5] = html_print_select(
$array_rel_type,
'relation_type',
'',
'',
'',
0,
true,
false,
true,
''
);
$table_new_relations->data[0][6] = html_print_button(
__('Add relationship'),
'add_relation',
false,
'javascript: add_new_relation();',
'class="sub add"',
true
);
$table_new_relations->data[0][6] .= "&nbsp;&nbsp;<div id='add_relation_status' style='display: inline;'></div>";
// Relationship list.
$table_relations = new stdClass();
$table_relations->id = 'module_relations';
$table_relations->width = '100%';
@ -1141,19 +1170,26 @@ $table_relations->data = [];
$table_relations->rowstyle = [];
$table_relations->rowstyle[-1] = 'display: none;';
$table_relations->style = [];
$table_relations->style[2] = 'width: 10%; text-align: center;';
$table_relations->style[3] = 'width: 10%; text-align: center;';
$table_relations->style[4] = 'width: 10%; text-align: center;';
$table_relations->head[0] = __('Agent');
$table_relations->head[1] = __('Module');
$table_relations->head[2] = __('Changes').ui_print_help_tip(__('Activate this to prevent the relation from being updated or deleted'), true);
$table_relations->head[3] = __('Delete');
$table_relations->head[2] = __('Type');
$table_relations->head[3] = __('Changes').ui_print_help_tip(
__('Activate this to prevent the relation from being updated or deleted'),
true
);
$table_relations->head[4] = __('Delete');
// Create an invisible row to use their html to add new rows
// Create an invisible row to use their html to add new rows.
$table_relations->data[-1][0] = '';
$table_relations->data[-1][1] = '';
$table_relations->data[-1][2] = '<a id="disable_updates_button" class="alpha50" href="">'.html_print_image('images/lock.png', true).'</a>';
$table_relations->data[-1][3] = '<a id="delete_relation_button" href="">'.html_print_image('images/cross.png', true).'</a>';
$table_relations->data[-1][2] = '';
$table_relations->data[-1][3] = '<a id="disable_updates_button" class="alpha50" href="">';
$table_relations->data[-1][3] .= html_print_image('images/lock.png', true).'</a>';
$table_relations->data[-1][4] = '<a id="delete_relation_button" href="">';
$table_relations->data[-1][4] .= html_print_image('images/cross.png', true).'</a>';
$module_relations = modules_get_relations(['id_module' => $id_agent_module]);
if (!$module_relations) {
@ -1164,10 +1200,14 @@ $relations_count = 0;
foreach ($module_relations as $key => $module_relation) {
if ($module_relation['module_a'] == $id_agent_module) {
$module_id = $module_relation['module_b'];
$agent_id = modules_give_agent_id_from_module_id($module_relation['module_b']);
$agent_id = modules_give_agent_id_from_module_id(
$module_relation['module_b']
);
} else {
$module_id = $module_relation['module_a'];
$agent_id = modules_give_agent_id_from_module_id($module_relation['module_a']);
$agent_id = modules_give_agent_id_from_module_id(
$module_relation['module_a']
);
}
$agent_name = ui_print_agent_name($agent_id, true);
@ -1183,14 +1223,16 @@ foreach ($module_relations as $key => $module_relation) {
$disabled_update_class = 'alpha50';
}
// Agent name
// Agent name.
$table_relations->data[$relations_count][0] = $agent_name;
// Module name
// Module name.
$table_relations->data[$relations_count][1] = "<a href='index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&id_agente=".$agent_id.'&tab=module&edit_module=1&id_agent_module='.$module_id."'>".ui_print_truncate_text($module_name, 'module_medium', true, true, true, '[&hellip;]').'</a>';
// Lock relationship updates
$table_relations->data[$relations_count][2] = '<a id="disable_updates_button" class="'.$disabled_update_class.'"href="javascript: change_lock_relation('.$relations_count.', '.$module_relation['id'].');">'.html_print_image('images/lock.png', true).'</a>';
// Delete relationship
$table_relations->data[$relations_count][3] = '<a id="delete_relation_button" href="javascript: delete_relation('.$relations_count.', '.$module_relation['id'].');">'.html_print_image('images/cross.png', true).'</a>';
// Type.
$table_relations->data[$relations_count][2] = ($module_relation['type'] === 'direct') ? __('Direct') : __('Failover');
// Lock relationship updates.
$table_relations->data[$relations_count][3] = '<a id="disable_updates_button" class="'.$disabled_update_class.'"href="javascript: change_lock_relation('.$relations_count.', '.$module_relation['id'].');">'.html_print_image('images/lock.png', true).'</a>';
// Delete relationship.
$table_relations->data[$relations_count][4] = '<a id="delete_relation_button" href="javascript: delete_relation('.$relations_count.', '.$module_relation['id'].');">'.html_print_image('images/cross.png', true).'</a>';
$relations_count++;
}
@ -1198,7 +1240,6 @@ html_print_input_hidden('module_relations_count', $relations_count);
ui_require_jquery_file('json');
?>
<script type="text/javascript">
@ -1343,8 +1384,6 @@ $(document).ready (function () {
'width=800,height=600'
);
}
}
if(type_name_selected == 'web_data' ||
type_name_selected == 'web_proc' ||
@ -1365,8 +1404,6 @@ $(document).ready (function () {
'width=800,height=600'
);
}
}
}
@ -1512,7 +1549,6 @@ function advanced_option_dynamic() {
} else {
$('.hide_dinamic').show();
}
}
@ -1524,11 +1560,9 @@ function change_modules_autocomplete_input () {
var module_autocomplete = $("#module_autocomplete");
var load_icon = '<?php html_print_image('images/spinner.gif', false); ?>';
var error_icon = '<?php html_print_image('images/error_red.png', false); ?>';
if (!module_autocomplete.hasClass('working')) {
module_autocomplete.addClass('working');
module_autocomplete.html(load_icon);
$.ajax({
type: "POST",
url: "ajax.php",
@ -1563,10 +1597,15 @@ function change_modules_autocomplete_input () {
// Add a new relation
function add_new_relation () {
var module_a_id = parseInt($("#hidden-id_agent_module").val());
var module_b_id = parseInt($("#hidden-autocomplete_module_name_hidden").val());
var module_a_id = parseInt(
$("#hidden-id_agent_module").val()
);
var module_b_id = parseInt(
$("#hidden-autocomplete_module_name_hidden").val()
);
var module_b_name = $("#text-autocomplete_module_name").val();
var agent_b_name = $("#text-autocomplete_agent_name").val();
var relation_type = $("#relation_type").val();
var hiddenRow = $("#module_relations--1");
var button = $("#button-add_relation");
var iconPlaceholder = $("#add_relation_status");
@ -1574,7 +1613,6 @@ function add_new_relation () {
var suc_icon = '<?php html_print_image('images/ok.png', false, ['style' => 'vertical-align:middle;']); ?>';
var error_icon = '<?php html_print_image('images/error_red.png', false, ['style' => 'vertical-align:middle;']); ?>';
if (!button.hasClass('working')) {
button.addClass('working');
iconPlaceholder.html(load_icon);
@ -1588,7 +1626,8 @@ function add_new_relation () {
add_module_relation: true,
id_module_a: module_a_id,
id_module_b: module_b_id,
name_module_b: module_b_name
name_module_b: module_b_name,
relation_type: relation_type
},
success: function (data) {
button.removeClass('working');
@ -1611,12 +1650,13 @@ function add_new_relation () {
var rowHTML = '<tr id="module_relations-' + relationsCount + '" class="' + rowClass + '">' +
'<td id="module_relations-' + relationsCount + '-0"><b>' + agent_b_name + '</b></td>' +
'<td id="module_relations-' + relationsCount + '-1">' + module_b_name + '</td>' +
'<td id="module_relations-' + relationsCount + '-2" style="width: 10%; text-align: center;">' +
'<td id="module_relations-' + relationsCount + '-2">' + relation_type + '</td>' +
'<td id="module_relations-' + relationsCount + '-3" style="width: 10%; text-align: center;">' +
'<a id="disable_updates_button" class="alpha50" href="javascript: change_lock_relation(' + relationsCount + ', ' + data + ');">' +
'<?php echo html_print_image('images/lock.png', true); ?>' +
'</a>' +
'</td>' +
'<td id="module_relations-' + relationsCount + '-3" style="width: 10%; text-align: center;">' +
'<td id="module_relations-' + relationsCount + '-4" style="width: 10%; text-align: center;">' +
'<a id="delete_relation_button" href="javascript: delete_relation(' + relationsCount + ', ' + data + ');">' +
'<?php echo html_print_image('images/cross.png', true); ?>' +
'</a>' +

View File

@ -506,45 +506,5 @@ $(document).ready (function () {
});
});
// Show the SNMP browser window
function snmpBrowserWindow () {
// Keep elements in the form and the SNMP browser synced
$('#text-target_ip').val($('#text-ip_target').val());
$('#text-community').val($('#text-snmp_community').val());
$('#snmp_browser_version').val($('#snmp_version').val());
$('#text-snmp3_browser_auth_user').val($('#text-snmp3_auth_user').val());
$('#snmp3_browser_security_level').val($('#snmp3_security_level').val());
$('#snmp3_browser_auth_method').val($('#snmp3_auth_method').val());
$('#password-snmp3_browser_auth_pass').val($('#password-snmp3_auth_pass').val());
$('#snmp3_browser_privacy_method').val($('#snmp3_privacy_method').val());
$('#password-snmp3_browser_privacy_pass').val($('#password-snmp3_privacy_pass').val());
$("#snmp_browser_container").show().dialog ({
title: '',
resizable: true,
draggable: true,
modal: true,
overlay: {
opacity: 0.5,
background: "black"
},
width: 920,
height: 500
});
}
// Set the form OID to the value selected in the SNMP browser
function setOID () {
if($('#snmp_browser_version').val() == '3'){
$('#text-snmp_oid').val($('#table1-0-1').text());
} else {
$('#text-snmp_oid').val($('#snmp_selected_oid').text());
}
// Close the SNMP browser
$('.ui-dialog-titlebar-close').trigger('click');
}
</script>

View File

@ -52,7 +52,7 @@ if ($migrate_malformed) {
// Header.
ui_print_page_header(
__('Planned Downtime'),
__('Scheduled Downtime'),
'images/gm_monitoring.png',
false,
'planned_downtime',
@ -136,9 +136,6 @@ $table_form = new StdClass();
$table_form->class = 'databox filters';
$table_form->width = '100%';
$table_form->rowstyle = [];
$table_form->rowstyle[0] = 'background-color: #f9faf9;';
$table_form->rowstyle[1] = 'background-color: #f9faf9;';
$table_form->rowstyle[2] = 'background-color: #f9faf9;';
$table_form->data = [];
$row = [];

View File

@ -37,14 +37,10 @@ $table->head = [];
$table->data = [];
$table->size = [];
$table->size = [];
$table->size[0] = '5%';
$table->size[1] = '25%';
$table->size[2] = '5%';
$table->size[3] = '20%';
$table->style[0] = 'font-weight: bold; ';
$table->style[1] = 'font-weight: bold; ';
$table->style[2] = 'font-weight: bold; ';
$table->style[3] = 'font-weight: bold; ';
$table->style[0] = 'font-weight: bold;';
$table->style[1] = 'font-weight: bold;display: flex;align-items: baseline;';
$table->style[2] = 'font-weight: bold;';
$table->style[3] = 'font-weight: bold;';
// This is because if this view is reused after list alert view then
// styles in the previous view can affect this table.
@ -89,7 +85,7 @@ $table->data[0][1] = html_print_select(
true,
'',
($id_agente == 0),
'width: 250px;'
'min-width: 250px;margin-right: 0.5em;'
);
$table->data[0][1] .= ' <span id="latest_value" class="invisible">'.__('Latest value').': ';
$table->data[0][1] .= '<span id="value">&nbsp;</span></span>';
@ -117,7 +113,7 @@ $table->data[1][1] = html_print_select(
true,
'',
false,
'width: 250px;'
'min-width: 250px;'
);
$table->data[1][1] .= '<span id="advanced_action" class="advanced_actions invisible"><br>';
$table->data[1][1] .= __('Number of alerts match from').' ';
@ -127,9 +123,9 @@ $table->data[1][1] .= html_print_input_text('fires_max', '', '', 4, 10, true);
$table->data[1][1] .= '</span>';
if (check_acl($config['id_user'], 0, 'LM')) {
$table->data[1][1] .= '<a style="margin-left:5px;" href="index.php?sec=galertas&sec2=godmode/alerts/configure_alert_action&pure='.$pure.'">';
$table->data[1][1] .= '<a href="index.php?sec=galertas&sec2=godmode/alerts/configure_alert_action&pure='.$pure.'">';
$table->data[1][1] .= html_print_image('images/add.png', true);
$table->data[1][1] .= '<span style="margin-left:5px;vertical-align:middle;">'.__('Create Action').'</span>';
$table->data[1][1] .= '<span style="margin-left:0.5em;">'.__('Create Action').'</span>';
$table->data[1][1] .= '</a>';
}
@ -162,13 +158,13 @@ if ($own_info['is_admin'] || check_acl($config['id_user'], 0, 'PM')) {
if (check_acl($config['id_user'], 0, 'LM')) {
$table->data[2][1] .= '<a href="index.php?sec=galertas&sec2=godmode/alerts/configure_alert_template&pure='.$pure.'">';
$table->data[2][1] .= html_print_image('images/add.png', true);
$table->data[2][1] .= '<span style="margin-left:5px;vertical-align:middle;">'.__('Create Template').'</span>';
$table->data[2][1] .= '<span style="margin-left:0.5em;">'.__('Create Template').'</span>';
$table->data[2][1] .= '</a>';
}
$table->data[3][0] = __('Threshold');
$table->data[3][1] = html_print_input_text('module_action_threshold', '0', '', 5, 7, true);
$table->data[3][1] .= ' '.__('seconds');
$table->data[3][1] .= '<span style="margin-left:0.5em;">'.__('seconds').'</span>';
if (!isset($step)) {
echo '<form class="add_alert_form" method="post">';

View File

@ -438,11 +438,11 @@ if (! $id_agente) {
$table->style = [];
$table->style[0] = 'font-weight: bold;';
$table->head[0] = __('Agent').ui_get_sorting_arrows($url_up_agente, $url_down_agente, $selectAgentUp, $selectAgentDown);
$table->size[0] = '4%';
$table->size[1] = '8%';
$table->size[2] = '8%';
$table->size[3] = '4%';
$table->size[4] = '4%';
$table->headstyle[0] = 'width: 100%; min-width: 12em;';
$table->headstyle[1] = 'min-width: 15em;';
$table->headstyle[2] = 'min-width: 20em;';
$table->headstyle[3] = 'min-width: 1em;';
$table->headstyle[4] = 'min-width: 15em;';
/*
if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK) {
@ -450,16 +450,11 @@ if (! $id_agente) {
}*/
} else {
$table->head[0] = __('Module').ui_get_sorting_arrows($url_up_module, $url_down_module, $selectModuleUp, $selectModuleDown);
// Different sizes or the layout screws up
$table->size[0] = '0%';
$table->size[1] = '10%';
$table->size[2] = '30%';
/*
if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK) {
$table->size[4] = '25%';
} */
$table->size[3] = '1%';
$table->size[4] = '1%';
$table->headstyle[0] = 'width: 100%; min-width: 15em;';
$table->headstyle[1] = 'min-width: 15em;';
$table->headstyle[2] = 'min-width: 20em;';
$table->headstyle[3] = 'min-width: 1em;';
$table->headstyle[4] = 'min-width: 15em;';
}
$table->head[1] = __('Template').ui_get_sorting_arrows($url_up_template, $url_down_template, $selectTemplateUp, $selectTemplateDown);

View File

@ -317,9 +317,9 @@ $(document).ready (function () {
jQuery.post (<?php echo "'".ui_get_full_url('ajax.php', false, false, false)."'"; ?>,
values,
function (data, status) {
original_command = js_html_entity_decode (data["command"]);
original_command = data["command"];
render_command_preview (original_command);
command_description = js_html_entity_decode (data["description"]);
command_description = data["description"];
render_command_description(command_description);
var max_fields = parseInt('<?php echo $config['max_macro_fields']; ?>');

View File

@ -60,96 +60,12 @@ $fields_selected = explode(',', $config['event_fields']);
$result_selected = [];
// show list of fields selected.
// Show list of fields selected.
if ($fields_selected[0] != '') {
foreach ($fields_selected as $field_selected) {
switch ($field_selected) {
case 'id_evento':
$result = __('Event Id');
break;
case 'evento':
$result = __('Event Name');
break;
case 'id_agente':
$result = __('Agent Name');
break;
case 'id_usuario':
$result = __('User');
break;
case 'id_grupo':
$result = __('Group');
break;
case 'estado':
$result = __('Status');
break;
case 'timestamp':
$result = __('Timestamp');
break;
case 'event_type':
$result = __('Event Type');
break;
case 'id_agentmodule':
$result = __('Module Name');
break;
case 'id_alert_am':
$result = __('Alert');
break;
case 'criticity':
$result = __('Severity');
break;
case 'user_comment':
$result = __('Comment');
break;
case 'tags':
$result = __('Tags');
break;
case 'source':
$result = __('Source');
break;
case 'id_extra':
$result = __('Extra Id');
break;
case 'owner_user':
$result = __('Owner');
break;
case 'ack_utimestamp':
$result = __('ACK Timestamp');
break;
case 'instructions':
$result = __('Instructions');
break;
case 'server_name':
$result = __('Server Name');
break;
case 'data':
$result = __('Data');
break;
case 'module_status':
$result = __('Module Status');
break;
}
$result_selected[$field_selected] = $result;
$result_selected[$field_selected] = events_get_column_name(
$field_selected
);
}
}
@ -177,7 +93,8 @@ $fields_available = [];
$fields_available['id_evento'] = __('Event Id');
$fields_available['evento'] = __('Event Name');
$fields_available['id_agente'] = __('Agent Name');
$fields_available['id_agente'] = __('Agent ID');
$fields_available['agent_name'] = __('Agent Name');
$fields_available['id_usuario'] = __('User');
$fields_available['id_grupo'] = __('Group');
$fields_available['estado'] = __('Status');
@ -196,20 +113,20 @@ $fields_available['instructions'] = __('Instructions');
$fields_available['server_name'] = __('Server Name');
$fields_available['data'] = __('Data');
$fields_available['module_status'] = __('Module Status');
$fields_available['mini_severity'] = __('Severity mini');
// remove fields already selected
// Remove fields already selected.
foreach ($fields_available as $key => $available) {
foreach ($result_selected as $selected) {
if ($selected == $available) {
if (isset($result_selected[$key])) {
unset($fields_available[$key]);
}
}
}
$table->data[0][0] = '<b>'.__('Fields available').'</b>';
$table->data[1][0] = html_print_select($fields_available, 'fields_available[]', true, '', '', 0, true, true, false, '', false, 'width: 300px');
$table->data[1][1] = '<a href="javascript:">'.html_print_image(
'images/darrowright.png',
'images/darrowright_green.png',
true,
[
'id' => 'right',
@ -217,7 +134,7 @@ $table->data[1][1] = '<a href="javascript:">'.html_print_image(
]
).'</a>';
$table->data[1][1] .= '<br><br><br><br><a href="javascript:">'.html_print_image(
'images/darrowleft.png',
'images/darrowleft_green.png',
true,
[
'id' => 'left',

View File

@ -50,17 +50,10 @@ if (check_acl($config['id_user'], 0, 'PM')) {
'text' => '<a href="index.php?sec=eventos&sec2=godmode/events/events&amp;section=responses&amp;pure='.$config['pure'].'">'.html_print_image('images/event_responses.png', true, ['title' => __('Event responses')]).'</a>',
];
if (!is_metaconsole()) {
$buttons['fields'] = [
'active' => false,
'text' => '<a href="index.php?sec=eventos&sec2=godmode/events/events&amp;section=fields&amp;pure='.$config['pure'].'">'.html_print_image('images/custom_columns.png', true, ['title' => __('Custom fields')]).'</a>',
];
} else {
$buttons['fields'] = [
'active' => false,
'text' => '<a href="index.php?sec=eventos&sec2=event/custom_events&amp;section=fields&amp;pure='.$config['pure'].'">'.html_print_image('images/custom_columns.png', true, ['title' => __('Custom fields')]).'</a>',
];
}
}
switch ($section) {

View File

@ -0,0 +1,627 @@
<?php
/**
* Credentials management view.
*
* @category Credentials management
* @package Pandora FMS
* @subpackage Opensource
* @version 1.0.0
* @license See below
*
* ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2005-2019 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;
// Check access.
check_login();
if (! check_acl($config['id_user'], 0, 'PM')) {
db_pandora_audit(
'ACL Violation',
'Trying to access event viewer'
);
if (is_ajax()) {
return ['error' => 'noaccess'];
}
include 'general/noaccess.php';
return;
}
// Required files.
ui_require_css_file('credential_store');
require_once $config['homedir'].'/include/functions_credential_store.php';
require_once $config['homedir'].'/include/functions_io.php';
if (is_ajax()) {
$draw = get_parameter('draw', 0);
$filter = get_parameter('filter', []);
$get_key = get_parameter('get_key', 0);
$new_form = get_parameter('new_form', 0);
$new_key = get_parameter('new_key', 0);
$update_key = get_parameter('update_key', 0);
$delete_key = get_parameter('delete_key', 0);
if ($new_form) {
echo print_inputs();
exit;
}
if ($delete_key) {
$identifier = get_parameter('identifier', null);
if (empty($identifier)) {
ajax_msg('error', __('identifier cannot be empty'));
}
if (db_process_sql_delete(
'tcredential_store',
['identifier' => $identifier]
) === false
) {
ajax_msg('error', $config['dbconnection']->error, true);
} else {
ajax_msg('result', $identifier, true);
}
}
if ($update_key) {
$data = get_parameter('values', null);
if ($data === null || !is_array($data)) {
echo json_encode(['error' => __('Invalid parameters, please retry')]);
exit;
}
$values = [];
foreach ($data as $key => $value) {
if ($key == 'identifier') {
$identifier = base64_decode($value);
} else if ($key == 'product') {
$product = base64_decode($value);
} else {
$values[$key] = base64_decode($value);
}
}
if (empty($identifier)) {
ajax_msg('error', __('identifier cannot be empty'));
}
if (empty($product)) {
ajax_msg('error', __('product cannot be empty'));
}
if (db_process_sql_update(
'tcredential_store',
$values,
['identifier' => $identifier]
) === false
) {
ajax_msg('error', $config['dbconnection']->error);
} else {
ajax_msg('result', $identifier);
}
exit;
}
if ($new_key) {
$data = get_parameter('values', null);
if ($data === null || !is_array($data)) {
echo json_encode(['error' => __('Invalid parameters, please retry')]);
exit;
}
$values = [];
foreach ($data as $key => $value) {
$values[$key] = base64_decode($value);
if ($key == 'identifier') {
$values[$key] = preg_replace('/\s+/', '-', trim($values[$key]));
}
}
$identifier = $values['identifier'];
if (empty($identifier)) {
ajax_msg('error', __('identifier cannot be empty'));
}
if (empty($values['product'])) {
ajax_msg('error', __('product cannot be empty'));
}
if (db_process_sql_insert('tcredential_store', $values) === false) {
ajax_msg('error', $config['dbconnection']->error);
} else {
ajax_msg('result', $identifier);
}
exit;
}
if ($get_key) {
$identifier = get_parameter('identifier', null);
$key = get_key($identifier);
echo print_inputs($key);
exit;
}
if ($draw) {
// Datatables offset, limit and order.
$start = get_parameter('start', 0);
$length = get_parameter('length', $config['block_size']);
$order = get_datatable_order(true);
try {
ob_start();
$fields = [
'cs.*',
'tg.nombre as `group`',
];
// Retrieve data.
$data = credentials_get_all(
// Fields.
$fields,
// Filter.
$filter,
// Offset.
$start,
// Limit.
$length,
// Order.
$order['direction'],
// Sort field.
$order['field']
);
// Retrieve counter.
$count = credentials_get_all(
'count',
$filter
);
if ($data) {
$data = array_reduce(
$data,
function ($carry, $item) {
// Transforms array of arrays $data into an array
// of objects, making a post-process of certain fields.
$tmp = (object) $item;
$tmp->username = io_safe_output($tmp->username);
if (empty($tmp->group)) {
$tmp->group = __('All');
} else {
$tmp->group = io_safe_output($tmp->group);
}
$carry[] = $tmp;
return $carry;
}
);
}
// Datatables format: RecordsTotal && recordsfiltered.
echo json_encode(
[
'data' => $data,
'recordsTotal' => $count,
'recordsFiltered' => $count,
]
);
// Capture output.
$response = ob_get_clean();
} catch (Exception $e) {
return json_encode(['error' => $e->getMessage()]);
}
// If not valid, show error with issue.
json_decode($response);
if (json_last_error() == JSON_ERROR_NONE) {
// If valid dump.
echo $response;
} else {
echo json_encode(
['error' => $response]
);
}
exit;
}
exit;
}
// Datatables list.
try {
$columns = [
'group',
'identifier',
'product',
'username',
'options',
];
$column_names = [
__('Group'),
__('Identifier'),
__('Product'),
__('User'),
[
'text' => __('Options'),
'class' => 'action_buttons',
],
];
$table_id = 'keystore';
// Load datatables user interface.
ui_print_datatable(
[
'id' => $table_id,
'class' => 'info_table',
'style' => 'width: 100%',
'columns' => $columns,
'column_names' => $column_names,
'ajax_url' => 'godmode/groups/credential_store',
'ajax_postprocess' => 'process_datatables_item(item)',
'no_sortable_columns' => [-1],
'order' => [
'field' => 'identifier',
'direction' => 'asc',
],
'search_button_class' => 'sub filter float-right',
'form' => [
'inputs' => [
[
'label' => __('Group'),
'type' => 'select',
'id' => 'filter_id_group',
'name' => 'filter_id_group',
'options' => users_get_groups_for_select(
$config['id_user'],
'AR',
true,
true,
false
),
],
[
'label' => __('Free search'),
'type' => 'text',
'class' => 'mw250px',
'id' => 'free_search',
'name' => 'free_search',
],
],
],
]
);
} catch (Exception $e) {
echo $e->getMessage();
}
// Auxiliar div.
$new = '<div id="new_key" style="display: none"><form id="form_new">';
$new .= '</form></div>';
$details = '<div id="info_key" style="display: none"><form id="form_update">';
$details .= '</form></div>';
$aux = '<div id="aux" style="display: none"></div>';
echo $new.$details.$aux;
// Create button.
echo '<div class="w100p flex-content-right">';
html_print_submit_button(
__('Add key'),
'create',
false,
'class="sub next"'
);
echo '</div>';
?>
<script type="text/javascript">
function process_datatables_item(item) {
item.options = '<a href="javascript:" onclick="display_key(\'';
item.options += item.identifier;
item.options += '\')" ><?php echo html_print_image('images/eye.png', true, ['title' => __('Show')]); ?></a>';
item.options += '<a href="javascript:" onclick="delete_key(\'';
item.options += item.identifier;
item.options += '\')" ><?php echo html_print_image('images/cross.png', true, ['title' => __('Delete')]); ?></a>';
}
function handle_response(data) {
var title = "<?php echo __('Success'); ?>";
var text = '';
var failed = 0;
try {
data = JSON.parse(data);
text = data['result'];
} catch (err) {
title = "<?php echo __('Failed'); ?>";
text = err.message;
failed = 1;
}
if (!failed && data['error'] != undefined) {
title = "<?php echo __('Failed'); ?>";
text = data['error'];
failed = 1;
}
$('#aux').empty();
$('#aux').html(text);
$('#aux').dialog({
width: 450,
position: {
my: 'center',
at: 'center',
of: window,
collision: 'fit'
},
title: title,
buttons: [
{
text: 'OK',
click: function(e) {
if (!failed) {
dt_<?php echo $table_id; ?>.draw(0);
$(".ui-dialog-content").dialog("close");
cleanupDOM();
} else {
$(this).dialog('close');
}
}
}
]
});
}
function delete_key(id) {
$('#aux').empty();
$('#aux').text('<?php echo __('Are you sure?'); ?>');
$('#aux').dialog({
title: '<?php echo __('Delete'); ?> ' + id,
buttons: [
{
class: 'ui-widget ui-state-default ui-corner-all ui-button-text-only sub upd submit-cancel',
text: '<?php echo __('Cancel'); ?>',
click: function(e) {
$(this).dialog('close');
cleanupDOM();
}
},
{
text: 'Delete',
class: 'ui-widget ui-state-default ui-corner-all ui-button-text-only sub ok submit-next',
click: function(e) {
$.ajax({
method: 'post',
url: '<?php echo ui_get_full_url('ajax.php', false, false, false); ?>',
data: {
page: 'godmode/groups/credential_store',
delete_key: 1,
identifier: id
},
datatype: "json",
success: function (data) {
handle_response(data);
},
error: function(e) {
handle_response(e);
}
});
}
}
]
});
}
function display_key(id) {
$('#form_update').empty();
$('#form_update').html('Loading...');
$.ajax({
method: 'post',
url: '<?php echo ui_get_full_url('ajax.php', false, false, false); ?>',
data: {
page: 'godmode/groups/credential_store',
get_key: 1,
identifier: id
},
success: function (data) {
$('#info_key').dialog({
width: 580,
height: 400,
position: {
my: 'center',
at: 'center',
of: window,
collision: 'fit'
},
title: id,
buttons: [
{
class: 'ui-widget ui-state-default ui-corner-all ui-button-text-only sub upd submit-cancel',
text: '<?php echo __('Cancel'); ?>',
click: function(e) {
$(this).dialog('close');
cleanupDOM();
}
},
{
text: 'Update',
class: 'ui-widget ui-state-default ui-corner-all ui-button-text-only sub ok submit-next',
click: function(e) {
var values = {};
$('#form_update :input').each(function() {
values[this.name] = btoa($(this).val());
});
$.ajax({
method: 'post',
url: '<?php echo ui_get_full_url('ajax.php', false, false, false); ?>',
data: {
page: 'godmode/groups/credential_store',
update_key: 1,
values: values
},
datatype: "json",
success: function (data) {
handle_response(data);
},
error: function(e) {
handle_response(e);
}
});
}
}
]
});
$('#form_update').html(data);
}
})
}
function cleanupDOM() {
$('#div-identifier').empty();
$('#div-product').empty();
$('#div-username').empty();
$('#div-password').empty();
$('#div-extra_1').empty();
$('#div-extra_2').empty();
}
function calculate_inputs() {
if ($('#product :selected').val() == "CUSTOM") {
$('#div-username label').text('<?php echo __('User'); ?>');
$('#div-password label').text('<?php echo __('Password'); ?>');
$('#div-extra_1').hide();
$('#div-extra_2').hide();
} else if ($('#product :selected').val() == "AWS") {
$('#div-username label').text('<?php echo __('Access key ID'); ?>');
$('#div-password label').text('<?php echo __('Secret access key'); ?>');
$('#div-extra_1').hide();
$('#div-extra_2').hide();
} else if ($('#product :selected').val() == "AZURE") {
$('#div-username label').text('<?php echo __('Client ID'); ?>');
$('#div-password label').text('<?php echo __('Application secret'); ?>');
$('#div-extra_1 label').text('<?php echo __('Tenant or domain name'); ?>');
$('#div-extra_2 label').text('<?php echo __('Subscription id'); ?>');
$('#div-extra_1').show();
$('#div-extra_2').show();
}
}
function add_key() {
// Clear form.
$('#form_update').empty();
$('#form_update').html('Loading...');
$.ajax({
method: 'post',
url: '<?php echo ui_get_full_url('ajax.php', false, false, false); ?>',
data: {
page: 'godmode/groups/credential_store',
new_form: 1
},
success: function(data) {
$('#form_new').html(data);
$('#id_group').val(0);
// By default CUSTOM.
$('#product').val('CUSTOM');
calculate_inputs();
$('#product').on('change', function() {
calculate_inputs()
});
// Show form.
$('#new_key').dialog({
width: 580,
height: 400,
position: {
my: 'center',
at: 'center',
of: window,
collision: 'fit'
},
title: "<?php echo __('Register new key into keystore'); ?>",
buttons: [
{
class: 'ui-widget ui-state-default ui-corner-all ui-button-text-only sub upd submit-cancel',
text: "<?php echo __('Cancel'); ?>",
click: function(e) {
$(this).dialog('close');
cleanupDOM();
}
},
{
class: 'ui-widget ui-state-default ui-corner-all ui-button-text-only sub ok submit-next',
text: 'OK',
click: function(e) {
var values = {};
$('#form_new :input').each(function() {
values[this.name] = btoa($(this).val());
});
$.ajax({
method: 'post',
url: '<?php echo ui_get_full_url('ajax.php', false, false, false); ?>',
data: {
page: 'godmode/groups/credential_store',
new_key: 1,
values: values
},
datatype: "json",
success: function (data) {
handle_response(data);
},
error: function(e) {
handle_response(e);
}
});
}
},
]
});
}
})
}
$(document).ready(function(){
$("#submit-create").on('click', function(){
add_key();
});
});
</script>

View File

@ -1,20 +1,36 @@
<?php
/**
* Group management view.
*
* @category Group View
* @package Pandora FMS
* @subpackage Opensource
* @version 1.0.0
* @license See below
*
* ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2005-2019 Artica Soluciones Tecnologicas
* Please see http://pandorafms.org for full contribution list
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation for version 2.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* ============================================================================
*/
// Pandora FMS - http://pandorafms.com
// ==================================================
// Copyright (c) 2005-2010 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.
ui_require_css_file('tree');
ui_require_css_file('fixed-bottom-box');
// Load global vars
// Load global vars.
global $config;
check_login();
@ -76,15 +92,17 @@ if (is_ajax()) {
$recursion = (int) get_parameter('recursion', 0);
$privilege = (string) get_parameter('privilege', '');
$all_agents = (int) get_parameter('all_agents', 0);
// Is is possible add keys prefix to avoid auto sorting in js object conversion
// Is is possible add keys prefix to avoid auto sorting in
// js object conversion.
$keys_prefix = (string) get_parameter('keys_prefix', '');
// This attr is for the operation "bulk alert accions add", it controls the query that take the agents
// from db
// This attr is for the operation "bulk alert accions add", it controls
// the query that take the agents from db.
$add_alert_bulk_op = get_parameter('add_alert_bulk_op', false);
// Ids of agents to be include in the SQL clause as id_agent IN ()
// Ids of agents to be include in the SQL clause as id_agent IN ().
$filter_agents_json = (string) get_parameter('filter_agents_json', '');
$status_agents = (int) get_parameter('status_agents', AGENT_STATUS_ALL);
// Juanma (22/05/2014) Fix: If setted remove void agents from result (by default and for compatibility show void agents)
// Juanma (22/05/2014) Fix: If setted remove void agents from result
// (by default and for compatibility show void agents).
$show_void_agents = (int) get_parameter('show_void_agents', 1);
$serialized = (bool) get_parameter('serialized', false);
$serialized_separator = (string) get_parameter('serialized_separator', '|');
@ -121,7 +139,7 @@ if (is_ajax()) {
$filter['status'] = $status_agents;
}
// Juanma (22/05/2014) Fix: If remove void agents setted
// Juanma (22/05/2014) Fix: If remove void agents set.
$_sql_post = ' 1=1 ';
if ($show_void_agents == 0) {
$_sql_post .= ' AND id_agente IN (SELECT a.id_agente FROM tagente a, tagente_modulo b WHERE a.id_agente=b.id_agente AND b.delete_pending=0) AND \'1\'';
@ -131,8 +149,9 @@ if (is_ajax()) {
$id_groups_get_agents = $id_group;
if ($id_group == 0 && $privilege != '') {
$groups = users_get_groups($config['id_user'], $privilege, false);
// if group ID doesn't matter and $privilege is specified (like 'AW'),
// retruns all agents that current user has $privilege privilege for.
// If group ID doesn't matter and $privilege is specified
// (like 'AW'), retruns all agents that current user has $privilege
// privilege for.
$id_groups_get_agents = array_keys($groups);
}
@ -149,13 +168,13 @@ if (is_ajax()) {
);
$agents_disabled = [];
// Add keys prefix
// Add keys prefix.
if ($keys_prefix !== '') {
foreach ($agents as $k => $v) {
$agents[$keys_prefix.$k] = $v;
unset($agents[$k]);
if ($all_agents) {
// Unserialize to get the status
// Unserialize to get the status.
if ($serialized && is_metaconsole()) {
$agent_info = explode($serialized_separator, $k);
$agent_disabled = db_get_value_filter(
@ -174,7 +193,8 @@ if (is_ajax()) {
['id_agente' => $agent_info[1]]
);
} else if (!$serialized && is_metaconsole()) {
// Cannot retrieve the disabled status. Mark all as not disabled
// Cannot retrieve the disabled status.
// Mark all as not disabled.
$agent_disabled = 0;
} else {
$agent_disabled = db_get_value_filter(
@ -226,11 +246,13 @@ if (! check_acl($config['id_user'], 0, 'PM')) {
}
$sec = defined('METACONSOLE') ? 'advanced' : 'gagente';
$url_tree = "index.php?sec=$sec&sec2=godmode/groups/group_list&tab=tree";
$url_groups = "index.php?sec=$sec&sec2=godmode/groups/group_list&tab=groups";
$url_credbox = 'index.php?sec='.$sec.'&sec2=godmode/groups/group_list&tab=credbox';
$url_tree = 'index.php?sec='.$sec.'&sec2=godmode/groups/group_list&tab=tree';
$url_groups = 'index.php?sec='.$sec.'&sec2=godmode/groups/group_list&tab=groups';
$buttons['tree'] = [
'active' => false,
'text' => "<a href='$url_tree'>".html_print_image(
'text' => '<a href="'.$url_tree.'">'.html_print_image(
'images/gm_massive_operations.png',
true,
[
@ -241,7 +263,7 @@ $buttons['tree'] = [
$buttons['groups'] = [
'active' => false,
'text' => "<a href='$url_groups'>".html_print_image(
'text' => '<a href="'.$url_groups.'">'.html_print_image(
'images/group.png',
true,
[
@ -250,21 +272,38 @@ $buttons['groups'] = [
).'</a>',
];
$buttons['credbox'] = [
'active' => false,
'text' => '<a href="'.$url_credbox.'">'.html_print_image(
'images/key.png',
true,
[
'title' => __('Credential Store'),
]
).'</a>',
];
$tab = (string) get_parameter('tab', 'groups');
// Marks correct tab
$title = __('Groups defined in %s', get_product_name());
// Marks correct tab.
switch ($tab) {
case 'tree':
$buttons['tree']['active'] = true;
break;
case 'credbox':
$buttons['credbox']['active'] = true;
$title = __('Credential store');
break;
case 'groups':
default:
$buttons['groups']['active'] = true;
break;
}
// Header
// Header.
if (defined('METACONSOLE')) {
agents_meta_print_header();
echo '<div class="notify">';
@ -272,7 +311,7 @@ if (defined('METACONSOLE')) {
echo '</div>';
} else {
ui_print_page_header(
__('Groups defined in %s', get_product_name()),
$title,
'images/group.png',
false,
'group_list_tab',
@ -281,12 +320,19 @@ if (defined('METACONSOLE')) {
);
}
// Load credential store view before parse list-tree forms.
if ($tab == 'credbox') {
include_once __DIR__.'/credential_store.php';
// Stop script.
return;
}
$create_group = (bool) get_parameter('create_group');
$update_group = (bool) get_parameter('update_group');
$delete_group = (bool) get_parameter('delete_group');
$pure = get_parameter('pure', 0);
// Create group
// Create group.
if (($create_group) && (check_acl($config['id_user'], 0, 'PM'))) {
$name = (string) get_parameter('name');
$icon = (string) get_parameter('icon');
@ -301,7 +347,7 @@ if (($create_group) && (check_acl($config['id_user'], 0, 'PM'))) {
$check = db_get_value('nombre', 'tgrupo', 'nombre', $name);
$propagate = (bool) get_parameter('propagate');
// Check if name field is empty
// Check if name field is empty.
if ($name != '') {
if (!$check) {
$values = [
@ -328,12 +374,11 @@ if (($create_group) && (check_acl($config['id_user'], 0, 'PM'))) {
ui_print_error_message(__('Each group must have a different name'));
}
} else {
// $result = false;
ui_print_error_message(__('Group must have a name'));
}
}
// Update group
// Update group.
if ($update_group) {
$id_group = (int) get_parameter('id_group');
$name = (string) get_parameter('name');
@ -349,13 +394,21 @@ if ($update_group) {
$contact = (string) get_parameter('contact');
$other = (string) get_parameter('other');
// Check if name field is empty
// Check if name field is empty.
if ($name != '') {
switch ($config['dbtype']) {
case 'mysql':
$sql = sprintf(
'UPDATE tgrupo SET nombre = "%s",
icon = "%s", disabled = %d, parent = %d, custom_id = "%s", propagate = %d, id_skin = %d, description = "%s", contact = "%s", other = "%s", password = "%s"
'UPDATE tgrupo
SET nombre = "%s",
icon = "%s",
disabled = %d,
parent = %d,
custom_id = "%s",
propagate = %d,
id_skin = %d,
description = "%s",
contact = "%s",
other = "%s",
password = "%s"
WHERE id_grupo = %d',
$name,
empty($icon) ? '' : substr($icon, 0, -4),
@ -370,28 +423,6 @@ if ($update_group) {
$group_pass,
$id_group
);
break;
case 'postgresql':
case 'oracle':
$sql = sprintf(
'UPDATE tgrupo SET nombre = \'%s\',
icon = \'%s\', disabled = %d, parent = %d, custom_id = \'%s\', propagate = %d, id_skin = %d, description = \'%s\', contact = \'%s\', other = \'%s\'
WHERE id_grupo = %d',
$name,
substr($icon, 0, -4),
!$alerts_enabled,
$id_parent,
$custom_id,
$propagate,
$skin,
$description,
$contact,
$other,
$id_group
);
break;
}
$result = db_process_sql($sql);
} else {
@ -405,7 +436,7 @@ if ($update_group) {
}
}
// Delete group
// Delete group.
if (($delete_group) && (check_acl($config['id_user'], 0, 'PM'))) {
$id_group = (int) get_parameter('id_group');
@ -445,7 +476,14 @@ if (($delete_group) && (check_acl($config['id_user'], 0, 'PM'))) {
}
}
// Credential store is loaded previously in this document to avoid
// process group tree - list forms.
if ($tab == 'tree') {
/*
* Group tree view.
*/
echo html_print_image(
'images/spinner.gif',
true,
@ -456,6 +494,10 @@ if ($tab == 'tree') {
);
echo "<div id='tree-controller-recipient'></div>";
} else {
/*
* Group list view.
*/
$acl = '';
$search_name = '';
$offset = (int) get_parameter('offset', 0);
@ -463,17 +505,22 @@ if ($tab == 'tree') {
$block_size = $config['block_size'];
if (!empty($search)) {
$search_name = "AND t.nombre LIKE '%$search%'";
$search_name = 'AND t.nombre LIKE "%'.$search.'%"';
}
if (!users_can_manage_group_all('AR')) {
$user_groups_acl = users_get_groups(false, 'AR');
$groups_acl = implode(',', $user_groups_ACL);
if (empty($groups_acl)) {
return ui_print_info_message(['no_close' => true, 'message' => __('There are no defined groups') ]);
return ui_print_info_message(
[
'no_close' => true,
'message' => __('There are no defined groups'),
]
);
}
$acl = "AND t.id_grupo IN ($groups_acl)";
$acl = 'AND t.id_grupo IN ('.$groups_acl.')';
}
$form = "<form method='post' action=''>";
@ -488,29 +535,37 @@ if ($tab == 'tree') {
echo $form;
$groups_sql = "SELECT t.*,
$groups_sql = sprintf(
'SELECT t.*,
p.nombre AS parent_name,
IF(t.parent=p.id_grupo, 1, 0) AS has_child
FROM tgrupo t
LEFT JOIN tgrupo p
ON t.parent=p.id_grupo
WHERE 1=1
$acl
$search_name
%s
%s
ORDER BY nombre
LIMIT $offset, $block_size
";
LIMIT %d, %d',
$acl,
$search_name,
$offset,
$block_size
);
$groups = db_get_all_rows_sql($groups_sql);
if (!empty($groups)) {
// Count all groups for pagination only saw user and filters
$groups_sql_count = "SELECT count(*)
// Count all groups for pagination only saw user and filters.
$groups_sql_count = sprintf(
'SELECT count(*)
FROM tgrupo t
WHERE 1=1
$acl
%s
%s',
$acl,
$search_name
";
);
$groups_count = db_get_value_sql($groups_sql_count);
$table = new StdClass();
@ -545,7 +600,7 @@ if ($tab == 'tree') {
$url = 'index.php?sec=gagente&sec2=godmode/groups/configure_group&id_group='.$group['id_grupo'];
$url_delete = 'index.php?sec=gagente&sec2=godmode/groups/group_list&delete_group=1&id_group='.$group['id_grupo'];
$table->data[$key][0] = $group['id_grupo'];
$table->data[$key][1] = "<a href='$url'>".$group['nombre'].'</a>';
$table->data[$key][1] = '<a href="'.$url.'">'.$group['nombre'].'</a>';
if ($group['icon'] != '') {
$table->data[$key][2] = html_print_image(
'images/groups_small/'.$group['icon'].'.png',
@ -555,20 +610,23 @@ if ($tab == 'tree') {
'class' => 'bot',
'alt' => $group['nombre'],
'title' => $group['nombre'],
false, false, false, true
]
],
false,
false,
false,
true
);
} else {
$table->data[$key][2] = '';
}
// reporting_get_group_stats
$table->data[$key][3] = $group['disabled'] ? __('Disabled') : __('Enabled');
// Reporting_get_group_stats.
$table->data[$key][3] = ($group['disabled']) ? __('Disabled') : __('Enabled');
$table->data[$key][4] = $group['parent_name'];
$table->data[$key][5] = $group['description'];
$table->cellclass[$key][6] = 'action_buttons';
$table->data[$key][6] = "<a href='$url'>".html_print_image(
$table->data[$key][6] = '<a href="'.$url.'">'.html_print_image(
'images/config.png',
true,
[

View File

@ -84,7 +84,9 @@ if ($create_profiles) {
);
}
html_print_table($table);
if ($table !== null) {
html_print_table($table);
}
unset($table);

View File

@ -177,6 +177,9 @@ $table->data['operations'][1] .= html_print_checkbox('copy_alerts', 1, true, tru
$table->data['operations'][1] .= html_print_label(__('Copy alerts'), 'checkbox-copy_alerts', true);
$table->data['operations'][1] .= '</span>';
$table->data['form_modules_filter'][0] = __('Filter Modules');
$table->data['form_modules_filter'][1] = html_print_input_text('filter_modules', '', '', 20, 255, true);
$table->data[1][0] = __('Modules');
$table->data[1][1] = '<span class="with_modules'.(empty($modules) ? ' invisible' : '').'">';
$table->data[1][1] .= html_print_select(
@ -270,6 +273,9 @@ $table->data[1][1] = html_print_select(
true
);
$table->data['form_agents_filter'][0] = __('Filter Agents');
$table->data['form_agents_filter'][1] = html_print_input_text('filter_agents', '', '', 20, 255, true);
$table->data[2][0] = __('Agent');
$table->data[2][0] .= '<span id="destiny_agent_loading" class="invisible">';
$table->data[2][0] .= html_print_image('images/spinner.png', true);
@ -302,6 +308,8 @@ echo '<h3 class="error invisible" id="message">&nbsp;</h3>';
ui_require_jquery_file('form');
ui_require_jquery_file('pandora.controls');
?>
<script type="text/javascript" src="include/javascript/pandora_modules.js"></script>
<script type="text/javascript">
/* <![CDATA[ */
var module_alerts;
@ -349,6 +357,11 @@ $(document).ready (function () {
/* Hide source agent */
var selected_agent = $("#source_id_agent").val();
$("#destiny_id_agent option[value='" + selected_agent + "']").remove();
},
callbackAfter:function() {
//Filter agents. Call the function when the select is fully loaded.
var textNoData = "<?php echo __('None'); ?>";
filterByText($('#destiny_id_agent'), $("#text-filter_agents"), textNoData);
}
});
@ -450,13 +463,14 @@ $(document).ready (function () {
$("#fieldset_destiny").hide ();
$("span.without_modules, span.without_alerts").show ();
$("span.with_modules, span.with_alerts, #target_table-operations").hide ();
$("span.with_modules, span.with_alerts, #target_table-operations, #target_table-form_modules_filter").hide ();
}
else {
if (no_modules) {
$("span.without_modules").show ();
$("span.with_modules").hide ();
$("#checkbox-copy_modules").uncheck ();
$("#target_table-form_modules_filter").hide ();
}
else {
$("span.without_modules").hide ();
@ -474,10 +488,13 @@ $(document).ready (function () {
$("span.with_alerts").show ();
$("#checkbox-copy_alerts").check ();
}
$("#fieldset_destiny, #target_table-operations").show ();
$("#fieldset_destiny, #target_table-operations, #target_table-form_modules_filter").show ();
}
$("#fieldset_targets").show ();
$("#target_modules, #target_alerts").enable ();
//Filter modules. Call the function when the select is fully loaded.
var textNoData = "<?php echo __('None'); ?>";
filterByText($('#target_modules'), $("#text-filter_modules"), textNoData);
},
"json"
);

View File

@ -31,6 +31,7 @@ require_once $config['homedir'].'/include/functions_users.php';
if (is_ajax()) {
$get_agents = (bool) get_parameter('get_agents');
$recursion = (int) get_parameter('recursion');
$disabled_modules = (int) get_parameter('disabled_modules');
if ($get_agents) {
$id_group = (int) get_parameter('id_group');
@ -44,12 +45,18 @@ if (is_ajax()) {
$groups = [$id_group];
}
if ($disabled_modules == 0) {
$filter['tagente_modulo.disabled'] = '<> 1';
} else {
unset($filter['tagente_modulo.disabled']);
}
$agents_alerts = [];
foreach ($groups as $group) {
$agents_alerts_one_group = alerts_get_agents_with_alert_template(
$id_alert_template,
$group,
false,
$filter,
[
'tagente.alias',
'tagente.id_agente',
@ -253,6 +260,11 @@ $table->data[1][1] = html_print_select_groups(
'',
$id_alert_template == 0
);
$table->data[0][2] = __('Show alerts on disabled modules');
$table->data[0][3] = html_print_checkbox('disabled_modules', 1, false, true, false);
$table->data[1][2] = __('Group recursion');
$table->data[1][3] = html_print_checkbox('recursion', 1, false, true, false);
@ -360,6 +372,7 @@ $(document).ready (function () {
"get_agents" : 1,
"id_group" : this.value,
"recursion" : $("#checkbox-recursion").is(":checked") ? 1 : 0,
"disabled_modules" : $("#checkbox-disabled_modules").is(":checked") ? 1 : 0,
"id_alert_template" : $("#id_alert_template").val(),
// Add a key prefix to avoid auto sorting in js object conversion
"keys_prefix" : "_"
@ -387,6 +400,10 @@ $(document).ready (function () {
$("#modules_selection_mode").change (function() {
$("#id_agents").trigger('change');
});
$("#checkbox-disabled_modules").click(function () {
$("#id_group").trigger("change");
});
});
/* ]]> */
</script>

View File

@ -429,6 +429,11 @@ $table->data['form_modules_3'][1] = html_print_select(
);
$table->data['form_modules_3'][3] = '';
$table->rowstyle['form_modules_filter'] = 'vertical-align: top;';
$table->rowclass['form_modules_filter'] = 'select_modules_row select_modules_row_2';
$table->data['form_modules_filter'][0] = __('Filter Modules');
$table->data['form_modules_filter'][1] = html_print_input_text('filter_modules', '', '', 20, 255, true);
$table->rowstyle['form_modules_2'] = 'vertical-align: top;';
$table->rowclass['form_modules_2'] = 'select_modules_row select_modules_row_2';
$table->data['form_modules_2'][0] = __('Modules');
@ -496,6 +501,11 @@ $table->data['form_agents_4'][1] = html_print_select(
true
);
$table->rowstyle['form_agents_filter'] = 'vertical-align: top;';
$table->rowclass['form_agents_filter'] = 'select_agents_row select_agents_row_2';
$table->data['form_agents_filter'][0] = __('Filter Agents');
$table->data['form_agents_filter'][1] = html_print_input_text('filter_agents', '', '', 20, 255, true);
$table->rowstyle['form_agents_3'] = 'vertical-align: top;';
$table->rowclass['form_agents_3'] = 'select_agents_row select_agents_row_2';
$table->data['form_agents_3'][0] = __('Agents');
@ -571,6 +581,7 @@ if ($selection_mode == 'modules') {
}
?>
<script type="text/javascript" src="include/javascript/pandora_modules.js"></script>
<script type="text/javascript">
/* <![CDATA[ */
@ -650,6 +661,9 @@ $(document).ready (function () {
});
$("#module_loading").hide();
$("#module_name").removeAttr ("disabled");
//Filter modules. Call the function when the select is fully loaded.
var textNoData = "<?php echo __('None'); ?>";
filterByText($('#module_name'), $("#text-filter_modules"), textNoData);
},
"json"
);
@ -754,6 +768,9 @@ $(document).ready (function () {
.html (value["alias"]);
$("#id_agents").append (option);
});
//Filter agents. Call the function when the select is fully loaded.
var textNoData = "<?php echo __('None'); ?>";
filterByText($('#id_agents'), $("#text-filter_agents"), textNoData);
},
"json"
);

View File

@ -92,7 +92,9 @@ if ($delete_profiles) {
);
}
html_print_table($table);
if ($table !== null) {
html_print_table($table);
}
unset($table);

View File

@ -170,6 +170,8 @@ if ($update_agents) {
$n_edited = 0;
$result = false;
foreach ($id_agents as $id_agent) {
$old_interval_value = db_get_value_filter('intervalo', 'tagente', ['id_agente' => $id_agent]);
if (!empty($values)) {
$group_old = false;
$disabled_old = false;
@ -196,6 +198,18 @@ if ($update_agents) {
$result_metaconsole = agent_update_from_cache($id_agent, $values, $server_name);
}
// Update the configuration files.
if ($result && ($old_interval_value != $values['intervalo'])) {
enterprise_hook(
'config_agents_update_config_token',
[
$id_agent,
'interval',
$values['intervalo'],
]
);
}
if ($disabled_old !== false && $disabled_old != $values['disabled']) {
enterprise_hook(
'config_agents_update_config_token',

View File

@ -388,6 +388,11 @@ $table->data['form_modules_4'][1] = html_print_select(
true
);
$table->rowstyle['form_modules_filter'] = 'vertical-align: top;';
$table->rowclass['form_modules_filter'] = 'select_modules_row select_modules_row_2';
$table->data['form_modules_filter'][0] = __('Filter Modules');
$table->data['form_modules_filter'][1] = html_print_input_text('filter_modules', '', '', 20, 255, true);
$table->rowstyle['form_modules_2'] = 'vertical-align: top;';
$table->rowclass['form_modules_2'] = 'select_modules_row select_modules_row_2';
$table->data['form_modules_2'][0] = __('Modules');
@ -468,6 +473,11 @@ $table->data['form_agents_4'][1] = html_print_select(
true
);
$table->rowstyle['form_agents_filter'] = 'vertical-align: top;';
$table->rowclass['form_agents_filter'] = 'select_agents_row select_agents_row_2';
$table->data['form_agents_filter'][0] = __('Filter agents');
$table->data['form_agents_filter'][1] = html_print_input_text('filter_agents', '', '', 20, 255, true);
$table->rowstyle['form_agents_3'] = 'vertical-align: top;';
$table->rowclass['form_agents_3'] = 'select_agents_row select_agents_row_2';
$table->data['form_agents_3'][0] = __('Agents');
@ -1247,6 +1257,9 @@ $(document).ready (function () {
});
$("#module_loading").hide ();
$("#module_name").removeAttr ("disabled");
//Filter modules. Call the function when the select is fully loaded.
var textNoData = "<?php echo __('None'); ?>";
filterByText($('#module_name'), $("#text-filter_modules"), textNoData);
},
"json"
);
@ -1630,6 +1643,9 @@ $(document).ready (function () {
.html(value["alias"]);
$("#id_agents").append (option);
});
//Filter agents. Call the function when the select is fully loaded.
var textNoData = "<?php echo __('None'); ?>";
filterByText($('#id_agents'), $("#text-filter_agents"), textNoData);
},
"json"
);

View File

@ -24,9 +24,24 @@ $menu_godmode['class'] = 'godmode';
if (check_acl($config['id_user'], 0, 'PM')) {
$sub = [];
$sub['godmode/servers/discovery']['text'] = __('Discovery');
$sub['godmode/servers/discovery']['id'] = 'Discovery';
$sub['godmode/servers/discovery']['subsecs'] = ['godmode/servers/discovery'];
$sub['godmode/servers/discovery&wiz=main']['text'] = __('Main');
$sub['godmode/servers/discovery&wiz=main']['id'] = 'Discovery';
$sub['godmode/servers/discovery&wiz=tasklist']['text'] = __('Task list');
$sub['godmode/servers/discovery&wiz=tasklist']['id'] = 'tasklist';
$sub2 = [];
$sub2['godmode/servers/discovery&wiz=hd&mode=netscan']['text'] = __('Network scan');
enterprise_hook('hostdevices_submenu');
$sub2['godmode/servers/discovery&wiz=hd&mode=customnetscan']['text'] = __('Custom network scan');
$sub2['godmode/servers/discovery&wiz=hd&mode=managenetscanscripts']['text'] = __('Manage scan scripts');
$sub['godmode/servers/discovery&wiz=hd']['text'] = __('Host & devices');
$sub['godmode/servers/discovery&wiz=hd']['id'] = 'hd';
$sub['godmode/servers/discovery&wiz=hd']['sub2'] = $sub2;
enterprise_hook('applications_menu');
enterprise_hook('cloud_menu');
enterprise_hook('console_task_menu');
// Add to menu.
$menu_godmode['discovery']['text'] = __('Discovery');
@ -114,6 +129,7 @@ if (check_acl($config['id_user'], 0, 'PM')) {
$sub['godmode/modules/manage_network_templates']['id'] = 'Module templates';
enterprise_hook('inventory_submenu');
enterprise_hook('autoconfiguration_menu');
enterprise_hook('agent_repository_menu');
}
if (check_acl($config['id_user'], 0, 'AW')) {
@ -208,7 +224,7 @@ if (!empty($sub)) {
}
if (check_acl($config['id_user'], 0, 'AW') || check_acl($config['id_user'], 0, 'PM') || check_acl($config['id_user'], 0, 'RR')) {
if (check_acl($config['id_user'], 0, 'AW') || check_acl($config['id_user'], 0, 'PM')) {
// Servers
$menu_godmode['gservers']['text'] = __('Servers');
$menu_godmode['gservers']['sec2'] = 'godmode/servers/modificar_server';
@ -418,10 +434,12 @@ if (is_array($config['extensions'])) {
$sub['godmode/extensions']['type'] = 'direct';
$sub['godmode/extensions']['subtype'] = 'nolink';
if (is_array($menu_godmode['gextensions']['sub'])) {
$submenu = array_merge($menu_godmode['gextensions']['sub'], $sub);
if ($menu_godmode['gextensions']['sub'] != null) {
$menu_godmode['gextensions']['sub'] = $submenu;
}
}
}
$menu_godmode['links']['text'] = __('Links');

View File

@ -277,7 +277,7 @@ if (isset($data)) {
}
echo '<form method="post">';
echo '<form method="post" action='.$url.'>';
echo '<div class="" style="float:right;">';
html_print_input_hidden('new', 1);
html_print_submit_button(__('Create'), 'crt', false, 'class="sub next"');

View File

@ -36,6 +36,9 @@ require_once $config['homedir'].'/include/functions_component_groups.php';
if (defined('METACONSOLE')) {
components_meta_print_header();
$sec = 'advanced';
$id_modulo = (int) get_parameter('id_component_type');
$new_component = (bool) get_parameter('new_component');
} else {
/*
Hello there! :)

View File

@ -1,17 +1,32 @@
<?php
/**
* Extension to manage a list of gateways and the node address where they should
* point to.
*
* @category Network components Plugins
* @package Pandora FMS
* @subpackage Community
* @version 1.0.0
* @license See below
*
* ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2005-2019 Artica Soluciones Tecnologicas
* Please see http://pandorafms.org for full contribution list
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation for version 2.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* ============================================================================
*/
// Pandora FMS - http://pandorafms.com
// ==================================================
// Copyright (c) 2005-2010 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.
// Load global variables
global $config;
check_login();
@ -29,7 +44,7 @@ $data[1] = html_print_select_from_sql(
false,
false
);
// Store the macros in base64 into a hidden control to move between pages
// Store the macros in base64 into a hidden control to move between pages.
$data[1] .= html_print_input_hidden('macros', base64_encode($macros), true);
$data[2] = __('Post process');
$data[3] = html_print_extended_select_for_post_process(
@ -46,7 +61,7 @@ $data[3] = html_print_extended_select_for_post_process(
push_table_row($data, 'plugin_1');
// A hidden "model row" to clone it from javascript to add fields dynamicly
// A hidden "model row" to clone it from javascript to add fields dynamicly.
$data = [];
$data[0] = 'macro_desc';
$data[0] .= ui_print_help_tip('macro_help', true);
@ -56,7 +71,7 @@ $table->rowstyle['macro_field'] = 'display:none';
push_table_row($data, 'macro_field');
// If there are $macros, we create the form fields
// If there are $macros, we create the form fields.
if (!empty($macros)) {
$macros = json_decode($macros, true);
@ -68,9 +83,23 @@ if (!empty($macros)) {
}
if ($m['hide'] == 1) {
$data[1] = html_print_input_text($m['macro'], $m['value'], '', 100, 1024, true);
$data[1] = html_print_input_text(
$m['macro'],
io_output_password($m['value']),
'',
100,
1024,
true
);
} else {
$data[1] = html_print_input_text($m['macro'], io_output_password($m['value']), '', 100, 1024, true);
$data[1] = html_print_input_text(
$m['macro'],
$m['value'],
'',
100,
1024,
true
);
}
$table->colspan['macro'.$m['macro']][1] = 3;

View File

@ -414,7 +414,7 @@ if ($edit_container) {
echo "<table width='100%' cellpadding=4 cellspacing=4 class='databox filters'>";
echo '<tr>';
echo '<td>';
echo ui_toggle($single_table, 'Simple module graph', '', true, true);
echo ui_toggle($single_table, 'Simple module graph', '', '', true);
echo '</td>';
echo '</tr>';
echo '</table>';
@ -466,7 +466,7 @@ if ($edit_container) {
echo "<table width='100%' cellpadding=4 cellspacing=4 class='databox filters'>";
echo '<tr>';
echo '<td>';
echo ui_toggle(html_print_table($table, true), 'Custom graph', '', true, true);
echo ui_toggle(html_print_table($table, true), 'Custom graph', '', '', true);
echo '</td>';
echo '</tr>';
echo '</table>';
@ -561,7 +561,7 @@ if ($edit_container) {
echo "<table width='100%' cellpadding=4 cellspacing=4 class='databox filters'>";
echo '<tr>';
echo '<td>';
echo ui_toggle(html_print_table($table, true), 'Dynamic rules for simple module graph', '', true, true);
echo ui_toggle(html_print_table($table, true), 'Dynamic rules for simple module graph', '', '', true);
echo '</td>';
echo '</tr>';
echo '</table>';

View File

@ -356,9 +356,35 @@ echo "<td style='vertical-align: top;'>".__('Agents').'</td>';
echo '<td></td>';
echo "<td style='vertical-align: top;'>".__('Modules').'</td>';
echo '</tr><tr>';
echo '<td>'.html_print_select(agents_get_group_agents(), 'id_agents[]', 0, false, '', '', true, true, true, '', false, '').'</td>';
echo "<td style='vertical-align: center; text-align: center;'>".html_print_image('images/darrowright.png', true).'</td>';
echo '<td>'.html_print_select([], 'module[]', 0, false, '', 0, true, true, true, '', false, '').'</td>';
echo '<td style="width: 50%;">'.html_print_select(
agents_get_group_agents(),
'id_agents[]',
0,
false,
'',
'',
true,
true,
true,
'w100p',
false,
''
).'</td>';
echo "<td style='width: 3em;vertical-align: center; text-align: center;'>".html_print_image('images/darrowright.png', true).'</td>';
echo '<td style="width: 50%;">'.html_print_select(
[],
'module[]',
0,
false,
'',
0,
true,
true,
true,
'w100p',
false,
''
).'</td>';
echo '</tr><tr>';
echo "<td colspan='3'>";
echo "<table cellpadding='4'><tr>";

View File

@ -61,7 +61,7 @@ $buttons['visual_console_favorite'] = [
'text' => '<a href="'.$url_visual_console_favorite.'">'.html_print_image('images/list.png', true, ['title' => __('Visual Favourite Console')]).'</a>',
];
if ($is_enterprise && $vconsoles_manage) {
if ($is_enterprise !== ENTERPRISE_NOT_HOOK && $vconsoles_manage) {
$buttons['visual_console_template'] = [
'active' => false,
'text' => '<a href="'.$url_visual_console_template.'">'.html_print_image('images/templates.png', true, ['title' => __('Visual Console Template')]).'</a>',

View File

@ -165,6 +165,8 @@ switch ($action) {
$show_in_landscape = 0;
$hide_notinit_agents = 0;
$priority_mode = REPORT_PRIORITY_MODE_OK;
$failover_mode = 0;
$failover_type = REPORT_FAILOVER_TYPE_NORMAL;
$server_name = '';
$server_id = 0;
$dyn_height = 230;
@ -314,6 +316,8 @@ switch ($action) {
$sla_sorted_by = $item['top_n'];
$period = $item['period'];
$current_month = $item['current_month'];
$failover_mode = $item['failover_mode'];
$failover_type = $item['failover_type'];
break;
case 'module_histogram_graph':
@ -566,7 +570,6 @@ switch ($action) {
$include_extended_events = $item['show_extended_events'];
$filter_search = $style['event_filter_search'];
break;
case 'event_report_group':
@ -582,6 +585,9 @@ switch ($action) {
$filter_search = $style['event_filter_search'];
$filter_event_severity = json_decode($style['filter_event_severity'], true);
$filter_event_status = json_decode($style['filter_event_status'], true);
$filter_event_type = json_decode($style['filter_event_type'], true);
$include_extended_events = $item['show_extended_events'];
@ -847,7 +853,10 @@ $class = 'databox filters';
}
?>
<?php
if (!isset($text)) {
$text = __('This type of report brings a lot of data loading, it is recommended to use it for scheduled reports and not for real-time view.');
}
echo '<a id="log_help_tip" style="visibility: hidden;" href="javascript:" class="tip" >'.html_print_image('images/tip.png', true, ['title' => $text]).'</a>';
?>
</td>
@ -859,7 +868,18 @@ $class = 'databox filters';
</td>
<td style="">
<?php
html_print_input_text('name', $name, '', 80, 100);
html_print_input_text(
'name',
$name,
'',
80,
100,
false,
false,
false,
'',
'fullwidth'
);
?>
</td>
</tr>
@ -917,7 +937,18 @@ $class = 'databox filters';
</td>
<td style="">
<?php
echo html_print_input_text('label', $label, '', 50, 255, true);
echo html_print_input_text(
'label',
$label,
'',
50,
255,
true,
false,
false,
'',
'fullwidth'
);
?>
</td>
</tr>
@ -2235,6 +2266,7 @@ $class = 'databox filters';
?>
</td>
</tr>
<tr id="row_select_fields2" style="" class="datos">
<td style="font-weight:bold;margin-right:150px;">
<?php
@ -2606,6 +2638,59 @@ $class = 'databox filters';
</td>
</tr>
<tr id="row_failover_mode" style="" class="datos">
<td style="font-weight:bold;">
<?php
echo __('Failover mode').ui_print_help_tip(
__('SLA calculation must be performed taking into account the failover modules assigned to the primary module'),
true
);
?>
</td>
<td>
<?php
html_print_checkbox_switch(
'failover_mode',
1,
$failover_mode
);
?>
</td>
</tr>
<tr id="row_failover_type" style="" class="datos">
<td style="font-weight:bold;">
<?php
echo __('Failover type');
?>
</td>
<td>
<?php
echo __('Failover normal');
echo '<span style="margin-left:5px;"></span>';
html_print_radio_button(
'failover_type',
REPORT_FAILOVER_TYPE_NORMAL,
'',
$failover_type == REPORT_FAILOVER_TYPE_NORMAL,
''
);
echo '<span style="margin:30px;"></span>';
echo __('Failover simple');
echo '<span style="margin-left:5px;"></span>';
html_print_radio_button(
'failover_type',
REPORT_FAILOVER_TYPE_SIMPLE,
'',
$failover_type == REPORT_FAILOVER_TYPE_SIMPLE,
''
);
?>
</td>
</tr>
<tr id="row_filter_search" style="" class="datos">
<td style="font-weight:bold;"><?php echo __('Free search'); ?></td>
<td>
@ -2769,6 +2854,13 @@ function print_SLA_list($width, $action, $idItem=null)
'id_rc',
$idItem
);
$failover_mode = db_get_value(
'failover_mode',
'treport_content',
'id_rc',
$idItem
);
?>
<table class="databox data" id="sla_list" border="0" cellpadding="4" cellspacing="4" width="100%">
<thead>
@ -2781,8 +2873,23 @@ function print_SLA_list($width, $action, $idItem=null)
<th class="header sla_list_module_col" scope="col">
<?php
echo __('Module');
if ($report_item_type == 'availability_graph'
&& $failover_mode
) {
?>
<th class="header sla_list_agent_failover" scope="col">
<?php
echo __('Agent Failover');
?>
</th>
<th class="header sla_list_module_failover" scope="col">
<?php
echo __('Module Failover');
?>
</th>
<?php
}
?>
<th class="header sla_list_service_col" scope="col">
<?php
echo __('Service');
@ -2828,6 +2935,7 @@ function print_SLA_list($width, $action, $idItem=null)
case 'update':
case 'edit':
echo '<tbody id="list_sla">';
$itemsSLA = db_get_all_rows_filter(
'treport_content_sla_combined',
['id_report_content' => $idItem]
@ -2862,6 +2970,25 @@ function print_SLA_list($width, $action, $idItem=null)
['id_agente_modulo' => $item['id_agent_module']]
);
if (isset($item['id_agent_module_failover']) === true
&& $item['id_agent_module_failover'] !== 0
) {
$idAgentFailover = db_get_value_filter(
'id_agente',
'tagente_modulo',
['id_agente_modulo' => $item['id_agent_module_failover']]
);
$nameAgentFailover = agents_get_alias(
$idAgentFailover
);
$nameModuleFailover = db_get_value_filter(
'nombre',
'tagente_modulo',
['id_agente_modulo' => $item['id_agent_module_failover']]
);
}
$server_name_element = '';
if ($meta && $server_name != '') {
$server_name_element .= ' ('.$server_name.')';
@ -2875,6 +3002,17 @@ function print_SLA_list($width, $action, $idItem=null)
echo printSmallFont($nameModule);
echo '</td>';
if ($report_item_type == 'availability_graph'
&& $failover_mode
) {
echo '<td class="sla_list_agent_failover">';
echo printSmallFont($nameAgentFailover).$server_name_element;
echo '</td>';
echo '<td class="sla_list_module_failover">';
echo printSmallFont($nameModuleFailover);
echo '</td>';
}
if (enterprise_installed()
&& $report_item_type == 'SLA_services'
) {
@ -2923,6 +3061,15 @@ function print_SLA_list($width, $action, $idItem=null)
<td class="sla_list_agent_col agent_name"></td>
<td class="sla_list_module_col module_name"></td>
<?php
if ($report_item_type == 'availability_graph'
&& $failover_mode
) {
?>
<td class="sla_list_agent_failover agent_name_failover"></td>
<td class="sla_list_module_failover module_name_failover"></td>
<?php
}
if (enterprise_installed()
&& $report_item_type == 'SLA_services'
) {
@ -2979,6 +3126,44 @@ function print_SLA_list($width, $action, $idItem=null)
</select>
</td>
<?php
if ($report_item_type == 'availability_graph'
&& $failover_mode
) {
?>
<td class="sla_list_agent_failover_col">
<input id="hidden-id_agent_failover" name="id_agent_failover" value="" type="hidden">
<input id="hidden-server_name_failover" name="server_name_failover" value="" type="hidden">
<?php
$params = [];
$params['show_helptip'] = true;
$params['input_name'] = 'agent_failover';
$params['value'] = '';
$params['use_hidden_input_idagent'] = true;
$params['hidden_input_idagent_id'] = 'hidden-id_agent_failover';
$params['javascript_is_function_select'] = true;
$params['selectbox_id'] = 'id_agent_module_failover';
$params['add_none_module'] = false;
if ($meta) {
$params['use_input_id_server'] = true;
$params['input_id_server_id'] = 'hidden-id_server';
$params['disabled_javascript_on_blur_function'] = true;
}
ui_print_agent_autocomplete_input($params);
?>
</td>
<td class="sla_list_module_failover_col">
<select id="id_agent_module_failover" name="id_agent_module_failover" disabled="disabled" style="max-width: 180px">
<option value="0">
<?php
echo __('Select an Agent first');
?>
</option>
</select>
</td>
<?php
}
if (enterprise_installed()
&& $report_item_type == 'SLA_services'
) {
@ -3614,11 +3799,18 @@ $(document).ready (function () {
$("#checkbox-checkbox_show_resume").change(function(){
if($(this).is(":checked")){
$("#row_select_fields2").show();
$("#row_select_fields3").show();
}
else{
$("#row_select_fields2").hide();
$("#row_select_fields3").hide();
}
});
$("#checkbox-failover_mode").change(function(){
if($(this).is(":checked")){
$("#row_failover_type").show();
}
else{
$("#row_failover_type").hide();
}
});
});
@ -3912,10 +4104,13 @@ function deleteGeneralRow(id_row) {
function addSLARow() {
var nameAgent = $("input[name=agent_sla]").val();
var nameAgentFailover = $("input[name=agent_failover]").val();
var idAgent = $("input[name=id_agent_sla]").val();
var serverId = $("input[name=id_server]").val();
var idModule = $("#id_agent_module_sla").val();
var idModuleFailover = $("#id_agent_module_failover").val();
var nameModule = $("#id_agent_module_sla :selected").text();
var nameModuleFailover = $("#id_agent_module_failover :selected").text();
var slaMin = $("input[name=sla_min]").val();
var slaMax = $("input[name=sla_max]").val();
var slaLimit = $("input[name=sla_limit]").val();
@ -3976,10 +4171,63 @@ function addSLARow() {
});
}
if (nameAgentFailover != '') {
//Truncate nameAgentFailover
var params = [];
params.push("truncate_text=1");
params.push("text=" + nameAgentFailover);
params.push("page=include/ajax/reporting.ajax");
jQuery.ajax ({
data: params.join ("&"),
type: 'POST',
url: action=
<?php
echo '"'.ui_get_full_url(
false,
false,
false,
false
).'"';
?>
+ "/ajax.php",
async: false,
timeout: 10000,
success: function (data) {
nameAgentFailover = data;
}
});
//Truncate nameModuleFailover
var params = [];
params.push("truncate_text=1");
params.push("text=" + nameModuleFailover);
params.push("page=include/ajax/reporting.ajax");
jQuery.ajax ({
data: params.join ("&"),
type: 'POST',
url: action=
<?php
echo '"'.ui_get_full_url(
false,
false,
false,
false
).'"';
?>
+ "/ajax.php",
async: false,
timeout: 10000,
success: function (data) {
nameModuleFailover = data;
}
});
}
var params = [];
params.push("add_sla=1");
params.push("id=" + $("input[name=id_item]").val());
params.push("id_module=" + idModule);
params.push("id_module_failover=" + idModuleFailover);
params.push("sla_min=" + slaMin);
params.push("sla_max=" + slaMax);
params.push("sla_limit=" + slaLimit);
@ -4012,6 +4260,8 @@ function addSLARow() {
$("#row", row).attr('id', 'sla_' + data['id']);
$(".agent_name", row).html(nameAgent);
$(".module_name", row).html(nameModule);
$(".agent_name_failover", row).html(nameAgentFailover);
$(".module_name_failover", row).html(nameModuleFailover);
$(".service_name", row).html(serviceName);
$(".sla_min", row).html(slaMin);
$(".sla_max", row).html(slaMax);
@ -4022,14 +4272,22 @@ function addSLARow() {
);
$("#list_sla").append($(row).html());
$("input[name=id_agent_sla]").val('');
$("input[name=id_agent_failover]").val('');
$("input[name=id_server]").val('');
$("input[name=agent_sla]").val('');
$("input[name=agent_failover]").val('');
$("#id_agent_module_sla").empty();
$("#id_agent_module_sla").attr('disabled', 'true');
$("#id_agent_module_sla").append(
$("<option></option>")
.attr ("value", 0)
.html ($("#module_sla_text").html()));
$("#id_agent_module_failover").empty();
$("#id_agent_module_failover").attr('disabled', 'true');
$("#id_agent_module_failover").append(
$("<option></option>")
.attr ("value", 0)
.html ($("#module_sla_text").html()));
$("input[name=sla_min]").val('');
$("input[name=sla_max]").val('');
$("input[name=sla_limit]").val('');
@ -4158,7 +4416,6 @@ function addGeneralRow() {
success: function (data) {
if (data['correct']) {
row = $("#general_template").clone();
$("#row", row).show();
$("#row", row).attr('id', 'general_' + data['id']);
$(".agent_name", row).html(nameAgent);
@ -4208,6 +4465,8 @@ function chooseType() {
$("#row_custom_example").hide();
$("#row_group").hide();
$("#row_current_month").hide();
$("#row_failover_mode").hide();
$("#row_failover_type").hide();
$("#row_working_time").hide();
$("#row_only_display_wrong").hide();
$("#row_combo_module").hide();
@ -4286,6 +4545,8 @@ function chooseType() {
$("#row_event_filter").show();
$("#row_event_graphs").show();
$("#row_event_graph_by_agent").show();
$("#row_event_graph_by_user").show();
$("#row_event_graph_by_criticity").show();
@ -4293,6 +4554,11 @@ function chooseType() {
$("#row_extended_events").show();
$("#row_filter_search").show();
$("#row_event_severity").show();
$("#row_event_status").show();
$("#row_event_type").show();
$("#row_historical_db_check").hide();
break;
@ -4374,6 +4640,11 @@ function chooseType() {
$("#row_working_time").show();
$("#row_historical_db_check").hide();
$("#row_priority_mode").show();
$("#row_failover_mode").show();
var failover_checked = $("input[name='failover_mode']").prop("checked");
if(failover_checked){
$("#row_failover_type").show();
}
break;
case 'module_histogram_graph':

View File

@ -774,34 +774,32 @@ switch ($action) {
$table->head[1] = __('Description');
$table->head[2] = __('HTML');
$table->head[3] = __('XML');
$table->size[0] = '20%';
$table->size[1] = '30%';
$table->size[0] = '50%';
$table->size[1] = '20%';
$table->size[2] = '2%';
$table->headstyle[2] = 'min-width: 35px;';
$table->headstyle[2] = 'min-width: 35px;text-align: left;';
$table->size[3] = '2%';
$table->headstyle[3] = 'min-width: 35px;';
$table->headstyle[3] = 'min-width: 35px;text-align: left;';
$table->size[4] = '2%';
$table->headstyle[4] = 'min-width: 35px;';
$table->size[5] = '2%';
$table->headstyle[5] = 'min-width: 35px;';
$table->size[6] = '2%';
$table->headstyle[6] = 'min-width: 35px;';
$table->size[7] = '5%';
$table->headstyle['csv'] = 'min-width: 65px;';
$table->style[7] = 'text-align: center;';
$table->headstyle[9] = 'min-width: 100px;';
$table->style[9] = 'text-align: center;';
$table->headstyle[4] = 'min-width: 35px;text-align: left;';
$next = 4;
// Calculate dinamically the number of the column.
if (enterprise_hook('load_custom_reporting_1') !== ENTERPRISE_NOT_HOOK) {
if (enterprise_hook('load_custom_reporting_1', [$table]) !== ENTERPRISE_NOT_HOOK) {
$next = 7;
}
$table->size[$next] = '2%';
$table->style[$next] = 'text-align: left;';
$table->headstyle[($next + 2)] = 'min-width: 130px; text-align:right;';
$table->style[($next + 2)] = 'text-align: right;';
// Admin options only for RM flag.
if (check_acl($config['id_user'], 0, 'RM')) {
$table->head[$next] = __('Private');
$table->headstyle[$next] = 'min-width: 40px;text-align: left;';
$table->size[$next] = '2%';
if (defined('METACONSOLE')) {
$table->align[$next] = '';
@ -811,7 +809,9 @@ switch ($action) {
$next++;
$table->head[$next] = __('Group');
$table->size[$next] = '15%';
$table->headstyle[$next] = 'min-width: 40px;text-align: left;';
$table->size[$next] = '2%';
$table->align[$next] = 'left';
$next++;
$op_column = false;
@ -829,7 +829,7 @@ switch ($action) {
// $table->size = array ();
$table->size[$next] = '10%';
$table->align[$next] = 'left';
$table->align[$next] = 'right';
}
$columnview = false;
@ -1344,6 +1344,16 @@ switch ($action) {
switch ($action) {
case 'update':
$values = [];
$server_name = get_parameter('server_id');
if (is_metaconsole() && $server_name != '') {
$id_meta = metaconsole_get_id_server($server_name);
$connection = metaconsole_get_connection_by_id(
$id_meta
);
metaconsole_connect($connection);
$values['server_name'] = $connection['server_name'];
}
$values['id_report'] = $idReport;
$values['description'] = get_parameter('description');
$values['type'] = get_parameter('type', null);
@ -1352,14 +1362,36 @@ switch ($action) {
$label = get_parameter('label', '');
$id_agent = get_parameter('id_agent');
$id_agent_module = get_parameter('id_agent_module');
// Add macros name.
$items_label = [];
$items_label['type'] = get_parameter('type');
$items_label['id_agent'] = get_parameter('id_agent');
$items_label['id_agent_module'] = get_parameter(
'id_agent_module'
);
$name_it = (string) get_parameter('name');
$agent_description = agents_get_description($id_agent);
$agent_group = agents_get_agent_group($id_agent);
$agent_address = agents_get_address($id_agent);
$agent_alias = agents_get_alias($id_agent);
$module_name = modules_get_agentmodule_name(
$id_agent_module
);
$module_description = modules_get_agentmodule_descripcion(
$id_agent_module
);
$items_label = [
'type' => get_parameter('type'),
'id_agent' => $id_agent,
'id_agent_module' => $id_agent_module,
'agent_description' => $agent_description,
'agent_group' => $agent_group,
'agent_address' => $agent_address,
'agent_alias' => $agent_alias,
'module_name' => $module_name,
'module_description' => $module_description,
];
$values['name'] = reporting_label_macro(
$items_label,
$name_it
@ -1444,6 +1476,14 @@ switch ($action) {
$values['show_graph'] = get_parameter(
'combo_graph_options'
);
$values['failover_mode'] = get_parameter(
'failover_mode',
0
);
$values['failover_type'] = get_parameter(
'failover_type',
REPORT_FAILOVER_TYPE_NORMAL
);
$good_format = true;
break;
@ -1707,13 +1747,6 @@ switch ($action) {
);
$values['id_group'] = get_parameter('combo_group');
$values['server_name'] = get_parameter('server_name');
$server_id = (int) get_parameter('server_id');
if ($server_id != 0) {
$connection = metaconsole_get_connection_by_id(
$server_id
);
$values['server_name'] = $connection['server_name'];
}
if ($values['server_name'] == '') {
$values['server_name'] = get_parameter(
@ -1970,22 +2003,11 @@ switch ($action) {
$values['style'] = io_safe_input(json_encode($style));
if (is_metaconsole()) {
metaconsole_restore_db();
}
if ($good_format) {
switch ($config['dbtype']) {
case 'oracle':
if (isset($values['type'])) {
$values[db_escape_key_identifier(
'type'
)] = $values['type'];
unset($values['type']);
}
break;
default:
// Default.
break;
}
$resultOperationDB = db_process_sql_update(
'treport_content',
$values,
@ -1998,21 +2020,62 @@ switch ($action) {
case 'save':
$values = [];
$values['server_name'] = get_parameter('server_name');
$server_id = (int) get_parameter('server_id');
if ($server_id != 0) {
$connection = metaconsole_get_connection_by_id(
$server_id
);
metaconsole_connect($connection);
$values['server_name'] = $connection['server_name'];
}
$values['id_report'] = $idReport;
$values['type'] = get_parameter('type', null);
$values['description'] = get_parameter('description');
$label = get_parameter('label', '');
// Add macros name.
$items_label = [];
$items_label['type'] = get_parameter('type');
$items_label['id_agent'] = get_parameter('id_agent');
$items_label['id_agent_module'] = get_parameter(
'id_agent_module'
);
$name_it = (string) get_parameter('name');
$values['recursion'] = get_parameter('recursion', null);
$values['show_extended_events'] = get_parameter('include_extended_events', null);
$values['show_extended_events'] = get_parameter(
'include_extended_events',
null
);
$id_agent = get_parameter('id_agent');
$id_agent_module = get_parameter('id_agent_module');
// Add macros name.
$name_it = (string) get_parameter('name');
$agent_description = agents_get_description($id_agent);
$agent_group = agents_get_agent_group($id_agent);
$agent_address = agents_get_address($id_agent);
$agent_alias = agents_get_alias($id_agent);
$module_name = modules_get_agentmodule_name(
$id_agent_module
);
$module_description = modules_get_agentmodule_descripcion(
$id_agent_module
);
if (is_metaconsole()) {
metaconsole_restore_db();
}
$items_label = [
'type' => get_parameter('type'),
'id_agent' => $id_agent,
'id_agent_module' => $id_agent_module,
'agent_description' => $agent_description,
'agent_group' => $agent_group,
'agent_address' => $agent_address,
'agent_alias' => $agent_alias,
'module_name' => $module_name,
'module_description' => $module_description,
];
$values['name'] = reporting_label_macro(
$items_label,
$name_it
@ -2217,18 +2280,6 @@ switch ($action) {
break;
}
$values['server_name'] = get_parameter('server_name');
$server_id = (int) get_parameter('server_id');
if ($server_id != 0) {
$connection = metaconsole_get_connection_by_id(
$server_id
);
$values['server_name'] = $connection['server_name'];
}
if ($values['server_name'] == '') {
$values['server_name'] = get_parameter(
'combo_server'
@ -2401,6 +2452,16 @@ switch ($action) {
$values['current_month'] = get_parameter('current_month');
$values['failover_mode'] = get_parameter(
'failover_mode',
0
);
$values['failover_type'] = get_parameter(
'failover_type',
REPORT_FAILOVER_TYPE_NORMAL
);
$style = [];
$style['show_in_same_row'] = get_parameter(
'show_in_same_row',

View File

@ -254,12 +254,14 @@ function update_button_palette_callback() {
var values = {};
values = readFields();
if (selectedItem == "static_graph") {
if (values["map_linked"] == 0) {
if (values["agent"] == "" || values["agent"] == "none") {
dialog_message("#message_alert_no_agent");
return false;
}
}
}
// TODO VALIDATE DATA
switch (selectedItem) {
case "background":

View File

@ -25,6 +25,8 @@ if (empty($visualConsole)) {
exit;
}
ui_require_css_file('visual_maps');
// ACL for the existing visual console
// if (!isset($vconsole_read))
// $vconsole_read = check_acl ($config['id_user'], $visualConsole['id_group'], "VR");
@ -170,6 +172,7 @@ echo "<div id='delete_in_progress_dialog' style='display: none; text-align: cent
// CSS
ui_require_css_file('color-picker', 'include/styles/js/');
ui_require_css_file('jquery-ui.min', 'include/styles/js/');
ui_require_jquery_file('jquery-ui_custom');
// Javascript
ui_require_jquery_file('colorpicker');

View File

@ -171,7 +171,7 @@ foreach ($layoutDatas as $layoutData) {
$table->data[($i + 1)]['icon'] = html_print_image(
'images/camera.png',
true,
['title' => __('Static Graph')]
['title' => __('Static Image')]
);
break;

View File

@ -54,7 +54,7 @@ $buttons['visual_console_favorite'] = [
'text' => '<a href="'.$url_visual_console_favorite.'">'.html_print_image('images/list.png', true, ['title' => __('Visual Favourite Console')]).'</a>',
];
if ($is_enterprise && $vconsoles_manage) {
if ($is_enterprise !== ENTERPRISE_NOT_HOOK && $vconsoles_manage) {
$buttons['visual_console_template'] = [
'active' => false,
'text' => '<a href="'.$url_visual_console_template.'">'.html_print_image('images/templates.png', true, ['title' => __('Visual Console Template')]).'</a>',

View File

@ -42,7 +42,19 @@ function get_wiz_class($str)
return 'ConsoleTasks';
default:
// Ignore.
// Main, show header.
ui_print_page_header(
__('Discovery'),
'',
false,
'',
true,
'',
false,
'',
GENERIC_SIZE_TEXT,
''
);
return null;
}
}
@ -81,7 +93,7 @@ function cl_load_cmp($a, $b)
$classes = glob($config['homedir'].'/godmode/wizards/*.class.php');
if (enterprise_installed()) {
$ent_classes = glob(
$config['homedir'].'/enterprise/godmode/wizards/*.class.php'
$config['homedir'].'/'.ENTERPRISE_DIR.'/godmode/wizards/*.class.php'
);
if ($ent_classes === false) {
$ent_classes = [];
@ -130,5 +142,11 @@ if ($classname_selected === null) {
}
}
// Show hints if there is no task.
if (get_parameter('discovery_hint', 0)) {
ui_require_css_file('discovery-hint');
ui_print_info_message(__('You must create a task first'));
}
Wizard::printBigButtonsList($wiz_data);
}

View File

@ -70,7 +70,7 @@ if (is_ajax()) {
$table->head[0] = __('Agent');
$table->head[1] = __('Module');
foreach ($modules as $mod) {
$agent_name = '<a href="'.$config['homeurl'].'/index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$mod['id_agente'].'">'.modules_get_agentmodule_agent_name(
$agent_name = '<a href="'.ui_get_full_url('index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$mod['id_agente']).'">'.modules_get_agentmodule_agent_alias(
$mod['id_agente_modulo']
).'</a>';
@ -280,7 +280,7 @@ if (($create != '') || ($view != '')) {
} else {
if ($create != '') {
ui_print_page_header(
__('Plugin creation'),
__('Plugin registration'),
'images/gm_servers.png',
false,
'plugin_definition',
@ -1215,4 +1215,3 @@ ui_require_javascript_file('pandora_modules');
</script>

View File

@ -51,11 +51,11 @@ $table->style[0] = 'font-weight: bold';
$table->align = [];
$table->align[1] = 'center';
$table->align[3] = 'center';
$table->align[8] = 'center';
$table->align[8] = 'right';
$table->headstyle[1] = 'text-align:center';
$table->headstyle[3] = 'text-align:center';
$table->headstyle[8] = 'text-align:center';
$table->headstyle[8] = 'text-align:right;width: 120px;';
// $table->title = __('Tactical server information');
$table->titleclass = 'tabletitle';
@ -152,12 +152,12 @@ foreach ($servers as $server) {
$data[8] = '';
if ($server['type'] == 'recon') {
$data[8] .= '<a href="index.php?sec=gservers&sec2=operation/servers/recon_view">';
$data[8] .= '<a href="'.ui_get_full_url('index.php?sec=gservers&sec2=godmode/servers/discovery&wiz=tasklist').'">';
$data[8] .= html_print_image(
'images/firts_task/icono_grande_reconserver.png',
true,
[
'title' => __('Manage recon tasks'),
'title' => __('Manage Discovery tasks'),
'style' => 'width:21px;height:21px;',
]
);
@ -165,7 +165,7 @@ foreach ($servers as $server) {
}
if ($server['type'] == 'data') {
$data[8] .= '<a href="index.php?sec=gservers&sec2=godmode/servers/modificar_server&refr=0&server_reset_counts='.$server['id_server'].'">';
$data[8] .= '<a href="'.ui_get_full_url('index.php?sec=gservers&sec2=godmode/servers/modificar_server&refr=0&server_reset_counts='.$server['id_server']).'">';
$data[8] .= html_print_image(
'images/target.png',
true,
@ -173,7 +173,7 @@ foreach ($servers as $server) {
);
$data[8] .= '</a>';
} else if ($server['type'] == 'enterprise snmp') {
$data[8] .= '<a href="index.php?sec=gservers&sec2=godmode/servers/modificar_server&refr=0&server_reset_snmp_enterprise='.$server['id_server'].'">';
$data[8] .= '<a href="'.ui_get_full_url('index.php?sec=gservers&sec2=godmode/servers/modificar_server&refr=0&server_reset_snmp_enterprise='.$server['id_server']).'">';
$data[8] .= html_print_image(
'images/target.png',
true,
@ -182,7 +182,7 @@ foreach ($servers as $server) {
$data[8] .= '</a>';
}
$data[8] .= '<a href="index.php?sec=gservers&sec2=godmode/servers/modificar_server&server='.$server['id_server'].'">';
$data[8] .= '<a href="'.ui_get_full_url('index.php?sec=gservers&sec2=godmode/servers/modificar_server&server='.$server['id_server']).'">';
$data[8] .= html_print_image(
'images/config.png',
true,
@ -191,7 +191,7 @@ foreach ($servers as $server) {
$data[8] .= '</a>';
if (($names_servers[$safe_server_name] === true) && ($server['type'] == 'data' || $server['type'] == 'enterprise satellite')) {
$data[8] .= '<a href="index.php?sec=gservers&sec2=godmode/servers/modificar_server&server_remote='.$server['id_server'].'&ext='.$ext.'">';
$data[8] .= '<a href="'.ui_get_full_url('index.php?sec=gservers&sec2=godmode/servers/modificar_server&server_remote='.$server['id_server'].'&ext='.$ext).'">';
$data[8] .= html_print_image(
'images/remote_configuration.png',
true,
@ -201,7 +201,7 @@ foreach ($servers as $server) {
$names_servers[$safe_server_name] = false;
}
$data[8] .= '<a href="index.php?sec=gservers&sec2=godmode/servers/modificar_server&server_del='.$server['id_server'].'&amp;delete=1">';
$data[8] .= '<a href="'.ui_get_full_url('index.php?sec=gservers&sec2=godmode/servers/modificar_server&server_del='.$server['id_server'].'&amp;delete=1').'">';
$data[8] .= html_print_image(
'images/cross.png',
true,
@ -234,7 +234,8 @@ if ($tiny) {
ui_toggle(
html_print_table($table, true),
__('Tactical server information'),
false,
'',
'',
$hidden_toggle
);
} else {

View File

@ -86,7 +86,7 @@ $buttons = [];
// Draws header.
$buttons['general'] = [
'active' => false,
'text' => '<a href="index.php?sec=gsetup&sec2=godmode/setup/setup&amp;section=general">'.html_print_image('images/gm_setup.png', true, ['title' => __('General')]).'</a>',
'text' => '<a href="'.ui_get_full_url('index.php?sec=gsetup&sec2=godmode/setup/setup&amp;section=general').'">'.html_print_image('images/gm_setup.png', true, ['title' => __('General')]).'</a>',
];
if (enterprise_installed()) {
@ -95,37 +95,37 @@ if (enterprise_installed()) {
$buttons['auth'] = [
'active' => false,
'text' => '<a href="index.php?sec=gsetup&sec2=godmode/setup/setup&amp;section=auth">'.html_print_image('images/key.png', true, ['title' => __('Authentication')]).'</a>',
'text' => '<a href="'.ui_get_full_url('index.php?sec=gsetup&sec2=godmode/setup/setup&amp;section=auth').'">'.html_print_image('images/key.png', true, ['title' => __('Authentication')]).'</a>',
];
$buttons['perf'] = [
'active' => false,
'text' => '<a href="index.php?sec=gsetup&sec2=godmode/setup/setup&amp;section=perf">'.html_print_image('images/performance.png', true, ['title' => __('Performance')]).'</a>',
'text' => '<a href="'.ui_get_full_url('index.php?sec=gsetup&sec2=godmode/setup/setup&amp;section=perf').'">'.html_print_image('images/performance.png', true, ['title' => __('Performance')]).'</a>',
];
$buttons['vis'] = [
'active' => false,
'text' => '<a href="index.php?sec=gsetup&sec2=godmode/setup/setup&amp;section=vis">'.html_print_image('images/chart.png', true, ['title' => __('Visual styles')]).'</a>',
'text' => '<a href="'.ui_get_full_url('index.php?sec=gsetup&sec2=godmode/setup/setup&amp;section=vis').'">'.html_print_image('images/chart.png', true, ['title' => __('Visual styles')]).'</a>',
];
if (check_acl($config['id_user'], 0, 'AW')) {
if ($config['activate_netflow']) {
$buttons['net'] = [
'active' => false,
'text' => '<a href="index.php?sec=gsetup&sec2=godmode/setup/setup&amp;section=net">'.html_print_image('images/op_netflow.png', true, ['title' => __('Netflow')]).'</a>',
'text' => '<a href="'.ui_get_full_url('index.php?sec=gsetup&sec2=godmode/setup/setup&amp;section=net').'">'.html_print_image('images/op_netflow.png', true, ['title' => __('Netflow')]).'</a>',
];
}
}
$buttons['ehorus'] = [
'active' => false,
'text' => '<a href="index.php?sec=gsetup&sec2=godmode/setup/setup&section=ehorus">'.html_print_image('images/ehorus/ehorus.png', true, ['title' => __('eHorus')]).'</a>',
'text' => '<a href="'.ui_get_full_url('index.php?sec=gsetup&sec2=godmode/setup/setup&section=ehorus').'">'.html_print_image('images/ehorus/ehorus.png', true, ['title' => __('eHorus')]).'</a>',
];
// FIXME: Not definitive icon
$buttons['notifications'] = [
'active' => false,
'text' => '<a href="index.php?sec=gsetup&sec2=godmode/setup/setup&section=notifications">'.html_print_image('images/alerts_template.png', true, ['title' => __('Notifications')]).'</a>',
'text' => '<a href="'.ui_get_full_url('index.php?sec=gsetup&sec2=godmode/setup/setup&section=notifications').'">'.html_print_image('images/alerts_template.png', true, ['title' => __('Notifications')]).'</a>',
];
$help_header = '';

View File

@ -1,5 +1,13 @@
<?php
/**
* General setup.
*
* @category Setup
* @package Pandora FMS
* @subpackage Opensource
* @version 1.0.0
* @license See below
*
* ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
@ -18,8 +26,36 @@
* ============================================================================
*/
// File begin.
/**
* Return sounds path.
*
* @return string Path.
*/
function get_sounds()
{
global $config;
$return = [];
$files = scandir($config['homedir'].'/include/sounds');
foreach ($files as $file) {
if (strstr($file, 'wav') !== false) {
$return['include/sounds/'.$file] = $file;
}
}
return $return;
}
// Begin.
global $config;
check_login();
$table = new StdClass();
@ -33,35 +69,18 @@ $table->style[0] = 'font-weight:bold';
$table->size[1] = '70%';
// Current config["language"] could be set by user, not taken from global setup !
switch ($config['dbtype']) {
case 'mysql':
$current_system_lang = db_get_sql(
'SELECT `value`
FROM tconfig WHERE `token` = "language"'
);
break;
case 'postgresql':
$current_system_lang = db_get_sql(
'SELECT "value"
FROM tconfig WHERE "token" = \'language\''
);
break;
case 'oracle':
$current_system_lang = db_get_sql(
'SELECT value
FROM tconfig WHERE token = \'language\''
);
break;
}
$current_system_lang = db_get_sql(
'SELECT `value` FROM tconfig WHERE `token` = "language"'
);
if ($current_system_lang == '') {
$current_system_lang = 'en';
}
$table->data[0][0] = __('Language code');
$table->data[0][1] = html_print_select_from_sql(
$i = 0;
$table->data[$i][0] = __('Language code');
$table->data[$i++][1] = html_print_select_from_sql(
'SELECT id_language, name FROM tlanguage',
'language',
$current_system_lang,
@ -71,68 +90,67 @@ $table->data[0][1] = html_print_select_from_sql(
true
);
$table->data[1][0] = __('Remote config directory').ui_print_help_tip(__('Directory where agent remote configuration is stored.'), true);
$table->data[$i][0] = __('Remote config directory').ui_print_help_tip(__('Directory where agent remote configuration is stored.'), true);
$table->data[$i++][1] = html_print_input_text('remote_config', io_safe_output($config['remote_config']), '', 30, 100, true);
$table->data[1][1] = html_print_input_text('remote_config', io_safe_output($config['remote_config']), '', 30, 100, true);
$table->data[$i][0] = __('Phantomjs bin directory').ui_print_help_tip(__('Directory where phantomjs binary file exists and has execution grants.'), true);
$table->data[$i++][1] = html_print_input_text('phantomjs_bin', io_safe_output($config['phantomjs_bin']), '', 30, 100, true);
$table->data[2][0] = __('Phantomjs bin directory').ui_print_help_tip(__('Directory where phantomjs binary file exists and has execution grants.'), true);
$table->data[$i][0] = __('Auto login (hash) password');
$table->data[$i++][1] = html_print_input_password('loginhash_pwd', io_output_password($config['loginhash_pwd']), '', 15, 15, true);
$table->data[2][1] = html_print_input_text('phantomjs_bin', io_safe_output($config['phantomjs_bin']), '', 30, 100, true);
$table->data[6][0] = __('Auto login (hash) password');
$table->data[6][1] = html_print_input_password('loginhash_pwd', io_output_password($config['loginhash_pwd']), '', 15, 15, true);
$table->data[9][0] = __('Time source');
$table->data[$i][0] = __('Time source');
$sources['system'] = __('System');
$sources['sql'] = __('Database');
$table->data[9][1] = html_print_select($sources, 'timesource', $config['timesource'], '', '', '', true);
$table->data[$i++][1] = html_print_select($sources, 'timesource', $config['timesource'], '', '', '', true);
$table->data[10][0] = __('Automatic check for updates');
$table->data[10][1] = html_print_checkbox_switch('autoupdate', 1, $config['autoupdate'], true);
$table->data[$i][0] = __('Automatic check for updates');
$table->data[$i++][1] = html_print_checkbox_switch('autoupdate', 1, $config['autoupdate'], true);
echo "<div id='dialog' title='".__('Enforce https Information')."' style='display:none;'>";
echo "<p style='text-align: center;'>".__('If SSL is not properly configured you will lose access to ').get_product_name().__(' Console').'</p>';
echo '</div>';
$table->data[11][0] = __('Enforce https');
$table->data[11][1] = html_print_checkbox_switch_extended('https', 1, $config['https'], false, '', '', true);
$table->data[$i][0] = __('Enforce https');
$table->data[$i++][1] = html_print_checkbox_switch_extended('https', 1, $config['https'], false, '', '', true);
$table->data[12][0] = __('Use cert of SSL');
$table->data[12][1] = html_print_checkbox_switch_extended('use_cert', 1, $config['use_cert'], false, '', '', true);
$table->data[$i][0] = __('Use cert of SSL');
$table->data[$i++][1] = html_print_checkbox_switch_extended('use_cert', 1, $config['use_cert'], false, '', '', true);
$table->rowstyle[13] = 'display: none;';
$table->data[13][0] = __('Path of SSL Cert.').ui_print_help_tip(__('Path where you put your cert and name of this cert. Remember your cert only in .pem extension.'), true);
$table->data[13][1] = html_print_input_text('cert_path', io_safe_output($config['cert_path']), '', 50, 255, true);
$table->rowstyle[$i] = 'display: none;';
$table->rowid[$i] = 'ssl-path-tr';
$table->data[$i][0] = __('Path of SSL Cert.').ui_print_help_tip(__('Path where you put your cert and name of this cert. Remember your cert only in .pem extension.'), true);
$table->data[$i++][1] = html_print_input_text('cert_path', io_safe_output($config['cert_path']), '', 50, 255, true);
$table->data[14][0] = __('Attachment store').ui_print_help_tip(__('Directory where temporary data is stored.'), true);
$table->data[14][1] = html_print_input_text('attachment_store', io_safe_output($config['attachment_store']), '', 50, 255, true);
$table->data[$i][0] = __('Attachment store').ui_print_help_tip(__('Directory where temporary data is stored.'), true);
$table->data[$i++][1] = html_print_input_text('attachment_store', io_safe_output($config['attachment_store']), '', 50, 255, true);
$table->data[15][0] = __('IP list with API access');
$table->data[$i][0] = __('IP list with API access');
if (isset($_POST['list_ACL_IPs_for_API'])) {
$list_ACL_IPs_for_API = get_parameter_post('list_ACL_IPs_for_API');
} else {
$list_ACL_IPs_for_API = get_parameter_get('list_ACL_IPs_for_API', implode("\n", $config['list_ACL_IPs_for_API']));
}
$table->data[15][1] = html_print_textarea('list_ACL_IPs_for_API', 2, 25, $list_ACL_IPs_for_API, 'style="height: 50px; width: 300px"', true);
$table->data[$i++][1] = html_print_textarea('list_ACL_IPs_for_API', 2, 25, $list_ACL_IPs_for_API, 'style="height: 50px; width: 300px"', true);
$table->data[16][0] = __('API password').ui_print_help_tip(__('Please be careful if you put a password put https access.'), true);
$table->data[16][1] = html_print_input_password('api_password', io_output_password($config['api_password']), '', 25, 255, true);
$table->data[$i][0] = __('API password').ui_print_help_tip(__('Please be careful if you put a password put https access.'), true);
$table->data[$i++][1] = html_print_input_password('api_password', io_output_password($config['api_password']), '', 25, 255, true);
$table->data[17][0] = __('Enable GIS features');
$table->data[17][1] = html_print_checkbox_switch('activate_gis', 1, $config['activate_gis'], true);
$table->data[$i][0] = __('Enable GIS features');
$table->data[$i++][1] = html_print_checkbox_switch('activate_gis', 1, $config['activate_gis'], true);
$table->data[19][0] = __('Enable Netflow');
$table->data[$i][0] = __('Enable Netflow');
$rbt_disabled = false;
if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN') {
$rbt_disabled = true;
$table->data[19][0] .= ui_print_help_tip(__('Not supported in Windows systems'), true);
$table->data[$i][0] .= ui_print_help_tip(__('Not supported in Windows systems'), true);
}
$table->data[19][1] = html_print_checkbox_switch_extended('activate_netflow', 1, $config['activate_netflow'], $rbt_disabled, '', '', true);
$table->data[$i++][1] = html_print_checkbox_switch_extended('activate_netflow', 1, $config['activate_netflow'], $rbt_disabled, '', '', true);
$table->data[21][0] = __('Enable Network Traffic Analyzer');
$table->data[21][1] = html_print_switch(
$table->data[$i][0] = __('Enable Network Traffic Analyzer');
$table->data[$i++][1] = html_print_switch(
[
'name' => 'activate_nta',
'value' => $config['activate_nta'],
@ -171,11 +189,11 @@ foreach ($timezones as $timezone) {
}
}
$table->data[23][0] = __('Timezone setup').' '.ui_print_help_tip(
$table->data[$i][0] = __('Timezone setup').' '.ui_print_help_tip(
__('Must have the same time zone as the system or database to avoid mismatches of time.'),
true
);
$table->data[23][1] = html_print_input_text_extended(
$table->data[$i][1] = html_print_input_text_extended(
'timezone_text',
$config['timezone'],
'text-timezone_text',
@ -187,47 +205,63 @@ $table->data[23][1] = html_print_input_text_extended(
'readonly',
true
);
$table->data[23][1] .= '<a id="change_timezone">'.html_print_image('images/pencil.png', true, ['title' => __('Change timezone')]).'</a>';
$table->data[23][1] .= '&nbsp;&nbsp;'.html_print_select($zone_name, 'zone', $zone_selected, 'show_timezone();', '', '', true);
$table->data[23][1] .= '&nbsp;&nbsp;'.html_print_select($timezone_n, 'timezone', $config['timezone'], '', '', '', true);
$table->data[$i][1] .= '<a id="change_timezone">'.html_print_image('images/pencil.png', true, ['title' => __('Change timezone')]).'</a>';
$table->data[$i][1] .= '&nbsp;&nbsp;'.html_print_select($zone_name, 'zone', $zone_selected, 'show_timezone();', '', '', true);
$table->data[$i++][1] .= '&nbsp;&nbsp;'.html_print_select($timezone_n, 'timezone', $config['timezone'], '', '', '', true);
$sounds = get_sounds();
$table->data[24][0] = __('Sound for Alert fired');
$table->data[24][1] = html_print_select($sounds, 'sound_alert', $config['sound_alert'], 'replaySound(\'alert\');', '', '', true);
$table->data[24][1] .= ' <a href="javascript: toggleButton(\'alert\');">'.html_print_image('images/control_play_col.png', true, ['id' => 'button_sound_alert', 'style' => 'vertical-align: middle;', 'width' => '16', 'title' => __('Play sound')]).'</a>';
$table->data[24][1] .= '<div id="layer_sound_alert"></div>';
$table->data[$i][0] = __('Sound for Alert fired');
$table->data[$i][1] = html_print_select($sounds, 'sound_alert', $config['sound_alert'], 'replaySound(\'alert\');', '', '', true);
$table->data[$i][1] .= ' <a href="javascript: toggleButton(\'alert\');">'.html_print_image('images/control_play_col.png', true, ['id' => 'button_sound_alert', 'style' => 'vertical-align: middle;', 'width' => '16', 'title' => __('Play sound')]).'</a>';
$table->data[$i++][1] .= '<div id="layer_sound_alert"></div>';
$table->data[25][0] = __('Sound for Monitor critical');
$table->data[25][1] = html_print_select($sounds, 'sound_critical', $config['sound_critical'], 'replaySound(\'critical\');', '', '', true);
$table->data[25][1] .= ' <a href="javascript: toggleButton(\'critical\');">'.html_print_image('images/control_play_col.png', true, ['id' => 'button_sound_critical', 'style' => 'vertical-align: middle;', 'width' => '16', 'title' => __('Play sound')]).'</a>';
$table->data[25][1] .= '<div id="layer_sound_critical"></div>';
$table->data[$i][0] = __('Sound for Monitor critical');
$table->data[$i][1] = html_print_select($sounds, 'sound_critical', $config['sound_critical'], 'replaySound(\'critical\');', '', '', true);
$table->data[$i][1] .= ' <a href="javascript: toggleButton(\'critical\');">'.html_print_image('images/control_play_col.png', true, ['id' => 'button_sound_critical', 'style' => 'vertical-align: middle;', 'width' => '16', 'title' => __('Play sound')]).'</a>';
$table->data[$i++][1] .= '<div id="layer_sound_critical"></div>';
$table->data[26][0] = __('Sound for Monitor warning');
$table->data[26][1] = html_print_select($sounds, 'sound_warning', $config['sound_warning'], 'replaySound(\'warning\');', '', '', true);
$table->data[26][1] .= ' <a href="javascript: toggleButton(\'warning\');">'.html_print_image('images/control_play_col.png', true, ['id' => 'button_sound_warning', 'style' => 'vertical-align: middle;', 'width' => '16', 'title' => __('Play sound')]).'</a>';
$table->data[26][1] .= '<div id="layer_sound_warning"></div>';
$table->data[$i][0] = __('Sound for Monitor warning');
$table->data[$i][1] = html_print_select($sounds, 'sound_warning', $config['sound_warning'], 'replaySound(\'warning\');', '', '', true);
$table->data[$i][1] .= ' <a href="javascript: toggleButton(\'warning\');">'.html_print_image('images/control_play_col.png', true, ['id' => 'button_sound_warning', 'style' => 'vertical-align: middle;', 'width' => '16', 'title' => __('Play sound')]).'</a>';
$table->data[$i++][1] .= '<div id="layer_sound_warning"></div>';
$table->data[28][0] = __('Public URL');
$table->data[28][0] .= ui_print_help_tip(
$table->data[$i][0] = __('Public URL');
$table->data[$i][0] .= ui_print_help_tip(
__('Set this value when your %s across inverse proxy or for example with mod_proxy of Apache.', get_product_name()).' '.__('Without the index.php such as http://domain/console_url/'),
true
);
$table->data[28][1] = html_print_input_text('public_url', $config['public_url'], '', 40, 255, true);
$table->data[$i++][1] = html_print_input_text('public_url', $config['public_url'], '', 40, 255, true);
$table->data[29][0] = __('Referer security');
$table->data[29][0] .= ui_print_help_tip(__("If enabled, actively checks if the user comes from %s's URL", get_product_name()), true);
$table->data[29][1] = html_print_checkbox_switch('referer_security', 1, $config['referer_security'], true);
$table->data[$i][0] = __('Force use Public URL');
$table->data[$i][0] .= ui_print_help_tip(__('Force using defined public URL).', get_product_name()), true);
$table->data[$i++][1] = html_print_switch(
[
'name' => 'force_public_url',
'value' => $config['force_public_url'],
]
);
$table->data[30][0] = __('Event storm protection');
$table->data[30][0] .= ui_print_help_tip(__('If set to yes no events or alerts will be generated, but agents will continue receiving data.'), true);
$table->data[30][1] = html_print_checkbox_switch('event_storm_protection', 1, $config['event_storm_protection'], true);
echo "<div id='force_public_url_dialog' title='".__('Enforce public URL usage information')."' style='display:none;'>";
echo "<p style='text-align: center;'>".__('If public URL is not properly configured you will lose access to ').get_product_name().__(' Console').'</p>';
echo '</div>';
$table->data[$i][0] = __('Public URL host exclusions');
$table->data[$i++][1] = html_print_textarea('public_url_exclusions', 2, 25, $config['public_url_exclusions'], 'style="height: 50px; width: 300px"', true);
$table->data[$i][0] = __('Referer security');
$table->data[$i][0] .= ui_print_help_tip(__("If enabled, actively checks if the user comes from %s's URL", get_product_name()), true);
$table->data[$i++][1] = html_print_checkbox_switch('referer_security', 1, $config['referer_security'], true);
$table->data[$i][0] = __('Event storm protection');
$table->data[$i][0] .= ui_print_help_tip(__('If set to yes no events or alerts will be generated, but agents will continue receiving data.'), true);
$table->data[$i++][1] = html_print_checkbox_switch('event_storm_protection', 1, $config['event_storm_protection'], true);
$table->data[31][0] = __('Command Snapshot').ui_print_help_tip(__('The string modules with several lines show as command output'), true);
$table->data[31][1] = html_print_checkbox_switch('command_snapshot', 1, $config['command_snapshot'], true);
$table->data[$i][0] = __('Command Snapshot').ui_print_help_tip(__('The string modules with several lines show as command output'), true);
$table->data[$i++][1] = html_print_checkbox_switch('command_snapshot', 1, $config['command_snapshot'], true);
$table->data[32][0] = __('Server logs directory').ui_print_help_tip(__('Directory where the server logs are stored.'), true);
$table->data[32][1] = html_print_input_text(
$table->data[$i][0] = __('Server logs directory').ui_print_help_tip(__('Directory where the server logs are stored.'), true);
$table->data[$i++][1] = html_print_input_text(
'server_log_dir',
$config['server_log_dir'],
'',
@ -236,8 +270,8 @@ $table->data[32][1] = html_print_input_text(
true
);
$table->data[33][0] = __('Log size limit in system logs viewer extension').ui_print_help_tip(__('Max size (in bytes) for the logs to be shown.'), true);
$table->data[33][1] = html_print_input_text(
$table->data[$i][0] = __('Log size limit in system logs viewer extension').ui_print_help_tip(__('Max size (in bytes) for the logs to be shown.'), true);
$table->data[$i++][1] = html_print_input_text(
'max_log_size',
$config['max_log_size'],
'',
@ -251,8 +285,8 @@ $modes_tutorial = [
'on_demand' => __('On demand'),
'expert' => __('Expert'),
];
$table->data['tutorial_mode'][0] = __('Tutorial mode').ui_print_help_tip(__("Configuration of our clippy, 'full mode' show the icon in the header and the contextual helps and it is noise, 'on demand' it is equal to full but it is not noise and 'expert' the icons in the header and the context is not."), true);
$table->data['tutorial_mode'][1] = html_print_select(
$table->data[$i][0] = __('Tutorial mode').ui_print_help_tip(__("Configuration of our clippy, 'full mode' show the icon in the header and the contextual helps and it is noise, 'on demand' it is equal to full but it is not noise and 'expert' the icons in the header and the context is not."), true);
$table->data[$i++][1] = html_print_select(
$modes_tutorial,
'tutorial_mode',
$config['tutorial_mode'],
@ -263,11 +297,11 @@ $table->data['tutorial_mode'][1] = html_print_select(
);
$config['past_planned_downtimes'] = isset($config['past_planned_downtimes']) ? $config['past_planned_downtimes'] : 1;
$table->data[34][0] = __('Allow create planned downtimes in the past').ui_print_help_tip(__('The planned downtimes created in the past will affect the SLA reports'), true);
$table->data[34][1] = html_print_checkbox_switch('past_planned_downtimes', 1, $config['past_planned_downtimes'], true);
$table->data[$i][0] = __('Allow create planned downtimes in the past').ui_print_help_tip(__('The planned downtimes created in the past will affect the SLA reports'), true);
$table->data[$i++][1] = html_print_checkbox_switch('past_planned_downtimes', 1, $config['past_planned_downtimes'], true);
$table->data[35][0] = __('Limit for bulk operations').ui_print_help_tip(__('Your PHP environment is set to 1000 max_input_vars. This parameter should have the same value or lower.', ini_get('max_input_vars')), true);
$table->data[35][1] = html_print_input_text(
$table->data[$i][0] = __('Limit for bulk operations').ui_print_help_tip(__('Your PHP environment is set to 1000 max_input_vars. This parameter should have the same value or lower.', ini_get('max_input_vars')), true);
$table->data[$i++][1] = html_print_input_text(
'limit_parameters_massive',
$config['limit_parameters_massive'],
'',
@ -276,17 +310,17 @@ $table->data[35][1] = html_print_input_text(
true
);
$table->data[36][0] = __('Include agents manually disabled');
$table->data[36][1] = html_print_checkbox_switch('include_agents', 1, $config['include_agents'], true);
$table->data[$i][0] = __('Include agents manually disabled');
$table->data[$i++][1] = html_print_checkbox_switch('include_agents', 1, $config['include_agents'], true);
$table->data[37][0] = __('Audit log directory').ui_print_help_tip(__('Directory where audit log is stored.'), true);
$table->data[37][1] = html_print_input_text('auditdir', io_safe_output($config['auditdir']), '', 30, 100, true);
$table->data[$i][0] = __('Audit log directory').ui_print_help_tip(__('Directory where audit log is stored.'), true);
$table->data[$i++][1] = html_print_input_text('auditdir', io_safe_output($config['auditdir']), '', 30, 100, true);
$table->data[38][0] = __('Set alias as name by default in agent creation');
$table->data[38][1] = html_print_checkbox_switch('alias_as_name', 1, $config['alias_as_name'], true);
$table->data[$i][0] = __('Set alias as name by default in agent creation');
$table->data[$i++][1] = html_print_checkbox_switch('alias_as_name', 1, $config['alias_as_name'], true);
$table->data[39][0] = __('Unique IP').ui_print_help_tip(__('Set the primary IP address as the unique IP, preventing the same primary IP address from being used in more than one agent'), true);
$table->data[39][1] = html_print_checkbox_switch('unique_ip', 1, $config['unique_ip'], true);
$table->data[$i][0] = __('Unique IP').ui_print_help_tip(__('Set the primary IP address as the unique IP, preventing the same primary IP address from being used in more than one agent'), true);
$table->data[$i++][1] = html_print_checkbox_switch('unique_ip', 1, $config['unique_ip'], true);
echo '<form id="form_setup" method="post" action="index.php?sec=gsetup&sec2=godmode/setup/setup&amp;section=general&amp;pure='.$config['pure'].'">';
@ -352,44 +386,50 @@ $(document).ready (function () {
});
if ($("input[name=use_cert]").is(':checked')) {
$('#setup_general-13').show();
$('#ssl-path-tr').show();
}
$("input[name=use_cert]").change(function () {
if( $(this).is(":checked") )
$('#setup_general-13').show();
$('#ssl-path-tr').show();
else
$('#setup_general-13').hide();
$('#ssl-path-tr').hide();
});
$("input[name=https]").change(function (){
if($("input[name=https]").prop('checked')) {
$("#dialog").css({'display': 'inline', 'font-weight': 'bold'}).dialog({
$("#dialog").dialog({
modal: true,
buttons:{
"<?php echo __('Close'); ?>": function(){
width: 500,
buttons:[
{
class: 'ui-widget ui-state-default ui-corner-all ui-button-text-only sub upd submit-next',
text: "<?php echo __('OK'); ?>",
click: function(){
$(this).dialog("close");
}
}
]
});
}
})
$("input[name=force_public_url]").change(function (){
if($("input[name=force_public_url]").prop('checked')) {
$("#force_public_url_dialog").dialog({
modal: true,
width: 500,
buttons: [
{
class: 'ui-widget ui-state-default ui-corner-all ui-button-text-only sub upd submit-next',
text: "<?php echo __('OK'); ?>",
click: function(){
$(this).dialog("close");
}
}
]
});
}
})
});
</script>
<?php
function get_sounds()
{
global $config;
$return = [];
$files = scandir($config['homedir'].'/include/sounds');
foreach ($files as $file) {
if (strstr($file, 'wav') !== false) {
$return['include/sounds/'.$file] = $file;
}
}
return $return;
}

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