mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-30 09:15:15 +02:00
Merge remote-tracking branch 'origin/develop' into ent-4231-crear-plugin-para-google-cloud-y-anadirlo-a-discovery
Conflicts: pandora_console/include/class/CredentialStore.class.php
This commit is contained in:
commit
eb67b387b9
@ -24,7 +24,7 @@ cd $CODEHOME && tar zcvf $RPMHOME/SOURCES/pandorafms_server-$LOCAL_VERSION.tar.g
|
||||
cd $CODEHOME/pandora_agents/shellscript && tar zcvf $RPMHOME/SOURCES/pandorafms_agent-$LOCAL_VERSION.tar.gz --exclude \.exe --exclude \.svn --exclude nohup linux || exit 1
|
||||
|
||||
# Unix agent
|
||||
cd $CODEHOME/pandora_agents && tar zvcf $RPMHOME/SOURCES/pandorafms_agent_unix-$LOCAL_VERSION.tar.gz --exclude \.exe --exclude \.svn --exclude nohup --exclude NT4 unix || exit 1
|
||||
cd $CODEHOME/pandora_agents && tar zvcf $RPMHOME/SOURCES/pandorafms_agent_unix-$LOCAL_VERSION.tar.gz --exclude \.exe --exclude \.svn --exclude nohup --exclude NT4 --exclude Darwin/dmg unix || exit 1
|
||||
|
||||
# Enterprise console
|
||||
cd $PANDHOME_ENT/pandora_console && tar zcvf $RPMHOME/SOURCES/pandorafms_console_enterprise-$LOCAL_VERSION.tar.gz --exclude \.exe --exclude \.svn enterprise/* || exit 1
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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();
|
||||
|
@ -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",
|
||||
|
145
extras/docker/centos8/README.MD
Normal file
145
extras/docker/centos8/README.MD
Normal file
@ -0,0 +1,145 @@
|
||||

|
||||
|
||||
|
||||
Pandora FMS is a __monitoring solution__ that provides unparalleled flexibility for IT to address both immediate and unforeseen operational issues, including infrastructure and IT processes.
|
||||
|
||||
It uniquely enables business and IT to adapt to changing needs through a flexible and rapid approach to IT and business deployment.
|
||||
|
||||
For community support you can visit our forums at [forums.pandorafms.org](http://forums.pandorafms.org). Check out our community website at [pandorafms.org](http://pandorafms.org), and if you need sales information or/and professional support, visit [pandorafms.com](http://pandorafms.com).
|
||||
|
||||
# Pandora FMS full stack based on Centos 8
|
||||
|
||||
## Try it
|
||||
|
||||
You can try it on a cloud env for 4 hours using play with docker just click in the icon bellow, wait for the pulling image and the containers will be up and running automatically
|
||||
|
||||
If you want to open the console just click on the port 8080 on the upside and will be redirected to the pandora consola.
|
||||
|
||||
[](https://labs.play-with-docker.com/?stack=https://raw.githubusercontent.com/rafaelameijeiras/PandoraFMS/master/pandorafms_community/docker-compose-official.yml)
|
||||
|
||||
|
||||
https://www.youtube.com/watch?v=Hw2P6hHQpeI
|
||||
|
||||
Note: could take a couple of minutes for the console to be ready so if you click in the 8080 port and nothing and have a blank page wait a little and reload the page
|
||||
|
||||
## Usage
|
||||
```
|
||||
docker run --name Pandora_new %container_name% --rm \
|
||||
-p %local_httpd_port%:80 \
|
||||
-p %local_tentacle_port%:41121 \
|
||||
-e DBHOST=%Mysql_Server_IP% \
|
||||
-e DBNAME=%database_name% \
|
||||
-e DBUSER=%Mysql_user% \
|
||||
-e DBPASS=%Mysql_pass% \
|
||||
-e DBPORT=%Mysql_port% \
|
||||
-e INSTANCE_NAME=%server name% \
|
||||
-ti pandorafms-open-stack-el8
|
||||
```
|
||||
Example:
|
||||
```
|
||||
docker run --name Pandora_new --rm \
|
||||
-p 8081:80 \
|
||||
-p 41125:41121 \
|
||||
-e DBHOST=192.168.80.45 \
|
||||
-e DBNAME=pandora_demos_1 \
|
||||
-e DBUSER=pandora \
|
||||
-e DBPASS=pandora \
|
||||
-e DBPORT=3306 \
|
||||
-e INSTANCE_NAME=pandora201 \
|
||||
-ti pandorafms-open-stack-el8
|
||||
```
|
||||
|
||||
### Integrated database for PandoraFMS container
|
||||
There is a preconfigured database image in this repo to connect the Pandora environment so you can up the database and then point the pandora container to the database.
|
||||
|
||||
Example:
|
||||
```
|
||||
docker run --name Pandora_DB \
|
||||
-p 3306:3306 \
|
||||
-e MYSQL_ROOT_PASSWORD=pandora \
|
||||
-e MYSQL_DATABASE=pandora \
|
||||
-e MYSQL_USER=pandora \
|
||||
-e MYSQL_PASSWORD=pandora \
|
||||
-d pandorafms/pandorafms-percona-base
|
||||
```
|
||||
|
||||
This creates a Percona mysql docker and a database called Pandora with grants to the pandora user (optional) and the credentials for root user.
|
||||
|
||||
In this example we expose the 3306 for database connection.
|
||||
|
||||
Using this configuration (getting the container ip from DB container ip) you can execute the next container Pandora pointing to it:
|
||||
|
||||
```
|
||||
docker run --name Pandora_new --rm \
|
||||
-p 8081:80 \
|
||||
-p 41125:41121 \
|
||||
-e DBHOST=<percona container ip> \
|
||||
-e DBNAME=pandora \
|
||||
-e DBUSER=pandora \
|
||||
-e DBPASS=pandora \
|
||||
-e DBPORT=3306 \
|
||||
-e INSTANCE_NAME=pandora_inst \
|
||||
-ti pandorafms/pandorafms-open-stack-el8
|
||||
```
|
||||
|
||||
### Docker Compose Stack
|
||||
|
||||
if you want to run an easy to deploy stack you may use the docker-compose.yml file
|
||||
|
||||
```
|
||||
version: '3.1'
|
||||
services:
|
||||
db:
|
||||
image: pandorafms/pandorafms-percona-base
|
||||
restart: always
|
||||
#command: ["mysqld", "--innodb-buffer-pool-size=900M"]
|
||||
environment:
|
||||
MYSQL_ROOT_PASSWORD: pandora
|
||||
MYSQL_DATABASE: pandora
|
||||
MYSQL_USER: pandora
|
||||
MYSQL_PASSWORD: pandora
|
||||
networks:
|
||||
- pandora
|
||||
|
||||
pandora:
|
||||
image: pandorafms/pandorafms-open-stack-el8:latest
|
||||
restart: always
|
||||
depends_on:
|
||||
- db
|
||||
environment:
|
||||
MYSQL_ROOT_PASSWORD: pandora
|
||||
DBHOST: db
|
||||
DBNAME: pandora
|
||||
DBUSER: pandora
|
||||
DBPASS: pandora
|
||||
DBPORT: 3306
|
||||
INSTANCE_NAME: pandora01
|
||||
PUBLICURL: ""
|
||||
SLEEP: 5
|
||||
RETRIES: 10
|
||||
networks:
|
||||
- pandora
|
||||
ports:
|
||||
- "8080:80"
|
||||
- "41121:41121"
|
||||
- "162:162/udp"
|
||||
- "9995:9995/udp"
|
||||
networks:
|
||||
pandora:
|
||||
```
|
||||
just by running: `docker-compose -f <docker-compose-file> up`
|
||||
|
||||
## Important Parameters:
|
||||
|
||||
* __INSTANCE_NAME__: Pandora Server name
|
||||
* __DBHOST__: DB host IP to MySQL engine
|
||||
* __DBNAME__: The name of the database. If your user have enough permissions to create databases, the container will create it in case automatically if didn't exist
|
||||
* __DBUSER__: The user to connect MySQL engine.
|
||||
* __DBPASS__: User password to connect MySQL engine.
|
||||
* __DBPORT__: The port to connect MySQL engine. by default 33306
|
||||
* __PUBLICURL__: Define a public URL. Useful when Pandora is used behind a reverse proxy
|
||||
* __SLEEP__: Time to wait between retries
|
||||
* __RETRIES__: How many times Pandora will try to connect to MySQL engine before fail.
|
||||
|
||||
Note1: the SLEEP and RETRIES variables will be used to wait for database container to fully start, if you are in a slower system maybe you will need to increase these variables values, in this example will wait 5 seconds for the database container to be up and retries 3 times.
|
||||
|
257
extras/docker/centos8/base/Dockerfile
Normal file
257
extras/docker/centos8/base/Dockerfile
Normal file
@ -0,0 +1,257 @@
|
||||
#docker build -t pandorafms/pandorafms-open-base-el8 -f $HOME/code/pandorafms/extras/docker/centos8/base/Dockerfile $HOME/code/pandorafms/extras/docker/centos8/base/
|
||||
#docker push pandorafms/pandorafms-open-base-el8
|
||||
|
||||
FROM centos:8
|
||||
|
||||
RUN dnf install -y --setopt=tsflags=nodocs \
|
||||
epel-release \
|
||||
dnf-utils \
|
||||
http://rpms.remirepo.net/enterprise/remi-release-8.rpm
|
||||
|
||||
RUN dnf module reset -y php && dnf module install -y php:remi-7.3
|
||||
RUN dnf config-manager --set-enabled PowerTools
|
||||
|
||||
# Install console
|
||||
RUN dnf install -y --setopt=tsflags=nodocs \
|
||||
php \
|
||||
php-mcrypt \php-cli \
|
||||
php-gd \
|
||||
php-curl \
|
||||
php-session \
|
||||
php-mysqlnd \
|
||||
php-ldap \
|
||||
php-zip \
|
||||
php-zlib \
|
||||
php-fileinfo \
|
||||
php-gettext \
|
||||
php-snmp \
|
||||
php-mbstring \
|
||||
php-pecl-zip \
|
||||
php-xmlrpc \
|
||||
libxslt \
|
||||
wget \
|
||||
php-xml \
|
||||
httpd \
|
||||
mod_php \
|
||||
atk \
|
||||
avahi-libs \
|
||||
cairo \
|
||||
cups-libs \
|
||||
fribidi \
|
||||
gd \
|
||||
gdk-pixbuf2 \
|
||||
ghostscript \
|
||||
graphite2 \
|
||||
graphviz \
|
||||
gtk2 \
|
||||
harfbuzz \
|
||||
hicolor-icon-theme \
|
||||
hwdata \
|
||||
jasper-libs \
|
||||
lcms2 \
|
||||
libICE \
|
||||
libSM \
|
||||
libXaw \
|
||||
libXcomposite \
|
||||
libXcursor \
|
||||
libXdamage \
|
||||
libXext \
|
||||
libXfixes \
|
||||
libXft \
|
||||
libXi \
|
||||
libXinerama \
|
||||
libXmu \
|
||||
libXrandr \
|
||||
libXrender \
|
||||
libXt \
|
||||
libXxf86vm \
|
||||
libcroco \
|
||||
libdrm \
|
||||
libfontenc \
|
||||
libglvnd \
|
||||
libglvnd-egl \
|
||||
libglvnd-glx \
|
||||
libpciaccess \
|
||||
librsvg2 \
|
||||
libthai \
|
||||
libtool-ltdl \
|
||||
libwayland-client \
|
||||
libwayland-server \
|
||||
libxshmfence \
|
||||
mesa-libEGL \
|
||||
mesa-libGL \
|
||||
mesa-libgbm \
|
||||
mesa-libglapi \
|
||||
pango \
|
||||
pixman \
|
||||
nfdump \
|
||||
xorg-x11-fonts-75dpi \
|
||||
xorg-x11-fonts-misc \
|
||||
poppler-data \
|
||||
php-yaml; yum clean all
|
||||
|
||||
RUN mkdir -p /run/php-fpm/ ; chown -R root:apache /run/php-fpm/
|
||||
# not installed perl-Net-Telnet gtk-update-icon-cach ghostscript-fonts
|
||||
|
||||
# Install server
|
||||
|
||||
RUN dnf install -y --setopt=tsflags=nodocs \
|
||||
GeoIP \
|
||||
GeoIP-GeoLite-data \
|
||||
dwz \
|
||||
efi-srpm-macros \
|
||||
ghc-srpm-macros \
|
||||
go-srpm-macros \
|
||||
ocaml-srpm-macros \
|
||||
openblas-srpm-macros \
|
||||
perl \
|
||||
perl-Algorithm-Diff \
|
||||
perl-Archive-Tar \
|
||||
perl-Archive-Zip \
|
||||
perl-Attribute-Handlers \
|
||||
perl-B-Debug \
|
||||
perl-CPAN \
|
||||
perl-CPAN-Meta \
|
||||
perl-CPAN-Meta-Requirements \
|
||||
perl-CPAN-Meta-YAML \
|
||||
perl-Compress-Bzip2 \
|
||||
perl-Config-Perl-V \
|
||||
perl-DBD-MySQL \
|
||||
perl-DBI \
|
||||
perl-DB_File \
|
||||
perl-Data-Dump \
|
||||
perl-Data-OptList \
|
||||
perl-Data-Section \
|
||||
perl-Devel-PPPort \
|
||||
perl-Devel-Peek \
|
||||
perl-Devel-SelfStubber \
|
||||
perl-Devel-Size \
|
||||
perl-Digest-HMAC \
|
||||
perl-Digest-SHA \
|
||||
perl-Encode-Locale \
|
||||
perl-Encode-devel \
|
||||
perl-Env \
|
||||
perl-ExtUtils-CBuilder \
|
||||
perl-ExtUtils-Command \
|
||||
perl-ExtUtils-Embed \
|
||||
perl-ExtUtils-Install \
|
||||
perl-ExtUtils-MM-Utils \
|
||||
perl-ExtUtils-MakeMaker \
|
||||
perl-ExtUtils-Manifest \
|
||||
perl-ExtUtils-Miniperl \
|
||||
perl-ExtUtils-ParseXS \
|
||||
perl-File-Fetch \
|
||||
perl-File-HomeDir \
|
||||
perl-File-Listing \
|
||||
perl-File-Which \
|
||||
perl-Filter \
|
||||
perl-Filter-Simple \
|
||||
perl-Geo-IP \
|
||||
perl-HTML-Parser \
|
||||
perl-HTML-Tagset \
|
||||
perl-HTML-Tree \
|
||||
perl-HTTP-Cookies \
|
||||
perl-HTTP-Date \
|
||||
perl-HTTP-Message \
|
||||
perl-HTTP-Negotiate \
|
||||
perl-IO-HTML \
|
||||
perl-IO-Socket-INET6 \
|
||||
perl-IO-Zlib \
|
||||
perl-IO-stringy \
|
||||
perl-IPC-Cmd \
|
||||
perl-IPC-SysV \
|
||||
perl-IPC-System-Simple \
|
||||
perl-JSON \
|
||||
perl-JSON-PP \
|
||||
perl-LWP-MediaTypes \
|
||||
perl-Locale-Codes \
|
||||
perl-Locale-Maketext \
|
||||
perl-Locale-Maketext-Simple \
|
||||
perl-MRO-Compat \
|
||||
perl-Math-BigInt \
|
||||
perl-Math-BigInt-FastCalc \
|
||||
perl-Math-BigRat \
|
||||
perl-Memoize \
|
||||
perl-Module-Build \
|
||||
perl-Module-CoreList \
|
||||
perl-Module-CoreList-tools \
|
||||
perl-Module-Load \
|
||||
perl-Module-Load-Conditional \
|
||||
perl-Module-Loaded \
|
||||
perl-Module-Metadata \
|
||||
perl-NTLM \
|
||||
perl-Net-HTTP \
|
||||
perl-Net-Ping \
|
||||
perl-NetAddr-IP \
|
||||
perl-Package-Generator \
|
||||
perl-Params-Check \
|
||||
perl-Params-Util \
|
||||
perl-Perl-OSType \
|
||||
perl-PerlIO-via-QuotedPrint \
|
||||
perl-Pod-Checker \
|
||||
perl-Pod-Html \
|
||||
perl-Pod-Parser \
|
||||
perl-SelfLoader \
|
||||
perl-Socket6 \
|
||||
perl-Software-License \
|
||||
perl-Sub-Exporter \
|
||||
perl-Sub-Install \
|
||||
perl-Sys-Syslog \
|
||||
perl-Test \
|
||||
perl-Test-Harness \
|
||||
perl-Test-Simple \
|
||||
perl-Text-Balanced \
|
||||
perl-Text-Diff \
|
||||
perl-Text-Glob \
|
||||
perl-Text-Template \
|
||||
perl-Thread-Queue \
|
||||
perl-Time-Piece \
|
||||
perl-TimeDate \
|
||||
perl-Try-Tiny \
|
||||
perl-Unicode-Collate \
|
||||
perl-WWW-RobotRules \
|
||||
perl-XML-NamespaceSupport \
|
||||
perl-XML-Parser \
|
||||
perl-XML-SAX \
|
||||
perl-XML-SAX-Base \
|
||||
perl-XML-Simple \
|
||||
perl-XML-Twig \
|
||||
perl-autodie \
|
||||
perl-bignum \
|
||||
perl-devel \
|
||||
perl-encoding \
|
||||
perl-experimental \
|
||||
perl-inc-latest \
|
||||
perl-libnetcfg \
|
||||
perl-libwww-perl \
|
||||
perl-local-lib \
|
||||
perl-open \
|
||||
perl-perlfaq \
|
||||
perl-srpm-macros \
|
||||
perl-utils \
|
||||
perl-version \
|
||||
python-srpm-macros \
|
||||
python3-pyparsing \
|
||||
python3-rpm-macros \
|
||||
qt5-srpm-macros \
|
||||
redhat-rpm-config \
|
||||
rust-srpm-macros \
|
||||
systemtap-sdt-devel \
|
||||
perl-TermReadKey \
|
||||
perl \
|
||||
perl-DBD-MySQL \
|
||||
perl-DBI \
|
||||
initscripts \
|
||||
net-tools \
|
||||
nmap-ncat \
|
||||
nmap \
|
||||
net-snmp-utils \
|
||||
sudo \
|
||||
http://firefly.artica.es/centos8/perl-Net-Telnet-3.04-1.el8.noarch.rpm \
|
||||
http://www6.atomicorp.com/channels/atomic/centos/7/x86_64/RPMS/wmi-1.3.14-4.el7.art.x86_64.rpm
|
||||
|
||||
|
||||
RUN dnf install -y supervisor crontabs mysql http://firefly.artica.es/centos8/phantomjs-2.1.1-1.el7.x86_64.rpm --setopt=tsflags=nodocs
|
||||
|
||||
|
||||
EXPOSE 80 443 41121 162/udp
|
112
extras/docker/centos8/build_image_el8.sh
Executable file
112
extras/docker/centos8/build_image_el8.sh
Executable file
@ -0,0 +1,112 @@
|
||||
#!/bin/bash
|
||||
|
||||
VERSION=$1
|
||||
ENT="$HOME/code/pandora_enterprise"
|
||||
OPEN="$HOME/code/pandorafms"
|
||||
OS="Centos"
|
||||
ARCH="x86_64"
|
||||
EL="el7"
|
||||
EXT="demo"
|
||||
TARGET_URL="http://atlantis.artica.es"
|
||||
DOCKER_PATH="$OPEN/extras/docker/centos8/"
|
||||
OSTACK_IMAGE="pandorafms/pandorafms-open-stack-el8"
|
||||
OBASE_IMAGE="pandorafms/pandorafms-open-base-el8"
|
||||
PERCONA_IMAGE="pandorafms/pandorafms-percona-base"
|
||||
|
||||
|
||||
function help {
|
||||
echo "To excute the builder you must declare 4 parameters: the version image, upload (push) tokens, build base (rebuild centos base image), build percona (rebuild percona base image)"
|
||||
echo ""
|
||||
echo "$0 <version> [ <push 0|1> ] [<build base 0|1>] [<build percona 0|1>]"
|
||||
echo "Ex creates a local image from 749 packages : $0 749 0 1 1"
|
||||
}
|
||||
|
||||
if [ "$1" == "" ] || [ "$1" == "-h" ] ; then
|
||||
help
|
||||
exit
|
||||
fi
|
||||
|
||||
if [ "$2" == "1" ]; then
|
||||
UPDATE="1"
|
||||
fi
|
||||
|
||||
if [ "$3" == "1" ]; then
|
||||
BASEBUILD="1"
|
||||
fi
|
||||
|
||||
if [ "$4" == "1" ]; then
|
||||
DBBUILD="1"
|
||||
fi
|
||||
|
||||
#Defining packages urls
|
||||
|
||||
oconsoleurl=$TARGET_URL/Releases/7.0NG.$VERSION/$OS/noarch/pandorafms_console-7.0NG.$VERSION.noarch.rpm
|
||||
oserverurl=$TARGET_URL/Releases/7.0NG.$VERSION/$OS/noarch/pandorafms_server-7.0NG.$VERSION.noarch.rpm
|
||||
url=$(curl -I -s $TARGET_URL/Releases/7.0NG.$VERSION/ 2> /dev/null | grep "200 OK" | wc -l)
|
||||
|
||||
# log in into docker acount to acces private repo.
|
||||
|
||||
# docker login -u $DOCKERUSER -p$DOCKERPASS
|
||||
|
||||
Check athlantis is reachable
|
||||
if [ "$url" -lt 1 ] ; then
|
||||
echo "$url Athlantis unreachable ..."
|
||||
exit
|
||||
fi
|
||||
|
||||
echo "Start"
|
||||
# Removing old packages
|
||||
cd $DOCKER_PATH/pandora-stack/sources
|
||||
rm -rf ./pandorafms_*
|
||||
|
||||
# Downloading new packages
|
||||
wget $oconsoleurl
|
||||
wget $oserverurl
|
||||
|
||||
if [ "$BASEBUILD" == 1 ] ; then
|
||||
# Open Base image
|
||||
echo "building Base el8 image"
|
||||
cd $DOCKER_PATH/base
|
||||
docker build -t $OBASE_IMAGE:$VERSION -f $DOCKER_PATH/base/Dockerfile $DOCKER_PATH/base
|
||||
echo "Taging Open stack el8 latest image before upload"
|
||||
docker tag $OBASE_IMAGE:$VERSION $OBASE_IMAGE:latest
|
||||
echo -e ">>>> \n"
|
||||
fi
|
||||
|
||||
if [ "$DBBUILD" == 1 ] ; then
|
||||
# Percona image
|
||||
echo "building Percona image"
|
||||
cd $OPEN/extras/docker/percona
|
||||
docker build -t $PERCONA_IMAGE:latest -f $OPEN/extras/docker/percona/Dockerfile $OPEN/extras/docker/percona
|
||||
echo -e ">>>> \n"
|
||||
fi
|
||||
|
||||
#Open Stack image
|
||||
echo "building Open el8 image"
|
||||
cd $DOCKER_PATH/pandora-stack
|
||||
docker build -t $OSTACK_IMAGE:$VERSION -f $DOCKER_PATH/pandora-stack/Dockerfile $DOCKER_PATH/pandora-stack
|
||||
echo "Taging Open base latest image before upload"
|
||||
docker tag $OSTACK_IMAGE:$VERSION $OSTACK_IMAGE:latest
|
||||
echo -e ">>>> \n"
|
||||
|
||||
# Upload images
|
||||
|
||||
if [ "$UPDATE" == 1 ] ; then
|
||||
if [ "$BASEBUILD" == 1 ] ; then
|
||||
#Open base Images
|
||||
echo "Uploading Open $OBASE_IMAGE:$VERSION . . ."
|
||||
docker push $OBASE_IMAGE:$VERSION
|
||||
docker push $OBASE_IMAGE:latest
|
||||
fi
|
||||
|
||||
if [ "$DBBUILD" == 1 ] ; then
|
||||
#Open base Images
|
||||
echo "Uploading percona $PERCONA_IMAGE:latest . . ."
|
||||
docker push $PERCONA_IMAGE:latest
|
||||
fi
|
||||
|
||||
#Open Stack Images
|
||||
echo "Uploading Open $OSTACK_IMAGE:$VERSION . . ."
|
||||
docker push $OSTACK_IMAGE:$VERSION
|
||||
docker push $OSTACK_IMAGE:latest
|
||||
fi
|
43
extras/docker/centos8/docker-compose.yml
Normal file
43
extras/docker/centos8/docker-compose.yml
Normal file
@ -0,0 +1,43 @@
|
||||
# Use root/example as user/password credentials
|
||||
# este compose incluye la base de datos en otro docker y levanta aplicacion y DB juntos
|
||||
version: '3.1'
|
||||
|
||||
services:
|
||||
|
||||
db:
|
||||
image: pandorafms/pandorafms-percona-base
|
||||
restart: always
|
||||
#command: ["mysqld", "--innodb-buffer-pool-size=900M"]
|
||||
environment:
|
||||
MYSQL_ROOT_PASSWORD: pandora
|
||||
MYSQL_DATABASE: pandora
|
||||
MYSQL_USER: pandora
|
||||
MYSQL_PASSWORD: pandora
|
||||
networks:
|
||||
- pandora
|
||||
|
||||
pandora:
|
||||
image: pandorafms/pandorafms-open-stack-el8:latest
|
||||
restart: always
|
||||
depends_on:
|
||||
- db
|
||||
environment:
|
||||
MYSQL_ROOT_PASSWORD: pandora
|
||||
DBHOST: db
|
||||
DBNAME: pandora
|
||||
DBUSER: pandora
|
||||
DBPASS: pandora
|
||||
DBPORT: 3306
|
||||
INSTANCE_NAME: pandora01
|
||||
PUBLICURL: ""
|
||||
SLEEP: 5
|
||||
RETRIES: 10
|
||||
networks:
|
||||
- pandora
|
||||
ports:
|
||||
- "8080:80"
|
||||
- "41121:41121"
|
||||
- "162:162/udp"
|
||||
- "9995:9995/udp"
|
||||
networks:
|
||||
pandora:
|
24
extras/docker/centos8/pandora-stack/Dockerfile
Normal file
24
extras/docker/centos8/pandora-stack/Dockerfile
Normal file
@ -0,0 +1,24 @@
|
||||
#docker build -t pandorafms/pandorafms-open-stack-el8:$VERSION -f $HOME/code/pandorafms/extras/docker/centos8/pandora-stack/Dockerfile $HOME/code/pandorafms/extras/docker/centos8/pandora-stack/
|
||||
|
||||
FROM pandorafms/pandorafms-open-base-el8
|
||||
|
||||
ENV DBNAME=pandora
|
||||
ENV DBUSER=pandora
|
||||
ENV DBPASS=pandora
|
||||
ENV DBHOST=pandora
|
||||
ENV DBPORT=3306
|
||||
ENV SLEEP=5
|
||||
ENV RETRIES=1
|
||||
ENV OPEN=1
|
||||
|
||||
ENV LC_ALL=C
|
||||
|
||||
RUN rm -rf /etc/localtime ; ln -s /usr/share/zoneinfo/Europe/Madrid /etc/localtime
|
||||
|
||||
COPY ./sources /opt/pandora
|
||||
# Install the Pandora console
|
||||
RUN dnf install -y /opt/pandora/pandorafms_console-*.rpm /opt/pandora/pandorafms_server-*.rpm ; yum clean all
|
||||
|
||||
EXPOSE 80 443 41121 162/udp 9995/udp
|
||||
|
||||
CMD sh /opt/pandora/init_pandora.sh
|
5
extras/docker/centos8/pandora-stack/sources/.gitignore
vendored
Normal file
5
extras/docker/centos8/pandora-stack/sources/.gitignore
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
# exclude packages
|
||||
demos/
|
||||
*.tar*
|
||||
*.rpm
|
||||
phantomjs
|
336
extras/docker/centos8/pandora-stack/sources/init_pandora.sh
Executable file
336
extras/docker/centos8/pandora-stack/sources/init_pandora.sh
Executable file
@ -0,0 +1,336 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Prepares environment and launchs Pandora FMS
|
||||
#
|
||||
# Global vars
|
||||
#
|
||||
PANDORA_CONSOLE=/var/www/html/pandora_console
|
||||
PANDORA_SERVER_CONF=/etc/pandora/pandora_server.conf
|
||||
PANDORA_SERVER_BIN=/usr/bin/pandora_server
|
||||
PANDORA_HA_BIN=/usr/bin/pandora_ha
|
||||
PANDORA_TABLES_MIN=160
|
||||
#
|
||||
# Check database
|
||||
#
|
||||
function db_check {
|
||||
# Check DB
|
||||
echo -n ">> Checking dbengine connection: "
|
||||
|
||||
for i in `seq $RETRIES`; do
|
||||
r=`echo 'select 1' | mysql -u$DBUSER -p$DBPASS -P$DBPORT -h$DBHOST -A`
|
||||
if [ $? -ne 0 ]; then
|
||||
echo -n "retriying DB conection in $SLEEP seconds: "
|
||||
sleep $SLEEP
|
||||
else
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
r=`echo 'select 1' | mysql -u$DBUSER -p$DBPASS -P$DBPORT -h$DBHOST -A`
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "OK"
|
||||
echo -n ">> Checking database connection: "
|
||||
r=`echo 'select 1' | mysql -u$DBUSER -p$DBPASS -P$DBPORT -h$DBHOST -A $DBNAME`
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "OK"
|
||||
return 0
|
||||
fi
|
||||
echo -n ">> Cannot connect to $DBNAME, trying to create: "
|
||||
r=`echo "create database $DBNAME" | mysql -u$DBUSER -p$DBPASS -P$DBPORT -h$DBHOST`
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "OK"
|
||||
return 0
|
||||
fi
|
||||
echo "Cannot create database $DBNAME on $DBUSER@$DBHOST:$DBPORT"
|
||||
|
||||
return 1
|
||||
fi
|
||||
|
||||
if [ "$DEBUG" == "1" ]; then
|
||||
echo "Command: [echo 'select 1' | mysql -u$DBUSER -p$DBPASS -P$DBPORT -h$DBHOST -A $DBNAME]"
|
||||
echo "Output: [$r]"
|
||||
|
||||
traceroute $DBHOST
|
||||
nmap $DBHOST -v -v -p $DBPORT
|
||||
fi
|
||||
|
||||
|
||||
return 1
|
||||
}
|
||||
|
||||
# Load database
|
||||
#
|
||||
function db_load {
|
||||
# Load DB
|
||||
echo -n ">> Checking database state:"
|
||||
r=`mysql -u$DBUSER -p$DBPASS -P$DBPORT -h$DBHOST -A $DBNAME -s -e 'show tables'| wc -l`
|
||||
if [ "$DEBUG" == "1" ]; then
|
||||
echo "Command: [mysql -u$DBUSER -p$DBPASS -P$DBPORT -h$DBHOST -A $DBNAME -s -e 'show tables'| wc -l]"
|
||||
echo "Output: [$r]"
|
||||
fi
|
||||
|
||||
if [ "$r" -ge "$PANDORA_TABLES_MIN" ]; then
|
||||
echo 'OK. Already exists, '$r' tables detected'
|
||||
return 0
|
||||
fi
|
||||
echo 'Empty database detected';
|
||||
|
||||
# Needs to be loaded.
|
||||
echo -n "- Loading database schema: "
|
||||
r=`mysql -u$DBUSER -p$DBPASS -P$DBPORT -h$DBHOST $DBNAME < $PANDORA_CONSOLE/pandoradb.sql`
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "mysql -u$DBUSER -p$DBPASS -P$DBPORT -h$DBHOST $DBNAME < $PANDORA_CONSOLE/pandoradb.sql"
|
||||
echo "ERROR"
|
||||
echo "$r"
|
||||
return 1;
|
||||
fi
|
||||
echo "OK"
|
||||
|
||||
echo -n "- Loading database data: "
|
||||
r=`mysql -u$DBUSER -p$DBPASS -P$DBPORT -h$DBHOST $DBNAME < $PANDORA_CONSOLE/pandoradb_data.sql`
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "ERROR"
|
||||
echo $r
|
||||
return 2;
|
||||
fi
|
||||
echo "OK"
|
||||
|
||||
# Loaded.
|
||||
return 0
|
||||
}
|
||||
|
||||
#
|
||||
# Prepare & start Pandora FMS Console
|
||||
#
|
||||
function console_prepare {
|
||||
CONSOLE_PATH=/var/www/html/pandora_console
|
||||
|
||||
echo ">> Preparing console"
|
||||
# Delete install and license files.
|
||||
mv $CONSOLE_PATH/install.php $CONSOLE_PATH/install.done
|
||||
rm -f $CONSOLE_PATH/enterprise/PandoraFMS_Enteprise_Licence.txt
|
||||
|
||||
# Configure console.
|
||||
cat > $CONSOLE_PATH/include/config.php << EO_CONFIG_F
|
||||
<?php
|
||||
\$config["dbtype"] = "mysql";
|
||||
\$config["dbname"]="$DBNAME";
|
||||
\$config["dbuser"]="$DBUSER";
|
||||
\$config["dbpass"]="$DBPASS";
|
||||
\$config["dbhost"]="$DBHOST";
|
||||
\$config["homedir"]="/var/www/html/pandora_console";
|
||||
\$config["homeurl"]="/pandora_console";
|
||||
error_reporting(0);
|
||||
\$ownDir = dirname(__FILE__) . '/';
|
||||
include (\$ownDir . "config_process.php");
|
||||
|
||||
EO_CONFIG_F
|
||||
|
||||
# enable allow override
|
||||
cat > /etc/httpd/conf.d/pandora.conf << EO_CONFIG_F
|
||||
<Directory "/var/www/html">
|
||||
Options Indexes FollowSymLinks
|
||||
AllowOverride All
|
||||
Require all granted
|
||||
</Directory>
|
||||
|
||||
EO_CONFIG_F
|
||||
|
||||
cat > /var/www/html/index.html << EOF_INDEX
|
||||
<meta HTTP-EQUIV="REFRESH" content="0; url=/pandora_console/">
|
||||
EOF_INDEX
|
||||
|
||||
echo "- Fixing permissions"
|
||||
chmod 600 $CONSOLE_PATH/include/config.php
|
||||
chown -R apache. $CONSOLE_PATH
|
||||
|
||||
# prepare php.ini
|
||||
sed -i -e "s/^max_input_time.*/max_input_time = -1/g" /etc/php.ini
|
||||
sed -i -e "s/^max_execution_time.*/max_execution_time = 0/g" /etc/php.ini
|
||||
sed -i -e "s/^upload_max_filesize.*/upload_max_filesize = 800M/g" /etc/php.ini
|
||||
sed -i -e "s/^memory_limit.*/memory_limit = 500M/g" /etc/php.ini
|
||||
|
||||
echo "- Setting Public URL: $PUBLICURL"
|
||||
q=$(mysql -u$DBUSER -p$DBPASS $DBNAME -h$DBHOST -sNe "select token from tconfig;" | grep public_url)
|
||||
[[ ! "$q" ]] && mysql -u $DBUSER -p$DBPASS $DBNAME -P$DBPORT -h$DBHOST -sNe "INSERT INTO tconfig (token,value) VALUES ('public_url',\"$PUBLICURL\");"
|
||||
mysql -u$DBUSER -p$DBPASS $DBNAME -h$DBHOST -sNe "UPDATE tconfig SET value=\"$PUBLICURL\" WHERE token=\"public_url\";"
|
||||
|
||||
#touch $CONSOLE_PATH/pandora_console.log
|
||||
#chown apache. $CONSOLE_PATH/pandora_console.log
|
||||
|
||||
}
|
||||
|
||||
function check_mr {
|
||||
## geting MR + Package
|
||||
CMR=$(mysql -u$DBUSER -p$DBPASS $DBNAME -h$DBHOST -sNe "select value from tconfig where token = 'MR'")
|
||||
CPK=$(mysql -u$DBUSER -p$DBPASS $DBNAME -h$DBHOST -sNe "select value from tconfig where token = 'current_package_enterprise'")
|
||||
|
||||
DPK=$(grep pandora_version $PANDORA_CONSOLE/include/config_process.php | awk '{print $3}' | tr -d "'" | tr -d ";" | cut -d . -f 3)
|
||||
DMR=$(ls $PANDORA_CONSOLE/extras/mr/ | sort -n | tail -1 | cut -d . -f 1)
|
||||
|
||||
if [[ $DMR -gt $CMR ]]; then
|
||||
echo ">> Fixing DB: MR: $CMR Current Package: $CPK Desired MR: $DMR"
|
||||
cd $PANDORA_CONSOLE/extras/mr/
|
||||
for i in $(ls | sort -n); do
|
||||
cat $i | mysql -u$DBUSER -p$DBPASS $DBNAME -h$DBHOST
|
||||
done
|
||||
cd -
|
||||
|
||||
echo ">> Updating DB: MR: $CMR Current Package: $CPK Desired MR: $DMR"
|
||||
|
||||
mysql -u $DBUSER -p$DBPASS $DBNAME -h$DBHOST -sNe "update tconfig set value = $DMR where token = 'MR';"
|
||||
mysql -u $DBUSER -p$DBPASS $DBNAME -h$DBHOST -sNe "update tconfig set value = $DPK where token = 'current_package_enterprise';"
|
||||
fi
|
||||
|
||||
|
||||
}
|
||||
|
||||
function server_prepare {
|
||||
sed -i -e "s/^dbhost.*/dbhost $DBHOST/g" $PANDORA_SERVER_CONF
|
||||
sed -i -e "s/^dbname.*/dbname $DBNAME/g" $PANDORA_SERVER_CONF
|
||||
sed -i -e "s/^dbuser.*/dbuser $DBUSER/g" $PANDORA_SERVER_CONF
|
||||
sed -i -e "s|^dbpass.*|dbpass $DBPASS|g" $PANDORA_SERVER_CONF
|
||||
sed -i -e "s/^dbport.*/dbport $DBPORT/g" $PANDORA_SERVER_CONF
|
||||
sed -i -e "s/^#servername.*/servername $INSTANCE_NAME/g" $PANDORA_SERVER_CONF
|
||||
echo "pandora_service_cmd /etc/init.d/pandora_server" >> $PANDORA_SERVER_CONF
|
||||
|
||||
# prepare snmptrapd
|
||||
cat > /etc/snmp/snmptrapd.conf << EOF
|
||||
authCommunity log public
|
||||
disableAuthorization yes
|
||||
EOF
|
||||
|
||||
## Enable WUX
|
||||
if [ "$WUX_SERVER" == "1" ] && [ "$WUX_HOST" ]; then
|
||||
if [ ! $WUX_PORT ]; then
|
||||
WUX_PORT=4444
|
||||
fi
|
||||
echo "Enabling WUX server HOST=$WUX_HOST PORT=$WUX_PORT"
|
||||
sed -i -r "s/#?wuxserver.*/wuxserver 1/g" $PANDORA_SERVER_CONF
|
||||
sed -i -r "s/#?wux_host.*/wux_host $WUX_HOST/g" $PANDORA_SERVER_CONF
|
||||
sed -i -r "s/#?wux_port.*/wux_port $WUX_PORT/g" $PANDORA_SERVER_CONF
|
||||
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
##
|
||||
## MAIN
|
||||
##
|
||||
|
||||
if [ "$DBUSER" == "" ] || [ "$DBPASS" == "" ] || [ "$DBNAME" == "" ] || [ "$DBHOST" == "" ]; then
|
||||
echo "Required environemntal variables DBUSER, DBPASS, DBNAME, DBHOST"
|
||||
exit 1
|
||||
fi
|
||||
if [ "$DBPORT" == "" ]; then
|
||||
DBPORT=3306
|
||||
fi
|
||||
|
||||
echo "" > /opt/pandora/crontasks || touch /opt/pandora/crontasks
|
||||
|
||||
|
||||
#install pandora packages
|
||||
echo "-> Istalling pandorafms"
|
||||
cd /opt/pandora
|
||||
useradd pandora
|
||||
|
||||
if [[ $OPEN != 1 ]]; then
|
||||
# install enterprise
|
||||
dnf install -y /opt/pandora/pandorafms_console*.rpm
|
||||
tar xvfz /opt/pandora/pandorafms_server_*tar* && cd pandora_server && ./pandora_server_installer --install ; rm -rf /opt/pandora/pandora_server
|
||||
[[ -e /var/www/html/pandora_console/include/config.php ]] || yum reinstall -y /opt/pandora/pandorafms*.rpm
|
||||
PANDORA_BIN="pandora_ha"
|
||||
PANDORA_EXEC="/usr/bin/pandora_ha /etc/pandora/pandora_server.conf"
|
||||
else
|
||||
install only open
|
||||
dnf install -y /opt/pandora/pandorafms_console-*.rpm /opt/pandora/pandorafms_server-*.rpm
|
||||
dnf reinstall -y /opt/pandora/pandorafms_server-*.rpm
|
||||
[[ -e /var/www/html/pandora_console/include/config.php ]] || dnf reinstall -y /opt/pandora/pandorafms_console-*.rpm
|
||||
PANDORA_BIN="pandora_server"
|
||||
PANDORA_EXEC="/usr/bin/pandora_server /etc/pandora/pandora_server.conf"
|
||||
fi
|
||||
|
||||
|
||||
|
||||
db_check && db_load
|
||||
|
||||
# Sync to MC.
|
||||
if [ "$META_DBNAME" != "" ] && [ "$META_DBHOST" != "" ]; then
|
||||
if [ "$META_DBPORT" == "" ]; then
|
||||
META_DBPORT=3306
|
||||
fi
|
||||
register_mc
|
||||
fi
|
||||
|
||||
check_mr
|
||||
console_prepare
|
||||
server_prepare
|
||||
|
||||
echo ">> Enable oracle env file cron: "
|
||||
cat > /etc/pandora/pandora_server.env << 'EOF_ENV'
|
||||
#!/bin/bash
|
||||
VERSION=19.8
|
||||
export PATH=$PATH:$HOME/bin:/usr/lib/oracle/$VERSION/client64/bin
|
||||
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib/oracle/$VERSION/client64/lib
|
||||
export ORACLE_HOME=/usr/lib/oracle/$VERSION/client64
|
||||
EOF_ENV
|
||||
|
||||
echo ">> Enable discovery cron: "
|
||||
#while true ; do wget -q -O - --no-check-certificate http://localhost/pandora_console/enterprise/cron.php >> /var/www/html/pandora_console/pandora_console.log && sleep 60 ; done &
|
||||
echo "*/5 * * * * wget -q -O - --no-check-certificate http://localhost/pandora_console/enterprise/cron.php >> /var/www/html/pandora_console/log/cron.log" >> /opt/pandora/crontasks
|
||||
|
||||
echo ">> Enable pandora_db cron: "
|
||||
/usr/bin/perl /usr/share/pandora_server/util/pandora_db.pl /etc/pandora/pandora_server.conf
|
||||
#while true ; do sleep 1h && /usr/bin/pandora_db /etc/pandora/pandora_server.conf; done &
|
||||
echo "0 */1 * * * /usr/bin/pandora_db /etc/pandora/pandora_server.conf" >> /opt/pandora/crontasks
|
||||
|
||||
echo ">> Loading crontab tasks"
|
||||
crontab -r
|
||||
crontab /opt/pandora/crontasks && crontab -l
|
||||
|
||||
ip addr | grep -w "inet" | grep -v "127.0.0.1" | grep -v -e "172.1[0-9].0.1" | awk '{print $2}' | awk -F '/' '{print "-> Go to http://"$1"/pandora_console to manage this server"}'
|
||||
|
||||
# Check and launch supervisord
|
||||
echo ">> Starting process: Running supervisord"
|
||||
# Create supervisor.conf
|
||||
|
||||
cat > /etc/supervisord.conf << EOF_CON
|
||||
[unix_http_server]
|
||||
file=/tmp/supervisor.sock
|
||||
|
||||
[supervisord]
|
||||
nodaemon=true
|
||||
loglevel = debug
|
||||
|
||||
[program:php-fpm]
|
||||
command=/usr/sbin/php-fpm -F
|
||||
riredirect_stderr=true
|
||||
|
||||
[program:httpd]
|
||||
command=/usr/sbin/apachectl -DFOREGROUND
|
||||
riredirect_stderr=true
|
||||
|
||||
[program:tentacle]
|
||||
command=/etc/init.d/tentacle_serverd restart
|
||||
|
||||
[program:$PANDORA_BIN]
|
||||
command=$PANDORA_EXEC
|
||||
riredirect_stderr=true
|
||||
|
||||
[program:cron]
|
||||
command=crond -n
|
||||
|
||||
[group:allservices]
|
||||
programs=httpd,cron,php-fpm,$PANDORA_BIN,tentacle
|
||||
|
||||
[rpcinterface:supervisor]
|
||||
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
|
||||
|
||||
[supervisorctl]
|
||||
serverurl=unix:///tmp/supervisor.sock
|
||||
|
||||
EOF_CON
|
||||
|
||||
# execute supervisor
|
||||
touch /var/log/pandora/pandora_server.log ; tail -F /var/log/pandora/* &
|
||||
su - -c supervisord
|
31
extras/docker/percona/Dockerfile
Normal file
31
extras/docker/percona/Dockerfile
Normal file
@ -0,0 +1,31 @@
|
||||
|
||||
#docker build -t pandorafms/pandorafms-percona-base -f $HOME/code/pandorafms/extras/docker/percona/Dockerfile $HOME/code/pandorafms/extras/docker/percona
|
||||
|
||||
FROM percona:5.7
|
||||
|
||||
RUN echo -e '#PandoraFMS configuration \n\
|
||||
[mysqld] \n\
|
||||
max_allowed_packet = 64M \n\
|
||||
innodb_buffer_pool_size = 500M \n\
|
||||
innodb_lock_wait_timeout = 90 \n\
|
||||
innodb_file_per_table \n\
|
||||
innodb_flush_log_at_trx_commit = 0 \n\
|
||||
innodb_flush_method = O_DIRECT \n\
|
||||
innodb_log_file_size = 64M \n\
|
||||
innodb_log_buffer_size = 16M \n\
|
||||
innodb_io_capacity = 100 \n\
|
||||
thread_cache_size = 8 \n\
|
||||
thread_stack = 256K \n\
|
||||
max_connections = 100 \n \n\
|
||||
key_buffer_size=4M \n\
|
||||
read_buffer_size=128K \n\
|
||||
read_rnd_buffer_size=128K \n\
|
||||
sort_buffer_size=128K \n\
|
||||
join_buffer_size=4M \n\n\
|
||||
query_cache_type = 1 \n\
|
||||
query_cache_size = 64M \n\
|
||||
query_cache_min_res_unit = 2k \n\
|
||||
query_cache_limit = 256K \n\n\
|
||||
sql_mode="" ' > /etc/my.cnf.d/pandora.cnf
|
||||
|
||||
EXPOSE 3306
|
50
extras/docker/percona/README.MD
Normal file
50
extras/docker/percona/README.MD
Normal file
@ -0,0 +1,50 @@
|
||||

|
||||
|
||||
# Pandora FMS database container
|
||||
|
||||
This container image is designed for optimal performance using Pandora FMS.
|
||||
|
||||
Is based on the official Percona database image turned to get the maximum performance on PandoraFMS
|
||||
|
||||
## Official Gitgub repo
|
||||
|
||||
Dockerfiles and more info in our official repository: https://github.com/pandorafms/pandorafms/tree/develop/extras/docker/percona
|
||||
|
||||
## USAGE
|
||||
|
||||
Similar to the official percona image:
|
||||
Example:
|
||||
```
|
||||
docker run --name Pandora_DB \
|
||||
-p 3306:3306 \
|
||||
-e MYSQL_ROOT_PASSWORD=pandora \
|
||||
-e MYSQL_DATABASE=pandora \
|
||||
-e MYSQL_USER=pandora \
|
||||
-e MYSQL_PASSWORD=pandora \
|
||||
-d pandorafms/pandorafms-percona-base
|
||||
```
|
||||
|
||||
## Environment Variables
|
||||
When you start the percona image, you can adjust the configuration of the instance by passing one or more environment variables on the docker run command line. Do note that none of the variables below will have any effect if you start the container with a data directory that already contains a database: any pre-existing database will always be left untouched on container startup.
|
||||
|
||||
__MYSQL_ROOT_PASSWORD__ : This variable is mandatory and specifies the password that will be set for the root superuser account. In the above example, it was set to my-secret-pw.
|
||||
|
||||
__MYSQL_ROOT_HOST__ : By default, root can connect from anywhere. This option restricts root connections to be from the specified host only. Also localhost can be used here for the local-only root access.
|
||||
|
||||
__MYSQL_DATABASE__ :
|
||||
This variable is optional and allows you to specify the name of a database to be created on image startup. If a user/password was supplied (see below) then that user will be granted superuser access (corresponding to GRANT ALL) to this database.
|
||||
|
||||
__MYSQL_USER, MYSQL_PASSWORD__ :These variables are optional, used in conjunction to create a new user and to set that user's password. This user will be granted superuser permissions (see above) for the database specified by the MYSQL_DATABASE variable. Both variables are required for a user to be created.
|
||||
Do note that there is no need to use this mechanism to create the root superuser, that user gets created by default with the password specified by the MYSQL_ROOT_PASSWORD variable.
|
||||
|
||||
__MYSQL_ALLOW_EMPTY_PASSWORD__ : This is an optional variable. Set to yes to allow the container to be started with a blank password for the root user. NOTE: Setting this variable to yes is not recommended unless you really know what you are doing, since this will leave your instance completely unprotected, allowing anyone to gain complete superuser access.
|
||||
|
||||
__MYSQL_RANDOM_ROOT_PASSWORD__ : This is an optional variable. Set to yes to generate a random initial password for the root user (using pwgen). The generated root password will be printed to stdout (GENERATED ROOT PASSWORD: .....).
|
||||
|
||||
__MYSQL_ONETIME_PASSWORD__ : Sets root (not the user specified in MYSQL_USER!) user as expired once init is complete, forcing a password change on first login. NOTE: This feature is supported on MySQL 5.6+ only. Using this option on MySQL 5.5 will throw an appropriate error during initialization.
|
||||
|
||||
__MYSQL_INITDB_SKIP_TZINFO__ : At first run MySQL automatically loads from the local system the timezone information needed for the CONVERT_TZ() function. If it's is not what is intended, this option disables timezone loading.
|
||||
|
||||
__INIT_TOKUDB__ : Tuns on TokuDB Engine. It can be activated only when transparent huge pages (THP) are disabled.
|
||||
|
||||
__INIT_ROCKSDB__ : Tuns on RocksDB Engine.
|
@ -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);
|
||||
|
@ -57,6 +57,9 @@ AGENT_UNIX_FILE="$CODEHOME/pandora_agents/unix/pandora_agent"
|
||||
AGENT_WIN_FILE="$CODEHOME/pandora_agents/win32/pandora.cc"
|
||||
AGENT_WIN_MPI_FILE="$CODEHOME/pandora_agents/win32/installer/pandora.mpi"
|
||||
AGENT_WIN_RC_FILE="$CODEHOME/pandora_agents/win32/versioninfo.rc"
|
||||
AGENT_DARWIN_BUILDER="$CODEHOME/pandora_agents/unix/Darwin/dmg/build_darwin_dmg.sh"
|
||||
AGENT_DARWIN_DISTR="$CODEHOME/pandora_agents/unix/Darwin/dmg/extras/distribution.xml"
|
||||
AGENT_DARWIN_PLIST="$CODEHOME/pandora_agents/unix/Darwin/dmg/files/pandorafms_uninstall/PandoraFMS agent uninstaller.app/Contents/Info.plist"
|
||||
SATELLITE_FILE="$PANDHOME_ENT/satellite_server/satellite_server.pl"
|
||||
PERL_PLUGIN_FILES="$PANDHOME_ENT/pandora_server/util/recon_script/vmware-plugin.pl \
|
||||
$PANDHOME_ENT/pandora_server/util/recon_script/pcm_client.pl \
|
||||
@ -138,6 +141,14 @@ for file in $INSTALLER_FILES; do
|
||||
update_installer_version $file
|
||||
done
|
||||
|
||||
# Darwin dmg installer files
|
||||
echo "Updating DARWIN DMG files..."
|
||||
sed -i -e "/VERSION/s/=\"7.0NG.*/=\"$VERSION\"/" "$AGENT_DARWIN_BUILDER"
|
||||
sed -i -r "s/(version=\").*(\"\s+onConclusion=)/\1$VERSION\2/g" "$AGENT_DARWIN_DISTR"
|
||||
sed -i -r "s/(CFBundleVersion<\/key>\s*<string>).*(<\/string>)/\1$VERSION\2/g" "$AGENT_DARWIN_PLIST"
|
||||
sed -i -r "s/(CFBundleShortVersionString<\/key>\s*<string>).*(<\/string>)/\1$VERSION\2/g" "$AGENT_DARWIN_PLIST"
|
||||
sed -i -r "s/(CFBundleGetInfoString<\/key>\s*<string>).*( Pandora FMS)/\1$VERSION\2/g" "$AGENT_DARWIN_PLIST"
|
||||
|
||||
# Perl plugins files
|
||||
for file in $PERL_PLUGIN_FILES; do
|
||||
echo "Updating plugin file $file..."
|
||||
@ -155,7 +166,7 @@ sed -i -e "s/my\s\s*\$version\s*=.*/my \$version = \"$VERSION PS$BUILD\";/" "$SE
|
||||
sed -i -e "s/\s*\#\s*\Version.*/\# Version $VERSION/" "$SERVER_CONF_FILE"
|
||||
sed -i -e "s/\s*\!define PRODUCT_VERSION.*/\!define PRODUCT_VERSION \"$VERSION\"/" "$SERVER_WIN_MPI_OPEN_FILE"
|
||||
sed -i -e "s/\s*\!define PRODUCT_VERSION.*/\!define PRODUCT_VERSION \"$VERSION\"/" "$SERVER_WIN_MPI_ENT_FILE"
|
||||
echo "Updateing Pandora PluginTools version..."
|
||||
echo "Updating Pandora PluginTools version..."
|
||||
sed -i -e "s/my\s\s*\$pandora_version\s*=.*/my \$pandora_version = \"$VERSION\";/" "$PLUGIN_LIB_FILE"
|
||||
sed -i -e "s/my\s\s*\$pandora_build\s*=.*/my \$pandora_build = \"$BUILD\";/" "$PLUGIN_LIB_FILE"
|
||||
|
||||
|
@ -1,20 +1,27 @@
|
||||
FROM centos:centos7
|
||||
FROM centos:centos8
|
||||
MAINTAINER Pandora FMS Team <info@pandorafms.com>
|
||||
|
||||
# Add Pandora FMS agent installer
|
||||
ADD unix /tmp/pandora_agent/unix
|
||||
ADD unix /opt/pandora/pandora_agent/unix
|
||||
|
||||
RUN export LC_ALL=C
|
||||
|
||||
RUN dnf install -y dnf-plugins-core; dnf config-manager --set-enabled PowerTools
|
||||
|
||||
# Install dependencies
|
||||
RUN yum -y install \
|
||||
RUN dnf -y install \
|
||||
epel-release \
|
||||
unzip \
|
||||
perl \
|
||||
python3 \
|
||||
sed \
|
||||
"perl(Sys::Syslog)"
|
||||
perl-YAML-Tiny \
|
||||
"perl(Sys::Syslog)" \
|
||||
&& dnf clean all
|
||||
|
||||
|
||||
# Install Pandora FMS agent
|
||||
RUN cd /tmp/pandora_agent/unix \
|
||||
RUN cd /opt/pandora/pandora_agent/unix \
|
||||
&& chmod +x pandora_agent_installer \
|
||||
&& ./pandora_agent_installer --install
|
||||
|
||||
@ -41,8 +48,7 @@ if [ $TIMEZONE != "" ]; then\n \
|
||||
\tln -sfn /usr/share/zoneinfo/$TIMEZONE /etc/localtime\n \
|
||||
fi\n \
|
||||
/etc/init.d/pandora_agent_daemon start\n \
|
||||
rm -f $0\n \
|
||||
tail -f /var/log/pandora/pandora_agent.log' \
|
||||
tail -F /var/log/pandora/pandora_agent.log' \
|
||||
>> /entrypoint.sh && \
|
||||
chmod +x /entrypoint.sh
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.749, AIX version
|
||||
# Version 7.0NG.750, AIX version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2010 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.749, FreeBSD Version
|
||||
# Version 7.0NG.750, FreeBSD Version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2010 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.749, HP-UX Version
|
||||
# Version 7.0NG.750, HP-UX Version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.749, GNU/Linux
|
||||
# Version 7.0NG.750, GNU/Linux
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.749, GNU/Linux
|
||||
# Version 7.0NG.750, GNU/Linux
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.749, Solaris Version
|
||||
# Version 7.0NG.750, Solaris Version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
@ -1,6 +1,6 @@
|
||||
# Base config file for Pandora FMS Windows Agent
|
||||
# (c) 2006-2010 Artica Soluciones Tecnologicas
|
||||
# Version 7.0NG.749
|
||||
# Version 7.0NG.750
|
||||
|
||||
# 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
|
||||
|
@ -1,6 +1,6 @@
|
||||
# Fichero de configuracion base de agentes de Pandora
|
||||
# Base config file for Pandora agents
|
||||
# Version 7.0NG.749, AIX version
|
||||
# Version 7.0NG.750, AIX version
|
||||
|
||||
# General Parameters
|
||||
# ==================
|
||||
|
@ -1,6 +1,6 @@
|
||||
# Fichero de configuracion base de agentes de Pandora
|
||||
# Base config file for Pandora agents
|
||||
# Version 7.0NG.749
|
||||
# Version 7.0NG.750
|
||||
# FreeBSD/IPSO version
|
||||
# Licenced under GPL licence, 2003-2007 Sancho Lerena
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
# Fichero de configuracion base de agentes de Pandora
|
||||
# Base config file for Pandora agents
|
||||
# Version 7.0NG.749, HPUX Version
|
||||
# Version 7.0NG.750, HPUX Version
|
||||
|
||||
# General Parameters
|
||||
# ==================
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.749
|
||||
# Version 7.0NG.750
|
||||
# Licensed under GPL license v2,
|
||||
# (c) 2003-2010 Artica Soluciones Tecnologicas
|
||||
# please visit http://pandora.sourceforge.net
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.749
|
||||
# Version 7.0NG.750
|
||||
# Licensed under GPL license v2,
|
||||
# (c) 2003-2009 Artica Soluciones Tecnologicas
|
||||
# please visit http://pandora.sourceforge.net
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.749
|
||||
# Version 7.0NG.750
|
||||
# Licensed under GPL license v2,
|
||||
# please visit http://pandora.sourceforge.net
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
# Fichero de configuracion base de agentes de Pandora
|
||||
# Base config file for Pandora agents
|
||||
# Version 7.0NG.749, Solaris version
|
||||
# Version 7.0NG.750, Solaris version
|
||||
|
||||
# General Parameters
|
||||
# ==================
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.749, AIX version
|
||||
# Version 7.0NG.750, AIX version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2010 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
@ -99,6 +99,12 @@ transfer_mode tentacle
|
||||
# Proxy timeout (by default 1s)
|
||||
# proxy_timeout 1
|
||||
|
||||
# Address the proxy will listen on.
|
||||
#proxy_address 0.0.0.0
|
||||
|
||||
# Port the proxy will listen on.
|
||||
#proxy_port 41121
|
||||
|
||||
# User the agent will run as
|
||||
#pandora_user root
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
package: pandorafms-agent-unix
|
||||
Version: 7.0NG.749-200922
|
||||
Version: 7.0NG.750-201201
|
||||
Architecture: all
|
||||
Priority: optional
|
||||
Section: admin
|
||||
|
@ -14,7 +14,7 @@
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
pandora_version="7.0NG.749-200922"
|
||||
pandora_version="7.0NG.750-201201"
|
||||
|
||||
echo "Test if you has the tools for to make the packages."
|
||||
whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null
|
||||
|
@ -6,13 +6,16 @@
|
||||
<string>com.pandorafms.pandorafms</string>
|
||||
<key>ProgramArguments</key>
|
||||
<array>
|
||||
<string>/usr/bin/pandora_agent</string>
|
||||
<string>/usr/local/bin/pandora_agent</string>
|
||||
<string>/etc/pandora</string>
|
||||
</array>
|
||||
<key>EnvironmentVariables</key>
|
||||
<dict>
|
||||
<key>PATH</key>
|
||||
<string>/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/bin:/Library/Apple/bin</string>
|
||||
</dict>
|
||||
<key>RunAtLoad</key>
|
||||
<true/>
|
||||
<key>ServiceDescription</key>
|
||||
<string>PandoraFMS agent</string>
|
||||
<key>UserName</key>
|
||||
<string>root</string>
|
||||
</dict>
|
||||
|
14
pandora_agents/unix/Darwin/dmg/HOWTO.txt
Normal file
14
pandora_agents/unix/Darwin/dmg/HOWTO.txt
Normal file
@ -0,0 +1,14 @@
|
||||
### DMG Agent compilation for MacOS
|
||||
|
||||
1. Move to the dmg directory, where build_darwin_dmg.sh is located
|
||||
# cd /<code-path>/pandorafms/pandora_agents/unix/Darwin/dmg/HOWTO.txt
|
||||
|
||||
2. Run the script. It has three optional arguments. In this order:
|
||||
- DMG package name.
|
||||
By default is "Pandora FMS MacOS agent"
|
||||
- DMG package version.
|
||||
It uses the current version by default (e.g. "7.NG.748")
|
||||
- Build path, where temporary files and final .dmg will be created.
|
||||
By default /root/code/pandorafms/pandora_agents/unix/Darwin/dmg (it creates "build" and "buildtmp" folders, deletes buildtmp when finished)
|
||||
|
||||
3. The script should return "SUCCESS: DMG file created at XXXX" when finished.
|
105
pandora_agents/unix/Darwin/dmg/build_darwin_dmg.sh
Normal file
105
pandora_agents/unix/Darwin/dmg/build_darwin_dmg.sh
Normal file
@ -0,0 +1,105 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Restore the original working directory and exit.
|
||||
function error {
|
||||
popd >/dev/null 2>&1
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Keeping this for future CICD integration
|
||||
if [ "$CI_PROJECT_DIR" != "" ]; then
|
||||
LOCALINST="$CODEHOME/pandora_agents/unix/Darwin/dmg"
|
||||
else
|
||||
LOCALINST="/root/code/pandorafms/pandora_agents/unix/Darwin/dmg"
|
||||
fi
|
||||
|
||||
# DMG package name
|
||||
if [ "$#" -ge 1 ]; then
|
||||
DMGNAME="$1"
|
||||
else
|
||||
DMGNAME="Pandora FMS MacOS agent"
|
||||
fi
|
||||
|
||||
# DMG package version
|
||||
if [ "$#" -ge 2 ]; then
|
||||
VERSION="$2"
|
||||
else
|
||||
VERSION="7.0NG.750"
|
||||
fi
|
||||
|
||||
# Path for the generated DMG file
|
||||
if [ "$#" -ge 3 ]; then
|
||||
BUILD_PATH="$3"
|
||||
else
|
||||
BUILD_PATH="/root/code/pandorafms/pandora_agents/unix/Darwin/dmg"
|
||||
fi
|
||||
|
||||
BUILD_DMG="$BUILD_PATH/build"
|
||||
BUILD_TMP="$BUILD_PATH/buildtmp"
|
||||
|
||||
FULLNAME="$DMGNAME-$VERSION.dmg"
|
||||
echo "VERSION-"$VERSION" NAME-"$DMGNAME
|
||||
pushd .
|
||||
cd $LOCALINST
|
||||
|
||||
# Copy necessary files to installer
|
||||
cp ../com.pandorafms.pandorafms.plist files/pandorafms/
|
||||
cp ../../../../pandora_agents/unix/pandora* files/pandorafms/
|
||||
cp ../../../../pandora_agents/unix/tentacle* files/pandorafms/
|
||||
cp -R ../../../../pandora_agents/unix/plugins files/pandorafms/
|
||||
cp -R ../../../../pandora_agents/unix/man files/pandorafms/
|
||||
cp -R ../../../../pandora_agents/unix/Darwin/pandora_agent.conf files/pandorafms/
|
||||
mkdir $BUILD_DMG
|
||||
mkdir $BUILD_TMP
|
||||
|
||||
# Build pandorafms agent component
|
||||
pkgbuild --root files/pandorafms/ \
|
||||
--identifier com.pandorafms.pandorafms_src \
|
||||
--version $VERSION \
|
||||
--scripts scripts \
|
||||
--install-location /usr/local/share/pandora_agent/ \
|
||||
$BUILD_TMP/pandorafms_src.pdk || error
|
||||
|
||||
# Build pandorafms uninstaller app
|
||||
pkgbuild --root files/pandorafms_uninstall/ \
|
||||
--component-plist extras/pandorafms_uninstall.plist \
|
||||
--install-location /Applications \
|
||||
$BUILD_TMP/pandorafms_uninstall.pdk || error
|
||||
|
||||
# Put it together into a single pkg
|
||||
productbuild --distribution extras/distribution.xml \
|
||||
--package-path $BUILD_TMP \
|
||||
--resources resources \
|
||||
--scripts scripts \
|
||||
--version "$VERSION" \
|
||||
$BUILD_TMP/pandorafms_agent.pkg || error
|
||||
|
||||
# Clean and prepare dmg creation
|
||||
rm $BUILD_TMP/pandorafms_src.pdk
|
||||
rm $BUILD_TMP/pandorafms_uninstall.pdk
|
||||
|
||||
#Create dmg file
|
||||
hdiutil create -volname "Pandora FMS agent installer" \
|
||||
-srcfolder "$BUILD_TMP" \
|
||||
-ov -format UDZO \
|
||||
"$BUILD_DMG/$FULLNAME" || error
|
||||
|
||||
#Change the icon to dmg
|
||||
sips -i extras/pandora_installer.png || error
|
||||
DeRez -only icns extras/pandora_installer.png > tmpicns.rsrc || error
|
||||
Rez -append tmpicns.rsrc -o "$BUILD_DMG/$FULLNAME" || error
|
||||
SetFile -a C "$BUILD_DMG/$FULLNAME" || error
|
||||
|
||||
|
||||
# Copy and clean folder
|
||||
rm -Rf $BUILD_TMP
|
||||
rm -Rf files/pandorafms/*pandora*
|
||||
rm -Rf files/pandorafms/*tentacle*
|
||||
rm -Rf files/pandorafms/plugins
|
||||
rm -Rf files/pandorafms/man
|
||||
rm -f files/pandorafms/README
|
||||
rm -f tmpicns.rsrc
|
||||
|
||||
popd
|
||||
|
||||
printf "\nSUCCESS: DMG file created at \"$BUILD_DMG/$FULLNAME\"\n"
|
33
pandora_agents/unix/Darwin/dmg/extras/distribution.xml
Normal file
33
pandora_agents/unix/Darwin/dmg/extras/distribution.xml
Normal file
@ -0,0 +1,33 @@
|
||||
<?xml version="1.0" encoding="utf-8" standalone="no"?>
|
||||
<installer-gui-script minSpecVersion="1">
|
||||
<pkg-ref id="com.pandorafms.pandorafms_src"/>
|
||||
<title>Pandora FMS Agent installer for MacOS</title>
|
||||
<welcome file="text/welcome.html" />
|
||||
<!-- <readme file="text/readme.html" /> -->
|
||||
<license file="text/license.html" />
|
||||
<conclusion file="text/conclusion.html" />
|
||||
<background file="images/pfms_background_darwin.png" alignment="bottomleft" scaling="none" mime-type="image/png" uti="public.png" />
|
||||
<options customize="never" allow-external-scripts="true" rootVolumeOnly="true"/>
|
||||
<!-- <options customize="never" allow-external-scripts="true"/> -->
|
||||
<choices-outline>
|
||||
<line choice="default">
|
||||
<line choice="com.pandorafms.pandorafms_src"/>
|
||||
<line choice="com.pandorafms.pandorafms_uninstall"/>
|
||||
</line>
|
||||
</choices-outline>
|
||||
<choice id="default"/>
|
||||
<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>
|
||||
<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>
|
||||
<!-- <installation-check script="check()" />
|
||||
<script>
|
||||
<![CDATA[
|
||||
]]>
|
||||
</script>
|
||||
-->
|
||||
</installer-gui-script>
|
BIN
pandora_agents/unix/Darwin/dmg/extras/pandora_installer.png
Normal file
BIN
pandora_agents/unix/Darwin/dmg/extras/pandora_installer.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 33 KiB |
@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<array>
|
||||
<dict>
|
||||
<key>BundleHasStrictIdentifier</key>
|
||||
<true/>
|
||||
<key>BundleIsRelocatable</key>
|
||||
<false/>
|
||||
<key>BundleIsVersionChecked</key>
|
||||
<true/>
|
||||
<key>BundleOverwriteAction</key>
|
||||
<string>upgrade</string>
|
||||
<key>RootRelativeBundlePath</key>
|
||||
<string>PandoraFMS agent uninstaller.app</string>
|
||||
</dict>
|
||||
</array>
|
||||
</plist>
|
@ -0,0 +1,22 @@
|
||||
#!/usr/bin/osascript
|
||||
|
||||
set first_time to 1
|
||||
set text_display to "Please set your Pandora FMS IP address:"
|
||||
|
||||
repeat
|
||||
if (first_time = 1) then
|
||||
set text_display to "You can set a specific group for this agent (must exist in Pandora):"
|
||||
end if
|
||||
set my_group to display dialog ¬
|
||||
text_display with title ¬
|
||||
"Target group" default answer "Servers" ¬
|
||||
buttons {"Continue"} ¬
|
||||
default button "Continue"
|
||||
if ((text returned of my_group) = "") then
|
||||
set first_time to 0
|
||||
else
|
||||
exit repeat
|
||||
end if
|
||||
end repeat
|
||||
|
||||
return (text returned of my_group)
|
@ -0,0 +1,23 @@
|
||||
#!/usr/bin/osascript
|
||||
|
||||
set first_time to 1
|
||||
set text_display to "Enable remote config for this agent?"
|
||||
|
||||
repeat
|
||||
if (first_time = 1) then
|
||||
set text_display to "Enable remote config for this agent? (Enterprise only)"
|
||||
end if
|
||||
set my_remotecfg to display dialog ¬
|
||||
text_display with title ¬
|
||||
"Remote config" ¬
|
||||
buttons {"No", "Yes"} ¬
|
||||
default button "Yes"
|
||||
if (button returned of my_remotecfg) is "Yes" then
|
||||
set remote_config to "1"
|
||||
else
|
||||
set remote_config to "0"
|
||||
end if
|
||||
exit repeat
|
||||
end repeat
|
||||
|
||||
return (remote_config)
|
@ -0,0 +1,22 @@
|
||||
#!/usr/bin/osascript
|
||||
|
||||
set first_time to 1
|
||||
set text_display to "Please set your Pandora FMS IP address:"
|
||||
|
||||
repeat
|
||||
if (first_time = 1) then
|
||||
set text_display to "Please set your Pandora FMS IP address:"
|
||||
end if
|
||||
set my_serverip to display dialog ¬
|
||||
text_display with title ¬
|
||||
"Pandora FMS Server address" default answer "localhost" ¬
|
||||
buttons {"Continue"} ¬
|
||||
default button "Continue"
|
||||
if ((text returned of my_serverip) = "") then
|
||||
set first_time to 0
|
||||
else
|
||||
exit repeat
|
||||
end if
|
||||
end repeat
|
||||
|
||||
return (text returned of my_serverip)
|
@ -0,0 +1,31 @@
|
||||
#!/usr/bin/env perl
|
||||
|
||||
use strict;
|
||||
|
||||
my ($CONF_FILE, $token, $value) = @ARGV;
|
||||
exit unless defined ($value);
|
||||
exit unless -e $CONF_FILE;
|
||||
|
||||
open(my $fh, '<', $CONF_FILE) or die($!);
|
||||
my @lines = <$fh>;
|
||||
close ($fh);
|
||||
|
||||
# Set the new value for the configuration token.
|
||||
my $found = 0;
|
||||
for(my $i = 0; $i < $#lines; $i++) {
|
||||
if ($lines[$i] =~ m/[#\s]*$token/) {
|
||||
$lines[$i] = "$token $value\n";
|
||||
$found = 1;
|
||||
last;
|
||||
}
|
||||
}
|
||||
|
||||
# Append the token to the end if it was not found in the file.
|
||||
if ($found == 0) {
|
||||
push(@lines, "$token $value\n");
|
||||
}
|
||||
|
||||
# Write the changes to the configuration file.
|
||||
open($fh, '>', $CONF_FILE) or die($!);
|
||||
print $fh @lines;
|
||||
close($fh);
|
@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"><plist version="1.0"><dict><key>CFBundlePackageType</key><string>APPL</string><key>CFBundleInfoDictionaryVersion</key><string>6.0</string>
|
||||
|
||||
<key>CFBundleName</key> <string>PandoraFMS agent uninstaller</string>
|
||||
<key>CFBundleExecutable</key> <string>uninstall.sh</string>
|
||||
<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>NSPrincipalClass</key><string>NSApplication</string>
|
||||
<key>NSMainNibFile</key><string>MainMenu</string>
|
||||
</dict></plist>
|
@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env bash
|
||||
cd "$(dirname "$0")"
|
||||
|
||||
CONFIRM=`"$(dirname "$0")/../Resources/confirm_uninstall"`
|
||||
if [ "$CONFIRM" -ne "1" ]
|
||||
then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
OUTPUT=`"$(dirname "$0")/../Resources/ask_root"`
|
||||
ERROR="$?"
|
||||
|
||||
if [ "$?" -gt "0" ]
|
||||
then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo $OUTPUT | `sudo -S "$(dirname "$0")/../Resources/uninstall"`
|
@ -0,0 +1,9 @@
|
||||
#!/usr/bin/osascript
|
||||
|
||||
set my_password to display dialog "Please provide root password to uninstall Pandora FMS agent:" ¬
|
||||
with title "Root confirmation" ¬
|
||||
with icon caution ¬
|
||||
default answer "" ¬
|
||||
buttons {"Cancel", "OK"} default button 2 ¬
|
||||
with hidden answer
|
||||
return (text returned of my_password)
|
@ -0,0 +1,23 @@
|
||||
#!/usr/bin/osascript
|
||||
|
||||
set first_time to 1
|
||||
set text_display to "Are you sure you want to uninstall Pandora FMS agent?"
|
||||
|
||||
repeat
|
||||
if (first_time = 1) then
|
||||
set text_display to "Are you sure you want to uninstall Pandora FMS agent?"
|
||||
end if
|
||||
set my_remotecfg to display dialog ¬
|
||||
text_display with title ¬
|
||||
"Confirm uninstall" ¬
|
||||
buttons {"No", "Yes"} ¬
|
||||
default button "No"
|
||||
if (button returned of my_remotecfg) is "Yes" then
|
||||
set confirm_uninstall to "1"
|
||||
else
|
||||
set confirm_uninstall to "0"
|
||||
end if
|
||||
exit repeat
|
||||
end repeat
|
||||
|
||||
return (confirm_uninstall)
|
Binary file not shown.
@ -0,0 +1,33 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Stop the agent process
|
||||
`launchctl stop com.pandorafms.pandorafms`
|
||||
PFMSAGENT=`ps aux | grep pandora_agent | grep -v grep | wc -l`
|
||||
if [ "$PFMSAGENT" -gt "0" ]
|
||||
then
|
||||
PIDAGENT=`ps aux | grep pandora_agent | grep -v grep | awk '{print $2}'`
|
||||
kill $PIDAGENT
|
||||
fi
|
||||
|
||||
# Remove local files
|
||||
rm -Rf /etc/pandora
|
||||
rm -Rf /usr/local/share/pandora_agent/
|
||||
rm -f /usr/local/bin/pandora_agent
|
||||
rm -f /usr/local/bin/pandora_agent_exec
|
||||
rm -f /usr/local/bin/pandora_revent
|
||||
rm -f /usr/local/bin/tentacle_client
|
||||
rm -f /usr/local/share/man/man1/pandora_agent.1.gz
|
||||
rm -f /usr/local/share/man/man1/tentacle_client.1.gz
|
||||
rm -f /var/log/pandora/pandora_agent.*
|
||||
rm -f /etc/newsyslog.d/pandora_agent.conf
|
||||
|
||||
# Remove everything related with Pandora FMS agent
|
||||
`launchctl remove com.pandorafms.pandorafms`
|
||||
rm -f /Library/LaunchDaemons/com.pandorafms.pandorafms.plist
|
||||
|
||||
# Remove all packages residual files
|
||||
rm -f /private/var/db/receipts/com.pandorafms*
|
||||
|
||||
# Remove the uninstall app too
|
||||
rm -Rf /Applications/PandoraFMS*
|
||||
|
Binary file not shown.
After Width: | Height: | Size: 32 KiB |
@ -0,0 +1,4 @@
|
||||
Installation complete! Thank you for installing Pandora FMS agent for MacOS.
|
||||
Agent's service has been automatically started. You can manage the service with:
|
||||
sudo launchctl start com.pandorafms.pandorafms to start it, and sudo launchctl
|
||||
stop com.pandorafms.pandorafms to stop it.
|
237
pandora_agents/unix/Darwin/dmg/resources/text/license.html
Normal file
237
pandora_agents/unix/Darwin/dmg/resources/text/license.html
Normal file
@ -0,0 +1,237 @@
|
||||
GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free
|
||||
Software Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies of this license
|
||||
document, but changing it is not allowed. Preamble The licenses for most
|
||||
software are designed to take away your freedom to share and change it. By
|
||||
contrast, the GNU General Public License is intended to guarantee your freedom
|
||||
to share and change free software--to make sure the software is free for all its
|
||||
users. This General Public License applies to most of the Free Software
|
||||
Foundation's software and to any other program whose authors commit to using it.
|
||||
(Some other Free Software Foundation software is covered by the GNU Library
|
||||
General Public License instead.) You can apply it to your programs, too. When we
|
||||
speak of free software, we are referring to freedom, not price. Our General
|
||||
Public Licenses are designed to make sure that you have the freedom to
|
||||
distribute copies of free software (and charge for this service if you wish),
|
||||
that you receive source code or can get it if you want it, that you can change
|
||||
the software or use pieces of it in new free programs; and that you know you can
|
||||
do these things. To protect your rights, we need to make restrictions that
|
||||
forbid anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if you
|
||||
distribute copies of the software, or if you modify it. For example, if you
|
||||
distribute copies of such a program, whether gratis or for a fee, you must give
|
||||
the recipients all the rights that you have. You must make sure that they, too,
|
||||
receive or can get the source code. And you must show them these terms so they
|
||||
know their rights. We protect your rights with two steps: (1) copyright the
|
||||
software, and (2) offer you this license which gives you legal permission to
|
||||
copy, distribute and/or modify the software. Also, for each author's protection
|
||||
and ours, we want to make certain that everyone understands that there is no
|
||||
warranty for this free software. If the software is modified by someone else and
|
||||
passed on, we want its recipients to know that what they have is not the
|
||||
original, so that any problems introduced by others will not reflect on the
|
||||
original authors' reputations. Finally, any free program is threatened
|
||||
constantly by software patents. We wish to avoid the danger that redistributors
|
||||
of a free program will individually obtain patent licenses, in effect making the
|
||||
program proprietary. To prevent this, we have made it clear that any patent must
|
||||
be licensed for everyone's free use or not licensed at all. The precise terms
|
||||
and conditions for copying, distribution and modification follow. GNU GENERAL
|
||||
PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
0. This License applies to any program or other work which contains a notice
|
||||
placed by the copyright holder saying it may be distributed under the terms of
|
||||
this General Public License. The "Program", below, refers to any such program or
|
||||
work, and a "work based on the Program" means either the Program or any
|
||||
derivative work under copyright law: that is to say, a work containing the
|
||||
Program or a portion of it, either verbatim or with modifications and/or
|
||||
translated into another language. (Hereinafter, translation is included without
|
||||
limitation in the term "modification".) Each licensee is addressed as "you".
|
||||
Activities other than copying, distribution and modification are not covered by
|
||||
this License; they are outside its scope. The act of running the Program is not
|
||||
restricted, and the output from the Program is covered only if its contents
|
||||
constitute a work based on the Program (independent of having been made by
|
||||
running the Program). Whether that is true depends on what the Program does. 1.
|
||||
You may copy and distribute verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and appropriately
|
||||
publish on each copy an appropriate copyright notice and disclaimer of warranty;
|
||||
keep intact all the notices that refer to this License and to the absence of any
|
||||
warranty; and give any other recipients of the Program a copy of this License
|
||||
along with the Program. You may charge a fee for the physical act of
|
||||
transferring a copy, and you may at your option offer warranty protection in
|
||||
exchange for a fee. 2. You may modify your copy or copies of the Program or any
|
||||
portion of it, thus forming a work based on the Program, and copy and distribute
|
||||
such modifications or work under the terms of Section 1 above, provided that you
|
||||
also meet all of these conditions: a) You must cause the modified files to carry
|
||||
prominent notices stating that you changed the files and the date of any change.
|
||||
b) You must cause any work that you distribute or publish, that in whole or in
|
||||
part contains or is derived from the Program or any part thereof, to be licensed
|
||||
as a whole at no charge to all third parties under the terms of this License. c)
|
||||
If the modified program normally reads commands interactively when run, you must
|
||||
cause it, when started running for such interactive use in the most ordinary
|
||||
way, to print or display an announcement including an appropriate copyright
|
||||
notice and a notice that there is no warranty (or else, saying that you provide
|
||||
a warranty) and that users may redistribute the program under these conditions,
|
||||
and telling the user how to view a copy of this License. (Exception: if the
|
||||
Program itself is interactive but does not normally print such an announcement,
|
||||
your work based on the Program is not required to print an announcement.) These
|
||||
requirements apply to the modified work as a whole. If identifiable sections of
|
||||
that work are not derived from the Program, and can be reasonably considered
|
||||
independent and separate works in themselves, then this License, and its terms,
|
||||
do not apply to those sections when you distribute them as separate works. But
|
||||
when you distribute the same sections as part of a whole which is a work based
|
||||
on the Program, the distribution of the whole must be on the terms of this
|
||||
License, whose permissions for other licensees extend to the entire whole, and
|
||||
thus to each and every part regardless of who wrote it. Thus, it is not the
|
||||
intent of this section to claim rights or contest your rights to work written
|
||||
entirely by you; rather, the intent is to exercise the right to control the
|
||||
distribution of derivative or collective works based on the Program. In
|
||||
addition, mere aggregation of another work not based on the Program with the
|
||||
Program (or with a work based on the Program) on a volume of a storage or
|
||||
distribution medium does not bring the other work under the scope of this
|
||||
License. 3. You may copy and distribute the Program (or a work based on it,
|
||||
under Section 2) in object code or executable form under the terms of Sections 1
|
||||
and 2 above provided that you also do one of the following: a) Accompany it with
|
||||
the complete corresponding machine-readable source code, which must be
|
||||
distributed under the terms of Sections 1 and 2 above on a medium customarily
|
||||
used for software interchange; or, b) Accompany it with a written offer, valid
|
||||
for at least three years, to give any third party, for a charge no more than
|
||||
your cost of physically performing source distribution, a complete
|
||||
machine-readable copy of the corresponding source code, to be distributed under
|
||||
the terms of Sections 1 and 2 above on a medium customarily used for software
|
||||
interchange; or, c) Accompany it with the information you received as to the
|
||||
offer to distribute corresponding source code. (This alternative is allowed only
|
||||
for noncommercial distribution and only if you received the program in object
|
||||
code or executable form with such an offer, in accord with Subsection b above.)
|
||||
The source code for a work means the preferred form of the work for making
|
||||
modifications to it. For an executable work, complete source code means all the
|
||||
source code for all modules it contains, plus any associated interface
|
||||
definition files, plus the scripts used to control compilation and installation
|
||||
of the executable. However, as a special exception, the source code distributed
|
||||
need not include anything that is normally distributed (in either source or
|
||||
binary form) with the major components (compiler, kernel, and so on) of the
|
||||
operating system on which the executable runs, unless that component itself
|
||||
accompanies the executable. If distribution of executable or object code is made
|
||||
by offering access to copy from a designated place, then offering equivalent
|
||||
access to copy the source code from the same place counts as distribution of the
|
||||
source code, even though third parties are not compelled to copy the source
|
||||
along with the object code. 4. You may not copy, modify, sublicense, or
|
||||
distribute the Program except as expressly provided under this License. Any
|
||||
attempt otherwise to copy, modify, sublicense or distribute the Program is void,
|
||||
and will automatically terminate your rights under this License. However,
|
||||
parties who have received copies, or rights, from you under this License will
|
||||
not have their licenses terminated so long as such parties remain in full
|
||||
compliance. 5. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or distribute
|
||||
the Program or its derivative works. These actions are prohibited by law if you
|
||||
do not accept this License. Therefore, by modifying or distributing the Program
|
||||
(or any work based on the Program), you indicate your acceptance of this License
|
||||
to do so, and all its terms and conditions for copying, distributing or
|
||||
modifying the Program or works based on it. 6. Each time you redistribute the
|
||||
Program (or any work based on the Program), the recipient automatically receives
|
||||
a license from the original licensor to copy, distribute or modify the Program
|
||||
subject to these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein. You are
|
||||
not responsible for enforcing compliance by third parties to this License. 7.
|
||||
If, as a consequence of a court judgment or allegation of patent infringement or
|
||||
for any other reason (not limited to patent issues), conditions are imposed on
|
||||
you (whether by court order, agreement or otherwise) that contradict the
|
||||
conditions of this License, they do not excuse you from the conditions of this
|
||||
License. If you cannot distribute so as to satisfy simultaneously your
|
||||
obligations under this License and any other pertinent obligations, then as a
|
||||
consequence you may not distribute the Program at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Program by all those
|
||||
who receive copies directly or indirectly through you, then the only way you
|
||||
could satisfy both it and this License would be to refrain entirely from
|
||||
distribution of the Program. If any portion of this section is held invalid or
|
||||
unenforceable under any particular circumstance, the balance of the section is
|
||||
intended to apply and the section as a whole is intended to apply in other
|
||||
circumstances. It is not the purpose of this section to induce you to infringe
|
||||
any patents or other property right claims or to contest validity of any such
|
||||
claims; this section has the sole purpose of protecting the integrity of the
|
||||
free software distribution system, which is implemented by public license
|
||||
practices. Many people have made generous contributions to the wide range of
|
||||
software distributed through that system in reliance on consistent application
|
||||
of that system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot impose
|
||||
that choice. This section is intended to make thoroughly clear what is believed
|
||||
to be a consequence of the rest of this License. 8. If the distribution and/or
|
||||
use of the Program is restricted in certain countries either by patents or by
|
||||
copyrighted interfaces, the original copyright holder who places the Program
|
||||
under this License may add an explicit geographical distribution limitation
|
||||
excluding those countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates the
|
||||
limitation as if written in the body of this License. 9. The Free Software
|
||||
Foundation may publish revised and/or new versions of the General Public License
|
||||
from time to time. Such new versions will be similar in spirit to the present
|
||||
version, but may differ in detail to address new problems or concerns. Each
|
||||
version is given a distinguishing version number. If the Program specifies a
|
||||
version number of this License which applies to it and "any later version", you
|
||||
have the option of following the terms and conditions either of that version or
|
||||
of any later version published by the Free Software Foundation. If the Program
|
||||
does not specify a version number of this License, you may choose any version
|
||||
ever published by the Free Software Foundation. 10. If you wish to incorporate
|
||||
parts of the Program into other free programs whose distribution conditions are
|
||||
different, write to the author to ask for permission. For software which is
|
||||
copyrighted by the Free Software Foundation, write to the Free Software
|
||||
Foundation; we sometimes make exceptions for this. Our decision will be guided
|
||||
by the two goals of preserving the free status of all derivatives of our free
|
||||
software and of promoting the sharing and reuse of software generally. NO
|
||||
WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO
|
||||
WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE
|
||||
THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED,
|
||||
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND
|
||||
PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU
|
||||
ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO
|
||||
EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY
|
||||
COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE
|
||||
PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL,
|
||||
SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY
|
||||
TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
|
||||
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF
|
||||
THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER
|
||||
PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND
|
||||
CONDITIONS How to Apply These Terms to Your New Programs If you develop a new
|
||||
program, and you want it to be of the greatest possible use to the public, the
|
||||
best way to achieve this is to make it free software which everyone can
|
||||
redistribute and change under these terms. To do so, attach the following
|
||||
notices to the program. It is safest to attach them to the start of each source
|
||||
file to most effectively convey the exclusion of warranty; and each file should
|
||||
have at least the "copyright" line and a pointer to where the full notice is
|
||||
found. <one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C)
|
||||
<year>
|
||||
<name of author>
|
||||
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; either version 2 of the License, or (at your option)
|
||||
any later version. 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. You should have received a copy of the GNU
|
||||
General Public License along with this program; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
||||
USA Also add information on how to contact you by electronic and paper mail.
|
||||
If the program is interactive, make it output a short notice like this when
|
||||
it starts in an interactive mode: Gnomovision version 69, Copyright (C) year
|
||||
name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details
|
||||
type `show w'. This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details. The hypothetical
|
||||
commands `show w' and `show c' should show the appropriate parts of the
|
||||
General Public License. Of course, the commands you use may be called
|
||||
something other than `show w' and `show c'; they could even be mouse-clicks
|
||||
or menu items--whatever suits your program. You should also get your
|
||||
employer (if you work as a programmer) or your school, if any, to sign a
|
||||
"copyright disclaimer" for the program, if necessary. Here is a sample;
|
||||
alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in
|
||||
the program `Gnomovision' (which makes passes at compilers) written by James
|
||||
Hacker.
|
||||
|
||||
<signature of Ty Coon
|
||||
>, 1 April 1989 Ty Coon, President of Vice This General Public License
|
||||
does not permit incorporating your program into proprietary programs. If
|
||||
your program is a subroutine library, you may consider it more useful to
|
||||
permit linking proprietary applications with the library. If this is what
|
||||
you want to do, use the GNU Library General Public License instead of this
|
||||
License.
|
||||
</signature></name
|
||||
></year
|
||||
>
|
@ -0,0 +1 @@
|
||||
README
|
@ -0,0 +1,5 @@
|
||||
Welcome to Pandora FMS agent for MacOS installer. This will install Pandora FMS
|
||||
agent in the root disk of this system, specifically in:
|
||||
/usr/local/share/pandora_agent/ /etc/pandora/ It will also create an Uninstaller
|
||||
at your Applications folder. If you wish to perform a custom installation,
|
||||
please use the Linux tarball installer instead.
|
93
pandora_agents/unix/Darwin/dmg/scripts/postinstall
Normal file
93
pandora_agents/unix/Darwin/dmg/scripts/postinstall
Normal file
@ -0,0 +1,93 @@
|
||||
#!/usr/bin/env bash
|
||||
cd /usr/local/share/pandora_agent/
|
||||
|
||||
# Copy daemon file
|
||||
mv com.pandorafms.pandorafms.plist /Library/LaunchDaemons/
|
||||
|
||||
if [ -f /etc/pandora/pandora_agent.conf ]
|
||||
then
|
||||
# Stop the agent process
|
||||
`launchctl stop com.pandorafms.pandorafms`
|
||||
PFMSAGENT=`ps aux | grep pandora_agent | grep -v postinstall | grep -v grep | wc -l`
|
||||
if [ "$PFMSAGENT" -gt "0" ]
|
||||
then
|
||||
PIDAGENT=`ps aux | grep pandora_agent | grep -v postinstall | grep -v grep | awk '{print $2}'`
|
||||
kill $PIDAGENT
|
||||
fi
|
||||
else
|
||||
# Ask for user and password
|
||||
SERVER=`/usr/local/share/pandora_agent/inst_utilities/get_serverip.scpt`
|
||||
GROUP=`/usr/local/share/pandora_agent/inst_utilities/get_group.scpt`
|
||||
REMOTECFG=`/usr/local/share/pandora_agent/inst_utilities/get_remotecfg.scpt`
|
||||
|
||||
# Write the conf file
|
||||
`/usr/local/share/pandora_agent/inst_utilities/print_conf.pl /usr/local/share/pandora_agent/pandora_agent.conf server_ip $SERVER`
|
||||
`/usr/local/share/pandora_agent/inst_utilities/print_conf.pl /usr/local/share/pandora_agent/pandora_agent.conf group $GROUP`
|
||||
`/usr/local/share/pandora_agent/inst_utilities/print_conf.pl /usr/local/share/pandora_agent/pandora_agent.conf remote_config $REMOTECFG`
|
||||
|
||||
# Create agent directories and files
|
||||
mkdir -p /usr/local/bin/
|
||||
mkdir -p /usr/local/share/man/man1/
|
||||
mkdir -p /usr/local/share/pandora_agent/collections/
|
||||
mkdir -p /usr/local/share/pandora_agent/commands/
|
||||
mkdir -p /etc/pandora/
|
||||
mkdir -p /var/spool/pandora/data_out/
|
||||
mkdir -p /var/log/pandora/
|
||||
mv pandora_agent.conf /etc/pandora/
|
||||
touch /var/log/pandora/pandora_agent.log
|
||||
|
||||
# Setting permissions to directories and files
|
||||
chmod -R 700 /usr/local/share/pandora_agent/collections
|
||||
chmod -R 700 /usr/local/share/pandora_agent/commands
|
||||
chmod -R 755 /etc/pandora/
|
||||
chmod -R 700 /var/spool/pandora/data_out
|
||||
chmod -R 711 /var/log/pandora
|
||||
chmod 640 /var/log/pandora/pandora_agent.log
|
||||
chmod 640 /etc/pandora/pandora_agent.conf
|
||||
fi
|
||||
|
||||
# Copying agent utilities to /usr/local/bin and securing them
|
||||
cp -f pandora_agent /usr/local/bin/
|
||||
chmod 755 /usr/local/bin/pandora_agent
|
||||
chown root:wheel /usr/local/bin/pandora_agent
|
||||
|
||||
cp -f pandora_agent_exec /usr/local/bin/
|
||||
chmod 755 /usr/local/bin/pandora_agent_exec
|
||||
chown root:wheel /usr/local/bin/pandora_agent_exec
|
||||
|
||||
cp -f pandora_revent /usr/local/bin/
|
||||
chmod 755 /usr/local/bin/pandora_revent
|
||||
chown root:wheel /usr/local/bin/pandora_revent
|
||||
|
||||
# Copying tentacle_client to /usr/local/bin and securing it
|
||||
cp -f tentacle_client /usr/local/bin/
|
||||
chmod 755 /usr/local/bin/tentacle_client
|
||||
chown root:wheel /usr/local/bin/tentacle_client
|
||||
|
||||
|
||||
# Create symbolic links in /etc/pandora/
|
||||
ln -s /usr/local/share/pandora_agent/plugins /etc/pandora/plugins
|
||||
ln -s /usr/local/share/pandora_agent/commands /etc/pandora/commands
|
||||
ln -s /usr/local/share/pandora_agent/collections /etc/pandora/collections
|
||||
|
||||
|
||||
# Copy manuals
|
||||
cp -f man/man1/pandora_agent.1.gz /usr/local/share/man/man1/
|
||||
chmod 644 /usr/local/share/man/man1/pandora_agent.1.gz
|
||||
cp -f man/man1/tentacle_client.1.gz /usr/local/share/man/man1/
|
||||
chmod 644 /usr/local/share/man/man1/tentacle_client.1.gz
|
||||
|
||||
# Create newsyslog entry
|
||||
# logfilename [owner:group] mode count size(KB) when flags [/pid_file] [sig_num]
|
||||
echo "/var/log/pandora/pandora_agent.log : 640 5 2048 * Z" > /etc/newsyslog.d/pandora_agent.conf
|
||||
|
||||
# Install the daemon
|
||||
`launchctl load -wF /Library/LaunchDaemons/com.pandorafms.pandorafms.plist`
|
||||
|
||||
# Launch the daemon
|
||||
`launchctl start com.pandorafms.pandorafms`
|
||||
|
||||
# Clean all install utilites
|
||||
rm -Rf inst_utilities
|
||||
|
||||
exit 0
|
9
pandora_agents/unix/Darwin/dmg/scripts/preinstall
Normal file
9
pandora_agents/unix/Darwin/dmg/scripts/preinstall
Normal file
@ -0,0 +1,9 @@
|
||||
#!/bin/bash
|
||||
|
||||
#Save the existing configuration file
|
||||
#if [ -f /usr/local/share/pandora_agent/pandora_agent.conf ]
|
||||
#then
|
||||
# #mkdir -p /tmp/eh_restore
|
||||
# cp /usr/local/share/pandora_agent/pandora_agent.conf /usr/local/share/pandora_agent/pandora_agent.bak
|
||||
#fi
|
||||
exit 0
|
@ -1,5 +1,5 @@
|
||||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.749, GNU/Linux
|
||||
# Version 7.0NG.750, GNU/Linux
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2012 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
@ -129,6 +129,12 @@ transfer_mode tentacle
|
||||
# Proxy timeout (by default 1s)
|
||||
# proxy_timeout 1
|
||||
|
||||
# Address the proxy will listen on.
|
||||
#proxy_address 0.0.0.0
|
||||
|
||||
# Port the proxy will listen on.
|
||||
#proxy_port 41121
|
||||
|
||||
# Number of threads to execute modules in parallel
|
||||
#agent_threads 1
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.749, FreeBSD Version
|
||||
# Version 7.0NG.750, FreeBSD Version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2016 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
@ -142,6 +142,12 @@ remote_config 0
|
||||
# Proxy timeout (by default 1s)
|
||||
#proxy_timeout 1
|
||||
|
||||
# Address the proxy will listen on.
|
||||
#proxy_address 0.0.0.0
|
||||
|
||||
# Port the proxy will listen on.
|
||||
#proxy_port 41121
|
||||
|
||||
# Number of threads to execute modules in parallel
|
||||
#agent_threads 1
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.749, HP-UX Version
|
||||
# Version 7.0NG.750, HP-UX Version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
@ -101,6 +101,12 @@ transfer_mode tentacle
|
||||
# Proxy timeout (by default 1s)
|
||||
# proxy_timeout 1
|
||||
|
||||
# Address the proxy will listen on.
|
||||
#proxy_address 0.0.0.0
|
||||
|
||||
# Port the proxy will listen on.
|
||||
#proxy_port 41121
|
||||
|
||||
# User the agent will run as
|
||||
#pandora_user root
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.749, GNU/Linux
|
||||
# Version 7.0NG.750, GNU/Linux
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2014 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
@ -148,6 +148,12 @@ remote_config 0
|
||||
# Proxy timeout (by default 1s)
|
||||
# proxy_timeout 1
|
||||
|
||||
# Address the proxy will listen on.
|
||||
#proxy_address 0.0.0.0
|
||||
|
||||
# Port the proxy will listen on.
|
||||
#proxy_port 41121
|
||||
|
||||
# Number of threads to execute modules in parallel
|
||||
#agent_threads 1
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.749, GNU/Linux
|
||||
# Version 7.0NG.750, GNU/Linux
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.749, NetBSD Version
|
||||
# Version 7.0NG.750, NetBSD Version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2010 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
@ -110,6 +110,12 @@ transfer_mode tentacle
|
||||
# Proxy timeout (by default 1s)
|
||||
#proxy_timeout 1
|
||||
|
||||
# Address the proxy will listen on.
|
||||
#proxy_address 0.0.0.0
|
||||
|
||||
# Port the proxy will listen on.
|
||||
#proxy_port 41121
|
||||
|
||||
# Number of threads to execute modules in parallel
|
||||
#agent_threads 1
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.749, Solaris Version
|
||||
# Version 7.0NG.750, Solaris Version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
@ -104,6 +104,12 @@ transfer_mode tentacle
|
||||
# Proxy timeout (by default 1s)
|
||||
#proxy_timeout 1
|
||||
|
||||
# Address the proxy will listen on.
|
||||
#proxy_address 0.0.0.0
|
||||
|
||||
# Port the proxy will listen on.
|
||||
#proxy_port 41121
|
||||
|
||||
# User the agent will run as
|
||||
#pandora_user root
|
||||
|
||||
|
@ -33,17 +33,8 @@ use IO::Socket;
|
||||
use Sys::Syslog;
|
||||
use Time::Local;
|
||||
|
||||
my $YAML = 0;
|
||||
# Dynamic load. Avoid unwanted behaviour.
|
||||
eval {
|
||||
eval 'require YAML::Tiny;1' or die('YAML::Tiny lib not found, commands feature won\'t be available');
|
||||
};
|
||||
if ($@) {
|
||||
$YAML = 0;
|
||||
print STDERR $@;
|
||||
} else {
|
||||
$YAML = 1;
|
||||
}
|
||||
use lib '/usr/lib/perl5';
|
||||
use PandoraFMS::Omnishell;
|
||||
|
||||
# Agent XML data
|
||||
my $Xml;
|
||||
@ -54,8 +45,8 @@ my $Sem = undef;
|
||||
# Semaphore used to control the number of threads
|
||||
my $ThreadSem = undef;
|
||||
|
||||
use constant AGENT_VERSION => '7.0NG.749';
|
||||
use constant AGENT_BUILD => '200922';
|
||||
use constant AGENT_VERSION => '7.0NG.750';
|
||||
use constant AGENT_BUILD => '201201';
|
||||
|
||||
# Agent log default file size maximum and instances
|
||||
use constant DEFAULT_MAX_LOG_SIZE => 600000;
|
||||
@ -192,6 +183,8 @@ my %DefaultConf = (
|
||||
'udp_server_port' => 41122,
|
||||
'udp_server_auth_address' => '0.0.0.0',
|
||||
'udp_server' => 0,
|
||||
'proxy_address' => '0.0.0.0',
|
||||
'proxy_port' => 41121,
|
||||
'proxy_mode' => 0,
|
||||
'proxy_max_connection' => 10,
|
||||
'proxy_timeout' => 1,
|
||||
@ -283,20 +276,6 @@ sub error ($) {
|
||||
exit 1;
|
||||
}
|
||||
|
||||
################################################################################
|
||||
# Try to load extra libraries.c
|
||||
################################################################################
|
||||
sub load_libraries() {
|
||||
# Dynamic load. Avoid unwanted behaviour.
|
||||
eval {eval 'require YAML::Tiny;1' or die('YAML::Tiny lib not found, commands feature won\'t be available');};
|
||||
if ($@) {
|
||||
$YAML = 0;
|
||||
print STDERR $@;
|
||||
} else {
|
||||
$YAML = 1;
|
||||
}
|
||||
}
|
||||
|
||||
################################################################################
|
||||
# Erase blank spaces before and after the string
|
||||
################################################################################
|
||||
@ -1082,8 +1061,6 @@ sub fix_directory ($) {
|
||||
return $dir . $char;
|
||||
}
|
||||
|
||||
|
||||
|
||||
################################################################################
|
||||
# Sends a file to the server.
|
||||
################################################################################
|
||||
@ -1383,7 +1360,7 @@ sub launch_tentacle_proxy () {
|
||||
if ($tentacle_pid == 0) {
|
||||
|
||||
#Execute tentacle server as a daemon
|
||||
my $new_process = "tentacle_server -b ".$Conf{'server_ip'}." -g ".$Conf{'server_port'}." -c ".$Conf{'proxy_max_connection'}." -t ".$Conf{'proxy_timeout'};
|
||||
my $new_process = "tentacle_server -a ".$Conf{'proxy_address'}." -p ".$Conf{'proxy_port'}." -b ".$Conf{'server_ip'}." -g ".$Conf{'server_port'}." -c ".$Conf{'proxy_max_connection'}." -t ".$Conf{'proxy_timeout'};
|
||||
|
||||
$new_process .= ' -C' if ($Conf{'server_ssl'} eq '1');
|
||||
|
||||
@ -1486,336 +1463,6 @@ sub check_collections () {
|
||||
}
|
||||
}
|
||||
|
||||
################################################################################
|
||||
# Check for remote commands defined.
|
||||
################################################################################
|
||||
sub prepare_commands {
|
||||
if ($YAML == 0) {
|
||||
log_message(
|
||||
'error',
|
||||
'Cannot use commands without YAML dependency, please install it.'
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
# Force configuration file read.
|
||||
my @commands = read_config('cmd_file');
|
||||
|
||||
if (empty(\@commands)) {
|
||||
$Conf{'commands'} = {};
|
||||
} else {
|
||||
foreach my $rcmd (@commands) {
|
||||
$Conf{'commands'}->{trim($rcmd)} = {};
|
||||
}
|
||||
}
|
||||
|
||||
# Cleanup old commands. Not registered.
|
||||
cleanup_old_commands();
|
||||
|
||||
foreach my $ref (keys %{$Conf{'commands'}}) {
|
||||
my $file_content;
|
||||
my $download = 0;
|
||||
my $rcmd_file = $ConfDir.'/commands/'.$ref.'.rcmd';
|
||||
|
||||
# Check for local .rcmd.done files
|
||||
if (-e $rcmd_file.'.done') {
|
||||
# Ignore.
|
||||
delete $Conf{'commands'}->{$ref};
|
||||
next;
|
||||
}
|
||||
|
||||
# Search for local .rcmd file
|
||||
if (-e $rcmd_file) {
|
||||
my $remote_md5_file = $Conf{'temporal'}.'/'.$ref.'.md5';
|
||||
|
||||
$file_content = read_file($rcmd_file);
|
||||
if (recv_file($ref.'.md5', $remote_md5_file) != 0) {
|
||||
# Remote file could not be retrieved, skip.
|
||||
delete $Conf{'commands'}->{$ref};
|
||||
next;
|
||||
}
|
||||
|
||||
my $local_md5 = md5($file_content);
|
||||
my $remote_md5 = md5(read_file($remote_md5_file));
|
||||
|
||||
if ($local_md5 ne $remote_md5) {
|
||||
# Must be downloaded again.
|
||||
$download = 1;
|
||||
}
|
||||
} else {
|
||||
$download = 1;
|
||||
}
|
||||
|
||||
# Search for remote .rcmd file
|
||||
if ($download == 1) {
|
||||
# Download .rcmd file
|
||||
if (recv_file($ref.'.rcmd') != 0) {
|
||||
# Remote file could not be retrieved, skip.
|
||||
delete $Conf{'commands'}->{$ref};
|
||||
next;
|
||||
} else {
|
||||
# Success
|
||||
move($Conf{'temporal'}.'/'.$ref.'.rcmd', $rcmd_file);
|
||||
}
|
||||
}
|
||||
|
||||
# Parse and prepare in memory skel.
|
||||
eval {
|
||||
$Conf{'commands'}->{$ref} = YAML::Tiny->read($rcmd_file);
|
||||
};
|
||||
if ($@) {
|
||||
# Failed.
|
||||
log_message('error', 'Failed to decode command. ' . "\n".$@);
|
||||
delete $Conf{'commands'}->{$ref};
|
||||
next;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
################################################################################
|
||||
# Command report.
|
||||
################################################################################
|
||||
sub report_command {
|
||||
my ($ref, $err_level) = @_;
|
||||
|
||||
# Retrieve content from .stdout and .stderr
|
||||
my $stdout_file = $Conf{'temporal'}.'/'.$ref.'.stdout';
|
||||
my $stderr_file = $Conf{'temporal'}.'/'.$ref.'.stderr';
|
||||
|
||||
my $return;
|
||||
eval {
|
||||
$return = {
|
||||
'error_level' => $err_level,
|
||||
'stdout' => read_file($stdout_file),
|
||||
'stderr' => read_file($stderr_file),
|
||||
};
|
||||
|
||||
$return->{'name'} = $Conf{'commands'}->{$ref}->[0]->{'name'};
|
||||
};
|
||||
if ($@) {
|
||||
log_message('error', 'Failed to report command output. ' . $@);
|
||||
}
|
||||
|
||||
# Cleanup
|
||||
unlink($stdout_file) if (-e $stdout_file);
|
||||
unlink($stderr_file) if (-e $stderr_file);
|
||||
|
||||
# Mark command as done.
|
||||
open (my $R_FILE, '> '.$ConfDir.'/commands/'.$ref.'.rcmd.done');
|
||||
print $R_FILE $err_level;
|
||||
close($R_FILE);
|
||||
|
||||
|
||||
$return->{'stdout'} = '' unless defined ($return->{'stdout'});
|
||||
$return->{'stderr'} = '' unless defined ($return->{'stderr'});
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
################################################################################
|
||||
# Cleanup unreferenced rcmd and rcmd.done files.
|
||||
################################################################################
|
||||
sub cleanup_old_commands {
|
||||
# Cleanup old .rcmd and .rcmd.done files.
|
||||
my %registered = map { $_.'.rcmd' => 1 } keys %{$Conf{'commands'}};
|
||||
if(opendir(my $dir, $ConfDir.'/commands/')) {
|
||||
while (my $item = readdir($dir)) {
|
||||
|
||||
# Skip other files.
|
||||
next if ($item !~ /\.rcmd$/);
|
||||
|
||||
# Clean .rcmd.done file if its command is not referenced in conf.
|
||||
if (!defined($registered{$item})) {
|
||||
if (-e $ConfDir.'/commands/'.$item) {
|
||||
unlink($ConfDir.'/commands/'.$item);
|
||||
}
|
||||
if (-e $ConfDir.'/commands/'.$item.'.done') {
|
||||
unlink($ConfDir.'/commands/'.$item.'.done');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# Close dir.
|
||||
closedir($dir);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
################################################################################
|
||||
# Executes a command using defined timeout.
|
||||
################################################################################
|
||||
sub execute_command_timeout {
|
||||
my ($cmd, $timeout) = @_;
|
||||
|
||||
if (!defined($timeout)
|
||||
|| !looks_like_number($timeout)
|
||||
|| $timeout <= 0
|
||||
) {
|
||||
`$cmd`;
|
||||
return $?>>8;
|
||||
}
|
||||
|
||||
my $remaining_timeout = $timeout;
|
||||
|
||||
my $RET;
|
||||
my $output;
|
||||
|
||||
my $pid = open ($RET, "-|");
|
||||
if (!defined($pid)) {
|
||||
# Failed to fork.
|
||||
log_message('error', '[command] Failed to fork.');
|
||||
return undef;
|
||||
}
|
||||
if ($pid == 0) {
|
||||
# Child.
|
||||
my $ret;
|
||||
eval {
|
||||
local $SIG{ALRM} = sub { die "timeout\n" };
|
||||
alarm $timeout;
|
||||
`$cmd`;
|
||||
alarm 0;
|
||||
};
|
||||
|
||||
my $result = ($?>>8);
|
||||
return $result;
|
||||
|
||||
# Exit child.
|
||||
# Child finishes.
|
||||
exit;
|
||||
|
||||
} else {
|
||||
# Parent waiting.
|
||||
while( --$remaining_timeout > 0 ){
|
||||
if (wait == -1) {
|
||||
last;
|
||||
}
|
||||
# Wait child up to timeout seconds.
|
||||
sleep 1;
|
||||
}
|
||||
}
|
||||
|
||||
if ($remaining_timeout > 0) {
|
||||
# Retrieve output from child.
|
||||
$output = do { local $/; <$RET> };
|
||||
$output = $output>>8;
|
||||
}
|
||||
else {
|
||||
# Timeout expired.
|
||||
return 124;
|
||||
}
|
||||
|
||||
close($RET);
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
################################################################################
|
||||
# Executes a block of commands, returns error level, leaves output in
|
||||
# redirection set by $std_files. E.g:
|
||||
# $std_files = ' >> /tmp/stdout 2>> /tmp/stderr
|
||||
################################################################################
|
||||
sub execute_command_block {
|
||||
my ($commands, $std_files, $timeout, $retry) = @_;
|
||||
|
||||
return 0 unless defined($commands);
|
||||
|
||||
my $retries = $retry;
|
||||
|
||||
$retries = 1 unless looks_like_number($retries) && $retries > 0;
|
||||
|
||||
my $err_level = 0;
|
||||
$std_files = '' unless defined ($std_files);
|
||||
|
||||
if (ref($commands) ne "ARRAY") {
|
||||
return 0 if $commands eq '';
|
||||
|
||||
do {
|
||||
$err_level = execute_command_timeout(
|
||||
"($commands) $std_files",
|
||||
$timeout
|
||||
);
|
||||
|
||||
# Do not retry if success.
|
||||
last if looks_like_number($err_level) && $err_level == 0;
|
||||
} while ((--$retries) > 0);
|
||||
|
||||
} else {
|
||||
foreach my $comm (@{$commands}) {
|
||||
next unless defined($comm);
|
||||
$retries = $retry;
|
||||
$retries = 1 unless looks_like_number($retries) && $retries > 0;
|
||||
|
||||
do {
|
||||
$err_level = execute_command_timeout(
|
||||
"($comm) $std_files",
|
||||
$timeout
|
||||
);
|
||||
|
||||
# Do not retry if success.
|
||||
$retries = 0 if looks_like_number($err_level) && $err_level == 0;
|
||||
|
||||
} while ((--$retries) > 0);
|
||||
|
||||
# Do not continue evaluating block if failed.
|
||||
last unless ($err_level == 0);
|
||||
}
|
||||
}
|
||||
|
||||
return $err_level;
|
||||
}
|
||||
|
||||
################################################################################
|
||||
# Evalate given command.
|
||||
################################################################################
|
||||
sub evaluate_command {
|
||||
my ($ref) = @_;
|
||||
|
||||
# Not found.
|
||||
return unless defined $Conf{'commands'}->{$ref};
|
||||
|
||||
# Already completed.
|
||||
return if (-e $ConfDir.'/commands/'.$ref.'.rcmd.done');
|
||||
|
||||
# [0] because how library works.
|
||||
my $cmd = $Conf{'commands'}->{$ref}->[0];
|
||||
|
||||
my $std_files = ' >> '.$Conf{'temporal'}.'/'.$ref.'.stdout ';
|
||||
$std_files .= ' 2>> '.$Conf{'temporal'}.'/'.$ref.'.stderr ';
|
||||
|
||||
# Check preconditions
|
||||
my $err_level;
|
||||
|
||||
$err_level = execute_command_block(
|
||||
$cmd->{'preconditions'},
|
||||
$std_files,
|
||||
$cmd->{'timeout'}
|
||||
);
|
||||
|
||||
# Precondition not satisfied.
|
||||
return report_command($ref, $err_level) unless ($err_level == 0);
|
||||
|
||||
# Main run.
|
||||
$err_level = execute_command_block(
|
||||
$cmd->{'script'},
|
||||
$std_files,
|
||||
$cmd->{'timeout'}
|
||||
);
|
||||
|
||||
# Script not success.
|
||||
return report_command($ref, $err_level) unless ($err_level == 0);
|
||||
|
||||
# Check postconditions
|
||||
$err_level = execute_command_block(
|
||||
$cmd->{'postconditions'},
|
||||
$std_files,
|
||||
$cmd->{'timeout'}
|
||||
);
|
||||
|
||||
# Return results.
|
||||
return report_command($ref, $err_level);
|
||||
}
|
||||
|
||||
################################################################################
|
||||
# Sleep function
|
||||
################################################################################
|
||||
@ -3433,9 +3080,10 @@ my $main_agent = -1;
|
||||
# base time to start eatch iteration with the same interval.
|
||||
my $iter_base_time = time();
|
||||
$LogFileIdx = -1;
|
||||
|
||||
# Loop
|
||||
while (1) {
|
||||
load_libraries();
|
||||
my $omnishell;
|
||||
|
||||
if (-e $Conf{'logfile'} && (stat($Conf{'logfile'}))[7] > $Conf{'logsize'}) {
|
||||
rotate_log();
|
||||
@ -3451,8 +3099,18 @@ while (1) {
|
||||
# Check file collections
|
||||
check_collections () unless ($Conf{'debug'} eq '1');
|
||||
|
||||
# Check scheduled commands
|
||||
prepare_commands() unless ($Conf{'debug'} eq '1');
|
||||
eval {
|
||||
# Omnishell controller.
|
||||
$omnishell = new PandoraFMS::Omnishell(
|
||||
{
|
||||
%Conf,
|
||||
'ConfDir' => $ConfDir
|
||||
}
|
||||
);
|
||||
};
|
||||
if ($@) {
|
||||
log_message('error', "Omnishell process error: ".$@);
|
||||
}
|
||||
|
||||
# Launch broker agents
|
||||
@BrokerPid = ();
|
||||
@ -3585,18 +3243,22 @@ while (1) {
|
||||
|
||||
if (ref ($Conf{'commands'}) eq "HASH") {
|
||||
foreach my $command (keys %{$Conf{'commands'}}) {
|
||||
my $result = evaluate_command($command);
|
||||
if (ref($result) eq "HASH") {
|
||||
# Process command result.
|
||||
$Xml .= "<cmd_report>\n";
|
||||
$Xml .= " <cmd_response>\n";
|
||||
$Xml .= " <cmd_name><![CDATA[".$result->{'name'}."]]></cmd_name>\n";
|
||||
$Xml .= " <cmd_key><![CDATA[".$command."]]></cmd_key>\n";
|
||||
$Xml .= " <cmd_errorlevel><![CDATA[".$result->{'error_level'}."]]></cmd_errorlevel>\n";
|
||||
$Xml .= " <cmd_stdout><![CDATA[".$result->{'stdout'}."]]></cmd_stdout>\n";
|
||||
$Xml .= " <cmd_stderr><![CDATA[".$result->{'stderr'}."]]></cmd_stderr>\n";
|
||||
$Xml .= " </cmd_response>\n";
|
||||
$Xml .= "</cmd_report>\n";
|
||||
eval {
|
||||
if ($Conf{'debug'} eq '1') {
|
||||
log_message('debug', 'Running omnishell commmand ['.$command.']');
|
||||
}
|
||||
|
||||
my $output = $omnishell->runCommand($command, 'xml');
|
||||
if (!empty($output)) {
|
||||
$Xml .= $output;
|
||||
} else {
|
||||
if ($Conf{'debug'} eq '1') {
|
||||
log_message('error', 'Omnishell result: '.$omnishell->get_last_error());
|
||||
}
|
||||
}
|
||||
};
|
||||
if ($@) {
|
||||
log_message('error', 'Omnishell error: '.$@);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2,8 +2,8 @@
|
||||
#Pandora FMS Linux Agent
|
||||
#
|
||||
%define name pandorafms_agent_unix
|
||||
%define version 7.0NG.749
|
||||
%define release 200922
|
||||
%define version 7.0NG.750
|
||||
%define release 201201
|
||||
|
||||
Summary: Pandora FMS Linux agent, PERL version
|
||||
Name: %{name}
|
||||
@ -87,7 +87,7 @@ fi
|
||||
if [ ! -f /etc/pandora/pandora_agent.conf ] ; then
|
||||
ln -s /usr/share/pandora_agent/pandora_agent.conf /etc/pandora/pandora_agent.conf
|
||||
else
|
||||
ln -s /usr/share/pandora_agent/pandora_agent.conf.rpmnew /etc/pandora/pandora_agent.conf.rpmnew
|
||||
[[ ! -f /etc/pandora/pandora_agent.conf.rpmnew ]] && ln -s /usr/share/pandora_agent/pandora_agent.conf.rpmnew /etc/pandora/pandora_agent.conf.rpmnew
|
||||
fi
|
||||
|
||||
if [ ! -e /etc/pandora/plugins ]; then
|
||||
|
@ -2,8 +2,8 @@
|
||||
#Pandora FMS Linux Agent
|
||||
#
|
||||
%define name pandorafms_agent_unix
|
||||
%define version 7.0NG.749
|
||||
%define release 200922
|
||||
%define version 7.0NG.750
|
||||
%define release 201201
|
||||
|
||||
Summary: Pandora FMS Linux agent, PERL version
|
||||
Name: %{name}
|
||||
|
@ -9,15 +9,15 @@
|
||||
# Please see http://www.pandorafms.org. This code is licensed under GPL 2.0 license.
|
||||
# **********************************************************************
|
||||
|
||||
PI_VERSION="7.0NG.749"
|
||||
PI_BUILD="200922"
|
||||
PI_VERSION="7.0NG.750"
|
||||
PI_BUILD="201201"
|
||||
OS_NAME=`uname -s`
|
||||
|
||||
FORCE=0
|
||||
LOG_TIMESTAMP=`date +"%Y/%m/%d %H:%M:%S"`
|
||||
|
||||
PREFIX=/usr
|
||||
if [ "$OS_NAME" = "FreeBSD" ] || [ "$OS_NAME" = "NetBSD" ]
|
||||
if [ "$OS_NAME" = "FreeBSD" ] || [ "$OS_NAME" = "NetBSD" ] || [ "$OS_NAME" = "Darwin" ]
|
||||
then
|
||||
PREFIX=/usr/local
|
||||
fi
|
||||
@ -146,6 +146,7 @@ help () {
|
||||
uninstall () {
|
||||
if [ "$OS_NAME" = "Darwin" ]
|
||||
then
|
||||
launchctl stop com.pandorafms.pandorafms
|
||||
launchctl remove com.pandorafms.pandorafms
|
||||
rm /Library/LaunchDaemons/com.pandorafms.pandorafms.plist 2> /dev/null
|
||||
fi
|
||||
@ -162,6 +163,7 @@ uninstall () {
|
||||
rm -Rf $PANDORA_BASE$PANDORA_EXEC_BIN 2> /dev/null
|
||||
rm -Rf $PANDORA_BASE$PANDORA_REVENT_BIN 2> /dev/null
|
||||
rm -f $DESTDIR/etc/logrotate.d/pandora_agent
|
||||
rm -f $DESTDIR/etc/newsyslog.d/pandora_agent.conf
|
||||
|
||||
# Remove systemd service if exists
|
||||
if [ `systemctl --v 2> /dev/null | grep systemd | wc -l` != 0 ]
|
||||
@ -305,7 +307,7 @@ install () {
|
||||
# Backup the configuration file
|
||||
cp -f "$AGENT_CFG" "${AGENT_CFG}.bak"
|
||||
|
||||
if [ "$OS_NAME" = "FreeBSD" ] || [ "$OS_NAME" = "NetBSD" ]
|
||||
if [ "$OS_NAME" = "FreeBSD" ] || [ "$OS_NAME" = "NetBSD" ] || [ "$OS_NAME" = "Darwin" ]
|
||||
then
|
||||
sed -e "\|^PATH=|s|=|=$PANDORA_BASE$PREFIX/bin:|" \
|
||||
-e "s|/usr/local/etc/pandora|$PANDORA_BASE$PANDORA_CFG|g" \
|
||||
@ -503,12 +505,16 @@ install () {
|
||||
[ "$MSG" ] && echo "$MSG"
|
||||
fi
|
||||
|
||||
if [ -d /etc/logrotate.d ]
|
||||
if [ -d /etc/logrotate.d ] && [ "$OS_NAME" != "Darwin" ]
|
||||
then
|
||||
[ -d $DESTDIR/etc/logrotate.d ] && mkdir -p $DESTDIR/etc/logrotate.d
|
||||
echo "Creating logrotate.d entry for Pandora FMS log management"
|
||||
sed -e "s|^/var/log/pandora/pandora_agent.log|$PANDORA_BASE_REAL$PANDORA_LOG_DIR/$PANDORA_LOG|" pandora_agent_logrotate \
|
||||
> $DESTDIR/etc/logrotate.d/pandora_agent
|
||||
elif [ "$OS_NAME" = "Darwin" ]
|
||||
then
|
||||
echo "Creating newsyslog entry for Pandora FMS log management"
|
||||
echo "/var/log/pandora/pandora_agent.log : 640 5 2048 * Z" > $DESTDIR/etc/newsyslog.d/pandora_agent.conf
|
||||
else
|
||||
echo "Please add a log rotation schedule manually to your log rotation daemon (if any)"
|
||||
fi
|
||||
|
@ -1,6 +1,6 @@
|
||||
# Base config file for Pandora FMS Windows Agent
|
||||
# (c) 2006-2017 Artica Soluciones Tecnologicas
|
||||
# Version 7.0NG.749
|
||||
# Version 7.0NG.750
|
||||
|
||||
# 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
|
||||
@ -99,6 +99,12 @@ server_port 41121
|
||||
# Proxy timeout (by default 1s)
|
||||
# proxy_timeout 1
|
||||
|
||||
# Address the proxy will listen on.
|
||||
#proxy_address 0.0.0.0
|
||||
|
||||
# Port the proxy will listen on.
|
||||
#proxy_port 41121
|
||||
|
||||
# Enable or disable XML buffer.
|
||||
xml_buffer 1
|
||||
|
||||
|
BIN
pandora_agents/win32/bin/util/omnishell_client.exe
Executable file
BIN
pandora_agents/win32/bin/util/omnishell_client.exe
Executable file
Binary file not shown.
@ -3,7 +3,7 @@ AllowLanguageSelection
|
||||
{Yes}
|
||||
|
||||
AppName
|
||||
{Pandora FMS Windows Agent v7.0NG.749}
|
||||
{Pandora FMS Windows Agent v7.0NG.750}
|
||||
|
||||
ApplicationID
|
||||
{17E3D2CF-CA02-406B-8A80-9D31C17BD08F}
|
||||
@ -186,7 +186,7 @@ UpgradeApplicationID
|
||||
{}
|
||||
|
||||
Version
|
||||
{200922}
|
||||
{201201}
|
||||
|
||||
ViewReadme
|
||||
{Yes}
|
||||
|
93
pandora_agents/win32/omnishell/omnishell_client.pl
Normal file
93
pandora_agents/win32/omnishell/omnishell_client.pl
Normal 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;
|
@ -30,7 +30,7 @@ using namespace Pandora;
|
||||
using namespace Pandora_Strutils;
|
||||
|
||||
#define PATH_SIZE _MAX_PATH+1
|
||||
#define PANDORA_VERSION ("7.0NG.749(Build 200922)")
|
||||
#define PANDORA_VERSION ("7.0NG.750(Build 201201)")
|
||||
|
||||
string pandora_path;
|
||||
string pandora_dir;
|
||||
|
@ -424,7 +424,7 @@ Pandora_Windows_Service::killTentacleProxy() {
|
||||
int
|
||||
Pandora_Windows_Service::launchTentacleProxy() {
|
||||
string server_ip, server_port, proxy_max_connections, proxy_timeout, server_ssl;
|
||||
string proxy_cmd;
|
||||
string proxy_cmd, proxy_address, proxy_port;
|
||||
PROCESS_INFORMATION pi;
|
||||
STARTUPINFO si;
|
||||
|
||||
@ -460,7 +460,19 @@ Pandora_Windows_Service::launchTentacleProxy() {
|
||||
proxy_cmd = "tentacle_server.exe";
|
||||
}
|
||||
|
||||
proxy_cmd += " -b " + server_ip + " -g " + server_port + " -c " + proxy_max_connections + " -t " + proxy_timeout;
|
||||
// Proxy address.
|
||||
proxy_address = conf->getValue("proxy_address");
|
||||
if (proxy_address == "") {
|
||||
proxy_address = "0.0.0.0";
|
||||
}
|
||||
|
||||
// Proxy port.
|
||||
proxy_port = conf->getValue("proxy_port");
|
||||
if (proxy_port == "") {
|
||||
proxy_port = "41121";
|
||||
}
|
||||
|
||||
proxy_cmd += " -b " + server_ip + " -g " + server_port + " -c " + proxy_max_connections + " -t " + proxy_timeout + " -a " + proxy_address + " -p " + proxy_port;
|
||||
|
||||
ZeroMemory (&si, sizeof (si));
|
||||
ZeroMemory (&pi, sizeof (pi));
|
||||
@ -1692,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;
|
||||
@ -1773,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");
|
||||
@ -2006,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;
|
||||
@ -2043,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++;
|
||||
@ -2114,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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
|
@ -11,7 +11,7 @@ BEGIN
|
||||
VALUE "LegalCopyright", "Artica ST"
|
||||
VALUE "OriginalFilename", "PandoraAgent.exe"
|
||||
VALUE "ProductName", "Pandora FMS Windows Agent"
|
||||
VALUE "ProductVersion", "(7.0NG.749(Build 200922))"
|
||||
VALUE "ProductVersion", "(7.0NG.750(Build 201201))"
|
||||
VALUE "FileVersion", "1.0.0.0"
|
||||
END
|
||||
END
|
||||
|
@ -1,5 +1,5 @@
|
||||
package: pandorafms-console
|
||||
Version: 7.0NG.749-200922
|
||||
Version: 7.0NG.750-201201
|
||||
Architecture: all
|
||||
Priority: optional
|
||||
Section: admin
|
||||
|
@ -14,7 +14,7 @@
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
pandora_version="7.0NG.749-200922"
|
||||
pandora_version="7.0NG.750-201201"
|
||||
|
||||
package_pear=0
|
||||
package_pandora=1
|
||||
|
@ -1,649 +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 .= html_print_select_groups(false, 'AR', true, 'group_id', $group_id, false, '', '', true, false, true, '', false, 'margin-right: 10px; margin-top: 5px;');
|
||||
|
||||
$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, '…', 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>
|
||||
|
@ -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
|
||||
@ -389,8 +378,8 @@ function mainAgentsModules()
|
||||
$filter_groups_label = '<b>'.__('Group').'</b>';
|
||||
$filter_groups = html_print_select_groups(false, 'AR', true, 'group_id', $group_id, '', '', '', true, false, true, '', false, 'width: auto;');
|
||||
|
||||
$filter_recursion_label = '<b>'.__('Recursion').'</b>';
|
||||
$filter_recursion = html_print_checkbox('recursion', 1, 0, true);
|
||||
$filter_recursion_label = '</td><td><b>'.__('Recursion').'</b>';
|
||||
$filter_recursion = html_print_checkbox('recursion', 1, 0, true).'</td>';
|
||||
// Groups module.
|
||||
$filter_module_groups_label = '<b>'.__('Module group').'</b>';
|
||||
$filter_module_groups = html_print_select_from_sql(
|
||||
@ -668,7 +657,7 @@ function mainAgentsModules()
|
||||
if ($recursion) {
|
||||
$filter_groups['id_grupo'] = array_merge(
|
||||
$group_id,
|
||||
groups_get_id_recursive($group_id, true)
|
||||
groups_get_children_ids($group_id, true)
|
||||
);
|
||||
} else {
|
||||
$filter_groups['id_grupo'] = $group_id;
|
||||
@ -801,7 +790,7 @@ function mainAgentsModules()
|
||||
echo "<td style='text-align: center;'>";
|
||||
$win_handle = dechex(crc32($module_id.$module['name']));
|
||||
$graph_type = return_graphtype(modules_get_agentmodule_type($module_id));
|
||||
$link = "winopeng('".'operation/agentes/stat_win.php?'."type=$graph_type&".'period='.SECONDS_1DAY.'&'.'id='.$module_id.'&'.'refresh='.SECONDS_10MINUTES."', 'day_".$win_handle."')";
|
||||
$link = "winopeng_var('".'operation/agentes/stat_win.php?'."type=$graph_type&".'period='.SECONDS_1DAY.'&'.'id='.$module_id.'&'.'refresh='.SECONDS_10MINUTES."', 'day_".$win_handle."', 800, 480)";
|
||||
|
||||
echo '<a href="javascript:'.$link.'">';
|
||||
|
||||
|
@ -53,7 +53,28 @@ foreach ($groups as $id => $name) {
|
||||
|
||||
$row = [];
|
||||
$row[0] = __('Groups');
|
||||
$row[1] = html_print_select($groups, 'groups[]', $groups_selected, '', '', '', true, true, '', '', '');
|
||||
$row[1] = '<div class="w290px">'.html_print_select_groups(
|
||||
// Id_user.
|
||||
false,
|
||||
// Privilege.
|
||||
'AR',
|
||||
// ReturnAllGroup.
|
||||
true,
|
||||
// Name.
|
||||
'groups[]',
|
||||
// Selected.
|
||||
$groups_selected,
|
||||
// Script.
|
||||
'',
|
||||
// Nothing.
|
||||
'',
|
||||
// Nothing_value.
|
||||
0,
|
||||
// Return.
|
||||
true,
|
||||
// Multiple.
|
||||
true
|
||||
).'</div>';
|
||||
$table->data[] = $row;
|
||||
$table->colspan[][1] = 3;
|
||||
|
||||
|
@ -86,7 +86,6 @@ function mainModuleGroups()
|
||||
);
|
||||
$info = $tree_group->getArray();
|
||||
$info = groupview_plain_groups($info);
|
||||
$counter = count($info);
|
||||
$offset = get_parameter('offset', 0);
|
||||
$agent_group_search = get_parameter('agent_group_search', '');
|
||||
$module_group_search = get_parameter('module_group_search', '');
|
||||
@ -134,6 +133,8 @@ function mainModuleGroups()
|
||||
$ids_group = -1;
|
||||
}
|
||||
|
||||
$counter = count($info);
|
||||
|
||||
$condition_critical = modules_get_state_condition(AGENT_MODULE_STATUS_CRITICAL_ALERT);
|
||||
$condition_warning = modules_get_state_condition(AGENT_MODULE_STATUS_WARNING_ALERT);
|
||||
$condition_unknown = modules_get_state_condition(AGENT_MODULE_STATUS_UNKNOWN);
|
||||
|
@ -468,6 +468,7 @@ function quickShellSettings()
|
||||
100,
|
||||
true
|
||||
);
|
||||
$hidden->data[1][1] .= ui_print_reveal_password('gotty_pass', true);
|
||||
|
||||
html_print_table($t);
|
||||
|
||||
|
@ -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').' '.html_print_select($graph_fields, 'graph', $graph, '', '', 0, true);
|
||||
$data['graph'] = __('Graph').' ';
|
||||
$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').' '.html_print_select($refresh_fields, 'refresh', $refresh, '', '', 0, true);
|
||||
$data['refresh'] = __('Refresh interval').' ';
|
||||
$data['refresh'] .= html_print_select(
|
||||
$refresh_fields,
|
||||
'refresh',
|
||||
$refresh,
|
||||
'',
|
||||
'',
|
||||
0,
|
||||
true
|
||||
);
|
||||
if ($graph != 'snmp_module') {
|
||||
$data['incremental'] = __('Incremental').' '.html_print_checkbox('incremental', 1, 0, true);
|
||||
$data['incremental'] = __('Incremental').' ';
|
||||
$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').' '.html_print_input_text('ip_target', $snmp_address, '', 50, 255, true);
|
||||
$table->colspan[1]['snmp_address'] = 2;
|
||||
|
||||
$data['snmp_community'] = __('Community').' '.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').' '.html_print_input_text('snmp_oid', $snmp_oid, '', 100, 255, true);
|
||||
$table->colspan[2]['snmp_oid'] = 2;
|
||||
|
||||
$data['snmp_ver'] = __('Version').' '.html_print_select($snmp_versions, 'snmp_version', $snmp_ver, '', '', 0, true);
|
||||
$data['snmp_ver'] .= ' '.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(' <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(
|
||||
' <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;
|
||||
|
@ -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)) {
|
||||
|
@ -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;
|
||||
|
@ -92,7 +92,11 @@ function output_xml_report($id)
|
||||
|
||||
$group = db_get_value('nombre', 'tgrupo', 'id_grupo', $report['id_group']);
|
||||
echo '<group><![CDATA['.io_safe_output($group)."]]></group>\n";
|
||||
$items = db_get_all_rows_field_filter('treport_content', 'id_report', $report['id_report']);
|
||||
$items = db_get_all_rows_field_filter(
|
||||
'treport_content',
|
||||
'id_report',
|
||||
$report['id_report']
|
||||
);
|
||||
foreach ($items as $item) {
|
||||
echo "<item>\n";
|
||||
echo '<type>'.io_safe_output($item['type'])."</type>\n";
|
||||
|
@ -37,8 +37,16 @@ function insert_item_report($report_id, $values)
|
||||
|
||||
ui_print_result_message(
|
||||
$result,
|
||||
sprintf(__("Success add '%s' item in report '%s'."), $values['type'], $name),
|
||||
sprintf(__("Error create '%s' item in report '%s'."), $values['type'], $name)
|
||||
sprintf(
|
||||
__("Success add '%s' item in report '%s'."),
|
||||
$values['type'],
|
||||
$name
|
||||
),
|
||||
sprintf(
|
||||
__("Error create '%s' item in report '%s'."),
|
||||
$values['type'],
|
||||
$name
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -55,9 +63,12 @@ function process_upload_xml_report($xml, $group_filter=0)
|
||||
$posible_name = $values['name'];
|
||||
$exist = true;
|
||||
$loops = 30;
|
||||
// Loops to exit or tries
|
||||
// Loops to exit or tries.
|
||||
while ($exist && $loops > 0) {
|
||||
$exist = (bool) db_get_row_filter('treport', ['name' => io_safe_input($posible_name)]);
|
||||
$exist = (bool) db_get_row_filter(
|
||||
'treport',
|
||||
['name' => io_safe_input($posible_name)]
|
||||
);
|
||||
|
||||
if ($exist) {
|
||||
$loops--;
|
||||
@ -74,7 +85,7 @@ function process_upload_xml_report($xml, $group_filter=0)
|
||||
);
|
||||
break;
|
||||
} else if ($loops != 30) {
|
||||
ui_print_error_message(
|
||||
ui_print_warning_message(
|
||||
sprintf(
|
||||
__("Warning create '%s' report, the name exist, the report have a name %s."),
|
||||
$reportElement->name,
|
||||
@ -89,13 +100,22 @@ function process_upload_xml_report($xml, $group_filter=0)
|
||||
break;
|
||||
}
|
||||
|
||||
$id_group = db_get_value('id_grupo', 'tgrupo', 'nombre', $reportElement->group);
|
||||
if ($id_group === false) {
|
||||
ui_print_error_message(__("Error the report haven't group."));
|
||||
break;
|
||||
if (isset($reportElement->group) === true
|
||||
&& empty($reportElement->group) === false
|
||||
) {
|
||||
$id_group = db_get_value(
|
||||
'id_grupo',
|
||||
'tgrupo',
|
||||
'nombre',
|
||||
$reportElement->group
|
||||
);
|
||||
if ($id_group === false) {
|
||||
ui_print_error_message(__("Error the report haven't group."));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($reportElement->description)) {
|
||||
if (isset($reportElement->description) === true) {
|
||||
$values['description'] = $reportElement->description;
|
||||
}
|
||||
|
||||
@ -108,9 +128,19 @@ function process_upload_xml_report($xml, $group_filter=0)
|
||||
);
|
||||
|
||||
if ($id_report) {
|
||||
db_pandora_audit('Report management', 'Create report '.$id_report, false, false);
|
||||
db_pandora_audit(
|
||||
'Report management',
|
||||
'Create report '.$id_report,
|
||||
false,
|
||||
false
|
||||
);
|
||||
} else {
|
||||
db_pandora_audit('Report management', 'Fail to create report', false, false);
|
||||
db_pandora_audit(
|
||||
'Report management',
|
||||
'Fail to create report',
|
||||
false,
|
||||
false
|
||||
);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -119,45 +149,52 @@ function process_upload_xml_report($xml, $group_filter=0)
|
||||
|
||||
$values = [];
|
||||
$values['id_report'] = $id_report;
|
||||
if (isset($item['description'])) {
|
||||
if (isset($item['description']) === true) {
|
||||
$values['description'] = io_safe_input($item['description']);
|
||||
}
|
||||
|
||||
if (isset($item['period'])) {
|
||||
if (isset($item['period']) === true) {
|
||||
$values['period'] = io_safe_input($item['period']);
|
||||
}
|
||||
|
||||
if (isset($item['type'])) {
|
||||
if (isset($item['type']) === true) {
|
||||
$values['type'] = io_safe_input($item['type']);
|
||||
}
|
||||
|
||||
$agents_item = [];
|
||||
if (isset($item['agent'])) {
|
||||
if (isset($item['agent']) === true) {
|
||||
$agents = agents_get_agents(
|
||||
['id_grupo' => $group_filter],
|
||||
[
|
||||
'id_agente',
|
||||
'nombre',
|
||||
'alias',
|
||||
]
|
||||
);
|
||||
|
||||
$agent_clean = str_replace(['[', ']'], '', $item['agent']);
|
||||
$agent_clean = str_replace(
|
||||
[
|
||||
'[',
|
||||
']',
|
||||
],
|
||||
'',
|
||||
io_safe_output($item['agent'])
|
||||
);
|
||||
$regular_expresion = ($agent_clean != $item['agent']);
|
||||
|
||||
foreach ($agents as $agent) {
|
||||
if ($regular_expresion) {
|
||||
if ((bool) preg_match('/'.$agent_clean.'/', io_safe_output($agent['nombre']))) {
|
||||
$agents_item[$agent['id_agente']]['name'] = $agent['nombre'];
|
||||
if ((bool) preg_match('/'.$agent_clean.'/', io_safe_output($agent['alias']))) {
|
||||
$agents_item[$agent['id_agente']]['name'] = $agent['alias'];
|
||||
}
|
||||
} else {
|
||||
if ($agent_clean == io_safe_output($agent['nombre'])) {
|
||||
$agents_item[$agent['id_agente']]['name'] = $agent['nombre'];
|
||||
if ($agent_clean == io_safe_output($agent['alias'])) {
|
||||
$agents_item[$agent['id_agente']]['name'] = $agent['alias'];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($item['module'])) {
|
||||
if (isset($item['module']) === true) {
|
||||
$module_clean = str_replace(['[', ']'], '', $item['module']);
|
||||
$regular_expresion = ($module_clean != $item['module']);
|
||||
|
||||
|
36
pandora_console/extras/mr/42.sql
Normal file
36
pandora_console/extras/mr/42.sql
Normal file
@ -0,0 +1,36 @@
|
||||
START TRANSACTION;
|
||||
|
||||
ALTER TABLE tmetaconsole_event ADD INDEX `tme_timestamp_idx` (`timestamp`);
|
||||
ALTER TABLE tmetaconsole_event ADD INDEX `tme_module_status_idx` (`module_status`);
|
||||
ALTER TABLE tmetaconsole_event ADD INDEX `tme_criticity_idx` (`criticity`);
|
||||
ALTER TABLE tmetaconsole_event ADD INDEX `tme_agent_name_idx` (`agent_name`);
|
||||
|
||||
ALTER TABLE tmetaconsole_agent ADD INDEX `tma_id_os_idx` (`id_os`);
|
||||
ALTER TABLE tmetaconsole_agent ADD INDEX `tma_server_name_idx` (`server_name`);
|
||||
|
||||
ALTER TABLE tmetaconsole_event_history ADD INDEX `tmeh_estado_idx` (`estado`);
|
||||
ALTER TABLE tmetaconsole_event_history ADD INDEX `tmeh_timestamp_idx` (`timestamp`);
|
||||
|
||||
ALTER TABLE talert_actions ADD COLUMN `field16` TEXT NOT NULL DEFAULT "";
|
||||
ALTER TABLE talert_actions ADD COLUMN `field17` TEXT NOT NULL DEFAULT "";
|
||||
ALTER TABLE talert_actions ADD COLUMN `field18` TEXT NOT NULL DEFAULT "";
|
||||
ALTER TABLE talert_actions ADD COLUMN `field19` TEXT NOT NULL DEFAULT "";
|
||||
ALTER TABLE talert_actions ADD COLUMN `field20` TEXT NOT NULL DEFAULT "";
|
||||
ALTER TABLE talert_actions ADD COLUMN `field16_recovery` TEXT NOT NULL DEFAULT "";
|
||||
ALTER TABLE talert_actions ADD COLUMN `field17_recovery` TEXT NOT NULL DEFAULT "";
|
||||
ALTER TABLE talert_actions ADD COLUMN `field18_recovery` TEXT NOT NULL DEFAULT "";
|
||||
ALTER TABLE talert_actions ADD COLUMN `field19_recovery` TEXT NOT NULL DEFAULT "";
|
||||
ALTER TABLE talert_actions ADD COLUMN `field20_recovery` TEXT NOT NULL DEFAULT "";
|
||||
|
||||
ALTER TABLE `treport_content` add column `graph_render` tinyint(1) UNSIGNED NOT NULL default 0;
|
||||
ALTER TABLE `treport_content_template` add column `graph_render` tinyint(1) UNSIGNED NOT NULL default 0;
|
||||
|
||||
ALTER TABLE `treport` ADD COLUMN `cover_page_render` tinyint(1) NOT NULL DEFAULT 1;
|
||||
ALTER TABLE `treport` ADD COLUMN `index_render` tinyint(1) NOT NULL DEFAULT 1;
|
||||
|
||||
ALTER TABLE `treport_template` ADD COLUMN `cover_page_render` tinyint(1) NOT NULL DEFAULT 1;
|
||||
ALTER TABLE `treport_template` ADD COLUMN `index_render` tinyint(1) NOT NULL DEFAULT 1;
|
||||
|
||||
UPDATE `tconfig` SET value = '{"0.00000038580247":"Seconds to months","0.00000165343915":"Seconds to weeks","0.00001157407407":"Seconds to days","0.01666666666667":"Seconds to minutes","0.00000000093132":"Bytes to Gigabytes","0.00000095367432":"Bytes to Megabytes","0.00097656250000":"Bytes to Kilobytes","0.00000001653439":"Timeticks to weeks","0.00000011574074":"Timeticks to days"}' WHERE token = 'post_process_custom_values';
|
||||
|
||||
COMMIT;
|
9
pandora_console/extras/mr/43.sql
Normal file
9
pandora_console/extras/mr/43.sql
Normal file
@ -0,0 +1,9 @@
|
||||
START TRANSACTION;
|
||||
|
||||
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;
|
@ -770,7 +770,8 @@ CREATE TABLE IF NOT EXISTS `treport_template` (
|
||||
`custom_font` varchar(200) default NULL,
|
||||
`metaconsole` tinyint(1) DEFAULT 0,
|
||||
`agent_regex` varchar(600) NOT NULL default '',
|
||||
|
||||
`cover_page_render` tinyint(1) NOT NULL DEFAULT 1,
|
||||
`index_render` tinyint(1) NOT NULL DEFAULT 1,
|
||||
PRIMARY KEY(`id_report`)
|
||||
) ENGINE = InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
@ -849,7 +850,8 @@ ALTER TABLE `treport_content_template` MODIFY COLUMN `historical_db` tinyint(1)
|
||||
MODIFY COLUMN `visual_format` tinyint(1) unsigned NOT NULL DEFAULT '0';
|
||||
ALTER TABLE `treport_content_template` ADD COLUMN `landscape` tinyint(1) UNSIGNED NOT NULL default 0;
|
||||
ALTER TABLE `treport_content_template` ADD COLUMN `pagebreak` tinyint(1) UNSIGNED NOT NULL default 0;
|
||||
ALTER TABLE `treport_content_template` add column `compare_work_time` tinyint(1) UNSIGNED NOT NULL default 0;
|
||||
ALTER TABLE `treport_content_template` ADD COLUMN `compare_work_time` tinyint(1) UNSIGNED NOT NULL default 0;
|
||||
ALTER TABLE `treport_content_template` ADD COLUMN `graph_render` tinyint(1) UNSIGNED NOT NULL default 0;
|
||||
|
||||
-- ----------------------------------------------------------------------
|
||||
-- Table `tnews`
|
||||
@ -978,6 +980,10 @@ CREATE TABLE IF NOT EXISTS `tmetaconsole_event` (
|
||||
ALTER TABLE `tmetaconsole_event` ADD COLUMN `data` double(22,5) default NULL;
|
||||
ALTER TABLE `tmetaconsole_event` ADD COLUMN `module_status` int(4) NOT NULL default '0';
|
||||
ALTER TABLE `tmetaconsole_event` ADD INDEX `server_id` (`server_id`);
|
||||
ALTER TABLE `tmetaconsole_event` ADD INDEX `tme_timestamp_idx` (`timestamp`);
|
||||
ALTER TABLE `tmetaconsole_event` ADD INDEX `tme_module_status_idx` (`module_status`);
|
||||
ALTER TABLE `tmetaconsole_event` ADD INDEX `tme_criticity_idx` (`criticity`);
|
||||
ALTER TABLE `tmetaconsole_event` ADD INDEX `tme_agent_name_idx` (`agent_name`);
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Table `tmetaconsole_event_history`
|
||||
@ -1026,6 +1032,8 @@ CREATE TABLE IF NOT EXISTS `tmetaconsole_event_history` (
|
||||
|
||||
ALTER TABLE `tmetaconsole_event_history` ADD COLUMN `data` double(22,5) default NULL;
|
||||
ALTER TABLE `tmetaconsole_event_history` ADD COLUMN `module_status` int(4) NOT NULL default '0';
|
||||
ALTER TABLE `tmetaconsole_event_history` ADD INDEX `tmeh_estado_idx` (`estado`);
|
||||
ALTER TABLE `tmetaconsole_event_history` ADD INDEX `tmeh_timestamp_idx` (`timestamp`);
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Table `textension_translate_string`
|
||||
-- ---------------------------------------------------------------------
|
||||
@ -1119,7 +1127,9 @@ ALTER TABLE `tmetaconsole_agent` ADD COLUMN `remote` tinyint(1) NOT NULL DEFAULT
|
||||
ADD COLUMN `alias` varchar(600) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '',
|
||||
MODIFY COLUMN `update_secondary_groups` tinyint(1) NOT NULL DEFAULT '0',
|
||||
MODIFY COLUMN `alias_as_name` tinyint(2) NOT NULL DEFAULT '0',
|
||||
ADD INDEX `id_tagente_idx` (`id_tagente`);
|
||||
ADD INDEX `id_tagente_idx` (`id_tagente`),
|
||||
ADD INDEX `tma_id_os_idx` (`id_os`),
|
||||
ADD INDEX `tma_server_name_idx` (`server_name`);
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Table `ttransaction`
|
||||
@ -1246,11 +1256,16 @@ 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,
|
||||
@ -1258,6 +1273,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`
|
||||
-- ---------------------------------------------------------------------
|
||||
@ -1308,11 +1324,21 @@ ALTER TABLE talert_actions ADD COLUMN `field12` TEXT NOT NULL DEFAULT "";
|
||||
ALTER TABLE talert_actions ADD COLUMN `field13` TEXT NOT NULL DEFAULT "";
|
||||
ALTER TABLE talert_actions ADD COLUMN `field14` TEXT NOT NULL DEFAULT "";
|
||||
ALTER TABLE talert_actions ADD COLUMN `field15` TEXT NOT NULL DEFAULT "";
|
||||
ALTER TABLE talert_actions ADD COLUMN `field16` TEXT NOT NULL DEFAULT "";
|
||||
ALTER TABLE talert_actions ADD COLUMN `field17` TEXT NOT NULL DEFAULT "";
|
||||
ALTER TABLE talert_actions ADD COLUMN `field18` TEXT NOT NULL DEFAULT "";
|
||||
ALTER TABLE talert_actions ADD COLUMN `field19` TEXT NOT NULL DEFAULT "";
|
||||
ALTER TABLE talert_actions ADD COLUMN `field20` TEXT NOT NULL DEFAULT "";
|
||||
ALTER TABLE talert_actions ADD COLUMN `field11_recovery` TEXT NOT NULL DEFAULT "";
|
||||
ALTER TABLE talert_actions ADD COLUMN `field12_recovery` TEXT NOT NULL DEFAULT "";
|
||||
ALTER TABLE talert_actions ADD COLUMN `field13_recovery` TEXT NOT NULL DEFAULT "";
|
||||
ALTER TABLE talert_actions ADD COLUMN `field14_recovery` TEXT NOT NULL DEFAULT "";
|
||||
ALTER TABLE talert_actions ADD COLUMN `field15_recovery` TEXT NOT NULL DEFAULT "";
|
||||
ALTER TABLE talert_actions ADD COLUMN `field16_recovery` TEXT NOT NULL DEFAULT "";
|
||||
ALTER TABLE talert_actions ADD COLUMN `field17_recovery` TEXT NOT NULL DEFAULT "";
|
||||
ALTER TABLE talert_actions ADD COLUMN `field18_recovery` TEXT NOT NULL DEFAULT "";
|
||||
ALTER TABLE talert_actions ADD COLUMN `field19_recovery` TEXT NOT NULL DEFAULT "";
|
||||
ALTER TABLE talert_actions ADD COLUMN `field20_recovery` TEXT NOT NULL DEFAULT "";
|
||||
ALTER TABLE `talert_actions` ADD COLUMN `previous_name` text;
|
||||
|
||||
ALTER TABLE `talert_actions` MODIFY COLUMN `field11` text NOT NULL,
|
||||
@ -1352,13 +1378,13 @@ ALTER TABLE `ttag` ADD COLUMN `previous_name` text NULL;
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('big_operation_step_datos_purge', '100');
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('small_operation_step_datos_purge', '1000');
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('days_autodisable_deletion', '30');
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('MR', 41);
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('MR', 42);
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_docs_logo', 'default_docs.png');
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_support_logo', 'default_support.png');
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_logo_white_bg_preview', 'pandora_logo_head_white_bg.png');
|
||||
UPDATE tconfig SET value = 'https://licensing.artica.es/pandoraupdate7/server.php' WHERE token='url_update_manager';
|
||||
DELETE FROM `tconfig` WHERE `token` = 'current_package_enterprise';
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('current_package_enterprise', '749');
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('current_package_enterprise', 750);
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('status_monitor_fields', 'policy,agent,data_type,module_name,server_type,interval,status,graph,warn,data,timestamp');
|
||||
UPDATE `tconfig` SET `value` = 'mini_severity,evento,id_agente,estado,timestamp' WHERE `token` LIKE 'event_fields';
|
||||
DELETE FROM `tconfig` WHERE `token` LIKE 'integria_api_password';
|
||||
@ -1385,6 +1411,7 @@ INSERT INTO `tconfig` (`token`, `value`) VALUES ('cr_incident_type', '');
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('cr_incident_status', '');
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('cr_incident_title', '');
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('cr_incident_content', '');
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('post_process_custom_values', '{"0.00000038580247":"Seconds to months","0.00000165343915":"Seconds to weeks","0.00001157407407":"Seconds to days","0.01666666666667":"Seconds to minutes","0.00000000093132":"Bytes to Gigabytes","0.00000095367432":"Bytes to Megabytes","0.00097656250000":"Bytes to Kilobytes","0.00000001653439":"Timeticks to weeks","0.00000011574074":"Timeticks to days"}');
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Table `tconfig_os`
|
||||
@ -1674,7 +1701,8 @@ ALTER TABLE `treport_content` MODIFY COLUMN `historical_db` tinyint(1) unsigned
|
||||
MODIFY COLUMN `failover_type` tinyint(1) NULL DEFAULT '1';
|
||||
ALTER TABLE `treport_content` ADD COLUMN `landscape` tinyint(1) UNSIGNED NOT NULL default 0;
|
||||
ALTER TABLE `treport_content` ADD COLUMN `pagebreak` tinyint(1) UNSIGNED NOT NULL default 0;
|
||||
ALTER TABLE `treport_content` add column `compare_work_time` tinyint(1) UNSIGNED NOT NULL default 0;
|
||||
ALTER TABLE `treport_content` ADD COLUMN `compare_work_time` tinyint(1) UNSIGNED NOT NULL default 0;
|
||||
ALTER TABLE `treport_content` ADD COLUMN `graph_render` tinyint(1) UNSIGNED NOT NULL default 0;
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Table `tmodule_relationship`
|
||||
@ -2207,13 +2235,15 @@ INSERT INTO tlog_graph_models VALUES (6, 'Pages with warnings',
|
||||
INSERT INTO tlog_graph_models VALUES (7, 'Users login',
|
||||
'Starting Session \d+\ of user (.*)',
|
||||
'user', 0);
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Add column in table `treport`
|
||||
-- -----------------------------------------------------
|
||||
|
||||
ALTER TABLE `treport` ADD COLUMN `hidden` tinyint(1) NOT NULL DEFAULT 0;
|
||||
ALTER TABLE `treport` ADD COLUMN `orientation` varchar(25) NOT NULL default 'vertical';
|
||||
ALTER TABLE `treport` MODIFY COLUMN `hidden` tinyint(1) NULL DEFAULT '0' AFTER `non_interactive`;
|
||||
ALTER TABLE `treport` ADD COLUMN `cover_page_render` tinyint(1) NOT NULL DEFAULT 1;
|
||||
ALTER TABLE `treport` ADD COLUMN `index_render` tinyint(1) NOT NULL DEFAULT 1;
|
||||
|
||||
ALTER TABLE `trecon_task` ADD COLUMN `snmp_version` varchar(5) NOT NULL default '1';
|
||||
ALTER TABLE `trecon_task` ADD COLUMN `snmp_auth_user` varchar(255) NOT NULL default '';
|
||||
|
@ -114,6 +114,13 @@ 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();
|
||||
$support_logo = ui_get_support_logo();
|
||||
@ -450,7 +457,12 @@ if ($login_screen == 'logout') {
|
||||
echo '<div class="content_message_alert">';
|
||||
echo '<div class="text_message_alert">';
|
||||
echo '<h1>'.__('Logged out').'</h1>';
|
||||
echo '<p>'.__('Your session has ended. Please close your browser window to close this %s session.', get_product_name()).'</p>';
|
||||
if (empty($config['logout_msg']) === true) {
|
||||
echo '<p>'.__('Your session has ended. Please close your browser window to close this %s session.', get_product_name()).'</p>';
|
||||
} else {
|
||||
echo '<p>'.__($config['logout_msg']).'</p>';
|
||||
}
|
||||
|
||||
echo '</div>';
|
||||
echo '<div class="button_message_alert">';
|
||||
html_print_submit_button('Ok', 'hide-login-logout', false);
|
||||
|
@ -148,7 +148,8 @@ if ($initial && users_is_admin()) {
|
||||
config_wiz_modal(
|
||||
false,
|
||||
true,
|
||||
(($registration === true) ? 'show_registration_wizard()' : null)
|
||||
(($registration === true) ? 'show_registration_wizard()' : null),
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
@ -159,7 +160,8 @@ if (!$config['disabled_newsletter']) {
|
||||
false,
|
||||
// Launch only if not being launch from 'initial'.
|
||||
!$initial,
|
||||
(($show_newsletter === true) ? 'force_run_newsletter()' : null)
|
||||
(($show_newsletter === false) ? 'force_run_newsletter()' : null),
|
||||
true
|
||||
);
|
||||
} else {
|
||||
if ($show_newsletter) {
|
||||
@ -167,7 +169,8 @@ if (!$config['disabled_newsletter']) {
|
||||
newsletter_wiz_modal(
|
||||
false,
|
||||
// Launch only if not being call from 'registration'.
|
||||
!$registration && !$initial
|
||||
!$registration && !$initial,
|
||||
true
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -183,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;
|
||||
|
||||
?>
|
||||
|
@ -149,7 +149,7 @@ if (is_ajax()) {
|
||||
|
||||
ui_require_javascript_file('openlayers.pandora');
|
||||
|
||||
$new_agent = (bool) get_parameter('new_agent');
|
||||
$new_agent = (empty($id_agente)) ? true : false;
|
||||
|
||||
if (! isset($id_agente) && ! $new_agent) {
|
||||
db_pandora_audit('ACL Violation', 'Trying to access agent manager witout an agent');
|
||||
@ -258,7 +258,7 @@ if (!$new_agent && $alias != '') {
|
||||
$table_qr_code .= '<p class="input_label">'.__('QR Code Agent view').'</p>';
|
||||
$table_qr_code .= '<div id="qr_container_image"></div>';
|
||||
if ($id_agente) {
|
||||
$table_qr_code .= "<a id='qr_code_agent_view' href='javascript: show_dialog_qrcode(null, \"".ui_get_full_url('mobile/index.php?page=agent&id='.$id_agente)."\" );'></a>";
|
||||
$table_qr_code .= "<a id='qr_code_agent_view' href='".ui_get_full_url('mobile/index.php?page=agent&id='.$id_agente).");'></a>";
|
||||
}
|
||||
|
||||
// Add Custom id div.
|
||||
@ -322,7 +322,16 @@ $table_primary_group = '<div class="label_select"><p class="input_label">'.__('P
|
||||
$table_primary_group .= '<div class="label_select_parent">';
|
||||
// Cannot change primary group if user have not permission for that group.
|
||||
if (isset($groups[$grupo]) || $new_agent) {
|
||||
$table_primary_group .= html_print_select_groups(false, 'AR', false, 'grupo', $grupo, '', '', 0, true);
|
||||
$table_primary_group .= html_print_input(
|
||||
[
|
||||
'type' => 'select_groups',
|
||||
'returnAllGroup' => false,
|
||||
'name' => 'grupo',
|
||||
'selected' => $grupo,
|
||||
'return' => true,
|
||||
'required' => true,
|
||||
]
|
||||
);
|
||||
} else {
|
||||
$table_primary_group .= groups_get_name($grupo);
|
||||
$table_primary_group .= html_print_input_hidden('grupo', $grupo, true);
|
||||
@ -424,44 +433,66 @@ if (enterprise_installed()) {
|
||||
$secondary_groups_selected = enterprise_hook('agents_get_secondary_groups', [$id_agente]);
|
||||
$adv_secondary_groups_label = '<div class="label_select"><p class="input_label">'.__('Secondary groups').'</p></div>';
|
||||
$adv_secondary_groups_left = html_print_select_groups(
|
||||
false,
|
||||
// Id_user.
|
||||
// Use the current user to select the groups.
|
||||
'AR',
|
||||
// ACL permission.
|
||||
false,
|
||||
// Privilege.
|
||||
// ACL permission.
|
||||
'AR',
|
||||
// ReturnAllGroup.
|
||||
// Not all group.
|
||||
'secondary_groups',
|
||||
false,
|
||||
// Name.
|
||||
// HTML id.
|
||||
'',
|
||||
'secondary_groups',
|
||||
// Selected.
|
||||
// No select any by default.
|
||||
'',
|
||||
// Script.
|
||||
// Javascript onChange code.
|
||||
'',
|
||||
// Nothing.
|
||||
// Do not user no selected value.
|
||||
0,
|
||||
false,
|
||||
// Nothing_value.
|
||||
// Do not use no selected value.
|
||||
true,
|
||||
0,
|
||||
// Return.
|
||||
// Return HTML (not echo).
|
||||
true,
|
||||
// Multiple.
|
||||
// Multiple selection.
|
||||
true,
|
||||
// Sort.
|
||||
// Sorting by default.
|
||||
'',
|
||||
true,
|
||||
// Class.
|
||||
// CSS classnames (default).
|
||||
false,
|
||||
'',
|
||||
// Disabled.
|
||||
// Not disabled (default).
|
||||
'min-width:170px;',
|
||||
// Inline styles (default).
|
||||
false,
|
||||
// Style.
|
||||
// Inline styles (default).
|
||||
'min-width:170px;',
|
||||
// Option_style.
|
||||
// Option style select (default).
|
||||
false,
|
||||
// Id_group.
|
||||
// Do not truncate the users tree (default).
|
||||
'id_grupo',
|
||||
// Key to get as value (default).
|
||||
false,
|
||||
// Keys_field.
|
||||
// Key to get as value (default).
|
||||
'id_grupo',
|
||||
// Strict_user.
|
||||
// Not strict user (default).
|
||||
$secondary_groups_selected['plain']
|
||||
false,
|
||||
// Delete_groups.
|
||||
// Do not show the primary group in this selection.
|
||||
array_merge($secondary_groups_selected['plain'], [$agent['id_grupo']])
|
||||
// Include_groups.
|
||||
// Size.
|
||||
// Simple_multiple_options.
|
||||
);
|
||||
|
||||
$adv_secondary_groups_arrows = html_print_input_image(
|
||||
@ -489,30 +520,30 @@ if (enterprise_installed()) {
|
||||
);
|
||||
|
||||
$adv_secondary_groups_right .= html_print_select(
|
||||
$secondary_groups_selected['for_select'],
|
||||
// Values.
|
||||
'secondary_groups_selected',
|
||||
$secondary_groups_selected['for_select'],
|
||||
// HTML id.
|
||||
'',
|
||||
'secondary_groups_selected',
|
||||
// Selected.
|
||||
'',
|
||||
// Javascript onChange code.
|
||||
'',
|
||||
// Nothing selected.
|
||||
0,
|
||||
false,
|
||||
// Nothing selected.
|
||||
true,
|
||||
0,
|
||||
// Return HTML (not echo).
|
||||
true,
|
||||
// Multiple selection.
|
||||
true,
|
||||
// Sort.
|
||||
'',
|
||||
true,
|
||||
// Class.
|
||||
false,
|
||||
'',
|
||||
// Disabled.
|
||||
'min-width:170px;'
|
||||
false,
|
||||
// Style.
|
||||
'min-width:170px;'
|
||||
);
|
||||
|
||||
// Safe operation mode.
|
||||
@ -1191,6 +1222,7 @@ ui_require_jquery_file('bgiframe');
|
||||
|
||||
$(document).ready (function() {
|
||||
|
||||
var $id_agent = '<?php echo $id_agente; ?>';
|
||||
var previous_primary_group_select;
|
||||
$("#grupo").on('focus', function () {
|
||||
previous_primary_group_select = this.value;
|
||||
@ -1245,12 +1277,14 @@ ui_require_jquery_file('bgiframe');
|
||||
}
|
||||
});
|
||||
|
||||
paint_qrcode(
|
||||
"<?php echo ui_get_full_url('mobile/index.php?page=agent&id='.$id_agente); ?>",
|
||||
"#qr_code_agent_view",
|
||||
128,
|
||||
128
|
||||
);
|
||||
if (typeof $id_agent !== 'undefined' && $id_agent !== '0') {
|
||||
paint_qrcode(
|
||||
"<?php echo ui_get_full_url('mobile/index.php?page=agent&id='.$id_agente); ?>",
|
||||
"#qr_code_agent_view",
|
||||
128,
|
||||
128
|
||||
);
|
||||
}
|
||||
$("#text-agente").prop('readonly', true);
|
||||
|
||||
});
|
||||
|
@ -1115,7 +1115,7 @@ if ($update_agent) {
|
||||
ui_print_success_message(__('Successfully updated'));
|
||||
db_pandora_audit(
|
||||
'Agent management',
|
||||
'Updated agent '.$alias,
|
||||
'Updated agent '.io_safe_output($alias),
|
||||
false,
|
||||
false,
|
||||
$info
|
||||
@ -1650,7 +1650,7 @@ if ($update_module) {
|
||||
|
||||
db_pandora_audit(
|
||||
'Agent management',
|
||||
"Fail to try update module '".$name."' for agent ".$agent['alias']
|
||||
"Fail to try update module '".io_safe_output($name)."' for agent ".io_safe_output($agent['alias'])
|
||||
);
|
||||
} else {
|
||||
if ($prediction_module == 3) {
|
||||
@ -1674,7 +1674,7 @@ if ($update_module) {
|
||||
|
||||
db_pandora_audit(
|
||||
'Agent management',
|
||||
"Updated module '".$name."' for agent ".$agent['alias'],
|
||||
"Updated module '".io_safe_output($name)."' for agent ".io_safe_output($agent['alias']),
|
||||
false,
|
||||
false,
|
||||
io_json_mb_encode($values)
|
||||
@ -1834,7 +1834,7 @@ if ($create_module) {
|
||||
$moduletype = $id_module;
|
||||
db_pandora_audit(
|
||||
'Agent management',
|
||||
"Fail to try added module '".$name."' for agent ".$agent['alias']
|
||||
"Fail to try added module '".io_safe_output($name)."' for agent ".io_safe_output($agent['alias'])
|
||||
);
|
||||
} else {
|
||||
if ($prediction_module == 3) {
|
||||
@ -1859,7 +1859,7 @@ if ($create_module) {
|
||||
$agent = db_get_row('tagente', 'id_agente', $id_agente);
|
||||
db_pandora_audit(
|
||||
'Agent management',
|
||||
"Added module '".$name."' for agent ".$agent['alias'],
|
||||
"Added module '".io_safe_output($name)."' for agent ".io_safe_output($agent['alias']),
|
||||
false,
|
||||
true,
|
||||
io_json_mb_encode($values)
|
||||
@ -1894,12 +1894,12 @@ if ($enable_module) {
|
||||
if ($result === NOERR) {
|
||||
db_pandora_audit(
|
||||
'Module management',
|
||||
'Enable #'.$enable_module.' | '.$module_name.' | '.$agent['alias']
|
||||
'Enable #'.$enable_module.' | '.$module_name.' | '.io_safe_output($agent['alias'])
|
||||
);
|
||||
} else {
|
||||
db_pandora_audit(
|
||||
'Module management',
|
||||
'Fail to enable #'.$enable_module.' | '.$module_name.' | '.$agent['alias']
|
||||
'Fail to enable #'.$enable_module.' | '.$module_name.' | '.io_safe_output($agent['alias'])
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -1929,12 +1929,12 @@ if ($disable_module) {
|
||||
if ($result === NOERR) {
|
||||
db_pandora_audit(
|
||||
'Module management',
|
||||
'Disable #'.$disable_module.' | '.$module_name.' | '.$agent['alias']
|
||||
'Disable #'.$disable_module.' | '.$module_name.' | '.io_safe_output($agent['alias'])
|
||||
);
|
||||
} else {
|
||||
db_pandora_audit(
|
||||
'Module management',
|
||||
'Fail to disable #'.$disable_module.' | '.$module_name.' | '.$agent['alias']
|
||||
'Fail to disable #'.$disable_module.' | '.$module_name.' | '.io_safe_output($agent['alias'])
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -2108,7 +2108,7 @@ if ($delete_module) {
|
||||
$agent = db_get_row('tagente', 'id_agente', $id_agente);
|
||||
db_pandora_audit(
|
||||
'Agent management',
|
||||
"Deleted module '".$module_data['nombre']."' for agent ".$agent['alias']
|
||||
"Deleted module '".io_safe_output($module_data['nombre'])."' for agent ".io_safe_output($agent['alias'])
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -2163,7 +2163,7 @@ if (!empty($duplicate_module)) {
|
||||
if ($enable_module) {
|
||||
$result = modules_change_disabled($enable_module, 0);
|
||||
$modulo_nombre = db_get_row_sql('SELECT nombre FROM tagente_modulo WHERE id_agente_modulo = '.$enable_module.'');
|
||||
$modulo_nombre = $modulo_nombre['nombre'];
|
||||
$modulo_nombre = io_safe_output($modulo_nombre['nombre']);
|
||||
|
||||
if ($result === NOERR) {
|
||||
enterprise_hook('config_agents_enable_module_conf', [$id_agente, $enable_module]);
|
||||
@ -2182,7 +2182,7 @@ if ($enable_module) {
|
||||
if ($disable_module) {
|
||||
$result = modules_change_disabled($disable_module, 1);
|
||||
$modulo_nombre = db_get_row_sql('SELECT nombre FROM tagente_modulo WHERE id_agente_modulo = '.$disable_module.'');
|
||||
$modulo_nombre = $modulo_nombre['nombre'];
|
||||
$modulo_nombre = io_safe_output($modulo_nombre['nombre']);
|
||||
|
||||
if ($result === NOERR) {
|
||||
enterprise_hook('config_agents_disable_module_conf', [$id_agente, $disable_module]);
|
||||
|
@ -115,7 +115,7 @@ if ($agent_to_delete) {
|
||||
|
||||
if ($enable_agent) {
|
||||
$result = db_process_sql_update('tagente', ['disabled' => 0], ['id_agente' => $enable_agent]);
|
||||
$alias = agents_get_alias($enable_agent);
|
||||
$alias = io_safe_output(agents_get_alias($enable_agent));
|
||||
|
||||
if ($result) {
|
||||
// Update the agent from the metaconsole cache.
|
||||
@ -137,7 +137,7 @@ if ($enable_agent) {
|
||||
|
||||
if ($disable_agent) {
|
||||
$result = db_process_sql_update('tagente', ['disabled' => 1], ['id_agente' => $disable_agent]);
|
||||
$alias = agents_get_alias($disable_agent);
|
||||
$alias = io_safe_output(agents_get_alias($disable_agent));
|
||||
|
||||
if ($result) {
|
||||
// Update the agent from the metaconsole cache.
|
||||
@ -173,8 +173,9 @@ if (!$own_info['is_admin'] && !check_acl($config['id_user'], 0, 'AR') && !check_
|
||||
$return_all_group = true;
|
||||
}
|
||||
|
||||
echo '<div class="w250px inline">';
|
||||
html_print_select_groups(false, 'AR', $return_all_group, 'ag_group', $ag_group, 'this.form.submit();', '', 0, false, false, true, '', false);
|
||||
|
||||
echo '</div>';
|
||||
echo '<td>';
|
||||
echo __('Show Agents').' ';
|
||||
$fields = [
|
||||
@ -407,7 +408,7 @@ if ($ag_group > 0) {
|
||||
$ag_groups = [];
|
||||
$ag_groups = (array) $ag_group;
|
||||
if ($recursion) {
|
||||
$ag_groups = groups_get_id_recursive($ag_group, true);
|
||||
$ag_groups = groups_get_children_ids($ag_group, true);
|
||||
}
|
||||
|
||||
$user_groups_to_sql = implode(',', $ag_groups);
|
||||
@ -753,7 +754,6 @@ if (check_acl($config['id_user'], 0, 'AW')) {
|
||||
// Create agent button.
|
||||
echo '<div style="text-align: right;">';
|
||||
echo '<form method="post" action="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente">';
|
||||
html_print_input_hidden('new_agent', 1);
|
||||
html_print_submit_button(
|
||||
__('Create agent'),
|
||||
'crt-2',
|
||||
|
@ -382,7 +382,7 @@ if ($disabledBecauseInPolicy) {
|
||||
);
|
||||
}
|
||||
|
||||
$table_simple->data[2][0] = __('Warning status');
|
||||
$table_simple->data[2][0] = __('Warning threshold');
|
||||
if (!modules_is_string_type($id_module_type) || $edit) {
|
||||
$table_simple->data[2][1] .= '<span id="minmax_warning"><em>'.__('Min. ').'</em>';
|
||||
$table_simple->data[2][1] .= html_print_input_text(
|
||||
@ -435,7 +435,7 @@ if (!modules_is_string_type($id_module_type) || $edit) {
|
||||
$table_simple->data[2][2] = '<svg id="svg_dinamic" width="500" height="300"> </svg>';
|
||||
}
|
||||
|
||||
$table_simple->data[3][0] = __('Critical status');
|
||||
$table_simple->data[3][0] = __('Critical threshold');
|
||||
if (!modules_is_string_type($id_module_type) || $edit) {
|
||||
$table_simple->data[3][1] .= '<span id="minmax_critical"><em>'.__('Min. ').'</em>';
|
||||
$table_simple->data[3][1] .= html_print_input_text(
|
||||
@ -528,27 +528,37 @@ $table_advanced->data[0][1] = html_print_input_text(
|
||||
20,
|
||||
65,
|
||||
true,
|
||||
(($config['module_custom_id_ro'] && $__code_from != 'policies') ? true : $disabledBecauseInPolicy),
|
||||
false,
|
||||
'',
|
||||
(($config['module_custom_id_ro'] && $__code_from != 'policies') ? 'readonly' : $classdisabledBecauseInPolicy)
|
||||
);
|
||||
|
||||
$table_advanced->data[0][3] = __('Unit');
|
||||
$table_advanced->data[0][4] = html_print_input_text(
|
||||
'unit',
|
||||
$unit,
|
||||
'',
|
||||
20,
|
||||
65,
|
||||
true,
|
||||
$disabledBecauseInPolicy,
|
||||
false,
|
||||
'',
|
||||
$classdisabledBecauseInPolicy
|
||||
);
|
||||
|
||||
$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(
|
||||
'unit',
|
||||
$unit,
|
||||
'',
|
||||
'',
|
||||
'0',
|
||||
false,
|
||||
true,
|
||||
false,
|
||||
false
|
||||
);
|
||||
// $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;
|
||||
@ -1340,115 +1350,117 @@ $(document).ready (function () {
|
||||
var type_name_selected = type_names[type_selected];
|
||||
var element = document.getElementById("module_type_help");
|
||||
var language = "<?php echo $config['language']; ?>" ;
|
||||
element.onclick = function (event) {
|
||||
if(type_name_selected == 'async_data' ||
|
||||
type_name_selected == 'async_proc' ||
|
||||
type_name_selected == 'async_string' ||
|
||||
type_name_selected == 'generic_proc'||
|
||||
type_name_selected == 'generic_data' ||
|
||||
type_name_selected == 'generic_data_inc' ||
|
||||
type_name_selected == 'generic_data_inc_abs'||
|
||||
type_name_selected == 'generic_data_string' ||
|
||||
type_name_selected == 'keep_alive'
|
||||
){
|
||||
if (language == 'es'){
|
||||
window.open(
|
||||
'https://wiki.pandorafms.com/index.php?title=Pandora:Documentation_es:Operacion&printable=yes#Tipos_de_m.C3.B3dulos',
|
||||
'_blank',
|
||||
'width=800,height=600'
|
||||
);
|
||||
}
|
||||
else{
|
||||
window.open(
|
||||
'https://wiki.pandorafms.com/index.php?title=Pandora:Documentation_en:Operations&printable=yes#Types_of_Modules',
|
||||
'_blank',
|
||||
'width=800,height=600'
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
if(type_name_selected == 'remote_icmp' ||
|
||||
type_name_selected == 'remote_icmp_proc'
|
||||
){
|
||||
if(language == 'es'){
|
||||
window.open(
|
||||
'https://wiki.pandorafms.com/index.php?title=Pandora:Documentation_es:Monitorizacion_remota&printable=yes#Monitorizaci.C3.B3n_ICMP',
|
||||
'_blank',
|
||||
'width=800,height=600'
|
||||
);
|
||||
}
|
||||
else{
|
||||
window.open(
|
||||
'https://wiki.pandorafms.com/index.php?title=Pandora:Documentation_en:Remote_Monitoring&printable=yes#ICMP_Monitoring',
|
||||
'_blank',
|
||||
'width=800,height=600'
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
if(type_name_selected == 'remote_snmp_string' ||
|
||||
type_name_selected == 'remote_snmp_proc' ||
|
||||
type_name_selected == 'remote_snmp_inc' ||
|
||||
type_name_selected == 'remote_snmp'
|
||||
){
|
||||
if(language == 'es'){
|
||||
window.open(
|
||||
'https://wiki.pandorafms.com/index.php?title=Pandora:Documentation_es:Monitorizacion_remota&printable=yes#Monitorizando_con_m.C3.B3dulos_de_red_tipo_SNMP',
|
||||
'_blank',
|
||||
'width=800,height=600'
|
||||
);
|
||||
}
|
||||
else{
|
||||
window.open(
|
||||
'https://wiki.pandorafms.com/index.php?title=Pandora:Documentation_en:Remote_Monitoring&printable=yes#Monitoring_by_Network_Modules_with_SNMP',
|
||||
'_blank',
|
||||
'width=800,height=600'
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
if(type_name_selected == 'remote_tcp_string' ||
|
||||
type_name_selected == 'remote_tcp_proc' ||
|
||||
type_name_selected == 'remote_tcp_inc' ||
|
||||
type_name_selected == 'remote_tcp'
|
||||
){
|
||||
if(language == 'es'){
|
||||
window.open(
|
||||
'https://wiki.pandorafms.com/index.php?title=Pandora:Documentation_es:Monitorizacion_remota&printable=yes#Monitorizaci.C3.B3n_TCP',
|
||||
'_blank',
|
||||
'width=800,height=600'
|
||||
);
|
||||
if (typeof element !== 'undefined' && element !== null) {
|
||||
element.onclick = function (event) {
|
||||
if(type_name_selected == 'async_data' ||
|
||||
type_name_selected == 'async_proc' ||
|
||||
type_name_selected == 'async_string' ||
|
||||
type_name_selected == 'generic_proc'||
|
||||
type_name_selected == 'generic_data' ||
|
||||
type_name_selected == 'generic_data_inc' ||
|
||||
type_name_selected == 'generic_data_inc_abs'||
|
||||
type_name_selected == 'generic_data_string' ||
|
||||
type_name_selected == 'keep_alive'
|
||||
){
|
||||
if (language == 'es'){
|
||||
window.open(
|
||||
'https://wiki.pandorafms.com/index.php?title=Pandora:Documentation_es:Operacion&printable=yes#Tipos_de_m.C3.B3dulos',
|
||||
'_blank',
|
||||
'width=800,height=600'
|
||||
);
|
||||
}
|
||||
else{
|
||||
window.open(
|
||||
'https://wiki.pandorafms.com/index.php?title=Pandora:Documentation_en:Remote_Monitoring&printable=yes#TCP_Monitoring',
|
||||
'_blank',
|
||||
'width=800,height=600'
|
||||
);
|
||||
}
|
||||
}
|
||||
if(type_name_selected == 'web_data' ||
|
||||
type_name_selected == 'web_proc' ||
|
||||
type_name_selected == 'web_content_data' ||
|
||||
type_name_selected == 'web_content_string'
|
||||
){
|
||||
if(language == 'es'){
|
||||
window.open(
|
||||
'https://wiki.pandorafms.com/index.php?title=Pandora:Documentation_es:Monitorizacion_web&printable=yes#Creaci.C3.B3n_de_m.C3.B3dulos_web',
|
||||
'_blank',
|
||||
'width=800,height=600'
|
||||
);
|
||||
}
|
||||
else{
|
||||
window.open(
|
||||
'https://wiki.pandorafms.com/index.php?title=Pandora:Documentation_en:Web_Monitoring&printable=yes#Creating_Web_Modules',
|
||||
'_blank',
|
||||
'width=800,height=600'
|
||||
);
|
||||
'https://wiki.pandorafms.com/index.php?title=Pandora:Documentation_en:Operations&printable=yes#Types_of_Modules',
|
||||
'_blank',
|
||||
'width=800,height=600'
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
if(type_name_selected == 'remote_icmp' ||
|
||||
type_name_selected == 'remote_icmp_proc'
|
||||
){
|
||||
if(language == 'es'){
|
||||
window.open(
|
||||
'https://wiki.pandorafms.com/index.php?title=Pandora:Documentation_es:Monitorizacion_remota&printable=yes#Monitorizaci.C3.B3n_ICMP',
|
||||
'_blank',
|
||||
'width=800,height=600'
|
||||
);
|
||||
}
|
||||
else{
|
||||
window.open(
|
||||
'https://wiki.pandorafms.com/index.php?title=Pandora:Documentation_en:Remote_Monitoring&printable=yes#ICMP_Monitoring',
|
||||
'_blank',
|
||||
'width=800,height=600'
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
if(type_name_selected == 'remote_snmp_string' ||
|
||||
type_name_selected == 'remote_snmp_proc' ||
|
||||
type_name_selected == 'remote_snmp_inc' ||
|
||||
type_name_selected == 'remote_snmp'
|
||||
){
|
||||
if(language == 'es'){
|
||||
window.open(
|
||||
'https://wiki.pandorafms.com/index.php?title=Pandora:Documentation_es:Monitorizacion_remota&printable=yes#Monitorizando_con_m.C3.B3dulos_de_red_tipo_SNMP',
|
||||
'_blank',
|
||||
'width=800,height=600'
|
||||
);
|
||||
}
|
||||
else{
|
||||
window.open(
|
||||
'https://wiki.pandorafms.com/index.php?title=Pandora:Documentation_en:Remote_Monitoring&printable=yes#Monitoring_by_Network_Modules_with_SNMP',
|
||||
'_blank',
|
||||
'width=800,height=600'
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
if(type_name_selected == 'remote_tcp_string' ||
|
||||
type_name_selected == 'remote_tcp_proc' ||
|
||||
type_name_selected == 'remote_tcp_inc' ||
|
||||
type_name_selected == 'remote_tcp'
|
||||
){
|
||||
if(language == 'es'){
|
||||
window.open(
|
||||
'https://wiki.pandorafms.com/index.php?title=Pandora:Documentation_es:Monitorizacion_remota&printable=yes#Monitorizaci.C3.B3n_TCP',
|
||||
'_blank',
|
||||
'width=800,height=600'
|
||||
);
|
||||
}
|
||||
else{
|
||||
window.open(
|
||||
'https://wiki.pandorafms.com/index.php?title=Pandora:Documentation_en:Remote_Monitoring&printable=yes#TCP_Monitoring',
|
||||
'_blank',
|
||||
'width=800,height=600'
|
||||
);
|
||||
}
|
||||
}
|
||||
if(type_name_selected == 'web_data' ||
|
||||
type_name_selected == 'web_proc' ||
|
||||
type_name_selected == 'web_content_data' ||
|
||||
type_name_selected == 'web_content_string'
|
||||
){
|
||||
if(language == 'es'){
|
||||
window.open(
|
||||
'https://wiki.pandorafms.com/index.php?title=Pandora:Documentation_es:Monitorizacion_web&printable=yes#Creaci.C3.B3n_de_m.C3.B3dulos_web',
|
||||
'_blank',
|
||||
'width=800,height=600'
|
||||
);
|
||||
}
|
||||
else{
|
||||
window.open(
|
||||
'https://wiki.pandorafms.com/index.php?title=Pandora:Documentation_en:Web_Monitoring&printable=yes#Creating_Web_Modules',
|
||||
'_blank',
|
||||
'width=800,height=600'
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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')
|
||||
@ -645,7 +645,7 @@ $table->data[0][1] = html_print_input_text(
|
||||
$disabled_in_execution
|
||||
);
|
||||
$table->data[1][0] = __('Group');
|
||||
$table->data[1][1] = html_print_select_groups(
|
||||
$table->data[1][1] = '<div class="w250px">'.html_print_select_groups(
|
||||
false,
|
||||
$access,
|
||||
true,
|
||||
@ -659,7 +659,7 @@ $table->data[1][1] = html_print_select_groups(
|
||||
true,
|
||||
'',
|
||||
$disabled_in_execution
|
||||
);
|
||||
).'</div>';
|
||||
$table->data[2][0] = __('Description');
|
||||
$table->data[2][1] = html_print_textarea(
|
||||
'description',
|
||||
@ -877,7 +877,7 @@ if ($id_downtime > 0) {
|
||||
$filter_cond = '';
|
||||
if ($filter_group > 0) {
|
||||
if ($recursion) {
|
||||
$rg = groups_get_id_recursive($filter_group, true);
|
||||
$rg = groups_get_children_ids($filter_group, true);
|
||||
$filter_cond .= ' AND id_grupo IN (';
|
||||
|
||||
$i = 0;
|
||||
|
@ -131,7 +131,7 @@ if (check_acl($config['id_user'], 0, 'LM')) {
|
||||
|
||||
$table->data[2][0] = __('Template');
|
||||
$own_info = get_user_info($config['id_user']);
|
||||
if ($own_info['is_admin'] || check_acl($config['id_user'], 0, 'PM')) {
|
||||
if ($own_info['is_admin']) {
|
||||
$templates = alerts_get_alert_templates(false, ['id', 'name']);
|
||||
} else {
|
||||
$usr_groups = users_get_groups($config['id_user'], 'LW', true);
|
||||
|
@ -208,18 +208,21 @@ if ($delete_alert) {
|
||||
$agent_alias = agents_get_alias(
|
||||
db_get_value('id_agente', 'tagente_modulo', 'id_agente_modulo', $id_agent_module)
|
||||
);
|
||||
$unsafe_alert_template_name = io_safe_output($alert_template_name);
|
||||
$unsafe_module_name = io_safe_output($module_name);
|
||||
$unsafe_agent_alias = io_safe_output($agent_alias);
|
||||
|
||||
$result = alerts_delete_alert_agent_module($id_alert_agent_module);
|
||||
|
||||
if ($result) {
|
||||
db_pandora_audit(
|
||||
'Alert management',
|
||||
"Deleted alert '$alert_template_name' for module '$module_name' in agent '$agent_alias'"
|
||||
"Deleted alert '$unsafe_alert_template_name' for module '$unsafe_module_name' in agent '$unsafe_agent_alias'"
|
||||
);
|
||||
} else {
|
||||
db_pandora_audit(
|
||||
'Alert management',
|
||||
"Fail to deleted alert '$alert_template_name' for module '$module_name' in agent '$agent_alias'"
|
||||
"Fail to deleted alert '$unsafe_alert_template_name' for module '$unsafe_module_name' in agent '$unsafe_agent_alias'"
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -296,7 +296,9 @@ if (!users_can_manage_group_all('LM')) {
|
||||
$can_manage_group_all = true;
|
||||
}
|
||||
|
||||
echo '<div class="inline w250px">';
|
||||
html_print_select_groups(false, 'LM', $can_manage_group_all, 'id_group', $id_group, false, '', 0, false, false, true, '', false, 'width:100px;');
|
||||
echo '</div>';
|
||||
echo '</td><td>';
|
||||
echo __('Overwrite');
|
||||
ui_print_help_tip(__('Check this box, if you want to overwrite existing same days.'), false);
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user