Merge branch 'develop' into 'ent-6643-show-summary-vmware'

# Conflicts:
#   pandora_console/godmode/wizards/DiscoveryTaskList.class.php
This commit is contained in:
José González 2020-12-23 06:49:42 +01:00
commit 908e5cf7ef
197 changed files with 40132 additions and 3186 deletions

View File

@ -3,309 +3,321 @@ var isFetching = null;
var storedEvents = new Array();
var notVisited = {};
$(window).on('load', function() {
initilise();
// Wait some ms to throw main function
var delay = setTimeout(main, 100);
resetInterval();
$(window).on("load", function() {
initilise();
// Wait some ms to throw main function
var delay = setTimeout(main, 100);
resetInterval();
});
function fetchEvents() {
return storedEvents;
return storedEvents;
}
function fetchNotVisited() {
return notVisited;
return notVisited;
}
function removeNotVisited(eventId) {
if (notVisited[eventId] === true) delete notVisited[eventId];
if (notVisited[eventId] === true) delete notVisited[eventId];
}
function main() {
chrome.runtime.sendMessage({ text: "FETCH_EVENTS" });
// Do not fetch if is fetching now
if (isFetching) return;
isFetching = true;
chrome.runtime.sendMessage({text: "FETCH_EVENTS"});
// Do not fetch if is fetching now
if (isFetching) return;
isFetching = true;
var url =
localStorage["ip_address"] +
"/include/api.php?op=get&op2=events&return_type=json";
var feedUrl = url;
var data = new FormData();
var feedUrl = localStorage["ip_address"]+'/include/api.php?op=get&op2=events&return_type=json&apipass='+localStorage["api_pass"]+'&user='+localStorage["user_name"]+'&pass='+localStorage["pass"];
data.append("apipass", localStorage["api_pass"]);
data.append("user", localStorage["user_name"]);
data.append("pass", localStorage["pass"]);
req = new XMLHttpRequest();
req.onload = handleResponse;
req.onerror = handleError;
req.open("GET", feedUrl, true);
req.withCredentials = true
req.send(null);
req = new XMLHttpRequest();
req.onload = handleResponse;
req.onerror = handleError;
req.open("POST", feedUrl, true);
req.withCredentials = true;
req.send(data);
}
function handleError() {
chrome.runtime.sendMessage({text: "FETCH_EVENTS_URL_ERROR"});
isFetching = false;
chrome.runtime.sendMessage({ text: "FETCH_EVENTS_URL_ERROR" });
isFetching = false;
}
function handleResponse() {
var doc = req.responseText;
if (doc=="auth error") {
chrome.runtime.sendMessage({text: "FETCH_EVENTS_URL_ERROR"});
} else {
var n = doc.search("404 Not Found");
if (n>0) {
chrome.runtime.sendMessage({text: "FETCH_EVENTS_DATA_ERROR"});
} else {
getEvents(doc);
chrome.runtime.sendMessage({text: "FETCH_EVENTS_SUCCESS"});
}
}
isFetching = false;
var doc = req.responseText;
if (doc == "auth error") {
chrome.runtime.sendMessage({ text: "FETCH_EVENTS_URL_ERROR" });
} else {
var n = doc.search("404 Not Found");
if (n > 0) {
chrome.runtime.sendMessage({ text: "FETCH_EVENTS_DATA_ERROR" });
} else {
getEvents(doc);
chrome.runtime.sendMessage({ text: "FETCH_EVENTS_SUCCESS" });
}
}
isFetching = false;
}
function getEvents(reply){
var fetchedEvents = parseReplyEvents(reply);
function getEvents(reply) {
var fetchedEvents = parseReplyEvents(reply);
// If there is no events requested, mark all as visited
if (storedEvents.length == 0) {
notVisited = {};
storedEvents = fetchedEvents;
return;
}
// If there is no events requested, mark all as visited
if (typeof storedEvents != "undefined" && storedEvents.length == 0) {
notVisited = {};
storedEvents = fetchedEvents;
return;
}
// Discriminate the new events
newEvents=fetchNewEvents(fetchedEvents,storedEvents);
var newNotVisited = {};
var notVisitedCount = 0;
// Check if popup is displayed to make some actions
var views = chrome.extension.getViews({ type: "popup" });
for(var k=0;k<newEvents.length;k++){
newNotVisited[newEvents[k]['id']] = true;
if (views.length == 0) {
notVisitedCount++;
displayNotification (newEvents[k])
alertsSound(newEvents[k]);
}
}
// Discriminate the new events
newEvents = fetchNewEvents(fetchedEvents, storedEvents);
var newNotVisited = {};
var notVisitedCount = 0;
// Make that the old events marked as not visited remains with the
// same status
for(var k=0;k<fetchedEvents.length;k++){
if (notVisited[fetchedEvents[k]['id']] === true) {
newNotVisited[fetchedEvents[k]['id']] = true;
notVisitedCount++;
}
}
notVisited = newNotVisited;
// Check if popup is displayed to make some actions
var views = chrome.extension.getViews({ type: "popup" });
for (var k = 0; k < newEvents.length; k++) {
newNotVisited[newEvents[k]["id"]] = true;
if (views.length == 0) {
notVisitedCount++;
displayNotification(newEvents[k]);
alertsSound(newEvents[k]);
}
}
// Update the number
localStorage["new_events"] = (views.length == 0) ? notVisitedCount : 0;
updateBadge();
// Make that the old events marked as not visited remains with the
// same status
for (var k = 0; k < fetchedEvents.length; k++) {
if (notVisited[fetchedEvents[k]["id"]] === true) {
newNotVisited[fetchedEvents[k]["id"]] = true;
notVisitedCount++;
}
}
notVisited = newNotVisited;
// Store the requested events
storedEvents = fetchedEvents;
// Update the number
localStorage["new_events"] = views.length == 0 ? notVisitedCount : 0;
updateBadge();
// Store the requested events
storedEvents = fetchedEvents;
}
function updateBadge() {
if (localStorage["new_events"] != 0) {
chrome.browserAction.setBadgeBackgroundColor({color:[0,200,0,255]});
chrome.browserAction.setBadgeText({ text: localStorage["new_events"] });
} else {
chrome.browserAction.setBadgeText({ text: "" });
}
if (localStorage["new_events"] != 0) {
chrome.browserAction.setBadgeBackgroundColor({ color: [0, 200, 0, 255] });
chrome.browserAction.setBadgeText({ text: localStorage["new_events"] });
} else {
chrome.browserAction.setBadgeText({ text: "" });
}
}
function fetchNewEvents(A,B){
var arrDiff = new Array();
for(var i = 0; i < A.length; i++) {
var id = false;
for(var j = 0; j < B.length; j++) {
if(A[i]['id'] == B[j]['id']) {
id = true;
break;
}
}
if(!id) {
arrDiff.push(A[i]);
}
}
return arrDiff;
function fetchNewEvents(A, B) {
var arrDiff = new Array();
for (var i = 0; i < A.length; i++) {
var id = false;
for (var j = 0; j < B.length; j++) {
if (A[i]["id"] == B[j]["id"]) {
id = true;
break;
}
}
if (!id) {
arrDiff.push(A[i]);
}
}
return arrDiff;
}
function parseReplyEvents(reply) {
// Split the API response
var data;
try {
data = JSON.parse(reply);
} catch (error) {
console.log(error);
return [];
}
var e_array = JSON.parse(reply).data;
function parseReplyEvents (reply) {
// Split the API response
var data = JSON.parse(reply)
var e_array = JSON.parse(reply).data;
// Form a properly object
var fetchedEvents=new Array();
for(var i=0;i<e_array.length;i++){
var event=e_array[i];
fetchedEvents.push({
'id' : event.id_evento,
'agent_name' : event.agent_name,
'agent' : event.id_agente,
'date' : event.timestamp,
'title' : event.evento,
'module' : event.id_agentmodule,
'type' : event.event_type,
'source' : event.source,
'severity' : event.criticity_name,
'visited' : false
});
}
// Return the events
return fetchedEvents;
// Form a properly object
var fetchedEvents = new Array();
for (var i = 0; i < e_array.length; i++) {
var event = e_array[i];
fetchedEvents.push({
id: event.id_evento,
agent_name: event.agent_name,
agent: event.id_agente,
date: event.timestamp,
title: event.evento,
module: event.id_agentmodule,
type: event.event_type,
source: event.source,
severity: event.criticity_name,
visited: false
});
}
// Return the events
return fetchedEvents;
}
function alertsSound(pEvent){
if(localStorage["sound_alert"]!="on"){
return;
}
function alertsSound(pEvent) {
if (localStorage["sound_alert"] != "on") {
return;
}
switch (pEvent['severity']) {
case "Critical":
playSound(localStorage["critical"]);
break;
case "Informational":
playSound(localStorage["informational"]);
break;
case "Maintenance":
playSound(localStorage["maintenance"]);
break;
case "Normal":
playSound(localStorage["normal"]);
break;
case "Warning":
playSound(localStorage["warning"]);
break;
}
switch (pEvent["severity"]) {
case "Critical":
playSound(localStorage["critical"]);
break;
case "Informational":
playSound(localStorage["informational"]);
break;
case "Maintenance":
playSound(localStorage["maintenance"]);
break;
case "Normal":
playSound(localStorage["normal"]);
break;
case "Warning":
playSound(localStorage["warning"]);
break;
}
}
function displayNotification (pEvent) {
function displayNotification(pEvent) {
// Check if the user is okay to get some notification
if (Notification.permission === "granted") {
// If it's okay create a notification
getNotification(pEvent);
}
// Check if the user is okay to get some notification
if (Notification.permission === "granted") {
// If it's okay create a notification
getNotification(pEvent);
}
// Otherwise, we need to ask the user for permission
// Note, Chrome does not implement the permission static property
// So we have to check for NOT 'denied' instead of 'default'
else if (Notification.permission !== 'denied') {
Notification.requestPermission(function (permission) {
// Whatever the user answers, we make sure we store the information
if(!('permission' in Notification)) {
Notification.permission = permission;
}
// If the user is okay, let's create a notification
if (permission === "granted") getNotification(pEvent);
});
}
// Otherwise, we need to ask the user for permission
// Note, Chrome does not implement the permission static property
// So we have to check for NOT 'denied' instead of 'default'
else if (Notification.permission !== "denied") {
Notification.requestPermission(function(permission) {
// Whatever the user answers, we make sure we store the information
if (!("permission" in Notification)) {
Notification.permission = permission;
}
// If the user is okay, let's create a notification
if (permission === "granted") getNotification(pEvent);
});
}
}
function getNotification(pEvent){
// Build the event text
var even = pEvent['type'];
if (pEvent['source'] != '') even += " : " + pEvent['source'];
even += ". Event occured at " + pEvent['date'];
if(pEvent['module'] != 0) even += " in the module with Id "+ pEvent['module'];
even += ".";
function getNotification(pEvent) {
// Build the event text
var even = pEvent["type"];
if (pEvent["source"] != "") even += " : " + pEvent["source"];
even += ". Event occured at " + pEvent["date"];
if (pEvent["module"] != 0)
even += " in the module with Id " + pEvent["module"];
even += ".";
var url = (pEvent['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=" + pEvent['agent'];
var url =
pEvent["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=" +
pEvent["agent"];
var notification = new Notification(
pEvent['title'],
{
body: even,
icon: "images/icon.png"
}
);
var notification = new Notification(pEvent["title"], {
body: even,
icon: "images/icon.png"
});
// Add the link
notification.onclick = function (event) {
event.preventDefault();
window.open(url, '_blank');
}
// Add the link
notification.onclick = function(event) {
event.preventDefault();
window.open(url, "_blank");
};
// Close notification after 10 secs
setTimeout(function() {notification.close()}, 10000);
// Close notification after 10 secs
setTimeout(function() {
notification.close();
}, 10000);
}
function resetInterval () {
if (refreshTimer) clearInterval(refreshTimer);
refreshTimer = setInterval(main, localStorage["refresh"]*1000);
function resetInterval() {
if (refreshTimer) clearInterval(refreshTimer);
refreshTimer = setInterval(main, localStorage["refresh"] * 1000);
}
function initilise(){
function initilise() {
if (isFetching == null) isFetching = false;
if (localStorage["ip_address"] == undefined) {
localStorage["ip_address"] = "http://firefly.artica.es/pandora_demo";
}
if (isFetching == null) isFetching = false;
if(localStorage["ip_address"]==undefined){
localStorage["ip_address"]="http://firefly.artica.es/pandora_demo";
}
if(localStorage["api_pass"]==undefined){
localStorage["api_pass"]="doreik0";
}
if(localStorage["user_name"]==undefined){
localStorage["user_name"]="demo";
}
if(localStorage["pass"]==undefined){
localStorage["pass"]="demo";
}
if(localStorage["critical"]==null){
localStorage["critical"]="11";
}
if(localStorage["informational"]==null){
localStorage["informational"]="1";
}
if(localStorage["maintenance"]==null){
localStorage["maintenance"]="10";
}
if(localStorage["normal"]==null){
localStorage["normal"]="6";
}
if(localStorage["warning"]==null){
localStorage["warning"]="2";
}
if(localStorage["events"]==null){
localStorage["events"]=20;
}
if(localStorage["refresh"]==null){
localStorage["refresh"]="10";
}
if(localStorage["ip_address"]==null){
localStorage["ip_address"]="http://firefly.artica.es/pandora_demo";
}
if(localStorage["api_pass"]==null){
localStorage["api_pass"]="doreik0";
}
if(localStorage["user_name"]==null){
localStorage["user_name"]="demo";
}
if(localStorage["pass"]==null){
localStorage["pass"]="demo";
}
if(localStorage["sound_alert"]==null){
localStorage["sound_alert"]="on";
}
if(localStorage["changed"]==null){
localStorage["changed"]="false";
}
if(localStorage["new_events"]==null){
localStorage["new_events"]=parseInt(localStorage["events"]);
}
if(localStorage["error"]==null) {
localStorage["error"] = true;
}
if (localStorage["api_pass"] == undefined) {
localStorage["api_pass"] = "doreik0";
}
if (localStorage["user_name"] == undefined) {
localStorage["user_name"] = "demo";
}
if (localStorage["pass"] == undefined) {
localStorage["pass"] = "demo";
}
if (localStorage["critical"] == null) {
localStorage["critical"] = "11";
}
if (localStorage["informational"] == null) {
localStorage["informational"] = "1";
}
if (localStorage["maintenance"] == null) {
localStorage["maintenance"] = "10";
}
if (localStorage["normal"] == null) {
localStorage["normal"] = "6";
}
if (localStorage["warning"] == null) {
localStorage["warning"] = "2";
}
if (localStorage["events"] == null) {
localStorage["events"] = 20;
}
if (localStorage["refresh"] == null) {
localStorage["refresh"] = "10";
}
if (localStorage["ip_address"] == null) {
localStorage["ip_address"] = "http://firefly.artica.es/pandora_demo";
}
if (localStorage["api_pass"] == null) {
localStorage["api_pass"] = "doreik0";
}
if (localStorage["user_name"] == null) {
localStorage["user_name"] = "demo";
}
if (localStorage["pass"] == null) {
localStorage["pass"] = "demo";
}
if (localStorage["sound_alert"] == null) {
localStorage["sound_alert"] = "on";
}
if (localStorage["changed"] == null) {
localStorage["changed"] = "false";
}
if (localStorage["new_events"] == null) {
localStorage["new_events"] = parseInt(localStorage["events"]);
}
if (localStorage["error"] == null) {
localStorage["error"] = true;
}
}

View File

@ -8,7 +8,10 @@ $(document).ready(function() {
bg = chrome.extension.getBackgroundPage();
// Display the information
if (bg.fetchEvents().length == 0) {
var events = bg.fetchEvents();
if (!events) {
showError("Failed to retrieve events, please retry");
} else if (events.length == 0) {
showError("No events");
} else {
showEvents();

View File

@ -1,6 +1,6 @@
{
"name": "__MSG_name__",
"version": "2.2",
"version": "2.3",
"manifest_version": 2,
"description": "Pandora FMS Event viewer Chrome extension",
"homepage_url": "http://pandorafms.com",

View File

@ -1,245 +1,262 @@
if ("undefined" == typeof(PandoraChrome)) {
var PandoraChrome = {};
var prefManager = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefService).getBranch("pandora.");
/* globals Components, req */
if ("undefined" == typeof PandoraChrome) {
var PandoraChrome = {};
var prefManager = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefService)
.getBranch("pandora.");
var timer = null;
var allEvents=new Array();
var newEvents=new Array();
var oldEvents=new Array();
var api_div_numbers=21;
};
PandoraChrome.fn = function(){
return {
displaySideBar: function(){
PandoraChrome.fn.hideNotification();
PandoraChrome.fn.hideBadge();
toggleSidebar('viewPandoraSidebar');
},
displayDialog : function(){
window.openDialog("chrome://pandorasidebar/content/options.xul", "","chrome, centerscreen, dialog, modal, resizable=no", null).focus();
},
handleClick: function(e){
if(e.button == 0){
toggleSidebar('viewPandoraSidebar');
PandoraChrome.fn.setIcon('icon16');
}
},
Onloading: function () {
if(prefManager.getBoolPref("firstLoad")){
prefManager.setIntPref("new_events",prefManager.getIntPref("events"));
prefManager.setBoolPref("firstLoad",false);
}
var timer = null;
var allEvents = new Array();
var newEvents = new Array();
var oldEvents = new Array();
var api_div_numbers = 21;
}
if(timer) {
clearTimeout(timer);
}
timer =setTimeout(PandoraChrome.fn.main , 100 );
},
PandoraChrome.fn = (function() {
return {
displaySideBar: function() {
PandoraChrome.fn.hideNotification();
PandoraChrome.fn.hideBadge();
toggleSidebar("viewPandoraSidebar");
},
displayDialog: function() {
window
.openDialog(
"chrome://pandorasidebar/content/options.xul",
"",
"chrome, centerscreen, dialog, modal, resizable=no",
null
)
.focus();
},
handleClick: function(e) {
if (e.button == 0) {
toggleSidebar("viewPandoraSidebar");
PandoraChrome.fn.setIcon("icon16");
}
},
Onloading: function() {
if (prefManager.getBoolPref("firstLoad")) {
prefManager.setIntPref("new_events", prefManager.getIntPref("events"));
prefManager.setBoolPref("firstLoad", false);
}
main: function() {
// alert('test_main');
var url=prefManager.getCharPref("ip_address")+'/include/api.php?op=get&op2=events&return_type=csv&apipass='+prefManager.getCharPref("api_pass")+'&user='+prefManager.getCharPref("user_name")+'&pass='+prefManager.getCharPref("pass");
var feedUrl = url;
prefManager.setBoolPref("data_check", true);
req = new XMLHttpRequest();
req.onload = PandoraChrome.fn.handleResponse;
req.onerror = PandoraChrome.fn.handleError;
req.open("GET", feedUrl, true);
req.send(null);
},
if (timer) {
clearTimeout(timer);
}
timer = setTimeout(PandoraChrome.fn.main, 100);
},
handleError: function() {
//alert("error");
prefManager.setCharPref("data",null);
prefManager.setBoolPref("data_check", false);
if(timer) {
clearTimeout(timer);
}
timer =setTimeout(PandoraChrome.fn.main , 1000);
},
main: function() {
// alert('test_main');
var url =
prefManager.getCharPref("ip_address") +
"/include/api.php?op=get&op2=events&return_type=json";
var feedUrl = url;
var data = new FormData();
handleResponse: function () {
var doc = req.responseText;
if (doc=="auth error") {
prefManager.setCharPref("data",null);
prefManager.setBoolPref("data_check", false);
if(timer) {
clearTimeout(timer);
}
timer =setTimeout(PandoraChrome.fn.main , 1000);
data.append("apipass", prefManager.getCharPref("api_pass"));
data.append("user", prefManager.getCharPref("user_name"));
data.append("pass", prefManager.getCharPref("pass"));
}
else{
var n=doc.search("404 Not Found");
if(n>0){
prefManager.setBoolPref("data_check", true);
req = new XMLHttpRequest();
req.onload = PandoraChrome.fn.handleResponse;
req.onerror = PandoraChrome.fn.handleError;
req.open("POST", feedUrl, true);
req.send(data);
},
prefManager.setCharPref("data",null);
prefManager.setBoolPref("data_check", false);
if(timer) {
clearTimeout(timer);
}
timer =setTimeout(PandoraChrome.fn.main , 1000);
}
else{
prefManager.setBoolPref("data_check", true);
handleError: function() {
//alert("error");
prefManager.setCharPref("data", null);
prefManager.setBoolPref("data_check", false);
if (timer) {
clearTimeout(timer);
}
timer = setTimeout(PandoraChrome.fn.main, 1000);
},
prefManager.setCharPref("data",doc);
PandoraChrome.fn.getEvents(doc);
}
}
},
handleResponse: function() {
var doc = req.responseText;
if (doc == "auth error") {
prefManager.setCharPref("data", null);
prefManager.setBoolPref("data_check", false);
if (timer) {
clearTimeout(timer);
}
timer = setTimeout(PandoraChrome.fn.main, 1000);
} else {
var n = doc.search("404 Not Found");
if (n > 0) {
prefManager.setCharPref("data", null);
prefManager.setBoolPref("data_check", false);
if (timer) {
clearTimeout(timer);
}
timer = setTimeout(PandoraChrome.fn.main, 1000);
} else {
prefManager.setBoolPref("data_check", true);
getEvents: function (reply){
if(reply.length>100){
all_event_array=reply.split("\n");
allEvents=PandoraChrome.fn.divideArray(all_event_array);
if(oldEvents.length==0){
oldEvents=allEvents;
}
prefManager.setCharPref("data", doc);
PandoraChrome.fn.getEvents(doc);
}
}
},
newEvents=PandoraChrome.fn.fetchNewEvents(allEvents,oldEvents);
if(newEvents.length!=0){
for(var k=0;k<newEvents.length;k++){
var temp=prefManager.getIntPref("new_events")+1;
prefManager.setIntPref("new_events",temp);
PandoraChrome.fn.showNotification(k);
PandoraChrome.fn.showBadge(prefManager.getIntPref("new_events"));
}
}
oldEvents=allEvents;
if(prefManager.getIntPref("new_events")>0){
PandoraChrome.fn.showBadge(prefManager.getIntPref("new_events"));
}
else{
PandoraChrome.fn.hideBadge();
}
if(timer) {
clearTimeout(timer);
}
timer =setTimeout(PandoraChrome.fn.main , prefManager.getIntPref("refresh")*1000 );
}
},
showNotification: function(eventId){
//alert("notify"+eventId);
if(prefManager.getBoolPref("sound_alert")){
if(newEvents[eventId][19]=="Critical"){
Sounds.playSound(prefManager.getIntPref("critical"));
}
if(newEvents[eventId][19]=="Informational"){
Sounds.playSound(prefManager.getIntPref("informational"));
}
if(newEvents[eventId][19]=="Maintenance"){
Sounds.playSound(prefManager.getIntPref("maintenance"));
}
if(newEvents[eventId][19]=="Normal"){
Sounds.playSound(prefManager.getIntPref("normal"));
}
if(newEvents[eventId][19]=="Warning"){
Sounds.playSound(prefManager.getIntPref("warning"));
}
}
var newEve = document.getElementById('newEvent');
newEve.label="Last Event : "+newEvents[eventId][6];
var id;
if(newEvents[eventId][9]==0){
id=".";
}
else {
id= " in the module with Id "+ newEvents[eventId][9] + ".";
}
var event = newEvents[eventId][14]+" : "+newEvents[eventId][17]+". Event occured at "+ newEvents[eventId][5]+id;
newEve.tooltipText=event;
$('#newEvent').show();
return;
},
hideNotification:function(){
//alert("Hide Notif");
$('#newEvent').hide();
},
showBadge: function (txt) {
//alert(txt);
var updateCount = document.getElementById('temp');
updateCount.setAttribute("style","cursor:pointer; font-size:11px; color:#123863; font-weight:bold; display:none;") ;
updateCount.label=txt;
$('#temp').show();
},
hideBadge: function () {
var updateCount = document.getElementById('temp');
//alert("hide B");
$('#temp').hide();
},
divideArray: function (e_array){
var Events=new Array();
for(var i=0;i<e_array.length;i++){
var event=e_array[i].split(";");
Events.push(event);
}
return Events;
},
fetchNewEvents: function (A,B){
var arrDiff = new Array();
// alert(A.length);
//alert(B.length);
for(var i = 0; i < A.length; i++) {
var id = false;
for(var j = 0; j < B.length; j++) {
if(A[i][0] == B[j][0]) {
id = true;
break;
}
}
if(!id) {
arrDiff.push(A[i]);
}
}
return arrDiff;
},
getNotification:function (eventId){
var title=newEvents[eventId][6];
var id;
if(newEvents[eventId][9]==0){
id=".";
}
else {
id= " in the module with Id "+ newEvents[eventId][9] + ".";
}
var event = newEvents[eventId][14]+" : "+newEvents[eventId][17]+". Event occured at "+ newEvents[eventId][5]+id;
//var event=newEvents[eventId][14]+' '+newEvents[eventId][17]+' Event occured at:'+ newEvents[eventId][5] +'in the module with Id '+ newEvents[eventId][9];
return '<a>' + title + '</a> <br/> <span style="font-size:80%">' + event + '</span>';
getEvents: function(reply) {
if (reply.length > 100) {
all_event_array = reply.split("\n");
allEvents = PandoraChrome.fn.divideArray(all_event_array);
if (oldEvents.length == 0) {
oldEvents = allEvents;
}
};
}();
newEvents = PandoraChrome.fn.fetchNewEvents(allEvents, oldEvents);
if (newEvents.length != 0) {
for (var k = 0; k < newEvents.length; k++) {
var temp = prefManager.getIntPref("new_events") + 1;
prefManager.setIntPref("new_events", temp);
PandoraChrome.fn.showNotification(k);
PandoraChrome.fn.showBadge(prefManager.getIntPref("new_events"));
}
}
oldEvents = allEvents;
if (prefManager.getIntPref("new_events") > 0) {
PandoraChrome.fn.showBadge(prefManager.getIntPref("new_events"));
} else {
PandoraChrome.fn.hideBadge();
}
if (timer) {
clearTimeout(timer);
}
timer = setTimeout(
PandoraChrome.fn.main,
prefManager.getIntPref("refresh") * 1000
);
}
},
showNotification: function(eventId) {
//alert("notify"+eventId);
if (prefManager.getBoolPref("sound_alert")) {
if (newEvents[eventId][19] == "Critical") {
Sounds.playSound(prefManager.getIntPref("critical"));
}
if (newEvents[eventId][19] == "Informational") {
Sounds.playSound(prefManager.getIntPref("informational"));
}
if (newEvents[eventId][19] == "Maintenance") {
Sounds.playSound(prefManager.getIntPref("maintenance"));
}
if (newEvents[eventId][19] == "Normal") {
Sounds.playSound(prefManager.getIntPref("normal"));
}
if (newEvents[eventId][19] == "Warning") {
Sounds.playSound(prefManager.getIntPref("warning"));
}
}
var newEve = document.getElementById("newEvent");
newEve.label = "Last Event : " + newEvents[eventId][6];
var id;
if (newEvents[eventId][9] == 0) {
id = ".";
} else {
id = " in the module with Id " + newEvents[eventId][9] + ".";
}
var event =
newEvents[eventId][14] +
" : " +
newEvents[eventId][17] +
". Event occured at " +
newEvents[eventId][5] +
id;
newEve.tooltipText = event;
$("#newEvent").show();
return;
},
hideNotification: function() {
//alert("Hide Notif");
$("#newEvent").hide();
},
showBadge: function(txt) {
//alert(txt);
var updateCount = document.getElementById("temp");
updateCount.setAttribute(
"style",
"cursor:pointer; font-size:11px; color:#123863; font-weight:bold; display:none;"
);
updateCount.label = txt;
$("#temp").show();
},
hideBadge: function() {
var updateCount = document.getElementById("temp");
//alert("hide B");
$("#temp").hide();
},
divideArray: function(e_array) {
var Events = new Array();
for (var i = 0; i < e_array.length; i++) {
var event = e_array[i].split(";");
Events.push(event);
}
return Events;
},
fetchNewEvents: function(A, B) {
var arrDiff = new Array();
// alert(A.length);
//alert(B.length);
for (var i = 0; i < A.length; i++) {
var id = false;
for (var j = 0; j < B.length; j++) {
if (A[i][0] == B[j][0]) {
id = true;
break;
}
}
if (!id) {
arrDiff.push(A[i]);
}
}
return arrDiff;
},
getNotification: function(eventId) {
var title = newEvents[eventId][6];
var id;
if (newEvents[eventId][9] == 0) {
id = ".";
} else {
id = " in the module with Id " + newEvents[eventId][9] + ".";
}
var event =
newEvents[eventId][14] +
" : " +
newEvents[eventId][17] +
". Event occured at " +
newEvents[eventId][5] +
id;
//var event=newEvents[eventId][14]+' '+newEvents[eventId][17]+' Event occured at:'+ newEvents[eventId][5] +'in the module with Id '+ newEvents[eventId][9];
return (
"<a>" +
title +
'</a> <br/> <span style="font-size:80%">' +
event +
"</span>"
);
}
};
})();
/* Add Event Listener */
window.addEventListener("load", PandoraChrome.fn.Onloading(), false);

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,6 +1,6 @@
# Base config file for Pandora FMS Windows Agent
# (c) 2006-2010 Artica Soluciones Tecnologicas
# Version 7.0NG.750
# Version 7.0NG.751
# This program is Free Software, you can redistribute it and/or modify it
# under the terms of the GNU General Public Licence as published by the Free Software

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,5 +1,5 @@
package: pandorafms-agent-unix
Version: 7.0NG.750-201112
Version: 7.0NG.751-201223
Architecture: all
Priority: optional
Section: admin

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

File diff suppressed because it is too large Load Diff

View File

@ -2,8 +2,8 @@
#Pandora FMS Linux Agent
#
%define name pandorafms_agent_unix
%define version 7.0NG.750
%define release 201112
%define version 7.0NG.751
%define release 201223
Summary: Pandora FMS Linux agent, PERL version
Name: %{name}

View File

@ -2,8 +2,8 @@
#Pandora FMS Linux Agent
#
%define name pandorafms_agent_unix
%define version 7.0NG.750
%define release 201112
%define version 7.0NG.751
%define release 201223
Summary: Pandora FMS Linux agent, PERL version
Name: %{name}

View File

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

View File

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

Binary file not shown.

View File

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

View File

@ -0,0 +1,93 @@
#!/usr/bin/perl
################################################################################
# Pandora FMS Omnishell client.
#
# (c) Fco de Borja Sánchez <fborja.sanchez@pandorafms.com>
#
# Usage: omnishell_client "C:\Program Files\pandora_agent\pandora_agent.conf"
#
################################################################################
use strict;
use warnings;
use File::Basename;
use lib '/usr/lib/perl5';
use PandoraFMS::PluginTools;
use PandoraFMS::Omnishell;
################################################################################
# Definitions
################################################################################
my $HELP=<<EO_H;
Pandora FMS Omnishell client.
Usage:
$0 <configuration_file> [-debug 1]
Where <configuration_file> is your Pandora FMS Agent configuration.
*Recommended: use full path.
Use -debug 1 to get information extra in STDERR
EO_H
################################################################################
# Parse commands.
################################################################################
sub read_commands {
my ($config, $exp, $line, $file) = @_;
if (empty($config->{'commands'})) {
$config->{'commands'} = {};
}
my ($ref) = $line =~ /$exp\s+(.*)/;
$config->{'commands'}->{trim($ref)} = {};
return $config;
}
################################################################################
# MAIN
################################################################################
my $ConfFile = $ARGV[0];
my $config = read_configuration({},' ', [
{
'exp' => 'cmd_file',
'target' => \&read_commands
},
]);
if (!defined($ConfFile) || !-e $ConfFile) {
print $HELP;
exit 1;
}
if(!-d dirname($ConfFile).'\commands') {
mkdir(dirname($ConfFile).'\commands');
}
eval {
# Check scheduled commands
my $omnishell = new PandoraFMS::Omnishell(
{
%{$config},
'ConfDir' => dirname($ConfFile)
}
);
if (empty($omnishell->run('xml')) && is_enabled($config->{'debug'}) ) {
print STDERR $omnishell->get_last_error()."\n";
}
};
if ($@) {
if (is_enabled($config->{'debug'})) {
print STDERR $@."\n";
}
exit 1;
}
exit 0;

View File

@ -30,7 +30,7 @@ using namespace Pandora;
using namespace Pandora_Strutils;
#define PATH_SIZE _MAX_PATH+1
#define PANDORA_VERSION ("7.0NG.750(Build 201112)")
#define PANDORA_VERSION ("7.0NG.751(Build 201223)")
string pandora_path;
string pandora_dir;

View File

@ -1704,7 +1704,7 @@ Pandora_Windows_Service::checkConfig (string file) {
}
int
Pandora_Windows_Service::sendXml (Pandora_Module_List *modules) {
Pandora_Windows_Service::sendXml (Pandora_Module_List *modules, string extra /* = ""*/) {
int rc = 0, rc_sec = 0, xml_buffer;
string data_xml;
string xml_filename, random_integer;
@ -1785,10 +1785,13 @@ Pandora_Windows_Service::sendXml (Pandora_Module_List *modules) {
modules->goNext ();
}
}
/* Write extra content (omnishell, for instance) */
data_xml += extra;
/* Close the XML header */
data_xml += "</agent_data>";
/* Generate temporal filename */
random_integer = inttostr (rand());
tmp_filename = conf->getValue ("agent_name");
@ -2018,7 +2021,7 @@ Pandora_Windows_Service::pandora_run () {
void
Pandora_Windows_Service::pandora_run (int forced_run) {
Pandora_Agent_Conf *conf = NULL;
string server_addr, conf_file, *all_conf;
string server_addr, conf_file, *all_conf, omnishell_output, omnishell_path;
int startup_delay = 0;
int i, num;
static bool startup = true;
@ -2055,6 +2058,15 @@ Pandora_Windows_Service::pandora_run (int forced_run) {
this->checkCollections ();
}
/* Execute omnishell commands */
omnishell_path = '"'+Pandora::getPandoraInstallDir ();
omnishell_path += "util\\omnishell_client.exe\" \"" + conf_file+"\"";
if (getPandoraDebug () != false) {
pandoraLog ("Omnishell: Running");
}
omnishell_output = getValueFromCmdExec(omnishell_path.c_str(), 6000000);
server_addr = conf->getValue ("server_ip");
execution_number++;
@ -2126,7 +2138,7 @@ Pandora_Windows_Service::pandora_run (int forced_run) {
// Send the XML
if (!server_addr.empty ()) {
this->sendXml (this->modules);
this->sendXml (this->modules, omnishell_output);
}
}

View File

@ -117,7 +117,7 @@ namespace Pandora {
const char *svc_description);
void start ();
int sendXml (Pandora_Module_List *modules);
int sendXml (Pandora_Module_List *modules, string extra = "");
void sendBufferedXml (string path, copy_func_p copy_func, bool secondary_buffer);
Pandora_Agent_Conf *getConf ();
string getEHKey (string ehorus_conf);

View File

@ -11,7 +11,7 @@ BEGIN
VALUE "LegalCopyright", "Artica ST"
VALUE "OriginalFilename", "PandoraAgent.exe"
VALUE "ProductName", "Pandora FMS Windows Agent"
VALUE "ProductVersion", "(7.0NG.750(Build 201112))"
VALUE "ProductVersion", "(7.0NG.751(Build 201223))"
VALUE "FileVersion", "1.0.0.0"
END
END

View File

@ -1,5 +1,5 @@
package: pandorafms-console
Version: 7.0NG.750-201112
Version: 7.0NG.751-201223
Architecture: all
Priority: optional
Section: admin

View File

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

View File

@ -1,651 +1,91 @@
<?php
/**
* Agents/Alerts Monitoring view.
*
* @category Operations
* @package Pandora FMS
* @subpackage Opensource
* @version 1.0.0
* @license See below
*
* ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2005-2020 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.
require_once $config['homedir'].'/include/functions_agents.php';
require_once $config['homedir'].'/include/functions_modules.php';
require_once $config['homedir'].'/include/functions_users.php';
// Begin.
global $config;
// Require needed class.
require_once $config['homedir'].'/include/class/AgentsAlerts.class.php';
// Get the parameter.
$sec2 = get_parameter_get('sec2');
// Add operation menu option.
extensions_add_operation_menu_option(
__('Agents/Alerts view'),
'estado',
null,
'v1r1',
'view'
);
// If sec2 parameter come with this page info.
if ($sec2 === 'extensions/agents_alerts') {
extensions_add_main_function('mainAgentsAlerts');
}
/**
* Function for load the controller.
*
* @return void
*/
function mainAgentsAlerts()
{
global $config;
// Load global vars
include_once 'include/config.php';
include_once 'include/functions_reporting.php';
check_login();
// ACL Check
if (! check_acl($config['id_user'], 0, 'AR')) {
db_pandora_audit(
'ACL Violation',
'Trying to access Agent view (Grouped)'
);
include 'general/noaccess.php';
exit;
}
// Update network modules for this group
// Check for Network FLAG change request
// Made it a subquery, much faster on both the database and server side
if (isset($_GET['update_netgroup'])) {
$group = get_parameter_get('update_netgroup', 0);
if (check_acl($config['id_user'], $group, 'AW')) {
$where = ['id_agente' => 'ANY(SELECT id_agente FROM tagente WHERE id_grupo = '.$group];
db_process_sql_update('tagente_modulo', ['flag' => 1], $where);
} else {
db_pandora_audit('ACL Violation', 'Trying to set flag for groups');
include 'general/noaccess.php';
// Ajax variables.
$pageName = '[AgentsAlerts]';
// Control call flow.
try {
// User access and validation is being processed on class constructor.
$obj = new AgentsAlerts();
} catch (Exception $e) {
if (is_ajax() === true) {
echo json_encode(['error' => $pageName.$e->getMessage() ]);
exit;
}
}
if ($config['realtimestats'] == 0) {
$updated_info = __('Last update').' : '.ui_print_timestamp(db_get_sql('SELECT min(utimestamp) FROM tgroup_stat'), true);
} else {
// $updated_info = __("Updated at realtime");
$updated_info = '';
}
$updated_time = $updated_info;
$create_alert = (int) get_parameter('create_alert', 0);
if ($create_alert) {
$template2 = get_parameter('template');
$module_action_threshold = get_parameter('module_action_threshold');
$id_alert = alerts_create_alert_agent_module($create_alert, $template2);
if ($id_alert !== false) {
$action_select = get_parameter('action_select', 0);
if ($action_select != 0) {
$values = [];
$values['fires_min'] = 0;
$values['fires_max'] = 0;
$values['module_action_threshold'] = (int) get_parameter('module_action_threshold');
alerts_add_alert_agent_module_action($id_alert, $action_select, $values);
}
}
}
$refr = (int) get_parameter('refr', 30);
// By default 30 seconds
$show_modules = (bool) get_parameter('show_modules', 0);
$group_id = get_parameter('group_id', 0);
$offset = get_parameter('offset', 0);
$hor_offset = get_parameter('hor_offset', 0);
$block = 20;
$groups = users_get_groups();
$filter_groups .= '<b>'.__('Group').'</b>';
$filter_groups .= '<div class="w250px inline margin-left-2">';
$filter_groups .= html_print_select_groups(false, 'AR', true, 'group_id', $group_id, false, '', '', true, false, true, '', false, 'margin-right: 10px; margin-top: 5px;');
$filter_groups .= '</div>';
$check = '<b>'.__('Show modules without alerts').'</b>';
$check .= html_print_checkbox('slides_ids[]', $d['id'], $show_modules, true, false, '', true);
$comborefr = '<form method="post" action="'.ui_get_url_refresh(['offset' => 0, 'hor_offset' => 0]).'">';
$comborefr .= '<b>'.__('Refresh').'</b>';
$comborefr .= html_print_select(
[
'30' => '30 '.__('seconds'),
(string) SECONDS_1MINUTE => __('1 minute'),
(string) SECONDS_2MINUTES => __('2 minutes'),
(string) SECONDS_5MINUTES => __('5 minutes'),
(string) SECONDS_10MINUTES => __('10 minutes'),
],
'refr',
(int) get_parameter('refr', 0),
$script = 'this.form.submit()',
'',
0,
true,
false,
false,
'',
false,
'width: 100px; margin-right: 10px; margin-top: 5px;'
);
$comborefr .= '</form>';
if ($config['pure'] == 0) {
$fullscreen['text'] = '<a href="'.ui_get_url_refresh(['pure' => 1]).'">'.html_print_image('images/full_screen.png', true, ['title' => __('Full screen mode')]).'</a>';
} else {
$fullscreen['text'] = '<a href="'.ui_get_url_refresh(['pure' => 0]).'">'.html_print_image('images/normal_screen.png', true, ['title' => __('Back to normal mode')]).'</a>';
$config['refr'] = $refr;
}
$onheader = [
'updated_time' => $updated_time,
'fullscreen' => $fullscreen,
'combo_groups' => $filter_groups,
];
if ($config['pure'] == 1) {
$onheader['combo_refr'] = $comborefr;
}
// Header.
ui_print_page_header(
__('Agents/Alerts'),
'images/op_alerts.png',
false,
'',
false,
$updated_time
);
// Old style table, we need a lot of special formatting,don't use table function
// Prepare old-style table
echo '<table class="databox filters" cellpadding="0" cellspacing="0" border="0" style="width:100%;">';
echo '<tr>';
echo '<td>'.$filter_groups.'</td>';
echo '<td>'.$check.'</td>';
if ($config['pure'] == 1) {
echo '<td>'.$comborefr.'</td>';
}
echo '<td> <strong>'.__('Full screen').'</strong>'.$fullscreen['text'].'</td>';
echo '</tr>';
echo '</table>';
if ($show_modules) {
if ($group_id > 0) {
$grupo = " AND tagente.id_grupo = $group_id";
} else {
$grupo = '';
echo $pageName.$e->getMessage();
}
$offset_modules = get_parameter('offset', 0);
$sql_count = "SELECT COUNT(tagente_modulo.nombre) FROM tagente_modulo
INNER JOIN tagente ON tagente.id_agente = tagente_modulo.id_agente
WHERE id_agente_modulo NOT IN (SELECT id_agent_module FROM talert_template_modules)
$grupo";
$count_agent_module = db_get_all_rows_sql($sql_count);
$sql = "SELECT tagente.alias, tagente_modulo.nombre,
tagente_modulo.id_agente_modulo FROM tagente_modulo
INNER JOIN tagente ON tagente.id_agente = tagente_modulo.id_agente
WHERE id_agente_modulo NOT IN (SELECT id_agent_module FROM talert_template_modules)
$grupo LIMIT 20 OFFSET $offset_modules";
$agent_modules = db_get_all_rows_sql($sql);
ui_pagination(
$count_agent_module[0]['COUNT(tagente_modulo.nombre)'],
ui_get_url_refresh(),
0,
0,
false,
'offset',
true,
'',
'',
false,
'alerts_modules'
);
$table->width = '100%';
$table->class = 'databox data';
$table->id = 'table_agent_module';
$table->data = [];
$table->head[0] = __('Agents');
$table->head[1] = __('Modules');
$table->head[2] = __('Actions');
$table->style[0] = 'width: 25%;';
$table->style[1] = 'width: 33%;';
$table->style[2] = 'width: 33%;';
foreach ($agent_modules as $agent_module) {
$data[0] = io_safe_output($agent_module['alias']);
$data[1] = io_safe_output($agent_module['nombre']);
$uniqid = $agent_module['id_agente_modulo'];
$data[2] = "<a title='".__('Create alert')."' href='javascript:show_add_alerts(\"$uniqid\")'>".html_print_image('images/add_mc.png', true).'</a>';
array_push($table->data, $data);
$table2->width = '100%';
$table2->id = 'table_add_alert';
$table2->class = 'databox filters';
$table2->data = [];
// $data[0] =
$table2->data[0][0] = __('Actions');
$groups_user = users_get_groups($config['id_user']);
if (!empty($groups_user)) {
$groups = implode(',', array_keys($groups_user));
$sql = "SELECT id, name FROM talert_actions WHERE id_group IN ($groups)";
$actions = db_get_all_rows_sql($sql);
}
$table2->data[0][1] = html_print_select(
index_array($actions, 'id', 'name'),
'action_select',
'',
'',
__('Default action'),
'0',
true,
'',
true,
'',
false,
'width: 250px;'
);
$table2->data[0][1] .= '<span id="advanced_action" class="advanced_actions invisible"><br>';
$table2->data[0][1] .= __('Number of alerts match from').' ';
$table2->data[0][1] .= html_print_input_text('fires_min', '', '', 4, 10, true);
$table2->data[0][1] .= ' '.__('to').' ';
$table2->data[0][1] .= html_print_input_text('fires_max', '', '', 4, 10, true);
$table2->data[0][1] .= ui_print_help_icon(
'alert-matches',
true,
ui_get_full_url(false, false, false, false)
);
$table2->data[0][1] .= '</span>';
if (check_acl($config['id_user'], 0, 'LM')) {
$table2->data[0][1] .= '<a style="margin-left:5px;" href="index.php?sec=galertas&sec2=godmode/alerts/configure_alert_action&pure='.$pure.'">';
$table2->data[0][1] .= html_print_image('images/add.png', true);
$table2->data[0][1] .= '<span style="margin-left:5px;vertical-align:middle;">'.__('Create Action').'</span>';
$table2->data[0][1] .= '</a>';
}
$table2->data[1][0] = __('Template');
$own_info = get_user_info($config['id_user']);
if ($own_info['is_admin'] || check_acl($config['id_user'], 0, 'PM')) {
$templates = alerts_get_alert_templates(false, ['id', 'name']);
} else {
$usr_groups = users_get_groups($config['id_user'], 'LW', true);
$filter_groups = '';
$filter_groups = implode(',', array_keys($usr_groups));
$templates = alerts_get_alert_templates(['id_group IN ('.$filter_groups.')'], ['id', 'name']);
}
$table2->data[1][1] = html_print_select(
index_array($templates, 'id', 'name'),
'template',
'',
'',
__('Select'),
0,
true,
false,
true,
'',
false,
'width: 250px;'
);
$table2->data[1][1] .= ' <a class="template_details invisible" href="#">'.html_print_image('images/zoom.png', true, ['class' => 'img_help']).'</a>';
if (check_acl($config['id_user'], 0, 'LM')) {
$table2->data[1][1] .= '<a href="index.php?sec=galertas&sec2=godmode/alerts/configure_alert_template&pure='.$pure.'">';
$table2->data[1][1] .= html_print_image('images/add.png', true);
$table2->data[1][1] .= '<span style="margin-left:5px;vertical-align:middle;">'.__('Create Template').'</span>';
$table2->data[1][1] .= '</a>';
}
$table2->data[2][0] = __('Threshold');
$table2->data[2][1] = html_print_input_text('module_action_threshold', '0', '', 5, 7, true);
$table2->data[2][1] .= ' '.__('seconds');
$content2 = '<form class="add_alert_form" method="post">';
$content2 .= html_print_table($table2, true);
$content2 .= '<div class="action-buttons" style="width: '.$table2->width.'">';
$content2 .= html_print_submit_button(__('Add alert'), 'add', false, 'class="sub wand"', true);
$content2 .= html_print_input_hidden('create_alert', $uniqid, true);
$content2 .= '</div></form>';
$module_name = ui_print_truncate_text(io_safe_output($agent_module['nombre']), 40, false, true, false, '&hellip;', false);
echo '<div id="add_alerts_dialog_'.$uniqid.'" title="'.__('Agent').': '.$agent_module['alias'].' / '.__('module').': '.$module_name.'" style="display:none">'.$content2.'</div>';
}
html_print_table($table);
} else {
$filter = [
'offset' => (int) $offset,
'limit' => (int) $config['block_size'],
];
$filter_count = [];
if ($group_id > 0) {
$filter['id_grupo'] = $group_id;
$filter_count['id_grupo'] = $group_id;
}
// Get the id of all agents with alerts
$sql = 'SELECT DISTINCT(id_agente)
FROM tagente_modulo
WHERE id_agente_modulo IN
(SELECT id_agent_module
FROM talert_template_modules)';
$agents_with_alerts_raw = db_get_all_rows_sql($sql);
if ($agents_with_alerts_raw === false) {
$agents_with_alerts_raw = [];
}
$agents_with_alerts = [];
foreach ($agents_with_alerts_raw as $awar) {
$agents_with_alerts[] = $awar['id_agente'];
}
$filter['id_agente'] = $agents_with_alerts;
$filter_count['id_agente'] = $agents_with_alerts;
$agents = agents_get_agents($filter);
$nagents = count(agents_get_agents($filter_count));
if ($agents == false) {
ui_print_info_message(['no_close' => true, 'message' => __('There are no agents with alerts') ]);
return;
}
$all_alerts = agents_get_alerts_simple();
if ($config['pure'] == 1) {
$block = count($all_alerts);
}
$templates = [];
$agent_alerts = [];
foreach ($all_alerts as $alert) {
$templates[$alert['id_alert_template']] = '';
$agent_alerts[$alert['agent_name']][$alert['id_alert_template']][] = $alert;
}
// Prepare pagination
ui_pagination(
$nagents,
false,
0,
0,
false,
'offset',
true,
'',
'',
[
'count' => '',
'offset' => 'offset_param',
],
'alerts_agents'
);
echo '<table class="info_table" cellpadding="0" cellspacing="0" border="0" width=100%>';
echo '<thead><tr>';
echo "<th width='140px' >".__('Agents').' / '.__('Alert templates').'</th>';
if ($hor_offset > 0) {
$new_hor_offset = ($hor_offset - $block);
echo "<th width='20px' style='' rowspan='".($nagents + 1)."'>
<a href='index.php?sec=extensions&sec2=extensions/agents_alerts&refr=0&hor_offset=".$new_hor_offset.'&offset='.$offset.'&group_id='.$group_id."'>".html_print_image('images/darrowleft.png', true, ['title' => __('Previous templates')]).'</a> </th>';
}
$templates_raw = [];
if (!empty($templates)) {
$sql = sprintf(
'SELECT id, name
FROM talert_templates
WHERE id IN (%s)',
implode(',', array_keys($templates))
);
$templates_raw = db_get_all_rows_sql($sql);
}
if (empty($templates_raw)) {
$templates_raw = [];
}
$alerts = [];
$ntemplates = 0;
foreach ($templates_raw as $temp) {
if (isset($templates[$temp['id']]) && $templates[$temp['id']] == '') {
$ntemplates++;
if ($ntemplates <= $hor_offset || $ntemplates > ($hor_offset + $block)) {
continue;
}
$templates[$temp['id']] = $temp['name'];
}
}
foreach ($templates as $tid => $tname) {
if ($tname == '') {
continue;
}
echo '<th width="20px" >'.io_safe_output($tname).'</th>';
}
echo '</tr></thead>';
if (($hor_offset + $block) < $ntemplates) {
$new_hor_offset = ($hor_offset + $block);
echo "<th width='20px' style='' rowspan='".($nagents + 1)."'>
<a href='index.php?sec=extensions&sec2=extensions/agents_alerts&hor_offset=".$new_hor_offset.'&offset='.$offset.'&group_id='.$group_id."'>".html_print_image('images/darrowright.png', true, ['title' => __('More templates')]).'</a> </th>';
}
foreach ($agents as $agent) {
$alias = db_get_row('tagente', 'id_agente', $agent['id_agente']);
echo '<tr>';
// Name of the agent
echo '<td style="font-weight:bold;">'.$alias['alias'].'</td>';
// Alerts of the agent
$anyfired = false;
foreach ($templates as $tid => $tname) {
if ($tname == '') {
continue;
}
if (isset($agent_alerts[$agent['nombre']][$tid])) {
foreach ($agent_alerts[$agent['nombre']][$tid] as $alert) {
if ($alert['times_fired'] > 0) {
$anyfired = true;
}
}
$cellstyle = '';
if ($anyfired) {
$cellstyle = 'background:'.COL_ALERTFIRED.';';
}
echo '<td style=";'.$cellstyle.'" class="action_buttons"> ';
$uniqid = uniqid();
echo '<div>';
echo count($agent_alerts[$agent['nombre']][$tid]).' '.__('Alerts').' ';
echo "<a href='javascript:show_alerts_details(\"$uniqid\")'>".html_print_image('images/zoom.png', true).'</a>';
echo '</div>';
print_alerts_summary_modal_window($uniqid, $agent_alerts[$agent['nombre']][$tid]);
} else {
echo '<td style="text-align:center"> ';
}
echo '</td>';
}
echo '</tr>';
}
echo '</table>';
ui_pagination(
$nagents,
false,
0,
0,
false,
'offset',
true,
'pagination-bottom',
'',
[
'count' => '',
'offset' => 'offset_param',
],
'alerts_agents'
);
// Stop this execution, but continue 'globally'.
return;
}
// AJAX controller.
if (is_ajax() === true) {
$method = get_parameter('method');
if (method_exists($obj, $method) === true) {
$obj->{$method}();
} else {
$obj->error('Method not found. ['.$method.']');
}
// Stop any execution.
exit;
} else {
// Run.
$obj->run();
}
}
// Print the modal window for the summary of each alerts group
function print_alerts_summary_modal_window($id, $alerts)
{
$table->width = '98%';
$table->class = 'info_table';
$table->data = [];
$table->head[0] = __('Module');
$table->head[1] = __('Action');
$table->head[2] = __('Last fired');
$table->head[3] = __('Status');
foreach ($alerts as $alert) {
$data[0] = modules_get_agentmodule_name($alert['id_agent_module']);
$actions = alerts_get_alert_agent_module_actions($alert['id']);
$actionDefault = db_get_value_sql(
'
SELECT id_alert_action
FROM talert_templates
WHERE id = '.$alert['id_alert_template']
);
$actionText = '';
if (!empty($actions)) {
$actionText = '<div style="margin-left: 10px;"><ul class="action_list">';
foreach ($actions as $action) {
$actionText .= '<div><span class="action_name"><li>'.$action['name'];
if ($action['fires_min'] != $action['fires_max']) {
$actionText .= ' ('.$action['fires_min'].' / '.$action['fires_max'].')';
}
$actionText .= '</li></span><br /></div>';
}
$actionText .= '</ul></div>';
} else {
if (!empty($actionDefault)) {
$actionText = db_get_sql(
"SELECT name
FROM talert_actions
WHERE id = $actionDefault"
).' <i>('.__('Default').')</i>';
}
}
$data[1] = $actionText;
$data[2] = ui_print_timestamp($alert['last_fired'], true);
$status = STATUS_ALERT_NOT_FIRED;
if ($alert['times_fired'] > 0) {
$status = STATUS_ALERT_FIRED;
$title = __('Alert fired').' '.$alert['internal_counter'].' '.__('time(s)');
} else if ($alert['disabled'] > 0) {
$status = STATUS_ALERT_DISABLED;
$title = __('Alert disabled');
} else {
$status = STATUS_ALERT_NOT_FIRED;
$title = __('Alert not fired');
}
$data[3] = ui_print_status_image($status, $title, true);
array_push($table->data, $data);
}
$content = html_print_table($table, true);
$agent = modules_get_agentmodule_agent_alias($alerts[0]['id_agent_module']);
$template = alerts_get_alert_template_name($alerts[0]['id_alert_template']);
echo '<div id="alerts_details_'.$id.'" title="'.__('Agent').': '.$agent.' / '.__('Template').': '.$template.'" style="display:none">'.$content.'</div>';
}
extensions_add_operation_menu_option(__('Agents/Alerts view'), 'estado', null, 'v1r1', 'view');
extensions_add_main_function('mainAgentsAlerts');
ui_require_jquery_file('pandora');
?>
<script type="text/javascript">
function show_alerts_details(id) {
$("#alerts_details_"+id).dialog({
resizable: true,
draggable: true,
modal: true,
height: 280,
width: 800,
overlay: {
opacity: 0.5,
background: "black"
}
});
}
function show_add_alerts(id) {
$("#add_alerts_dialog_"+id).dialog({
resizable: true,
draggable: true,
modal: true,
height: 235,
width: 600,
overlay: {
opacity: 0.5,
background: "black"
}
});
}
// checkbox-slides_ids
$(document).ready(function () {
$('#checkbox-slides_ids').click(function(){
if ($('#checkbox-slides_ids').prop('checked')){
var url = location.href.replace("&show_modules=true", "");
location.href = url+"&show_modules=true";
} else {
var url = location.href.replace("&show_modules=true", "");
var re = /&offset=\d*/g;
location.href = url.replace(re, "");
}
});
$('#group_id').change(function(){
if(location.href.indexOf("extensions/agents_modules") == -1){
var regx = /&group_id=\d*/g;
var url = location.href.replace(regx, "");
location.href = url+"&group_id="+$("#group_id").val();
}
});
});
</script>

View File

@ -26,17 +26,6 @@ function agents_modules_load_js()
$ignored_params['refresh'] = '';
?>
<style type='text/css'>
.rotate_text_module {
-ms-transform: rotate(270deg);
-webkit-transform: rotate(270deg);
-moz-transform: rotate(270deg);
-o-transform: rotate(270deg);
writing-mode: lr-tb;
white-space: nowrap;
}
</style>
<script type='text/javascript'>
$(document).ready(function () {
//Get max width of name of modules

View File

@ -468,6 +468,7 @@ function quickShellSettings()
100,
true
);
$hidden->data[1][1] .= ui_print_reveal_password('gotty_pass', true);
html_print_table($t);

View File

@ -1,22 +1,42 @@
<?php
/**
* Funtions real time.
*
* @category Realtime
* @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-2014 Artica Soluciones Tecnologicas
// Please see http://pandorafms.org for full contribution list
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; version 2
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
global $config;
require_once $config['homedir'].'/include/graphs/fgraph.php';
require_once $config['homedir'].'/include/functions_snmp_browser.php';
/**
* Real time charts.
*
* @return void
*/
function pandora_realtime_graphs()
{
global $config;
@ -28,7 +48,7 @@ function pandora_realtime_graphs()
$onheader = [];
$hide_header = get_parameter('hide_header', 0);
if (!$hide_header) {
if ($hide_header === 0) {
ui_print_page_header(
__('Realtime graphs'),
'images/extensions.png',
@ -96,18 +116,42 @@ function pandora_realtime_graphs()
$table->data = [];
$graph_fields['cpu_load'] = __('%s Server CPU', get_product_name());
$graph_fields['pending_packets'] = __('Pending packages from %s Server', get_product_name());
$graph_fields['disk_io_wait'] = __('%s Server Disk IO Wait', get_product_name());
$graph_fields['apache_load'] = __('%s Server Apache load', get_product_name());
$graph_fields['mysql_load'] = __('%s Server MySQL load', get_product_name());
$graph_fields['server_load'] = __('%s Server load', get_product_name());
$graph_fields['pending_packets'] = __(
'Pending packages from %s Server',
get_product_name()
);
$graph_fields['disk_io_wait'] = __(
'%s Server Disk IO Wait',
get_product_name()
);
$graph_fields['apache_load'] = __(
'%s Server Apache load',
get_product_name()
);
$graph_fields['mysql_load'] = __(
'%s Server MySQL load',
get_product_name()
);
$graph_fields['server_load'] = __(
'%s Server load',
get_product_name()
);
$graph_fields['snmp_interface'] = __('SNMP Interface throughput');
$graph = get_parameter('graph', 'cpu_load');
$refresh = get_parameter('refresh', '1000');
if ($graph != 'snmp_module') {
$data['graph'] = __('Graph').'&nbsp;&nbsp;'.html_print_select($graph_fields, 'graph', $graph, '', '', 0, true);
$data['graph'] = __('Graph').'&nbsp;&nbsp;';
$data['graph'] .= html_print_select(
$graph_fields,
'graph',
$graph,
'',
'',
0,
true
);
}
$refresh_fields[1000] = human_time_description_raw(1, true, 'large');
@ -119,10 +163,14 @@ function pandora_realtime_graphs()
$agent_alias = io_safe_output(get_parameter('agent_alias', ''));
$module_name = io_safe_output(get_parameter('module_name', ''));
$module_incremental = get_parameter('incremental', 0);
$data['module_info'] = "$agent_alias: <b>$module_name</b>";
$data['module_info'] = $agent_alias.': <b>'.$module_name.'</b>';
// Append all the hidden in this cell
$data['module_info'] .= html_print_input_hidden('incremental', $module_incremental, true);
// Append all the hidden in this cell.
$data['module_info'] .= html_print_input_hidden(
'incremental',
$module_incremental,
true
);
$data['module_info'] .= html_print_select(
['snmp_module' => '-'],
'graph',
@ -139,76 +187,72 @@ function pandora_realtime_graphs()
);
}
$data['refresh'] = __('Refresh interval').'&nbsp;&nbsp;'.html_print_select($refresh_fields, 'refresh', $refresh, '', '', 0, true);
$data['refresh'] = __('Refresh interval').'&nbsp;&nbsp;';
$data['refresh'] .= html_print_select(
$refresh_fields,
'refresh',
$refresh,
'',
'',
0,
true
);
if ($graph != 'snmp_module') {
$data['incremental'] = __('Incremental').'&nbsp;&nbsp;'.html_print_checkbox('incremental', 1, 0, true);
$data['incremental'] = __('Incremental').'&nbsp;&nbsp;';
$data['incremental'] .= html_print_checkbox('incremental', 1, 0, true);
}
$data['reset'] = html_print_button(__('Clear graph'), 'reset', false, 'javascript:realtimeGraphs.clearGraph();', 'class="sub delete" style="margin-top:0px;"', true);
$data['reset'] = html_print_button(
__('Clear graph'),
'reset',
false,
'javascript:realtimeGraphs.clearGraph();',
'class="sub delete" style="margin-top:0px;"',
true
);
$table->data[] = $data;
if ($graph == 'snmp_interface' || $graph == 'snmp_module') {
$snmp_address = get_parameter('snmp_address', '');
$snmp_community = get_parameter('snmp_community', '');
$snmp_oid = get_parameter('snmp_oid', '');
$snmp_ver = get_parameter('snmp_ver', '');
$data = [];
$data['snmp_address'] = __('Target IP').'&nbsp;&nbsp;'.html_print_input_text('ip_target', $snmp_address, '', 50, 255, true);
$table->colspan[1]['snmp_address'] = 2;
$data['snmp_community'] = __('Community').'&nbsp;&nbsp;'.html_print_input_text('snmp_community', $snmp_community, '', 50, 255, true);
$table->colspan[1]['snmp_community'] = 2;
$table->data[] = $data;
$snmp_versions = [];
$snmp_versions['1'] = '1';
$snmp_versions['2'] = '2';
$snmp_versions['2c'] = '2c';
$data = [];
$data['snmp_oid'] = __('OID').'&nbsp;&nbsp;'.html_print_input_text('snmp_oid', $snmp_oid, '', 100, 255, true);
$table->colspan[2]['snmp_oid'] = 2;
$data['snmp_ver'] = __('Version').'&nbsp;&nbsp;'.html_print_select($snmp_versions, 'snmp_version', $snmp_ver, '', '', 0, true);
$data['snmp_ver'] .= '&nbsp;&nbsp;'.html_print_button(__('SNMP walk'), 'snmp_walk', false, 'javascript:snmpBrowserWindow();', 'class="sub next"', true);
$table->colspan[2]['snmp_ver'] = 2;
$table->data[] = $data;
// Hide some options in snmp_module graphs
if ($graph == 'snmp_module') {
$table->rowstyle[1] = 'display: none;';
$table->rowstyle[2] = 'display: none;';
}
snmp_browser_print_container(false, '100%', '60%', 'none');
echo snmp_browser_print_container(true, '100%', '60%', 'none');
}
// Print the relative path to AJAX calls:
// Print the relative path to AJAX calls.
html_print_input_hidden('rel_path', get_parameter('rel_path', ''));
// Print the form
// Print the form.
echo '<form id="realgraph" method="post">';
html_print_table($table);
echo '</form>';
// Define a custom action to save the OID selected in the SNMP browser to the form
html_print_input_hidden('custom_action', urlencode(base64_encode('&nbsp;<a href="javascript:realtimeGraphs.setOID();"><img src="'.ui_get_full_url('images').'/input_filter.disabled.png" title="'.__('Use this OID').'" style="vertical-align: middle;"></img></a>')), false);
// Define a custom action to save
// the OID selected in the SNMP browser to the form.
html_print_input_hidden(
'custom_action',
urlencode(
base64_encode(
'&nbsp;<a href="javascript:realtimeGraphs.setOID();"><img src="'.ui_get_full_url('images').'/input_filter.disabled.png" title="'.__('Use this OID').'" style="vertical-align: middle;"></img></a>'
)
),
false
);
html_print_input_hidden('incremental_base', '0');
echo '<script type="text/javascript" src="'.ui_get_full_url('include/javascript/pandora_snmp_browser.js').'"></script>';
echo '<script type="text/javascript" src="'.ui_get_full_url('extensions/realtime_graphs/realtime_graphs.js').'"></script>';
echo '<link rel="stylesheet" type="text/css" href="'.ui_get_full_url('extensions/realtime_graphs/realtime_graphs.css').'"></style>';
// Store servers timezone offset to be retrieved from js
// Store servers timezone offset to be retrieved from js.
set_js_value('timezone_offset', date('Z', time()));
}
extensions_add_operation_menu_option(__('Realtime graphs'), 'estado', null, 'v1r1', 'view');
extensions_add_operation_menu_option(
__('Realtime graphs'),
'estado',
null,
'v1r1',
'view'
);
extensions_add_main_function('pandora_realtime_graphs');
$db = null;

View File

@ -69,15 +69,34 @@ switch ($graph) {
case 'snmp_interface':
case 'snmp_module':
$snmp_address = $_POST['snmp_address'];
$snmp_community = $_POST['snmp_community'];
$snmp_ver = $_POST['snmp_ver'];
$snmp_oid = $_POST['snmp_oid'];
$snmp_address = get_parameter('snmp_address', '');
$snmp_community = get_parameter('snmp_community', '');
$snmp_ver = get_parameter('snmp_ver', '');
$snmp_oid = get_parameter('snmp_oid', '');
$snmp3_auth_user = get_parameter('snmp3_auth_user', '');
$snmp3_security_level = get_parameter('snmp3_security_level', '');
$snmp3_auth_method = get_parameter('snmp3_auth_method', '');
$snmp3_auth_pass = get_parameter('snmp3_auth_pass', '');
$snmp3_privacy_method = get_parameter('snmp3_privacy_method', '');
$snmp3_privacy_pass = get_parameter('snmp3_privacy_pass', '');
if (empty($snmp_address) || empty($snmp_oid)) {
$data = 0;
} else {
$data = get_snmpwalk($snmp_address, $snmp_ver, $snmp_community, '', '', '', '', '', '', 0, $snmp_oid);
$data = get_snmpwalk(
$snmp_address,
$snmp_ver,
$snmp_community,
$snmp3_auth_user,
$snmp3_security_level,
$snmp3_auth_method,
$snmp3_auth_pass,
$snmp3_privacy_method,
$snmp3_privacy_pass,
0,
$snmp_oid,
$snmp_port
);
$data_index = array_keys($data);
$graph_title = $data_index[0];
if (!empty($data)) {

View File

@ -1,3 +1,4 @@
/* global $, get_php_value */
(function() {
var numberOfPoints = 100;
var refresh = parseInt($("#refresh").val());
@ -14,7 +15,7 @@
container: $("#chartLegend")
},
xaxis: {
tickFormatter: function(timestamp, axis) {
tickFormatter: function(timestamp) {
var date = new Date(timestamp * 1000);
var server_timezone_offset = get_php_value("timezone_offset");
@ -39,7 +40,7 @@
}
},
yaxis: {
tickFormatter: function(value, axis) {
tickFormatter: function(value) {
return shortNumber(roundToTwo(value));
}
},
@ -66,10 +67,16 @@
data: {
graph: $("#graph :selected").val(),
graph_title: $("#graph :selected").html(),
snmp_community: $("#text-snmp_community").val(),
snmp_oid: $("#text-snmp_oid").val(),
snmp_ver: $("#snmp_version :selected").val(),
snmp_address: $("#text-ip_target").val(),
snmp_community: $("#text-community").val(),
snmp_oid: $("#text-starting_oid").val(),
snmp_ver: $("#snmp_browser_version").val(),
snmp_address: $("#text-target_ip").val(),
snmp3_auth_user: $("#text-snmp3_browser_auth_user").val(),
snmp3_security_level: $("#snmp3_browser_security_level").val(),
snmp3_auth_method: $("#snmp3_browser_auth_method").val(),
snmp3_auth_pass: $("#password-snmp3_browser_auth_pass").val(),
snmp3_privacy_method: $("#snmp3_browser_privacy_method").val(),
snmp3_privacy_pass: $("#password-snmp3_browser_privacy_pass").val(),
refresh: refresh
},
success: function(serie) {
@ -87,7 +94,7 @@
}
if (data.length === 0) {
for (i = 0; i < numberOfPoints; i++) {
for (var i = 0; i < numberOfPoints; i++) {
var step = i * (refresh / 1000);
serie.data.unshift([timestamp - step, 0]);
}
@ -123,7 +130,7 @@
var data = plot.getData();
if (data.length === 0) return;
for (i = 0; i < data[0].data.length; i++) {
for (var i = 0; i < data[0].data.length; i++) {
data[0].data[i][1] = 0;
}
if (incremental) lastIncVal = null;

View File

@ -0,0 +1,31 @@
START TRANSACTION;
CREATE TABLE `tinventory_alert`(
`id` int UNSIGNED NOT NULL auto_increment,
`id_module_inventory` int(10) NOT NULL,
`actions` text NOT NULL default '',
`id_group` mediumint(8) unsigned NULL default 0,
`condition` enum('WHITE_LIST', 'BLACK_LIST', 'MATCH') NOT NULL default 'WHITE_LIST',
`value` text NOT NULL default '',
`name` tinytext NOT NULL default '',
`description` text NOT NULL default '',
`time_threshold` int(10) NOT NULL default '0',
`last_fired` text NOT NULL default '',
`disable_event` tinyint(1) UNSIGNED default 0,
`enabled` tinyint(1) UNSIGNED default 1,
PRIMARY KEY (`id`),
FOREIGN KEY (`id_module_inventory`) REFERENCES tmodule_inventory(`id_module_inventory`)
ON DELETE CASCADE ON UPDATE CASCADE
) engine=InnoDB DEFAULT CHARSET=utf8;
ALTER TABLE `tagente_modulo` ADD COLUMN `debug_content` varchar(200);
INSERT IGNORE INTO tuser_task VALUES (8, 'cron_task_generate_csv_log', 'a:1:{i:0;a:2:{s:11:"description";s:14:"Send to e-mail";s:4:"type";s:4:"text";}}', 'Send csv log');
ALTER TABLE `talert_snmp` ADD COLUMN `al_field16` TEXT NOT NULL AFTER `al_field15`;
ALTER TABLE `talert_snmp` ADD COLUMN `al_field17` TEXT NOT NULL AFTER `al_field16`;
ALTER TABLE `talert_snmp` ADD COLUMN `al_field18` TEXT NOT NULL AFTER `al_field17`;
ALTER TABLE `talert_snmp` ADD COLUMN `al_field19` TEXT NOT NULL AFTER `al_field18`;
ALTER TABLE `talert_snmp` ADD COLUMN `al_field20` TEXT NOT NULL AFTER `al_field19`;
COMMIT;

View File

@ -0,0 +1,15 @@
START TRANSACTION;
ALTER TABLE `talert_templates`
ADD COLUMN `field16` TEXT NOT NULL AFTER `field15`
,ADD COLUMN `field17` TEXT NOT NULL AFTER `field16`
,ADD COLUMN `field18` TEXT NOT NULL AFTER `field17`
,ADD COLUMN `field19` TEXT NOT NULL AFTER `field18`
,ADD COLUMN `field20` TEXT NOT NULL AFTER `field19`
,ADD COLUMN `field16_recovery` TEXT NOT NULL AFTER `field15_recovery`
,ADD COLUMN `field17_recovery` TEXT NOT NULL AFTER `field16_recovery`
,ADD COLUMN `field18_recovery` TEXT NOT NULL AFTER `field17_recovery`
,ADD COLUMN `field19_recovery` TEXT NOT NULL AFTER `field18_recovery`
,ADD COLUMN `field20_recovery` TEXT NOT NULL AFTER `field19_recovery`;
COMMIT;

View File

@ -347,6 +347,27 @@ CREATE TABLE IF NOT EXISTS `tagente_datos_inventory` (
KEY `idx_utimestamp` USING BTREE (`utimestamp`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- -----------------------------------------------------
-- Table `tinventory_alert`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `tinventory_alert`(
`id` int UNSIGNED NOT NULL auto_increment,
`id_module_inventory` int(10) NOT NULL,
`actions` text NOT NULL default '',
`id_group` mediumint(8) unsigned NULL default 0,
`condition` enum('WHITE_LIST', 'BLACK_LIST', 'MATCH') NOT NULL default 'WHITE_LIST',
`value` text NOT NULL default '',
`name` tinytext NOT NULL default '',
`description` text NOT NULL default '',
`time_threshold` int(10) NOT NULL default '0',
`last_fired` text NOT NULL default '',
`disable_event` tinyint(1) UNSIGNED default 0,
`enabled` tinyint(1) UNSIGNED default 1,
PRIMARY KEY (`id`),
FOREIGN KEY (`id_module_inventory`) REFERENCES tmodule_inventory(`id_module_inventory`)
ON DELETE CASCADE ON UPDATE CASCADE
) engine=InnoDB DEFAULT CHARSET=utf8;
-- -----------------------------------------------------
-- Table `ttrap_custom_values`
-- -----------------------------------------------------
@ -1246,21 +1267,36 @@ ALTER TABLE talert_templates ADD COLUMN `field12` TEXT NOT NULL DEFAULT "";
ALTER TABLE talert_templates ADD COLUMN `field13` TEXT NOT NULL DEFAULT "";
ALTER TABLE talert_templates ADD COLUMN `field14` TEXT NOT NULL DEFAULT "";
ALTER TABLE talert_templates ADD COLUMN `field15` TEXT NOT NULL DEFAULT "";
ALTER TABLE talert_templates ADD COLUMN `field16` TEXT NOT NULL DEFAULT "";
ALTER TABLE talert_templates ADD COLUMN `field17` TEXT NOT NULL DEFAULT "";
ALTER TABLE talert_templates ADD COLUMN `field18` TEXT NOT NULL DEFAULT "";
ALTER TABLE talert_templates ADD COLUMN `field19` TEXT NOT NULL DEFAULT "";
ALTER TABLE talert_templates ADD COLUMN `field20` TEXT NOT NULL DEFAULT "";
ALTER TABLE talert_templates ADD COLUMN `field11_recovery` TEXT NOT NULL DEFAULT "";
ALTER TABLE talert_templates ADD COLUMN `field12_recovery` TEXT NOT NULL DEFAULT "";
ALTER TABLE talert_templates ADD COLUMN `field13_recovery` TEXT NOT NULL DEFAULT "";
ALTER TABLE talert_templates ADD COLUMN `field14_recovery` TEXT NOT NULL DEFAULT "";
ALTER TABLE talert_templates ADD COLUMN `field15_recovery` TEXT NOT NULL DEFAULT "";
ALTER TABLE talert_templates ADD COLUMN `field16_recovery` TEXT NOT NULL DEFAULT "";
ALTER TABLE talert_templates ADD COLUMN `field17_recovery` TEXT NOT NULL DEFAULT "";
ALTER TABLE talert_templates ADD COLUMN `field18_recovery` TEXT NOT NULL DEFAULT "";
ALTER TABLE talert_templates ADD COLUMN `field19_recovery` TEXT NOT NULL DEFAULT "";
ALTER TABLE talert_templates ADD COLUMN `field20_recovery` TEXT NOT NULL DEFAULT "";
ALTER TABLE `talert_templates` ADD COLUMN `disable_event` tinyint(1) DEFAULT 0;
-- ---------------------------------------------------------------------
-- Table `talert_snmp`
-- ---------------------------------------------------------------------
ALTER TABLE talert_snmp ADD COLUMN `al_field11` TEXT NOT NULL DEFAULT "";
ALTER TABLE talert_snmp ADD COLUMN `al_field12` TEXT NOT NULL DEFAULT "";
ALTER TABLE talert_snmp ADD COLUMN `al_field13` TEXT NOT NULL DEFAULT "";
ALTER TABLE talert_snmp ADD COLUMN `al_field14` TEXT NOT NULL DEFAULT "";
ALTER TABLE talert_snmp ADD COLUMN `al_field15` TEXT NOT NULL DEFAULT "";
ALTER TABLE `talert_snmp` ADD COLUMN `al_field11` TEXT NOT NULL DEFAULT "";
ALTER TABLE `talert_snmp` ADD COLUMN `al_field12` TEXT NOT NULL DEFAULT "";
ALTER TABLE `talert_snmp` ADD COLUMN `al_field13` TEXT NOT NULL DEFAULT "";
ALTER TABLE `talert_snmp` ADD COLUMN `al_field14` TEXT NOT NULL DEFAULT "";
ALTER TABLE `talert_snmp` ADD COLUMN `al_field15` TEXT NOT NULL DEFAULT "";
ALTER TABLE `talert_snmp` ADD COLUMN `al_field16` TEXT NOT NULL DEFAULT "";
ALTER TABLE `talert_snmp` ADD COLUMN `al_field17` TEXT NOT NULL DEFAULT "";
ALTER TABLE `talert_snmp` ADD COLUMN `al_field18` TEXT NOT NULL DEFAULT "";
ALTER TABLE `talert_snmp` ADD COLUMN `al_field19` TEXT NOT NULL DEFAULT "";
ALTER TABLE `talert_snmp` ADD COLUMN `al_field20` TEXT NOT NULL DEFAULT "";
ALTER TABLE `talert_snmp` ADD COLUMN `disable_event` tinyint(1) DEFAULT 0;
ALTER TABLE `talert_snmp` MODIFY COLUMN `al_field11` text NOT NULL,
MODIFY COLUMN `al_field12` text NOT NULL,
@ -1268,6 +1304,7 @@ ALTER TABLE `talert_snmp` MODIFY COLUMN `al_field11` text NOT NULL,
MODIFY COLUMN `al_field14` text NOT NULL,
MODIFY COLUMN `al_field15` text NOT NULL;
-- ---------------------------------------------------------------------
-- Table `talert_snmp_action`
-- ---------------------------------------------------------------------
@ -1482,6 +1519,7 @@ ALTER TABLE `tagente_modulo` DROP COLUMN `ff_normal`,
MODIFY COLUMN `dynamic_next` bigint(20) NOT NULL DEFAULT '0',
MODIFY COLUMN `dynamic_two_tailed` tinyint(1) unsigned NULL DEFAULT '0';
ALTER TABLE tagente_modulo MODIFY COLUMN `custom_string_1` MEDIUMTEXT;
ALTER TABLE `tagente_modulo` ADD COLUMN `debug_content` varchar(200);
-- ---------------------------------------------------------------------
-- Table `tagente_datos`
@ -2486,6 +2524,7 @@ ALTER TABLE `tnetflow_filter` MODIFY COLUMN `router_ip` text NOT NULL;
-- Update table `tuser_task`
-- ----------------------------------------------------------------------
UPDATE tuser_task set parameters = 'a:5:{i:0;a:6:{s:11:\"description\";s:28:\"Report pending to be created\";s:5:\"table\";s:7:\"treport\";s:8:\"field_id\";s:9:\"id_report\";s:10:\"field_name\";s:4:\"name\";s:4:\"type\";s:3:\"int\";s:9:\"acl_group\";s:8:\"id_group\";}i:1;a:2:{s:11:\"description\";s:46:\"Send to email addresses (separated by a comma)\";s:4:\"type\";s:4:\"text\";}i:2;a:2:{s:11:\"description\";s:7:\"Subject\";s:8:\"optional\";i:1;}i:3;a:3:{s:11:\"description\";s:7:\"Message\";s:4:\"type\";s:4:\"text\";s:8:\"optional\";i:1;}i:4;a:2:{s:11:\"description\";s:11:\"Report Type\";s:4:\"type\";s:11:\"report_type\";}}' where function_name = "cron_task_generate_report";
INSERT IGNORE INTO tuser_task VALUES (8, 'cron_task_generate_csv_log', 'a:1:{i:0;a:2:{s:11:"description";s:14:"Send to e-mail";s:4:"type";s:4:"text";}}', 'Send csv log');
-- ----------------------------------------------------------------------
-- ADD message in table 'tnews'

View File

@ -1,15 +1,17 @@
<?php
// Pandora FMS - http://pandorafms.com
// ==================================================
// 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; 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-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; version 2
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
require_once 'include/functions_messages.php';
require_once 'include/functions_servers.php';
require_once 'include/functions_notifications.php';
@ -142,7 +144,7 @@ if ($config['menu_type'] == 'classic') {
}
if ($_GET['sec'] == 'main' || !isset($_GET['sec'])) {
// home screen chosen by the user
// Home screen chosen by the user.
$home_page = '';
if (isset($config['id_user'])) {
$user_info = users_get_user_by_id($config['id_user']);
@ -169,6 +171,7 @@ if ($config['menu_type'] == 'classic') {
break;
case 'Default':
default:
$_GET['sec2'] = 'general/logon_ok';
break;
@ -763,6 +766,7 @@ if ($config['menu_type'] == 'classic') {
page: 'include/ajax/order_interpreter',
method: 'getResult',
text: $('#keywords').val(),
enterprise: <?php echo (int) enterprise_installed(); ?>,
},
success: function (data) {
$('#result_order').html(data);

View File

@ -114,12 +114,6 @@ foreach ($custom_fields as $field) {
}
}
// Connection lost alert.
ui_require_css_file('register', 'include/styles/', true);
ui_require_javascript_file('connection_check');
$conn_title = __('Connection with server has been lost');
$conn_text = __('Connection to the server has been lost. Please check your internet connection or contact with administrator.');
ui_print_message_dialog($conn_title, $conn_text, 'connection', '/images/error_1.png');
// Get the custom icons.
$docs_logo = ui_get_docs_logo();
@ -165,11 +159,31 @@ echo '<div class="container_login">';
echo '<div class="login_page">';
echo '<form method="post" action="'.ui_get_full_url('index.php'.$url).'" ><div class="login_logo_icon">';
echo '<a href="'.$logo_link.'">';
if (defined('METACONSOLE')) {
if (is_metaconsole() === true) {
if (!isset($config['custom_logo_login'])) {
html_print_image(ui_get_full_url('images/custom_logo_login/login_logo.png'), false, ['class' => 'login_logo', 'alt' => 'logo', 'border' => 0, 'title' => $logo_title], false, true);
html_print_image(
'enterprise/images/custom_logo_login/login_logo.png',
false,
[
'class' => 'login_logo',
'alt' => 'logo',
'border' => 0,
'title' => $logo_title,
],
false
);
} else {
html_print_image(ui_get_full_url('images/custom_logo_login/'.$config['custom_logo_login']), false, ['class' => 'login_logo', 'alt' => 'logo', 'border' => 0, 'title' => $logo_title], false, true);
html_print_image(
'enterprise/images/custom_logo_login/'.$config['custom_logo_login'],
false,
[
'class' => 'login_logo',
'alt' => 'logo',
'border' => 0,
'title' => $logo_title,
],
false
);
}
} else if (file_exists(ENTERPRISE_DIR.'/load_enterprise.php')) {
if (!isset($config['custom_logo_login'])) {
@ -350,9 +364,27 @@ if (file_exists(ENTERPRISE_DIR.'/load_enterprise.php')) {
echo '<div class ="img_banner_login">';
if (file_exists(ENTERPRISE_DIR.'/load_enterprise.php')) {
if (isset($config['custom_splash_login'])) {
html_print_image('enterprise/images/custom_splash_login/'.$config['custom_splash_login'], false, [ 'alt' => 'splash', 'border' => 0], false, true);
html_print_image(
'enterprise/images/custom_splash_login/'.$config['custom_splash_login'],
false,
[
'alt' => 'splash',
'border' => 0,
],
false,
false
);
} else {
html_print_image('enterprise/images/custom_splash_login/splash_image_default.png', false, ['alt' => 'logo', 'border' => 0], false, true);
html_print_image(
'enterprise/images/custom_splash_login/splash_image_default.png',
false,
[
'alt' => 'logo',
'border' => 0,
],
false,
false
);
}
} else {
html_print_image('images/splash_image_default.png', false, ['alt' => 'logo', 'border' => 0], false, true);

View File

@ -186,6 +186,88 @@ try {
$welcome = false;
}
$double_auth_enabled = (bool) db_get_value('id', 'tuser_double_auth', 'id_user', $config['id_user']);
if (!$double_auth_enabled && $config['2FA_all_users'] != ''
&& $config['2Fa_auth'] != '1'
&& $config['double_auth_enabled']
) {
echo '<div id="doble_auth_window" style="display: none"; >';
?>
<script type="text/javascript">
var userID = "<?php echo $config['id_user']; ?>";
var $loadingSpinner = $("<img src=\"<?php echo $config['homeurl']; ?>/images/spinner.gif\" />");
var $dialogContainer = $("div#doble_auth_window");
$dialogContainer.html($loadingSpinner);
// Load the info page
var request = $.ajax({
url: "<?php echo ui_get_full_url('ajax.php', false, false, false); ?>",
type: 'POST',
dataType: 'html',
data: {
page: 'include/ajax/double_auth.ajax',
id_user: userID,
get_double_auth_info_page: 1,
containerID: $dialogContainer.prop('id')
},
complete: function (xhr, textStatus) {
},
success: function (data, textStatus, xhr) {
// isNaN = is not a number
if (isNaN(data)) {
$dialogContainer.html(data);
}
// data is a number, convert it to integer to do the compare
else if (Number(data) === -1) {
$dialogContainer.html("<?php echo '<b><div class=\"red\">'.__('Authentication error').'</div></b>'; ?>");
}
else {
$dialogContainer.html("<?php echo '<b><div class=\"red\">'.__('Error').'</div></b>'; ?>");
}
},
error: function (xhr, textStatus, errorThrown) {
$dialogContainer.html("<?php echo '<b><div class=\"red\">'.__('There was an error loading the data').'</div></b>'; ?>");
}
});
$("div#doble_auth_window").dialog({
<?php config_update_value('2Fa_auth', ''); ?>
resizable: true,
draggable: true,
modal: true,
title: "<?php echo __('Double autentication activation'); ?>",
overlay: {
opacity: 0.5,
background: "black"
},
width: 500,
height: 400,
close: function (event, ui) {
<?php
if (!$double_auth_enabled) {
config_update_value('2Fa_auth', '1');
}
?>
// Abort the ajax request
if (typeof request != 'undefined'){
request.abort();
}
// Remove the contained html
$dialogContainer.empty();
//document.location.reload();
}
})
.show(); </script>
<?php
echo '</div>';
}
$newsletter = null;
?>

View File

@ -1,10 +1,10 @@
<?php
/**
* Credential store
* Monitoring SAP View
*
* @category HelperFeedBack
* @category Operations
* @package Pandora FMS
* @subpackage Help Feedback
* @subpackage Monitoring
* @version 1.0.0
* @license See below
*
@ -14,7 +14,7 @@
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2005-2019 Artica Soluciones Tecnologicas
* Copyright (c) 2005-2020 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
@ -38,16 +38,6 @@ enterprise_include_once('/include/class/SAPView.class.php');
$ajaxPage = 'general/sap_view';
// Header.
ui_print_page_header(
__('SAP view'),
'',
false,
'sap_view',
false,
''
);
// Control call flow.
try {
// User access and validation is being processed on class constructor.

View File

@ -535,20 +535,30 @@ $table_advanced->data[0][1] = html_print_input_text(
);
$table_advanced->data[0][3] = __('Unit');
// $table_advanced->data[1][4] = html_print_input_text ('unit', $unit, '', 20, 65, true,
// $disabledBecauseInPolicy, false, '', $classdisabledBecauseInPolicy);
// $table_advanced->colspan[1][4] = 3;
$table_advanced->data[0][4] = html_print_extended_select_for_unit(
$table_advanced->data[0][4] = html_print_input_text(
'unit',
$unit,
'',
'',
'0',
false,
20,
65,
true,
$disabledBecauseInPolicy,
false,
false
'',
$classdisabledBecauseInPolicy
);
// $table_advanced->colspan[1][4] = 3;
// $table_advanced->data[0][4] = html_print_extended_select_for_unit(
// 'unit',
// $unit,
// '',
// '',
// '0',
// false,
// true,
// false,
// false
// );
$table_advanced->colspan[0][4] = 3;
$module_id_policy_module = 0;

View File

@ -464,7 +464,7 @@ $data[1] = html_print_select(
$disabledBecauseInPolicy
);
$data[1] .= '<br> <br><a class="info_cell" href="'.ui_get_full_url('index.php?sec=gagente&sec2=godmode/groups/group_list&tab=credbox').'">'.__('Manage credentials').'</a>';
$data[1] .= '<br> <br><a class="info_cell" href="'.ui_get_full_url('index.php?sec=gmodules&sec2=godmode/groups/group_list&tab=credbox').'">'.__('Manage credentials').'</a>';
$array_os = [
'inherited' => __('Inherited'),

View File

@ -354,8 +354,8 @@ if ($create_downtime || $update_downtime) {
__('Not created. Error inserting data').'. '.__('The end date must be higher than the current time')
);
} else if ($type_execution == 'periodically'
&& (($type_periodicity == 'weekly' && $periodically_time_from >= $periodically_time_to)
|| ($type_periodicity == 'monthly' && $periodically_day_from == $periodically_day_to && $periodically_time_from >= $periodically_time_to))
&& $type_periodicity == 'monthly'
&& $periodically_day_from == $periodically_day_to
) {
ui_print_error_message(
__('Not created. Error inserting data').'. '.__('The end time must be higher than the start time')

View File

@ -148,7 +148,7 @@ if ($update_template) {
$recovery_notify = (bool) get_parameter('recovery_notify');
$fields_recovery = [];
for ($i = 1; $i <= 10; $i++) {
for ($i = 1; $i <= $config['max_macro_fields']; $i++) {
$values['field'.$i] = (string) get_parameter('field'.$i);
$values['field'.$i.'_recovery'] = ($recovery_notify) ? (string) get_parameter('field'.$i.'_recovery') : '';
}

View File

@ -138,7 +138,8 @@ if ($update || $create) {
['id_agente_modulo' => $id_agent_module]
)
);
}
}
$pagination = get_parameter('pagination', '');
$event_view_hr = get_parameter('event_view_hr', '');
$id_user_ack = get_parameter('id_user_ack', '');

View File

@ -248,17 +248,30 @@ if (is_ajax()) {
return;
}
if (! check_acl($config['id_user'], 0, 'PM')) {
$tab = (string) get_parameter('tab', 'groups');
if ($tab != 'credbox' && ! check_acl($config['id_user'], 0, 'PM')) {
db_pandora_audit(
'ACL Violation',
'Trying to access Group Management'
);
include 'general/noaccess.php';
return;
} else if ($tab == 'credbox'
&& !check_acl($config['id_user'], 0, 'UM')
&& !check_acl($config['id_user'], 0, 'PM')
) {
db_pandora_audit(
'ACL Violation',
'Trying to access Credential Store'
);
include 'general/noaccess.php';
return;
}
$sec = defined('METACONSOLE') ? 'advanced' : 'gagente';
$url_credbox = 'index.php?sec='.$sec.'&sec2=godmode/groups/group_list&tab=credbox';
$url_credbox = 'index.php?sec=gmodules&sec2=godmode/groups/group_list&tab=credbox';
$url_tree = 'index.php?sec='.$sec.'&sec2=godmode/groups/group_list&tab=tree';
$url_groups = 'index.php?sec='.$sec.'&sec2=godmode/groups/group_list&tab=groups';
@ -295,8 +308,6 @@ $buttons['credbox'] = [
).'</a>',
];
$tab = (string) get_parameter('tab', 'groups');
$title = __('Groups defined in %s', get_product_name());
// Marks correct tab.
switch ($tab) {
@ -419,45 +430,52 @@ if ($update_group) {
$aviable_name = false;
}
// Check if group name is unique.
$check = db_get_value_filter(
'nombre',
'tgrupo',
[
'nombre' => $name,
'id_grupo' => $id_group,
],
'AND NOT'
);
// Check if name field is empty.
if ($name != '' && $aviable_name === true) {
$sql = sprintf(
'UPDATE tgrupo
SET nombre = "%s",
icon = "%s",
disabled = %d,
parent = %d,
custom_id = "%s",
propagate = %d,
id_skin = %d,
description = "%s",
contact = "%s",
other = "%s",
password = "%s"
WHERE id_grupo = %d',
$name,
empty($icon) ? '' : substr($icon, 0, -4),
!$alerts_enabled,
$id_parent,
$custom_id,
$propagate,
$skin,
$description,
$contact,
$other,
$group_pass,
$id_group
);
if ($name != '') {
if (!$check) {
if ($aviable_name === true) {
$values = [
'nombre' => $name,
'icon' => empty($icon) ? '' : substr($icon, 0, -4),
'parent' => $id_parent,
'disabled' => !$alerts_enabled,
'custom_id' => $custom_id,
'id_skin' => $skin,
'description' => $description,
'contact' => $contact,
'propagate' => $propagate,
'other' => $other,
'password' => io_safe_input($group_pass),
];
$result = db_process_sql($sql);
} else {
$result = false;
}
$result = db_process_sql_update(
'tgrupo',
$values,
['id_grupo' => $id_group]
);
}
if ($result !== false) {
ui_print_success_message(__('Group successfully updated'));
if ($result) {
ui_print_success_message(__('Group successfully updated'));
} else {
ui_print_error_message(__('There was a problem modifying group'));
}
} else {
ui_print_error_message(__('Each group must have a different name'));
}
} else {
ui_print_error_message(__('There was a problem modifying group'));
ui_print_error_message(__('Group must have a name'));
}
}

View File

@ -67,10 +67,30 @@ if ($add) {
$modules = get_parameter('module');
$modules_id = [];
if (!empty($modules)) {
$modules_id = [];
foreach ($modules as $module) {
foreach ($id_agents as $id_agent) {
$module_id = modules_get_agentmodule_id($module, $id_agent);
$modules_id[] = $module_id['id_agente_modulo'];
if ($module == '0') {
// Get all modules of agent.
$agent_modules = db_get_all_rows_filter(
'tagente_modulo',
['id_agente' => $id_agent],
'id_agente_modulo'
);
$agent_modules_id = array_map(
function ($field) {
return $field['id_agente_modulo'];
},
$agent_modules
);
$modules_id = array_merge($modules_id, $agent_modules_id);
} else {
$module_id = modules_get_agentmodule_id($module, $id_agent);
$modules_id[] = $module_id['id_agente_modulo'];
}
}
}

View File

@ -106,15 +106,31 @@ function process_manage_add($id_alert_template, $id_agents, $module_names)
return false;
}
$modules_id = [];
foreach ($module_names as $module) {
foreach ($id_agents as $id_agent) {
$module_id = modules_get_agentmodule_id($module, $id_agent);
$modules_id[] = $module_id['id_agente_modulo'];
}
}
if ($module == '0') {
// Get all modules of agent.
$agent_modules = db_get_all_rows_filter(
'tagente_modulo',
['id_agente' => $id_agent],
'id_agente_modulo'
);
if (count($module_names) == 1 && $module_names[0] == '0') {
$modules_id = agents_common_modules($id_agents, false, true);
$agent_modules_id = array_map(
function ($field) {
return $field['id_agente_modulo'];
},
$agent_modules
);
$modules_id = array_merge($modules_id, $agent_modules_id);
} else {
$module_id = modules_get_agentmodule_id($module, $id_agent);
$modules_id[] = $module_id['id_agente_modulo'];
}
}
}
$conttotal = 0;

View File

@ -66,10 +66,29 @@ if ($delete) {
$modules = (array) get_parameter('module');
$modules_id = [];
if (!empty($modules)) {
$modules_id = [];
foreach ($modules as $module) {
foreach ($id_agents as $id_agent) {
$module_id = modules_get_agentmodule_id($module, $id_agent);
$modules_id[] = $module_id['id_agente_modulo'];
if ($module == '0') {
// Get all modules of agent.
$agent_modules = db_get_all_rows_filter(
'tagente_modulo',
['id_agente' => $id_agent],
'id_agente_modulo'
);
$agent_modules_id = array_map(
function ($field) {
return $field['id_agente_modulo'];
},
$agent_modules
);
$modules_id = array_merge($modules_id, $agent_modules_id);
} else {
$module_id = modules_get_agentmodule_id($module, $id_agent);
$modules_id[] = $module_id['id_agente_modulo'];
}
}
}

View File

@ -450,7 +450,7 @@ $table->data['form_modules_2'][1] = html_print_select(
'',
false,
'width:100%'
);
).' '.__('Select all modules').' '.html_print_checkbox('select_all_modules', 1, false, true, false, '', false, "class='static'");
$table->data['form_modules_2'][2] = __('When select modules');
$table->data['form_modules_2'][2] .= '<br>';
@ -522,7 +522,8 @@ $table->data['form_agents_3'][1] = html_print_select(
'',
false,
'width:100%'
);
).' '.__('Select all agents').' '.html_print_checkbox('select_all_agents', 1, false, true, false, '', false, "class='static'");
$table->data['form_agents_3'][2] = __('When select agents');
$table->data['form_agents_3'][2] .= '<br>';
$table->data['form_agents_3'][2] .= html_print_select(
@ -588,6 +589,44 @@ if ($selection_mode == 'modules') {
var limit_parameters_massive = <?php echo $config['limit_parameters_massive']; ?>;
$(document).ready (function () {
$("#checkbox-select_all_modules").change(function() {
if( $('#checkbox-select_all_modules').prop('checked')) {
$("#module_name option").prop('selected', 'selected');
$("#module_name").trigger('change');
} else {
$("#module_name option").prop('selected', false);
$("#module_name").trigger('change');
}
});
$("#module_name").change(function() {
var options_length = $("#module_name option").length;
var options_selected_length = $("#module_name option:selected").length;
if (options_selected_length < options_length) {
$('#checkbox-select_all_modules').prop("checked", false);
}
});
$("#checkbox-select_all_agents").change(function() {
if( $('#checkbox-select_all_agents').prop('checked')) {
$("#id_agents option").prop('selected', 'selected');
$("#id_agents").trigger('change');
} else {
$("#id_agents option").prop('selected', false);
$("#id_agents").trigger('change');
}
});
$("#id_agents").change(function() {
var options_length = $("#id_agents option").length;
var options_selected_length = $("#id_agents option:selected").length;
if (options_selected_length < options_length) {
$('#checkbox-select_all_agents').prop("checked", false);
}
});
$("#id_agents").change(agent_changed_by_multiple_agents);
$("#module_name").change(module_changed_by_multiple_modules);
@ -680,7 +719,7 @@ $(document).ready (function () {
$('#groups_select').val(-1);
}
$('input[type=checkbox]').change (
$('input[type=checkbox]').not(".static").change (
function () {
if (this.id == "checkbox-force_type") {
if (this.checked) {

View File

@ -406,7 +406,8 @@ $table->data['form_modules_2'][1] = html_print_select(
true,
true,
true
);
).' '.__('Select all modules').' '.html_print_checkbox('select_all_modules', 1, false, true, false, '', false, "class='static'");
$table->data['form_modules_2'][2] = __('When select modules');
$table->data['form_modules_2'][2] .= '<br>';
$table->data['form_modules_2'][2] .= html_print_select(
@ -491,7 +492,7 @@ $table->data['form_agents_3'][1] = html_print_select(
true,
true,
false
);
).' '.__('Select all agents').' '.html_print_checkbox('select_all_agents', 1, false, true, false, '', false, "class='static'");
$table->data['form_agents_3'][2] = __('When select agents');
$table->data['form_agents_3'][2] .= '<br>';
@ -1212,7 +1213,45 @@ $(document).ready (function () {
return false;
}
});
$("#checkbox-select_all_modules").change(function() {
if( $('#checkbox-select_all_modules').prop('checked')) {
$("#module_name option").prop('selected', 'selected');
$("#module_name").trigger('change');
} else {
$("#module_name option").prop('selected', false);
$("#module_name").trigger('change');
}
});
$("#module_name").change(function() {
var options_length = $("#module_name option").length;
var options_selected_length = $("#module_name option:selected").length;
if (options_selected_length < options_length) {
$('#checkbox-select_all_modules').prop("checked", false);
}
});
$("#checkbox-select_all_agents").change(function() {
if( $('#checkbox-select_all_agents').prop('checked')) {
$("#id_agents option").prop('selected', 'selected');
$("#id_agents").trigger('change');
} else {
$("#id_agents option").prop('selected', false);
$("#id_agents").trigger('change');
}
});
$("#id_agents").change(function() {
var options_length = $("#id_agents option").length;
var options_selected_length = $("#id_agents option:selected").length;
if (options_selected_length < options_length) {
$('#checkbox-select_all_agents').prop("checked", false);
}
});
$("#text-custom_ip_target").hide();
$("#id_agents").change(agent_changed_by_multiple_agents);
@ -1463,7 +1502,7 @@ $(document).ready (function () {
$('#groups_select').val(-1);
}
$('input[type=checkbox]').change (
$('input[type=checkbox]').not(".static").change (
function () {
if (this.id == "checkbox-force_type") {
if (this.checked) {

View File

@ -197,6 +197,11 @@ if (check_acl($config['id_user'], 0, 'AW')) {
$sub['gmassive']['sub2'] = $sub2;
}
if (check_acl($config['id_user'], 0, 'PM') || check_acl($config['id_user'], 0, 'UM')) {
$sub['godmode/groups/group_list&tab=credbox']['text'] = __('Credential store');
$sub['godmode/groups/group_list&tab=credbox']['id'] = 'credential store';
}
if (!empty($sub)) {
$menu_godmode['gmodules']['text'] = __('Configuration');
$menu_godmode['gmodules']['sec2'] = 'godmode/modules/manage_network_templates';
@ -235,6 +240,7 @@ if (check_acl($config['id_user'], 0, 'LW')
enterprise_hook('eventalerts_submenu');
$sub['godmode/snmpconsole/snmp_alert']['text'] = __('SNMP alerts');
$sub['godmode/snmpconsole/snmp_alert']['id'] = 'SNMP alerts';
enterprise_hook('alert_inventory_submenu');
}
$menu_godmode['galertas']['sub'] = $sub;

View File

@ -643,6 +643,9 @@ $url = ui_get_url_refresh(
$search_id_group = (int) get_parameter('search_id_group');
$search_string = (string) get_parameter('search_string');
if (!empty($search_string)) {
$search_string = trim($search_string, '&#x20;');
}
$table = new stdClass();
$table->width = '100%';

View File

@ -193,11 +193,13 @@ if ($editGraph) {
$count_module_array = count($module_array);
if ($count_module_array > 10) {
if ($count_module_array > $config['items_combined_charts']) {
ui_print_warning_message(
__(
'The maximum number of items in a chart is 10. You have %s elements, only first 10 will be displayed.',
$count_module_array
'The maximum number of items in a chart is %d. You have %d elements, only first %d will be displayed.',
$config['items_combined_charts'],
$count_module_array,
$config['items_combined_charts']
)
);
}

View File

@ -156,6 +156,14 @@ $agent_max_value = true;
$agent_min_value = true;
$uncompressed_module = true;
// Users.
$id_users = [];
$users_groups = [];
$select_by_group = false;
$nothing = __('Local metaconsole');
$nothing_value = 0;
$graph_render = (empty($config['type_mode_graph']) === true) ? 0 : $config['type_mode_graph'];
switch ($action) {
@ -726,6 +734,8 @@ switch ($action) {
case 'group_configuration':
$group = $item['id_group'];
$recursion = $item['recursion'];
$nothing = '';
$nothing_value = 0;
break;
case 'netflow_area':
@ -747,6 +757,22 @@ switch ($action) {
$top_n_value = $item['top_n_value'];
break;
case 'permissions_report':
$description = $item['description'];
$es = json_decode($item['external_source'], true);
$id_users = array_combine(
array_values($es['id_users']),
array_values($es['id_users'])
);
if (isset($id_users[0]) && $id_users[0] == 0) {
$id_users[0] = __('None');
}
$users_groups = $es['users_groups'];
$select_by_group = $es['select_by_group'];
break;
default:
// It's not possible.
break;
@ -934,8 +960,8 @@ $class = 'databox filters';
'combo_server',
$server_name,
'',
__('Local metaconsole'),
0
$nothing,
$nothing_value
);
?>
</td>
@ -1041,23 +1067,6 @@ $class = 'databox filters';
</td>
</tr>
<tr id="row_resolution" style="" class="datos">
<td style="font-weight:bold;">
<?php
echo __('Resolution');
?>
</td>
<td style="">
<?php
html_print_select(
netflow_resolution_select_params(),
'resolution',
$resolution
);
?>
</td>
</tr>
<tr id="row_period1" style="" class="datos">
<td style="font-weight:bold;">
<?php
@ -1896,7 +1905,14 @@ $class = 'databox filters';
</tr>
<tr id="row_query" style="" class="datos">
<td style="font-weight:bold;"><?php echo __('SQL query'); ?></td>
<td style="font-weight:bold;">
<?php
echo __('SQL query').ui_print_help_tip(
__('The entities of the fields that contain them must be included.'),
true
);
?>
</td>
<td style="" id="sql_entry">
<?php
html_print_textarea('sql', 5, 25, $sql_query_report);
@ -2846,7 +2862,102 @@ $class = 'databox filters';
?>
</td>
</tr>
<tr id="row_profiles_group" style="" class="datos">
<td style="font-weight:bold;">
<?php
echo __('Group');
?>
</td>
<td>
<?php
$user_groups = users_get_groups();
// Add a selector for users without assigned group.
$user_groups[''] = __('Unassigned group');
html_print_select(
$user_groups,
'users_groups[]',
$users_groups,
'',
false,
'',
false,
true,
false,
'',
false,
'min-width: 180px'
);
?>
</td>
</tr>
<tr id="row_users" style="" class="datos">
<td style="font-weight:bold;">
<?php
echo __('User');
?>
</td>
<td style="">
<?php
$tmp_users = db_get_all_rows_filter('tusuario', [], 'id_user');
foreach ($tmp_users as $key => $user) {
$select_users[$user['id_user']] = $user['id_user'];
}
$input_data = [
'type' => 'select_multiple_filtered',
'class' => 'w80p mw600px',
'name' => 'id_users',
'return' => 0,
'available' => array_diff(
$select_users,
$id_users
),
'selected' => $id_users,
'group_filter' => [
'page' => 'godmode/users/user_list',
'method' => 'get_users_by_group',
'nothing' => __('Unnasigned group'),
'nothing_value' => -1,
'id' => $id_users,
],
'texts' => [
'title-left' => 'Available users',
'title-right' => 'Selected users',
'filter-item' => 'Filter user name',
],
'sections' => [
'filters' => 1,
'item-selected-filters' => 0,
],
];
html_print_input($input_data, 'div', true);
?>
</td>
</tr>
<tr id="row_select_by_group" style="" class="datos">
<td style="font-weight:bold;">
<?php
echo __('Select by group');
?>
</td>
<td>
<?php
html_print_checkbox_switch(
'select_by_group',
1,
$select_by_group,
false
);
?>
</td>
</tr>
<tr id="row_landscape" style="" class="datos">
<td style="font-weight:bold;">
<?php
@ -3707,6 +3818,14 @@ echo "<div id='message_no_interval_option' title='".__('Item Editor Information
echo "<p style='text-align: center;font-weight: bold;'>".__('Please checked a custom interval option.').'</p>';
echo '</div>';
echo "<div id='message_no_user' title='".__('Item Editor Information')."' style='display:none;'>";
echo "<p style='text-align: center;font-weight: bold;'>".__('Please select a user.').'</p>';
echo '</div>';
echo "<div id='message_no_group' title='".__('Item Editor Information')."' style='display:none;'>";
echo "<p style='text-align: center;font-weight: bold;'>".__('Please select a group.').'</p>';
echo '</div>';
ui_require_javascript_file(
'pandora_inventory',
ENTERPRISE_DIR.'/include/javascript/'
@ -3754,7 +3873,6 @@ $(document).ready (function () {
$('#checkbox-recursion').removeAttr('disabled')
}
$("#id_agents").html('');
$("#id_agents2").html('');
$("#module").html('');
$("#inventory_modules").html('');
@ -3932,6 +4050,20 @@ $(document).ready (function () {
});
});
$("#checkbox-select_by_group").change(function () {
var select_by_group = $('#checkbox-select_by_group').prop('checked');
if(select_by_group == true) {
$("#row_users").hide();
$("#row_profiles_group").show();
} else {
$("#row_users").show();
$("#row_profiles_group").hide();
}
});
$("#checkbox-fullscale").change(function(e){
if(e.target.checked === true) {
$("#graph_render").prop('disabled', 'disabled');
@ -3995,6 +4127,16 @@ $(document).ready (function () {
return false;
}
break;
case 'permissions_report':
if ($("#checkbox-select_by_group").prop("checked") && $("select#users_groups>option:selected").val() == undefined) {
dialog_message('#message_no_group');
return false;
}
if ($("#checkbox-select_by_group").prop("checked") == false && $("select#selected-select-id_users>option:selected").val() == 0) {
dialog_message('#message_no_user');
return false;
}
break;
default:
break;
}
@ -4116,6 +4258,18 @@ $(document).ready (function () {
return false;
}
break;
case 'permissions_report':
if ($("#checkbox-select_by_group").prop("checked") && $("select#users_groups>option:selected").val() == undefined) {
dialog_message('#message_no_group');
return false;
}
if ($("#checkbox-select_by_group").prop("checked") == false && $("select#selected-select-id_users>option:selected").val() == 0) {
dialog_message('#message_no_user');
return false;
}
break;
default:
break;
}
@ -5002,6 +5156,10 @@ function chooseType() {
$("#row_select_fields2").hide();
$("#row_select_fields3").hide();
$("#row_uncompressed_module").hide();
$("#row_users").hide();
$("#row_profiles_group").hide();
$("#row_select_by_group").hide();
// SLA list default state.
$("#sla_list").hide();
@ -5648,6 +5806,7 @@ function chooseType() {
$("#row_group").show();
$("#row_servers").show();
$("#row_historical_db_check").hide();
$("#combo_server option[value='0']").remove();
break;
case 'netflow_area':
@ -5685,7 +5844,21 @@ function chooseType() {
$("#row_period").show();
$("#row_quantity").show();
break;
case 'permissions_report':
$("#row_description").show();
$("#row_users").show();
$("#row_profiles_group").show();
$("#row_select_by_group").show();
if($("#checkbox-select_by_group").prop("checked")) {
$("#row_users").hide();
} else {
$("#row_profiles_group").hide();
}
}
switch (type) {
case 'event_report_agent':
case 'simple_graph':
@ -5774,4 +5947,5 @@ function dialog_message(message_id) {
}
});
}
</script>

View File

@ -1432,10 +1432,7 @@ switch ($action) {
'module_description' => $module_description,
];
$values['name'] = reporting_label_macro(
$items_label,
$name_it
);
$values['name'] = $name_it;
$values['landscape'] = get_parameter('landscape');
$values['pagebreak'] = get_parameter('pagebreak');
@ -2054,6 +2051,14 @@ switch ($action) {
}
break;
case 'permissions_report':
$es['id_users'] = get_parameter('selected-select-id_users', 0);
$es['users_groups'] = get_parameter('users_groups', 0);
$es['select_by_group'] = get_parameter('select_by_group', 0);
$description = get_parameter('description');
$values['external_source'] = json_encode($es);
break;
default:
// Default.
break;
@ -2134,10 +2139,7 @@ switch ($action) {
'module_description' => $module_description,
];
$values['name'] = reporting_label_macro(
$items_label,
$name_it
);
$values['name'] = $name_it;
$values['landscape'] = get_parameter('landscape');
$values['pagebreak'] = get_parameter('pagebreak');
@ -2352,8 +2354,6 @@ switch ($action) {
break;
}
hd($values['server_name']);
hd(2);
if ($values['server_name'] == '') {
$values['server_name'] = get_parameter(
'combo_server'
@ -2671,6 +2671,14 @@ switch ($action) {
}
break;
case 'permissions_report':
$es['id_users'] = get_parameter('selected-select-id_users');
$es['users_groups'] = get_parameter('users_groups', 0);
$es['select_by_group'] = get_parameter('select_by_group', 0);
$description = get_parameter('description');
$values['external_source'] = json_encode($es);
break;
default:
// Default.
break;

View File

@ -242,6 +242,19 @@ if ($filemanager) {
$chunck_url = '&create=1';
}
$upload_file_or_zip = (bool) get_parameter('upload_file_or_zip');
$create_text_file = (bool) get_parameter('create_text_file');
$default_real_directory = realpath($config['homedir'].'/'.$fallback_directory);
if ($upload_file_or_zip) {
upload_file($upload_file_or_zip, $default_real_directory);
}
if ($create_text_file) {
create_text_file($default_real_directory);
}
filemanager_file_explorer(
$real_directory,
$directory,

View File

@ -66,6 +66,19 @@ $real_directory = realpath($config['homedir'].'/'.$directory);
echo '<h4>'.__('Index of %s', $directory).'</h4>';
$upload_file_or_zip = (bool) get_parameter('upload_file_or_zip');
$create_text_file = (bool) get_parameter('create_text_file');
$default_real_directory = realpath($config['homedir'].'/'.$fallback_directory);
if ($upload_file_or_zip) {
upload_file($upload_file_or_zip, $default_real_directory);
}
if ($create_text_file) {
create_text_file($default_real_directory);
}
filemanager_file_explorer(
$real_directory,
$directory,

View File

@ -55,7 +55,11 @@ if (isset($_POST['create'])) {
'expire_timestamp' => $expire_timestamp,
];
$id_link = db_process_sql_insert('tnews', $values);
if ($subject === '') {
$id_link = false;
} else {
$id_link = db_process_sql_insert('tnews', $values);
}
ui_print_result_message(
$id_link,
@ -92,7 +96,11 @@ if (isset($_POST['update'])) {
'expire_timestamp' => $expire_timestamp,
];
$result = db_process_sql_update('tnews', $values, ['id_news' => $id_news]);
if ($subject === '') {
$result = false;
} else {
$result = db_process_sql_update('tnews', $values, ['id_news' => $id_news]);
}
ui_print_result_message(
$result,
@ -173,7 +181,7 @@ if ((isset($_GET['form_add'])) || (isset($_GET['form_edit']))) {
$data = [];
$data[0] = __('Subject').'<br>';
$data[0] .= '<input type="text" name="subject" size="35" value="'.$subject.'">';
$data[0] .= '<input type="text" name="subject" size="35" value="'.$subject.'" >';
$data[1] = __('Group').'<br>';
$data[1] .= '<div class="w250px">';

View File

@ -642,6 +642,16 @@ $table_other->data[13][1] = html_print_input_text(
true
);
$table_other->data[14][0] = __('Row limit in csv log');
$table_other->data[14][1] = html_print_input_text(
'row_limit_csv',
$config['row_limit_csv'],
'',
5,
10,
true
);
echo '<form id="form_setup" method="post">';
echo '<fieldset>';

View File

@ -189,6 +189,10 @@ if (is_ajax()) {
100,
true
);
$row['control'] .= ui_print_reveal_password(
'ldap_admin_pass',
true
);
$table->data['ldap_admin_pass'] = $row;
break;
@ -217,10 +221,33 @@ if (is_ajax()) {
'double_auth_enabled',
1,
$config['double_auth_enabled'],
true
true,
false,
'showAndHide()'
);
$table->data['double_auth_enabled'] = $row;
// Enable 2FA for all users.
// Set default value.
set_unless_defined($config['2FA_all_users'], false);
$row = [];
$row['name'] = __('Force 2FA for all users is enabled');
$row['control'] .= html_print_checkbox_switch(
'2FA_all_users',
1,
$config['2FA_all_users'],
true
);
if (!$config['double_auth_enabled']) {
$table->rowclass['2FA_all_users'] = 'invisible';
} else {
$table->rowclass['2FA_all_users'] = '';
}
$table->data['2FA_all_users'] = $row;
// Session timeout.
// Default session timeout.
set_when_empty($config['session_timeout'], 90);
@ -313,6 +340,22 @@ echo '</form>';
?>
<script type="text/javascript">
function showAndHide() {
if ($('input[type=checkbox][name=double_auth_enabled]:checked').val() == 1) {
$('#table1-2FA_all_users').removeClass('invisible');
$('#table1-2FA_all_users-name').removeClass('invisible');
$('#table1-2FA_all_users-control').removeClass('invisible');
$('#table1-2FA_all_users').show();
} else {
$('#table1-2FA_all_users').hide();
}
}
$( document ).ready(function() {
});
//For change autocreate remote users
$('#auth').on('change', function(){
type_auth = $('#auth').val();
$.ajax({

View File

@ -82,6 +82,7 @@ $table_remote->data['ehorus_user'] = $row;
$row = [];
$row['name'] = __('Password');
$row['control'] = html_print_input_password('ehorus_pass', io_output_password($config['ehorus_pass']), '', 30, 100, true);
$row['control'] .= ui_print_reveal_password('ehorus_pass', true);
$table_remote->data['ehorus_pass'] = $row;
// Directory hostname.

View File

@ -116,7 +116,8 @@ $table->data[$i][0] = __('Phantomjs bin directory');
$table->data[$i++][1] = html_print_input_text('phantomjs_bin', io_safe_output($config['phantomjs_bin']), '', 30, 100, true);
$table->data[$i][0] = __('Auto login (hash) password');
$table->data[$i++][1] = html_print_input_password('loginhash_pwd', io_output_password($config['loginhash_pwd']), '', 15, 15, true);
$table->data[$i][1] = html_print_input_password('loginhash_pwd', io_output_password($config['loginhash_pwd']), '', 15, 15, true);
$table->data[$i++][1] .= ui_print_reveal_password('loginhash_pwd', true);
$table->data[$i][0] = __('Time source');
$sources['system'] = __('System');
@ -154,7 +155,8 @@ if (isset($_POST['list_ACL_IPs_for_API'])) {
$table->data[$i++][1] = html_print_textarea('list_ACL_IPs_for_API', 2, 25, $list_ACL_IPs_for_API, 'style="height: 50px; width: 300px"', true);
$table->data[$i][0] = __('API password');
$table->data[$i++][1] = html_print_input_password('api_password', io_output_password($config['api_password']), '', 25, 255, true);
$table->data[$i][1] = html_print_input_password('api_password', io_output_password($config['api_password']), '', 25, 255, true);
$table->data[$i++][1] .= ui_print_reveal_password('api_password', true);
$table->data[$i][0] = __('Enable GIS features');
$table->data[$i++][1] = html_print_checkbox_switch('activate_gis', 1, $config['activate_gis'], true);
@ -379,6 +381,7 @@ $table_mail_conf->data[5][1] = html_print_input_text('email_username', $config['
$table_mail_conf->data[6][0] = __('Email password');
$table_mail_conf->data[6][1] = html_print_input_password('email_password', io_output_password($config['email_password']), '', 30, 100, true);
$table_mail_conf->data[6][1] .= ui_print_reveal_password('email_password', true);
$uniqid = uniqid();

View File

@ -221,6 +221,7 @@ $table_remote->data['integria_user'] = $row;
$row = [];
$row['name'] = __('Password');
$row['control'] = html_print_input_password('integria_pass', io_output_password($config['integria_pass']), '', 30, 100, true);
$row['control'] .= ui_print_reveal_password('integria_pass', true);
$table_remote->data['integria_pass'] = $row;
// Integria hostname.
@ -233,6 +234,7 @@ $table_remote->data['integria_hostname'] = $row;
$row = [];
$row['name'] = __('API Password');
$row['control'] = html_print_input_password('integria_api_pass', io_output_password($config['integria_api_pass']), '', 30, 100, true);
$row['control'] .= ui_print_reveal_password('integria_api_pass', true);
$table_remote->data['integria_api_pass'] = $row;
// Request timeout.

View File

@ -463,19 +463,15 @@ if (enterprise_installed()) {
$row++;
}
// Title Header
if (enterprise_installed()) {
$table_styles->data[$row][0] = __('Title (header)');
$table_styles->data[$row][1] = html_print_input_text('custom_title_header', $config['custom_title_header'], '', 50, 40, true);
$row++;
}
// Title Header.
$table_styles->data[$row][0] = __('Title (header)');
$table_styles->data[$row][1] = html_print_input_text('custom_title_header', $config['custom_title_header'], '', 50, 40, true);
$row++;
// Subtitle Header
if (enterprise_installed()) {
$table_styles->data[$row][0] = __('Subtitle (header)');
$table_styles->data[$row][1] = html_print_input_text('custom_subtitle_header', $config['custom_subtitle_header'], '', 50, 40, true);
$row++;
}
// Subtitle Header.
$table_styles->data[$row][0] = __('Subtitle (header)');
$table_styles->data[$row][1] = html_print_input_text('custom_subtitle_header', $config['custom_subtitle_header'], '', 50, 40, true);
$row++;
// login title1
if (enterprise_installed()) {
@ -908,6 +904,20 @@ $row++;
);
$row++;
$table_chars->data[$row][0] = __('Number of elements in Custom Graph');
$table_chars->data[$row][1] = html_print_input_text(
'items_combined_charts',
$config['items_combined_charts'],
'',
5,
5,
true,
false,
false,
''
);
$row++;
$table_chars->data[$row][0] = __('Use round corners');
$table_chars->data[$row][1] = html_print_checkbox_switch(
'round_corner',
@ -1482,7 +1492,7 @@ $row++;
'.' => '.',
',' => ',',
];
$table_other->data[$row][0] = __('CSV decimal separator').ui_print_help_tip(__('Only for csv reports'), true);
$table_other->data[$row][0] = __('CSV decimal separator');
$table_other->data[$row][1] = html_print_select($decimal_separator, 'csv_decimal_separator', $config['csv_decimal_separator'], '', '', '', true, false, false);
$row++;
@ -1624,6 +1634,13 @@ var added_config1 = {
$(document).ready (function () {
var enterprise = '<?php echo enterprise_installed(); ?>';
if (enterprise === '') {
$('#text-custom_title_header').prop( "disabled", true );
$('#text-custom_subtitle_header').prop( "disabled", true );
}
// Show the cache expiration conf or not.
$("input[name=legacy_vc]").change(function (e) {
if ($(this).prop("checked") === true) {

View File

@ -1,16 +1,17 @@
<?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 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-2020 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 vars
if (! check_acl($config['id_user'], 0, 'LW')) {
db_pandora_audit(
@ -61,6 +62,11 @@ if ($add_action) {
$values[db_escape_key_identifier('al_field13')] = get_parameter('field13_value');
$values[db_escape_key_identifier('al_field14')] = get_parameter('field14_value');
$values[db_escape_key_identifier('al_field15')] = get_parameter('field15_value');
$values[db_escape_key_identifier('al_field16')] = get_parameter('field16_value');
$values[db_escape_key_identifier('al_field17')] = get_parameter('field17_value');
$values[db_escape_key_identifier('al_field18')] = get_parameter('field18_value');
$values[db_escape_key_identifier('al_field19')] = get_parameter('field19_value');
$values[db_escape_key_identifier('al_field20')] = get_parameter('field20_value');
$result = db_process_sql_insert('talert_snmp_action', $values);
}
@ -123,6 +129,11 @@ if ($save_alert || $modify_alert) {
$al_field13 = (string) get_parameter_post('field13_value');
$al_field14 = (string) get_parameter_post('field14_value');
$al_field15 = (string) get_parameter_post('field15_value');
$al_field16 = (string) get_parameter_post('field16_value');
$al_field17 = (string) get_parameter_post('field17_value');
$al_field18 = (string) get_parameter_post('field18_value');
$al_field19 = (string) get_parameter_post('field19_value');
$al_field20 = (string) get_parameter_post('field20_value');
$max_alerts = (int) get_parameter_post('max_alerts', 1);
$min_alerts = (int) get_parameter_post('min_alerts', 0);
$priority = (int) get_parameter_post('priority', 0);
@ -195,6 +206,11 @@ if ($save_alert || $modify_alert) {
'al_field13' => $al_field13,
'al_field14' => $al_field14,
'al_field15' => $al_field15,
'al_field16' => $al_field16,
'al_field17' => $al_field17,
'al_field18' => $al_field18,
'al_field19' => $al_field19,
'al_field20' => $al_field20,
'description' => $description,
'agent' => $source_ip,
'custom_oid' => $custom_value,
@ -267,7 +283,9 @@ if ($save_alert || $modify_alert) {
al_field5 = '%s', al_field6 = '%s',al_field7 = '%s',
al_field8 = '%s', al_field9 = '%s',al_field10 = '%s',
al_field11 = '%s', al_field12 = '%s', al_field13 = '%s',
al_field14 = '%s', al_field15 = '%s',
al_field14 = '%s', al_field15 = '%s', al_field16 = '%s',
al_field17 = '%s', al_field18 = '%s', al_field19 = '%s',
al_field20 = '%s',
description = '%s',
agent = '%s', custom_oid = '%s', oid = '%s',
time_threshold = %d, max_alerts = %d, min_alerts = %d,
@ -318,6 +336,11 @@ if ($save_alert || $modify_alert) {
$al_field13,
$al_field14,
$al_field15,
$al_field16,
$al_field17,
$al_field18,
$al_field19,
$al_field20,
$description,
$source_ip,
$custom_value,
@ -417,6 +440,11 @@ if ($update_alert || $duplicate_alert) {
$al_field13 = $alert['al_field13'];
$al_field14 = $alert['al_field14'];
$al_field15 = $alert['al_field15'];
$al_field16 = $alert['al_field16'];
$al_field17 = $alert['al_field17'];
$al_field18 = $alert['al_field18'];
$al_field19 = $alert['al_field19'];
$al_field20 = $alert['al_field20'];
$max_alerts = $alert['max_alerts'];
$min_alerts = $alert['min_alerts'];
$priority = $alert['priority'];
@ -490,6 +518,11 @@ if ($update_alert || $duplicate_alert) {
$al_field13 = '';
$al_field14 = '';
$al_field15 = '';
$al_field16 = '';
$al_field17 = '';
$al_field18 = '';
$al_field19 = '';
$al_field20 = '';
$max_alerts = 1;
$min_alerts = 0;
$priority = 0;
@ -547,10 +580,11 @@ if ($duplicate_alert) {
id_alert, al_field1, al_field2, al_field3,
al_field4, al_field5, al_field6, al_field7,
al_field8, al_field9, al_field10, al_field11,
al_field12, al_field13, al_field14, al_field15,
description, alert_type, agent, custom_oid, oid, time_threshold,
times_fired, last_fired, max_alerts, min_alerts,
internal_counter, priority,
al_field12, al_field13, al_field14, al_field15,
al_field16, al_field17, al_field18, al_field19,
al_field20, description, alert_type, agent, custom_oid,
oid, time_threshold, times_fired, last_fired,
max_alerts, min_alerts, internal_counter, priority,
'.db_escape_key_identifier('_snmp_f1_').',
'.db_escape_key_identifier('_snmp_f2_').',
'.db_escape_key_identifier('_snmp_f3_').',
@ -597,6 +631,11 @@ if ($duplicate_alert) {
$al_field13,
$al_field14,
$al_field15,
$al_field16,
$al_field17,
$al_field18,
$al_field19,
$al_field20,
$description,
$alert_type,
$source_ip,
@ -998,6 +1037,11 @@ if ($create_alert || $update_alert) {
'al_field13' => $al_field13,
'al_field14' => $al_field14,
'al_field15' => $al_field15,
'al_field16' => $al_field16,
'al_field17' => $al_field17,
'al_field18' => $al_field18,
'al_field19' => $al_field19,
'al_field20' => $al_field20,
];
// Hidden div with help hint to fill with javascript
@ -1421,6 +1465,11 @@ if ($create_alert || $update_alert) {
'al_field13' => $al_field13,
'al_field14' => $al_field14,
'al_field15' => $al_field15,
'al_field16' => $al_field16,
'al_field17' => $al_field17,
'al_field18' => $al_field18,
'al_field19' => $al_field19,
'al_field20' => $al_field20,
];
for ($i = 1; $i <= $config['max_macro_fields']; $i++) {

View File

@ -44,6 +44,9 @@ if (! check_acl($config['id_user'], 0, 'PM')
return;
}
require_once $config['homedir'].'/include/functions_update_manager.php';
if (update_manager_verify_license_expired()) {
ui_print_error_message(
__('The license has expired. Please contact Artica at info@artica.es')

View File

@ -196,6 +196,8 @@ if (is_ajax()) {
}
}
$tab = get_parameter('tab', 'user');
if ($id) {
@ -556,15 +558,51 @@ if ($update_user) {
if ($config['user_can_update_password']) {
$password_new = (string) get_parameter('password_new', '');
$password_confirm = (string) get_parameter('password_confirm', '');
$own_password_confirm = (string) get_parameter('own_password_confirm', '');
if ($password_new != '') {
$correct_password = false;
$user_credentials_check = process_user_login($config['id_user'], $own_password_confirm, true);
if ($user_credentials_check !== false) {
$correct_password = true;
}
if ($password_confirm == $password_new) {
if ((!is_user_admin($config['id_user']) || $config['enable_pass_policy_admin']) && $config['enable_pass_policy']) {
$pass_ok = login_validate_pass($password_new, $id, true);
if ($pass_ok != 1) {
ui_print_error_message($pass_ok);
if ($correct_password === true || is_user_admin($config['id_user'])) {
if ((!is_user_admin($config['id_user']) || $config['enable_pass_policy_admin']) && $config['enable_pass_policy']) {
$pass_ok = login_validate_pass($password_new, $id, true);
if ($pass_ok != 1) {
ui_print_error_message($pass_ok);
} else {
$res2 = update_user_password($id, $password_new);
if ($res2) {
db_process_sql_insert(
'tsesion',
[
'id_sesion' => '',
'id_usuario' => $id,
'ip_origen' => $_SERVER['REMOTE_ADDR'],
'accion' => 'Password&#x20;change',
'descripcion' => 'Access password updated',
'fecha' => date('Y-m-d H:i:s'),
'utimestamp' => time(),
]
);
$res3 = save_pass_history($id, $password_new);
}
ui_print_result_message(
$res1 || $res2,
__('User info successfully updated'),
__('Error updating user info (no change?)')
);
}
} else {
$res2 = update_user_password($id, $password_new);
if ($res2) {
$res3 = save_pass_history($id, $password_new);
db_process_sql_insert(
'tsesion',
[
@ -577,7 +615,6 @@ if ($update_user) {
'utimestamp' => time(),
]
);
$res3 = save_pass_history($id, $password_new);
}
ui_print_result_message(
@ -587,28 +624,11 @@ if ($update_user) {
);
}
} else {
$res2 = update_user_password($id, $password_new);
if ($res2) {
$res3 = save_pass_history($id, $password_new);
db_process_sql_insert(
'tsesion',
[
'id_sesion' => '',
'id_usuario' => $id,
'ip_origen' => $_SERVER['REMOTE_ADDR'],
'accion' => 'Password&#x20;change',
'descripcion' => 'Access password updated',
'fecha' => date('Y-m-d H:i:s'),
'utimestamp' => time(),
]
);
if ($own_password_confirm === '') {
ui_print_error_message(__('Password of the active user is required to perform password change'));
} else {
ui_print_error_message(__('Password of active user is not correct'));
}
ui_print_result_message(
$res1 || $res2,
__('User info successfully updated'),
__('Error updating user info (no change?)')
);
}
} else {
db_process_sql_insert(
@ -757,13 +777,13 @@ if (!users_is_admin() && $config['id_user'] != $id && !$new_user) {
$sql = sprintf(
"SELECT tusuario_perfil.* FROM tusuario_perfil
INNER JOIN tperfil ON tperfil.id_perfil = tusuario_perfil.id_perfil
WHERE id_usuario like '%s' AND id_grupo IN (%s) AND user_management = 0",
$id,
WHERE id_usuario like '%s' AND id_grupo IN (%s) AND user_management = 1",
$config['id_user'],
$group_um_string
);
$result = db_get_all_rows_sql($sql);
if ($result == false || $user_info['is_admin']) {
if ($result == false && $user_info['is_admin'] == false) {
db_pandora_audit(
'ACL Violation',
'Trying to access User Management'
@ -875,6 +895,25 @@ if ($config['user_can_update_password']) {
true,
true
).'</span></div>';
if (!is_user_admin($config['id_user'])) {
$own_pass_confirm = '<div class="label_select_simple"><span>'.html_print_input_text_extended(
'own_password_confirm',
'',
'own_password_confirm',
'',
'20',
'45',
$view_mode,
'',
[
'class' => 'input',
'placeholder' => __('Own password confirmation'),
],
true,
true
).'</span></div>';
}
}
$own_info = get_user_info($config['id_user']);
@ -1128,6 +1167,28 @@ if ($config['ehorus_user_level_conf']) {
$ehorus .= '</div>';
}
$double_auth_enabled = (bool) db_get_value('id', 'tuser_double_auth', 'id_user', $id);
if ($config['double_auth_enabled'] && check_acl($config['id_user'], 0, 'PM')) {
$double_authentication = '<div class="label_select_simple"><p class="edit_user_labels">'.__('Double authentication').'</p>';
if (($config['2FA_all_users'] == '' && !$double_auth_enabled)
|| ($config['double_auth_enabled'] == '' && $double_auth_enabled)
|| check_acl($config['id_user'], 0, 'PM')
) {
$double_authentication .= html_print_checkbox_switch('double_auth', 1, $double_auth_enabled, true);
}
// Dialog.
$double_authentication .= '<div id="dialog-double_auth" style="display:none"><div id="dialog-double_auth-container"></div></div>';
}
if ($double_auth_enabled && $config['double_auth_enabled'] && $config['2FA_all_users'] != '') {
$double_authentication .= html_print_button(__('Show information'), 'show_info', false, 'javascript:show_double_auth_info();', '', true);
}
if (isset($double_authentication)) {
$double_authentication .= '</div>';
}
if ($meta) {
enterprise_include_once('include/functions_metaconsole.php');
@ -1167,7 +1228,7 @@ if (is_metaconsole()) {
if ($id != '' && !$is_err) {
$div_user_info = '<div class="edit_user_info_left">'.$avatar.$user_id_create.'</div>
<div class="edit_user_info_right">'.$user_id_update_view.$full_name.$new_pass.$new_pass_confirm.$global_profile.'</div>';
<div class="edit_user_info_right">'.$user_id_update_view.$full_name.$new_pass.$new_pass_confirm.$own_pass_confirm.$global_profile.'</div>';
} else {
$div_user_info = '<div class="edit_user_info_left">'.$avatar.'</div>
<div class="edit_user_info_right">'.$user_id_create.$user_id_update_view.$full_name.$new_pass.$new_pass_confirm.$global_profile.'</div>';
@ -1179,7 +1240,7 @@ echo '<div id="user_form">
<div class="edit_user_autorefresh white_box"><p style="font-weight:bold;">Extra info</p>'.$email.$phone.$not_login.$session_time.'</div>
</div>
<div class="user_edit_second_row white_box">
<div class="edit_user_options">'.$language.$access_or_pagination.$skin.$home_screen.$default_event_filter.$newsletter.'</div>
<div class="edit_user_options">'.$language.$access_or_pagination.$skin.$home_screen.$default_event_filter.$newsletter.$double_authentication.'</div>
<div class="edit_user_timezone">'.$timezone;
if (!is_metaconsole()) {
@ -1278,6 +1339,15 @@ if (!is_metaconsole()) {
var json_profile = $('#hidden-json_profile');
/* <![CDATA[ */
$(document).ready (function () {
$("input#checkbox-double_auth").change(function (e) {
e.preventDefault();
if (this.checked) {
show_double_auth_activation();
} else {
show_double_auth_deactivation();
}
});
$('input:radio[name="is_admin"]').change(function() {
if($('#radiobtn0002').prop('checked')) {
$('#metaconsole_agents_manager_div').show();
@ -1495,5 +1565,216 @@ function switch_ehorus_conf()
}
function show_double_auth_info () {
var userID = '<?php echo io_safe_output($id); ?>';
var $loadingSpinner = $("<img src=\"<?php echo $config['homeurl']; ?>/images/spinner.gif\" />");
var $dialogContainer = $("div#dialog-double_auth-container");
$dialogContainer.html($loadingSpinner);
console.log(userID);
// Load the info page
var request = $.ajax({
url: "<?php echo ui_get_full_url('ajax.php', false, false, false); ?>",
type: 'POST',
dataType: 'html',
data: {
page: 'include/ajax/double_auth.ajax',
id_user: userID,
get_double_auth_data_page: 1,
FA_forced: 1,
containerID: $dialogContainer.prop('id')
},
complete: function(xhr, textStatus) {
},
success: function(data, textStatus, xhr) {
// isNaN = is not a number
if (isNaN(data)) {
$dialogContainer.html(data);
}
// data is a number, convert it to integer to do the compare
else if (Number(data) === -1) {
$dialogContainer.html("<?php echo '<b><div class=\"red\">'.__('Authentication error').'</div></b>'; ?>");
}
else {
$dialogContainer.html("<?php echo '<b><div class=\"red\">'.__('Error').'</div></b>'; ?>");
}
},
error: function(xhr, textStatus, errorThrown) {
$dialogContainer.html("<?php echo '<b><div class=\"red\">'.__('There was an error loading the data').'</div></b>'; ?>");
}
});
$("div#dialog-double_auth")
.css('display','block')
.append($dialogContainer)
.dialog({
resizable: true,
draggable: true,
modal: true,
title: "<?php echo __('Double autentication information'); ?>",
overlay: {
opacity: 0.5,
background: "black"
},
width: 400,
height: 375,
close: function(event, ui) {
// Abort the ajax request
if (typeof request != 'undefined')
request.abort();
// Remove the contained html
$dialogContainer.empty();
}
})
.show();
}
function show_double_auth_activation () {
var userID = '<?php echo io_safe_output($id); ?>';
var $loadingSpinner = $("<img src=\"<?php echo $config['homeurl']; ?>/images/spinner.gif\" />");
var $dialogContainer = $("div#dialog-double_auth-container");
$dialogContainer.html($loadingSpinner);
// Load the info page
var request = $.ajax({
url: "<?php echo ui_get_full_url('ajax.php', false, false, false); ?>",
type: 'POST',
dataType: 'html',
data: {
page: 'include/ajax/double_auth.ajax',
id_user: userID,
FA_forced: 1,
get_double_auth_info_page: 1,
containerID: $dialogContainer.prop('id')
},
complete: function(xhr, textStatus) {
},
success: function(data, textStatus, xhr) {
// isNaN = is not a number
if (isNaN(data)) {
$dialogContainer.html(data);
}
// data is a number, convert it to integer to do the compare
else if (Number(data) === -1) {
$dialogContainer.html("<?php echo '<b><div class=\"red\">'.__('Authentication error').'</div></b>'; ?>");
}
else {
$dialogContainer.html("<?php echo '<b><div class=\"red\">'.__('Error').'</div></b>'; ?>");
}
},
error: function(xhr, textStatus, errorThrown) {
$dialogContainer.html("<?php echo '<b><div class=\"red\">'.__('There was an error loading the data').'</div></b>'; ?>");
}
});
$("div#dialog-double_auth").dialog({
resizable: true,
draggable: true,
modal: true,
title: "<?php echo __('Double autentication activation'); ?>",
overlay: {
opacity: 0.5,
background: "black"
},
width: 500,
height: 400,
close: function(event, ui) {
// Abort the ajax request
if (typeof request != 'undefined')
request.abort();
// Remove the contained html
$dialogContainer.empty();
document.location.reload();
}
})
.show();
}
function show_double_auth_deactivation () {
var userID = '<?php echo io_safe_output($id); ?>';
console.log(userID);
var $loadingSpinner = $("<img src=\"<?php echo $config['homeurl']; ?>/images/spinner.gif\" />");
var $dialogContainer = $("div#dialog-double_auth-container");
var message = "<p><?php echo __('Are you sure?').'<br>'.__('The double authentication will be deactivated'); ?></p>";
var $button = $("<input type=\"button\" value=\"<?php echo __('Deactivate'); ?>\" />");
$dialogContainer
.empty()
.append(message)
.append($button);
var request;
$button.click(function(e) {
e.preventDefault();
$dialogContainer.html($loadingSpinner);
// Deactivate the double auth
request = $.ajax({
url: "<?php echo ui_get_full_url('ajax.php', false, false, false); ?>",
type: 'POST',
dataType: 'json',
data: {
page: 'include/ajax/double_auth.ajax',
id_user: userID,
FA_forced: 1,
deactivate_double_auth: 1
},
complete: function(xhr, textStatus) {
},
success: function(data, textStatus, xhr) {
console.log(data);
if (data === -1) {
$dialogContainer.html("<?php echo '<b><div class=\"red\">'.__('Authentication error').'</div></b>'; ?>");
}
else if (data) {
$dialogContainer.html("<?php echo '<b><div class=\"green\">'.__('The double autentication was deactivated successfully').'</div></b>'; ?>");
}
else {
$dialogContainer.html("<?php echo '<b><div class=\"red\">'.__('There was an error deactivating the double autentication').'</div></b>'; ?>");
}
},
error: function(xhr, textStatus, errorThrown) {
$dialogContainer.html("<?php echo '<b><div class=\"red\">'.__('There was an error deactivating the double autentication').'</div></b>'; ?>");
}
});
});
$("div#dialog-double_auth").dialog({
resizable: true,
draggable: true,
modal: true,
title: "<?php echo __('Double autentication activation'); ?>",
overlay: {
opacity: 0.5,
background: "black"
},
width: 300,
height: 150,
close: function(event, ui) {
// Abort the ajax request
if (typeof request != 'undefined')
request.abort();
// Remove the contained html
$dialogContainer.empty();
document.location.reload();
}
})
.show();
}
/* ]]> */
</script>

View File

@ -33,6 +33,53 @@ if (! check_acl($config['id_user'], 0, 'UM')) {
exit;
}
if (is_ajax()) {
$method = get_parameter('method');
$group_id = get_parameter('group_id');
$group_recursion = (bool) get_parameter('group_recursion', 0);
$return_all = false;
if ($group_id == -1) {
$sql = 'SELECT tusuario.id_user FROM tusuario
LEFT OUTER JOIN tusuario_perfil
ON tusuario.id_user = tusuario_perfil.id_usuario
WHERE tusuario_perfil.id_usuario IS NULL';
$users = io_safe_output(db_get_all_rows_sql($sql));
foreach ($users as $key => $user) {
$ret_user[$user['id_user']] = $user['id_user'];
}
echo json_encode($ret_user);
return;
}
if ($group_id == 0) {
$users = io_safe_output(db_get_all_rows_filter('tusuario', [], 'id_user'));
foreach ($users as $key => $user) {
$ret_user[$user['id_user']] = $user['id_user'];
}
echo json_encode($ret_user);
return;
}
if ($method === 'get_users_by_group') {
if ($group_recursion === true) {
$group_id = groups_get_children_ids($group_id);
}
$users_id = io_safe_output(users_get_user_users(false, 'AR', false, null, $group_id));
foreach ($users_id as $key => $user_id) {
$ret_id[$user_id] = $user_id;
}
echo json_encode($ret_id);
return;
}
}
$sortField = get_parameter('sort_field');
$sort = get_parameter('sort', 'none');
$tab = get_parameter('tab', 'user');
@ -444,12 +491,6 @@ foreach ($info as $user_id => $user_info) {
foreach ($group_um as $key => $value) {
if (isset($user_profiles_aux[$key])) {
$user_profiles[$key] = $user_profiles_aux[$key];
if ($user_profiles_aux[$key]['user_management'] == 1) {
$user_info['edit'] = 0;
} else {
$user_info['edit'] = 1;
}
unset($user_profiles_aux[$key]);
}
}
@ -547,7 +588,11 @@ foreach ($info as $user_id => $user_info) {
$total_profile++;
}
$data[4] .= '</div>';
if (isset($user_info['not_delete'])) {
$data[4] .= __('Other profiles are also assigned.').ui_print_help_tip(__('Other profiles you cannot manage are also assigned. These profiles are not shown. You cannot enable/disable or delete this user.'), true);
}
$data[4] .= '</div>';
} else {
$data[4] .= __('The user doesn\'t have any assigned profile/group');
}

View File

@ -176,7 +176,7 @@ class DiscoveryTaskList extends HTML
'type' => 'button',
'attributes' => 'class="sub upd"',
'return' => true,
'script' => 'location.reload();',
'script' => 'location.href = \''.$this->url.'\';',
],
],
],
@ -402,8 +402,10 @@ class DiscoveryTaskList extends HTML
$table->headstyle[$i] = 'text-align: left;';
}
// Task name.
$table->headstyle[1] .= 'min-width: 150px; width: 300px;';
// Name.
$table->headstyle[4] .= 'min-width: 100px; width: 600px;';
$table->headstyle[4] .= 'min-width: 100px; width: 400px;';
// Status.
$table->headstyle[5] .= 'min-width: 50px; width: 100px;';
// Task type.
@ -1264,6 +1266,17 @@ class DiscoveryTaskList extends HTML
],
]
);
if (count($map->nodes) <= 1) {
// No nodes detected in current task definition.
$task = db_get_row('trecon_task', 'id_rt', $id_task);
if ((int) $task['type'] === DISCOVERY_CLOUD_GCP_COMPUTE_ENGINE) {
ui_print_info_message(
__('Please ensure instances or regions are being monitorized and \'scan and general monitoring\' is enabled.')
);
}
}
$map->printMap();
}

View File

@ -336,6 +336,12 @@ class HostDevices extends Wizard
)
)
);
// Forbidden chars cleaning.
foreach ($network as $key => $singleNetwork) {
$network[$key] = preg_replace('/[-()\']/', '', $singleNetwork);
}
unlink($_FILES['network_csv']['tmp_name']);
if (empty($network) || is_array($network) === false) {
$this->msg = __(
@ -1421,9 +1427,9 @@ class HostDevices extends Wizard
include_once $config['homedir'].'/include/class/CredentialStore.class.php';
$available_keys = CredentialStore::getKeys('CUSTOM');
if (check_acl($config['id_user'], 0, 'PM')) {
if (check_acl($config['id_user'], 0, 'UM')) {
$link_to_cs = '<a class="ext_link" href="'.ui_get_full_url(
'index.php?sec=gagente&sec2=godmode/groups/group_list&tab=credbox'
'index.php?sec=gmodules&sec2=godmode/groups/group_list&tab=credbox'
).'" >';
$link_to_cs .= __('No credentials available').', ';
$link_to_cs .= strtolower(__('Manage credentials')).'</a>';

Binary file not shown.

After

Width:  |  Height:  |  Size: 392 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 898 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 647 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

@ -17,7 +17,9 @@ check_login();
// Security check
$id_user = (string) get_parameter('id_user');
if ($id_user !== $config['id_user']) {
$FA_forced = (int) get_parameter('FA_forced');
if ($id_user !== $config['id_user'] && $FA_forced != 1) {
db_pandora_audit(
'ACL Violation',
'Trying to access Double Authentication'

View File

@ -55,8 +55,6 @@ $password = get_parameter('pass', '');
$user = get_parameter('user', '');
$info = get_parameter('info', '');
$other = parseOtherParameter($otherSerialize, $otherMode);
$other = parseOtherParameter($otherSerialize, $otherMode);
$apiPassword = io_output_password(
db_get_value_filter(

View File

@ -1,5 +1,4 @@
<?php
/**
* Agent Wizard for SNMP and WMI
*
@ -1453,7 +1452,7 @@ class AgentWizard extends HTML
foreach (array_keys($data) as $k) {
foreach ($modulesActivated as $key => $value) {
$valueStr = preg_replace('/\//', '\/', $value);
if (empty(preg_match('/'.$valueStr.'$/', $k)) === false) {
if (empty(preg_match('/-'.$valueStr.'$/', $k)) === false) {
if (empty(preg_match('/module-name-set/', $k)) === false) {
$result[$value]['name'] = $data[$k];
} else if (empty(preg_match('/module-description-set/', $k)) === false) {
@ -1468,10 +1467,16 @@ class AgentWizard extends HTML
$result[$value]['name'] = $data['module-default_name-'.$key];
} else if (empty(preg_match('/module-description-set/', $k)) === false) {
$result[$value]['description'] = $data['module-default_description-'.$key];
} else if (empty(preg_match('/module-value/', $k)) === false) {
$result[$value]['value'] = $data['module-value-'.$key];
}
preg_match('/^(.*)-.*?_(\d-\d)$/', $k, $matches);
preg_match('/^(.*)-.*?_(\d+-\d+)$/', $k, $matches);
$k = $matches[1].'-0_'.$matches[2];
} else {
if (empty(preg_match('/module-value/', $k)) === false) {
$result[$value]['value'] = $data[$k];
}
}
}
@ -1495,7 +1500,7 @@ class AgentWizard extends HTML
$result[$value]['scan_type'] = (int) $data[$k];
} else if (empty(preg_match('/module-execution_type/', $k)) === false) {
$result[$value]['execution_type'] = (int) $data[$k];
} else if (empty(preg_match('/module-value/', $k)) === false) {
} else if (($data['wizard_section'] !== 'snmp_interfaces_explorer') && (empty(preg_match('/module-value/', $k)) === false)) {
$result[$value]['value'] = $data[$k];
} else if (empty(preg_match('/module-macros/', $k)) === false) {
$result[$value]['macros'] = $data[$k];

File diff suppressed because it is too large Load Diff

View File

@ -86,17 +86,17 @@ class ConsoleSupervisor
*
* @var boolean
*/
public $verbose;
public $interactive;
/**
* Constructor.
*
* @param boolean $verbose Show output while executing or not.
* @param boolean $interactive Show output while executing or not.
*
* @return class This object
*/
public function __construct(bool $verbose=true)
public function __construct(bool $interactive=true)
{
$source = db_get_row(
'tnotification_source',
@ -104,16 +104,16 @@ class ConsoleSupervisor
io_safe_input('System status')
);
$this->verbose = $verbose;
$this->interactive = $interactive;
if ($source === false) {
$this->notificationsEnabled = false;
$this->enabled = false;
$this->sourceId = null;
$this->targetGroups = null;
$this->targetUsers = null;
} else {
$this->notificationsEnabled = (bool) $source['enabled'];
$this->enabled = (bool) $source['enabled'];
$this->sourceId = $source['id'];
// Assign targets.
@ -153,42 +153,42 @@ class ConsoleSupervisor
/*
* PHP configuration warnings:
* NOTIF.PHP.SAFE_MODE
* NOTIF.PHP.INPUT_TIME
* NOTIF.PHP.EXECUTION_TIME
* NOTIF.PHP.UPLOAD_MAX_FILESIZE
* NOTIF.PHP.MEMORY_LIMIT
* NOTIF.PHP.DISABLE_FUNCTIONS
* NOTIF.PHP.PHANTOMJS
* NOTIF.PHP.VERSION
* NOTIF.PHP.SAFE_MODE
* NOTIF.PHP.INPUT_TIME
* NOTIF.PHP.EXECUTION_TIME
* NOTIF.PHP.UPLOAD_MAX_FILESIZE
* NOTIF.PHP.MEMORY_LIMIT
* NOTIF.PHP.DISABLE_FUNCTIONS
* NOTIF.PHP.PHANTOMJS
* NOTIF.PHP.VERSION
*/
$this->checkPHPSettings();
/*
* Check license.
* NOTIF.LICENSE.EXPIRATION
* NOTIF.LICENSE.EXPIRATION
*/
$this->checkLicense();
/*
* Check component statuses (servers down - frozen).
* NOTIF.SERVER.STATUS.ID_SERVER
* NOTIF.SERVER.STATUS.ID_SERVER
*/
$this->checkPandoraServers();
/*
* Check at least 1 server running in master mode.
* NOTIF.SERVER.MASTER
* NOTIF.SERVER.MASTER
*/
$this->checkPandoraServerMasterAvailable();
/*
* Check if CRON is running.
* NOTIF.CRON.CONFIGURED
* NOTIF.CRON.CONFIGURED
*/
if (enterprise_installed()) {
@ -197,14 +197,14 @@ class ConsoleSupervisor
/*
* Check if instance is registered.
* NOTIF.UPDATEMANAGER.REGISTRATION
* NOTIF.UPDATEMANAGER.REGISTRATION
*/
$this->checkUpdateManagerRegistration();
/*
* Check if there're new messages in UM.
* NOTIF.UPDATEMANAGER.MESSAGES
* NOTIF.UPDATEMANAGER.MESSAGES
*/
$this->getUMMessages();
@ -212,31 +212,32 @@ class ConsoleSupervisor
/*
* Check if the Server and Console has
* the same versions.
* NOTIF.SERVER.MISALIGNED
*/
$this->checkConsoleServerVersions();
/*
* Check if AllowOverride is None or All.
* NOTIF.ALLOWOVERIDE.MESSAGE
*/
$this->checkAllowOverrideEnabled();
/*
* Check if AllowOverride is None or All.
* NOTIF.HAMASTER.MESSAGE
*/
$this->checkHaStatus();
$this->checkAllowOverrideEnabled();
/*
* Check if the Pandora Console log
* file remains in old location.
* NOTIF.PANDORACONSOLE.LOG.OLD
*/
$this->checkPandoraConsoleLogOldLocation();
/*
* Check if the audit log file
* remains in old location.
* NOTIF.AUDIT.LOG.OLD
*/
$this->checkAuditLogOldLocation();
}
@ -253,7 +254,7 @@ class ConsoleSupervisor
$this->maintenanceOperations();
if ($this->notificationsEnabled === false) {
if ($this->enabled === false) {
// Notifications not enabled.
return;
}
@ -280,65 +281,65 @@ class ConsoleSupervisor
/*
* Check license.
* NOTIF.LICENSE.EXPIRATION
* NOTIF.LICENSE.LIMITED
* NOTIF.LICENSE.EXPIRATION
* NOTIF.LICENSE.LIMITED
*/
$this->checkLicense();
/*
* Check number of files in attachment:
* NOTIF.FILES.ATTACHMENT
* NOTIF.FILES.ATTACHMENT
*/
$this->checkAttachment();
/*
* Files in data_in:
* NOTIF.FILES.DATAIN (>1000)
* NOTIF.FILES.DATAIN.BADXML (>150)
* NOTIF.FILES.DATAIN (>1000)
* NOTIF.FILES.DATAIN.BADXML (>150)
*/
$this->checkDataIn();
/*
* Check module queues not growing:
* NOTIF.SERVER.QUEUE.ID_SERVER
* NOTIF.SERVER.QUEUE.ID_SERVER
*/
$this->checkServers();
/*
* Check component statuses (servers down - frozen).
* NOTIF.SERVER.STATUS.ID_SERVER
* NOTIF.SERVER.STATUS.ID_SERVER
*/
$this->checkPandoraServers();
/*
* Check at least 1 server running in master mode.
* NOTIF.SERVER.MASTER
* NOTIF.SERVER.MASTER
*/
$this->checkPandoraServerMasterAvailable();
/*
* PHP configuration warnings:
* NOTIF.PHP.SAFE_MODE
* NOTIF.PHP.INPUT_TIME
* NOTIF.PHP.EXECUTION_TIME
* NOTIF.PHP.UPLOAD_MAX_FILESIZE
* NOTIF.PHP.MEMORY_LIMIT
* NOTIF.PHP.DISABLE_FUNCTIONS
* NOTIF.PHP.PHANTOMJS
* NOTIF.PHP.VERSION
* NOTIF.PHP.SAFE_MODE
* NOTIF.PHP.INPUT_TIME
* NOTIF.PHP.EXECUTION_TIME
* NOTIF.PHP.UPLOAD_MAX_FILESIZE
* NOTIF.PHP.MEMORY_LIMIT
* NOTIF.PHP.DISABLE_FUNCTIONS
* NOTIF.PHP.PHANTOMJS
* NOTIF.PHP.VERSION
*/
$this->checkPHPSettings();
/*
* Check connection with historical DB (if enabled).
* NOTIF.HISTORYDB
* NOTIF.HISTORYDB
*/
$this->checkPandoraHistoryDB();
@ -346,23 +347,23 @@ class ConsoleSupervisor
/*
* Check pandoradb running in main DB.
* Check pandoradb running in historical DB.
* NOTIF.PANDORADB
* NOTIF.PANDORADB.HISTORICAL
* NOTIF.PANDORADB
* NOTIF.PANDORADB.HISTORICAL
*/
$this->checkPandoraDBMaintenance();
/*
* Check historical DB MR version.
* NOTIF.HISTORYDB.MR
* NOTIF.HISTORYDB.MR
*/
$this->checkPandoraHistoryDBMR();
/*
* Check external components.
* NOTIF.EXT.ELASTICSEARCH
* NOTIF.EXT.LOGSTASH
* NOTIF.EXT.ELASTICSEARCH
* NOTIF.EXT.LOGSTASH
*
*/
@ -370,76 +371,76 @@ class ConsoleSupervisor
/*
* Check Metaconsole synchronization issues.
* NOTIF.METACONSOLE.DB_CONNECTION
* NOTIF.METACONSOLE.DB_CONNECTION
*/
$this->checkMetaconsole();
/*
* Check incoming scheduled downtimes (< 15d).
* NOTIF.DOWNTIME
* NOTIF.DOWNTIME
*/
$this->checkDowntimes();
/*
* Check if instance is registered.
* NOTIF.UPDATEMANAGER.REGISTRATION
* NOTIF.UPDATEMANAGER.REGISTRATION
*/
$this->checkUpdateManagerRegistration();
/*
* Check if event storm protection is activated.
* NOTIF.MISC.EVENTSTORMPROTECTION
* NOTIF.MISC.EVENTSTORMPROTECTION
*/
$this->checkEventStormProtection();
/*
* Check if develop_bypass is enabled.
* NOTIF.MISC.DEVELOPBYPASS
* NOTIF.MISC.DEVELOPBYPASS
*/
$this->checkDevelopBypass();
/*
* Check if fontpath exists.
* NOTIF.MISC.FONTPATH
* NOTIF.MISC.FONTPATH
*/
$this->checkFont();
/*
* Check if default user and password exists.
* NOTIF.SECURITY.DEFAULT_PASSWORD
* NOTIF.SECURITY.DEFAULT_PASSWORD
*/
$this->checkDefaultPassword();
/*
* Check if there're new updates.
* NOTIF.UPDATEMANAGER.OPENSETUP
* NOTIF.UPDATEMANAGER.UPDATE
* NOTIF.UPDATEMANAGER.OPENSETUP
* NOTIF.UPDATEMANAGER.UPDATE
*/
$this->checkUpdates();
/*
* Check if there're new minor updates available.
* NOTIF.UPDATEMANAGER.MINOR
* NOTIF.UPDATEMANAGER.MINOR
*/
$this->checkMinorRelease();
if (enterprise_installed()) {
if ((bool) enterprise_installed() === true) {
// Release the lock.
enterprise_hook('cron_supervisor_release_lock');
}
/*
* Check if CRON is running.
* NOTIF.CRON.CONFIGURED
* NOTIF.CRON.CONFIGURED
*/
if (enterprise_installed()) {
@ -448,14 +449,14 @@ class ConsoleSupervisor
/*
* Check if instance is registered.
* NOTIF.UPDATEMANAGER.REGISTRATION
* NOTIF.UPDATEMANAGER.REGISTRATION
*/
$this->checkUpdateManagerRegistration();
/*
* Check if there're new messages in UM.
* NOTIF.UPDATEMANAGER.MESSAGES
* NOTIF.UPDATEMANAGER.MESSAGES
*/
$this->getUMMessages();
@ -463,18 +464,23 @@ class ConsoleSupervisor
/*
* Check if the Server and Console has
* the same versions.
* NOTIF.SERVER.MISALIGNED
*/
$this->checkConsoleServerVersions();
/*
* Check if AllowOverride is None or All.
* NOTIF.ALLOWOVERRIDE.MESSAGE
*/
$this->checkAllowOverrideEnabled();
/*
* Check if HA status.
*/
if (enterprise_installed()) {
/*
* Check if HA status.
*/
if ((bool) enterprise_installed() === true) {
$this->checkHaStatus();
}
@ -482,13 +488,8 @@ class ConsoleSupervisor
* Check if the audit log file
* remains in old location.
*/
$this->checkAuditLogOldLocation();
/*
Check if AllowOverride is None or All.
*/
$this->checkAllowOverrideEnabled();
}
@ -511,13 +512,13 @@ class ConsoleSupervisor
* Update targets for given notification using object targets.
*
* @param array $notification Current notification.
* @param boolean $update Only update db targets, no email.
* @param boolean $send_mails Only update db targets, no email.
*
* @return void
*/
public function updateTargets(
array $notification,
bool $update=false
bool $send_mails=true
) {
$notification_id = $notification['id_mensaje'];
$blacklist = [];
@ -536,7 +537,7 @@ class ConsoleSupervisor
);
$insertion_string .= ',';
if ($update === false) {
if ($send_mails === true) {
// Send mail.
if (isset($user['also_mail']) && $user['also_mail'] == 1) {
enterprise_hook(
@ -570,7 +571,7 @@ class ConsoleSupervisor
);
$insertion_string .= ',';
if ($update === false) {
if ($send_mails === true) {
// Send mail.
if (isset($group['also_mail']) && $group['also_mail'] == 1) {
enterprise_hook(
@ -611,7 +612,7 @@ class ConsoleSupervisor
public function notify(
array $data,
int $source_id=0,
int $max_age=86400
int $max_age=SECONDS_1DAY
) {
// Uses 'check failed' logic.
if (is_array($data) === false) {
@ -680,8 +681,8 @@ class ConsoleSupervisor
// NOTIF.SERVER.MASTER.
// NOTIF.SERVER.STATUS.ID_SERVER.
if (preg_match('/^NOTIF.SERVER/', $data['type']) === true) {
// Component notifications require be inmediate.
$max_age = 0;
// Send notification once a day.
$max_age = SECONDS_1DAY;
}
// Else ignored.
@ -692,7 +693,9 @@ class ConsoleSupervisor
$prev = db_get_row(
'tmensajes',
'subtype',
$data['type']
$data['type'],
false,
false
);
if ($prev !== false
@ -711,7 +714,7 @@ class ConsoleSupervisor
],
['id_mensaje' => $prev['id_mensaje']]
);
$this->updateTargets($prev, true);
$this->updateTargets($prev, false);
return;
}
@ -960,7 +963,7 @@ class ConsoleSupervisor
{
global $config;
$remote_config_dir = io_safe_output($config['remote_config']);
$remote_config_dir = (string) io_safe_output($config['remote_config']);
if (enterprise_installed()
&& isset($config['license_nms'])
@ -1200,6 +1203,8 @@ class ConsoleSupervisor
*/
public function checkPandoraServers()
{
global $config;
$servers = db_get_all_rows_sql(
'SELECT
id_server,
@ -1239,8 +1244,29 @@ class ConsoleSupervisor
$this->cleanNotifications('NOTIF.SERVER.STATUS%');
return;
} else {
// Clean notifications. Only show notif for down servers.
$this->cleanNotifications('NOTIF.SERVER.STATUS%');
// Clean notifications. Only show notif for down servers
// ONLY FOR RECOVERED ONES.
$servers_working = db_get_all_rows_sql(
'SELECT
id_server,
name,
server_type,
server_keepalive,
status,
unix_timestamp() - unix_timestamp(keepalive) as downtime
FROM tserver
WHERE
unix_timestamp() - unix_timestamp(keepalive) <= server_keepalive
OR status != 0'
);
if (is_array($servers_working) === true) {
foreach ($servers_working as $server) {
$this->cleanNotifications(
'NOTIF.SERVER.STATUS'.$server['id_server']
);
}
}
}
foreach ($servers as $server) {
@ -1297,6 +1323,8 @@ class ConsoleSupervisor
*/
public function checkPandoraServerMasterAvailable()
{
global $config;
$n_masters = db_get_value_sql(
'SELECT
count(*) as n
@ -2541,7 +2569,7 @@ class ConsoleSupervisor
}
/*
/**
* Check if Pandora console log file remains in old location.
*
* @return void

View File

@ -385,6 +385,8 @@ class CredentialStore extends Wizard
// Decrypt content.
$key['username'] = io_output_password($key['username']);
$key['password'] = io_output_password($key['password']);
$key['extra_1'] = io_output_password($key['extra_1']);
$key['extra_2'] = io_output_password($key['extra_2']);
return $key;
}
@ -425,6 +427,8 @@ class CredentialStore extends Wizard
function ($carry, $item) {
$item['username'] = io_output_password($item['username']);
$item['password'] = io_output_password($item['password']);
$item['extra_1'] = io_output_password($item['extra_1']);
$item['extra_2'] = io_output_password($item['extra_2']);
$carry[$item['identifier']] = $item['identifier'];
return $carry;
}
@ -451,6 +455,18 @@ class CredentialStore extends Wizard
$start = get_parameter('start', 0);
$length = get_parameter('length', $config['block_size']);
$order = get_datatable_order(true);
if ((bool) users_is_admin() === false) {
$all = users_can_manage_group_all('UM');
$filter['group_list'] = array_keys(
users_get_groups(
$config['id_user'],
'UM',
(bool) $all
)
);
}
try {
ob_start();
@ -561,13 +577,28 @@ class CredentialStore extends Wizard
$extra_1 = get_parameter('extra_1', null);
$extra_2 = get_parameter('extra_2', null);
if (empty($identifier)) {
if ($product === 'GOOGLE') {
$google_creds = json_decode(io_safe_output($extra_1));
if (json_last_error() !== JSON_ERROR_NONE) {
$this->ajaxMsg(
'error',
__('Not a valid JSON: %s', json_last_error_msg())
);
exit;
}
$username = $google_creds->client_email;
$password = $google_creds->private_key_id;
}
if (empty($identifier) === true) {
$error = __('Key identifier is required');
} else if ($id_group === null) {
$error = __('You must select a group where store this key!');
} else if (empty($product)) {
} else if (empty($product) === true) {
$error = __('You must specify a product type');
} else if (empty($username) && (empty($password))) {
} else if (empty($username) === true && (empty($password) === true)) {
$error = __('You must specify a username and/or password');
}
@ -581,10 +612,10 @@ class CredentialStore extends Wizard
'identifier' => $identifier,
'id_group' => $id_group,
'product' => $product,
'username' => io_input_password($username),
'password' => io_input_password($password),
'extra_1' => $extra_1,
'extra_2' => $extra_2,
'username' => io_input_password(io_safe_output($username)),
'password' => io_input_password(io_safe_output($password)),
'extra_1' => io_input_password(io_safe_output($extra_1)),
'extra_2' => io_input_password(io_safe_output($extra_2)),
];
// Spaces are not allowed.
@ -875,7 +906,7 @@ class CredentialStore extends Wizard
'AWS' => __('Aws'),
'AZURE' => __('Azure'),
'SAP' => __('SAP'),
// 'GOOGLE' => __('Google'),
'GOOGLE' => __('Google'),
],
'selected' => (isset($values['product']) ? $values['product'] : 'CUSTOM'),
'disabled' => (bool) $values['product'],
@ -887,6 +918,9 @@ class CredentialStore extends Wizard
$pass_label = __('Password');
$extra_1_label = __('Extra');
$extra_2_label = __('Extra (2)');
$extra1_type = 'text';
$user = true;
$pass = true;
$extra1 = true;
$extra2 = true;
@ -907,7 +941,14 @@ class CredentialStore extends Wizard
break;
case 'GOOGLE':
// Need further investigation.
$extra_1_label = __('Auth JSON');
$user = false;
$pass = false;
$extra1 = true;
$extra2 = false;
$extra1_type = 'textarea';
break;
case 'CUSTOM':
case 'SAP':
$user_label = __('Account ID');
@ -919,29 +960,33 @@ class CredentialStore extends Wizard
break;
}
$inputs[] = [
'label' => $user_label,
'id' => 'div-username',
'arguments' => [
'name' => 'username',
'input_class' => 'flex-row',
'type' => 'text',
'value' => $values['username'],
'return' => true,
],
];
if ($user) {
$inputs[] = [
'label' => $user_label,
'id' => 'div-username',
'arguments' => [
'name' => 'username',
'input_class' => 'flex-row',
'type' => 'text',
'value' => $values['username'],
'return' => true,
],
];
}
$inputs[] = [
'label' => $pass_label,
'id' => 'div-password',
'arguments' => [
'name' => 'password',
'input_class' => 'flex-row',
'type' => 'password',
'value' => $values['password'],
'return' => true,
],
];
if ($pass) {
$inputs[] = [
'label' => $pass_label,
'id' => 'div-password',
'arguments' => [
'name' => 'password',
'input_class' => 'flex-row',
'type' => 'password',
'value' => $values['password'],
'return' => true,
],
];
}
if ($extra1) {
$inputs[] = [
@ -949,8 +994,9 @@ class CredentialStore extends Wizard
'id' => 'div-extra_1',
'arguments' => [
'name' => 'extra_1',
'id' => 'text-extra_1',
'input_class' => 'flex-row',
'type' => 'text',
'type' => $extra1_type,
'value' => $values['extra_1'],
'return' => true,
],
@ -1031,14 +1077,30 @@ class CredentialStore extends Wizard
* Handles inputs visibility based on selected product.
*/
function calculate_inputs() {
if ($('#product :selected').val() != "GOOGLE") {
// Restore text-extra_1.
var val = $('#text-extra_1').val();
if(typeof val == 'undefined') {
val = '';
}
$('#text-extra_1').remove();
$('#div-extra_1').append(
$('<input type="text" name="extra_1" id="text-extra_1" size="50" value="'+val+'"></input>')
);
}
if ($('#product :selected').val() == "CUSTOM") {
$('#div-username label').text('<?php echo __('User'); ?>');
$('#div-password label').text('<?php echo __('Password'); ?>');
$('#div-username').show();
$('#div-password').show();
$('#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-username').show();
$('#div-password').show();
$('#div-extra_1').hide();
$('#div-extra_2').hide();
} else if ($('#product :selected').val() == "AZURE") {
@ -1046,13 +1108,32 @@ class CredentialStore extends Wizard
$('#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-username').show();
$('#div-password').show();
$('#div-extra_1').show();
$('#div-extra_2').show();
} else if ($('#product :selected').val() == "SAP") {
$('#div-username label').text('<?php echo __('Account ID.'); ?>');
$('#div-password label').text('<?php echo __('Password'); ?>');
$('#div-username').show();
$('#div-password').show();
$('#div-extra_1').hide();
$('#div-extra_2').hide();
} else if ($('#product :selected').val() == "GOOGLE") {
$('#div-username').hide();
$('#div-password').hide();
$('#div-extra_2').hide();
$('#div-extra_1 label').text('<?php echo __('Auth JSON'); ?>');
var val = $('#text-extra_1').val();
if(typeof val == 'undefined') {
val = '';
}
$('#text-extra_1').remove();
$('#div-extra_1').append(
$('<textarea name="extra_1" id="text-extra_1">'+val+'</textarea>')
);
$('#div-extra_1').show();
}
}

View File

@ -549,6 +549,11 @@ class HTML
&& $input['arguments']['type'] != 'hidden_extended'
&& $input['arguments']['type'] != 'datalist'
) {
// Raw content for attach at the start of the input.
if (isset($input['surround_start']) === true) {
$output .= $input['surround_start'];
}
if (!$direct) {
$output .= '<li id="'.$input['id'].'" class="'.$class.'">';
}
@ -563,6 +568,11 @@ class HTML
if (!$direct) {
$output .= '</li>';
}
// Raw content for attach at the end of the input.
if (isset($input['surround_end']) === true) {
$output .= $input['surround_end'];
}
} else {
$output .= self::printInput($input['arguments']);
// Allow dynamic content.

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