Merge branch 'develop' into ent-4047-Simplificacion-de-la-configuracion-del-sistema-de-email

This commit is contained in:
alejandro-campos 2019-09-10 10:50:53 +02:00
commit 93b9c76f58
435 changed files with 23034 additions and 16669 deletions

View File

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

View File

@ -1,30 +1,30 @@
{ {
"name": "__MSG_name__", "name": "__MSG_name__",
"version": "2.1", "version": "2.2",
"manifest_version": 2, "manifest_version": 2,
"description": "Pandora FMS Event viewer Chrome extension", "description": "Pandora FMS Event viewer Chrome extension",
"homepage_url": "http://pandorafms.com", "homepage_url": "http://pandorafms.com",
"browser_action": { "browser_action": {
"default_title": "__MSG_default_title__", "default_title": "__MSG_default_title__",
"default_icon": "images/icon.png", "default_icon": "images/icon.png",
"default_popup": "popup.html" "default_popup": "popup.html"
}, },
"background": { "background": {
"page": "background.html" "page": "background.html"
}, },
"icons": { "icons": {
"128": "images/icon128.png", "128": "images/icon128.png",
"16": "images/icon16.png", "16": "images/icon16.png",
"32": "images/icon32.png", "32": "images/icon32.png",
"48": "images/icon48.png" "48": "images/icon48.png"
}, },
"options_page": "options.html", "options_page": "options.html",
"permissions": [ "permissions": [
"tabs", "tabs",
"notifications", "notifications",
"http://*/*", "http://*/*",
"https://*/*", "https://*/*",
"background" "background"
], ],
"default_locale": "en" "default_locale": "en"
} }

50
pandora_agents/Dockerfile Normal file
View File

@ -0,0 +1,50 @@
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 \
&& chmod +x pandora_agent_installer \
&& ./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 \
tail -f /var/log/pandora/pandora_agent.log' \
>> /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 # Base config file for Pandora FMS agents
# Version 7.0NG.735, AIX version # Version 7.0NG.738, AIX version
# Licensed under GPL license v2, # Licensed under GPL license v2,
# Copyright (c) 2003-2010 Artica Soluciones Tecnologicas # Copyright (c) 2003-2010 Artica Soluciones Tecnologicas
# http://www.pandorafms.com # http://www.pandorafms.com

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,6 +1,6 @@
# Base config file for Pandora FMS Windows Agent # Base config file for Pandora FMS Windows Agent
# (c) 2006-2010 Artica Soluciones Tecnologicas # (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 # This program is Free Software, you can redistribute it and/or modify it
# under the terms of the GNU General Public Licence as published by the Free Software # under the terms of the GNU General Public Licence as published by the Free Software

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -41,8 +41,8 @@ my $Sem = undef;
# Semaphore used to control the number of threads # Semaphore used to control the number of threads
my $ThreadSem = undef; my $ThreadSem = undef;
use constant AGENT_VERSION => '7.0NG.735'; use constant AGENT_VERSION => '7.0NG.738';
use constant AGENT_BUILD => '190605'; use constant AGENT_BUILD => '190906';
# Agent log default file size maximum and instances # Agent log default file size maximum and instances
use constant DEFAULT_MAX_LOG_SIZE => 600000; use constant DEFAULT_MAX_LOG_SIZE => 600000;
@ -3038,10 +3038,10 @@ while (1) {
my @address_list; my @address_list;
if( -x "/bin/ip" || -x "/sbin/ip" || -x "/usr/sbin/ip" ) { if( -x "/bin/ip" || -x "/sbin/ip" || -x "/usr/sbin/ip" ) {
@address_list = `ip addr show 2>$DevNull | sed -e '/127.0.0/d' -e '/[0-9]*\\.[0-9]*\\.[0-9]*/!d' -e 's/^[ \\t]*\\([^ \\t]*\\)[ \\t]*\\([^ \\t]*\\)[ \\t].*/\\2/' -e 's/\\/.*//'`; @address_list = `ip addr show 2>$DevNull | sed -e '/127.0.0/d' -e '/\\([0-9][0-9]*\\.\\)\\{3\\}[0-9][0-9]*/!d' -e 's/^[ \\t]*\\([^ \\t]*\\)[ \\t]*\\([^ \\t]*\\)[ \\t].*/\\2/' -e 's/\\/.*//'`;
} }
else { else {
@address_list = `ifconfig -a 2>$DevNull | sed -e '/127.0.0/d' -e '/[0-9]*\\.[0-9]*\\.[0-9]*/!d' -e 's/^[ \\t]*\\([^ \\t]*\\)[ \\t]*\\([^ \\t]*\\)[ \\t].*/\\2/' -e 's/.*://'`; @address_list = `ifconfig -a 2>$DevNull | sed -e '/127.0.0/d' -e '/\\([0-9][0-9]*\\.\\)\\{3\\}[0-9][0-9]*/!d' -e 's/^[ \\t]*\\([^ \\t]*\\)[ \\t]*\\([^ \\t]*\\)[ \\t].*/\\2/' -e 's/.*://'`;
} }
for (my $i = 0; $i <= $#address_list; $i++) { for (my $i = 0; $i <= $#address_list; $i++) {

View File

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

View File

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

View File

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

View File

@ -6,17 +6,17 @@
# #
# grep_log Perl script to search log files for a matching pattern. The last # grep_log Perl script to search log files for a matching pattern. The last
# searched position is saved in an index file so that consecutive # searched position is saved in an index file so that consecutive
# runs do not return the same results. The log file inode number is # runs do not return the same results. The log file inode number is
# also saved to detect log rotation. # also saved to detect log rotation.
# #
# This program is free software; you can redistribute it and/or modify # 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 # it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License. # the Free Software Foundation; version 2 of the License.
# #
# This program is distributed in the hope that it will be useful, # This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of # but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details. # GNU General Public License for more details.
# #
############################################################################### ###############################################################################
use strict; use strict;
@ -30,7 +30,7 @@ my $Output = 'module';
my $Verbose = 0; my $Verbose = 0;
# Index file storage directory, with a trailing '/' # Index file storage directory, with a trailing '/'
my $Idx_dir=($^O =~ /win/i)?'.\\':'/tmp/'; my $Idx_dir=($^O =~ /win/i)?"$ENV{'TMP'}\\":"/tmp/";
# Log file # Log file
my $Log_file = ''; my $Log_file = '';
@ -64,7 +64,7 @@ if ( (defined ($ENV{GREP_LOG_TMP})) && (-d $ENV{GREP_LOG_TMP}) ) {
} }
######################################################################################## ########################################################################################
# Erase blank spaces before and after the string # Erase blank spaces before and after the string
######################################################################################## ########################################################################################
sub trim($){ sub trim($){
my $string = shift; my $string = shift;
@ -226,7 +226,7 @@ sub parse_log (;$$) {
open(LOGFILE, $Log_file) || error_msg("Error opening file $Log_file: " . open(LOGFILE, $Log_file) || error_msg("Error opening file $Log_file: " .
$!); $!);
# Go to starting position. # Go to starting position.
seek(LOGFILE, $Idx_pos, 0); seek(LOGFILE, $Idx_pos, 0);
# Parse log file # Parse log file
@ -318,7 +318,7 @@ sub print_log ($) {
print_summary() if ($summary_flag == 1); print_summary() if ($summary_flag == 1);
return; return;
} }
# Log module # Log module
if ($Output eq 'log_module') { if ($Output eq 'log_module') {
my $output = "<log_module>\n"; my $output = "<log_module>\n";

View File

@ -1,6 +1,6 @@
# Base config file for Pandora FMS Windows Agent # Base config file for Pandora FMS Windows Agent
# (c) 2006-2017 Artica Soluciones Tecnologicas # (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 # This program is Free Software, you can redistribute it and/or modify it
# under the terms of the GNU General Public Licence as published by the Free Software # under the terms of the GNU General Public Licence as published by the Free Software

View File

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

View File

@ -1214,7 +1214,8 @@ Pandora_Module_Factory::getModuleFromDefinition (string definition) {
module_source, module_source,
module_eventtype, module_eventtype,
module_eventcode, module_eventcode,
module_pattern); module_pattern,
module_application);
} else if (module_wmiquery != "") { } else if (module_wmiquery != "") {
module = new Pandora_Module_WMIQuery (module_name, module = new Pandora_Module_WMIQuery (module_name,
module_wmiquery, module_wmicolumn); module_wmiquery, module_wmicolumn);

View File

@ -53,7 +53,7 @@ static EvtUpdateBookmarkT EvtUpdateBookmarkF = NULL;
* @param name Module name. * @param name Module name.
* @param service_name Service internal name to check. * @param service_name Service internal name to check.
*/ */
Pandora_Module_Logchannel::Pandora_Module_Logchannel (string name, string source, string type, string id, string pattern) Pandora_Module_Logchannel::Pandora_Module_Logchannel (string name, string source, string type, string id, string pattern, string application)
: Pandora_Module (name) { : Pandora_Module (name) {
int i; int i;
vector<wstring> query; vector<wstring> query;
@ -93,6 +93,13 @@ Pandora_Module_Logchannel::Pandora_Module_Logchannel (string name, string source
query.push_back(ss.str()); query.push_back(ss.str());
} }
// Set the application
if (application != "") {
wstringstream ss;
ss << L"*[System/Provider[@Name='" << application.c_str() << L"']]";
query.push_back(ss.str());
}
// Fill the filter // Fill the filter
if (query.size() == 0) { if (query.size() == 0) {
this->filter = L"*"; this->filter = L"*";
@ -579,4 +586,4 @@ Pandora_Module_Logchannel::GetMessageString(EVT_HANDLE hMetadata, EVT_HANDLE hEv
} }
return pBuffer; return pBuffer;
} }

View File

@ -75,7 +75,7 @@ namespace Pandora_Modules {
LPWSTR GetMessageString(EVT_HANDLE hMetadata, EVT_HANDLE hEvent, EVT_FORMAT_MESSAGE_FLAGS FormatId); LPWSTR GetMessageString(EVT_HANDLE hMetadata, EVT_HANDLE hEvent, EVT_FORMAT_MESSAGE_FLAGS FormatId);
public: public:
Pandora_Module_Logchannel (string name, string source, string type, string id, string pattern); Pandora_Module_Logchannel (string name, string source, string type, string id, string pattern, string application);
void run (); void run ();
}; };
} }

View File

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

View File

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

View File

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

View File

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

View File

@ -1,17 +1,34 @@
<?php <?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__')) { if (!defined('__PAN_XHPROF__')) {
define('__PAN_XHPROF__', 0); define('__PAN_XHPROF__', 0);
} }
@ -56,7 +73,7 @@ if (isset($_GET['loginhash'])) {
$public_hash = get_parameter('hash', false); $public_hash = get_parameter('hash', false);
// Check user // Check user.
if ($public_hash == false) { if ($public_hash == false) {
check_login(); check_login();
} else { } else {
@ -68,9 +85,9 @@ if ($public_hash == false) {
} }
} }
define('AJAX', true);
// Enterprise support
// Enterprise support.
if (file_exists(ENTERPRISE_DIR.'/load_enterprise.php')) { if (file_exists(ENTERPRISE_DIR.'/load_enterprise.php')) {
include_once 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']]); $config['relative_path'] = enterprise_hook('skins_set_image_skin_path', [$config['id_user']]);
} }
if (isset($config['metaconsole'])) { if (is_metaconsole()) {
// Not cool way of know if we are executing from metaconsole or normal console // Backward compatibility.
if ($config['metaconsole']) { define('METACONSOLE', true);
define('METACONSOLE', true);
}
} }
if (file_exists($page)) { if (file_exists($page)) {

View File

@ -1,23 +1,24 @@
<?php <?php
/**
* 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.
*/
// 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.
$refr = (int) get_parameter('refresh', 0);
// By default 30 seconds
function mainAgentsModules() function mainAgentsModules()
{ {
global $config; global $config;
// Load global vars // Load global vars.
include_once 'include/config.php'; include_once 'include/config.php';
include_once 'include/functions_reporting.php'; include_once 'include/functions_reporting.php';
include_once $config['homedir'].'/include/functions_agents.php'; include_once $config['homedir'].'/include/functions_agents.php';
@ -25,7 +26,7 @@ function mainAgentsModules()
include_once $config['homedir'].'/include/functions_users.php'; include_once $config['homedir'].'/include/functions_users.php';
check_login(); check_login();
// ACL Check // ACL Check.
if (! check_acl($config['id_user'], 0, 'AR')) { if (! check_acl($config['id_user'], 0, 'AR')) {
db_pandora_audit( db_pandora_audit(
'ACL Violation', 'ACL Violation',
@ -37,7 +38,7 @@ function mainAgentsModules()
// Update network modules for this group // Update network modules for this group
// Check for Network FLAG change request // Check for Network FLAG change request
// Made it a subquery, much faster on both the database and server side // Made it a subquery, much faster on both the database and server side.
if (isset($_GET['update_netgroup'])) { if (isset($_GET['update_netgroup'])) {
$group = get_parameter_get('update_netgroup', 0); $group = get_parameter_get('update_netgroup', 0);
if (check_acl($config['id_user'], $group, 'AW')) { if (check_acl($config['id_user'], $group, 'AW')) {
@ -62,7 +63,7 @@ function mainAgentsModules()
$modulegroup = get_parameter('modulegroup', 0); $modulegroup = get_parameter('modulegroup', 0);
$refr = (int) get_parameter('refresh', 0); $refr = (int) get_parameter('refresh', 0);
// By default 30 seconds // By default 30 seconds.
$recursion = get_parameter('recursion', 0); $recursion = get_parameter('recursion', 0);
$group_id = (int) get_parameter('group_id', 0); $group_id = (int) get_parameter('group_id', 0);
$offset = (int) get_parameter('offset', 0); $offset = (int) get_parameter('offset', 0);
@ -79,7 +80,8 @@ function mainAgentsModules()
$full_modules_selected = explode(';', get_parameter('full_modules_selected', 0)); $full_modules_selected = explode(';', get_parameter('full_modules_selected', 0));
$full_agents_id = explode(';', get_parameter('full_agents_id', 0)); $full_agents_id = explode(';', get_parameter('full_agents_id', 0));
if ($save_serialize && $update_item == '') { // In full screen there is no pagination neither filters.
if (( ($config['pure'] == 0 && $save_serialize) && $update_item == '' ) || ( ($config['pure'] == 1 && $save_serialize == 0) && $update_item == '' )) {
$unserialize_modules_selected = unserialize_in_temp($config['id_user'].'_agent_module', true, 1); $unserialize_modules_selected = unserialize_in_temp($config['id_user'].'_agent_module', true, 1);
$unserialize_agents_id = unserialize_in_temp($config['id_user'].'_agents', true, 1); $unserialize_agents_id = unserialize_in_temp($config['id_user'].'_agents', true, 1);
if ($unserialize_modules_selected) { if ($unserialize_modules_selected) {
@ -102,7 +104,6 @@ function mainAgentsModules()
serialize_in_temp($agents_id, $config['id_user'].'_agents', 1); serialize_in_temp($agents_id, $config['id_user'].'_agents', 1);
} }
// if($agents_id != -1) $agents_id = null;
if ($config['pure'] == 0) { if ($config['pure'] == 0) {
if ($modules_selected[0] && $agents_id[0]) { if ($modules_selected[0] && $agents_id[0]) {
$full_modules = urlencode(implode(';', $modules_selected)); $full_modules = urlencode(implode(';', $modules_selected));
@ -124,13 +125,13 @@ function mainAgentsModules()
} }
} }
// groups // Groups.
$filter_groups_label = '<b>'.__('Group').'</b>'; $filter_groups_label = '<b>'.__('Group').'</b>';
$filter_groups = html_print_select_groups(false, 'AR', true, 'group_id', $group_id, '', '', '', true, false, true, '', false, 'width: auto;'); $filter_groups = html_print_select_groups(false, 'AR', true, 'group_id', $group_id, '', '', '', true, false, true, '', false, 'width: auto;');
$filter_recursion_label = '<b>'.__('Recursion').'</b>'; $filter_recursion_label = '<b>'.__('Recursion').'</b>';
$filter_recursion = html_print_checkbox('recursion', 1, 0, true); $filter_recursion = html_print_checkbox('recursion', 1, 0, true);
// groups module // Groups module.
$filter_module_groups_label = '<b>'.__('Module group').'</b>'; $filter_module_groups_label = '<b>'.__('Module group').'</b>';
$filter_module_groups = html_print_select_from_sql( $filter_module_groups = html_print_select_from_sql(
'SELECT * FROM tmodule_group ORDER BY name', 'SELECT * FROM tmodule_group ORDER BY name',
@ -146,7 +147,7 @@ function mainAgentsModules()
'width: auto;' 'width: auto;'
); );
// agent // Agent.
$agents = agents_get_group_agents($group_id); $agents = agents_get_group_agents($group_id);
if ((empty($agents)) || $agents == -1) { if ((empty($agents)) || $agents == -1) {
$agents = []; $agents = [];
@ -155,7 +156,7 @@ function mainAgentsModules()
$filter_agents_label = '<b>'.__('Agents').'</b>'; $filter_agents_label = '<b>'.__('Agents').'</b>';
$filter_agents = html_print_select($agents, 'id_agents2[]', $agents_id, '', '', 0, true, true, true, '', false, 'min-width: 180px; max-width: 200px;'); $filter_agents = html_print_select($agents, 'id_agents2[]', $agents_id, '', '', 0, true, true, true, '', false, 'min-width: 180px; max-width: 200px;');
// type show // Type show.
$selection = [ $selection = [
0 => __('Show common modules'), 0 => __('Show common modules'),
1 => __('Show all modules'), 1 => __('Show all modules'),
@ -163,12 +164,12 @@ function mainAgentsModules()
$filter_type_show_label = '<b>'.__('Show common modules').'</b>'; $filter_type_show_label = '<b>'.__('Show common modules').'</b>';
$filter_type_show = html_print_select($selection, 'selection_agent_module', $selection_a_m, '', '', 0, true, false, true, '', false, 'min-width: 180px;'); $filter_type_show = html_print_select($selection, 'selection_agent_module', $selection_a_m, '', '', 0, true, false, true, '', false, 'min-width: 180px;');
// modules // Modules.
$all_modules = select_modules_for_agent_group($group_id, $agents_id, $selection_a_m, false); $all_modules = select_modules_for_agent_group($group_id, $agents_id, $selection_a_m, false);
$filter_modules_label = '<b>'.__('Module').'</b>'; $filter_modules_label = '<b>'.__('Module').'</b>';
$filter_modules = html_print_select($all_modules, 'module[]', $modules_selected, '', '', 0, true, true, false, '', false, 'min-width: 180px; max-width: 200px;'); $filter_modules = html_print_select($all_modules, 'module[]', $modules_selected, '', '', 0, true, true, false, '', false, 'min-width: 180px; max-width: 200px;');
// update // Update.
$filter_update = html_print_submit_button(__('Update item'), 'edit_item', false, 'class="sub upd"', true); $filter_update = html_print_submit_button(__('Update item'), 'edit_item', false, 'class="sub upd"', true);
$onheader = [ $onheader = [
@ -178,8 +179,11 @@ function mainAgentsModules()
'combo_groups' => $filter_groups, 'combo_groups' => $filter_groups,
]; ];
// Old style table, we need a lot of special formatting,don't use table function /*
// Prepare old-style table * Old style table, we need a lot of special formatting,don't use table function.
* Prepare old-style table.
*/
if ($config['pure'] == 0) { if ($config['pure'] == 0) {
// Header. // Header.
ui_print_page_header( ui_print_page_header(
@ -200,38 +204,51 @@ function mainAgentsModules()
$full_modules = urlencode(implode(';', $full_modules_selected)); $full_modules = urlencode(implode(';', $full_modules_selected));
$full_agents = urlencode(implode(';', $full_agents_id)); $full_agents = urlencode(implode(';', $full_agents_id));
$url = " index.php?sec=view&sec2=extensions/agents_modules&amp;pure=0&amp;offset=$offset $url = 'index.php?sec=view&sec2=extensions/agents_modules&amp;pure=0&amp;offset=$offset
&group_id=$group_id&modulegroup=$modulegroup&refresh=$refr&full_modules_selected=$full_modules &group_id=$group_id&modulegroup=$modulegroup&refresh=$refr&full_modules_selected=$full_modules
&full_agents_id=$full_agents&selection_agent_module=$selection_a_m"; &full_agents_id=$full_agents&selection_agent_module=$selection_a_m';
} else { } else {
$url = " index.php?sec=view&sec2=extensions/agents_modules&amp;pure=0&amp;offset=$offset&group_id=$group_id&modulegroup=$modulegroup&refresh=$refr"; $url = 'index.php?sec=view&sec2=extensions/agents_modules&amp;pure=0&amp;offset=$offset&group_id=$group_id&modulegroup=$modulegroup&refresh=$refr';
} }
// Floating menu - Start // Floating menu - Start.
echo '<div id="vc-controls" style="z-index: 999">'; echo '<div id="vc-controls" style="z-index: 999">';
echo '<div id="menu_tab">'; echo '<div id="menu_tab">';
echo '<ul class="mn">'; echo '<ul class="mn">';
// Quit fullscreen // Quit fullscreen.
echo '<li class="nomn">'; echo '<li class="nomn">';
echo '<a target="_top" href="'.$url.'">'; echo '<a target="_top" href="'.$url.'">';
echo html_print_image('images/normal_screen.png', true, ['title' => __('Back to normal mode')]); echo html_print_image('images/normal_screen.png', true, ['title' => __('Back to normal mode')]);
echo '</a>'; echo '</a>';
echo '</li>'; echo '</li>';
// Countdown // Countdown.
echo '<li class="nomn">'; echo '<li class="nomn">';
echo '<div class="vc-refr">'; echo '<div class="vc-refr">';
echo '<div class="vc-countdown"></div>'; echo '<div class="vc-countdown style="display: inline;"></div>';
echo '<div id="vc-refr-form">'; echo '<div id="vc-refr-form">';
echo __('Refresh').':'; echo __('Refresh').':';
echo html_print_select(get_refresh_time_array(), 'refresh', $refr, '', '', 0, true, false, false); echo html_print_select(
get_refresh_time_array(),
'refresh',
$refr,
'',
'',
0,
true,
false,
false,
'',
false,
'margin-top: 3px;'
);
echo '</div>'; echo '</div>';
echo '</div>'; echo '</div>';
echo '</li>'; echo '</li>';
// Console name // Console name.
echo '<li class="nomn">'; echo '<li class="nomn">';
echo '<div class="vc-title">'.__('Agent/module view').'</div>'; echo '<div class="vc-title">'.__('Agent/module view').'</div>';
echo '</li>'; echo '</li>';
@ -240,35 +257,35 @@ function mainAgentsModules()
echo '</div>'; echo '</div>';
echo '</div>'; echo '</div>';
// Floating menu - End // Floating menu - End.
ui_require_jquery_file('countdown'); ui_require_jquery_file('countdown');
} }
if ($config['pure'] != 1) { if ($config['pure'] != 1) {
echo '<form method="post" action="'.ui_get_url_refresh(['offset' => $offset, 'hor_offset' => $offset, 'group_id' => $group_id, 'modulegroup' => $modulegroup]).'">'; $show_filters = '<form method="post" action="'.ui_get_url_refresh(['offset' => $offset, 'hor_offset' => $offset, 'group_id' => $group_id, 'modulegroup' => $modulegroup]).'" style="width:100%;">';
$show_filters .= '<table class="white_table" cellpadding="0" cellspacing="0" border="0" style="width:100%; border:none;">';
echo '<table class="databox filters" cellpadding="0" cellspacing="0" border="0" style="width:100%;">'; $show_filters .= '<tr>';
echo '<tr>'; $show_filters .= '<td>'.$filter_groups_label.'</td>';
echo '<td>'.$filter_groups_label.'</td>'; $show_filters .= '<td>'.$filter_groups.'&nbsp;&nbsp;&nbsp;'.$filter_recursion_label.$filter_recursion.'</td>';
echo '<td>'.$filter_groups.'&nbsp;&nbsp;&nbsp;'.$filter_recursion_label.$filter_recursion.'</td>'; $show_filters .= '<td></td>';
echo '<td></td>'; $show_filters .= '<td></td>';
echo '<td></td>'; $show_filters .= '<td>'.$filter_module_groups_label.'</td>';
echo '<td>'.$filter_module_groups_label.'</td>'; $show_filters .= '<td>'.$filter_module_groups.'</td>';
echo '<td>'.$filter_module_groups.'</td>'; $show_filters .= '</tr>';
echo '</tr>'; $show_filters .= '<tr>';
echo '<tr>'; $show_filters .= '<td>'.$filter_agents_label.'</td>';
echo '<td>'.$filter_agents_label.'</td>'; $show_filters .= '<td>'.$filter_agents.'</td>';
echo '<td>'.$filter_agents.'</td>'; $show_filters .= '<td>'.$filter_type_show_label.'</td>';
echo '<td>'.$filter_type_show_label.'</td>'; $show_filters .= '<td>'.$filter_type_show.'</td>';
echo '<td>'.$filter_type_show.'</td>'; $show_filters .= '<td>'.$filter_modules_label.'</td>';
echo '<td>'.$filter_modules_label.'</td>'; $show_filters .= '<td>'.$filter_modules.'</td>';
echo '<td>'.$filter_modules.'</td>'; $show_filters .= '</tr>';
echo '</tr>'; $show_filters .= '<tr>';
echo '<tr>'; $show_filters .= "<td colspan=6 ><span style='float: right; padding-right: 20px;'>".$filter_update.'</sapn></td>';
echo "<td colspan=6 ><span style='float: right; padding-right: 20px;'>".$filter_update.'</sapn></td>'; $show_filters .= '</tr>';
echo '</tr>'; $show_filters .= '</table>';
echo '</table>'; $show_filters .= '</form>';
echo '</form>'; ui_toggle($show_filters, __('Filters'));
} }
if ($agents_id[0] != -1) { if ($agents_id[0] != -1) {
@ -291,7 +308,7 @@ function mainAgentsModules()
$count = 0; $count = 0;
foreach ($agents as $agent) { foreach ($agents as $agent) {
// TODO TAGS agents_get_modules // TODO TAGS agents_get_modules.
$module = agents_get_modules( $module = agents_get_modules(
$agent, $agent,
false, false,
@ -339,7 +356,7 @@ function mainAgentsModules()
} }
} }
} else { } else {
// TODO TAGS agents_get_modules // TODO TAGS agents_get_modules.
$all_modules = agents_get_modules( $all_modules = agents_get_modules(
$agents, $agents,
false, false,
@ -414,11 +431,11 @@ function mainAgentsModules()
if ($hor_offset > 0) { if ($hor_offset > 0) {
$new_hor_offset = ($hor_offset - $block); $new_hor_offset = ($hor_offset - $block);
echo "<th width='20px' "."style='vertical-align:top; padding-top: 35px;' "."rowspan='".($nagents + 1)."'>"."<a href='index.php?".'extension_in_menu=estado&'.'sec=extensions&'.'sec2=extensions/agents_modules&'.'refr=0&'.'save_serialize=1&'.'selection_a_m='.$selection_a_m.'&'.'hor_offset='.$new_hor_offset.'&'.'offset='.$offset."'>".html_print_image( echo "<th width='20px' style='vertical-align: middle; text-align: center;' rowspan='".($nagents + 1)."'><a href='index.php?".'extension_in_menu=estado&sec=extensions&sec2=extensions/agents_modules&refr=0&save_serialize=1&selection_a_m='.$selection_a_m.'&hor_offset='.$new_hor_offset.'&offset='.$offset."'>".html_print_image(
'images/arrow_left.png', 'images/arrow_left_green.png',
true, true,
['title' => __('Previous modules')] ['title' => __('Previous modules')]
).'</a>'.'</th>'; ).'</a></th>';
} }
$nmodules = 0; $nmodules = 0;
@ -440,11 +457,11 @@ function mainAgentsModules()
if (($hor_offset + $block) < $nmodules) { if (($hor_offset + $block) < $nmodules) {
$new_hor_offset = ($hor_offset + $block); $new_hor_offset = ($hor_offset + $block);
echo "<th width='20px' "."style='vertical-align:top; padding-top: 35px;' "."rowspan='".($nagents + 1)."'>"."<a href='index.php?".'extension_in_menu=estado&'.'sec=extensions&'.'sec2=extensions/agents_modules&'.'save_serialize=1&'.'selection_a_m='.$selection_a_m.'&'.'hor_offset='.$new_hor_offset.'&'.'offset='.$offset."'>".html_print_image( echo "<th width='20px' style='vertical-align: middle; text-align: center;' rowspan='".($nagents + 1)."'><a href='index.php?".'extension_in_menu=estado&sec=extensions&sec2=extensions/agents_modules&save_serialize=1&selection_a_m='.$selection_a_m.'&hor_offset='.$new_hor_offset.'&offset='.$offset."'>".html_print_image(
'images/arrow.png', 'images/arrow_right_green.png',
true, true,
['title' => __('More modules')] ['title' => __('More modules')]
).'</a>'.'</th>'; ).'</a></th>';
} }
echo '</tr>'; echo '</tr>';
@ -457,12 +474,12 @@ function mainAgentsModules()
$filter_agents['id_grupo'] = $group_id; $filter_agents['id_grupo'] = $group_id;
} }
// Prepare pagination // Prepare pagination.
$url = 'index.php?extension_in_menu=estado&sec=extensions&sec2=extensions/agents_modules&save_serialize=1&'.'hor_offset='.$hor_offset.'&selection_a_m='.$selection_a_m; $url = 'index.php?extension_in_menu=estado&sec=extensions&sec2=extensions/agents_modules&save_serialize=1&hor_offset='.$hor_offset.'&selection_a_m='.$selection_a_m;
ui_pagination($total_pagination, $url); ui_pagination($total_pagination, $url);
foreach ($agents as $agent) { foreach ($agents as $agent) {
// Get stats for this group // Get stats for this group.
$agent_status = agents_get_status($agent['id_agente']); $agent_status = agents_get_status($agent['id_agente']);
$alias = db_get_row('tagente', 'id_agente', $agent['id_agente']); $alias = db_get_row('tagente', 'id_agente', $agent['id_agente']);
if (empty($alias['alias'])) { if (empty($alias['alias'])) {
@ -471,29 +488,29 @@ function mainAgentsModules()
switch ($agent_status) { switch ($agent_status) {
case 4: case 4:
// Alert fired status // Alert fired status.
$rowcolor = 'group_view_alrm'; $rowcolor = 'group_view_alrm';
break; break;
case 1: case 1:
// Critical status // Critical status.
$rowcolor = 'group_view_crit'; $rowcolor = 'group_view_crit';
break; break;
case 2: case 2:
// Warning status // Warning status.
$rowcolor = 'group_view_warn'; $rowcolor = 'group_view_warn';
break; break;
case 0: case 0:
// Normal status // Normal status.
$rowcolor = 'group_view_ok'; $rowcolor = 'group_view_ok';
break; break;
case 3: case 3:
case -1: case -1:
default: default:
// Unknown status // Unknown status.
$rowcolor = 'group_view_unk'; $rowcolor = 'group_view_unk';
break; break;
} }
@ -502,7 +519,7 @@ function mainAgentsModules()
echo "<td class='$rowcolor'> echo "<td class='$rowcolor'>
<a class='$rowcolor' href='index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=".$agent['id_agente']."'>".$alias['alias'].'</a></td>'; <a class='$rowcolor' href='index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=".$agent['id_agente']."'>".$alias['alias'].'</a></td>';
// TODO TAGS agents_get_modules // TODO TAGS agents_get_modules.
$agent_modules = agents_get_modules($agent['id_agente'], false, $filter_module_group, true, true); $agent_modules = agents_get_modules($agent['id_agente'], false, $filter_module_group, true, true);
$nmodules = 0; $nmodules = 0;
@ -572,18 +589,23 @@ function mainAgentsModules()
echo '</table>'; echo '</table>';
echo "<div class='legend_basic' style='width: 96%'>"; $show_legend = "<div class='legend_white'>";
$show_legend .= "<div style='display: flex;align-items: center;'>
<div class='legend_square_simple'><div style='background-color: ".COL_ALERTFIRED.";'></div></div>".__('Orange cell when the module has fired alerts').'</div>';
$show_legend .= "<div style='display: flex;align-items: center;'>
<div class='legend_square_simple'><div style='background-color: ".COL_CRITICAL.";'></div></div>".__('Red cell when the module has a critical status').'
</div>';
$show_legend .= "<div style='display: flex;align-items: center;'>
<div class='legend_square_simple'><div style='background-color: ".COL_WARNING.";'></div></div>".__('Yellow cell when the module has a warning status').'</div>';
$show_legend .= "<div style='display: flex;align-items: center;'>
<div class='legend_square_simple'><div style='background-color: ".COL_NORMAL.";'></div></div>".__('Green cell when the module has a normal status').'</div>';
$show_legend .= "<div style='display: flex;align-items: center;'>
<div class='legend_square_simple'><div style='background-color: ".COL_UNKNOWN.";'></div></div>".__('Grey cell when the module has an unknown status').'</div>';
$show_legend .= "<div style='display: flex;align-items: center;'>
<div class='legend_square_simple'><div style='background-color: ".COL_NOTINIT.";'></div></div>".__("Cell turns blue when the module is in 'not initialize' status").'</div>';
$show_legend .= '</div>';
ui_toggle($show_legend, __('Legend'));
echo '<table>';
echo "<tr><td colspan='2' style='padding-bottom: 10px;'><b>".__('Legend').'</b></td></tr>';
echo "<tr><td class='legend_square_simple'><div style='background-color: ".COL_ALERTFIRED.";'></div></td><td>".__('Orange cell when the module has fired alerts').'</td></tr>';
echo "<tr><td class='legend_square_simple'><div style='background-color: ".COL_CRITICAL.";'></div></td><td>".__('Red cell when the module has a critical status').'</td></tr>';
echo "<tr><td class='legend_square_simple'><div style='background-color: ".COL_WARNING.";'></div></td><td>".__('Yellow cell when the module has a warning status').'</td></tr>';
echo "<tr><td class='legend_square_simple'><div style='background-color: ".COL_NORMAL.";'></div></td><td>".__('Green cell when the module has a normal status').'</td></tr>';
echo "<tr><td class='legend_square_simple'><div style='background-color: ".COL_UNKNOWN.";'></div></td><td>".__('Grey cell when the module has an unknown status').'</td></tr>';
echo "<tr><td class='legend_square_simple'><div style='background-color: ".COL_NOTINIT.";'></div></td><td>".__("Cell turns blue when the module is in 'not initialize' status").'</td></tr>';
echo '</table>';
echo '</div>';
$pure_var = $config['pure']; $pure_var = $config['pure'];
if ($pure_var) { if ($pure_var) {
$pure_var = 1; $pure_var = 1;
@ -627,16 +649,14 @@ $ignored_params['refresh'] = '';
$.each($('.th_class_module_r'), function (i, elem) { $.each($('.th_class_module_r'), function (i, elem) {
id = $(elem).attr('id').replace('th_module_r_', ''); id = $(elem).attr('id').replace('th_module_r_', '');
$("#th_module_r_" + id).height(($("#div_module_r_" + id).width() + 10) + 'px'); $("#th_module_r_" + id).height(($("#div_module_r_" + id).width() + 10) + 'px');
//$("#div_module_r_" + id).css('margin-top', (max_width - $("#div_module_r_" + id).width()) + 'px');
$("#div_module_r_" + id).css('margin-top', (max_width - 20) + 'px'); $("#div_module_r_" + id).css('margin-top', (max_width - 20) + 'px');
$("#div_module_r_" + id).show(); $("#div_module_r_" + id).show();
}); });
var refr =" . $refr . "; var refr = '<?php echo get_parameter('refresh', 0); ?>';
var pure =" . $pure_var . "; var pure = '<?php echo get_parameter('pure', 0); ?>';
var href ='" . ui_get_url_refresh ($ignored_params) . "'; var href =' <?php echo ui_get_url_refresh($ignored_params); ?>';
if (pure) { if (pure) {
var startCountDown = function (duration, cb) { var startCountDown = function (duration, cb) {
$('div.vc-countdown').countdown('destroy'); $('div.vc-countdown').countdown('destroy');
@ -646,7 +666,7 @@ $ignored_params['refresh'] = '';
$('div.vc-countdown').countdown({ $('div.vc-countdown').countdown({
until: t, until: t,
format: 'MS', format: 'MS',
layout: '(%M%nn%M:%S%nn%S Until refresh)', layout: '(%M%nn%M:%S%nn%S <?php echo __('Until next'); ?>) ',
alwaysExpire: true, alwaysExpire: true,
onExpiry: function () { onExpiry: function () {
$('div.vc-countdown').countdown('destroy'); $('div.vc-countdown').countdown('destroy');
@ -655,8 +675,11 @@ $ignored_params['refresh'] = '';
} }
}); });
} }
startCountDown(refr, false); if(refr>0){
startCountDown(refr, false);
}
var controls = document.getElementById('vc-controls'); var controls = document.getElementById('vc-controls');
autoHideElement(controls, 1000); autoHideElement(controls, 1000);

View File

@ -69,7 +69,7 @@ function extension_db_status()
echo "<div style='text-align: right;'>"; echo "<div style='text-align: right;'>";
html_print_input_hidden('db_status_execute', 1); 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 '</div>';
echo '</form>'; echo '</form>';
@ -215,7 +215,7 @@ function extension_db_check_tables_differences(
$diff_tables = array_diff($tables_test, $tables_system); $diff_tables = array_diff($tables_test, $tables_system);
ui_print_result_message( ui_print_result_message(
!empty($diff_tables), empty($diff_tables),
__('Success! %s DB contains all tables', get_product_name()), __('Success! %s DB contains all tables', get_product_name()),
__( __(
'%s DB could not retrieve all tables. The missing tables are (%s)', '%s DB could not retrieve all tables. The missing tables are (%s)',

View File

@ -1,17 +1,32 @@
<?php <?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 // Begin.
// ==================================================
// 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
global $config; global $config;
check_login(); check_login();
@ -32,10 +47,12 @@ if (is_ajax()) {
} }
/** /**
* The main function of module groups and the enter point to * The main function of module groups and the enter point to
* execute the code. * execute the code.
*/ *
* @return void
*/
function mainModuleGroups() function mainModuleGroups()
{ {
global $config; global $config;
@ -68,13 +85,20 @@ function mainModuleGroups()
$info = array_filter( $info = array_filter(
$info, $info,
function ($v, $k) use ($agent_group_search) { 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 ARRAY_FILTER_USE_BOTH
); );
if (!empty($info)) { 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( $agents_counters = array_reduce(
$groups_view, $groups_view,
function ($carry, $item) { function ($carry, $item) {
@ -113,7 +137,7 @@ function mainModuleGroups()
$array_module_group = array_filter( $array_module_group = array_filter(
$array_module_group, $array_module_group,
function ($v, $k) use ($module_group_search) { 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 ARRAY_FILTER_USE_BOTH
); );
@ -125,66 +149,75 @@ function mainModuleGroups()
$array_for_defect[$key]['data']['icon'] = $value['icon']; $array_for_defect[$key]['data']['icon'] = $value['icon'];
} }
$sql = "SELECT SUM(IF(tae.alert_fired <> 0, 1, 0)) AS alerts_module_count, $sql = sprintf(
SUM(IF($condition_warning, 1, 0)) AS warning_module_count, "SELECT SUM(IF(tae.alert_fired <> 0, 1, 0)) AS alerts_module_count,
SUM(IF($condition_unknown, 1, 0)) AS unknown_module_count, SUM(IF(%s, 1, 0)) AS warning_module_count,
SUM(IF($condition_not_init, 1, 0)) AS notInit_module_count, SUM(IF(%s, 1, 0)) AS unknown_module_count,
SUM(IF($condition_critical, 1, 0)) AS critical_module_count, SUM(IF(%s, 1, 0)) AS notInit_module_count,
SUM(IF($condition_normal, 1, 0)) AS normal_module_count, SUM(IF(%s, 1, 0)) AS critical_module_count,
COUNT(tae.id_agente_modulo) AS total_count, SUM(IF(%s, 1, 0)) AS normal_module_count,
tmg.id_mg, COUNT(tae.id_agente_modulo) AS total_count,
tmg.name as n, tmg.id_mg,
tg.id_grupo tmg.name as n,
FROM ( tg.id_grupo
SELECT tam.id_agente_modulo, FROM (
tam.id_module_group, SELECT tam.id_agente_modulo,
ta.id_grupo AS g, tam.id_module_group,
tae.estado, ta.id_grupo AS g,
SUM(IF(tatm.last_fired <> 0, 1, 0)) AS alert_fired tae.estado,
FROM tagente_modulo tam SUM(IF(tatm.last_fired <> 0, 1, 0)) AS alert_fired
LEFT JOIN talert_template_modules tatm FROM tagente_modulo tam
ON tatm.id_agent_module = tam.id_agente_modulo LEFT JOIN talert_template_modules tatm
AND tatm.times_fired = 1 ON tatm.id_agent_module = tam.id_agente_modulo
LEFT JOIN tagente_estado tae AND tatm.times_fired = 1
ON tae.id_agente_modulo = tam.id_agente_modulo LEFT JOIN tagente_estado tae
INNER JOIN tagente ta ON tae.id_agente_modulo = tam.id_agente_modulo
ON ta.id_agente = tam.id_agente INNER JOIN tagente ta
WHERE ta.disabled = 0 ON ta.id_agente = tam.id_agente
AND tam.disabled = 0 WHERE ta.disabled = 0
AND tam.delete_pending = 0 AND tam.disabled = 0
AND ta.id_grupo IN ($ids_group) AND tam.delete_pending = 0
GROUP BY tam.id_agente_modulo AND ta.id_grupo IN (%s)
UNION ALL GROUP BY tam.id_agente_modulo
SELECT tam.id_agente_modulo, UNION ALL
tam.id_module_group, SELECT tam.id_agente_modulo,
tasg.id_group AS g, tam.id_module_group,
tae.estado, tasg.id_group AS g,
SUM(IF(tatm.last_fired <> 0, 1, 0)) AS alert_fired tae.estado,
FROM tagente_modulo tam SUM(IF(tatm.last_fired <> 0, 1, 0)) AS alert_fired
LEFT JOIN talert_template_modules tatm FROM tagente_modulo tam
ON tatm.id_agent_module = tam.id_agente_modulo LEFT JOIN talert_template_modules tatm
AND tatm.times_fired = 1 ON tatm.id_agent_module = tam.id_agente_modulo
LEFT JOIN tagente_estado tae AND tatm.times_fired = 1
ON tae.id_agente_modulo = tam.id_agente_modulo LEFT JOIN tagente_estado tae
INNER JOIN tagente ta ON tae.id_agente_modulo = tam.id_agente_modulo
ON ta.id_agente = tam.id_agente INNER JOIN tagente ta
INNER JOIN tagent_secondary_group tasg ON ta.id_agente = tam.id_agente
ON ta.id_agente = tasg.id_agent INNER JOIN tagent_secondary_group tasg
WHERE ta.disabled = 0 ON ta.id_agente = tasg.id_agent
AND tam.disabled = 0 WHERE ta.disabled = 0
AND tam.delete_pending = 0 AND tam.disabled = 0
AND tasg.id_group IN ($ids_group) AND tam.delete_pending = 0
GROUP BY tam.id_agente_modulo, tasg.id_group AND tasg.id_group IN (%s)
) AS tae GROUP BY tam.id_agente_modulo, tasg.id_group
RIGHT JOIN tgrupo tg ) AS tae
ON tg.id_grupo = tae.g RIGHT JOIN tgrupo tg
INNER JOIN ( ON tg.id_grupo = tae.g
SELECT * FROM tmodule_group INNER JOIN (
UNION ALL SELECT * FROM tmodule_group
SELECT 0 AS 'id_mg', 'Nothing' AS 'name' UNION ALL
) AS tmg SELECT 0 AS 'id_mg', 'Nothing' AS 'name'
ON tae.id_module_group = tmg.id_mg ) AS tmg
GROUP BY tae.g, tmg.id_mg"; ON tae.id_module_group = 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); $array_data_prev = db_get_all_rows_sql($sql);
@ -220,11 +253,29 @@ function mainModuleGroups()
echo '<td>'; echo '<td>';
echo '</tr></table>'; 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) { if (true) {
$table = new StdClass(); $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%'; $table->width = '100%';
if ($config['style'] === 'pandora_black') {
$background_color = '#333';
} else {
$background_color = '#fff';
}
$head[0] = __('Groups'); $head[0] = __('Groups');
$headstyle[0] = 'width: 20%; font-weight: bolder;'; $headstyle[0] = 'width: 20%; font-weight: bolder;';
foreach ($array_module_group as $key => $value) { foreach ($array_module_group as $key => $value) {
@ -248,28 +299,28 @@ function mainModuleGroups()
$color = '#FFA631'; $color = '#FFA631';
// Orange when the cell for this model group and agent has at least one alert fired. // 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) { } 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. // 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) { } 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. // 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) { } else if ($array_data[$key][$k]['unknown_module_count'] != 0) {
$color = '#B2B2B2 '; $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. // 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) { } 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. // 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) { } else if ($array_data[$key][$k]['notInit_module_count'] != 0) {
$color = '#5BB6E5'; $color = '#5BB6E5';
// Blue when the cell for this module group and all modules have not init value. // 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] .= "<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] .= $array_data[$key][$k]['total_count'];
$data[$i][$j] .= '</a></div>'; $data[$i][$j] .= '</a></div>';
} else { } 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] .= 0;
$data[$i][$j] .= '</div>'; $data[$i][$j] .= '</div>';
} }
@ -278,7 +329,7 @@ function mainModuleGroups()
} }
} else { } else {
foreach ($value['gm'] as $k => $v) { 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] .= 0;
$data[$i][$j] .= '</div>'; $data[$i][$j] .= '</div>';
$j++; $j++;

View File

@ -1,26 +1,60 @@
<?php <?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 // Begin.
// ================================================== global $config;
// Copyright (c) 2005-2011 Artica Soluciones Tecnologicas
// Please see http://pandorafms.org for full contribution list // Requires.
// This program is free software; you can redistribute it and/or require_once $config['homedir'].'/include/functions.php';
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; version 2 // This extension is usefull only if the agent has associated IP.
// 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.
$id_agente = get_parameter('id_agente'); $id_agente = get_parameter('id_agente');
// This extension is usefull only if the agent has associated IP
$address = agents_get_address($id_agente); $address = agents_get_address($id_agente);
if (!empty($address) || empty($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) function whereis_the_command($command)
{ {
global $config; global $config;
@ -63,6 +97,9 @@ function whereis_the_command($command)
return $snmpget_path; return $snmpget_path;
} }
break; break;
default:
return null;
} }
} }
@ -87,85 +124,20 @@ 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)) { if (!validate_address($ip)) {
ui_print_error_message(__('The ip or dns name entered cannot be resolved')); ui_print_error_message(__('The ip or dns name entered cannot be resolved'));
} else { } else {
switch ($operation) { switch ($operation) {
case 1: case 1:
@ -175,7 +147,7 @@ function main_net_tools()
} else { } else {
echo '<h3>'.__('Traceroute to ').$ip.'</h3>'; echo '<h3>'.__('Traceroute to ').$ip.'</h3>';
echo '<pre>'; echo '<pre>';
echo system("$traceroute $ip"); echo system($traceroute.' '.$ip);
echo '</pre>'; echo '</pre>';
} }
break; break;
@ -187,7 +159,7 @@ function main_net_tools()
} else { } else {
echo '<h3>'.__('Ping to %s', $ip).'</h3>'; echo '<h3>'.__('Ping to %s', $ip).'</h3>';
echo '<pre>'; echo '<pre>';
echo system("$ping -c 5 $ip"); echo system($ping.' -c 5 '.$ip);
echo '</pre>'; echo '</pre>';
} }
break; break;
@ -199,7 +171,7 @@ function main_net_tools()
} else { } else {
echo '<h3>'.__('Basic TCP Scan on ').$ip.'</h3>'; echo '<h3>'.__('Basic TCP Scan on ').$ip.'</h3>';
echo '<pre>'; echo '<pre>';
echo system("$nmap -F $ip"); echo system($nmap.' -F '.$ip);
echo '</pre>'; echo '</pre>';
} }
break; break;
@ -212,7 +184,7 @@ function main_net_tools()
ui_print_error_message(__('Dig executable does not exist.')); ui_print_error_message(__('Dig executable does not exist.'));
} else { } else {
echo '<pre>'; echo '<pre>';
echo system("dig $ip"); echo system('dig '.$ip);
echo '</pre>'; echo '</pre>';
} }
@ -221,51 +193,227 @@ function main_net_tools()
ui_print_error_message(__('Whois executable does not exist.')); ui_print_error_message(__('Whois executable does not exist.'));
} else { } else {
echo '<pre>'; echo '<pre>';
echo system("whois $ip"); echo system('whois '.$ip);
echo '</pre>'; echo '</pre>';
} }
break; break;
case 3: case 3:
$snmp_obj = [
'ip_target' => $ip,
'snmp_version' => $snmp_version,
'snmp_community' => $community,
'format' => '-Oqn',
];
$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 '<h3>'.__('SNMP information for ').$ip.'</h3>';
echo '<h4>'.__('Uptime').'</h4>';
$snmpget = whereis_the_command('snmpget'); echo '<pre>';
if (empty($snmpget)) { if (empty($result)) {
ui_print_error_message(__('SNMPget executable does not exist.')); ui_print_error_message(__('Target unreachable.'));
break;
} else { } else {
echo '<h4>'.__('Uptime').'</h4>'; echo array_pop($result);
echo '<pre>';
echo exec("$snmpget -Ounv -v1 -c $community $ip .1.3.6.1.2.1.1.3.0 ");
echo '</pre>';
echo '<h4>'.__('Device info').'</h4>';
echo '<pre>';
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 ");
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";
}
echo '</table>';
} }
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 '</pre>';
echo '<h4>Interface Information</h4>';
$table = new StdClass();
$table->class = 'databox';
$table->head = [];
$table->head[] = __('Interface');
$table->head[] = __('Status');
$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;
}
html_print_table($table);
break;
default:
// Ignore.
break; 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>'; echo '</div>';
} }
/**
* Add option.
*
* @return void
*/
function godmode_net_tools() function godmode_net_tools()
{ {
global $config; global $config;

View File

@ -173,7 +173,7 @@ function pandora_realtime_graphs()
$table->colspan[2]['snmp_oid'] = 2; $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'] = __('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->colspan[2]['snmp_ver'] = 2;
$table->data[] = $data; $table->data[] = $data;

View File

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

View File

@ -10,7 +10,9 @@
var plot; var plot;
var plotOptions = { var plotOptions = {
legend: { container: $("#chartLegend") }, legend: {
container: $("#chartLegend")
},
xaxis: { xaxis: {
tickFormatter: function(timestamp, axis) { tickFormatter: function(timestamp, axis) {
var date = new Date(timestamp * 1000); var date = new Date(timestamp * 1000);
@ -131,47 +133,6 @@
resetDataPooling(); 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) { function shortNumber(number) {
if (Math.round(number) != number) return number; if (Math.round(number) != number) return number;
number = Number.parseInt(number); number = Number.parseInt(number);
@ -187,6 +148,7 @@
return number + " " + shorts[pos]; return number + " " + shorts[pos];
} }
function roundToTwo(num) { function roundToTwo(num) {
return +(Math.round(num + "e+2") + "e-2"); return +(Math.round(num + "e+2") + "e-2");
} }

View File

@ -1,3 +1 @@
/general/login_identification_wizard.php operation/servers/recon_view.php
/general/login_required.php
/godmode/update_manager/update_manager.messages.php

View File

@ -0,0 +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

@ -139,8 +139,9 @@ function get_logs_size($file)
function get_status_logs($path) function get_status_logs($path)
{ {
$status_server_log = ''; $status_server_log = '';
$size_server_log = get_logs_size($path); $size_server_log = number_format(get_logs_size($path));
if ($size_server_log <= 1048576) { $size_server_log = (0 + str_replace(',', '', $size_server_log));
if ($size_server_log <= 10485760) {
$status_server_log = "<a style ='color: green;text-decoration: none;'>Normal Status</a><a style ='text-decoration: none;'>&nbsp&nbsp You have less than 10 MB of logs</a>"; $status_server_log = "<a style ='color: green;text-decoration: none;'>Normal Status</a><a style ='text-decoration: none;'>&nbsp&nbsp You have less than 10 MB of logs</a>";
} else { } else {
$status_server_log = "<a class= 'content' style= 'color: red;text-decoration: none;'>Warning Status</a><a style ='text-decoration: none;'>&nbsp&nbsp You have more than 10 MB of logs</a>"; $status_server_log = "<a class= 'content' style= 'color: red;text-decoration: none;'>Warning Status</a><a style ='text-decoration: none;'>&nbsp&nbsp You have more than 10 MB of logs</a>";
@ -361,7 +362,7 @@ if ($console_mode == 1) {
true 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>'; 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

@ -724,7 +724,7 @@ CREATE TABLE IF NOT EXISTS `treport_content_template` (
`type` varchar(30) default 'simple_graph', `type` varchar(30) default 'simple_graph',
`period` int(11) NOT NULL default 0, `period` int(11) NOT NULL default 0,
`order` int (11) NOT NULL default 0, `order` int (11) NOT NULL default 0,
`description` mediumtext, `description` mediumtext,
`text_agent` text, `text_agent` text,
`text` TEXT, `text` TEXT,
`external_source` Text, `external_source` Text,
@ -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_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 `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 `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) -- 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 '', `agent_version` varchar(100) default '',
`ultimo_contacto_remoto` datetime default '1970-01-01 00:00:00', `ultimo_contacto_remoto` datetime default '1970-01-01 00:00:00',
`disabled` tinyint(2) NOT NULL default '0', `disabled` tinyint(2) NOT NULL default '0',
`remote` tinyint(1) NOT NULL default '0',
`id_parent` int(10) unsigned default '0', `id_parent` int(10) unsigned default '0',
`custom_id` varchar(255) default '', `custom_id` varchar(255) default '',
`server_name` varchar(100) default '', `server_name` varchar(100) default '',
`cascade_protection` tinyint(2) NOT NULL default '0', `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' , `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' , `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' , `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', `fired_count` bigint(20) NOT NULL default '0',
`update_module_count` tinyint(1) NOT NULL default '0', `update_module_count` tinyint(1) NOT NULL default '0',
`update_alert_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`), PRIMARY KEY (`id_agente`),
KEY `nombre` (`nombre`(255)), KEY `nombre` (`nombre`(255)),
KEY `direccion` (`direccion`), KEY `direccion` (`direccion`),
KEY `id_tagente_idx` (`id_tagente`),
KEY `disabled` (`disabled`), KEY `disabled` (`disabled`),
KEY `id_grupo` (`id_grupo`), KEY `id_grupo` (`id_grupo`),
FOREIGN KEY (`id_tmetaconsole_setup`) REFERENCES tmetaconsole_setup(`id`) ON DELETE CASCADE ON UPDATE CASCADE FOREIGN KEY (`id_tmetaconsole_setup`) REFERENCES tmetaconsole_setup(`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8; ) 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` -- 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; UPDATE `talert_actions` SET `field4` = 'text/html', `field4_recovery` = 'text/html' WHERE id = 1;
DELETE FROM `talert_commands` WHERE `id` = 11;
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
-- Table `tmap` -- 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 ('big_operation_step_datos_purge', '100');
INSERT INTO `tconfig` (`token`, `value`) VALUES ('small_operation_step_datos_purge', '1000'); 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 ('days_autodisable_deletion', '30');
INSERT INTO `tconfig` (`token`, `value`) VALUES ('MR', 28); INSERT INTO `tconfig` (`token`, `value`) VALUES ('MR', 31);
INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_docs_logo', 'default_docs.png'); 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_support_logo', 'default_support.png');
INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_logo_white_bg_preview', 'pandora_logo_head_white_bg.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'; UPDATE tconfig SET value = 'https://licensing.artica.es/pandoraupdate7/server.php' WHERE token='url_update_manager';
DELETE FROM `tconfig` WHERE `token` = 'current_package_enterprise'; 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'); 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` -- 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_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 `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 `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` -- Table `tmodule_relationship`
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
ALTER TABLE tmodule_relationship ADD COLUMN `id_server` varchar(100) NOT NULL DEFAULT ''; 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` -- Table `tpolicy_module`
@ -2192,3 +2209,62 @@ CREATE TABLE `tvisual_console_elements_cache` (
ON UPDATE CASCADE ON UPDATE CASCADE
) engine=InnoDB DEFAULT CHARSET=utf8; ) 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> </p>
<form action="index.php?sec=gservers&sec2=godmode/servers/discovery" method="post"> <form action="index.php?sec=gservers&sec2=godmode/servers/discovery" method="post">
<input type="submit" class="button_task" value="<?php echo __('Discover'); ?>" /> <input type="submit" class="button_task" value="<?php echo __('Discover'); ?>" />
<input type="hidden" name="discovery_hint" value="1"/>
</form> </form>
</div> </div>
</div> </div>

View File

@ -20,6 +20,8 @@ if (isset($_SERVER['REQUEST_TIME'])) {
$time = get_system_time(); $time = get_system_time();
} }
ui_require_css_file('footer');
$license_file = 'general/license/pandora_info_'.$config['language'].'.html'; $license_file = 'general/license/pandora_info_'.$config['language'].'.html';
if (! file_exists($config['homedir'].$license_file)) { if (! file_exists($config['homedir'].$license_file)) {
$license_file = 'general/license/pandora_info_en.html'; $license_file = 'general/license/pandora_info_en.html';
@ -41,9 +43,17 @@ if ($current_package == 0) {
$build_package_version = $current_package; $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'])) { if (isset($config['debug'])) {
$cache_info = []; $cache_info = [];

View File

@ -670,21 +670,49 @@ if ($config['menu_type'] == 'classic') {
<?php <?php
if ($_GET['refr'] || $do_refresh === true) { 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'); $("#header_autorefresh").css('padding-right', '5px');
var refr_time = <?php echo (int) get_parameter('refr', $config['refr']); ?>; if(autorefresh_draw == true) {
var t = new Date(); var refresh_interval = parseInt('<?php echo ($config['refr'] * 1000); ?>');
t.setTime (t.getTime () + parseInt(<?php echo ($config['refr'] * 1000); ?>)); var until_time='';
$("#refrcounter").countdown ({
until: t, function events_refresh() {
layout: '%M%nn%M:%S%nn%S', until_time = new Date();
labels: ['', '', '', '', '', '', ''], until_time.setTime (until_time.getTime () + parseInt(<?php echo ($config['refr'] * 1000); ?>));
onExpiry: function () {
$("#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); ?>));
$("#refrcounter").countdown ({
until: t,
layout: '%M%nn%M:%S%nn%S',
labels: ['', '', '', '', '', '', ''],
onExpiry: function () {
href = $("a.autorefresh").attr ("href"); href = $("a.autorefresh").attr ("href");
href = href + refr_time; href = href + refr_time;
$(document).attr ("location", href); $(document).attr ("location", href);
} }
}); });
}
<?php <?php
} }
?> ?>
@ -694,8 +722,38 @@ if ($config['menu_type'] == 'classic') {
$("#combo_refr").toggle (); $("#combo_refr").toggle ();
$("select#ref").change (function () { $("select#ref").change (function () {
href = $("a.autorefresh").attr ("href"); href = $("a.autorefresh").attr ("href");
$(document).attr ("location", href + this.value);
}); 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; return false;
}); });

View File

@ -19,8 +19,8 @@ if (isset($config['homedir'])) {
ui_require_css_file('login'); ui_require_css_file('login');
require_once $homedir.'include/functions_ui.php'; require_once __DIR__.'/../include/functions_ui.php';
require_once $homedir.'include/functions.php'; require_once __DIR__.'/../include/functions.php';
require_once __DIR__.'/../include/functions_html.php'; require_once __DIR__.'/../include/functions_html.php';
@ -376,6 +376,9 @@ if (isset($correct_reset_pass_process)) {
} }
if (isset($login_failed)) { 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 id="login_failed" title="'.__('Login failed').'">';
echo '<div class="content_alert">'; echo '<div class="content_alert">';
echo '<div class="icon_message_alert">'; echo '<div class="icon_message_alert">';
@ -386,6 +389,12 @@ if (isset($login_failed)) {
echo '<h1>'.__('ERROR').'</h1>'; echo '<h1>'.__('ERROR').'</h1>';
echo '<p>'.$config['auth_error'].'</p>'; echo '<p>'.$config['auth_error'].'</p>';
echo '</div>'; echo '</div>';
if ($config['enable_pass_policy']) {
echo '<div class="text_message_alert">';
echo '<p><strong>Remaining attempts: '.$attemps.'</strong></p>';
echo '</div>';
}
echo '<div class="button_message_alert">'; echo '<div class="button_message_alert">';
html_print_submit_button('Ok', 'hide-login-error', false); html_print_submit_button('Ok', 'hide-login-error', false);
echo '</div>'; echo '</div>';
@ -518,6 +527,7 @@ if ($login_screen == 'error_authconfig' || $login_screen == 'error_emptyconfig'
ui_require_css_file('dialog'); ui_require_css_file('dialog');
ui_require_css_file('jquery-ui.min', 'include/styles/js/'); ui_require_css_file('jquery-ui.min', 'include/styles/js/');
ui_require_jquery_file('jquery-ui.min'); ui_require_jquery_file('jquery-ui.min');
ui_require_jquery_file('jquery-ui_custom');
?> ?>
<?php <?php
@ -679,5 +689,6 @@ html_print_div(['id' => 'forced_title_layer', 'class' => 'forced_title_layer', '
$("#final_process_correct").dialog('close'); $("#final_process_correct").dialog('close');
}); });
}); });
/* ]]> */ /* ]]> */
</script> </script>

View File

@ -103,199 +103,205 @@ if (!empty($all_data)) {
$data['server_sanity'] = format_numeric((100 - $data['module_sanity']), 1); $data['server_sanity'] = format_numeric((100 - $data['module_sanity']), 1);
} }
ui_require_css_file('logon');
?> echo '<div id="welcome_panel">';
<table border="0" width="100%" cellspacing="0" cellpadding="0">
<tr>
<td width="25%" style="padding-right: 20px;" valign="top">
<?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 = []; // Overview Table.
$stats = reporting_get_stats_indicators($data, 120, 10, false); //
$status = '<table class="status_tactical">'; $table = new stdClass();
foreach ($stats as $stat) { $table->class = 'no-class';
$status .= '<tr><td><b>'.$stat['title'].'</b></td><td>'.$stat['graph'].'</td></tr>'; $table->cellpadding = 4;
} $table->cellspacing = 4;
$table->head = [];
$table->data = [];
$table->headstyle[0] = 'text-align:center;';
$table->width = '100%';
$table->head_colspan[0] = 4;
$status .= '</table>'; // Indicators.
$table->data[0][0] = $status; $tdata = [];
$table->rowclass[] = ''; $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>';
}
$table->data[] = $tdata; $status .= '</table>';
$table->data[0][0] = $status;
$table->rowclass[] = '';
// Alerts. $table->data[] = $tdata;
$tdata = [];
$tdata[0] = reporting_get_stats_alerts($data);
$table->rowclass[] = '';
$table->data[] = $tdata;
// Modules by status. // Alerts.
$tdata = []; $tdata = [];
$tdata[0] = reporting_get_stats_modules_status($data, 180, 100); $tdata[0] = reporting_get_stats_alerts($data);
$table->rowclass[] = ''; $table->rowclass[] = '';
$table->data[] = $tdata; $table->data[] = $tdata;
// Total agents and modules. // Modules by status.
$tdata = []; $tdata = [];
$tdata[0] = reporting_get_stats_agents_monitors($data); $tdata[0] = reporting_get_stats_modules_status($data, 180, 100);
$table->rowclass[] = ''; $table->rowclass[] = '';
$table->data[] = $tdata; $table->data[] = $tdata;
// Users. // Total agents and modules.
if (users_is_admin()) { $tdata = [];
$tdata = []; $tdata[0] = reporting_get_stats_agents_monitors($data);
$tdata[0] = reporting_get_stats_users($data); $table->rowclass[] = '';
$table->rowclass[] = ''; $table->data[] = $tdata;
$table->data[] = $tdata;
}
html_print_table($table); // Users.
unset($table); if (users_is_admin()) {
?> $tdata = [];
$tdata[0] = reporting_get_stats_users($data);
$table->rowclass[] = '';
</td> $table->data[] = $tdata;
}
<td width="75%" valign="top">
ui_toggle(
html_print_table($table, true),
<?php __('%s Overview', get_product_name()),
$options = []; '',
$options['id_user'] = $config['id_user']; 'overview',
$options['modal'] = false; false
$options['limit'] = 3; );
$news = get_news($options); unset($table);
echo '<div id="right">';
// News.
require_once 'general/news_dialog.php';
$options = [];
$options['id_user'] = $config['id_user'];
$options['modal'] = false;
$options['limit'] = 3;
$news = get_news($options);
if (!empty($news)) { if (!empty($news)) {
// NEWS BOARD. ui_require_css_file('news');
echo '<div id="news_board">'; // NEWS BOARD.
if ($config['prominent_time'] == 'timestamp') {
echo '<table cellpadding="0" width=100% cellspacing="0" class="databox filters">'; $comparation_suffix = '';
echo '<tr><th style="text-align:center;"><span >'.__('News board').'</span></th></tr>'; } else {
if ($config['prominent_time'] == 'timestamp') { $comparation_suffix = __('ago');
$comparation_suffix = ''; }
} else {
$comparation_suffix = __('ago');
}
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;') {
$image = true;
}
$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">';
if ($image) {
echo '<center><img src="./images/welcome_image.png" alt="img colabora con nosotros - Support" width="191" height="207"></center>';
}
echo nl2br($text);
echo '</td></tr>';
}
echo '</table>';
echo '</div>';
// News board.
echo '<br><br>';
// 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(
'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); $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;') {
$image = true;
}
if ($sessions === false) { $text_bbdd = io_safe_output($article['text']);
$sessions = []; $text = html_entity_decode($text_bbdd);
} $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) {
$output_news .= '<center><img src="./images/welcome_image.png" alt="img colabora con nosotros - Support" width="191" height="207"></center>';
}
foreach ($sessions as $session) { $output_news .= nl2br($text);
$data = []; $output_news .= '</div>';
$session_id_usuario = $session['id_usuario']; }
$session_ip_origen = $session['ip_origen'];
$output_news .= '</div>';
// News board.
ui_toggle(
$output_news,
__('News board'),
'',
'news',
false
);
// END OF NEWS BOARD.
}
// LAST ACTIVITY.
// Show last activity from this user.
$table = new stdClass();
$table->class = 'no-td-padding info_table';
$table->cellpadding = 0;
$table->cellspacing = 0;
$table->width = '100%';
// Don't specify px.
$table->data = [];
$table->size = [];
$table->headstyle = [];
$table->size[0] = '5%';
$table->size[1] = '15%';
$table->headstyle[1] = 'min-width: 12em;';
$table->size[2] = '5%';
$table->headstyle[2] = 'min-width: 65px;';
$table->size[3] = '10%';
$table->size[4] = '25%';
$table->head = [];
$table->head[0] = __('User');
$table->head[1] = __('Action');
$table->head[2] = __('Date');
$table->head[3] = __('Source IP');
$table->head[4] = __('Comments');
$table->align[4] = 'left';
$sql = sprintf(
'SELECT id_usuario,accion, ip_origen,descripcion,utimestamp
FROM tsesion
WHERE (`utimestamp` > UNIX_TIMESTAMP(NOW()) - '.SECONDS_1WEEK.")
AND `id_usuario` = '%s' ORDER BY `utimestamp` DESC LIMIT 10",
$config['id_user']
);
$sessions = db_get_all_rows_sql($sql);
$data[0] = '<strong>'.$session_id_usuario.'</strong>'; if ($sessions === false) {
$data[1] = ui_print_session_action_icon($session['accion'], true).' '.$session['accion']; $sessions = [];
$data[2] = ui_print_help_tip( }
date($config['date_format'], $session['utimestamp']),
true
).human_time_comparation($session['utimestamp'], 'tiny');
$data[3] = $session_ip_origen;
$description = str_replace([',', ', '], ', ', $session['descripcion']);
if (strlen($description) > 100) {
$data[4] = '<div >'.io_safe_output(substr($description, 0, 150).'...').'</div>';
} else {
$data[4] = '<div >'.io_safe_output($description).'</div>';
}
array_push($table->data, $data); foreach ($sessions as $session) {
} $data = [];
$session_id_usuario = $session['id_usuario'];
$session_ip_origen = $session['ip_origen'];
echo "<div style='width:100%; overflow-x:auto;'>";
html_print_table($table); $data[0] = '<strong>'.$session_id_usuario.'</strong>';
unset($table); $data[1] = ui_print_session_action_icon($session['accion'], true).' '.$session['accion'];
echo '</div>'; $data[2] = ui_print_help_tip(
echo '</div>'; date($config['date_format'], $session['utimestamp']),
// END OF LAST ACTIVIYY. true
?> ).human_time_comparation($session['utimestamp'], 'tiny');
$data[3] = $session_ip_origen;
$description = str_replace([',', ', '], ', ', $session['descripcion']);
</td> if (strlen($description) > 100) {
$data[4] = '<div >'.io_safe_output(substr($description, 0, 150).'...').'</div>';
</tr> } else {
</table> $data[4] = '<div >'.io_safe_output($description).'</div>';
}
array_push($table->data, $data);
}
$activity .= html_print_table($table, true);
unset($table);
ui_toggle(
$activity,
__('Latest activity'),
'',
'activity',
false,
false,
'',
'white-box-content padded'
);
// END OF LAST ACTIVIYY.
// Close right panel.
echo '</div>';
// Close welcome panel.
echo '</div>';

View File

@ -30,12 +30,6 @@ $(document).ready(function(){
} }
}); });
// Set the height of the menu.
$(window).on('load', function (){
$("#menu_full").height($("#container").height());
});
</script> </script>
<?php <?php
$autohidden_menu = 0; $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(); exit();
} }
ui_require_css_file('register'); ui_require_css_file('register');
$initial = isset($config['initial_wizard']) !== true $initial = isset($config['initial_wizard']) !== true
@ -150,26 +149,27 @@ if ($initial && users_is_admin()) {
); );
} }
if ($registration && users_is_admin()) { if (!$config['disabled_newsletter']) {
// Prepare registration wizard, not launch. leave control to flow. if ($registration && users_is_admin()) {
registration_wiz_modal( // Prepare registration wizard, not launch. leave control to flow.
false, registration_wiz_modal(
// Launch only if not being launch from 'initial'.
!$initial,
(($show_newsletter === true) ? 'force_run_newsletter()' : null)
);
} else {
if ($show_newsletter) {
// Show newsletter wizard for current user.
newsletter_wiz_modal(
false, false,
// Launch only if not being call from 'registration'. // Launch only if not being launch from 'initial'.
!$registration && !$initial !$initial,
(($show_newsletter === true) ? 'force_run_newsletter()' : null)
); );
} else {
if ($show_newsletter) {
// Show newsletter wizard for current user.
newsletter_wiz_modal(
false,
// Launch only if not being call from 'registration'.
!$registration && !$initial
);
}
} }
} }
$newsletter = null; $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 = '<form name="query_sel" method="post" action="index.php?sec=glog&sec2=godmode/admin_access_logs">';
$form .= html_print_table($table, true); $form .= html_print_table($table, true);
$form .= '</form>'; $form .= '</form>';
ui_toggle($form, __('Filter'), '', false); ui_toggle($form, __('Filter'), '', '', false);
$filter = '1=1'; $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_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) { if ($get_modules_json_for_multiple_snmp) {
include_once 'include/graphs/functions_utils.php'; include_once 'include/graphs/functions_utils.php';
@ -100,7 +101,16 @@ if (is_ajax()) {
if ($out === false) { if ($out === false) {
$out = $oid_snmp; $out = $oid_snmp;
} else { } 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 = []; $oid_snmp = [];
@ -176,7 +186,7 @@ if ($disk_conf_delete) {
@unlink($filename['conf']); @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.
$custom_id_div = '<div class="label_select">'; $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%;">'; $table_agent_name .= '<div class="label_select_child_right agent_options_agent_name" style="width: 40%;">';
if ($id_agente) { 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 .= '<a href="index.php?sec=gagente&sec2=operation/agentes/ver_agente&id_agente='.$id_agente.'">';
$table_agent_name .= html_print_image( $table_agent_name .= html_print_image(
'images/zoom.png', 'images/zoom.png',
@ -245,7 +255,7 @@ if (!$new_agent && $alias != '') {
$table_agent_name .= '</div></div></div>'; $table_agent_name .= '</div></div></div>';
// QR code 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 .= '<p class="input_label">'.__('QR Code Agent view').': </p>';
$table_qr_code .= '<div id="qr_container_image"></div>'; $table_qr_code .= '<div id="qr_container_image"></div>';
if ($id_agente) { 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">'; $table_server .= '<div class="label_select_parent">';
if ($new_agent) { if ($new_agent) {
// Set first server by default. // 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); $array_keys_servers_get_names = array_keys($servers_get_names);
$server_name = reset($array_keys_servers_get_names); $server_name = reset($array_keys_servers_get_names);
} }
$table_server .= html_print_select( $table_server .= html_print_select(
servers_get_names(), $servers,
'server_name', 'server_name',
$server_name, $server_name,
'', '',
@ -401,7 +411,7 @@ $table_description .= html_print_textarea(
// QR code. // QR code.
echo '<div class="first_row"> 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_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 class="agent_options_column_right">'.$table_interval.$table_os.$table_server.$table_description.'</div>
</div>'; </div>';
@ -413,8 +423,8 @@ echo '</div>';
if (enterprise_installed()) { if (enterprise_installed()) {
$secondary_groups_selected = enterprise_hook('agents_get_secondary_groups', [$id_agente]); $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>'; $adv_secondary_groups_label = '<div class="label_select"><p class="input_label">'.__('Secondary groups').': </p></div>';
$table_adv_secondary_groups_left = html_print_select_groups( $adv_secondary_groups_left = html_print_select_groups(
false, false,
// Use the current user to select the groups. // Use the current user to select the groups.
'AR', 'AR',
@ -441,7 +451,7 @@ if (enterprise_installed()) {
// CSS classnames (default). // CSS classnames (default).
false, false,
// Not disabled (default). // Not disabled (default).
'width:50%; min-width:170px;', 'min-width:170px;',
// Inline styles (default). // Inline styles (default).
false, false,
// Option style select (default). // Option style select (default).
@ -455,7 +465,7 @@ if (enterprise_installed()) {
// Do not show the primary group in this selection. // 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', 'add_secondary',
'images/darrowright_green.png', 'images/darrowright_green.png',
1, 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'], $secondary_groups_selected['for_select'],
// Values. // Values.
'secondary_groups_selected', 'secondary_groups_selected',
@ -502,7 +512,7 @@ if (enterprise_installed()) {
// Class. // Class.
false, false,
// Disabled. // Disabled.
'width:50%; min-width:170px;' 'min-width:170px;'
// Style. // Style.
); );
@ -514,8 +524,10 @@ if (enterprise_installed()) {
); );
$safe_mode_modules = []; $safe_mode_modules = [];
$safe_mode_modules[0] = __('Any'); $safe_mode_modules[0] = __('Any');
foreach ($sql_modules as $m) { if (is_array($sql_modules)) {
$safe_mode_modules[$m['id_module']] = $m['name']; 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( $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 = [];
$params['return'] = true; $params['return'] = true;
$params['show_helptip'] = true; $params['show_helptip'] = true;
@ -648,13 +660,15 @@ $table_adv_module_mode .= html_print_radio_button_extended(
$table_adv_module_mode .= '</div></div>'; $table_adv_module_mode .= '</div></div>';
// Status (Disabled / Enabled). // 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( $table_adv_status .= html_print_checkbox_switch(
'disabled', 'disabled',
1, 1,
$disabled, $disabled,
true 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. // Url address.
if (enterprise_installed()) { if (enterprise_installed()) {
@ -665,7 +679,14 @@ if (enterprise_installed()) {
'', '',
45, 45,
255, 255,
true true,
false,
false,
'',
'',
'',
// Autocomplete.
'new-password'
).'</div>'; ).'</div>';
} else { } else {
$table_adv_url = '<div class="label_select"><p class="input_label">'.__('Url address').': </p></div>'; $table_adv_url = '<div class="label_select"><p class="input_label">'.__('Url address').': </p></div>';
@ -679,9 +700,11 @@ if (enterprise_installed()) {
).'</div>'; ).'</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 .= 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(); $listIcons = gis_get_array_list_icons();
@ -753,33 +776,48 @@ if ($config['activate_gis']) {
// General display distribution. // General display distribution.
$table_adv_options = $table_adv_secondary_groups.'<div class="secondary_groups_select" style="margin-bottom:30px;"> $table_adv_options = '
<div class="secondary_groups_list_left"> <div class="secondary_groups_list">
'.$table_adv_secondary_groups_left.' '.$adv_secondary_groups_label.'
<div class="sg_source">
'.$adv_secondary_groups_left.'
</div>
<div class="secondary_group_arrows">
'.$adv_secondary_groups_arrows.'
</div>
<div class="sg_target">
'.$adv_secondary_groups_right.'
</div>
</div> </div>
<div class="secondary_groups_select_arrows"> <div class="agent_av_opt_right" >
'.$table_adv_secondary_groups_arrows.' '.$table_adv_parent.$table_adv_module_mode.$table_adv_cascade;
</div>
<div class="secondary_groups_list_right">
'.$table_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;
if ($new_agent) { if ($new_agent) {
// If agent is new, show custom id as old style format. // If agent is new, show custom id as old style format.
$table_adv_options .= $custom_id_div; $table_adv_options .= $custom_id_div;
} }
$table_adv_options .= $table_adv_gis.'</div> $table_adv_options .= '</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>
</div>';
echo '<div class="ui_toggle">'; $table_adv_options .= '
ui_toggle($table_adv_options, __('Advanced options'), '', true, false, 'white_box white_box_opened'); <div class="agent_av_opt_left" >
echo '</div>'; '.$table_adv_gis.$table_adv_agent_icon.$table_adv_url.$table_adv_quiet.$table_adv_status.$table_adv_remote.$table_adv_safe.'
</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 = new stdClass();
$table->width = '100%'; $table->width = '100%';
@ -787,7 +825,7 @@ $table->class = 'custom_fields_table';
$table->head = [ $table->head = [
0 => __('Click to display').ui_print_help_tip( 0 => __('Click to display').ui_print_help_tip(
__('This field allows url insertion using the BBCode\'s url tag').'.<br />'.__('The format is: [url=\'url to navigate\']\'text to show\'[/url]').'.<br /><br />'.__('e.g.: [url=google.com]Google web search[/url]'), __('This field allows url insertion using the BBCode\'s url tag').'.<br />'.__('The format is: [url=\'url to navigate\']\'text to show\'[/url] or [url]\'url to navigate\'[/url] ').'.<br /><br />'.__('e.g.: [url=google.com]Google web search[/url] or [url]www.goole.com[/url]'),
true true
), ),
]; ];
@ -831,7 +869,7 @@ foreach ($fields as $field) {
$custom_value = ''; $custom_value = '';
} }
$table->rowstyle[$i] = 'cursor: pointer;'; $table->rowstyle[$i] = 'cursor: pointer;user-select: none;';
if (!empty($custom_value)) { if (!empty($custom_value)) {
$table->rowstyle[($i + 1)] = 'display: table-row;'; $table->rowstyle[($i + 1)] = 'display: table-row;';
} else { } else {
@ -893,16 +931,48 @@ foreach ($fields as $field) {
$i += 2; $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',
'no-border'
);
echo '</div>';
}
} else {
echo '<div class="ui_toggle">'; echo '<div class="ui_toggle">';
ui_toggle( ui_toggle(
html_print_table($table, true), $table_adv_options,
__('Custom fields'), __('Advanced options'),
'', '',
true, '',
false, true,
'white_box white_box_opened' 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>'; echo '</div>';
} }
@ -1134,6 +1204,19 @@ ui_require_jquery_file('bgiframe');
} }
$(document).ready (function() { $(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 (); $("select#id_os").pandoraSelectOS ();
var checked = $("#checkbox-cascade_protection").is(":checked"); var checked = $("#checkbox-cascade_protection").is(":checked");
@ -1182,7 +1265,7 @@ ui_require_jquery_file('bgiframe');
128, 128,
128 128
); );
$("#text-agente").prop('disabled', true); $("#text-agente").prop('readonly', true);
}); });
</script> </script>

View File

@ -1,16 +1,32 @@
<?php <?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; global $config;
require_once $config['homedir'].'/include/functions_agents.php'; require_once $config['homedir'].'/include/functions_agents.php';
require_once 'include/functions_modules.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); $ipAgent = db_get_value('direccion', 'tagente', 'id_agente', $idAgent);
check_login(); check_login();
$ip_target = (string) get_parameter('ip_target', $ipAgent); $ip_target = (string) get_parameter('ip_target', $ipAgent);
$use_agent = get_parameter('use_agent'); $use_agent = get_parameter('use_agent');
$snmp_community = (string) get_parameter('snmp_community', 'public'); $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')); $snmp3_privacy_pass = io_safe_output(get_parameter('snmp3_privacy_pass'));
$tcp_port = (string) get_parameter('tcp_port'); $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; $id_agent = $idAgent;
// Get passed variables // Get passed variables.
$snmpwalk = (int) get_parameter('snmpwalk', 0); $snmpwalk = (int) get_parameter('snmpwalk', 0);
$create_modules = (int) get_parameter('create_modules', 0); $create_modules = (int) get_parameter('create_modules', 0);
@ -48,7 +63,7 @@ $interfaces = [];
$interfaces_ip = []; $interfaces_ip = [];
if ($snmpwalk) { if ($snmpwalk) {
// OID Used is for SNMP MIB-2 Interfaces // OID Used is for SNMP MIB-2 Interfaces.
$snmpis = get_snmpwalk( $snmpis = get_snmpwalk(
$ip_target, $ip_target,
$snmp_version, $snmp_version,
@ -64,7 +79,7 @@ if ($snmpwalk) {
$tcp_port, $tcp_port,
$server_to_exec $server_to_exec
); );
// ifXTable is also used // IfXTable is also used.
$ifxitems = get_snmpwalk( $ifxitems = get_snmpwalk(
$ip_target, $ip_target,
$snmp_version, $snmp_version,
@ -81,7 +96,7 @@ if ($snmpwalk) {
$server_to_exec $server_to_exec
); );
// Get the interfaces IPV4/IPV6 // Get the interfaces IPV4/IPV6.
$snmp_int_ip = get_snmpwalk( $snmp_int_ip = get_snmpwalk(
$ip_target, $ip_target,
$snmp_version, $snmp_version,
@ -98,12 +113,12 @@ if ($snmpwalk) {
$server_to_exec $server_to_exec
); );
// Build a [<interface id>] => [<interface ip>] array // Build a [<interface id>] => [<interface ip>] array.
if (!empty($snmp_int_ip)) { if (!empty($snmp_int_ip)) {
foreach ($snmp_int_ip as $key => $value) { foreach ($snmp_int_ip as $key => $value) {
// The key is something like IP-MIB::ipAddressIfIndex.ipv4."<ip>" // The key is something like IP-MIB::ipAddressIfIndex.ipv4."<ip>".
// or IP-MIB::ipAddressIfIndex.ipv6."<ip>" // or IP-MIB::ipAddressIfIndex.ipv6."<ip>".
// The value is something like INTEGER: <interface id> // The value is something like INTEGER: <interface id>.
$data = explode(': ', $value); $data = explode(': ', $value);
$interface_id = !empty($data) && isset($data[1]) ? $data[1] : false; $interface_id = !empty($data) && isset($data[1]) ? $data[1] : false;
@ -111,7 +126,7 @@ if ($snmpwalk) {
$interface_ip = $matches[1]; $interface_ip = $matches[1];
} }
// Get the first ip // Get the first ip.
if ($interface_id !== false && !empty($interface_ip) && !isset($interfaces_ip[$interface_id])) { if ($interface_id !== false && !empty($interface_ip) && !isset($interfaces_ip[$interface_id])) {
$interfaces_ip[$interface_id] = $interface_ip; $interfaces_ip[$interface_id] = $interface_ip;
} }
@ -120,17 +135,17 @@ if ($snmpwalk) {
unset($snmp_int_ip); unset($snmp_int_ip);
} }
$snmpis = array_merge(($snmpis === false ? [] : $snmpis), ($ifxitems === false ? [] : $ifxitems)); $snmpis = array_merge((($snmpis === false) ? [] : $snmpis), (($ifxitems === false) ? [] : $ifxitems));
$interfaces = []; $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) { foreach ($snmpis as $key => $snmp) {
$data = explode(': ', $snmp, 2); $data = explode(': ', $snmp, 2);
$keydata = explode('::', $key); $keydata = explode('::', $key);
$keydata2 = explode('.', $keydata[1]); $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])) { if (!isset($keydata2[1]) || !isset($data[1])) {
continue; continue;
} }
@ -240,24 +255,22 @@ if ($create_modules) {
$oid_array[(count($oid_array) - 1)] = $id; $oid_array[(count($oid_array) - 1)] = $id;
$oid = implode('.', $oid_array); $oid = implode('.', $oid_array);
// Get the name // Get the name.
$name_array = explode('::', $oid_array[0]); $name_array = explode('::', $oid_array[0]);
$name = $ifname.'_'.$name_array[1]; $name = $ifname.'_'.$name_array[1];
// Clean the name // Clean the name.
$name = str_replace('"', '', $name); $name = str_replace('"', '', $name);
// Proc moduletypes // Proc moduletypes.
if (preg_match('/Status/', $name_array[1])) { if (preg_match('/Status/', $name_array[1])) {
$module_type = 18; $module_type = 18;
} else if (preg_match('/Present/', $name_array[1])) { } else if (preg_match('/Present/', $name_array[1])) {
$module_type = 18; $module_type = 18;
} else if (preg_match('/PromiscuousMode/', $name_array[1])) { } else if (preg_match('/PromiscuousMode/', $name_array[1])) {
$module_type = 18; $module_type = 18;
} } else if (preg_match('/Alias/', $name_array[1])) {
// String moduletypes.
// String moduletypes
else if (preg_match('/Alias/', $name_array[1])) {
$module_type = 17; $module_type = 17;
} else if (preg_match('/Address/', $name_array[1])) { } else if (preg_match('/Address/', $name_array[1])) {
$module_type = 17; $module_type = 17;
@ -267,15 +280,11 @@ if ($create_modules) {
$module_type = 17; $module_type = 17;
} else if (preg_match('/Descr/', $name_array[1])) { } else if (preg_match('/Descr/', $name_array[1])) {
$module_type = 17; $module_type = 17;
} } else if (preg_match('/s$/', $name_array[1])) {
// Specific counters (ends in s).
// Specific counters (ends in s)
else if (preg_match('/s$/', $name_array[1])) {
$module_type = 16; $module_type = 16;
} } else {
// Otherwise, numeric.
// Otherwise, numeric
else {
$module_type = 15; $module_type = 15;
} }
@ -322,7 +331,7 @@ if ($create_modules) {
} else if (preg_match('/ifAdminStatus/', $name_array[1])) { } else if (preg_match('/ifAdminStatus/', $name_array[1])) {
$module_type = 2; $module_type = 2;
} else if (preg_match('/ifOperStatus/', $name_array[1])) { } else if (preg_match('/ifOperStatus/', $name_array[1])) {
$module_type = 18; $module_type = 2;
} else { } else {
$module_type = 4; $module_type = 4;
} }
@ -331,7 +340,7 @@ if ($create_modules) {
$output_oid = ''; $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]; $conf_oid = $output_oid[0];
$oid = $conf_oid; $oid = $conf_oid;
@ -398,7 +407,9 @@ if ($create_modules) {
} }
if ($done > 0) { if ($done > 0) {
ui_print_success_message(__('Successfully modules created')." ($done)"); ui_print_success_message(
__('Successfully modules created').' ('.$done.')'
);
} }
if (!empty($errors)) { if (!empty($errors)) {
@ -408,17 +419,17 @@ if ($create_modules) {
foreach ($errors as $code => $number) { foreach ($errors as $code => $number) {
switch ($code) { switch ($code) {
case ERR_EXIST: 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; break;
case ERR_INCOMPLETE: case ERR_INCOMPLETE:
$msg .= '<br>'.__('Some required fields are missed').': ('.__('name').') '." ($number)"; $msg .= '<br>'.__('Some required fields are missed').': ('.__('name').') ('.$number.')';
break; break;
case ERR_DB: case ERR_DB:
case ERR_GENERIC: case ERR_GENERIC:
default: default:
$msg .= '<br>'.__('Processing error')." ($number)"; $msg .= '<br>'.__('Processing error').' ('.$number.')';
break; break;
} }
} }
@ -427,10 +438,10 @@ if ($create_modules) {
} }
} }
// Create the interface list for the interface // Create the interface list for the interface.
$interfaces_list = []; $interfaces_list = [];
foreach ($interfaces as $interface) { 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'] != '') { if (isset($interface['ifDescr']) && $interface['ifDescr']['value'] != '') {
$ifname = $interface['ifDescr']['value']; $ifname = $interface['ifDescr']['value'];
} else if (isset($interface['ifName']) && $interface['ifName']['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 '<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->width = '100%';
$table->cellpadding = 0; $table->cellpadding = 0;
@ -465,10 +476,15 @@ if (enterprise_installed()) {
enterprise_include_once('include/functions_satellite.php'); enterprise_include_once('include/functions_satellite.php');
$rows = get_proxy_servers(); $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) { foreach ($rows as $row) {
if ($row['server_type'] != 13) { if ($row['server_type'] != 13) {
$s_type = ' (Standard)'; $s_type = ' (Standard)';
} else { } else {
$id_satellite = $row['id_server'];
$s_type = ' (Satellite)'; $s_type = ' (Satellite)';
} }
@ -477,7 +493,16 @@ if (enterprise_installed()) {
} }
$table->data[1][2] = '<b>'.__('Server to execute command').'</b>'; $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['1'] = 'v. 1';
$snmp_versions['2'] = 'v. 2'; $snmp_versions['2'] = 'v. 2';
@ -497,7 +522,7 @@ html_print_table($table);
unset($table); unset($table);
// SNMP3 OPTIONS // SNMP3 OPTIONS.
$table->width = '100%'; $table->width = '100%';
$table->data[2][1] = '<b>'.__('Auth user').'</b>'; $table->data[2][1] = '<b>'.__('Auth user').'</b>';
@ -552,7 +577,7 @@ echo '</form>';
if (!empty($interfaces_list)) { if (!empty($interfaces_list)) {
echo '<span id ="none_text" style="display: none;">'.__('None').'</span>'; 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">'; echo '<span id="form_interfaces">';
$id_snmp_serialize = serialize_in_temp($interfaces, $config['id_user'].'_snmp'); $id_snmp_serialize = serialize_in_temp($interfaces, $config['id_user'].'_snmp');
@ -577,13 +602,30 @@ if (!empty($interfaces_list)) {
$table->width = '100%'; $table->width = '100%';
// Agent selector // Agent selector.
$table->data[0][0] = '<b>'.__('Interfaces').'</b>'; $table->data[0][0] = '<b>'.__('Interfaces').'</b>';
$table->data[0][1] = ''; $table->data[0][1] = '';
$table->data[0][2] = '<b>'.__('Modules').'</b>'; $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][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_select([], 'module[]', 0, false, '', 0, true, true, true, '', false, 'width:200px;');
$table->data[1][2] .= html_print_input_hidden('agent', $id_agent, true); $table->data[1][2] .= html_print_input_hidden('agent', $id_agent, true);
@ -608,11 +650,13 @@ ui_require_jquery_file('bgiframe');
$(document).ready (function () { $(document).ready (function () {
var inputActive = true; var inputActive = true;
$('#server_to_exec option').trigger('change');
$(document).data('text_for_module', $("#none_text").html()); $(document).data('text_for_module', $("#none_text").html());
$("#id_snmp").change(snmp_changed_by_multiple_snmp); $("#id_snmp").change(snmp_changed_by_multiple_snmp);
$("#snmp_version").change(function () { $("#snmp_version").change(function () {
if (this.value == "3") { if (this.value == "3") {
$("#snmp3_options").css("display", ""); $("#snmp3_options").css("display", "");
@ -621,28 +665,36 @@ $(document).ready (function () {
$("#snmp3_options").css("display", "none"); $("#snmp3_options").css("display", "none");
} }
}); });
$("#walk_form").submit(function() { $("#walk_form").submit(function() {
$("#submit-snmp_walk").disable (); $("#submit-snmp_walk").disable ();
$("#oid_loading").show (); $("#oid_loading").show ();
$("#no_snmp").hide (); $("#no_snmp").hide ();
$("#form_interfaces").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) { function snmp_changed_by_multiple_snmp (event, id_snmp, selected) {
var idSNMP = Array(); var idSNMP = Array();
var get_common_modules = $("#modules_selection_mode option:selected").val();
jQuery.each ($("#id_snmp option:selected"), function (i, val) { jQuery.each ($("#id_snmp option:selected"), function (i, val) {
idSNMP.push($(val).val()); idSNMP.push($(val).val());
}); });
$('#module').attr ('disabled', 1); $('#module').attr ('disabled', 1);
$('#module').empty (); $('#module').empty ();
$('#module').append ($('<option></option>').html ("Loading...").attr ("value", 0)); $('#module').append ($('<option></option>').html ("Loading...").attr ("value", 0));
jQuery.post ('ajax.php', jQuery.post ('ajax.php',
{"page" : "godmode/agentes/agent_manager", {"page" : "godmode/agentes/agent_manager",
"get_modules_json_for_multiple_snmp": 1, "get_modules_json_for_multiple_snmp": 1,
"get_common_modules" : get_common_modules,
"id_snmp[]": idSNMP, "id_snmp[]": idSNMP,
"id_snmp_serialize": $("#hidden-id_snmp_serialize").val() "id_snmp_serialize": $("#hidden-id_snmp_serialize").val()
}, },
@ -655,7 +707,7 @@ function snmp_changed_by_multiple_snmp (event, id_snmp, selected) {
$('#module').fadeIn ('normal'); $('#module').fadeIn ('normal');
c++; c++;
}); });
if (c == 0) { if (c == 0) {
if (typeof($(document).data('text_for_module')) != 'undefined') { if (typeof($(document).data('text_for_module')) != 'undefined') {
$('#module').append ($('<option></option>').html ($(document).data('text_for_module')).attr("value", 0).prop('selected', true)); $('#module').append ($('<option></option>').html ($(document).data('text_for_module')).attr("value", 0).prop('selected', true));
@ -666,11 +718,11 @@ function snmp_changed_by_multiple_snmp (event, id_snmp, selected) {
} }
else { else {
var anyText = $("#any_text").html(); //Trick for catch the translate text. var anyText = $("#any_text").html(); //Trick for catch the translate text.
if (anyText == null) { if (anyText == null) {
anyText = 'Any'; anyText = 'Any';
} }
$('#module').append ($('<option></option>').html (anyText).attr ("value", 0).prop('selected', true)); $('#module').append ($('<option></option>').html (anyText).attr ("value", 0).prop('selected', true));
} }
} }
@ -682,6 +734,20 @@ function snmp_changed_by_multiple_snmp (event, id_snmp, selected) {
"json"); "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> </script>

View File

@ -1213,7 +1213,7 @@ if ($update_module || $create_module) {
$max_timeout = (int) get_parameter('max_timeout'); $max_timeout = (int) get_parameter('max_timeout');
$max_retries = (int) get_parameter('max_retries'); $max_retries = (int) get_parameter('max_retries');
$min = (int) get_parameter_post('min'); $min = (int) get_parameter('min');
$max = (int) get_parameter('max'); $max = (int) get_parameter('max');
$interval = (int) get_parameter('module_interval', $intervalo); $interval = (int) get_parameter('module_interval', $intervalo);
$ff_interval = (int) get_parameter('module_ff_interval'); $ff_interval = (int) get_parameter('module_ff_interval');
@ -1276,18 +1276,10 @@ if ($update_module || $create_module) {
$m_hide = $m['hide']; $m_hide = $m['hide'];
} }
if ($update_module) { if ($m_hide == '1') {
if ($m_hide == '1') { $macros[$k]['value'] = io_input_password(get_parameter($m['macro'], ''));
$macros[$k]['value'] = io_input_password(get_parameter($m['macro'], ''));
} else {
$macros[$k]['value'] = get_parameter($m['macro'], '');
}
} else { } else {
if ($m_hide == '1') { $macros[$k]['value'] = get_parameter($m['macro'], '');
$macros[$k]['value'] = io_input_password($macros_names[$k]);
} else {
$macros[$k]['value'] = $macros_names[$k];
}
} }
} }
@ -1366,7 +1358,11 @@ if ($update_module || $create_module) {
$parent_module_id = (int) get_parameter('parent_module_id'); $parent_module_id = (int) get_parameter('parent_module_id');
$ip_target = (string) get_parameter('ip_target'); $ip_target = (string) get_parameter('ip_target');
if ($ip_target == '') { // No autofill if the module is a webserver module.
if ($ip_target == ''
&& $id_module_type < MODULE_WEBSERVER_CHECK_LATENCY
&& $id_module_type > MODULE_WEBSERVER_RETRIEVE_STRING_DATA
) {
$ip_target = 'auto'; $ip_target = 'auto';
} }
@ -1567,8 +1563,14 @@ if ($update_module) {
foreach ($plugin_parameter_split as $key => $value) { foreach ($plugin_parameter_split as $key => $value) {
if ($key == 1) { if ($key == 1) {
$values['plugin_parameter'] .= 'http_auth_user&#x20;'.$http_user.'&#x0a;'; if ($http_user) {
$values['plugin_parameter'] .= 'http_auth_pass&#x20;'.$http_pass.'&#x0a;'; $values['plugin_parameter'] .= 'http_auth_user&#x20;'.$http_user.'&#x0a;';
}
if ($http_pass) {
$values['plugin_parameter'] .= 'http_auth_pass&#x20;'.$http_pass.'&#x0a;';
}
$values['plugin_parameter'] .= $value.'&#x0a;'; $values['plugin_parameter'] .= $value.'&#x0a;';
} else { } else {
$values['plugin_parameter'] .= $value.'&#x0a;'; $values['plugin_parameter'] .= $value.'&#x0a;';
@ -1765,8 +1767,14 @@ if ($create_module) {
foreach ($plugin_parameter_split as $key => $value) { foreach ($plugin_parameter_split as $key => $value) {
if ($key == 1) { if ($key == 1) {
$values['plugin_parameter'] .= 'http_auth_user&#x20;'.$http_user.'&#x0a;'; if ($http_user) {
$values['plugin_parameter'] .= 'http_auth_pass&#x20;'.$http_pass.'&#x0a;'; $values['plugin_parameter'] .= 'http_auth_user&#x20;'.$http_user.'&#x0a;';
}
if ($http_pass) {
$values['plugin_parameter'] .= 'http_auth_pass&#x20;'.$http_pass.'&#x0a;';
}
$values['plugin_parameter'] .= $value.'&#x0a;'; $values['plugin_parameter'] .= $value.'&#x0a;';
} else { } else {
$values['plugin_parameter'] .= $value.'&#x0a;'; $values['plugin_parameter'] .= $value.'&#x0a;';
@ -2103,8 +2111,7 @@ if ($delete_module) {
} }
} }
// MODULE DUPLICATION // MODULE DUPLICATION.
// ==================.
if (!empty($duplicate_module)) { if (!empty($duplicate_module)) {
// DUPLICATE agent module ! // DUPLICATE agent module !
$id_duplicate_module = $duplicate_module; $id_duplicate_module = $duplicate_module;
@ -2150,8 +2157,46 @@ if (!empty($duplicate_module)) {
} }
} }
// UPDATE GIS // MODULE ENABLE/DISABLE.
// ==========. if ($enable_module) {
$result = modules_change_disabled($enable_module, 0);
$modulo_nombre = db_get_row_sql('SELECT nombre FROM tagente_modulo WHERE id_agente_modulo = '.$enable_module.'');
$modulo_nombre = $modulo_nombre['nombre'];
if ($result === NOERR) {
enterprise_hook('config_agents_enable_module_conf', [$id_agente, $enable_module]);
db_pandora_audit('Module management', 'Enable #'.$enable_module.' | '.$modulo_nombre.' | '.$agent['alias']);
} else {
db_pandora_audit('Module management', 'Fail to enable #'.$enable_module.' | '.$modulo_nombre.' | '.$agent['alias']);
}
ui_print_result_message(
$result,
__('Successfully enabled'),
__('Could not be enabled')
);
}
if ($disable_module) {
$result = modules_change_disabled($disable_module, 1);
$modulo_nombre = db_get_row_sql('SELECT nombre FROM tagente_modulo WHERE id_agente_modulo = '.$disable_module.'');
$modulo_nombre = $modulo_nombre['nombre'];
if ($result === NOERR) {
enterprise_hook('config_agents_disable_module_conf', [$id_agente, $disable_module]);
db_pandora_audit('Module management', 'Disable #'.$disable_module.' | '.$modulo_nombre.' | '.$agent['alias']);
} else {
db_pandora_audit('Module management', 'Fail to disable #'.$disable_module.' | '.$modulo_nombre.' | '.$agent['alias']);
}
ui_print_result_message(
$result,
__('Successfully disabled'),
__('Could not be disabled')
);
}
// UPDATE GIS.
$updateGIS = get_parameter('update_gis', 0); $updateGIS = get_parameter('update_gis', 0);
if ($updateGIS) { if ($updateGIS) {
$updateGisData = get_parameter('update_gis_data'); $updateGisData = get_parameter('update_gis_data');
@ -2239,8 +2284,11 @@ switch ($tab) {
break; break;
case 'alert': case 'alert':
// Because $id_agente is set, it will show only agent alerts. /*
// This var is for not display create button on alert list. * Because $id_agente is set, it will show only agent alerts
* This var is for not display create button on alert list
*/
$dont_display_alert_create_bttn = true; $dont_display_alert_create_bttn = true;
include 'godmode/alerts/alert_list.php'; include 'godmode/alerts/alert_list.php';
break; break;

View File

@ -163,7 +163,7 @@ echo '<td>';
echo __('Group').'&nbsp;'; echo __('Group').'&nbsp;';
$own_info = get_user_info($config['id_user']); $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; $return_all_group = false;
} else { } else {
$return_all_group = true; $return_all_group = true;
@ -443,6 +443,14 @@ ui_pagination($total_agents, "index.php?sec=gagente&sec2=godmode/agentes/modific
if ($agents !== false) { if ($agents !== false) {
// Urls to sort the table. // Urls to sort the table.
// Agent name size and description for Chinese and Japanese languages are adjusted
$agent_font_size = '7';
$description_font_size = '6.5';
if ($config['language'] == 'ja' || $config['language'] == 'zh_CN' || $own_info['language'] == 'ja' || $own_info['language'] == 'zh_CN') {
$agent_font_size = '15';
$description_font_size = '11';
}
$url_up_agente = 'index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&group_id='.$ag_group.'&recursion='.$recursion.'&search='.$search.'&os='.$os.'&offset='.$offset.'&sort_field=name&sort=up&disabled=$disabled'; $url_up_agente = 'index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&group_id='.$ag_group.'&recursion='.$recursion.'&search='.$search.'&os='.$os.'&offset='.$offset.'&sort_field=name&sort=up&disabled=$disabled';
$url_down_agente = 'index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&group_id='.$ag_group.'&recursion='.$recursion.'&search='.$search.'&os='.$os.'&offset='.$offset.'&sort_field=name&sort=down&disabled=$disabled'; $url_down_agente = 'index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&group_id='.$ag_group.'&recursion='.$recursion.'&search='.$search.'&os='.$os.'&offset='.$offset.'&sort_field=name&sort=down&disabled=$disabled';
$url_up_remote = 'index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&group_id='.$ag_group.'&recursion='.$recursion.'&search='.$search.'&os='.$os.'&offset='.$offset.'&sort_field=remote&sort=up&disabled=$disabled'; $url_up_remote = 'index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&group_id='.$ag_group.'&recursion='.$recursion.'&search='.$search.'&os='.$os.'&offset='.$offset.'&sort_field=remote&sort=up&disabled=$disabled';
@ -529,7 +537,7 @@ if ($agents !== false) {
} else { } else {
echo '<a alt ='.$agent['nombre']." href='index.php?sec=gagente& echo '<a alt ='.$agent['nombre']." href='index.php?sec=gagente&
sec2=godmode/agentes/configurar_agente&tab=$main_tab& sec2=godmode/agentes/configurar_agente&tab=$main_tab&
id_agente=".$agent['id_agente']."'>".'<span style="font-size: 7pt" title="'.$agent['nombre'].'">'.$agent['alias'].'</span>'.'</a>'; id_agente=".$agent['id_agente']."'>".'<span style="font-size: '.$agent_font_size.'pt" title="'.$agent['nombre'].'">'.$agent['alias'].'</span>'.'</a>';
} }
echo '</strong>'; echo '</strong>';
@ -629,7 +637,7 @@ if ($agents !== false) {
// Group icon and name // Group icon and name
echo "<td class='$tdcolor' align='left' valign='middle'>".ui_print_group_icon($agent['id_grupo'], true).'</td>'; echo "<td class='$tdcolor' align='left' valign='middle'>".ui_print_group_icon($agent['id_grupo'], true).'</td>';
// Description // Description
echo "<td class='".$tdcolor."f9'>".ui_print_truncate_text($agent['comentarios'], 'description', true, true, true, '[&hellip;]', 'font-size: 6.5pt;').'</td>'; echo "<td class='".$tdcolor."f9'>".ui_print_truncate_text($agent['comentarios'], 'description', true, true, true, '[&hellip;]', 'font-size: '.$description_font_size.'pt;').'</td>';
// Action // Action
// When there is only one element in page it's necesary go back page. // When there is only one element in page it's necesary go back page.
if ((count($agents) == 1) && ($offset >= $config['block_size'])) { if ((count($agents) == 1) && ($offset >= $config['block_size'])) {
@ -680,7 +688,7 @@ if ($agents !== false) {
} }
echo '</table>'; 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'>"; echo "<table width='100%'><tr><td align='right'>";
} else { } else {
ui_print_info_message(['no_close' => true, 'message' => __('There are no defined agents') ]); 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']); $cron_interval = explode(' ', $module['cron_interval']);
if (isset($cron_interval[4])) { if (isset($cron_interval[4])) {
$minute_from = $cron_interval[0]; $minute_from = $cron_interval[0];
$min = explode('-', $minute_from); $minute = explode('-', $minute_from);
$minute_from = $min[0]; $minute_from = $minute[0];
if (isset($min[1])) { if (isset($minute[1])) {
$minute_to = $min[1]; $minute_to = $minute[1];
} }
$hour_from = $cron_interval[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 // TODO: Change to the ui_print_error system
echo '<form method="post" id="module_form">'; 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( ui_toggle(
html_print_table($table_advanced, true), 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) function add_component_selection($id_network_component_type)
{ {
global $table_simple; global $table_simple;
global $config;
if ($config['style'] === 'pandora_black') {
$background_row = 'background-color: #444';
} else {
$background_row = 'background-color: #cfcfcf';
}
$data = []; $data = [];
$data[0] = __('Using module component').' '; $data[0] = __('Using module component').' ';
@ -116,7 +123,7 @@ function add_component_selection($id_network_component_type)
$data[1] .= '</span>'; $data[1] .= '</span>';
$table_simple->colspan['module_component'][1] = 3; $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'); prepend_table_simple($data, 'module_component');
} }
@ -134,7 +141,9 @@ $largeClassDisabledBecauseInPolicy = '';
$page = get_parameter('page', ''); $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 ($config['enterprise_installed']) {
if (policies_is_module_linked($id_agent_module) == 1) { if (policies_is_module_linked($id_agent_module) == 1) {
$disabledBecauseInPolicy = 1; $disabledBecauseInPolicy = 1;
@ -162,7 +171,7 @@ $edit_module = (bool) get_parameter_get('edit_module');
$table_simple = new stdClass(); $table_simple = new stdClass();
$table_simple->id = 'simple'; $table_simple->id = 'simple';
$table_simple->width = '100%'; $table_simple->width = '100%';
$table_simple->class = 'databox'; $table_simple->class = 'no-class';
$table_simple->data = []; $table_simple->data = [];
$table_simple->style = []; $table_simple->style = [];
$table_simple->style[0] = 'font-weight: bold; width: 25%;'; $table_simple->style[0] = 'font-weight: bold; width: 25%;';
@ -243,6 +252,12 @@ $table_simple->data[0][3] .= html_print_select_from_sql(
$disabledBecauseInPolicy $disabledBecauseInPolicy
); );
if ((isset($id_agent_module) && $id_agent_module) || $id_policy_module != 0) {
$edit = false;
} else {
$edit = true;
}
$in_policy = strstr($page, 'policy_modules'); $in_policy = strstr($page, 'policy_modules');
if (!$in_policy) { if (!$in_policy) {
// Cannot select the current module to be itself parent // 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] = __('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); $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) { if (!$edit) {
$sql = sprintf( $sql = sprintf(
'SELECT id_tipo, nombre 'SELECT id_tipo, nombre
@ -637,7 +641,7 @@ if ($disabledBecauseInPolicy) {
$table_advanced = new stdClass(); $table_advanced = new stdClass();
$table_advanced->id = 'advanced'; $table_advanced->id = 'advanced';
$table_advanced->width = '100%'; $table_advanced->width = '100%';
$table_advanced->class = 'databox filters'; $table_advanced->class = 'no-class';
$table_advanced->data = []; $table_advanced->data = [];
$table_advanced->style = []; $table_advanced->style = [];
$table_advanced->style[0] = $table_advanced->style[3] = $table_advanced->style[5] = 'font-weight: bold;'; $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 = new stdClass();
$table_macros->id = 'module_macros'; $table_macros->id = 'module_macros';
$table_macros->width = '100%'; $table_macros->width = '100%';
$table_macros->class = 'databox filters'; $table_macros->class = 'no-class';
$table_macros->data = []; $table_macros->data = [];
$table_macros->style = []; $table_macros->style = [];
$table_macros->style[0] = 'font-weight: bold;'; $table_macros->style[0] = 'font-weight: bold;';
@ -1101,20 +1105,20 @@ $macro_count++;
html_print_input_hidden('module_macro_count', $macro_count); html_print_input_hidden('module_macro_count', $macro_count);
/* // Advanced form part.
Advanced form part */ // Add relationships.
// Add relationships
$table_new_relations = new stdClass(); $table_new_relations = new stdClass();
$table_new_relations->id = 'module_new_relations'; $table_new_relations->id = 'module_new_relations';
$table_new_relations->width = '100%'; $table_new_relations->width = '100%';
$table_new_relations->class = 'databox filters'; $table_new_relations->class = 'no-class';
$table_new_relations->data = []; $table_new_relations->data = [];
$table_new_relations->style = []; $table_new_relations->style = [];
$table_new_relations->style[0] = 'width: 10%; font-weight: bold;'; $table_new_relations->style[0] = 'width: 10%; font-weight: bold;';
$table_new_relations->style[1] = 'width: 25%; text-align: center;'; $table_new_relations->style[1] = 'width: 25%; text-align: center;';
$table_new_relations->style[2] = 'width: 10%; font-weight: bold;'; $table_new_relations->style[2] = 'width: 10%; font-weight: bold;';
$table_new_relations->style[3] = 'width: 25%; text-align: center;'; $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'); $table_new_relations->data[0][0] = __('Agent');
$params = []; $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][1] = ui_print_agent_autocomplete_input($params);
$table_new_relations->data[0][2] = __('Module'); $table_new_relations->data[0][2] = __('Module');
$table_new_relations->data[0][3] = "<div id='module_autocomplete'></div>"; $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 = new stdClass();
$table_relations->id = 'module_relations'; $table_relations->id = 'module_relations';
$table_relations->width = '100%'; $table_relations->width = '100%';
@ -1141,19 +1170,26 @@ $table_relations->data = [];
$table_relations->rowstyle = []; $table_relations->rowstyle = [];
$table_relations->rowstyle[-1] = 'display: none;'; $table_relations->rowstyle[-1] = 'display: none;';
$table_relations->style = []; $table_relations->style = [];
$table_relations->style[2] = 'width: 10%; text-align: center;';
$table_relations->style[3] = '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[0] = __('Agent');
$table_relations->head[1] = __('Module'); $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[2] = __('Type');
$table_relations->head[3] = __('Delete'); $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][0] = '';
$table_relations->data[-1][1] = ''; $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][2] = '';
$table_relations->data[-1][3] = '<a id="delete_relation_button" href="">'.html_print_image('images/cross.png', true).'</a>'; $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]); $module_relations = modules_get_relations(['id_module' => $id_agent_module]);
if (!$module_relations) { if (!$module_relations) {
@ -1164,10 +1200,14 @@ $relations_count = 0;
foreach ($module_relations as $key => $module_relation) { foreach ($module_relations as $key => $module_relation) {
if ($module_relation['module_a'] == $id_agent_module) { if ($module_relation['module_a'] == $id_agent_module) {
$module_id = $module_relation['module_b']; $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 { } else {
$module_id = $module_relation['module_a']; $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); $agent_name = ui_print_agent_name($agent_id, true);
@ -1183,14 +1223,16 @@ foreach ($module_relations as $key => $module_relation) {
$disabled_update_class = 'alpha50'; $disabled_update_class = 'alpha50';
} }
// Agent name // Agent name.
$table_relations->data[$relations_count][0] = $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>'; $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 // Type.
$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>'; $table_relations->data[$relations_count][2] = ($module_relation['type'] === 'direct') ? __('Direct') : __('Failover');
// Delete relationship // Lock relationship updates.
$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>'; $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++; $relations_count++;
} }
@ -1198,7 +1240,6 @@ html_print_input_hidden('module_relations_count', $relations_count);
ui_require_jquery_file('json'); ui_require_jquery_file('json');
?> ?>
<script type="text/javascript"> <script type="text/javascript">
@ -1343,8 +1384,6 @@ $(document).ready (function () {
'width=800,height=600' 'width=800,height=600'
); );
} }
} }
if(type_name_selected == 'web_data' || if(type_name_selected == 'web_data' ||
type_name_selected == 'web_proc' || type_name_selected == 'web_proc' ||
@ -1365,8 +1404,6 @@ $(document).ready (function () {
'width=800,height=600' 'width=800,height=600'
); );
} }
} }
} }
@ -1386,7 +1423,7 @@ $(document).ready (function () {
$('#minmax_warning').hide(); $('#minmax_warning').hide();
$('#svg_dinamic').hide(); $('#svg_dinamic').hide();
} }
if (type_name_selected.match(/async/) == null) { if (type_name_selected.match(/async/) == null) {
$('#ff_timeout').hide(); $('#ff_timeout').hide();
$('#ff_timeout_disable').show(); $('#ff_timeout_disable').show();
@ -1396,16 +1433,16 @@ $(document).ready (function () {
$('#ff_timeout_disable').hide(); $('#ff_timeout_disable').hide();
} }
}); });
$("#id_module_type").trigger('change'); $("#id_module_type").trigger('change');
// Prevent the form submission when the user hits the enter button from the relationship autocomplete inputs // Prevent the form submission when the user hits the enter button from the relationship autocomplete inputs
$("#text-autocomplete_agent_name").keydown(function(event) { $("#text-autocomplete_agent_name").keydown(function(event) {
if(event.keyCode == 13) { // key code 13 is the enter button if(event.keyCode == 13) { // key code 13 is the enter button
event.preventDefault(); event.preventDefault();
} }
}); });
//validate post_process. Change ',' by '.' //validate post_process. Change ',' by '.'
$("#submit-updbutton").click (function () { $("#submit-updbutton").click (function () {
validate_post_process(); validate_post_process();
@ -1512,7 +1549,6 @@ function advanced_option_dynamic() {
} else { } else {
$('.hide_dinamic').show(); $('.hide_dinamic').show();
} }
} }
@ -1524,11 +1560,9 @@ function change_modules_autocomplete_input () {
var module_autocomplete = $("#module_autocomplete"); var module_autocomplete = $("#module_autocomplete");
var load_icon = '<?php html_print_image('images/spinner.gif', false); ?>'; var load_icon = '<?php html_print_image('images/spinner.gif', false); ?>';
var error_icon = '<?php html_print_image('images/error_red.png', false); ?>'; var error_icon = '<?php html_print_image('images/error_red.png', false); ?>';
if (!module_autocomplete.hasClass('working')) { if (!module_autocomplete.hasClass('working')) {
module_autocomplete.addClass('working'); module_autocomplete.addClass('working');
module_autocomplete.html(load_icon); module_autocomplete.html(load_icon);
$.ajax({ $.ajax({
type: "POST", type: "POST",
url: "ajax.php", url: "ajax.php",
@ -1563,22 +1597,26 @@ function change_modules_autocomplete_input () {
// Add a new relation // Add a new relation
function add_new_relation () { function add_new_relation () {
var module_a_id = parseInt($("#hidden-id_agent_module").val()); var module_a_id = parseInt(
var module_b_id = parseInt($("#hidden-autocomplete_module_name_hidden").val()); $("#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 module_b_name = $("#text-autocomplete_module_name").val();
var agent_b_name = $("#text-autocomplete_agent_name").val(); var agent_b_name = $("#text-autocomplete_agent_name").val();
var relation_type = $("#relation_type").val();
var hiddenRow = $("#module_relations--1"); var hiddenRow = $("#module_relations--1");
var button = $("#button-add_relation"); var button = $("#button-add_relation");
var iconPlaceholder = $("#add_relation_status"); var iconPlaceholder = $("#add_relation_status");
var load_icon = '<?php html_print_image('images/spinner.gif', false, ['style' => 'vertical-align:middle;']); ?>'; var load_icon = '<?php html_print_image('images/spinner.gif', false, ['style' => 'vertical-align:middle;']); ?>';
var suc_icon = '<?php html_print_image('images/ok.png', false, ['style' => 'vertical-align:middle;']); ?>'; 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;']); ?>'; var error_icon = '<?php html_print_image('images/error_red.png', false, ['style' => 'vertical-align:middle;']); ?>';
if (!button.hasClass('working')) { if (!button.hasClass('working')) {
button.addClass('working'); button.addClass('working');
iconPlaceholder.html(load_icon); iconPlaceholder.html(load_icon);
$.ajax({ $.ajax({
type: "POST", type: "POST",
url: "ajax.php", url: "ajax.php",
@ -1588,7 +1626,8 @@ function add_new_relation () {
add_module_relation: true, add_module_relation: true,
id_module_a: module_a_id, id_module_a: module_a_id,
id_module_b: module_b_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) { success: function (data) {
button.removeClass('working'); button.removeClass('working');
@ -1599,29 +1638,30 @@ function add_new_relation () {
else { else {
iconPlaceholder.html(suc_icon); iconPlaceholder.html(suc_icon);
setTimeout( function() { iconPlaceholder.html(''); }, 2000); setTimeout( function() { iconPlaceholder.html(''); }, 2000);
// Add the new row // Add the new row
var relationsCount = parseInt($("#hidden-module_relations_count").val()); var relationsCount = parseInt($("#hidden-module_relations_count").val());
var rowClass = "datos"; var rowClass = "datos";
if (relationsCount % 2 != 0) { if (relationsCount % 2 != 0) {
rowClass = "datos2"; rowClass = "datos2";
} }
var rowHTML = '<tr id="module_relations-' + relationsCount + '" class="' + rowClass + '">' + 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 + '-0"><b>' + agent_b_name + '</b></td>' +
'<td id="module_relations-' + relationsCount + '-1">' + module_b_name + '</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>' +
'<a id="disable_updates_button" class="alpha50" href="javascript: change_lock_relation(' + relationsCount + ', ' + data + ');">' + '<td id="module_relations-' + relationsCount + '-3" style="width: 10%; text-align: center;">' +
'<?php echo html_print_image('images/lock.png', true); ?>' + '<a id="disable_updates_button" class="alpha50" href="javascript: change_lock_relation(' + relationsCount + ', ' + data + ');">' +
'</a>' + '<?php echo html_print_image('images/lock.png', true); ?>' +
'</td>' + '</a>' +
'<td id="module_relations-' + relationsCount + '-3" style="width: 10%; text-align: center;">' + '</td>' +
'<a id="delete_relation_button" href="javascript: delete_relation(' + relationsCount + ', ' + data + ');">' + '<td id="module_relations-' + relationsCount + '-4" style="width: 10%; text-align: center;">' +
'<?php echo html_print_image('images/cross.png', true); ?>' + '<a id="delete_relation_button" href="javascript: delete_relation(' + relationsCount + ', ' + data + ');">' +
'</a>' + '<?php echo html_print_image('images/cross.png', true); ?>' +
'</td>' + '</a>' +
'</tr>'; '</td>' +
'</tr>';
$("#module_relations").find("tbody").append(rowHTML); $("#module_relations").find("tbody").append(rowHTML);
$("#hidden-module_relations_count").val(relationsCount + 1); $("#hidden-module_relations_count").val(relationsCount + 1);

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> </script>

View File

@ -83,8 +83,8 @@ $data[3] = html_print_input_password(
true, true,
$disabledBecauseInPolicy, $disabledBecauseInPolicy,
false, false,
'', $classdisabledBecauseInPolicy,
$classdisabledBecauseInPolicy 'new-password'
); );
push_table_simple($data, 'user_pass'); push_table_simple($data, 'user_pass');

View File

@ -52,7 +52,7 @@ if ($migrate_malformed) {
// Header. // Header.
ui_print_page_header( ui_print_page_header(
__('Planned Downtime'), __('Scheduled Downtime'),
'images/gm_monitoring.png', 'images/gm_monitoring.png',
false, false,
'planned_downtime', 'planned_downtime',
@ -136,9 +136,6 @@ $table_form = new StdClass();
$table_form->class = 'databox filters'; $table_form->class = 'databox filters';
$table_form->width = '100%'; $table_form->width = '100%';
$table_form->rowstyle = []; $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 = []; $table_form->data = [];
$row = []; $row = [];

View File

@ -37,14 +37,10 @@ $table->head = [];
$table->data = []; $table->data = [];
$table->size = []; $table->size = [];
$table->size = []; $table->size = [];
$table->size[0] = '5%'; $table->style[0] = 'font-weight: bold;';
$table->size[1] = '25%'; $table->style[1] = 'font-weight: bold;display: flex;align-items: baseline;';
$table->size[2] = '5%'; $table->style[2] = 'font-weight: bold;';
$table->size[3] = '20%'; $table->style[3] = 'font-weight: bold;';
$table->style[0] = 'font-weight: bold; ';
$table->style[1] = 'font-weight: bold; ';
$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 // This is because if this view is reused after list alert view then
// styles in the previous view can affect this table. // styles in the previous view can affect this table.
@ -89,7 +85,7 @@ $table->data[0][1] = html_print_select(
true, true,
'', '',
($id_agente == 0), ($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="latest_value" class="invisible">'.__('Latest value').': ';
$table->data[0][1] .= '<span id="value">&nbsp;</span></span>'; $table->data[0][1] .= '<span id="value">&nbsp;</span></span>';
@ -117,7 +113,7 @@ $table->data[1][1] = html_print_select(
true, true,
'', '',
false, false,
'width: 250px;' 'min-width: 250px;'
); );
$table->data[1][1] .= '<span id="advanced_action" class="advanced_actions invisible"><br>'; $table->data[1][1] .= '<span id="advanced_action" class="advanced_actions invisible"><br>';
$table->data[1][1] .= __('Number of alerts match from').' '; $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>'; $table->data[1][1] .= '</span>';
if (check_acl($config['id_user'], 0, 'LM')) { 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] .= 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>'; $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')) { 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] .= '<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] .= 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[2][1] .= '</a>';
} }
$table->data[3][0] = __('Threshold'); $table->data[3][0] = __('Threshold');
$table->data[3][1] = html_print_input_text('module_action_threshold', '0', '', 5, 7, true); $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)) { if (!isset($step)) {
echo '<form class="add_alert_form" method="post">'; echo '<form class="add_alert_form" method="post">';

View File

@ -438,11 +438,11 @@ if (! $id_agente) {
$table->style = []; $table->style = [];
$table->style[0] = 'font-weight: bold;'; $table->style[0] = 'font-weight: bold;';
$table->head[0] = __('Agent').ui_get_sorting_arrows($url_up_agente, $url_down_agente, $selectAgentUp, $selectAgentDown); $table->head[0] = __('Agent').ui_get_sorting_arrows($url_up_agente, $url_down_agente, $selectAgentUp, $selectAgentDown);
$table->size[0] = '4%'; $table->headstyle[0] = 'width: 100%; min-width: 12em;';
$table->size[1] = '8%'; $table->headstyle[1] = 'min-width: 15em;';
$table->size[2] = '8%'; $table->headstyle[2] = 'min-width: 20em;';
$table->size[3] = '4%'; $table->headstyle[3] = 'min-width: 1em;';
$table->size[4] = '4%'; $table->headstyle[4] = 'min-width: 15em;';
/* /*
if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK) { if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK) {
@ -450,16 +450,11 @@ if (! $id_agente) {
}*/ }*/
} else { } else {
$table->head[0] = __('Module').ui_get_sorting_arrows($url_up_module, $url_down_module, $selectModuleUp, $selectModuleDown); $table->head[0] = __('Module').ui_get_sorting_arrows($url_up_module, $url_down_module, $selectModuleUp, $selectModuleDown);
// Different sizes or the layout screws up $table->headstyle[0] = 'width: 100%; min-width: 15em;';
$table->size[0] = '0%'; $table->headstyle[1] = 'min-width: 15em;';
$table->size[1] = '10%'; $table->headstyle[2] = 'min-width: 20em;';
$table->size[2] = '30%'; $table->headstyle[3] = 'min-width: 1em;';
/* $table->headstyle[4] = 'min-width: 15em;';
if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK) {
$table->size[4] = '25%';
} */
$table->size[3] = '1%';
$table->size[4] = '1%';
} }
$table->head[1] = __('Template').ui_get_sorting_arrows($url_up_template, $url_down_template, $selectTemplateUp, $selectTemplateDown); $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)."'"; ?>, jQuery.post (<?php echo "'".ui_get_full_url('ajax.php', false, false, false)."'"; ?>,
values, values,
function (data, status) { function (data, status) {
original_command = js_html_entity_decode (data["command"]); original_command = data["command"];
render_command_preview (original_command); render_command_preview (original_command);
command_description = js_html_entity_decode (data["description"]); command_description = data["description"];
render_command_description(command_description); render_command_description(command_description);
var max_fields = parseInt('<?php echo $config['max_macro_fields']; ?>'); var max_fields = parseInt('<?php echo $config['max_macro_fields']; ?>');

View File

@ -60,96 +60,12 @@ $fields_selected = explode(',', $config['event_fields']);
$result_selected = []; $result_selected = [];
// show list of fields selected. // Show list of fields selected.
if ($fields_selected[0] != '') { if ($fields_selected[0] != '') {
foreach ($fields_selected as $field_selected) { foreach ($fields_selected as $field_selected) {
switch ($field_selected) { $result_selected[$field_selected] = events_get_column_name(
case 'id_evento': $field_selected
$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;
} }
} }
@ -177,7 +93,8 @@ $fields_available = [];
$fields_available['id_evento'] = __('Event Id'); $fields_available['id_evento'] = __('Event Id');
$fields_available['evento'] = __('Event Name'); $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_usuario'] = __('User');
$fields_available['id_grupo'] = __('Group'); $fields_available['id_grupo'] = __('Group');
$fields_available['estado'] = __('Status'); $fields_available['estado'] = __('Status');
@ -196,20 +113,20 @@ $fields_available['instructions'] = __('Instructions');
$fields_available['server_name'] = __('Server Name'); $fields_available['server_name'] = __('Server Name');
$fields_available['data'] = __('Data'); $fields_available['data'] = __('Data');
$fields_available['module_status'] = __('Module Status'); $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 ($fields_available as $key => $available) {
foreach ($result_selected as $selected) { if (isset($result_selected[$key])) {
if ($selected == $available) { unset($fields_available[$key]);
unset($fields_available[$key]);
}
} }
} }
$table->data[0][0] = '<b>'.__('Fields available').'</b>'; $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][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( $table->data[1][1] = '<a href="javascript:">'.html_print_image(
'images/darrowright.png', 'images/darrowright_green.png',
true, true,
[ [
'id' => 'right', 'id' => 'right',
@ -217,7 +134,7 @@ $table->data[1][1] = '<a href="javascript:">'.html_print_image(
] ]
).'</a>'; ).'</a>';
$table->data[1][1] .= '<br><br><br><br><a href="javascript:">'.html_print_image( $table->data[1][1] .= '<br><br><br><br><a href="javascript:">'.html_print_image(
'images/darrowleft.png', 'images/darrowleft_green.png',
true, true,
[ [
'id' => 'left', 'id' => 'left',

View File

@ -232,10 +232,17 @@ $table->data[0][0] = '<b>'.__('Filter name').'</b>';
$table->data[0][1] = html_print_input_text('id_name', $id_name, false, 20, 80, true); $table->data[0][1] = html_print_input_text('id_name', $id_name, false, 20, 80, true);
$table->data[1][0] = '<b>'.__('Save in group').'</b>'.ui_print_help_tip(__('This group will be use to restrict the visibility of this filter with ACLs'), true); $table->data[1][0] = '<b>'.__('Save in group').'</b>'.ui_print_help_tip(__('This group will be use to restrict the visibility of this filter with ACLs'), true);
$returnAllGroup = users_can_manage_group_all();
// If the user can't manage All group but the filter is for All group, the user should see All group in the select.
if ($returnAllGroup === false && $id_group_filter == 0) {
$returnAllGroup = true;
}
$table->data[1][1] = html_print_select_groups( $table->data[1][1] = html_print_select_groups(
$config['id_user'], $config['id_user'],
$access, $access,
users_can_manage_group_all(), $returnAllGroup,
'id_group_filter', 'id_group_filter',
$id_group_filter, $id_group_filter,
'', '',

View File

@ -93,10 +93,11 @@ if ($strict_acl) {
users_can_manage_group_all() users_can_manage_group_all()
); );
} else { } else {
// All users should see the filters with the All group.
$groups_user = users_get_groups( $groups_user = users_get_groups(
$config['id_user'], $config['id_user'],
$access, $access,
users_can_manage_group_all(), true,
true true
); );
} }

View File

@ -143,12 +143,12 @@ $table->data[3] = $data;
$data = []; $data = [];
$data[0] = '<span id="command_label" class="labels">'.__('Command').'</span><span id="url_label" style="display:none;" class="labels">'.__('URL').'</span>'.ui_print_help_icon('response_macros', true); $data[0] = '<span id="command_label" class="labels">'.__('Command').'</span><span id="url_label" style="display:none;" class="labels">'.__('URL').'</span>'.ui_print_help_icon('response_macros', true);
$data[1] = html_print_input_text( $data[1] = html_print_textarea(
'target', 'target',
3,
1,
$event_response['target'], $event_response['target'],
'', 'style="min-height:initial;"',
100,
255,
true true
); );

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>', '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'] = [
$buttons['fields'] = [ 'active' => false,
'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>',
'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) { switch ($section) {

View File

@ -357,8 +357,8 @@ function addConnectionMap() {
for (var index in connectionMaps) { for (var index in connectionMaps) {
if (isInt(index)) { if (isInt(index)) {
if (connectionMaps[index] == idConnectionMap) { if (connectionMaps[index] == idConnectionMap) {
alert("<?php echo __('The connection'); ?> "' + connectionMapName + '" <?php echo __('just added previously.'); ?>"); alert("<?php echo __('The connection'); ?> " + connectionMapName + " <?php echo __('just added previously.'); ?>");
return; return;
} }
} }

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 <?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 // Begin.
// ==================================================
// 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.
ui_require_css_file('tree'); ui_require_css_file('tree');
ui_require_css_file('fixed-bottom-box'); ui_require_css_file('fixed-bottom-box');
// Load global vars // Load global vars.
global $config; global $config;
check_login(); check_login();
@ -76,15 +92,17 @@ if (is_ajax()) {
$recursion = (int) get_parameter('recursion', 0); $recursion = (int) get_parameter('recursion', 0);
$privilege = (string) get_parameter('privilege', ''); $privilege = (string) get_parameter('privilege', '');
$all_agents = (int) get_parameter('all_agents', 0); $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', ''); $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 // This attr is for the operation "bulk alert accions add", it controls
// from db // the query that take the agents from db.
$add_alert_bulk_op = get_parameter('add_alert_bulk_op', false); $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', ''); $filter_agents_json = (string) get_parameter('filter_agents_json', '');
$status_agents = (int) get_parameter('status_agents', AGENT_STATUS_ALL); $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); $show_void_agents = (int) get_parameter('show_void_agents', 1);
$serialized = (bool) get_parameter('serialized', false); $serialized = (bool) get_parameter('serialized', false);
$serialized_separator = (string) get_parameter('serialized_separator', '|'); $serialized_separator = (string) get_parameter('serialized_separator', '|');
@ -121,7 +139,7 @@ if (is_ajax()) {
$filter['status'] = $status_agents; $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 '; $_sql_post = ' 1=1 ';
if ($show_void_agents == 0) { 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\''; $_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; $id_groups_get_agents = $id_group;
if ($id_group == 0 && $privilege != '') { if ($id_group == 0 && $privilege != '') {
$groups = users_get_groups($config['id_user'], $privilege, false); $groups = users_get_groups($config['id_user'], $privilege, false);
// if group ID doesn't matter and $privilege is specified (like 'AW'), // If group ID doesn't matter and $privilege is specified
// retruns all agents that current user has $privilege privilege for. // (like 'AW'), retruns all agents that current user has $privilege
// privilege for.
$id_groups_get_agents = array_keys($groups); $id_groups_get_agents = array_keys($groups);
} }
@ -149,13 +168,13 @@ if (is_ajax()) {
); );
$agents_disabled = []; $agents_disabled = [];
// Add keys prefix // Add keys prefix.
if ($keys_prefix !== '') { if ($keys_prefix !== '') {
foreach ($agents as $k => $v) { foreach ($agents as $k => $v) {
$agents[$keys_prefix.$k] = $v; $agents[$keys_prefix.$k] = $v;
unset($agents[$k]); unset($agents[$k]);
if ($all_agents) { if ($all_agents) {
// Unserialize to get the status // Unserialize to get the status.
if ($serialized && is_metaconsole()) { if ($serialized && is_metaconsole()) {
$agent_info = explode($serialized_separator, $k); $agent_info = explode($serialized_separator, $k);
$agent_disabled = db_get_value_filter( $agent_disabled = db_get_value_filter(
@ -174,7 +193,8 @@ if (is_ajax()) {
['id_agente' => $agent_info[1]] ['id_agente' => $agent_info[1]]
); );
} else if (!$serialized && is_metaconsole()) { } 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; $agent_disabled = 0;
} else { } else {
$agent_disabled = db_get_value_filter( $agent_disabled = db_get_value_filter(
@ -226,11 +246,13 @@ if (! check_acl($config['id_user'], 0, 'PM')) {
} }
$sec = defined('METACONSOLE') ? 'advanced' : 'gagente'; $sec = defined('METACONSOLE') ? 'advanced' : 'gagente';
$url_tree = "index.php?sec=$sec&sec2=godmode/groups/group_list&tab=tree"; $url_credbox = 'index.php?sec='.$sec.'&sec2=godmode/groups/group_list&tab=credbox';
$url_groups = "index.php?sec=$sec&sec2=godmode/groups/group_list&tab=groups"; $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'] = [ $buttons['tree'] = [
'active' => false, 'active' => false,
'text' => "<a href='$url_tree'>".html_print_image( 'text' => '<a href="'.$url_tree.'">'.html_print_image(
'images/gm_massive_operations.png', 'images/gm_massive_operations.png',
true, true,
[ [
@ -241,7 +263,7 @@ $buttons['tree'] = [
$buttons['groups'] = [ $buttons['groups'] = [
'active' => false, 'active' => false,
'text' => "<a href='$url_groups'>".html_print_image( 'text' => '<a href="'.$url_groups.'">'.html_print_image(
'images/group.png', 'images/group.png',
true, true,
[ [
@ -250,21 +272,38 @@ $buttons['groups'] = [
).'</a>', ).'</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'); $tab = (string) get_parameter('tab', 'groups');
// Marks correct tab $title = __('Groups defined in %s', get_product_name());
// Marks correct tab.
switch ($tab) { switch ($tab) {
case 'tree': case 'tree':
$buttons['tree']['active'] = true; $buttons['tree']['active'] = true;
break; break;
case 'credbox':
$buttons['credbox']['active'] = true;
$title = __('Credential store');
break;
case 'groups': case 'groups':
default: default:
$buttons['groups']['active'] = true; $buttons['groups']['active'] = true;
break; break;
} }
// Header // Header.
if (defined('METACONSOLE')) { if (defined('METACONSOLE')) {
agents_meta_print_header(); agents_meta_print_header();
echo '<div class="notify">'; echo '<div class="notify">';
@ -272,7 +311,7 @@ if (defined('METACONSOLE')) {
echo '</div>'; echo '</div>';
} else { } else {
ui_print_page_header( ui_print_page_header(
__('Groups defined in %s', get_product_name()), $title,
'images/group.png', 'images/group.png',
false, false,
'group_list_tab', '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'); $create_group = (bool) get_parameter('create_group');
$update_group = (bool) get_parameter('update_group'); $update_group = (bool) get_parameter('update_group');
$delete_group = (bool) get_parameter('delete_group'); $delete_group = (bool) get_parameter('delete_group');
$pure = get_parameter('pure', 0); $pure = get_parameter('pure', 0);
// Create group // Create group.
if (($create_group) && (check_acl($config['id_user'], 0, 'PM'))) { if (($create_group) && (check_acl($config['id_user'], 0, 'PM'))) {
$name = (string) get_parameter('name'); $name = (string) get_parameter('name');
$icon = (string) get_parameter('icon'); $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); $check = db_get_value('nombre', 'tgrupo', 'nombre', $name);
$propagate = (bool) get_parameter('propagate'); $propagate = (bool) get_parameter('propagate');
// Check if name field is empty // Check if name field is empty.
if ($name != '') { if ($name != '') {
if (!$check) { if (!$check) {
$values = [ $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')); ui_print_error_message(__('Each group must have a different name'));
} }
} else { } else {
// $result = false;
ui_print_error_message(__('Group must have a name')); ui_print_error_message(__('Group must have a name'));
} }
} }
// Update group // Update group.
if ($update_group) { if ($update_group) {
$id_group = (int) get_parameter('id_group'); $id_group = (int) get_parameter('id_group');
$name = (string) get_parameter('name'); $name = (string) get_parameter('name');
@ -349,49 +394,35 @@ if ($update_group) {
$contact = (string) get_parameter('contact'); $contact = (string) get_parameter('contact');
$other = (string) get_parameter('other'); $other = (string) get_parameter('other');
// Check if name field is empty // Check if name field is empty.
if ($name != '') { if ($name != '') {
switch ($config['dbtype']) { $sql = sprintf(
case 'mysql': 'UPDATE tgrupo
$sql = sprintf( SET nombre = "%s",
'UPDATE tgrupo SET nombre = "%s", icon = "%s",
icon = "%s", disabled = %d, parent = %d, custom_id = "%s", propagate = %d, id_skin = %d, description = "%s", contact = "%s", other = "%s", password = "%s" disabled = %d,
WHERE id_grupo = %d', parent = %d,
$name, custom_id = "%s",
empty($icon) ? '' : substr($icon, 0, -4), propagate = %d,
!$alerts_enabled, id_skin = %d,
$id_parent, description = "%s",
$custom_id, contact = "%s",
$propagate, other = "%s",
$skin, password = "%s"
$description, WHERE id_grupo = %d',
$contact, $name,
$other, empty($icon) ? '' : substr($icon, 0, -4),
$group_pass, !$alerts_enabled,
$id_group $id_parent,
); $custom_id,
break; $propagate,
$skin,
case 'postgresql': $description,
case 'oracle': $contact,
$sql = sprintf( $other,
'UPDATE tgrupo SET nombre = \'%s\', $group_pass,
icon = \'%s\', disabled = %d, parent = %d, custom_id = \'%s\', propagate = %d, id_skin = %d, description = \'%s\', contact = \'%s\', other = \'%s\' $id_group
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); $result = db_process_sql($sql);
} else { } else {
@ -405,7 +436,7 @@ if ($update_group) {
} }
} }
// Delete group // Delete group.
if (($delete_group) && (check_acl($config['id_user'], 0, 'PM'))) { if (($delete_group) && (check_acl($config['id_user'], 0, 'PM'))) {
$id_group = (int) get_parameter('id_group'); $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') { if ($tab == 'tree') {
/*
* Group tree view.
*/
echo html_print_image( echo html_print_image(
'images/spinner.gif', 'images/spinner.gif',
true, true,
@ -456,6 +494,10 @@ if ($tab == 'tree') {
); );
echo "<div id='tree-controller-recipient'></div>"; echo "<div id='tree-controller-recipient'></div>";
} else { } else {
/*
* Group list view.
*/
$acl = ''; $acl = '';
$search_name = ''; $search_name = '';
$offset = (int) get_parameter('offset', 0); $offset = (int) get_parameter('offset', 0);
@ -463,17 +505,22 @@ if ($tab == 'tree') {
$block_size = $config['block_size']; $block_size = $config['block_size'];
if (!empty($search)) { if (!empty($search)) {
$search_name = "AND t.nombre LIKE '%$search%'"; $search_name = 'AND t.nombre LIKE "%'.$search.'%"';
} }
if (!users_can_manage_group_all('AR')) { if (!users_can_manage_group_all('AR')) {
$user_groups_acl = users_get_groups(false, 'AR'); $user_groups_acl = users_get_groups(false, 'AR');
$groups_acl = implode(',', $user_groups_ACL); $groups_acl = implode(',', $user_groups_ACL);
if (empty($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=''>"; $form = "<form method='post' action=''>";
@ -488,29 +535,37 @@ if ($tab == 'tree') {
echo $form; echo $form;
$groups_sql = "SELECT t.*, $groups_sql = sprintf(
'SELECT t.*,
p.nombre AS parent_name, p.nombre AS parent_name,
IF(t.parent=p.id_grupo, 1, 0) AS has_child IF(t.parent=p.id_grupo, 1, 0) AS has_child
FROM tgrupo t FROM tgrupo t
LEFT JOIN tgrupo p LEFT JOIN tgrupo p
ON t.parent=p.id_grupo ON t.parent=p.id_grupo
WHERE 1=1 WHERE 1=1
$acl %s
$search_name %s
ORDER BY nombre ORDER BY nombre
LIMIT $offset, $block_size LIMIT %d, %d',
"; $acl,
$search_name,
$offset,
$block_size
);
$groups = db_get_all_rows_sql($groups_sql); $groups = db_get_all_rows_sql($groups_sql);
if (!empty($groups)) { if (!empty($groups)) {
// Count all groups for pagination only saw user and filters // Count all groups for pagination only saw user and filters.
$groups_sql_count = "SELECT count(*) $groups_sql_count = sprintf(
'SELECT count(*)
FROM tgrupo t FROM tgrupo t
WHERE 1=1 WHERE 1=1
$acl %s
$search_name %s',
"; $acl,
$search_name
);
$groups_count = db_get_value_sql($groups_sql_count); $groups_count = db_get_value_sql($groups_sql_count);
$table = new StdClass(); $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 = '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']; $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][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'] != '') { if ($group['icon'] != '') {
$table->data[$key][2] = html_print_image( $table->data[$key][2] = html_print_image(
'images/groups_small/'.$group['icon'].'.png', 'images/groups_small/'.$group['icon'].'.png',
@ -553,22 +608,25 @@ if ($tab == 'tree') {
[ [
'style' => '', 'style' => '',
'class' => 'bot', 'class' => 'bot',
'alt' => $group['nombre'], 'alt' => $group['nombre'],
'title' => $group['nombre'], 'title' => $group['nombre'],
false, false, false, true ],
] false,
false,
false,
true
); );
} else { } else {
$table->data[$key][2] = ''; $table->data[$key][2] = '';
} }
// reporting_get_group_stats // Reporting_get_group_stats.
$table->data[$key][3] = $group['disabled'] ? __('Disabled') : __('Enabled'); $table->data[$key][3] = ($group['disabled']) ? __('Disabled') : __('Enabled');
$table->data[$key][4] = $group['parent_name']; $table->data[$key][4] = $group['parent_name'];
$table->data[$key][5] = $group['description']; $table->data[$key][5] = $group['description'];
$table->cellclass[$key][6] = 'action_buttons'; $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', 'images/config.png',
true, true,
[ [

View File

@ -84,7 +84,9 @@ if ($create_profiles) {
); );
} }
html_print_table($table); if ($table !== null) {
html_print_table($table);
}
unset($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] .= html_print_label(__('Copy alerts'), 'checkbox-copy_alerts', true);
$table->data['operations'][1] .= '</span>'; $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][0] = __('Modules');
$table->data[1][1] = '<span class="with_modules'.(empty($modules) ? ' invisible' : '').'">'; $table->data[1][1] = '<span class="with_modules'.(empty($modules) ? ' invisible' : '').'">';
$table->data[1][1] .= html_print_select( $table->data[1][1] .= html_print_select(
@ -270,6 +273,9 @@ $table->data[1][1] = html_print_select(
true 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] = __('Agent');
$table->data[2][0] .= '<span id="destiny_agent_loading" class="invisible">'; $table->data[2][0] .= '<span id="destiny_agent_loading" class="invisible">';
$table->data[2][0] .= html_print_image('images/spinner.png', true); $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('form');
ui_require_jquery_file('pandora.controls'); ui_require_jquery_file('pandora.controls');
?> ?>
<script type="text/javascript" src="include/javascript/pandora_modules.js"></script>
<script type="text/javascript"> <script type="text/javascript">
/* <![CDATA[ */ /* <![CDATA[ */
var module_alerts; var module_alerts;
@ -349,6 +357,11 @@ $(document).ready (function () {
/* Hide source agent */ /* Hide source agent */
var selected_agent = $("#source_id_agent").val(); var selected_agent = $("#source_id_agent").val();
$("#destiny_id_agent option[value='" + selected_agent + "']").remove(); $("#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 (); $("#fieldset_destiny").hide ();
$("span.without_modules, span.without_alerts").show (); $("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 { else {
if (no_modules) { if (no_modules) {
$("span.without_modules").show (); $("span.without_modules").show ();
$("span.with_modules").hide (); $("span.with_modules").hide ();
$("#checkbox-copy_modules").uncheck (); $("#checkbox-copy_modules").uncheck ();
$("#target_table-form_modules_filter").hide ();
} }
else { else {
$("span.without_modules").hide (); $("span.without_modules").hide ();
@ -474,10 +488,13 @@ $(document).ready (function () {
$("span.with_alerts").show (); $("span.with_alerts").show ();
$("#checkbox-copy_alerts").check (); $("#checkbox-copy_alerts").check ();
} }
$("#fieldset_destiny, #target_table-operations").show (); $("#fieldset_destiny, #target_table-operations, #target_table-form_modules_filter").show ();
} }
$("#fieldset_targets").show (); $("#fieldset_targets").show ();
$("#target_modules, #target_alerts").enable (); $("#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" "json"
); );

View File

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

View File

@ -429,6 +429,11 @@ $table->data['form_modules_3'][1] = html_print_select(
); );
$table->data['form_modules_3'][3] = ''; $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->rowstyle['form_modules_2'] = 'vertical-align: top;';
$table->rowclass['form_modules_2'] = 'select_modules_row select_modules_row_2'; $table->rowclass['form_modules_2'] = 'select_modules_row select_modules_row_2';
$table->data['form_modules_2'][0] = __('Modules'); $table->data['form_modules_2'][0] = __('Modules');
@ -496,6 +501,11 @@ $table->data['form_agents_4'][1] = html_print_select(
true 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->rowstyle['form_agents_3'] = 'vertical-align: top;';
$table->rowclass['form_agents_3'] = 'select_agents_row select_agents_row_2'; $table->rowclass['form_agents_3'] = 'select_agents_row select_agents_row_2';
$table->data['form_agents_3'][0] = __('Agents'); $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"> <script type="text/javascript">
/* <![CDATA[ */ /* <![CDATA[ */
@ -650,6 +661,9 @@ $(document).ready (function () {
}); });
$("#module_loading").hide(); $("#module_loading").hide();
$("#module_name").removeAttr ("disabled"); $("#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" "json"
); );
@ -754,6 +768,9 @@ $(document).ready (function () {
.html (value["alias"]); .html (value["alias"]);
$("#id_agents").append (option); $("#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" "json"
); );

View File

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

View File

@ -170,6 +170,8 @@ if ($update_agents) {
$n_edited = 0; $n_edited = 0;
$result = false; $result = false;
foreach ($id_agents as $id_agent) { foreach ($id_agents as $id_agent) {
$old_interval_value = db_get_value_filter('intervalo', 'tagente', ['id_agente' => $id_agent]);
if (!empty($values)) { if (!empty($values)) {
$group_old = false; $group_old = false;
$disabled_old = false; $disabled_old = false;
@ -196,6 +198,18 @@ if ($update_agents) {
$result_metaconsole = agent_update_from_cache($id_agent, $values, $server_name); $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']) { if ($disabled_old !== false && $disabled_old != $values['disabled']) {
enterprise_hook( enterprise_hook(
'config_agents_update_config_token', 'config_agents_update_config_token',
@ -686,7 +700,7 @@ if ($fields === false) {
foreach ($fields as $field) { foreach ($fields as $field) {
$data[0] = '<b>'.$field['name'].'</b>'; $data[0] = '<b>'.$field['name'].'</b>';
$data[0] .= ui_print_help_tip( $data[0] .= ui_print_help_tip(
__('This field allows url insertion using the BBCode\'s url tag').'.<br />'.__('The format is: [url=\'url to navigate\']\'text to show\'[/url]').'.<br /><br />'.__('e.g.: [url=google.com]Google web search[/url]'), __('This field allows url insertion using the BBCode\'s url tag').'.<br />'.__('The format is: [url=\'url to navigate\']\'text to show\'[/url] or [url]\'url to navigate\'[/url] ').'.<br /><br />'.__('e.g.: [url=google.com]Google web search[/url] or [url]www.goole.com[/url]'),
true true
); );
$combo = []; $combo = [];

View File

@ -388,6 +388,11 @@ $table->data['form_modules_4'][1] = html_print_select(
true 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->rowstyle['form_modules_2'] = 'vertical-align: top;';
$table->rowclass['form_modules_2'] = 'select_modules_row select_modules_row_2'; $table->rowclass['form_modules_2'] = 'select_modules_row select_modules_row_2';
$table->data['form_modules_2'][0] = __('Modules'); $table->data['form_modules_2'][0] = __('Modules');
@ -468,6 +473,11 @@ $table->data['form_agents_4'][1] = html_print_select(
true 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->rowstyle['form_agents_3'] = 'vertical-align: top;';
$table->rowclass['form_agents_3'] = 'select_agents_row select_agents_row_2'; $table->rowclass['form_agents_3'] = 'select_agents_row select_agents_row_2';
$table->data['form_agents_3'][0] = __('Agents'); $table->data['form_agents_3'][0] = __('Agents');
@ -1247,6 +1257,9 @@ $(document).ready (function () {
}); });
$("#module_loading").hide (); $("#module_loading").hide ();
$("#module_name").removeAttr ("disabled"); $("#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" "json"
); );
@ -1630,6 +1643,9 @@ $(document).ready (function () {
.html(value["alias"]); .html(value["alias"]);
$("#id_agents").append (option); $("#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" "json"
); );

View File

@ -725,7 +725,6 @@ echo '</form>';
} }
}); });
$modulesSelect.change();
} }
var processGet = function (params, callback) { var processGet = function (params, callback) {

View File

@ -24,9 +24,24 @@ $menu_godmode['class'] = 'godmode';
if (check_acl($config['id_user'], 0, 'PM')) { if (check_acl($config['id_user'], 0, 'PM')) {
$sub = []; $sub = [];
$sub['godmode/servers/discovery']['text'] = __('Discovery'); $sub['godmode/servers/discovery&wiz=main']['text'] = __('Main');
$sub['godmode/servers/discovery']['id'] = 'Discovery'; $sub['godmode/servers/discovery&wiz=main']['id'] = 'Discovery';
$sub['godmode/servers/discovery']['subsecs'] = ['godmode/servers/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. // Add to menu.
$menu_godmode['discovery']['text'] = __('Discovery'); $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'; $sub['godmode/modules/manage_network_templates']['id'] = 'Module templates';
enterprise_hook('inventory_submenu'); enterprise_hook('inventory_submenu');
enterprise_hook('autoconfiguration_menu'); enterprise_hook('autoconfiguration_menu');
enterprise_hook('agent_repository_menu');
} }
if (check_acl($config['id_user'], 0, 'AW')) { 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 // Servers
$menu_godmode['gservers']['text'] = __('Servers'); $menu_godmode['gservers']['text'] = __('Servers');
$menu_godmode['gservers']['sec2'] = 'godmode/servers/modificar_server'; $menu_godmode['gservers']['sec2'] = 'godmode/servers/modificar_server';
@ -418,9 +434,11 @@ if (is_array($config['extensions'])) {
$sub['godmode/extensions']['type'] = 'direct'; $sub['godmode/extensions']['type'] = 'direct';
$sub['godmode/extensions']['subtype'] = 'nolink'; $sub['godmode/extensions']['subtype'] = 'nolink';
$submenu = array_merge($menu_godmode['gextensions']['sub'], $sub); if (is_array($menu_godmode['gextensions']['sub'])) {
if ($menu_godmode['gextensions']['sub'] != null) { $submenu = array_merge($menu_godmode['gextensions']['sub'], $sub);
$menu_godmode['gextensions']['sub'] = $submenu; if ($menu_godmode['gextensions']['sub'] != null) {
$menu_godmode['gextensions']['sub'] = $submenu;
}
} }
} }

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;">'; echo '<div class="" style="float:right;">';
html_print_input_hidden('new', 1); html_print_input_hidden('new', 1);
html_print_submit_button(__('Create'), 'crt', false, 'class="sub next"'); 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')) { if (defined('METACONSOLE')) {
components_meta_print_header(); components_meta_print_header();
$sec = 'advanced'; $sec = 'advanced';
$id_modulo = (int) get_parameter('id_component_type');
$new_component = (bool) get_parameter('new_component');
} else { } else {
/* /*
Hello there! :) Hello there! :)

View File

@ -1,17 +1,32 @@
<?php <?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; global $config;
check_login(); check_login();
@ -29,7 +44,7 @@ $data[1] = html_print_select_from_sql(
false, false,
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[1] .= html_print_input_hidden('macros', base64_encode($macros), true);
$data[2] = __('Post process'); $data[2] = __('Post process');
$data[3] = html_print_extended_select_for_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'); 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 = [];
$data[0] = 'macro_desc'; $data[0] = 'macro_desc';
$data[0] .= ui_print_help_tip('macro_help', true); $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'); 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)) { if (!empty($macros)) {
$macros = json_decode($macros, true); $macros = json_decode($macros, true);
@ -68,9 +83,23 @@ if (!empty($macros)) {
} }
if ($m['hide'] == 1) { 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 { } 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; $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 "<table width='100%' cellpadding=4 cellspacing=4 class='databox filters'>";
echo '<tr>'; echo '<tr>';
echo '<td>'; echo '<td>';
echo ui_toggle($single_table, 'Simple module graph', '', true, true); echo ui_toggle($single_table, 'Simple module graph', '', '', true);
echo '</td>'; echo '</td>';
echo '</tr>'; echo '</tr>';
echo '</table>'; echo '</table>';
@ -466,7 +466,7 @@ if ($edit_container) {
echo "<table width='100%' cellpadding=4 cellspacing=4 class='databox filters'>"; echo "<table width='100%' cellpadding=4 cellspacing=4 class='databox filters'>";
echo '<tr>'; echo '<tr>';
echo '<td>'; 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 '</td>';
echo '</tr>'; echo '</tr>';
echo '</table>'; echo '</table>';
@ -561,7 +561,7 @@ if ($edit_container) {
echo "<table width='100%' cellpadding=4 cellspacing=4 class='databox filters'>"; echo "<table width='100%' cellpadding=4 cellspacing=4 class='databox filters'>";
echo '<tr>'; echo '<tr>';
echo '<td>'; 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 '</td>';
echo '</tr>'; echo '</tr>';
echo '</table>'; echo '</table>';

View File

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

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