Merge remote-tracking branch 'origin/develop' into ent-6375-proyectos-auto-aplicacion-de-politicas

This commit is contained in:
fbsanchez 2022-02-07 18:32:10 +01:00
commit 3caa8fd14f
758 changed files with 163016 additions and 139196 deletions

View File

@ -1,12 +1,17 @@
[![Build Status](https://travis-ci.org/pandorafms/pandorafms.svg?branch=develop)](https://travis-ci.org/pandorafms/pandorafms) [![Build Status](https://travis-ci.org/pandorafms/pandorafms.svg?branch=develop)](https://travis-ci.org/pandorafms/pandorafms)
[![Pandora logo](http://wolf359.artica.es/public_images/logo_pandora_community.png)](http://pandorafms.org) ![logo Pandora-FMS](https://user-images.githubusercontent.com/8567291/151817953-dc9c4c88-5f3c-459b-98a7-da0534930a2c.png)
Pandora FMS is a monitoring software for IT infrastructure management which includes network equipment, Windows and Unix servers, virtual infrastructure and all different kind of applications. It has a large amount of features, making it a new generation software which discovers all the monitoring issues that an organization may need.
With more than 50,000 customer installations across the five continents, Pandora FMS is an out-of-the-box monitoring solution: profitable and scalable, covering most infrastructure deployment options.
Pandora FMS gives you the agility to find and solve problems quickly, scaling them so they can be derived from any source, on-premise, multi cloud or both of them mixed. Now you have that capability across your entire IT stack and analytics to find any problem, even the ones that are hard to find.
Thanks to more than 500 plugins available, you can control and manage any application and technology, from SAP, Oracle, Lotus, Citrix or Jboss to VMware, AWS, SQL Server, Redhat, Websphere, etc.
### Support ### Support
For community support you can visit our forums at http://forums.pandorafms.org. Visit our community page at http://pandorafms.org and if you need commercial information or/and professional support visit http://pandorafms.com. For community support you can visit our forums at https://pandorafms.com/community/ and if you need commercial information or/and professional support visit https://pandorafms.com
### How to install Pandora FMS ### How to install Pandora FMS

View File

@ -88,7 +88,7 @@ public class PandoraWebView extends Activity {
//Check the first load the page for to hide a toast with the //Check the first load the page for to hide a toast with the
//connection message //connection message
//Close the CustomToast (I love this hack, fuck javalovers and yours patterns.). //Close the CustomToast.
if (ConnectionCustomToast.activity != null) if (ConnectionCustomToast.activity != null)
ConnectionCustomToast.activity.finish(); ConnectionCustomToast.activity.finish();
} }

View File

@ -1,54 +1,64 @@
<html> <html>
<head> <head>
<title>gatete</title> <title>gatete</title>
<script type="text/javascript" src="http://code.jquery.com/jquery-2.2.0.min.js"></script> <script
type="text/javascript"
src="http://code.jquery.com/jquery-2.2.0.min.js"
></script>
<script type="text/javascript" src="http://d3js.org/d3.v3.min.js"></script> <script type="text/javascript" src="http://d3js.org/d3.v3.min.js"></script>
</head> </head>
<body> <body>
<script> <script>
var svg = d3.select("#test svg"); var svg = d3.select("#test svg");
</script> </script>
<div id="test"> <div id="test">
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="1000px" height="1000px" style="background: black;"> <svg
<image id="cat_piano" x="400" y="-100" width="50%" height="50%" xlink:href="https://media.giphy.com/media/ymckEpq27dQ9W/giphy.gif" /> xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
width="1000px"
height="1000px"
style="background: black;"
>
<image
id="cat_piano"
x="400"
y="-100"
width="50%"
height="50%"
xlink:href="https://media.giphy.com/media/ymckEpq27dQ9W/giphy.gif"
/>
<g id="zoom" transform="translate(-10 20) scale (1)"> <g id="zoom" transform="translate(-10 20) scale (1)">
<g transform="translate(100, 300) scale(0.50)" id="cat1">
<g
transform="translate(100, 300) scale(0.50)"
id="cat1">
<path <path
id="path8068" id="path8068"
d="m 80,286.64792 28.57143,-31.42857 94.28571,60 5.71429,122.85714 L 200,472.3622 l 82.85714,-54.28571 194.28572,8.57143 191.42857,31.42857 48.57143,40 -11.42857,-65.71429 -48.57143,-94.28571 31.42857,-51.42857 14.28571,-88.57143 62.85715,74.28571 65.71428,0 31.42857,-82.85714 42.85715,94.28572 L 920,340.93363 897.14286,423.79078 868.57143,515.21935 800,663.79078 814.28571,795.21935 760,855.21935 734.28571,649.50506 691.42857,672.3622 714.28571,883.79078 640,895.21935 l -8.57143,-208.57143 -85.71428,71.42857 -160,-14.28571 L 317.14286,695.21935 360,838.07649 l -22.85714,65.71429 -74.28572,-200 -11.42857,162.85714 -74.28571,-17.14286 40,-217.14286 -42.85715,-17.14285 5.71429,-85.71429 -5.71429,-54.28571 -2.85714,-108.57143 -20,-42.85714 z" d="m 80,286.64792 28.57143,-31.42857 94.28571,60 5.71429,122.85714 L 200,472.3622 l 82.85714,-54.28571 194.28572,8.57143 191.42857,31.42857 48.57143,40 -11.42857,-65.71429 -48.57143,-94.28571 31.42857,-51.42857 14.28571,-88.57143 62.85715,74.28571 65.71428,0 31.42857,-82.85714 42.85715,94.28572 L 920,340.93363 897.14286,423.79078 868.57143,515.21935 800,663.79078 814.28571,795.21935 760,855.21935 734.28571,649.50506 691.42857,672.3622 714.28571,883.79078 640,895.21935 l -8.57143,-208.57143 -85.71428,71.42857 -160,-14.28571 L 317.14286,695.21935 360,838.07649 l -22.85714,65.71429 -74.28572,-200 -11.42857,162.85714 -74.28571,-17.14286 40,-217.14286 -42.85715,-17.14285 5.71429,-85.71429 -5.71429,-54.28571 -2.85714,-108.57143 -20,-42.85714 z"
style="fill:none;fill-rule:evenodd;stroke: red; fill: white; stroke-width:4px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" /> style="fill:none;fill-rule:evenodd;stroke: red; fill: white; stroke-width:4px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
/>
</g> </g>
<g <g transform="translate(700, 500) scale(0.25)" id="cat2">
transform="translate(700, 500) scale(0.25)"
id="cat2">
<path <path
id="path8068" id="path8068"
d="m 80,286.64792 28.57143,-31.42857 94.28571,60 5.71429,122.85714 L 200,472.3622 l 82.85714,-54.28571 194.28572,8.57143 191.42857,31.42857 48.57143,40 -11.42857,-65.71429 -48.57143,-94.28571 31.42857,-51.42857 14.28571,-88.57143 62.85715,74.28571 65.71428,0 31.42857,-82.85714 42.85715,94.28572 L 920,340.93363 897.14286,423.79078 868.57143,515.21935 800,663.79078 814.28571,795.21935 760,855.21935 734.28571,649.50506 691.42857,672.3622 714.28571,883.79078 640,895.21935 l -8.57143,-208.57143 -85.71428,71.42857 -160,-14.28571 L 317.14286,695.21935 360,838.07649 l -22.85714,65.71429 -74.28572,-200 -11.42857,162.85714 -74.28571,-17.14286 40,-217.14286 -42.85715,-17.14285 5.71429,-85.71429 -5.71429,-54.28571 -2.85714,-108.57143 -20,-42.85714 z" d="m 80,286.64792 28.57143,-31.42857 94.28571,60 5.71429,122.85714 L 200,472.3622 l 82.85714,-54.28571 194.28572,8.57143 191.42857,31.42857 48.57143,40 -11.42857,-65.71429 -48.57143,-94.28571 31.42857,-51.42857 14.28571,-88.57143 62.85715,74.28571 65.71428,0 31.42857,-82.85714 42.85715,94.28572 L 920,340.93363 897.14286,423.79078 868.57143,515.21935 800,663.79078 814.28571,795.21935 760,855.21935 734.28571,649.50506 691.42857,672.3622 714.28571,883.79078 640,895.21935 l -8.57143,-208.57143 -85.71428,71.42857 -160,-14.28571 L 317.14286,695.21935 360,838.07649 l -22.85714,65.71429 -74.28572,-200 -11.42857,162.85714 -74.28571,-17.14286 40,-217.14286 -42.85715,-17.14285 5.71429,-85.71429 -5.71429,-54.28571 -2.85714,-108.57143 -20,-42.85714 z"
style="fill:none;fill-rule:evenodd;stroke: red; fill: white; stroke-width:4px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" /> style="fill:none;fill-rule:evenodd;stroke: red; fill: white; stroke-width:4px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
/>
</g> </g>
<g <g transform="translate(200, 0) scale(0.25)" id="cat3">
transform="translate(200, 0) scale(0.25)"
id="cat3">
<path <path
id="path8068" id="path8068"
d="m 80,286.64792 28.57143,-31.42857 94.28571,60 5.71429,122.85714 L 200,472.3622 l 82.85714,-54.28571 194.28572,8.57143 191.42857,31.42857 48.57143,40 -11.42857,-65.71429 -48.57143,-94.28571 31.42857,-51.42857 14.28571,-88.57143 62.85715,74.28571 65.71428,0 31.42857,-82.85714 42.85715,94.28572 L 920,340.93363 897.14286,423.79078 868.57143,515.21935 800,663.79078 814.28571,795.21935 760,855.21935 734.28571,649.50506 691.42857,672.3622 714.28571,883.79078 640,895.21935 l -8.57143,-208.57143 -85.71428,71.42857 -160,-14.28571 L 317.14286,695.21935 360,838.07649 l -22.85714,65.71429 -74.28572,-200 -11.42857,162.85714 -74.28571,-17.14286 40,-217.14286 -42.85715,-17.14285 5.71429,-85.71429 -5.71429,-54.28571 -2.85714,-108.57143 -20,-42.85714 z" d="m 80,286.64792 28.57143,-31.42857 94.28571,60 5.71429,122.85714 L 200,472.3622 l 82.85714,-54.28571 194.28572,8.57143 191.42857,31.42857 48.57143,40 -11.42857,-65.71429 -48.57143,-94.28571 31.42857,-51.42857 14.28571,-88.57143 62.85715,74.28571 65.71428,0 31.42857,-82.85714 42.85715,94.28572 L 920,340.93363 897.14286,423.79078 868.57143,515.21935 800,663.79078 814.28571,795.21935 760,855.21935 734.28571,649.50506 691.42857,672.3622 714.28571,883.79078 640,895.21935 l -8.57143,-208.57143 -85.71428,71.42857 -160,-14.28571 L 317.14286,695.21935 360,838.07649 l -22.85714,65.71429 -74.28572,-200 -11.42857,162.85714 -74.28571,-17.14286 40,-217.14286 -42.85715,-17.14285 5.71429,-85.71429 -5.71429,-54.28571 -2.85714,-108.57143 -20,-42.85714 z"
style="fill:none;fill-rule:evenodd;stroke: red; fill: white; stroke-width:4px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" /> style="fill:none;fill-rule:evenodd;stroke: red; fill: white; stroke-width:4px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
/>
</g> </g>
<g <g transform="translate(600, 0) scale(0.25)" id="cat4">
transform="translate(600, 0) scale(0.25)"
id="cat4">
<path <path
id="path8068" id="path8068"
d="m 80,286.64792 28.57143,-31.42857 94.28571,60 5.71429,122.85714 L 200,472.3622 l 82.85714,-54.28571 194.28572,8.57143 191.42857,31.42857 48.57143,40 -11.42857,-65.71429 -48.57143,-94.28571 31.42857,-51.42857 14.28571,-88.57143 62.85715,74.28571 65.71428,0 31.42857,-82.85714 42.85715,94.28572 L 920,340.93363 897.14286,423.79078 868.57143,515.21935 800,663.79078 814.28571,795.21935 760,855.21935 734.28571,649.50506 691.42857,672.3622 714.28571,883.79078 640,895.21935 l -8.57143,-208.57143 -85.71428,71.42857 -160,-14.28571 L 317.14286,695.21935 360,838.07649 l -22.85714,65.71429 -74.28572,-200 -11.42857,162.85714 -74.28571,-17.14286 40,-217.14286 -42.85715,-17.14285 5.71429,-85.71429 -5.71429,-54.28571 -2.85714,-108.57143 -20,-42.85714 z" d="m 80,286.64792 28.57143,-31.42857 94.28571,60 5.71429,122.85714 L 200,472.3622 l 82.85714,-54.28571 194.28572,8.57143 191.42857,31.42857 48.57143,40 -11.42857,-65.71429 -48.57143,-94.28571 31.42857,-51.42857 14.28571,-88.57143 62.85715,74.28571 65.71428,0 31.42857,-82.85714 42.85715,94.28572 L 920,340.93363 897.14286,423.79078 868.57143,515.21935 800,663.79078 814.28571,795.21935 760,855.21935 734.28571,649.50506 691.42857,672.3622 714.28571,883.79078 640,895.21935 l -8.57143,-208.57143 -85.71428,71.42857 -160,-14.28571 L 317.14286,695.21935 360,838.07649 l -22.85714,65.71429 -74.28572,-200 -11.42857,162.85714 -74.28571,-17.14286 40,-217.14286 -42.85715,-17.14285 5.71429,-85.71429 -5.71429,-54.28571 -2.85714,-108.57143 -20,-42.85714 z"
style="fill:none;fill-rule:evenodd;stroke: red; fill: white; stroke-width:4px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" /> style="fill:none;fill-rule:evenodd;stroke: red; fill: white; stroke-width:4px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
/>
</g> </g>
</g> </g>
</svg> </svg>
@ -56,75 +66,128 @@ var svg = d3.select("#test svg");
<script type="text/javascript"> <script type="text/javascript">
var svg = d3.select("svg #zoom"); var svg = d3.select("svg #zoom");
svg
.append("g")
svg.append("g")
.attr("id", "circulo") .attr("id", "circulo")
.attr("transform", .attr("transform", function(d) {
function(d) { return (
return "translate(" + get_center_element("#cat1")[0] + " " + get_center_element("#cat1")[1] + ")";}) "translate(" +
get_center_element("#cat1")[0] +
" " +
get_center_element("#cat1")[1] +
")"
);
})
.append("circle") .append("circle")
.attr("style", "fill: rgb(0, 255, 0);") .attr("style", "fill: rgb(0, 255, 0);")
.attr("cx", 0) .attr("cx", 0)
.attr("cy", 0) .attr("cy", 0)
.attr("r", 20); .attr("r", 20);
svg.append("g") svg
.attr("transform", .append("g")
function(d) { return "translate(" + get_pos_element("#cat1")[0] + " " + get_pos_element("#cat1")[1] + ") scale(" + get_scale_element("#cat1") + ")";}) .attr("transform", function(d) {
return (
"translate(" +
get_pos_element("#cat1")[0] +
" " +
get_pos_element("#cat1")[1] +
") scale(" +
get_scale_element("#cat1") +
")"
);
})
.append("rect") .append("rect")
.attr("style", "fill:none; stroke:#ffff00;stroke-width:5") .attr("style", "fill:none; stroke:#ffff00;stroke-width:5")
.attr("width", function(d) { return get_size_element("#cat1")[0];}) .attr("width", function(d) {
.attr("height", function(d) { return get_size_element("#cat1")[1];}); return get_size_element("#cat1")[0];
})
.attr("height", function(d) {
return get_size_element("#cat1")[1];
});
svg.append("g") svg
.attr("transform", .append("g")
function(d) { .attr("transform", function(d) {
return "translate(" + get_center_element("#cat1")[0] + " " + get_center_element("#cat1")[1] + ") scale(" + get_scale_element("#cat1") + ")";}) return (
"translate(" +
get_center_element("#cat1")[0] +
" " +
get_center_element("#cat1")[1] +
") scale(" +
get_scale_element("#cat1") +
")"
);
})
.append("circle") .append("circle")
.attr("style", "fill: none; stroke-width: 5; stroke: rgb(0, 0, 255);") .attr("style", "fill: none; stroke-width: 5; stroke: rgb(0, 0, 255);")
.attr("cx", 0) .attr("cx", 0)
.attr("cy", 0) .attr("cy", 0)
.attr("r", get_radius_element("#cat1")); .attr("r", get_radius_element("#cat1"));
svg.append("g") svg
.append("g")
.attr("id", "circulo") .attr("id", "circulo")
.attr("transform", .attr("transform", function(d) {
function(d) { return (
return "translate(" + get_center_element("#cat3")[0] + " " + get_center_element("#cat3")[1] + ")";}) "translate(" +
get_center_element("#cat3")[0] +
" " +
get_center_element("#cat3")[1] +
")"
);
})
.append("circle") .append("circle")
.attr("style", "fill: rgb(0, 255, 0);") .attr("style", "fill: rgb(0, 255, 0);")
.attr("cx", 0) .attr("cx", 0)
.attr("cy", 0) .attr("cy", 0)
.attr("r", 20); .attr("r", 20);
svg.append("g") svg
.attr("transform", .append("g")
function(d) { return "translate(" + get_pos_element("#cat3")[0] + " " + get_pos_element("#cat3")[1] + ") scale(" + get_scale_element("#cat3") + ")";}) .attr("transform", function(d) {
return (
"translate(" +
get_pos_element("#cat3")[0] +
" " +
get_pos_element("#cat3")[1] +
") scale(" +
get_scale_element("#cat3") +
")"
);
})
.append("rect") .append("rect")
.attr("style", "fill:none; stroke:#ffff00;stroke-width:5") .attr("style", "fill:none; stroke:#ffff00;stroke-width:5")
.attr("width", function(d) { return get_size_element("#cat3")[0];}) .attr("width", function(d) {
.attr("height", function(d) { return get_size_element("#cat3")[1];}); return get_size_element("#cat3")[0];
})
.attr("height", function(d) {
return get_size_element("#cat3")[1];
});
svg.append("g") svg
.attr("transform", .append("g")
function(d) { .attr("transform", function(d) {
return "translate(" + get_center_element("#cat3")[0] + " " + get_center_element("#cat3")[1] + ") scale(" + get_scale_element("#cat3") + ")";}) return (
"translate(" +
get_center_element("#cat3")[0] +
" " +
get_center_element("#cat3")[1] +
") scale(" +
get_scale_element("#cat3") +
")"
);
})
.append("circle") .append("circle")
.attr("style", "fill: none; stroke-width: 5; stroke: rgb(0, 0, 255);") .attr("style", "fill: none; stroke-width: 5; stroke: rgb(0, 0, 255);")
.attr("cx", 0) .attr("cx", 0)
.attr("cy", 0) .attr("cy", 0)
.attr("r", get_radius_element("#cat3")); .attr("r", get_radius_element("#cat3"));
arrow_by_pieces2("gatete_flecha", "cat1", "cat2"); arrow_by_pieces2("gatete_flecha", "cat1", "cat2");
arrow_by_pieces2("gatete_flecha2", "cat1", "cat4"); arrow_by_pieces2("gatete_flecha2", "cat1", "cat4");
arrow_by_pieces2("gatete_flecha3", "cat3", "cat4"); arrow_by_pieces2("gatete_flecha3", "cat3", "cat4");
//~ arrow_by_pieces("gatete_flecha", "cat1", "cat2"); //~ arrow_by_pieces("gatete_flecha", "cat1", "cat2");
//~ arrow_by_pieces("gatete_flecha", "cat3", "cat4"); //~ arrow_by_pieces("gatete_flecha", "cat3", "cat4");
@ -136,8 +199,7 @@ var svg = d3.select("#test svg");
function get_radius_element(element) { function get_radius_element(element) {
var size = get_size_element(element); var size = get_size_element(element);
return Math.sqrt( return Math.sqrt(Math.pow(size[0] / 2, 2) + Math.pow(size[1] / 2, 2));
Math.pow(size[0] / 2, 2) + Math.pow(size[1] / 2, 2));
} }
/** /**
@ -147,7 +209,7 @@ var svg = d3.select("#test svg");
*/ */
function get_scale_element(element) { function get_scale_element(element) {
var element_t = d3.transform(d3.select(element).attr("transform")); var element_t = d3.transform(d3.select(element).attr("transform"));
var element_t_scale = parseFloat(element_t['scale']); var element_t_scale = parseFloat(element_t["scale"]);
return element_t_scale; return element_t_scale;
} }
@ -158,9 +220,12 @@ var svg = d3.select("#test svg");
* This method get the element size [width, height] * This method get the element size [width, height]
*/ */
function get_size_element(element) { function get_size_element(element) {
var element_b = d3.select(element).node().getBBox(); var element_b = d3
.select(element)
.node()
.getBBox();
return [element_b['width'], element_b['height']]; return [element_b["width"], element_b["height"]];
} }
/** /**
@ -170,13 +235,18 @@ var svg = d3.select("#test svg");
*/ */
function get_pos_element(element) { function get_pos_element(element) {
var element_t = d3.transform(d3.select(element).attr("transform")); var element_t = d3.transform(d3.select(element).attr("transform"));
var element_t_scale = parseFloat(element_t['scale']); var element_t_scale = parseFloat(element_t["scale"]);
var element_b = d3.select(element).node().getBBox(); var element_b = d3
.select(element)
.node()
.getBBox();
var box_x = parseFloat(element_t.translate[0]) + var box_x =
parseFloat(element_b['x']) * element_t_scale; parseFloat(element_t.translate[0]) +
var box_y = parseFloat(element_t.translate[1]) + parseFloat(element_b["x"]) * element_t_scale;
parseFloat(element_b['y']) * element_t_scale; var box_y =
parseFloat(element_t.translate[1]) +
parseFloat(element_b["y"]) * element_t_scale;
return [box_x, box_y]; return [box_x, box_y];
} }
@ -188,19 +258,24 @@ var svg = d3.select("#test svg");
*/ */
function get_center_element(element) { function get_center_element(element) {
var element_t = d3.transform(d3.select(element).attr("transform")); var element_t = d3.transform(d3.select(element).attr("transform"));
var element_t_scale = parseFloat(element_t['scale']); var element_t_scale = parseFloat(element_t["scale"]);
var element_b = d3.select(element).node().getBBox(); var element_b = d3
.select(element)
.node()
.getBBox();
var box_x = parseFloat(element_t.translate[0]) + var box_x =
parseFloat(element_b['x']) * element_t_scale; parseFloat(element_t.translate[0]) +
var box_y = parseFloat(element_t.translate[1]) + parseFloat(element_b["x"]) * element_t_scale;
parseFloat(element_b['y']) * element_t_scale; var box_y =
parseFloat(element_t.translate[1]) +
parseFloat(element_b["y"]) * element_t_scale;
var width = (element_t_scale * element_b['width']); var width = element_t_scale * element_b["width"];
var height = (element_t_scale * element_b['height']); var height = element_t_scale * element_b["height"];
var c_x = box_x + (width / 2); var c_x = box_x + width / 2;
var c_y = box_y + (height / 2); var c_y = box_y + height / 2;
return [c_x, c_y]; return [c_x, c_y];
} }
@ -214,72 +289,53 @@ var svg = d3.select("#test svg");
delta_x = Math.abs(point1[0] - point2[0]); delta_x = Math.abs(point1[0] - point2[0]);
delta_y = Math.abs(point1[1] - point1[1]); delta_y = Math.abs(point1[1] - point1[1]);
return Math.sqrt( return Math.sqrt(Math.pow(delta_x, 2) + Math.pow(delta_y, 2));
Math.pow(delta_x, 2) + Math.pow(delta_y, 2));
} }
/** /**
* Function get_angle_of_line * Function get_angle_of_line
* Return float * Return float
* This method get the angle of line and x axe * This method get the angle of line and x axe
*/ */
function get_angle_of_line(point1, point2) { function get_angle_of_line(point1, point2) {
return Math.atan2(point2[1] - point1[1], point2[0] - point1[0]) * 180 / Math.PI; return (
(Math.atan2(point2[1] - point1[1], point2[0] - point1[0]) * 180) /
Math.PI
);
} }
//~ function wait_for_preload_symbol(symbol) {
//~ preload_symbol(symbol);
//~
//~ while (!is_preload_symbol(symbol)) {
//~ sleep(1000);
//~ }
//~ }
//~
//~ function arrow_by_pieces(id_arrow, element1, element2, step) {
//~
//~ wait_for_preload_symbol('pedo');
//~ wait_for_preload_symbol('caca');
//~ ...
//~ }
function arrow_by_pieces2(id_arrow, element1, element2, step) { function arrow_by_pieces2(id_arrow, element1, element2, step) {
if (typeof(step) === "undefined") if (typeof step === "undefined") step = 0;
step = 0;
step++; step++;
switch (step) { switch (step) {
case 1: case 1:
wait_for_preload_symbols( wait_for_preload_symbols(
["body_arrow.svg#body_arrow", ["body_arrow.svg#body_arrow", "head_arrow.svg#head_arrow"],
"head_arrow.svg#head_arrow"],
function() { function() {
arrow_by_pieces2(id_arrow, element1, element2, step) arrow_by_pieces2(id_arrow, element1, element2, step);
}); }
);
break; break;
case 2: case 2:
var arrow = svg
var arrow = svg.append("g") .append("g")
.attr("id", id_arrow) .attr("id", id_arrow)
.attr("style", "opacity: 0"); .attr("style", "opacity: 0");
arrow.append("g") arrow
.append("g")
.attr("id", "body") .attr("id", "body")
.append("use") .append("use")
.attr("xlink:href", "body_arrow.svg#body_arrow"); .attr("xlink:href", "body_arrow.svg#body_arrow");
arrow.append("g") arrow
.append("g")
.attr("id", "head") .attr("id", "head")
.append("use") .append("use")
.attr("xlink:href", "head_arrow.svg#head_arrow"); .attr("xlink:href", "head_arrow.svg#head_arrow");
var c_elem1 = get_center_element("#" + element1); var c_elem1 = get_center_element("#" + element1);
var c_elem2 = get_center_element("#" + element2); var c_elem2 = get_center_element("#" + element2);
var distance = get_distance_between_point(c_elem1, c_elem2); var distance = get_distance_between_point(c_elem1, c_elem2);
@ -295,7 +351,7 @@ var svg = d3.select("#test svg");
var arrow_body_b = arrow_body.node().getBBox(); var arrow_body_b = arrow_body.node().getBBox();
transform.translate[0] = c_elem1[0]; transform.translate[0] = c_elem1[0];
transform.translate[1] = c_elem1[1] - arrow_body_b['height'] / 2; transform.translate[1] = c_elem1[1] - arrow_body_b["height"] / 2;
transform.rotate = get_angle_of_line(c_elem1, c_elem2); transform.rotate = get_angle_of_line(c_elem1, c_elem2);
arrow.attr("transform", transform.toString()); arrow.attr("transform", transform.toString());
@ -308,10 +364,10 @@ var svg = d3.select("#test svg");
var arrow_head = d3.select("#" + id_arrow + " #head"); var arrow_head = d3.select("#" + id_arrow + " #head");
var arrow_head_b = arrow_head.node().getBBox(); var arrow_head_b = arrow_head.node().getBBox();
var body_width = distance - arrow_head_b['width']; var body_width = distance - arrow_head_b["width"];
transform = d3.transform(); transform = d3.transform();
transform.scale[0] = body_width / arrow_body_b['width']; transform.scale[0] = body_width / arrow_body_b["width"];
arrow_body.attr("transform", transform.toString()); arrow_body.attr("transform", transform.toString());
/*---------------------------------------------*/ /*---------------------------------------------*/
@ -322,8 +378,9 @@ var svg = d3.select("#test svg");
var arrow_body_t = d3.transform(arrow_body.attr("transform")); var arrow_body_t = d3.transform(arrow_body.attr("transform"));
var scale = arrow_body_t.scale[0]; var scale = arrow_body_t.scale[0];
var x = 0 + arrow_body_b['width'] * scale; var x = 0 + arrow_body_b["width"] * scale;
var y = 0 + (arrow_body_b['height'] / 2 - arrow_head_b['height'] / 2); var y =
0 + (arrow_body_b["height"] / 2 - arrow_head_b["height"] / 2);
transform.translate[0] = x; transform.translate[0] = x;
transform.translate[1] = y; transform.translate[1] = y;
@ -347,15 +404,13 @@ var svg = d3.select("#test svg");
preload_symbol(symbol); preload_symbol(symbol);
setTimeout(function() { setTimeout(function() {
wait(symbol, wait(symbol, callback);
callback);
}, 100); }, 100);
break; break;
case 0: case 0:
// Wait // Wait
setTimeout(function() { setTimeout(function() {
wait(symbol, wait(symbol, callback);
callback);
}, 100); }, 100);
break; break;
case 1: case 1:
@ -376,31 +431,28 @@ var svg = d3.select("#test svg");
} }
} }
function preload_symbol(symbol, param_step) { function preload_symbol(symbol, param_step) {
var step; var step;
if (typeof param_step == "undefined") {
if (typeof(param_step) == "undefined") {
step = 1; step = 1;
param_step = 1; param_step = 1;
} } else {
else {
step = param_step; step = param_step;
} }
step++; step++;
var base64symbol = btoa(symbol).replace(/=/g, ""); var base64symbol = btoa(symbol).replace(/=/g, "");
var callback = function(e) { var callback = function(e) {
preload_symbol(symbol, step); preload_symbol(symbol, step);
} };
switch (param_step) { switch (param_step) {
case 1: case 1:
d3.select("svg").append("g") d3.select("svg")
.append("g")
.attr("id", base64symbol) .attr("id", base64symbol)
.attr("data-loaded", 0) .attr("data-loaded", 0)
.style("opacity", 0) .style("opacity", 0)
@ -418,8 +470,7 @@ var svg = d3.select("#test svg");
function is_preload_symbol(symbol) { function is_preload_symbol(symbol) {
var base64symbol = btoa(symbol).replace(/=/g, ""); var base64symbol = btoa(symbol).replace(/=/g, "");
if (d3.select("#" + base64symbol).node() === null) if (d3.select("#" + base64symbol).node() === null) return -1;
return -1;
return parseInt(d3.select("#" + base64symbol).attr("data-loaded")); return parseInt(d3.select("#" + base64symbol).attr("data-loaded"));
} }

View File

@ -1,20 +1,32 @@
#!/bin/bash #!/bin/bash
#######################################################
# PandoraFMS Community online installation script
#######################################################
## Tested versions ##
# Centos 7.9
# define variables #Constants
PANDORA_CONSOLE=/var/www/html/pandora_console PANDORA_CONSOLE=/var/www/html/pandora_console
CONSOLE_PATH=/var/www/html/pandora_console
PANDORA_SERVER_CONF=/etc/pandora/pandora_server.conf PANDORA_SERVER_CONF=/etc/pandora/pandora_server.conf
PANDORA_SERVER_BIN=/usr/bin/pandora_server PANDORA_AGENT_CONF=/etc/pandora/pandora_agent.conf
PANDORA_HA_BIN=/usr/bin/pandora_ha
PANDORA_TABLES_MIN=160
DBHOST=127.0.0.1 S_VERSION='2022012401'
DBNAME=pandora
DBUSER=pandora
DBPASS=pandora
DBPORT=3306
S_VERSION='2021012801'
LOGFILE="/tmp/pandora-deploy-community-$(date +%F).log" LOGFILE="/tmp/pandora-deploy-community-$(date +%F).log"
# define default variables
[ "$TZ" ] || TZ="Europe/Madrid"
[ "$DBHOST" ] || DBHOST=127.0.0.1
[ "$DBNAME" ] || DBNAME=pandora
[ "$DBUSER" ] || DBUSER=pandora
[ "$DBPASS" ] || DBPASS=pandora
[ "$DBPORT" ] || DBPORT=3306
[ "$DBROOTPASS" ] || DBROOTPASS=pandora
[ "$SKIP_PRECHECK" ] || SKIP_PRECHECK=0
[ "$SKIP_DATABASE_INSTALL" ] || SKIP_DATABASE_INSTALL=0
[ "$SKIP_KERNEL_OPTIMIZATIONS" ] || SKIP_KERNEL_OPTIMIZATIONS=0
[ "$POOL_SIZE" ] || POOL_SIZE=$(grep -i total /proc/meminfo | head -1 | awk '{printf "%.2f \n", $(NF-1)*0.4/1024}' | sed "s/\\..*$/M/g")
# Ansi color code variables # Ansi color code variables
red="\e[0;91m" red="\e[0;91m"
green="\e[0;92m" green="\e[0;92m"
@ -60,7 +72,7 @@ check_pre_pandora () {
echo -en "${cyan}Checking environment ... ${reset}" echo -en "${cyan}Checking environment ... ${reset}"
rpm -qa | grep pandora &>> /dev/null && local fail=true rpm -qa | grep pandora &>> /dev/null && local fail=true
[ -d "$CONSOLE_PATH" ] && local fail=true [ -d "$PANDORA_CONSOLE" ] && local fail=true
[ -f /usr/bin/pandora_server ] && local fail=true [ -f /usr/bin/pandora_server ] && local fail=true
echo "use $DBNAME" | mysql -uroot -P$DBPORT -h$DBHOST &>> /dev/null && local fail=true echo "use $DBNAME" | mysql -uroot -P$DBPORT -h$DBHOST &>> /dev/null && local fail=true
@ -111,7 +123,7 @@ echo "Community installer version: $S_VERSION" >> $LOGFILE
check_root_permissions check_root_permissions
# Pre installed pandora # Pre installed pandora
check_pre_pandora [ "$SKIP_PRECHECK" == 1 ] || check_pre_pandora
# Connectivity # Connectivity
check_repo_connection check_repo_connection
@ -125,6 +137,9 @@ execute_cmd "[ $(grep MemTotal /proc/meminfo | awk '{print $2}') -ge 1700000 ]"
# Check disk size at least 10 Gb free space # Check disk size at least 10 Gb free space
execute_cmd "[ $(df -BM / | tail -1 | awk '{print $4}' | tr -d M) -gt 10000 ]" 'Checking Disk (required: 10 GB free min)' execute_cmd "[ $(df -BM / | tail -1 | awk '{print $4}' | tr -d M) -gt 10000 ]" 'Checking Disk (required: 10 GB free min)'
# Setting timezone
execute_cmd "timedatectl set-timezone $TZ" "Setting Timezone $TZ"
# Execute tools check # Execute tools check
execute_cmd "awk --version" 'Checking needed tools: awk' execute_cmd "awk --version" 'Checking needed tools: awk'
execute_cmd "grep --version" 'Checking needed tools: grep' execute_cmd "grep --version" 'Checking needed tools: grep'
@ -148,10 +163,10 @@ http://rpms.remirepo.net/enterprise/remi-release-7.rpm \
https://repo.percona.com/yum/percona-release-latest.noarch.rpm" https://repo.percona.com/yum/percona-release-latest.noarch.rpm"
execute_cmd "yum install -y $extra_repos" "Installing extra repositories" execute_cmd "yum install -y $extra_repos" "Installing extra repositories"
execute_cmd "yum-config-manager --enable remi-php73" "Configuring PHP" execute_cmd "yum-config-manager --enable remi-php74" "Configuring PHP"
# Install percona Database # Install percona Database
[ -f /etc/my.cnf ] && rm -rf /etc/my.cnf #[ -f /etc/my.cnf ] && rm -rf /etc/my.cnf
execute_cmd "yum install -y Percona-Server-server-57" "Installing Percona Server" execute_cmd "yum install -y Percona-Server-server-57" "Installing Percona Server"
# Console dependencies # Console dependencies
@ -256,6 +271,7 @@ server_dependencies=" \
perl(XML::Twig) \ perl(XML::Twig) \
expect \ expect \
openssh-clients \ openssh-clients \
java \
http://firefly.artica.es/centos7/xprobe2-0.3-12.2.x86_64.rpm \ http://firefly.artica.es/centos7/xprobe2-0.3-12.2.x86_64.rpm \
http://firefly.artica.es/centos7/wmic-1.4-1.el7.x86_64.rpm" http://firefly.artica.es/centos7/wmic-1.4-1.el7.x86_64.rpm"
execute_cmd "yum install -y $server_dependencies" "Installing Pandora FMS Server dependencies" execute_cmd "yum install -y $server_dependencies" "Installing Pandora FMS Server dependencies"
@ -275,32 +291,51 @@ execute_cmd "yum install -y $vmware_dependencies" "Installing SDK VMware perl de
oracle_dependencies=" \ oracle_dependencies=" \
https://download.oracle.com/otn_software/linux/instantclient/19800/oracle-instantclient19.8-basic-19.8.0.0.0-1.x86_64.rpm \ https://download.oracle.com/otn_software/linux/instantclient/19800/oracle-instantclient19.8-basic-19.8.0.0.0-1.x86_64.rpm \
https://download.oracle.com/otn_software/linux/instantclient/19800/oracle-instantclient19.8-sqlplus-19.8.0.0.0-1.x86_64.rpm" https://download.oracle.com/otn_software/linux/instantclient/19800/oracle-instantclient19.8-sqlplus-19.8.0.0.0-1.x86_64.rpm"
execute_cmd "yum install -y $oracle_dependencies" "Installing Oracle Instant client" execute_cmd "yum install -y $oracle_dependencies || yum reinstall -y $oracle_dependencies" "Installing Oracle Instant client"
#ipam dependencies
ipam_dependencies=" \
http://firefly.artica.es/centos7/xprobe2-0.3-12.2.x86_64.rpm \
perl(NetAddr::IP) \
perl(Sys::Syslog) \
perl(DBI) \
perl(XML::Simple) \
perl(Geo::IP) \
perl(IO::Socket::INET6) \
perl(XML::Twig)"
execute_cmd "yum install -y $ipam_dependencies" "Installing IPAM Instant client"
# MSSQL dependencies el7
execute_cmd "curl https://packages.microsoft.com/config/rhel/7/prod.repo -o /etc/yum.repos.d/mssql-release.repo" "Configuring Microsoft repositories"
execute_cmd "yum remove unixODBC-utf16 unixODBC-utf16-devel" "Removing default unixODBC packages"
execute_cmd "env ACCEPT_EULA=Y yum install -y msodbcsql17" "Installing ODBC Driver for Microsoft(R) SQL Server(R)"
MS_ID=$(head -1 /etc/odbcinst.ini | tr -d '[]') &>> "$LOGFILE"
#yum config-manager --set-disable packages-microsoft-com-prod
# Disabling SELINUX and firewalld # Disabling SELINUX and firewalld
setenforce 0 setenforce 0
sed -i -e "s/^SELINUX=.*/SELINUX=disabled/g" /etc/selinux/config sed -i -e "s/^SELINUX=.*/SELINUX=disabled/g" /etc/selinux/config
systemctl disable firewalld --now &>> $LOGFILE systemctl disable firewalld --now &>> $LOGFILE
#Configuring Database #Configuring Database
if [ "$SKIP_DATABASE_INSTALL" -eq '0' ] ; then
execute_cmd "systemctl start mysqld" "Starting database engine" execute_cmd "systemctl start mysqld" "Starting database engine"
export MYSQL_PWD=$(grep "temporary password" /var/log/mysqld.log | rev | cut -d' ' -f1 | rev) export MYSQL_PWD=$(grep "temporary password" /var/log/mysqld.log | rev | cut -d' ' -f1 | rev)
echo """ echo """
SET PASSWORD FOR 'root'@'localhost' = PASSWORD('Pandor4!'); SET PASSWORD FOR 'root'@'localhost' = PASSWORD('Pandor4!');
UNINSTALL PLUGIN validate_password; UNINSTALL PLUGIN validate_password;
SET PASSWORD FOR 'root'@'localhost' = PASSWORD('pandora'); SET PASSWORD FOR 'root'@'localhost' = PASSWORD('$DBROOTPASS');
""" | mysql --connect-expired-password -uroot """ | mysql --connect-expired-password -uroot &>> "$LOGFILE"
fi
export MYSQL_PWD=$DBPASS export MYSQL_PWD=$DBROOTPASS
echo -en "${cyan}Creating Pandora FMS database...${reset}" echo -en "${cyan}Creating Pandora FMS database...${reset}"
echo "create database $DBNAME" | mysql -uroot -P$DBPORT -h$DBHOST echo "create database $DBNAME" | mysql -uroot -P$DBPORT -h$DBHOST
check_cmd_status 'Error creating database pandora, is this an empty node? if you have a previus installation please contact with support.' check_cmd_status "Error creating database $DBNAME, is this an empty node? if you have a previus installation please contact with support."
echo "GRANT ALL PRIVILEGES ON $DBNAME.* TO \"$DBUSER\"@'%' identified by \"$DBPASS\"" | mysql -uroot -P$DBPORT -h$DBHOST echo "GRANT ALL PRIVILEGES ON $DBNAME.* TO \"$DBUSER\"@'%' identified by \"$DBPASS\"" | mysql -uroot -P$DBPORT -h$DBHOST
export MYSQL_PWD=$DBPASS
#Generating my.cnf #Generating my.cnf
POOL_SIZE=$(grep -i total /proc/meminfo | head -1 | awk '{printf "%.2f \n", $(NF-1)*0.4/1024}' | sed "s/\\..*$/M/g")
cat > /etc/my.cnf << EO_CONFIG_F cat > /etc/my.cnf << EO_CONFIG_F
[mysqld] [mysqld]
datadir=/var/lib/mysql datadir=/var/lib/mysql
@ -350,7 +385,7 @@ execute_cmd "systemctl restart mysqld" "Configuring database engine"
# Downloading Pandora Packages # Downloading Pandora Packages
execute_cmd "wget http://firefly.artica.es/pandorafms/latest/RHEL_CentOS/pandorafms_server-7.0NG.noarch.rpm" "Downloading Pandora FMS Server community" execute_cmd "wget http://firefly.artica.es/pandorafms/latest/RHEL_CentOS/pandorafms_server-7.0NG.noarch.rpm" "Downloading Pandora FMS Server community"
execute_cmd "wget http://firefly.artica.es/pandorafms/latest/RHEL_CentOS/pandorafms_console-7.0NG.noarch.rpm" "Downloading Pandora FMS Console community" execute_cmd "wget http://firefly.artica.es/pandorafms/latest/RHEL_CentOS/pandorafms_console-7.0NG.noarch.rpm" "Downloading Pandora FMS Console community"
execute_cmd "wget http://firefly.artica.es/centos7/pandorafms_agent_unix-7.0NG.751_x86_64.rpm" "Downloading Pandora FMS Agent community" execute_cmd "wget http://firefly.artica.es/pandorafms/latest/RHEL_CentOS/pandorafms_agent_unix-7.0NG.noarch.rpm" "Downloading Pandora FMS Agent community"
# Install Pandora # Install Pandora
execute_cmd "yum install -y $HOME/pandora_deploy_tmp/pandorafms*.rpm" "installing PandoraFMS packages" execute_cmd "yum install -y $HOME/pandora_deploy_tmp/pandorafms*.rpm" "installing PandoraFMS packages"
@ -374,13 +409,13 @@ mysql -u$DBUSER -P$DBPORT -h$DBHOST $DBNAME < $PANDORA_CONSOLE/pandoradb_data.sq
check_cmd_status 'Error Loading database schema data' check_cmd_status 'Error Loading database schema data'
# Configure console # Configure console
cat > $CONSOLE_PATH/include/config.php << EO_CONFIG_F cat > $PANDORA_CONSOLE/include/config.php << EO_CONFIG_F
<?php <?php
\$config["dbtype"] = "mysql"; \$config["dbtype"] = "mysql";
\$config["dbname"]="$DBNAME"; \$config["dbname"]="$DBNAME";
\$config["dbuser"]="$DBUSER"; \$config["dbuser"]="$DBUSER";
\$config["dbpass"]="$DBPASS"; \$config["dbpass"]="$DBPASS";
\$config["dbhost"]="localhost"; \$config["dbhost"]="$DBHOST";
\$config["homedir"]="$PANDORA_CONSOLE"; \$config["homedir"]="$PANDORA_CONSOLE";
\$config["homeurl"]="/pandora_console"; \$config["homeurl"]="/pandora_console";
error_reporting(0); error_reporting(0);
@ -420,9 +455,9 @@ sed -i -e "s/php_flag engine off//g" $PANDORA_CONSOLE/images/.htaccess
sed -i -e "s/php_flag engine off//g" $PANDORA_CONSOLE/attachment/.htaccess sed -i -e "s/php_flag engine off//g" $PANDORA_CONSOLE/attachment/.htaccess
# Fixing console permissions # Fixing console permissions
chmod 600 $CONSOLE_PATH/include/config.php chmod 600 $PANDORA_CONSOLE/include/config.php
chown apache. $CONSOLE_PATH/include/config.php chown apache. $PANDORA_CONSOLE/include/config.php
mv $CONSOLE_PATH/install.php $CONSOLE_PATH/install.done mv $PANDORA_CONSOLE/install.php $PANDORA_CONSOLE/install.done
# Prepare php.ini # Prepare php.ini
sed -i -e "s/^max_input_time.*/max_input_time = -1/g" /etc/php.ini sed -i -e "s/^max_input_time.*/max_input_time = -1/g" /etc/php.ini
@ -449,6 +484,10 @@ 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/^dbuser.*/dbuser $DBUSER/g" $PANDORA_SERVER_CONF
sed -i -e "s|^dbpass.*|dbpass $DBPASS|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/^dbport.*/dbport $DBPORT/g" $PANDORA_SERVER_CONF
sed -i -e "s/^#.mssql_driver.*/mssql_driver $MS_ID/g" $PANDORA_SERVER_CONF
# Enable agent remote config
sed -i "s/^remote_config.*$/remote_config 1/g" $PANDORA_AGENT_CONF
# Set Oracle environment for pandora_server # Set Oracle environment for pandora_server
cat > /etc/pandora/pandora_server.env << 'EOF_ENV' cat > /etc/pandora/pandora_server.env << 'EOF_ENV'
@ -459,7 +498,7 @@ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib/oracle/$VERSION/client64/lib
export ORACLE_HOME=/usr/lib/oracle/$VERSION/client64 export ORACLE_HOME=/usr/lib/oracle/$VERSION/client64
EOF_ENV EOF_ENV
# Kernel optimization if [ "$SKIP_KERNEL_OPTIMIZATIONS" -eq '0' ] ; then
cat >> /etc/sysctl.conf <<EO_KO cat >> /etc/sysctl.conf <<EO_KO
# Pandora FMS Optimization # Pandora FMS Optimization
@ -487,6 +526,7 @@ net.core.optmem_max = 81920
EO_KO EO_KO
[ -d /dev/lxd/ ] || execute_cmd "sysctl --system" "Applying Kernel optimization" [ -d /dev/lxd/ ] || execute_cmd "sysctl --system" "Applying Kernel optimization"
fi
# Fix pandora_server.{log,error} permissions to allow Console check them # Fix pandora_server.{log,error} permissions to allow Console check them
chown pandora:apache /var/log/pandora chown pandora:apache /var/log/pandora
@ -563,7 +603,7 @@ execute_cmd "echo \"* * * * * root wget -q -O - --no-check-certificate http://12
echo "* * * * * root wget -q -O - --no-check-certificate http://127.0.0.1/pandora_console/enterprise/cron.php >> $PANDORA_CONSOLE/log/cron.log" >> /etc/crontab echo "* * * * * root wget -q -O - --no-check-certificate http://127.0.0.1/pandora_console/enterprise/cron.php >> $PANDORA_CONSOLE/log/cron.log" >> /etc/crontab
## Enabling agent ## Enabling agent
systemctl enable pandora_agent_daemon &>> $LOGFILE systemctl enable pandora_agent_daemon &>> $LOGFILE
execute_cmd "systemctl start pandora_agent_daemon" "starting Pandora FMS Agent" execute_cmd "systemctl start pandora_agent_daemon" "Starting Pandora FMS Agent"
#SSH banner #SSH banner
[ "$(curl -s ifconfig.me)" ] && ipplublic=$(curl -s ifconfig.me) [ "$(curl -s ifconfig.me)" ] && ipplublic=$(curl -s ifconfig.me)

View File

@ -1,17 +1,35 @@
#!/bin/bash #!/bin/bash
#######################################################
# PandoraFMS Community online installation script
#######################################################
## Tested versions ##
# Centos 8.4, 8.5
# Rocky 8.4, 8.5
# Almalinuz 8.4, 8.5
# RedHat 8.5
# define variables #Constants
PANDORA_CONSOLE=/var/www/html/pandora_console PANDORA_CONSOLE=/var/www/html/pandora_console
CONSOLE_PATH=/var/www/html/pandora_console
PANDORA_SERVER_CONF=/etc/pandora/pandora_server.conf PANDORA_SERVER_CONF=/etc/pandora/pandora_server.conf
DBHOST=127.0.0.1 PANDORA_AGENT_CONF=/etc/pandora/pandora_agent.conf
DBNAME=pandora
DBUSER=pandora
DBPASS=pandora S_VERSION='2022012401'
DBPORT=3306
S_VERSION='2021070101'
LOGFILE="/tmp/pandora-deploy-community-$(date +%F).log" LOGFILE="/tmp/pandora-deploy-community-$(date +%F).log"
# define default variables
[ "$TZ" ] || TZ="Europe/Madrid"
[ "$DBHOST" ] || DBHOST=127.0.0.1
[ "$DBNAME" ] || DBNAME=pandora
[ "$DBUSER" ] || DBUSER=pandora
[ "$DBPASS" ] || DBPASS=pandora
[ "$DBPORT" ] || DBPORT=3306
[ "$DBROOTPASS" ] || DBROOTPASS=pandora
[ "$SKIP_PRECHECK" ] || SKIP_PRECHECK=0
[ "$SKIP_DATABASE_INSTALL" ] || SKIP_DATABASE_INSTALL=0
[ "$SKIP_KERNEL_OPTIMIZATIONS" ] || SKIP_KERNEL_OPTIMIZATIONS=0
[ "$POOL_SIZE" ] || POOL_SIZE=$(grep -i total /proc/meminfo | head -1 | awk '{printf "%.2f \n", $(NF-1)*0.4/1024}' | sed "s/\\..*$/M/g")
# Ansi color code variables # Ansi color code variables
red="\e[0;91m" red="\e[0;91m"
green="\e[0;92m" green="\e[0;92m"
@ -56,7 +74,7 @@ check_pre_pandora () {
echo -en "${cyan}Checking environment ... ${reset}" echo -en "${cyan}Checking environment ... ${reset}"
rpm -qa | grep pandora &>> /dev/null && local fail=true rpm -qa | grep pandora &>> /dev/null && local fail=true
[ -d "$CONSOLE_PATH" ] && local fail=true [ -d "$PANDORA_CONSOLE" ] && local fail=true
[ -f /usr/bin/pandora_server ] && local fail=true [ -f /usr/bin/pandora_server ] && local fail=true
echo "use $DBNAME" | mysql -uroot -P$DBPORT -h$DBHOST &>> /dev/null && local fail=true echo "use $DBNAME" | mysql -uroot -P$DBPORT -h$DBHOST &>> /dev/null && local fail=true
@ -87,8 +105,8 @@ check_root_permissions () {
echo "Starting PandoraFMS Community deployment EL8 ver. $S_VERSION" echo "Starting PandoraFMS Community deployment EL8 ver. $S_VERSION"
# Centos Version # Centos Version
if [ ! "$(grep -Ei 'centos|rocky' /etc/redhat-release)" ]; then if [ ! "$(grep -Ei 'centos|rocky|Almalinux|Red Hat Enterprise' /etc/redhat-release)" ]; then
printf "\n ${red}Error this is not a Centos/Rocky Base system, this installer is compatible with Centos/Rocky systems only${reset}\n" printf "\n ${red}Error this is not a Centos/Rocky/Almalinux Base system, this installer is compatible with Centos/Rocky systems only${reset}\n"
exit 1 exit 1
fi fi
@ -106,7 +124,7 @@ echo "Community installer version: $S_VERSION" >> "$LOGFILE"
check_root_permissions check_root_permissions
# Pre installed pandora # Pre installed pandora
check_pre_pandora [ "$SKIP_PRECHECK" == 1 ] || check_pre_pandora
# Connectivity # Connectivity
check_repo_connection check_repo_connection
@ -120,6 +138,9 @@ execute_cmd "[ $(grep MemTotal /proc/meminfo | awk '{print $2}') -ge 1700000 ]"
# Check disk size at least 10 Gb free space # Check disk size at least 10 Gb free space
execute_cmd "[ $(df -BM / | tail -1 | awk '{print $4}' | tr -d M) -gt 10000 ]" 'Checking Disk (required: 10 GB free min)' execute_cmd "[ $(df -BM / | tail -1 | awk '{print $4}' | tr -d M) -gt 10000 ]" 'Checking Disk (required: 10 GB free min)'
# Setting timezone
execute_cmd "timedatectl set-timezone $TZ" "Setting Timezone $TZ"
# Execute tools check # Execute tools check
execute_cmd "awk --version" 'Checking needed tools: awk' execute_cmd "awk --version" 'Checking needed tools: awk'
execute_cmd "grep --version" 'Checking needed tools: grep' execute_cmd "grep --version" 'Checking needed tools: grep'
@ -131,10 +152,34 @@ rm -rf "$HOME"/pandora_deploy_tmp/*.rpm* &>> "$LOGFILE"
mkdir "$HOME"/pandora_deploy_tmp &>> "$LOGFILE" mkdir "$HOME"/pandora_deploy_tmp &>> "$LOGFILE"
execute_cmd "cd $HOME/pandora_deploy_tmp" "Moving to workspace: $HOME/pandora_deploy_tmp" execute_cmd "cd $HOME/pandora_deploy_tmp" "Moving to workspace: $HOME/pandora_deploy_tmp"
#Installing wget ## Extra steps on redhat envs
execute_cmd "dnf install -y wget" "Installing wget" if [ "$(grep -Ei 'Red Hat Enterprise' /etc/redhat-release)" ]; then
## In case REDHAT
# Check susbscription manager status:
echo -en "${cyan}Checking Red Hat Enterprise subscription... ${reset}"
subscription-manager status &>> "$LOGFILE"
subscription-manager list &>> "$LOGFILE"
subscription-manager list | grep 'Status:' | grep Subscribed &>> "$LOGFILE"
check_cmd_status 'Error checking subscription status, make sure your server is activated and suscribed to Red Hat Enterprise repositories'
#Installing extra repositiries # Ckeck repolist
dnf repolist &>> "$LOGFILE"
echo -en "${cyan}Checking Red Hat Enterprise repolist... ${reset}"
dnf repolist | grep 'rhel-8-for-x86_64-baseos-rpms' &>> "$LOGFILE"
check_cmd_status 'Error checking repositories status, could try a subscription-manager attach command or contact sysadmin'
#install extra repos
extra_repos=" \
tar \
dnf-utils \
https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm \
http://rpms.remirepo.net/enterprise/remi-release-8.rpm \
https://repo.percona.com/yum/percona-release-latest.noarch.rpm"
execute_cmd "dnf install -y $extra_repos" "Installing extra repositories"
execute_cmd "subscription-manager repos --enable codeready-builder-for-rhel-8-x86_64-rpms" "Enabling subscription to codeready-builder"
else
# For alma/rocky/centos
extra_repos=" \ extra_repos=" \
tar \ tar \
dnf-utils \ dnf-utils \
@ -144,12 +189,20 @@ extra_repos=" \
execute_cmd "dnf install -y $extra_repos" "Installing extra repositories" execute_cmd "dnf install -y $extra_repos" "Installing extra repositories"
execute_cmd "dnf config-manager --set-enabled powertools" "Configuring Powertools" execute_cmd "dnf config-manager --set-enabled powertools" "Configuring Powertools"
fi
#Installing wget
execute_cmd "dnf install -y wget" "Installing wget"
#Installing extra repositiries
execute_cmd "dnf module reset -y php " "Disabling standard PHP module" execute_cmd "dnf module reset -y php " "Disabling standard PHP module"
execute_cmd "dnf module install -y php:remi-7.3" "Configuring PHP" execute_cmd "dnf module install -y php:remi-7.4" "Configuring PHP"
# Install percona Database # Install percona Database
execute_cmd "dnf module disable -y mysql" "Disabiling mysql module" execute_cmd "dnf module disable -y mysql" "Disabiling mysql module"
rm -rf /etc/my.cnf #rm -rf /etc/my.cnf
execute_cmd "dnf install -y Percona-Server-server-57" "Installing Percona Server" execute_cmd "dnf install -y Percona-Server-server-57" "Installing Percona Server"
# Console dependencies # Console dependencies
@ -231,6 +284,7 @@ console_dependencies=" \
xorg-x11-fonts-misc \ xorg-x11-fonts-misc \
poppler-data \ poppler-data \
php-yaml \ php-yaml \
mod_ssl \
http://firefly.artica.es/centos8/perl-Net-Telnet-3.04-1.el8.noarch.rpm \ http://firefly.artica.es/centos8/perl-Net-Telnet-3.04-1.el8.noarch.rpm \
http://firefly.artica.es/centos7/wmic-1.4-1.el7.x86_64.rpm \ http://firefly.artica.es/centos7/wmic-1.4-1.el7.x86_64.rpm \
http://firefly.artica.es/centos8/phantomjs-2.1.1-1.el7.x86_64.rpm" http://firefly.artica.es/centos8/phantomjs-2.1.1-1.el7.x86_64.rpm"
@ -256,6 +310,7 @@ server_dependencies=" \
perl(XML::Twig) \ perl(XML::Twig) \
expect \ expect \
openssh-clients \ openssh-clients \
java \
http://firefly.artica.es/centos7/xprobe2-0.3-12.2.x86_64.rpm \ http://firefly.artica.es/centos7/xprobe2-0.3-12.2.x86_64.rpm \
http://firefly.artica.es/centos7/wmic-1.4-1.el7.x86_64.rpm" http://firefly.artica.es/centos7/wmic-1.4-1.el7.x86_64.rpm"
execute_cmd "dnf install -y $server_dependencies" "Installing Pandora FMS Server dependencies" execute_cmd "dnf install -y $server_dependencies" "Installing Pandora FMS Server dependencies"
@ -281,6 +336,7 @@ oracle_dependencies=" \
https://download.oracle.com/otn_software/linux/instantclient/19800/oracle-instantclient19.8-sqlplus-19.8.0.0.0-1.x86_64.rpm" https://download.oracle.com/otn_software/linux/instantclient/19800/oracle-instantclient19.8-sqlplus-19.8.0.0.0-1.x86_64.rpm"
execute_cmd "dnf install -y $oracle_dependencies" "Installing Oracle Instant client" execute_cmd "dnf install -y $oracle_dependencies" "Installing Oracle Instant client"
#ipam dependencies
ipam_dependencies=" \ ipam_dependencies=" \
http://firefly.artica.es/centos7/xprobe2-0.3-12.2.x86_64.rpm \ http://firefly.artica.es/centos7/xprobe2-0.3-12.2.x86_64.rpm \
perl(NetAddr::IP) \ perl(NetAddr::IP) \
@ -290,32 +346,39 @@ ipam_dependencies=" \
perl(Geo::IP) \ perl(Geo::IP) \
perl(IO::Socket::INET6) \ perl(IO::Socket::INET6) \
perl(XML::Twig)" perl(XML::Twig)"
execute_cmd "dnf install -y $ipam_dependencies" "Installing Oracle Instant client" execute_cmd "dnf install -y $ipam_dependencies" "Installing IPAM Instant client"
# MSSQL dependencies el8
execute_cmd "curl https://packages.microsoft.com/config/rhel/8/prod.repo -o /etc/yum.repos.d/mssql-release.repo" "Configuring Microsoft repositories"
execute_cmd "dnf remove unixODBC-utf16 unixODBC-utf16-devel" "Removing default unixODBC packages"
execute_cmd "env ACCEPT_EULA=Y dnf install -y msodbcsql17" "Installing ODBC Driver for Microsoft(R) SQL Server(R)"
MS_ID=$(head -1 /etc/odbcinst.ini | tr -d '[]') &>> "$LOGFILE"
#dnf config-manager --set-disable packages-microsoft-com-prod
# Disabling SELINUX and firewalld # Disabling SELINUX and firewalld
setenforce 0 &>> "$LOGFILE" setenforce 0 &>> "$LOGFILE"
sed -i -e "s/^SELINUX=.*/SELINUX=disabled/g" /etc/selinux/config &>> "$LOGFILE" sed -i -e "s/^SELINUX=.*/SELINUX=disabled/g" /etc/selinux/config &>> "$LOGFILE"
systemctl disable firewalld --now &>> "$LOGFILE" systemctl disable firewalld --now &>> "$LOGFILE"
#Configuring Database #Configuring Database
if [ "$SKIP_DATABASE_INSTALL" -eq '0' ] ; then
execute_cmd "systemctl start mysqld" "Starting database engine" execute_cmd "systemctl start mysqld" "Starting database engine"
export MYSQL_PWD=$(grep "temporary password" /var/log/mysqld.log | rev | cut -d' ' -f1 | rev) export MYSQL_PWD=$(grep "temporary password" /var/log/mysqld.log | rev | cut -d' ' -f1 | rev)
echo """ echo """
SET PASSWORD FOR 'root'@'localhost' = PASSWORD('Pandor4!'); SET PASSWORD FOR 'root'@'localhost' = PASSWORD('Pandor4!');
UNINSTALL PLUGIN validate_password; UNINSTALL PLUGIN validate_password;
SET PASSWORD FOR 'root'@'localhost' = PASSWORD('pandora'); SET PASSWORD FOR 'root'@'localhost' = PASSWORD('$DBROOTPASS');
""" | mysql --connect-expired-password -uroot """ | mysql --connect-expired-password -uroot &>> "$LOGFILE"
fi
export MYSQL_PWD=$DBPASS export MYSQL_PWD=$DBROOTPASS
echo -en "${cyan}Creating Pandora FMS database...${reset}" echo -en "${cyan}Creating Pandora FMS database...${reset}"
echo "create database $DBNAME" | mysql -uroot -P$DBPORT -h$DBHOST echo "create database $DBNAME" | mysql -uroot -P$DBPORT -h$DBHOST
check_cmd_status 'Error creating database pandora, is this an empty node? if you have a previus installation please contact with support.' check_cmd_status "Error creating database $DBNAME, is this an empty node? if you have a previus installation please contact with support."
echo "GRANT ALL PRIVILEGES ON $DBNAME.* TO \"$DBUSER\"@'%' identified by \"$DBPASS\"" | mysql -uroot -P$DBPORT -h$DBHOST echo "GRANT ALL PRIVILEGES ON $DBNAME.* TO \"$DBUSER\"@'%' identified by \"$DBPASS\"" | mysql -uroot -P$DBPORT -h$DBHOST
export MYSQL_PWD=$DBPASS
#Generating my.cnf #Generating my.cnf
POOL_SIZE=$(grep -i total /proc/meminfo | head -1 | awk '{printf "%.2f \n", $(NF-1)*0.4/1024}' | sed "s/\\..*$/M/g")
cat > /etc/my.cnf << EO_CONFIG_F cat > /etc/my.cnf << EO_CONFIG_F
[mysqld] [mysqld]
datadir=/var/lib/mysql datadir=/var/lib/mysql
@ -365,10 +428,10 @@ execute_cmd "systemctl restart mysqld" "Configuring database engine"
# Downloading Pandora Packages # Downloading Pandora Packages
execute_cmd "wget http://firefly.artica.es/pandorafms/latest/RHEL_CentOS/pandorafms_server-7.0NG.noarch.rpm" "Downloading Pandora FMS Server community" execute_cmd "wget http://firefly.artica.es/pandorafms/latest/RHEL_CentOS/pandorafms_server-7.0NG.noarch.rpm" "Downloading Pandora FMS Server community"
execute_cmd "wget http://firefly.artica.es/pandorafms/latest/RHEL_CentOS/pandorafms_console-7.0NG.noarch.rpm" "Downloading Pandora FMS Console community" execute_cmd "wget http://firefly.artica.es/pandorafms/latest/RHEL_CentOS/pandorafms_console-7.0NG.noarch.rpm" "Downloading Pandora FMS Console community"
execute_cmd "wget http://firefly.artica.es/centos7/pandorafms_agent_unix-7.0NG.751_x86_64.rpm" "Downloading Pandora FMS Agent community" execute_cmd "wget http://firefly.artica.es/pandorafms/latest/RHEL_CentOS/pandorafms_agent_unix-7.0NG.noarch.rpm" "Downloading Pandora FMS Agent community"
# Install Pandora # Install Pandora
execute_cmd "dnf install -y $HOME/pandora_deploy_tmp/pandorafms*.rpm" "installing PandoraFMS packages" execute_cmd "dnf install -y $HOME/pandora_deploy_tmp/pandorafms*.rpm" "Installing Pandora FMS packages"
# Copy gotty utility # Copy gotty utility
execute_cmd "wget https://github.com/yudai/gotty/releases/download/v1.0.1/gotty_linux_amd64.tar.gz" 'Dowloading gotty util' execute_cmd "wget https://github.com/yudai/gotty/releases/download/v1.0.1/gotty_linux_amd64.tar.gz" 'Dowloading gotty util'
@ -391,13 +454,13 @@ mysql -u$DBUSER -P$DBPORT -h$DBHOST $DBNAME < $PANDORA_CONSOLE/pandoradb_data.sq
check_cmd_status 'Error Loading database schema data' check_cmd_status 'Error Loading database schema data'
# Configure console # Configure console
cat > $CONSOLE_PATH/include/config.php << EO_CONFIG_F cat > $PANDORA_CONSOLE/include/config.php << EO_CONFIG_F
<?php <?php
\$config["dbtype"] = "mysql"; \$config["dbtype"] = "mysql";
\$config["dbname"]="$DBNAME"; \$config["dbname"]="$DBNAME";
\$config["dbuser"]="$DBUSER"; \$config["dbuser"]="$DBUSER";
\$config["dbpass"]="$DBPASS"; \$config["dbpass"]="$DBPASS";
\$config["dbhost"]="localhost"; \$config["dbhost"]="$DBHOST";
\$config["homedir"]="$PANDORA_CONSOLE"; \$config["homedir"]="$PANDORA_CONSOLE";
\$config["homeurl"]="/pandora_console"; \$config["homeurl"]="/pandora_console";
error_reporting(0); error_reporting(0);
@ -437,9 +500,9 @@ sed -i -e "s/php_flag engine off//g" $PANDORA_CONSOLE/images/.htaccess
sed -i -e "s/php_flag engine off//g" $PANDORA_CONSOLE/attachment/.htaccess sed -i -e "s/php_flag engine off//g" $PANDORA_CONSOLE/attachment/.htaccess
# Fixing console permissions # Fixing console permissions
chmod 600 $CONSOLE_PATH/include/config.php chmod 600 $PANDORA_CONSOLE/include/config.php
chown apache. $CONSOLE_PATH/include/config.php chown apache. $PANDORA_CONSOLE/include/config.php
mv $CONSOLE_PATH/install.php $CONSOLE_PATH/install.done mv $PANDORA_CONSOLE/install.php $PANDORA_CONSOLE/install.done &>> "$LOGFILE"
# Prepare php.ini # Prepare php.ini
sed -i -e "s/^max_input_time.*/max_input_time = -1/g" /etc/php.ini sed -i -e "s/^max_input_time.*/max_input_time = -1/g" /etc/php.ini
@ -466,6 +529,10 @@ 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/^dbuser.*/dbuser $DBUSER/g" $PANDORA_SERVER_CONF
sed -i -e "s|^dbpass.*|dbpass $DBPASS|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/^dbport.*/dbport $DBPORT/g" $PANDORA_SERVER_CONF
sed -i -e "s/^#.mssql_driver.*/mssql_driver $MS_ID/g" $PANDORA_SERVER_CONF
# Enable agent remote config
sed -i "s/^remote_config.*$/remote_config 1/g" $PANDORA_AGENT_CONF
# Set Oracle environment for pandora_server # Set Oracle environment for pandora_server
cat > /etc/pandora/pandora_server.env << 'EOF_ENV' cat > /etc/pandora/pandora_server.env << 'EOF_ENV'
@ -477,6 +544,8 @@ export ORACLE_HOME=/usr/lib/oracle/$VERSION/client64
EOF_ENV EOF_ENV
# Kernel optimization # Kernel optimization
if [ "$SKIP_KERNEL_OPTIMIZATIONS" -eq '0' ] ; then
cat >> /etc/sysctl.conf <<EO_KO cat >> /etc/sysctl.conf <<EO_KO
# Pandora FMS Optimization # Pandora FMS Optimization
@ -504,6 +573,7 @@ net.core.optmem_max = 81920
EO_KO EO_KO
[ -d /dev/lxd/ ] || execute_cmd "sysctl --system" "Applying Kernel optimization" [ -d /dev/lxd/ ] || execute_cmd "sysctl --system" "Applying Kernel optimization"
fi
# Fix pandora_server.{log,error} permissions to allow Console check them # Fix pandora_server.{log,error} permissions to allow Console check them
chown pandora:apache /var/log/pandora chown pandora:apache /var/log/pandora
@ -558,7 +628,7 @@ chmod 0644 /etc/logrotate.d/pandora_server
chmod 0644 /etc/logrotate.d/pandora_agent chmod 0644 /etc/logrotate.d/pandora_agent
# Add websocket engine start script. # Add websocket engine start script.
mv /var/www/html/pandora_console/pandora_websocket_engine /etc/init.d/ mv /var/www/html/pandora_console/pandora_websocket_engine /etc/init.d/ &>> "$LOGFILE"
chmod +x /etc/init.d/pandora_websocket_engine chmod +x /etc/init.d/pandora_websocket_engine
# Start Websocket engine # Start Websocket engine
@ -569,7 +639,7 @@ systemctl enable pandora_websocket_engine &>> "$LOGFILE"
# Enable pandora ha service # Enable pandora ha service
systemctl enable pandora_server --now &>> "$LOGFILE" systemctl enable pandora_server --now &>> "$LOGFILE"
execute_cmd "systemctl start pandora_server" "Starting Pandora FMS Server" execute_cmd "/etc/init.d/pandora_server start" "Starting Pandora FMS Server"
# starting tentacle server # starting tentacle server
systemctl enable tentacle_serverd &>> "$LOGFILE" systemctl enable tentacle_serverd &>> "$LOGFILE"
@ -580,7 +650,7 @@ execute_cmd "echo \"* * * * * root wget -q -O - --no-check-certificate http://12
echo "* * * * * root wget -q -O - --no-check-certificate http://127.0.0.1/pandora_console/enterprise/cron.php >> $PANDORA_CONSOLE/log/cron.log" >> /etc/crontab echo "* * * * * root wget -q -O - --no-check-certificate http://127.0.0.1/pandora_console/enterprise/cron.php >> $PANDORA_CONSOLE/log/cron.log" >> /etc/crontab
## Enabling agent ## Enabling agent
systemctl enable pandora_agent_daemon &>> "$LOGFILE" systemctl enable pandora_agent_daemon &>> "$LOGFILE"
execute_cmd "systemctl start pandora_agent_daemon" "starting Pandora FMS Agent" execute_cmd "systemctl start pandora_agent_daemon" "Starting Pandora FMS Agent"
#SSH banner #SSH banner
[ "$(curl -s ifconfig.me)" ] && ipplublic=$(curl -s ifconfig.me) [ "$(curl -s ifconfig.me)" ] && ipplublic=$(curl -s ifconfig.me)

View File

@ -1,14 +1,14 @@
#docker build -t pandorafms/pandorafms-open-base-el8 -f $HOME/code/pandorafms/extras/docker/centos8/base/Dockerfile $HOME/code/pandorafms/extras/docker/centos8/base/ #docker 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 #docker push pandorafms/pandorafms-open-base-el8
FROM centos:8 FROM rockylinux:8
RUN dnf install -y --setopt=tsflags=nodocs \ RUN dnf install -y --setopt=tsflags=nodocs \
epel-release \ epel-release \
dnf-utils \ dnf-utils \
http://rpms.remirepo.net/enterprise/remi-release-8.rpm http://rpms.remirepo.net/enterprise/remi-release-8.rpm
RUN dnf module reset -y php && dnf module install -y php:remi-7.3 RUN dnf module reset -y php && dnf module install -y php:remi-7.4
RUN dnf config-manager --set-enabled powertools RUN dnf config-manager --set-enabled powertools
# Install console dependencies # Install console dependencies

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 82 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 67 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 109 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

View File

@ -1,6 +1,6 @@
# Base config file for Pandora FMS Windows Agent # Base config file for Pandora FMS Windows Agent
# (c) 2006-2021 Artica Soluciones Tecnologicas # (c) 2006-2021 Artica Soluciones Tecnologicas
# Version 7.0NG.758 # Version 7.0NG.759
# This program is Free Software, you can redistribute it and/or modify it # This program is Free Software, you can redistribute it and/or modify it
# under the terms of the GNU General Public Licence as published by the Free Software # under the terms of the GNU General Public Licence as published by the Free Software
# Foundation; either version 2 of the Licence or any later version # Foundation; either version 2 of the Licence or any later version

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,5 +1,5 @@
package: pandorafms-agent-unix package: pandorafms-agent-unix
Version: 7.0NG.758-211108 Version: 7.0NG.759-220207
Architecture: all Architecture: all
Priority: optional Priority: optional
Section: admin Section: admin

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -47,4 +47,3 @@ License
The project is distributed under the GPL License v2 or later. The project is distributed under the GPL License v2 or later.
Copyright (C) 2004-2011 Pandora FMS development team Copyright (C) 2004-2011 Pandora FMS development team

View File

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

View File

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

View File

@ -2,8 +2,8 @@
#Pandora FMS Linux Agent #Pandora FMS Linux Agent
# #
%define name pandorafms_agent_unix %define name pandorafms_agent_unix
%define version 7.0NG.758 %define version 7.0NG.759
%define release 211108 %define release 220207
Summary: Pandora FMS Linux agent, PERL version Summary: Pandora FMS Linux agent, PERL version
Name: %{name} Name: %{name}

View File

@ -2,8 +2,8 @@
#Pandora FMS Linux Agent #Pandora FMS Linux Agent
# #
%define name pandorafms_agent_unix %define name pandorafms_agent_unix
%define version 7.0NG.758 %define version 7.0NG.759
%define release 211108 %define release 220207
Summary: Pandora FMS Linux agent, PERL version Summary: Pandora FMS Linux agent, PERL version
Name: %{name} Name: %{name}

View File

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

View File

@ -1,59 +0,0 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Fandora FMS - Generate SSH keys step-by-step</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="resource-type" content="document" />
<meta name="distribution" content="global" />
<meta name="author" content="Sancho Lerena, Raul Mateos and others" />
<meta
name="copyright"
content="This is GPL software. Created by Sancho Lerena and others"
/>
</head>
<body>
<center>
<img src="images/logo.png" alt="" />
</center>
<h2>Step-by-step generating SSH keys</h2>
From
<a
href="https://pandorafms.com/docs/index.php?title=Pandora:FAQ#How_to_generate_a_pair_of_SSH_keys_for_Pandora_Windows_agent.3F_.28SSH_Transfer_only.29"
>Pandora FMS FAQ</a
>.
<ol>
<li>
Go to <code>.\util</code> of your Pandora FMS agent for Windows and run
<code>puttygen.exe</code>.<br />
Generate keys, SSH-2_DSA, 1024:<br /><br />
<img src="images/1.jpg" /><br /><br />
</li>
<li>
Press Generate<br />
Export key to OpenSSH key (Cygwin uses a port of OpenSSH)<br /><br />
<img src="images/2.jpg" /><br /><br />
</li>
<li>
We have no chosen password, so press YES:<br /><br />
<img src="images/3.jpg" /><br /><br />
</li>
<li>
Save it as <code>c:\pandora\keys\id_dsa:</code><br /><br />
<img src="images/4.jpg" /><br /><br />
</li>
<li>
Now let's copy the public key to clipboard:<br /><br />
<img src="images/5.jpg" /><br /><br />
</li>
<li>
and paste it as <code>c:\pandora_agent\keys\id_dsa.pub</code>, and also
to the <code>/home/pandora/.ssh/authorized_keys</code> file.
<br /><br />
<img src="images/6.jpg" /><br /><br />
</li>
</ol>
</body>
</html>

View File

@ -1,62 +0,0 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>
Pandora FMS - Generación de claves SSH en Windows paso por paso
</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="resource-type" content="document" />
<meta name="distribution" content="global" />
<meta name="author" content="Sancho Lerena, Raul Mateos y otros" />
<meta
name="copyright"
content="This is GPL software. Created by Sancho Lerena and others"
/>
</head>
<body>
<center>
<img src="images/logo.png" alt="" />
</center>
<h2 class="print">Generación de claves SSH en Windows paso por paso</h2>
Extraído de las
<a
href="https://pandorafms.com/docs/index.php?title=Pandora:FAQ_ES#.C2.BFC.C3.B3mo_puedo_generar_un_par_de_claves_SHH_para_el_agente_para_Windows_.28SSH_Transfer.29_.3F"
>
FAQ</a
>.
<ol>
<li>
Desde el directorio <code>.\util</code> del agente Pandora FMS para
windows ejecutamos <code>puttygen.exe</code>.<br />
Generamos claves SSH-2_DSA, 1024:<br /><br />
<img src="images/1.jpg" /><br /><br />
</li>
<li>
Pulsamos «Generate» para generar la clave.<br />
Exportamos la clave a formato OpenSSH<br /><br />
<img src="images/2.jpg" /><br /><br />
</li>
<li>
No elegimos contraseña, con lo cual pulsamos «Sí»:<br /><br />
<img src="images/3.jpg" /><br /><br />
</li>
<li>
Guardamos la clave como <code>C:\pandora\keys\id_dsa:</code><br /><br />
<img src="images/4.jpg" /><br /><br />
</li>
<li>
Ahora copiamos la clave pública al portapapeles:<br /><br />
<img src="images/5.jpg" /><br /><br />
</li>
<li>
Pegamos la clave en un nuevo fichero
<code>C:\pandora_agent\keys\id_dsa.pub</code>, y debemos también
añadirla al fichero <code>/home/pandora/.ssh/authorized_keys</code>.
<br /><br />
<img src="images/6.jpg" /><br /><br />
</li>
</ol>
</body>
</html>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 82 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 67 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 109 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

View File

@ -1,6 +1,6 @@
# Base config file for Pandora FMS Windows Agent # Base config file for Pandora FMS Windows Agent
# (c) 2006-2021 Artica Soluciones Tecnologicas # (c) 2006-2021 Artica Soluciones Tecnologicas
# Version 7.0NG.758 # Version 7.0NG.759
# This program is Free Software, you can redistribute it and/or modify it # This program is Free Software, you can redistribute it and/or modify it
# under the terms of the GNU General Public Licence as published by the Free Software # under the terms of the GNU General Public Licence as published by the Free Software
# Foundation; either version 2 of the Licence or any later version # Foundation; either version 2 of the Licence or any later version

View File

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

View File

@ -30,7 +30,7 @@ using namespace Pandora;
using namespace Pandora_Strutils; using namespace Pandora_Strutils;
#define PATH_SIZE _MAX_PATH+1 #define PATH_SIZE _MAX_PATH+1
#define PANDORA_VERSION ("7.0NG.758 Build 211108") #define PANDORA_VERSION ("7.0NG.759 Build 220207")
string pandora_path; string pandora_path;
string pandora_dir; string pandora_dir;

View File

@ -11,7 +11,7 @@ BEGIN
VALUE "LegalCopyright", "Artica ST" VALUE "LegalCopyright", "Artica ST"
VALUE "OriginalFilename", "PandoraAgent.exe" VALUE "OriginalFilename", "PandoraAgent.exe"
VALUE "ProductName", "Pandora FMS Windows Agent" VALUE "ProductName", "Pandora FMS Windows Agent"
VALUE "ProductVersion", "(7.0NG.758(Build 211108))" VALUE "ProductVersion", "(7.0NG.759(Build 220207))"
VALUE "FileVersion", "1.0.0.0" VALUE "FileVersion", "1.0.0.0"
END END
END END

View File

@ -1,6 +1,9 @@
# pandora disable listing # pandora disable listing
Options -Indexes Options -Indexes
# Avoid clickjacking
Header always append X-Frame-Options SAMEORIGIN
<Files ~ "\.log$"> <Files ~ "\.log$">
Order Allow,Deny Order Allow,Deny
Deny from All Deny from All

View File

@ -1,5 +1,5 @@
package: pandorafms-console package: pandorafms-console
Version: 7.0NG.758-211108 Version: 7.0NG.759-220207
Architecture: all Architecture: all
Priority: optional Priority: optional
Section: admin Section: admin

View File

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

View File

@ -96,7 +96,6 @@ function agents_modules_load_js()
}); });
} }
else { else {
var agentes_id = $("#id_agents2").val(); var agentes_id = $("#id_agents2").val();
var id_agentes = getQueryParam("full_agents_id"); var id_agentes = getQueryParam("full_agents_id");
if (agentes_id === null && id_agentes !== null) { if (agentes_id === null && id_agentes !== null) {
@ -128,7 +127,6 @@ function agents_modules_load_js()
jQuery.each (data, function (id, value) { jQuery.each (data, function (id, value) {
// Remove keys_prefix from the index // Remove keys_prefix from the index
id = id.substring(1); id = id.substring(1);
option = $("<option></option>") option = $("<option></option>")
.attr ("value", value["id_agente"]) .attr ("value", value["id_agente"])
.html (value["alias"]); .html (value["alias"]);
@ -155,7 +153,6 @@ function agents_modules_load_js()
jQuery.each (data, function (id, value) { jQuery.each (data, function (id, value) {
// Remove keys_prefix from the index // Remove keys_prefix from the index
id = id.substring(1); id = id.substring(1);
option = $("<option></option>") option = $("<option></option>")
.attr ("value", value["id_agente"]) .attr ("value", value["id_agente"])
.html (value["alias"]); .html (value["alias"]);
@ -180,8 +177,8 @@ function agents_modules_load_js()
if(data){ if(data){
jQuery.each (data, function (id, value) { jQuery.each (data, function (id, value) {
option = $("<option></option>") option = $("<option></option>")
.attr ("value", value["id_agente_modulo"]) .attr ("value", id)
.html (value["nombre"]); .html (value);
$("#module").append (option); $("#module").append (option);
}); });
} }
@ -207,8 +204,8 @@ function agents_modules_load_js()
if(data){ if(data){
jQuery.each (data, function (id, value) { jQuery.each (data, function (id, value) {
option = $("<option></option>") option = $("<option></option>")
.attr ("value", value["id_agente_modulo"]) .attr ("value", id)
.html (value["nombre"]); .html (value);
$("#module").append (option); $("#module").append (option);
}); });
} }
@ -231,8 +228,8 @@ function agents_modules_load_js()
if(data){ if(data){
jQuery.each (data, function (id, value) { jQuery.each (data, function (id, value) {
option = $("<option></option>") option = $("<option></option>")
.attr ("value", value["id_agente_modulo"]) .attr ("value", id)
.html (value["nombre"]); .html (value);
$("#module").append (option); $("#module").append (option);
}); });
@ -262,7 +259,6 @@ function agents_modules_load_js()
return results[1]; return results[1];
} }
} }
</script> </script>
<?php <?php
} }

View File

@ -202,9 +202,7 @@ function extension_api_checker()
echo '</fieldset>'; echo '</fieldset>';
echo "<div class='right'>"; echo "<div class='right'>";
echo '</div>'; echo '</div>';
echo '</form>';
echo "<form method='post'>";
echo '<fieldset>'; echo '<fieldset>';
echo '<legend>'.__('Custom URL').'</legend>'; echo '<legend>'.__('Custom URL').'</legend>';
html_print_table($table3); html_print_table($table3);

View File

@ -131,7 +131,7 @@ if (!empty($files)) {
$config_url = ui_get_full_url( $config_url = ui_get_full_url(
'index.php?sec=godmode/extensions&sec2=extensions/files_repo&file_id='.$file_id 'index.php?sec=godmode/extensions&sec2=extensions/files_repo&file_id='.$file_id
); );
$data[4] .= '<a href=\"$config_url\">'; $data[4] .= "<a href=\"$config_url\">";
$data[4] .= html_print_image( $data[4] .= html_print_image(
'images/config.png', 'images/config.png',
true, true,

View File

@ -302,7 +302,7 @@ function mainModuleGroups()
$table->style[0] = 'color: #ffffff; background-color: #373737; font-weight: bolder; min-width: 230px;'; $table->style[0] = 'color: #ffffff; background-color: #373737; font-weight: bolder; min-width: 230px;';
$table->width = '100%'; $table->width = '100%';
if ($config['style'] === 'pandora_black') { if ($config['style'] === 'pandora_black' && !is_metaconsole()) {
$background_color = '#333'; $background_color = '#333';
} else { } else {
$background_color = '#fff'; $background_color = '#fff';
@ -351,7 +351,7 @@ function mainModuleGroups()
} }
$data[$i][$j] = "<div style='".$cell_style.'background:'.$color.";'>"; $data[$i][$j] = "<div style='".$cell_style.'background:'.$color.";'>";
$data[$i][$j] .= '<a class="info_cell white font_18px" rel="'.$rel.'" href="'.$url.'">'; $data[$i][$j] .= "<a class='info_cell white font_18px' rel='".$rel."' href='".$url."'>";
$data[$i][$j] .= $array_data[$key][$k]['total_count']; $data[$i][$j] .= $array_data[$key][$k]['total_count'];
$data[$i][$j] .= '</a></div>'; $data[$i][$j] .= '</a></div>';
} else { } else {

View File

@ -42,7 +42,7 @@ function pandora_realtime_graphs()
global $config; global $config;
check_login(); check_login();
if ($config['style'] === 'pandora_black') { if ($config['style'] === 'pandora_black' && !is_metaconsole()) {
ui_require_css_file('pandora_black', 'include/styles/', true); ui_require_css_file('pandora_black', 'include/styles/', true);
} }

View File

@ -206,7 +206,7 @@ function users_extension_main_god($god=true)
} }
extensions_add_operation_menu_option(__('Users connected'), 'workspace', 'users/icon.png', 'v1r1', '', 'UM'); extensions_add_operation_menu_option(__('Users connected'), 'workspace', 'users/icon.png', 'v1r1', null, 'UM');
extensions_add_godmode_function('users_extension_main_god'); extensions_add_godmode_function('users_extension_main_god');
extensions_add_main_function('users_extension_main'); extensions_add_main_function('users_extension_main');

View File

@ -112,3 +112,9 @@ enterprise/include/ajax/map_enterprise.ajax.php
enterprise/include/javascript/SimpleMapController.js enterprise/include/javascript/SimpleMapController.js
enterprise/include/javascript/tooltipster.bundle.min.js enterprise/include/javascript/tooltipster.bundle.min.js
enterprise/include/styles/tooltipster.bundle.min.css enterprise/include/styles/tooltipster.bundle.min.css
mobile/include/javascript/jquery.mobile-1.3.1.js
mobile/include/style/jquery.mobile-1.3.1.css
godmode/alerts/configure_alert_special_days.php
godmode/admin_access_logs.php
enterprise/extensions/backup/main.php
enterprise/extensions/backup.php

View File

@ -0,0 +1,99 @@
START TRANSACTION;
ALTER TABLE `tagente_modulo` ADD COLUMN `percentage_critical` tinyint(1) UNSIGNED DEFAULT 0;
ALTER TABLE `tagente_modulo` ADD COLUMN `percentage_warning` tinyint(1) UNSIGNED DEFAULT 0;
ALTER TABLE `tnetwork_component` ADD COLUMN `percentage_critical` tinyint(1) UNSIGNED DEFAULT 0;
ALTER TABLE `tnetwork_component` ADD COLUMN `percentage_warning` tinyint(1) UNSIGNED DEFAULT 0;
ALTER TABLE `tlocal_component` ADD COLUMN `percentage_critical` tinyint(1) UNSIGNED DEFAULT 0;
ALTER TABLE `tlocal_component` ADD COLUMN `percentage_warning` tinyint(1) UNSIGNED DEFAULT 0;
ALTER TABLE `tpolicy_modules` ADD COLUMN `percentage_warning` tinyint(1) UNSIGNED DEFAULT 0;
ALTER TABLE `tpolicy_modules` ADD COLUMN `percentage_critical` tinyint(1) UNSIGNED DEFAULT 0;
ALTER TABLE `tsync_queue` ADD COLUMN `result` TEXT;
ALTER TABLE tagente_modulo MODIFY debug_content TEXT;
CREATE TABLE IF NOT EXISTS `tncm_queue` (
`id` SERIAL,
`id_agent` INT(10) UNSIGNED NOT NULL,
`id_script` BIGINT(20) UNSIGNED NOT NULL,
`utimestamp` INT UNSIGNED NOT NULL,
`scheduled` INT UNSIGNED DEFAULT NULL,
FOREIGN KEY (`id_agent`) REFERENCES `tagente`(`id_agente`) ON UPDATE CASCADE ON DELETE CASCADE,
FOREIGN KEY (`id_script`) REFERENCES `tncm_script`(`id`) ON UPDATE CASCADE ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `tncm_snippet` (
`id` SERIAL,
`name` TEXT,
`content` TEXT,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `tncm_firmware` (
`id` SERIAL,
`name` varchar(255),
`shortname` varchar(255) unique,
`vendor` bigint(20) unsigned,
`models` text,
`path` text,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `talert_calendar` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(100) NOT NULL default '',
`id_group` INT(10) NOT NULL DEFAULT 0,
`description` text,
PRIMARY KEY (`id`),
UNIQUE (`name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `tipam_network_location` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(100) NOT NULL default '',
PRIMARY KEY (`id`),
UNIQUE (`name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `tipam_sites` (
`id` serial,
`name` varchar(100) UNIQUE NOT NULL default '',
`description` text,
`parent` bigint unsigned null,
PRIMARY KEY (`id`),
FOREIGN KEY (`parent`) REFERENCES `tipam_sites`(`id`) ON UPDATE CASCADE ON DELETE SET NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
INSERT IGNORE INTO `talert_calendar` VALUES (1, 'Default', 0, 'Default calendar');
INSERT IGNORE INTO `tipam_network_location` (`name`) SELECT `location` FROM `tipam_network` WHERE `location` <> '';
UPDATE `tipam_network` INNER JOIN `tipam_network_location` ON tipam_network_location.name=tipam_network.location SET tipam_network.location=tipam_network_location.id;
ALTER TABLE `tipam_network` MODIFY `location` int(10) unsigned NULL;
ALTER TABLE `tipam_network` ADD FOREIGN KEY (`location`) REFERENCES `tipam_network_location`(`id`) ON DELETE CASCADE;
ALTER TABLE `tagent_repository` ADD COLUMN `deployment_timeout` INT UNSIGNED DEFAULT 600 AFTER `path`;
ALTER TABLE `talert_special_days` ADD COLUMN `id_calendar` int(10) unsigned NOT NULL DEFAULT 1;
ALTER TABLE `talert_special_days` ADD COLUMN `day_code` tinyint(2) unsigned NOT NULL DEFAULT 0;
ALTER TABLE `talert_special_days` ADD FOREIGN KEY (`id_calendar`) REFERENCES `talert_calendar`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
ALTER TABLE `tipam_network` ADD COLUMN `id_site` bigint unsigned;
ALTER TABLE `tipam_network` ADD CONSTRAINT FOREIGN KEY (`id_site`) REFERENCES `tipam_sites`(`id`) ON DELETE SET NULL ON UPDATE CASCADE;
ALTER TABLE `tipam_supernet` ADD COLUMN `id_site` bigint unsigned;
ALTER TABLE `tipam_supernet` ADD CONSTRAINT FOREIGN KEY (`id_site`) REFERENCES `tipam_sites`(`id`) ON DELETE SET NULL ON UPDATE CASCADE;
ALTER TABLE `tipam_network` ADD COLUMN `vrf` int(10) unsigned;
ALTER TABLE `tipam_network` ADD CONSTRAINT FOREIGN KEY (`vrf`) REFERENCES `tagente`(`id_agente`) ON DELETE SET NULL ON UPDATE CASCADE;
ALTER TABLE `tncm_agent` ADD COLUMN `cron_interval` varchar(100) default '' AFTER `execute`;
ALTER TABLE `tncm_agent` ADD COLUMN `event_on_change` int unsigned default null AFTER `cron_interval`;
ALTER TABLE `tncm_vendor` ADD COLUMN `icon` VARCHAR(255) DEFAULT '';
ALTER TABLE `tevento` MODIFY COLUMN `event_type` ENUM('going_unknown','unknown','alert_fired','alert_recovered','alert_ceased','alert_manual_validation','recon_host_detected','system','error','new_agent','going_up_warning','going_up_critical','going_down_warning','going_down_normal','going_down_critical','going_up_normal', 'configuration_change', 'ncm') DEFAULT 'unknown';
UPDATE `talert_special_days` set `day_code` = 1 WHERE `same_day` = 'monday';
UPDATE `talert_special_days` set `day_code` = 2 WHERE `same_day` = 'tuesday';
UPDATE `talert_special_days` set `day_code` = 3 WHERE `same_day` = 'wednesday';
UPDATE `talert_special_days` set `day_code` = 4 WHERE `same_day` = 'thursday';
UPDATE `talert_special_days` set `day_code` = 5 WHERE `same_day` = 'friday';
UPDATE `talert_special_days` set `day_code` = 6 WHERE `same_day` = 'saturday';
UPDATE `talert_special_days` set `day_code` = 7 WHERE `same_day` = 'sunday';
ALTER TABLE `talert_special_days` DROP COLUMN `same_day`;
UPDATE `tconfig` c1 JOIN (select count(*) as n FROM `tconfig` c2 WHERE (c2.`token` = "node_metaconsole" AND c2.`value` = 1) OR (c2.`token` = "centralized_management" AND c2.`value` = 1) ) v SET c1. `value` = 0 WHERE c1.token = "autocreate_remote_users" AND v.n = 2;
COMMIT;

View File

@ -0,0 +1,6 @@
START TRANSACTION;
ALTER TABLE `tpolicy_queue` MODIFY COLUMN `progress` int(10) NOT NULL default '0';
CREATE INDEX `IDX_tservice_element` ON `tservice_element`(`id_service`,`id_agente_modulo`);
ALTER TABLE tevent_response ADD COLUMN display_command tinyint(1) default 0;
COMMIT;

View File

@ -172,6 +172,8 @@ ALTER TABLE tagente_modulo ADD COLUMN `dynamic_min` bigint(20) default '0';
ALTER TABLE tagente_modulo ADD COLUMN `prediction_sample_window` int(10) default 0; ALTER TABLE tagente_modulo ADD COLUMN `prediction_sample_window` int(10) default 0;
ALTER TABLE tagente_modulo ADD COLUMN `prediction_samples` int(4) default 0; ALTER TABLE tagente_modulo ADD COLUMN `prediction_samples` int(4) default 0;
ALTER TABLE tagente_modulo ADD COLUMN `prediction_threshold` int(4) default 0; ALTER TABLE tagente_modulo ADD COLUMN `prediction_threshold` int(4) default 0;
ALTER TABLE tagente_modulo ADD COLUMN `percentage_critical` tinyint(1) UNSIGNED DEFAULT 0;
ALTER TABLE tagente_modulo ADD COLUMN `percentage_warning` tinyint(1) UNSIGNED DEFAULT 0;
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
-- Table `tagente_estado` -- Table `tagente_estado`
@ -189,3 +191,21 @@ ALTER TABLE tgraph_source ADD COLUMN `id_server` int(11) NOT NULL default 0;
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
ALTER TABLE tevent_filter ADD COLUMN `id_agent_module` int(25) DEFAULT 0; ALTER TABLE tevent_filter ADD COLUMN `id_agent_module` int(25) DEFAULT 0;
ALTER TABLE tevent_filter ADD COLUMN `id_agent` int(25) DEFAULT 0; ALTER TABLE tevent_filter ADD COLUMN `id_agent` int(25) DEFAULT 0;
-- ---------------------------------------------------------------------
-- Table `tevent_filter`
-- ---------------------------------------------------------------------
ALTER TABLE `tnetwork_component` ADD COLUMN `percentage_critical` tinyint(1) UNSIGNED DEFAULT 0;
ALTER TABLE `tnetwork_component` ADD COLUMN `percentage_warning` tinyint(1) UNSIGNED DEFAULT 0;
-- ---------------------------------------------------------------------
-- Table `tevent_filter`
-- ---------------------------------------------------------------------
ALTER TABLE `tlocal_component` ADD COLUMN `percentage_critical` tinyint(1) UNSIGNED DEFAULT 0;
ALTER TABLE `tlocal_component` ADD COLUMN `percentage_warning` tinyint(1) UNSIGNED DEFAULT 0;
-- ---------------------------------------------------------------------
-- Table `tevent_filter`
-- ---------------------------------------------------------------------
ALTER TABLE `tpolicy_modules` ADD COLUMN `percentage_critical` tinyint(1) UNSIGNED DEFAULT 0;
ALTER TABLE `tpolicy_modules` ADD COLUMN `percentage_warning` tinyint(1) UNSIGNED DEFAULT 0;

View File

@ -480,7 +480,8 @@ CREATE TABLE IF NOT EXISTS `tservice_element` (
`id_agent` int(10) unsigned NOT NULL default 0, `id_agent` int(10) unsigned NOT NULL default 0,
`id_service_child` int(10) unsigned NOT NULL default 0, `id_service_child` int(10) unsigned NOT NULL default 0,
`id_server_meta` int(10) unsigned NOT NULL default 0, `id_server_meta` int(10) unsigned NOT NULL default 0,
PRIMARY KEY (`id`) PRIMARY KEY (`id`),
INDEX `IDX_tservice_element` (`id_service`,`id_agente_modulo`)
) ENGINE=InnoDB ) ENGINE=InnoDB
COMMENT = 'Table to define the modules and the weights of the modules that define a service' COMMENT = 'Table to define the modules and the weights of the modules that define a service'
DEFAULT CHARSET=utf8; DEFAULT CHARSET=utf8;
@ -578,7 +579,7 @@ CREATE TABLE IF NOT EXISTS `tpolicy_queue` (
`id_policy` int(10) unsigned NOT NULL default '0', `id_policy` int(10) unsigned NOT NULL default '0',
`id_agent` int(10) unsigned NOT NULL default '0', `id_agent` int(10) unsigned NOT NULL default '0',
`operation` varchar(15) default '', `operation` varchar(15) default '',
`progress` int(10) unsigned NOT NULL default '0', `progress` int(10) NOT NULL default '0',
`end_utimestamp` int(10) unsigned NOT NULL default 0, `end_utimestamp` int(10) unsigned NOT NULL default 0,
`priority` int(10) unsigned NOT NULL default '0', `priority` int(10) unsigned NOT NULL default '0',
PRIMARY KEY (`id`) PRIMARY KEY (`id`)
@ -1450,13 +1451,13 @@ ALTER TABLE `ttag` MODIFY COLUMN `name` text NOT NULL default '';
INSERT INTO `tconfig` (`token`, `value`) VALUES ('big_operation_step_datos_purge', '100'); INSERT INTO `tconfig` (`token`, `value`) VALUES ('big_operation_step_datos_purge', '100');
INSERT INTO `tconfig` (`token`, `value`) VALUES ('small_operation_step_datos_purge', '1000'); INSERT INTO `tconfig` (`token`, `value`) VALUES ('small_operation_step_datos_purge', '1000');
INSERT INTO `tconfig` (`token`, `value`) VALUES ('days_autodisable_deletion', '30'); INSERT INTO `tconfig` (`token`, `value`) VALUES ('days_autodisable_deletion', '30');
INSERT INTO `tconfig` (`token`, `value`) VALUES ('MR', 50); INSERT INTO `tconfig` (`token`, `value`) VALUES ('MR', 51);
INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_docs_logo', 'default_docs.png'); INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_docs_logo', 'default_docs.png');
INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_support_logo', 'default_support.png'); INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_support_logo', 'default_support.png');
INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_logo_white_bg_preview', 'pandora_logo_head_white_bg.png'); INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_logo_white_bg_preview', 'pandora_logo_head_white_bg.png');
UPDATE tconfig SET value = 'https://licensing.artica.es/pandoraupdate7/server.php' WHERE token='url_update_manager'; UPDATE tconfig SET value = 'https://licensing.artica.es/pandoraupdate7/server.php' WHERE token='url_update_manager';
DELETE FROM `tconfig` WHERE `token` = 'current_package_enterprise'; DELETE FROM `tconfig` WHERE `token` = 'current_package_enterprise';
INSERT INTO `tconfig` (`token`, `value`) VALUES ('current_package', 758); INSERT INTO `tconfig` (`token`, `value`) VALUES ('current_package', 759);
INSERT INTO `tconfig` (`token`, `value`) VALUES ('status_monitor_fields', 'policy,agent,data_type,module_name,server_type,interval,status,graph,warn,data,timestamp'); INSERT INTO `tconfig` (`token`, `value`) VALUES ('status_monitor_fields', 'policy,agent,data_type,module_name,server_type,interval,status,graph,warn,data,timestamp');
UPDATE `tconfig` SET `value` = 'mini_severity,evento,id_agente,estado,timestamp' WHERE `token` LIKE 'event_fields'; 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'; DELETE FROM `tconfig` WHERE `token` LIKE 'integria_api_password';
@ -1565,7 +1566,7 @@ ALTER TABLE `tagente_modulo` DROP COLUMN `ff_normal`,
MODIFY COLUMN `dynamic_next` bigint(20) NOT NULL DEFAULT '0', MODIFY COLUMN `dynamic_next` bigint(20) NOT NULL DEFAULT '0',
MODIFY COLUMN `dynamic_two_tailed` tinyint(1) unsigned NULL DEFAULT '0'; MODIFY COLUMN `dynamic_two_tailed` tinyint(1) unsigned NULL DEFAULT '0';
ALTER TABLE tagente_modulo MODIFY COLUMN `custom_string_1` MEDIUMTEXT; ALTER TABLE tagente_modulo MODIFY COLUMN `custom_string_1` MEDIUMTEXT;
ALTER TABLE `tagente_modulo` ADD COLUMN `debug_content` varchar(200); ALTER TABLE `tagente_modulo` ADD COLUMN `debug_content` TEXT;
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
-- Table `tagente_datos` -- Table `tagente_datos`
@ -2001,6 +2002,7 @@ ALTER TABLE `tserver` ADD COLUMN `port` int(5) unsigned NOT NULL default 0;
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
ALTER TABLE tevent_response ADD COLUMN server_to_exec int(10) unsigned NOT NULL DEFAULT 0; ALTER TABLE tevent_response ADD COLUMN server_to_exec int(10) unsigned NOT NULL DEFAULT 0;
ALTER TABLE tevent_response ADD COLUMN command_timeout int(5) unsigned NOT NULL DEFAULT 90; ALTER TABLE tevent_response ADD COLUMN command_timeout int(5) unsigned NOT NULL DEFAULT 90;
ALTER TABLE tevent_response ADD COLUMN display_command tinyint(1) DEFAULT 0;
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
-- Table `tmodule` -- Table `tmodule`
@ -2683,6 +2685,7 @@ CREATE TABLE `tagent_repository` (
`arch` ENUM('x64', 'x86') DEFAULT 'x64', `arch` ENUM('x64', 'x86') DEFAULT 'x64',
`version` VARCHAR(10) DEFAULT '', `version` VARCHAR(10) DEFAULT '',
`path` text, `path` text,
`deployment_timeout` INT UNSIGNED DEFAULT 600,
`uploaded_by` VARCHAR(100) DEFAULT '', `uploaded_by` VARCHAR(100) DEFAULT '',
`uploaded` bigint(20) NOT NULL DEFAULT 0 COMMENT "When it was uploaded", `uploaded` bigint(20) NOT NULL DEFAULT 0 COMMENT "When it was uploaded",
`last_err` text, `last_err` text,
@ -3969,15 +3972,20 @@ CREATE TABLE IF NOT EXISTS `tipam_network` (
`network` varchar(100) NOT NULL default '', `network` varchar(100) NOT NULL default '',
`name_network` varchar(255) default '', `name_network` varchar(255) default '',
`description` text NOT NULL, `description` text NOT NULL,
`location` tinytext NOT NULL, `location` int(10) unsigned NULL,
`id_recon_task` int(10) unsigned NOT NULL, `id_recon_task` int(10) unsigned NOT NULL,
`scan_interval` tinyint(2) default 1, `scan_interval` tinyint(2) default 1,
`monitoring` tinyint(2) default 0, `monitoring` tinyint(2) default 0,
`id_group` mediumint(8) unsigned NULL default 0, `id_group` mediumint(8) unsigned NULL default 0,
`lightweight_mode` tinyint(2) default 0, `lightweight_mode` tinyint(2) default 0,
`users_operator` text, `users_operator` text,
`id_site` bigint unsigned,
`vrf` int(10) unsigned,
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
FOREIGN KEY (`id_recon_task`) REFERENCES trecon_task(`id_rt`) ON DELETE CASCADE FOREIGN KEY (`id_recon_task`) REFERENCES trecon_task(`id_rt`) ON DELETE CASCADE,
FOREIGN KEY (`location`) REFERENCES `tipam_network_location`(`id`) ON DELETE CASCADE,
FOREIGN KEY (`id_site`) REFERENCES `tipam_sites`(`id`) ON DELETE SET NULL ON UPDATE CASCADE,
FOREIGN KEY (`vrf`) REFERENCES `tagente`(`id_agente`) ON DELETE SET NULL ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8; ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `tipam_ip` ( CREATE TABLE IF NOT EXISTS `tipam_ip` (
@ -4032,7 +4040,9 @@ CREATE TABLE IF NOT EXISTS `tipam_supernet` (
`address` varchar(250) NOT NULL, `address` varchar(250) NOT NULL,
`mask` varchar(250) NOT NULL, `mask` varchar(250) NOT NULL,
`subneting_mask` varchar(250) default '', `subneting_mask` varchar(250) default '',
PRIMARY KEY (`id`) `id_site` bigint unsigned,
PRIMARY KEY (`id`),
FOREIGN KEY (`id_site`) REFERENCES `tipam_sites`(`id`) ON DELETE SET NULL ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8; ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `tipam_supernet_network` ( CREATE TABLE IF NOT EXISTS `tipam_supernet_network` (
@ -4044,6 +4054,24 @@ CREATE TABLE IF NOT EXISTS `tipam_supernet_network` (
FOREIGN KEY (`id_network`) REFERENCES tipam_network(`id`) ON UPDATE CASCADE ON DELETE CASCADE FOREIGN KEY (`id_network`) REFERENCES tipam_network(`id`) ON UPDATE CASCADE ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8; ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `tipam_network_location` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(100) NOT NULL default '',
PRIMARY KEY (`id`),
UNIQUE (`name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `tipam_sites` (
`id` serial,
`name` varchar(100) UNIQUE NOT NULL default '',
`description` text,
`parent` bigint unsigned null,
PRIMARY KEY (`id`),
FOREIGN KEY (`parent`) REFERENCES `tipam_sites`(`id`) ON UPDATE CASCADE ON DELETE SET NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
INSERT IGNORE INTO `tipam_network_location` (`name`) SELECT `location` FROM `tipam_network` WHERE `location` <> '';
SET @insert_type = 3; SET @insert_type = 3;
SET @insert_name = 'IPAM Recon'; SET @insert_name = 'IPAM Recon';
SET @insert_description = 'This script is used to automatically detect network hosts availability and name, used as Recon Custom Script in the recon task. Parameters used are:\n\n* custom_field1 = network. i.e.: 192.168.100.0/24\n* custom_field2 = associated IPAM network id. i.e.: 4. Please do not change this value, it is assigned automatically in IPAM management.\n\nSee documentation for more information.'; SET @insert_description = 'This script is used to automatically detect network hosts availability and name, used as Recon Custom Script in the recon task. Parameters used are:\n\n* custom_field1 = network. i.e.: 192.168.100.0/24\n* custom_field2 = associated IPAM network id. i.e.: 4. Please do not change this value, it is assigned automatically in IPAM management.\n\nSee documentation for more information.';
@ -4076,6 +4104,7 @@ CREATE TABLE IF NOT EXISTS `tsync_queue` (
`operation` text, `operation` text,
`table` text, `table` text,
`error` MEDIUMTEXT, `error` MEDIUMTEXT,
`result` TEXT,
PRIMARY KEY (`id`) PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8; ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
@ -4108,6 +4137,7 @@ UPDATE `tlanguage` SET `name` = 'Deutsch' WHERE `id_language` = 'de';
CREATE TABLE IF NOT EXISTS `tncm_vendor` ( CREATE TABLE IF NOT EXISTS `tncm_vendor` (
`id` serial, `id` serial,
`name` varchar(255) UNIQUE, `name` varchar(255) UNIQUE,
`icon` VARCHAR(255) DEFAULT '',
PRIMARY KEY (`id`) PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8; ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
@ -4172,6 +4202,8 @@ CREATE TABLE IF NOT EXISTS `tncm_agent` (
`id_template` bigint(20) unsigned, `id_template` bigint(20) unsigned,
`execute_type` int(2) UNSIGNED NOT NULL default 0, `execute_type` int(2) UNSIGNED NOT NULL default 0,
`execute` int(2) UNSIGNED NOT NULL default 0, `execute` int(2) UNSIGNED NOT NULL default 0,
`cron_interval` varchar(100) default '',
`event_on_change` int unsigned default null,
`last_error` text, `last_error` text,
PRIMARY KEY (`id_agent`), PRIMARY KEY (`id_agent`),
FOREIGN KEY (`id_agent`) REFERENCES `tagente`(`id_agente`) ON UPDATE CASCADE ON DELETE CASCADE, FOREIGN KEY (`id_agent`) REFERENCES `tagente`(`id_agente`) ON UPDATE CASCADE ON DELETE CASCADE,
@ -4194,6 +4226,41 @@ CREATE TABLE IF NOT EXISTS `tncm_agent_data` (
FOREIGN KEY (`id_agent`) REFERENCES `tagente`(`id_agente`) ON UPDATE CASCADE ON DELETE CASCADE FOREIGN KEY (`id_agent`) REFERENCES `tagente`(`id_agente`) ON UPDATE CASCADE ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8; ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ----------------------------------------------------------------------
-- Table `tncm_queue`
-- ----------------------------------------------------------------------
CREATE TABLE IF NOT EXISTS `tncm_queue` (
`id` SERIAL,
`id_agent` INT(10) UNSIGNED NOT NULL,
`id_script` BIGINT(20) UNSIGNED NOT NULL,
`utimestamp` INT UNSIGNED NOT NULL,
`scheduled` INT UNSIGNED DEFAULT NULL,
FOREIGN KEY (`id_agent`) REFERENCES `tagente`(`id_agente`) ON UPDATE CASCADE ON DELETE CASCADE,
FOREIGN KEY (`id_script`) REFERENCES `tncm_script`(`id`) ON UPDATE CASCADE ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ----------------------------------------------------------------------
-- Table `tncm_snippet`
-- ----------------------------------------------------------------------
CREATE TABLE IF NOT EXISTS `tncm_snippet` (
`id` SERIAL,
`name` TEXT,
`content` TEXT,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ----------------------------------------------------------------------
-- Table `tncm_firmware`
-- ----------------------------------------------------------------------
CREATE TABLE IF NOT EXISTS `tncm_firmware` (
`id` SERIAL,
`name` varchar(255),
`shortname` varchar(255) unique,
`vendor` bigint(20) unsigned,
`models` text,
`path` text,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
INSERT INTO `tncm_vendor` VALUES INSERT INTO `tncm_vendor` VALUES
(1,'Cisco'), (1,'Cisco'),
@ -4220,6 +4287,36 @@ INSERT INTO `tncm_script` VALUES
(2,1,'enable&#x0d;&#x0a;expect:Password:&#92;s*&#x0d;&#x0a;_enablepass_&#x0d;&#x0a;term&#x20;length&#x20;0&#x0d;&#x0a;capture:show&#x20;running-config&#x0d;&#x0a;exit&#x0d;&#x0a;'), (2,1,'enable&#x0d;&#x0a;expect:Password:&#92;s*&#x0d;&#x0a;_enablepass_&#x0d;&#x0a;term&#x20;length&#x20;0&#x0d;&#x0a;capture:show&#x20;running-config&#x0d;&#x0a;exit&#x0d;&#x0a;'),
(3,2,'enable&#x0d;&#x0a;expect:Password:&#92;s*&#x0d;&#x0a;_enablepass_&#x0d;&#x0a;term&#x20;length&#x20;0&#x0d;&#x0a;config&#x20;terminal&#x0d;&#x0a;_applyconfigbackup_&#x0d;&#x0a;exit&#x0d;&#x0a;'), (3,2,'enable&#x0d;&#x0a;expect:Password:&#92;s*&#x0d;&#x0a;_enablepass_&#x0d;&#x0a;term&#x20;length&#x20;0&#x0d;&#x0a;config&#x20;terminal&#x0d;&#x0a;_applyconfigbackup_&#x0d;&#x0a;exit&#x0d;&#x0a;'),
(4,3,'enable&#x0d;&#x0a;expect:Password:&#92;s*&#x0d;&#x0a;_enablepass_&#x0d;&#x0a;term&#x20;length&#x20;0&#x0d;&#x0a;capture:show&#x20;version&#x20;|&#x20;i&#x20;IOS&#x20;Software&#x0d;&#x0a;exit&#x0d;&#x0a;'), (4,3,'enable&#x0d;&#x0a;expect:Password:&#92;s*&#x0d;&#x0a;_enablepass_&#x0d;&#x0a;term&#x20;length&#x20;0&#x0d;&#x0a;capture:show&#x20;version&#x20;|&#x20;i&#x20;IOS&#x20;Software&#x0d;&#x0a;exit&#x0d;&#x0a;'),
(5,5,'enable&#x0d;&#x0a;expect:Password:&#92;s*&#x0d;&#x0a;_enablepass_&#x0d;&#x0a;term&#x20;length&#x20;0&#x0d;&#x0a;config&#x20;term&#x0d;&#x0a;end&#x0d;&#x0a;end&#x0d;&#x0a;exit&#x0d;&#x0a;'); (5,5,'enable&#x0d;&#x0a;expect:Password:&#92;s*&#x0d;&#x0a;_enablepass_&#x0d;&#x0a;term&#x20;length&#x20;0&#x0d;&#x0a;config&#x20;term&#x0d;&#x0a;end&#x0d;&#x0a;end&#x0d;&#x0a;exit&#x0d;&#x0a;'),
(6,4,'copy&#x20;tftp&#x20;flash&#x0d;&#x0a;expect:&#92;]&#92;?&#x0d;&#x0a;_TFTP_SERVER_IP_&#x0d;&#x0a;expect:&#92;]&#92;?&#x0d;&#x0a;_SOURCE_FILE_NAME_&#x0d;&#x0a;expect:&#92;]&#92;?&#x0d;&#x0a;_DESTINATION_FILE_NAME_&#x0d;&#x0a;show&#x20;flash&#x0d;&#x0a;reload&#x0d;&#x0a;expect:confirm&#x0d;&#x0a;y&#x0d;&#x0a;config&#x20;terminal&#x0d;&#x0a;boot&#x20;system&#x20;_DESTINATION_FILE_NAME_');
INSERT INTO `tncm_template_scripts`(`id_template`, `id_script`) VALUES (1,1),(1,2),(1,3),(1,4),(1,5),(1,6);
INSERT INTO `tncm_template_scripts`(`id_template`, `id_script`) VALUES (1,1),(1,2),(1,3),(1,4),(1,5); -- ----------------------------------------------------------------------
-- Table `talert_calendar`
-- ----------------------------------------------------------------------
CREATE TABLE IF NOT EXISTS `talert_calendar` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(100) NOT NULL default '',
`id_group` INT(10) NOT NULL DEFAULT 0,
`description` text,
PRIMARY KEY (`id`),
UNIQUE (`name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
INSERT IGNORE INTO `talert_calendar` VALUES (1, 'Default', 0, 'Default calendar');
ALTER TABLE `talert_special_days` ADD COLUMN `id_calendar` int(10) unsigned NOT NULL DEFAULT 1;
ALTER TABLE `talert_special_days` ADD COLUMN `day_code` tinyint(2) unsigned NOT NULL DEFAULT 0;
UPDATE `talert_special_days` set `day_code` = 1 WHERE `same_day` = 'monday';
UPDATE `talert_special_days` set `day_code` = 2 WHERE `same_day` = 'tuesday';
UPDATE `talert_special_days` set `day_code` = 3 WHERE `same_day` = 'wednesday';
UPDATE `talert_special_days` set `day_code` = 4 WHERE `same_day` = 'thursday';
UPDATE `talert_special_days` set `day_code` = 5 WHERE `same_day` = 'friday';
UPDATE `talert_special_days` set `day_code` = 6 WHERE `same_day` = 'saturday';
UPDATE `talert_special_days` set `day_code` = 7 WHERE `same_day` = 'sunday';
ALTER TABLE `talert_special_days` DROP COLUMN `same_day`;
ALTER TABLE `talert_special_days` ADD FOREIGN KEY (`id_calendar`) REFERENCES `talert_calendar`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
UPDATE `tconfig` c1 JOIN (select count(*) as n FROM `tconfig` c2 WHERE (c2.`token` = "node_metaconsole" AND c2.`value` = 1) OR (c2.`token` = "centralized_management" AND c2.`value` = 1) ) v SET c1. `value` = 0 WHERE c1.token = "autocreate_remote_users" AND v.n = 2;

View File

@ -330,8 +330,30 @@ if ($config['enterprise_installed']) {
$reset_pass_link = 'reset_pass.php'; $reset_pass_link = 'reset_pass.php';
// Reset password link. // Reset password link.
echo '<div class="reset_password">'; echo '<div class="reset_password">';
if ((!$config['centralized_management'])) {
echo '<a href="index.php?reset=true&first=true">'.__('Forgot your password?'); echo '<a href="index.php?reset=true&first=true">'.__('Forgot your password?');
echo '</a>'; echo '</a>';
} else {
echo '<a href="javascript:centralized_mode_reset_dialog();">'.__('Forgot your password?');
echo '</a>';
echo '<div id="centralized_mode_reset_dialog" title="'.__('Password reset').'" style="display:none">';
echo '<div class="content_alert">';
echo '<div class="icon_message_alert">';
echo html_print_image('images/icono_stop.png', true, ['alt' => __('Password reset'), 'border' => 0]);
echo '</div>';
echo '<div class="content_message_alert">';
echo '<div class="text_message_alert">';
echo '<p>'.__('This node is configured with centralized mode. Go to metaconsole to reset the password').'</p>';
echo '</div>';
echo '<div class="button_message_alert">';
html_print_submit_button('Ok', 'centralized_mode_reset_button', false);
echo '</div>';
echo '</div>';
echo '</div>';
echo '</div>';
}
echo '</div>'; echo '</div>';
} }
} }
@ -826,5 +848,23 @@ html_print_div(['id' => 'forced_title_layer', 'class' => 'forced_title_layer', '
}); });
}); });
function centralized_mode_reset_dialog() {
$("#centralized_mode_reset_dialog").dialog({
resizable: true,
draggable: true,
modal: true,
height: 220,
width: 528,
overlay: {
opacity: 0.5,
background: "black"
}
});
$("#submit-centralized_mode_reset_button").click (function () {
$("#centralized_mode_reset_dialog").dialog('close');
});
}
/* ]]> */ /* ]]> */
</script> </script>

View File

@ -64,6 +64,8 @@ $data['monitor_critical'] = (int) $all_data['_monitors_critical_'];
$data['monitor_not_normal'] = (int) $all_data['_monitor_not_normal_']; $data['monitor_not_normal'] = (int) $all_data['_monitor_not_normal_'];
$data['monitor_alerts'] = (int) $all_data['_monitors_alerts_']; $data['monitor_alerts'] = (int) $all_data['_monitors_alerts_'];
$data['monitor_alerts_fired'] = (int) $all_data['_monitors_alerts_fired_']; $data['monitor_alerts_fired'] = (int) $all_data['_monitors_alerts_fired_'];
$data['monitor_total'] = (int) $all_data['_monitor_total_'];
$data['total_agents'] = (int) $all_data['_total_agents_']; $data['total_agents'] = (int) $all_data['_total_agents_'];

View File

@ -1,277 +0,0 @@
<?php
// Pandora FMS - http://pandorafms.com
// ==================================================
// Copyright (c) 2005-2021 Artica Soluciones Tecnologicas
// Please see http://pandorafms.org for full contribution list
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; version 2
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
global $config;
require_once $config['homedir'].'/include/functions_graph.php';
check_login();
$enterprise_include = enterprise_include_once('godmode/admin_access_logs.php');
if (! check_acl($config['id_user'], 0, 'PM')) {
db_pandora_audit('ACL Violation', 'Trying to access audit view');
include 'general/noaccess.php';
exit;
}
$offset = (int) get_parameter('offset');
$filter_type = (string) get_parameter('filter_type');
$filter_user = (string) get_parameter('filter_user');
$filter_text = (string) get_parameter('filter_text');
$filter_period = get_parameter('filter_period', null);
$filter_period = ($filter_period !== null) ? (int) $filter_period : 24;
$filter_ip = (string) get_parameter('filter_ip');
$filter_query = '&filter_type='.$filter_type.'&filter_user='.$filter_user.'&filter_text='.$filter_text.'&filter_period='.$filter_period.'&filter_ip='.$filter_ip;
$csv_url = ui_get_full_url(
false,
false,
false,
false
).'index.php?sec=gextensions&sec2=godmode/audit_log_csv'.$filter_query;
$csv_img = html_print_image(
'images/csv.png',
true,
[
'title' => __(
'Export to CSV'
),'class' => 'invert_filter',
]
);
$header_buttons = [
'csv' => [
'active' => false,
'text' => '<a href="'.$csv_url.'">'.$csv_img.'</a>',
],
];
ui_print_page_header(__('%s audit', get_product_name()).' &raquo; '.__('Review Logs'), 'images/gm_log.png', false, '', true, $header_buttons);
$table = new stdClass();
$table->class = 'databox filters';
$table->cellstyle = [];
$table->cellstyle[0] = [];
$table->cellstyle[1] = [];
$table->cellstyle[0][0] = 'text-align: right;';
$table->cellstyle[0][1] = 'text-align: left;';
$table->cellstyle[0][2] = 'text-align: right;';
$table->cellstyle[0][3] = 'text-align: left;';
$table->cellstyle[0][4] = 'text-align: right;';
$table->cellstyle[0][5] = 'text-align: left;';
$table->cellstyle[1][0] = 'text-align: right;';
$table->cellstyle[1][1] = 'text-align: left;';
$table->cellstyle[1][2] = 'text-align: right;';
$table->cellstyle[1][3] = 'text-align: left;';
$table->cellstyle[1][5] = 'text-align: right;';
$table->data = [];
$data = [];
$data[0] = '<b>'.__('Search').'</b>';
$data[1] = html_print_input_text('filter_text', $filter_text, __('Free text for search (*)'), 20, 40, true);
$data[2] = '<b>'.__('Max. hours old').'</b>';
$data[3] = html_print_input_text('filter_period', $filter_period, __('Max. hours old'), 3, 6, true);
$data[4] = '<b>'.__('IP').'</b>';
$data[5] = html_print_input_text('filter_ip', $filter_ip, __('IP'), 15, 15, true);
$table->data[0] = $data;
$data = [];
$actions_sql = 'SELECT DISTINCT(accion), accion AS text FROM tsesion';
$data[0] = '<b>'.__('Action').'</b>';
$data[1] = html_print_select_from_sql($actions_sql, 'filter_type', $filter_type, '', __('All'), '', true);
$users_sql = 'SELECT id_user, id_user AS text FROM tusuario';
$data[2] = '<b>'.__('User').'</b>';
$data[3] = html_print_select_from_sql($users_sql, 'filter_user', $filter_user, '', __('All'), '', true);
$data[4] = '';
$data[5] = html_print_submit_button(__('Filter'), 'filter', false, 'class="sub search"', true);
$table->data[1] = $data;
$form = '<form name="query_sel" method="post" action="index.php?sec=glog&sec2=godmode/admin_access_logs">';
$form .= html_print_table($table, true);
$form .= '</form>';
ui_toggle($form, __('Filter'), '', '', false);
$filter = '1=1';
if (!empty($filter_type)) {
$filter .= sprintf(" AND accion = '%s'", $filter_type);
}
if (!empty($filter_user)) {
$filter .= sprintf(" AND id_usuario = '%s'", $filter_user);
}
if (!empty($filter_text)) {
$filter .= sprintf(" AND (accion LIKE '%%%s%%' OR descripcion LIKE '%%%s%%')", $filter_text, $filter_text);
}
if (!empty($filter_ip)) {
$filter .= sprintf(" AND ip_origen LIKE '%%%s%%'", $filter_ip);
}
if (!empty($filter_period)) {
switch ($config['dbtype']) {
case 'mysql':
$filter .= ' AND fecha >= DATE_ADD(NOW(), INTERVAL -'.$filter_period.' HOUR)';
break;
case 'postgresql':
$filter .= ' AND fecha >= NOW() - INTERVAL \''.$filter_period.' HOUR \'';
break;
case 'oracle':
$filter .= ' AND fecha >= (SYSTIMESTAMP - INTERVAL \''.$filter_period.'\' HOUR)';
break;
}
}
$count_sql = sprintf('SELECT COUNT(*) FROM tsesion WHERE %s', $filter);
$count = (int) db_get_value_sql($count_sql);
$url = 'index.php?sec=godmode&sec2=godmode/admin_access_logs'.$filter_query;
ui_pagination($count, $url);
switch ($config['dbtype']) {
case 'mysql':
$sql = sprintf(
'SELECT *
FROM tsesion
WHERE %s
ORDER BY fecha DESC
LIMIT %d, %d',
$filter,
$offset,
$config['block_size']
);
break;
case 'postgresql':
$sql = sprintf(
'SELECT *
FROM tsesion
WHERE %s
ORDER BY fecha DESC
LIMIT %d OFFSET %d',
$filter,
$config['block_size'],
$offset
);
break;
case 'oracle':
$set = [];
$set['limit'] = $config['block_size'];
$set['offset'] = $offset;
$sql = sprintf(
'SELECT *
FROM tsesion
WHERE %s
ORDER BY fecha DESC',
$filter
);
$result = oracle_recode_query($sql, $set);
break;
}
$result = db_get_all_rows_sql($sql);
if (empty($result)) {
$result = [];
}
$table = new stdClass();
$table->cellpadding = 0;
$table->cellspacing = 0;
$table->width = '100%';
$table->class = 'info_table';
$table->size = [];
$table->data = [];
$table->head = [];
$table->align = [];
$table->rowclass = [];
$table->head[0] = __('User');
$table->head[1] = __('Action');
$table->head[2] = __('Date');
$table->head[3] = __('Source IP');
$table->head[4] = __('Comments');
if ($enterprise_include !== ENTERPRISE_NOT_HOOK) {
$table->head[5] = enterprise_hook('tableHeadEnterpriseAudit', ['title1']);
$table->head[6] = enterprise_hook('tableHeadEnterpriseAudit', ['title2']);
}
$table->size[0] = 80;
$table->size[2] = 130;
$table->size[3] = 100;
$table->size[4] = 200;
if ($enterprise_include !== ENTERPRISE_NOT_HOOK) {
$table->size[5] = enterprise_hook('tableHeadEnterpriseAudit', ['size1']);
$table->size[6] = enterprise_hook('tableHeadEnterpriseAudit', ['size2']);
$table->align[5] = enterprise_hook('tableHeadEnterpriseAudit', ['align']);
$table->align[6] = enterprise_hook('tableHeadEnterpriseAudit', ['align2']);
}
$table->colspan = [];
$table->rowstyle = [];
$rowPair = true;
$iterator = 0;
// Get data
foreach ($result as $row) {
$iterator++;
$table->rowclass[] = $rowPair ? 'rowPair' : 'rowOdd';
$rowPair = !$rowPair;
$data = [];
$data[0] = io_safe_output($row['id_usuario']);
$data[1] = ui_print_session_action_icon($row['accion'], true).$row['accion'];
$data[2] = ui_print_help_tip(date($config['date_format'], $row['utimestamp']), true).ui_print_timestamp($row['utimestamp'], true);
$data[3] = io_safe_output($row['ip_origen']);
$data[4] = io_safe_output($row['descripcion']);
if ($enterprise_include !== ENTERPRISE_NOT_HOOK) {
$data[5] = enterprise_hook('cell1EntepriseAudit', [$row['id_sesion']]);
$data[6] = enterprise_hook('cell2EntepriseAudit', [$row['id_sesion']]);
}
$table->data[] = $data;
if ($enterprise_include !== ENTERPRISE_NOT_HOOK) {
rowEnterpriseAudit($table, $iterator, $row['id_sesion']);
}
}
foreach ($table->rowclass as $key => $value) {
if (strpos($value, 'limit_scroll') !== false) {
$table->colspan[$key] = [7];
} else {
if ($enterprise_include !== ENTERPRISE_NOT_HOOK) {
$table->cellclass[$key][6] = 'action_buttons';
}
}
}
html_print_table($table);
ui_pagination($count, $url, 0, 0, false, 'offset', true, 'pagination-bottom');
if ($enterprise_include !== ENTERPRISE_NOT_HOOK) {
enterprise_hook('enterpriseAuditFooter');
}

View File

@ -103,10 +103,10 @@ if (is_ajax()) {
} else { } else {
$commons = array_intersect($out, $oid_snmp); $commons = array_intersect($out, $oid_snmp);
if ($get_common_modules) { if ($get_common_modules) {
// Common modules is selected (default) // Common modules is selected (default).
$out = $commons; $out = $commons;
} else { } else {
// All modules is selected // All modules is selected.
$array1 = array_diff($out, $oid_snmp); $array1 = array_diff($out, $oid_snmp);
$array2 = array_diff($oid_snmp, $out); $array2 = array_diff($oid_snmp, $out);
$out = array_merge($commons, $array1, $array2); $out = array_merge($commons, $array1, $array2);
@ -135,12 +135,12 @@ if (is_ajax()) {
'agents_update_secondary_groups', 'agents_update_secondary_groups',
[ [
$id_agent, $id_agent,
($add_secondary_groups) ? $groups_to_add : [], (($add_secondary_groups) ? $groups_to_add : []),
($remove_secondary_groups) ? $groups_to_add : [], (($remove_secondary_groups) ? $groups_to_add : []),
] ]
); );
// Echo 0 in case of error. 0 Otherwise. // Echo 0 in case of error. 0 Otherwise.
echo ($ret) ? 1 : 0; echo ((bool) $ret === true) ? 1 : 0;
} }
} }
@ -341,6 +341,7 @@ if (isset($groups[$grupo]) || $new_agent) {
'selected' => $grupo, 'selected' => $grupo,
'return' => true, 'return' => true,
'required' => true, 'required' => true,
'privilege' => 'AW',
] ]
); );
} else { } else {

View File

@ -96,6 +96,8 @@ if (isset($_POST['template_id'])) {
'str_critical' => $row2['str_critical'], 'str_critical' => $row2['str_critical'],
'critical_inverse' => $row2['critical_inverse'], 'critical_inverse' => $row2['critical_inverse'],
'warning_inverse' => $row2['warning_inverse'], 'warning_inverse' => $row2['warning_inverse'],
'percentage_warning' => $row2['percentage_warning'],
'percentage_critical' => $row2['percentage_critical'],
'critical_instructions' => $row2['critical_instructions'], 'critical_instructions' => $row2['critical_instructions'],
'warning_instructions' => $row2['warning_instructions'], 'warning_instructions' => $row2['warning_instructions'],
'unknown_instructions' => $row2['unknown_instructions'], 'unknown_instructions' => $row2['unknown_instructions'],

View File

@ -196,6 +196,13 @@ if ($create_agent) {
$nombre_agente = hash('sha256', $alias.'|'.$direccion_agente.'|'.time().'|'.sprintf('%04d', rand(0, 10000))); $nombre_agente = hash('sha256', $alias.'|'.$direccion_agente.'|'.time().'|'.sprintf('%04d', rand(0, 10000)));
$grupo = (int) get_parameter_post('grupo'); $grupo = (int) get_parameter_post('grupo');
if ((bool) check_acl($config['id_user'], $grupo, 'AW') === false) {
db_pandora_audit('ACL Violation', 'Trying to access agent manager');
include $config['homedir'].'/general/noaccess.php';
return;
}
$intervalo = (string) get_parameter_post('intervalo', SECONDS_5MINUTES); $intervalo = (string) get_parameter_post('intervalo', SECONDS_5MINUTES);
$comentarios = (string) get_parameter_post('comentarios', ''); $comentarios = (string) get_parameter_post('comentarios', '');
$modo = (int) get_parameter_post('modo'); $modo = (int) get_parameter_post('modo');
@ -990,6 +997,8 @@ if ($update_agent) {
$cps = get_parameter_switch('cps', -1); $cps = get_parameter_switch('cps', -1);
$old_values = db_get_row('tagente', 'id_agente', $id_agente); $old_values = db_get_row('tagente', 'id_agente', $id_agente);
$fields = db_get_all_fields_in_table('tagent_custom_fields'); $fields = db_get_all_fields_in_table('tagent_custom_fields');
$secondary_groups = (string) get_parameter('secondary_hidden', '');
if ($fields === false) { if ($fields === false) {
$fields = []; $fields = [];
@ -1069,8 +1078,11 @@ if ($update_agent) {
// If IP is set for deletion, delete first. // If IP is set for deletion, delete first.
if ($action_delete_ip) { if ($action_delete_ip) {
$delete_ip = get_parameter_post('address_list'); $delete_ip = get_parameter_post('address_list');
if (empty($direccion_agente) === true) {
$direccion_agente = agents_delete_address($id_agente, $delete_ip); $direccideon_agente = agents_delete_address($id_agente, $delete_ip);
} else {
agents_delete_address($id_agente, $delete_ip);
}
} }
$values = [ $values = [
@ -1219,7 +1231,16 @@ if ($update_agent) {
"Quiet":"'.(int) $quiet.'", "Quiet":"'.(int) $quiet.'",
"Cps":"'.(int) $cps.'"}'; "Cps":"'.(int) $cps.'"}';
enterprise_hook('update_agent', [$id_agente]); // Create the secondary groups.
enterprise_hook(
'agents_update_secondary_groups',
[
$id_agente,
explode(',', $secondary_groups),
[],
]
);
ui_print_success_message(__('Successfully updated')); ui_print_success_message(__('Successfully updated'));
db_pandora_audit( db_pandora_audit(
'Agent management', 'Agent management',
@ -1364,9 +1385,15 @@ if ($update_module || $create_module) {
$custom_integer_2_default = $module['custom_integer_2']; $custom_integer_2_default = $module['custom_integer_2'];
} }
if ($id_module_type == 25) { if ($id_module_type === 25) {
// Web analysis, from MODULE_WUX. // Web analysis, from MODULE_WUX.
$custom_string_1 = base64_encode((string) get_parameter('custom_string_1', $custom_string_1_default)); $custom_string_1 = base64_encode((string) get_parameter('custom_string_1'));
// If the custom_string_1 parameter come empty, set the content
// of the module (it is base64_encoded).
if (empty($custom_string_1) === true) {
$custom_string_1 = $custom_string_1_default;
}
$custom_integer_1 = (int) get_parameter('custom_integer_1', $custom_integer_1_default); $custom_integer_1 = (int) get_parameter('custom_integer_1', $custom_integer_1_default);
} else { } else {
$custom_string_1 = (string) get_parameter('custom_string_1', $custom_string_1_default); $custom_string_1 = (string) get_parameter('custom_string_1', $custom_string_1_default);
@ -1381,7 +1408,7 @@ if ($update_module || $create_module) {
$macros = (string) get_parameter('macros'); $macros = (string) get_parameter('macros');
$macros_names = (array) get_parameter('macro_name', []); $macros_names = (array) get_parameter('macro_name', []);
if (!empty($macros)) { if (empty($macros) === false) {
$macros = json_decode(base64_decode($macros), true); $macros = json_decode(base64_decode($macros), true);
foreach ($macros as $k => $m) { foreach ($macros as $k => $m) {
@ -1523,6 +1550,8 @@ if ($update_module || $create_module) {
$unknown_instructions = (string) get_parameter('unknown_instructions'); $unknown_instructions = (string) get_parameter('unknown_instructions');
$critical_inverse = (int) get_parameter('critical_inverse'); $critical_inverse = (int) get_parameter('critical_inverse');
$warning_inverse = (int) get_parameter('warning_inverse'); $warning_inverse = (int) get_parameter('warning_inverse');
$percentage_critical = (int) get_parameter('percentage_critical');
$percentage_warning = (int) get_parameter('percentage_warning');
$id_category = (int) get_parameter('id_category'); $id_category = (int) get_parameter('id_category');
@ -1584,6 +1613,15 @@ if ($update_module || $create_module) {
); );
} }
if ($prediction_module === MODULE_PREDICTION_PLANNING) {
$custom_string_2 = get_parameter('estimation_type', 'estimation_calculation');
if ($custom_string_2 === 'estimation_calculation') {
$custom_string_1 = get_parameter('estimation_days', -1);
} else {
$custom_string_1 = get_parameter('estimation_interval', '300');
}
}
$active_snmp_v3 = get_parameter('active_snmp_v3'); $active_snmp_v3 = get_parameter('active_snmp_v3');
/* /*
@ -1676,6 +1714,8 @@ if ($update_module) {
'unknown_instructions' => $unknown_instructions, 'unknown_instructions' => $unknown_instructions,
'critical_inverse' => $critical_inverse, 'critical_inverse' => $critical_inverse,
'warning_inverse' => $warning_inverse, 'warning_inverse' => $warning_inverse,
'percentage_critical' => $percentage_critical,
'percentage_warning' => $percentage_warning,
'cron_interval' => $cron_interval, 'cron_interval' => $cron_interval,
'id_category' => $id_category, 'id_category' => $id_category,
'disabled_types_event' => addslashes($disabled_types_event), 'disabled_types_event' => addslashes($disabled_types_event),
@ -1767,7 +1807,7 @@ if ($update_module) {
"Fail to try update module '".io_safe_output($name)."' for agent ".io_safe_output($agent['alias']) "Fail to try update module '".io_safe_output($name)."' for agent ".io_safe_output($agent['alias'])
); );
} else { } else {
if ($prediction_module == 3) { if ($prediction_module == MODULE_PREDICTION_SYNTHETIC) {
enterprise_hook( enterprise_hook(
'modules_create_synthetic_operations', 'modules_create_synthetic_operations',
[ [
@ -1882,6 +1922,8 @@ if ($create_module) {
'unknown_instructions' => $unknown_instructions, 'unknown_instructions' => $unknown_instructions,
'critical_inverse' => $critical_inverse, 'critical_inverse' => $critical_inverse,
'warning_inverse' => $warning_inverse, 'warning_inverse' => $warning_inverse,
'percentage_critical' => $percentage_critical,
'percentage_warning' => $percentage_warning,
'cron_interval' => $cron_interval, 'cron_interval' => $cron_interval,
'id_category' => $id_category, 'id_category' => $id_category,
'disabled_types_event' => addslashes($disabled_types_event), 'disabled_types_event' => addslashes($disabled_types_event),
@ -1910,7 +1952,7 @@ if ($create_module) {
} }
} }
if ($prediction_module == 3 && $serialize_ops == '') { if ($prediction_module == MODULE_PREDICTION_SYNTHETIC && $serialize_ops == '') {
$id_agent_module = false; $id_agent_module = false;
} else { } else {
$id_agent_module = modules_create_agent_module( $id_agent_module = modules_create_agent_module(
@ -1951,7 +1993,7 @@ if ($create_module) {
"Fail to try added module '".io_safe_output($name)."' for agent ".io_safe_output($agent['alias']) "Fail to try added module '".io_safe_output($name)."' for agent ".io_safe_output($agent['alias'])
); );
} else { } else {
if ($prediction_module == 3) { if ($prediction_module == MODULE_PREDICTION_SYNTHETIC) {
enterprise_hook( enterprise_hook(
'modules_create_synthetic_operations', 'modules_create_synthetic_operations',
[ [
@ -2386,7 +2428,7 @@ switch ($tab) {
var aget_id_os = '<?php echo agents_get_os(modules_get_agentmodule_agent(get_parameter('id_agent_module'))); ?>'; var aget_id_os = '<?php echo agents_get_os(modules_get_agentmodule_agent(get_parameter('id_agent_module'))); ?>';
if('<?php echo modules_get_agentmodule_name(get_parameter('id_agent_module')); ?>' != $('#text-name').val() && if('<?php echo io_safe_output(modules_get_agentmodule_name(get_parameter('id_agent_module'))); ?>' != $('#text-name').val() &&
'<?php echo agents_get_os(modules_get_agentmodule_agent(get_parameter('id_agent_module'))); ?>' == 19){ '<?php echo agents_get_os(modules_get_agentmodule_agent(get_parameter('id_agent_module'))); ?>' == 19){
event.preventDefault(); event.preventDefault();
@ -2420,7 +2462,7 @@ switch ($tab) {
var module_type_snmp = '<?php echo modules_get_agentmodule_type(get_parameter('id_agent_module')); ?>'; var module_type_snmp = '<?php echo modules_get_agentmodule_type(get_parameter('id_agent_module')); ?>';
if('<?php echo modules_get_agentmodule_name(get_parameter('id_agent_module')); ?>' != $('#text-name').val() && ( if('<?php echo io_safe_output(modules_get_agentmodule_name(get_parameter('id_agent_module'))); ?>' != $('#text-name').val() && (
module_type_snmp == 15 || module_type_snmp == 16 || module_type_snmp == 17 || module_type_snmp == 18)){ module_type_snmp == 15 || module_type_snmp == 16 || module_type_snmp == 17 || module_type_snmp == 18)){
event.preventDefault(); event.preventDefault();

View File

@ -144,7 +144,7 @@ if ($prediction_available) {
$modules['predictionserver'] = __('Create a new prediction server module'); $modules['predictionserver'] = __('Create a new prediction server module');
} }
if ($web_available) { if (is_metaconsole() === true || $web_available === '1') {
$modules['webserver'] = __('Create a new web Server module'); $modules['webserver'] = __('Create a new web Server module');
} }
@ -253,6 +253,7 @@ $module_action = (string) get_parameter('module_action');
if ($module_action === 'delete') { if ($module_action === 'delete') {
$id_agent_modules_delete = (array) get_parameter('id_delete'); $id_agent_modules_delete = (array) get_parameter('id_delete');
$print_result_msg = true;
$count_correct_delete_modules = 0; $count_correct_delete_modules = 0;
foreach ($id_agent_modules_delete as $id_agent_module_del) { foreach ($id_agent_modules_delete as $id_agent_module_del) {
$id_grupo = (int) agents_get_agent_group($id_agente); $id_grupo = (int) agents_get_agent_group($id_agente);
@ -268,12 +269,19 @@ if ($module_action === 'delete') {
} }
if ($id_agent_module_del < 1) { if ($id_agent_module_del < 1) {
db_pandora_audit( if (count($id_agent_modules_delete) === 1) {
'HACK Attempt', ui_print_error_message(
'Expected variable from form is not correct' __('No modules selected')
); );
die(__('Nice try buddy'));
exit; $print_result_msg = false;
} else {
ui_print_error_message(
__('There was a problem completing the operation')
);
}
continue;
} }
enterprise_include_once('include/functions_config_agents.php'); enterprise_include_once('include/functions_config_agents.php');
@ -421,6 +429,7 @@ if ($module_action === 'delete') {
} }
} }
if ($print_result_msg === true) {
$count_modules_to_delete = count($id_agent_modules_delete); $count_modules_to_delete = count($id_agent_modules_delete);
if ($count_correct_delete_modules == 0) { if ($count_correct_delete_modules == 0) {
ui_print_error_message( ui_print_error_message(
@ -442,6 +451,7 @@ if ($module_action === 'delete') {
); );
} }
} }
}
} else if ($module_action === 'disable') { } else if ($module_action === 'disable') {
$id_agent_modules_disable = (array) get_parameter('id_delete'); $id_agent_modules_disable = (array) get_parameter('id_delete');
@ -704,6 +714,8 @@ if ((bool) $checked === true) {
'quiet', 'quiet',
'critical_inverse', 'critical_inverse',
'warning_inverse', 'warning_inverse',
'percentage_critical',
'percentage_warning',
'id_policy_module', 'id_policy_module',
] ]
); );

View File

@ -99,6 +99,9 @@ if (is_ajax()) {
$component['str_critical'] = io_safe_output($component['str_critical']); $component['str_critical'] = io_safe_output($component['str_critical']);
$component['warning_inverse'] = (bool) $component['warning_inverse']; $component['warning_inverse'] = (bool) $component['warning_inverse'];
$component['critical_inverse'] = (bool) $component['critical_inverse']; $component['critical_inverse'] = (bool) $component['critical_inverse'];
$component['percentage_warning'] = (bool) $component['percentage_warning'];
$component['percentage_critical'] = (bool) $component['percentage_critical'];
echo io_json_mb_encode($component); echo io_json_mb_encode($component);
return; return;
@ -328,6 +331,9 @@ if ($id_agent_module) {
$critical_inverse = $module['critical_inverse']; $critical_inverse = $module['critical_inverse'];
$warning_inverse = $module['warning_inverse']; $warning_inverse = $module['warning_inverse'];
$percentage_critical = $module['percentage_critical'];
$percentage_warning = $module['percentage_warning'];
$id_category = $module['id_category']; $id_category = $module['id_category'];
@ -467,6 +473,8 @@ if ($id_agent_module) {
$critical_inverse = ''; $critical_inverse = '';
$warning_inverse = ''; $warning_inverse = '';
$percentage_critical = '';
$percentage_warning = '';
$each_ff = 0; $each_ff = 0;
$ff_event_normal = ''; $ff_event_normal = '';

View File

@ -98,7 +98,7 @@ function add_component_selection($id_network_component_type)
global $table_simple; global $table_simple;
global $config; global $config;
if ($config['style'] === 'pandora_black') { if ($config['style'] === 'pandora_black' && !is_metaconsole()) {
$background_row = 'background-color: #444'; $background_row = 'background-color: #444';
} else { } else {
$background_row = 'background-color: #cfcfcf'; $background_row = 'background-color: #cfcfcf';
@ -456,8 +456,16 @@ if (modules_is_string_type($id_module_type) || $edit) {
).'</span>'; ).'</span>';
} }
$table_simple->data[2][1] .= '<br /><em>'.__('Inverse interval').'</em>'; $table_simple->data[2][1] .= '<div id="warning_inverse"><em>'.__('Inverse interval').'</em>';
$table_simple->data[2][1] .= html_print_checkbox('warning_inverse', 1, $warning_inverse, true, $disabledBecauseInPolicy); $table_simple->data[2][1] .= html_print_checkbox('warning_inverse', 1, $warning_inverse, true, $disabledBecauseInPolicy);
$table_simple->data[2][1] .= '</div>';
if (modules_is_string_type($id_module_type) === false) {
$table_simple->data[2][1] .= '<div id="percentage_warning"><em>'.__('Percentage').'</em>';
$table_simple->data[2][1] .= html_print_checkbox('percentage_warning', 1, $percentage_warning, true, $disabledBecauseInPolicy);
$table_simple->data[2][1] .= ui_print_help_tip('Defines threshold as a percentage of value decrease/increment', true);
$table_simple->data[2][1] .= '</div>';
}
if (!modules_is_string_type($id_module_type) || $edit) { 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[2][2] = '<svg id="svg_dinamic" width="500" height="300"> </svg>';
@ -509,8 +517,17 @@ if (modules_is_string_type($id_module_type) || $edit) {
).'</span>'; ).'</span>';
} }
$table_simple->data[3][1] .= '<br /><em>'.__('Inverse interval').'</em>'; $table_simple->data[3][1] .= '<div id="critical_inverse"><em>'.__('Inverse interval').'</em>';
$table_simple->data[3][1] .= html_print_checkbox('critical_inverse', 1, $critical_inverse, true, $disabledBecauseInPolicy); $table_simple->data[3][1] .= html_print_checkbox('critical_inverse', 1, $critical_inverse, true, $disabledBecauseInPolicy);
$table_simple->data[3][1] .= '</div>';
if (modules_is_string_type($id_module_type) === false) {
$table_simple->data[3][1] .= '<div id="percentage_critical" /><em>'.__('Percentage').'</em>';
$table_simple->data[3][1] .= ui_print_help_tip('Defines threshold as a percentage of value decrease/increment', true);
$table_simple->data[3][1] .= html_print_checkbox('percentage_critical', 1, $percentage_critical, true, $disabledBecauseInPolicy);
$table_simple->data[3][1] .= '</div>';
}
$table_simple->data[4][0] = __('Historical data'); $table_simple->data[4][0] = __('Historical data');
if ($disabledBecauseInPolicy) { if ($disabledBecauseInPolicy) {
@ -1551,6 +1568,8 @@ $(document).ready (function () {
$('#minmax_critical').show(); $('#minmax_critical').show();
$('#minmax_warning').show(); $('#minmax_warning').show();
$('#svg_dinamic').show(); $('#svg_dinamic').show();
$('#percentage_warning').show();
$('#percentage_critical').show();
} }
else { else {
// String types // String types
@ -1559,6 +1578,8 @@ $(document).ready (function () {
$('#minmax_critical').hide(); $('#minmax_critical').hide();
$('#minmax_warning').hide(); $('#minmax_warning').hide();
$('#svg_dinamic').hide(); $('#svg_dinamic').hide();
$('#percentage_warning').hide();
$('#percentage_critical').hide();
} }
if (type_name_selected.match(/async/) == null) { if (type_name_selected.match(/async/) == null) {
@ -1628,11 +1649,64 @@ $(document).ready (function () {
$('#text-max_critical').val(0); $('#text-max_critical').val(0);
} }
}); });
if ($('#checkbox-warning_inverse').prop('checked') === true) {
$('#percentage_warning').hide();
}
if ($('#checkbox-critical_inverse').prop('checked') === true) {
$('#percentage_critical').hide();
}
if ($('#checkbox-percentage_warning').prop('checked') === true) {
$('#warning_inverse').hide();
}
if ($('#checkbox-percentage_critical').prop('checked') === true) {
$('#critical_inverse').hide();
}
$('#checkbox-warning_inverse').change (function() { $('#checkbox-warning_inverse').change (function() {
paint_graph_values(); paint_graph_values();
if ($('#checkbox-warning_inverse').prop('checked') === true){
$('#checkbox-percentage_warning').prop('checked', false);
$('#percentage_warning').hide();
} else {
$('#percentage_warning').show();
}
}); });
$('#checkbox-critical_inverse').change (function() { $('#checkbox-critical_inverse').change (function() {
paint_graph_values(); paint_graph_values();
if ($('#checkbox-critical_inverse').prop('checked') === true){
$('#checkbox-percentage_critical').prop('checked', false);
$('#percentage_critical').hide();
} else {
$('#percentage_critical').show();
}
});
$('#checkbox-percentage_warning').change (function() {
paint_graph_values();
if ($('#checkbox-percentage_warning').prop('checked') === true){
$('#checkbox-warning_inverse').prop('checked', false);
$('#warning_inverse').hide();
} else {
$('#warning_inverse').show();
}
});
$('#checkbox-percentage_critical').change (function() {
paint_graph_values();
if ($('#checkbox-percentage_critical').prop('checked') === true){
$('#checkbox-critical_inverse').prop('checked', false);
$('#critical_inverse').hide();
}
else {
$('#critical_inverse').show();
}
}); });
}); });
@ -1915,6 +1989,43 @@ function paint_graph_values(){
//messages error //messages error
var message_error_warning = '<?php echo __('Please introduce a maximum warning higher than the minimun warning'); ?>'; var message_error_warning = '<?php echo __('Please introduce a maximum warning higher than the minimun warning'); ?>';
var message_error_critical = '<?php echo __('Please introduce a maximum critical higher than the minimun critical'); ?>'; var message_error_critical = '<?php echo __('Please introduce a maximum critical higher than the minimun critical'); ?>';
var message_error_percentage = '<?php echo __('Please introduce a positive percentage value'); ?>';
//Percentage selector
var percentage_w = $('#checkbox-percentage_warning').prop('checked');
var percentage_c = $('#checkbox-percentage_critical').prop('checked');
if(percentage_w == true || percentage_c == true) {
d3.select("#svg_dinamic rect").remove();
//create svg
var svg = d3.select("#svg_dinamic");
svg.selectAll("g").remove();
if (percentage_w === true) {
if(max_w < 0 || min_w < 0) {
paint_graph_status(0,0,0,0,0,0,1,0,legend_normal,legend_warning,legend_critical,message_error_percentage,message_error_percentage);
} else {
$("#text-max_warning").removeClass("input_error");
$("#text-min_warning").removeClass("input_error");
}
}
if(percentage_c === true) {
if(max_c < 0 || min_c < 0) {
paint_graph_status(0,0,0,0,0,0,0,1,legend_normal,legend_warning,legend_critical,message_error_percentage,message_error_percentage);
} else {
$("#text-min-critical").removeClass("input_error");
$("#text-max_critical").removeClass("input_error");
}
}
return;
} else {
$('#svg_dinamic').show();
}
//if haven't error //if haven't error
if(max_w == 0 || max_w > min_w){ if(max_w == 0 || max_w > min_w){

View File

@ -14,6 +14,7 @@
enterprise_include_once('include/functions_policies.php'); enterprise_include_once('include/functions_policies.php');
enterprise_include_once('godmode/agentes/module_manager_editor_prediction.php'); enterprise_include_once('godmode/agentes/module_manager_editor_prediction.php');
require_once 'include/functions_agents.php'; require_once 'include/functions_agents.php';
ui_require_jquery_file('validate');
$disabledBecauseInPolicy = false; $disabledBecauseInPolicy = false;
$disabledTextBecauseInPolicy = ''; $disabledTextBecauseInPolicy = '';
@ -36,9 +37,9 @@ if ($row !== false && is_array($row)) {
// Services are an Enterprise feature. // Services are an Enterprise feature.
$custom_integer_1 = $row['custom_integer_1']; $custom_integer_1 = $row['custom_integer_1'];
switch ($prediction_module) { switch ((int) $prediction_module) {
case MODULE_PREDICTION_SERVICE: case MODULE_PREDICTION_SERVICE:
$is_service = true; $selected = 'service_selected';
$custom_integer_2 = 0; $custom_integer_2 = 0;
break; break;
@ -61,20 +62,33 @@ if ($row !== false && is_array($row)) {
if (isset($first_op[1]) && $first_op[1] == 'avg') { if (isset($first_op[1]) && $first_op[1] == 'avg') {
$is_synthetic_avg = true; $selected = 'synthetic_avg_selected';
} else { } else {
$is_synthetic = true; $selected = 'synthetic_selected';
} }
$custom_integer_1 = 0; $custom_integer_1 = 0;
$custom_integer_2 = 0; $custom_integer_2 = 0;
break; break;
case MODULE_PREDICTION_TRENDING:
$selected = 'trending_selected';
$prediction_module = $custom_integer_1;
break;
case MODULE_PREDICTION_PLANNING:
$selected = 'capacity_planning';
$prediction_module = $custom_integer_1;
$estimation_interval = $custom_string_1;
$estimation_type = $custom_string_2;
break;
default: default:
$prediction_module = $custom_integer_1; $prediction_module = $custom_integer_1;
break; break;
} }
} else { } else {
$selected = 'capacity_planning';
$custom_integer_1 = 0; $custom_integer_1 = 0;
} }
@ -97,7 +111,7 @@ $data[0] = __('Source module');
$data[0] .= ui_print_help_icon('prediction_source_module', true); $data[0] .= ui_print_help_icon('prediction_source_module', true);
$data[1] = ''; $data[1] = '';
// Services and Synthetic are an Enterprise feature. // Services and Synthetic are an Enterprise feature.
$module_service_synthetic_selector = enterprise_hook('get_module_service_synthetic_selector', [$is_service, $is_synthetic, $is_synthetic_avg]); $module_service_synthetic_selector = enterprise_hook('get_module_service_synthetic_selector', [$selected]);
if ($module_service_synthetic_selector !== ENTERPRISE_NOT_HOOK) { if ($module_service_synthetic_selector !== ENTERPRISE_NOT_HOOK) {
$data[1] = $module_service_synthetic_selector; $data[1] = $module_service_synthetic_selector;
@ -112,16 +126,17 @@ $data[1] = '<div id="module_data" class="w50p float-left top-1em">';
$data[1] .= html_print_label(__('Agent'), 'agent_name', true).'<br/>'; $data[1] .= html_print_label(__('Agent'), 'agent_name', true).'<br/>';
// Get module and agent of the target prediction module // Get module and agent of the target prediction module
if (!empty($prediction_module)) { if (empty($prediction_module) === false) {
$id_agente_clean = modules_get_agentmodule_agent($prediction_module); $id_agente_clean = modules_get_agentmodule_agent($prediction_module);
$prediction_module_agent = modules_get_agentmodule_agent_name($prediction_module); $prediction_module_agent = modules_get_agentmodule_agent_name($prediction_module);
$agent_name_clean = $prediction_module_agent; $agent_name_clean = $prediction_module_agent;
$agent_alias = agents_get_alias($id_agente_clean);
} else { } else {
$id_agente_clean = $id_agente; $id_agente_clean = 0;
$agent_name_clean = $agent_name; $agent_name_clean = '';
$agent_alias = '';
} }
$agent_alias = agents_get_alias($id_agente_clean);
$params = []; $params = [];
$params['return'] = true; $params['return'] = true;
@ -135,7 +150,8 @@ $params['use_hidden_input_idagent'] = true;
$params['hidden_input_idagent_id'] = 'hidden-id_agente_module_prediction'; $params['hidden_input_idagent_id'] = 'hidden-id_agente_module_prediction';
$data[1] .= ui_print_agent_autocomplete_input($params); $data[1] .= ui_print_agent_autocomplete_input($params);
$data[1] .= html_print_label(__('Module'), 'prediction_module', true); $data[1] .= '<br />';
$data[1] .= html_print_label(__('Module'), 'prediction_module', true).'<br />';
if ($id_agente) { if ($id_agente) {
$sql = 'SELECT id_agente_modulo, nombre $sql = 'SELECT id_agente_modulo, nombre
FROM tagente_modulo FROM tagente_modulo
@ -143,19 +159,23 @@ if ($id_agente) {
AND history_data = 1 AND history_data = 1
AND id_agente = '.$id_agente_clean.' AND id_agente = '.$id_agente_clean.'
AND id_agente_modulo <> '.$id_agente_modulo; AND id_agente_modulo <> '.$id_agente_modulo;
$data[1] .= html_print_select_from_sql(
$sql, $data[1] .= html_print_input(
'prediction_module', [
$prediction_module, 'type' => 'select_from_sql',
false, 'sql' => $sql,
__('Select Module'), 'name' => 'prediction_module',
0, 'selected' => $prediction_module,
true 'nothing' => __('Select Module'),
'nothing_value' => 0,
'return' => true,
]
); );
} else { } else {
$data[1] .= '<select id="prediction_module" name="custom_integer_1" disabled="disabled"><option value="0">Select an Agent first</option></select>'; $data[1] .= '<select id="prediction_module" name="custom_integer_1" disabled="disabled"><option value="0">Select an Agent first</option></select>';
} }
$data[1] .= '<br />';
$data[1] .= html_print_label(__('Period'), 'custom_integer_2', true).'<br/>'; $data[1] .= html_print_label(__('Period'), 'custom_integer_2', true).'<br/>';
$periods[0] = __('Weekly'); $periods[0] = __('Weekly');
@ -169,6 +189,56 @@ $data[1] .= '</div>';
$table_simple->colspan['prediction_module'][1] = 3; $table_simple->colspan['prediction_module'][1] = 3;
push_table_simple($data, 'prediction_module'); push_table_simple($data, 'prediction_module');
$data = [];
$data[0] = '';
$data[1] .= html_print_label(__('Calculation type'), 'estimation_type', true).'<br/>';
$data[1] .= html_print_input(
[
'type' => 'select',
'return' => 'true',
'name' => 'estimation_type',
'class' => 'w250px',
'fields' => [
'estimation_absolute' => __('Estimated absolute value'),
'estimation_calculation' => __('Calculation of days to reach limit'),
],
'selected' => $estimation_type,
],
'div',
false
);
$data[1] .= '<div id="estimation_interval_row">';
$data[1] .= html_print_label(__('Future estimation'), 'estimation_interval', true).'<br/>';
$data[1] .= html_print_input(
[
'type' => 'interval',
'return' => 'true',
'name' => 'estimation_interval',
'value' => $estimation_interval,
],
'div',
false
);
$data[1] .= '</div>';
$data[1] .= '<div id="estimation_days_row">';
$data[1] .= html_print_label(__('Limit value'), 'estimation_days', true).'<br/>';
$data[1] .= html_print_input(
[
'type' => 'number',
'return' => 'true',
'id' => 'estimation_days',
'name' => 'estimation_days',
'value' => $estimation_interval,
]
);
$data[1] .= '</div>';
push_table_simple($data, 'capacity_planning');
// Services are an Enterprise feature. // Services are an Enterprise feature.
$selector_form = enterprise_hook('get_selector_form', [$custom_integer_1]); $selector_form = enterprise_hook('get_selector_form', [$custom_integer_1]);
if ($selector_form !== ENTERPRISE_NOT_HOOK) { if ($selector_form !== ENTERPRISE_NOT_HOOK) {
@ -187,10 +257,20 @@ if ($synthetic_module_form !== ENTERPRISE_NOT_HOOK) {
$data[0] = ''; $data[0] = '';
$data[1] = $synthetic_module_form; $data[1] = $synthetic_module_form;
$table_simple->colspan['synthetic_module'][1] = 3;
push_table_simple($data, 'synthetic_module'); push_table_simple($data, 'synthetic_module');
} }
$trending_module_form = enterprise_hook('get_trending_module_form', [$custom_string_1]);
if ($trending_module_form !== ENTERPRISE_NOT_HOOK) {
$data = [];
$data[0] = '';
$data[1] .= $trending_module_form;
push_table_simple($data, 'trending_module');
}
// Netflow modules are an Enterprise feature. // Netflow modules are an Enterprise feature.
$netflow_module_form = enterprise_hook('get_netflow_module_form', [$custom_integer_1]); $netflow_module_form = enterprise_hook('get_netflow_module_form', [$custom_integer_1]);
if ($netflow_module_form !== ENTERPRISE_NOT_HOOK) { if ($netflow_module_form !== ENTERPRISE_NOT_HOOK) {
@ -214,9 +294,7 @@ unset($table_advanced->data[3]);
enterprise_hook( enterprise_hook(
'setup_services_synth', 'setup_services_synth',
[ [
$is_service, $selected,
$is_synthetic,
$is_synthetic_avg,
$is_netflow, $is_netflow,
$ops, $ops,
] ]

View File

@ -62,7 +62,9 @@ html_print_div(
] ]
); );
require_once $config['homedir'].'/include/ajax/web_server_module_debug.php'; if (is_int($id_agent_module) && $id_agent_module !== 0) {
include_once $config['homedir'].'/include/ajax/web_server_module_debug.php';
}
define('ID_NETWORK_COMPONENT_TYPE', 7); define('ID_NETWORK_COMPONENT_TYPE', 7);

View File

@ -135,6 +135,7 @@ $first_create = (int) get_parameter('first_create');
$create_downtime = (int) get_parameter('create_downtime'); $create_downtime = (int) get_parameter('create_downtime');
$update_downtime = (int) get_parameter('update_downtime'); $update_downtime = (int) get_parameter('update_downtime');
$edit_downtime = (int) get_parameter('edit_downtime'); $edit_downtime = (int) get_parameter('edit_downtime');
$downtime_copy = (int) get_parameter('downtime_copy');
$id_downtime = (int) get_parameter('id_downtime'); $id_downtime = (int) get_parameter('id_downtime');
$id_agent = (int) get_parameter('id_agent'); $id_agent = (int) get_parameter('id_agent');
@ -250,6 +251,7 @@ if ($create_downtime || $update_downtime) {
} else if ($type_execution == 'periodically' } else if ($type_execution == 'periodically'
&& $type_periodicity == 'monthly' && $type_periodicity == 'monthly'
&& $periodically_day_from == $periodically_day_to && $periodically_day_from == $periodically_day_to
&& $periodically_time_from >= $periodically_time_to
) { ) {
ui_print_error_message( ui_print_error_message(
__('Not created. Error inserting data').'. '.__('The end time must be higher than the start time') __('Not created. Error inserting data').'. '.__('The end time must be higher than the start time')
@ -419,6 +421,16 @@ if ($create_downtime || $update_downtime) {
} }
} }
if ($downtime_copy) {
$result = planned_downtimes_copy($id_downtime);
if ($result['id_downtime'] !== false) {
$id_downtime = $result['id_downtime'];
ui_print_success_message($result['success']);
} else {
ui_print_error_message(__($result['error']));
}
}
// Have any data to show ? // Have any data to show ?
if ($id_downtime > 0) { if ($id_downtime > 0) {
// Columns of the table tplanned_downtime. // Columns of the table tplanned_downtime.
@ -946,9 +958,7 @@ if (empty($downtimes_agents)) {
if (!$running) { if (!$running) {
$data[5] = ''; $data[5] = '';
if ($type_downtime != 'disable_agents_alerts' if ($type_downtime !== 'disable_agents') {
&& $type_downtime != 'disable_agents'
) {
$data[5] = '<a href="javascript:show_editor_module('.$downtime_agent['id_agente'].');">'.html_print_image('images/config.png', true, ['border' => '0', 'alt' => __('Delete'), 'class' => 'invert_filter']).'</a>'; $data[5] = '<a href="javascript:show_editor_module('.$downtime_agent['id_agente'].');">'.html_print_image('images/config.png', true, ['border' => '0', 'alt' => __('Delete'), 'class' => 'invert_filter']).'</a>';
} }

View File

@ -405,6 +405,7 @@ else {
if ($write_permisson || $manage_permisson) { if ($write_permisson || $manage_permisson) {
$table->head['stop'] = __('Stop downtime'); $table->head['stop'] = __('Stop downtime');
$table->head['copy'] = __('Copy');
$table->head['edit'] = __('Edit'); $table->head['edit'] = __('Edit');
$table->head['delete'] = __('Delete'); $table->head['delete'] = __('Delete');
} }
@ -492,6 +493,8 @@ else {
if (check_acl_restricted_all($config['id_user'], $downtime['id_group'], 'AW') if (check_acl_restricted_all($config['id_user'], $downtime['id_group'], 'AW')
|| check_acl_restricted_all($config['id_user'], $downtime['id_group'], 'AD') || check_acl_restricted_all($config['id_user'], $downtime['id_group'], 'AD')
) { ) {
// Copy.
$data['copy'] = '<a href="index.php?sec=extensions&sec2=godmode/agentes/planned_downtime.editor&downtime_copy=1&id_downtime='.$downtime['id'].'">'.html_print_image('images/copy.png', true, ['title' => __('Copy'), 'class' => 'invert_filter']).'</a>';
// Edit. // Edit.
$data['edit'] = '<a href="index.php?sec=extensions&sec2=godmode/agentes/planned_downtime.editor&edit_downtime=1&id_downtime='.$downtime['id'].'">'.html_print_image('images/config.png', true, ['title' => __('Update'), 'class' => 'invert_filter']).'</a>'; $data['edit'] = '<a href="index.php?sec=extensions&sec2=godmode/agentes/planned_downtime.editor&edit_downtime=1&id_downtime='.$downtime['id'].'">'.html_print_image('images/config.png', true, ['title' => __('Update'), 'class' => 'invert_filter']).'</a>';
// Delete. // Delete.
@ -504,6 +507,8 @@ else {
if (check_acl_restricted_all($config['id_user'], $downtime['id_group'], 'AW') if (check_acl_restricted_all($config['id_user'], $downtime['id_group'], 'AW')
|| check_acl_restricted_all($config['id_user'], $downtime['id_group'], 'AD') || check_acl_restricted_all($config['id_user'], $downtime['id_group'], 'AD')
) { ) {
// Copy.
$data['copy'] = '<a href="index.php?sec=extensions&sec2=godmode/agentes/planned_downtime.editor&downtime_copy=1&id_downtime='.$downtime['id'].'">'.html_print_image('images/copy.png', true, ['title' => __('Copy'), 'class' => 'invert_filter']).'</a>';
// Edit. // Edit.
$data['edit'] = '<a href="index.php?sec=extensions&sec2=godmode/agentes/planned_downtime.editor&edit_downtime=1&id_downtime='.$downtime['id'].'">'.html_print_image('images/config.png', true, ['title' => __('Update'), 'class' => 'invert_filter']).'</a>'; $data['edit'] = '<a href="index.php?sec=extensions&sec2=godmode/agentes/planned_downtime.editor&edit_downtime=1&id_downtime='.$downtime['id'].'">'.html_print_image('images/config.png', true, ['title' => __('Update'), 'class' => 'invert_filter']).'</a>';
// Delete. // Delete.
@ -513,11 +518,13 @@ else {
$data['delete'] = ''; $data['delete'] = '';
} }
} else { } else {
$data['copy'] = '';
$data['edit'] = ''; $data['edit'] = '';
$data['delete'] = ''; $data['delete'] = '';
} }
} else { } else {
$data['stop'] = ''; $data['stop'] = '';
$data['copy'] = '';
$data['edit'] = ''; $data['edit'] = '';
$data['delete'] = ''; $data['delete'] = '';
} }

View File

@ -235,7 +235,7 @@ $search_string = (string) get_parameter('search_string', '');
$group = (int) get_parameter('group', 0); $group = (int) get_parameter('group', 0);
$group_search = (int) get_parameter('group_search', 0); $group_search = (int) get_parameter('group_search', 0);
$id_command_search = (int) get_parameter('id_command_search', 0); $id_command_search = (int) get_parameter('id_command_search', 0);
$url = 'index.php?sec='.$sec.'&sec2=godmode/alerts/alert_actions'; $url = 'index.php?sec='.$sec.'&sec2=godmode/alerts/alert_actions&search_string='.$search_string.'&group_search='.$group_search.'&id_command_search='.$id_command_search;
// Filter table. // Filter table.
$table_filter = new stdClass(); $table_filter = new stdClass();

View File

@ -34,6 +34,7 @@ require_once $config['homedir'].'/include/functions_modules.php';
require_once $config['homedir'].'/include/functions_users.php'; require_once $config['homedir'].'/include/functions_users.php';
$pure = get_parameter('pure', 0); $pure = get_parameter('pure', 0);
$agent_id = get_parameter('agent_id', 0);
if (defined('METACONSOLE')) { if (defined('METACONSOLE')) {
$sec = 'advanced'; $sec = 'advanced';
@ -74,6 +75,11 @@ $params['input_name'] = 'agent_name';
$params['value'] = $agentName; $params['value'] = $agentName;
$params['size'] = 24; $params['size'] = 24;
$params['metaconsole_enabled'] = false; $params['metaconsole_enabled'] = false;
$params['use_hidden_input_idagent'] = true;
$params['print_hidden_input_idagent'] = true;
$params['hidden_input_idagent_id'] = 'hidden-autocomplete_id_agent';
$params['hidden_input_idagent_name'] = 'agent_id';
$params['hidden_input_idagent_value'] = $agent_id;
$form_filter .= ui_print_agent_autocomplete_input($params); $form_filter .= ui_print_agent_autocomplete_input($params);
@ -234,7 +240,7 @@ if ($searchFlag) {
$id_agents = array_keys($agents); $id_agents = array_keys($agents);
$total = agents_get_alerts_simple( $total = agents_get_alerts_simple(
$id_agents, (empty($agent_id) === false) ? ['0' => $agent_id] : $id_agents,
false, false,
false, false,
$where, $where,
@ -412,7 +418,7 @@ if ($id_agente) {
$offset = (int) get_parameter('offset'); $offset = (int) get_parameter('offset');
$simple_alerts = agents_get_alerts_simple( $simple_alerts = agents_get_alerts_simple(
$id_agents, (empty($agent_id) === false) ? ['0' => $agent_id] : $id_agents,
false, false,
[ [
'offset' => $offset, 'offset' => $offset,
@ -688,7 +694,7 @@ foreach ($simple_alerts as $alert) {
$data[3] .= '</tr>'; $data[3] .= '</tr>';
} }
$data[3] .= '<div id="update_action-div" class="invisible left">'; $data[3] .= '<div id="update_action-div-'.$alert['id'].'" class="invisible">';
$data[3] .= '</div>'; $data[3] .= '</div>';
$data[3] .= '</table>'; $data[3] .= '</table>';
// Is possible manage actions if have LW permissions in the agent group of the alert module // Is possible manage actions if have LW permissions in the agent group of the alert module
@ -706,9 +712,9 @@ foreach ($simple_alerts as $alert) {
$actions = alerts_get_alert_actions_filter(true, 'id_group IN ('.$filter_groups.')'); $actions = alerts_get_alert_actions_filter(true, 'id_group IN ('.$filter_groups.')');
} }
$data[3] .= '<div id="add_action-div-'.$alert['id'].'" class="invisible left">'; $data[3] .= '<div id="add_action-div-'.$alert['id'].'" class="invisible">';
$data[3] .= '<form id="add_action_form-'.$alert['id'].'" method="post">'; $data[3] .= '<form id="add_action_form-'.$alert['id'].'" method="post" style="height:85%;">';
$data[3] .= '<table class="databox_color w100p bg_color222">'; $data[3] .= '<table class="databox_color w100p bg_color222" style="height:100%;">';
$data[3] .= html_print_input_hidden('add_action', 1, true); $data[3] .= html_print_input_hidden('add_action', 1, true);
$data[3] .= html_print_input_hidden('id_alert_module', $alert['id'], true); $data[3] .= html_print_input_hidden('id_alert_module', $alert['id'], true);
@ -1127,13 +1133,14 @@ function show_add_action(id_alert) {
background: "black" background: "black"
}, },
open: function() { open: function() {
$("#action_select, #action_select").select2({ $(`#add_action-div-${id_alert}`).css('overflow', 'hidden');
$("select[id^='action_select'], select[id^='action_select']").select2({
tags: true, tags: true,
dropdownParent: $("#add_action-div-" + id_alert) dropdownParent: $("#add_action-div-" + id_alert)
}); });
}, },
width: 500, width: 455,
height: 300 height: 500
}) })
.show (); .show ();
} }
@ -1151,8 +1158,8 @@ function show_display_update_action(id_module_action, alert_id, alert_id_agent_m
type: 'POST', type: 'POST',
url: action="<?php echo ui_get_full_url('ajax.php', false, false, false); ?>", url: action="<?php echo ui_get_full_url('ajax.php', false, false, false); ?>",
success: function (data) { success: function (data) {
$("#update_action-div").html (data); $(`#update_action-div-${alert_id}`).html (data);
$("#update_action-div").hide () $(`#update_action-div-${alert_id}`).hide ()
.dialog ({ .dialog ({
resizable: true, resizable: true,
draggable: true, draggable: true,
@ -1163,18 +1170,18 @@ function show_display_update_action(id_module_action, alert_id, alert_id_agent_m
background: "black" background: "black"
}, },
open: function() { open: function() {
$("#action_select_ajax, #action_select_ajax").select2({ $(`#update_action-div-${alert_id}`).css('overflow', 'hidden');
$(`#action_select_ajax-${alert_id}`).select2({
tags: true, tags: true,
dropdownParent: $("#update_action-div") dropdownParent: $(`#update_action-div-${alert_id}`)
}); });
}, },
width: 500, width: 455,
height: 300 height: 500
}) })
.show (); .show ();
} }
}); });
} }
/* ]]> */ /* ]]> */

View File

@ -270,7 +270,8 @@ if ($add_action) {
} }
if ($update_action) { if ($update_action) {
$id_action = (int) get_parameter('action_select_ajax'); $alert_id = (int) get_parameter('alert_id');
$id_action = (int) get_parameter('action_select_ajax-'.$alert_id);
$id_module_action = (int) get_parameter('id_module_action_ajax'); $id_module_action = (int) get_parameter('id_module_action_ajax');
$fires_min = (int) get_parameter('fires_min_ajax'); $fires_min = (int) get_parameter('fires_min_ajax');
$fires_max = (int) get_parameter('fires_max_ajax'); $fires_max = (int) get_parameter('fires_max_ajax');

View File

@ -1,577 +1,75 @@
<?php <?php
/**
* Calendar controller.
*
* @category Alerts
* @package Pandora FMS
* @subpackage Community
* @version 1.0.0
* @license See below
*
* ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2005-2021 Artica Soluciones Tecnologicas
* Please see http://pandorafms.org for full contribution list
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation for version 2.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* ============================================================================
*/
// Pandora FMS - http://pandorafms.com // Begin.
// ==================================================
// Copyright (c) 2005-2021 Artica Soluciones Tecnologicas
// Copyright (c) 2012-2016 Junichi Satoh
// Please see http://pandorafms.org for full contribution list
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation for version 2.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Load global vars
global $config; global $config;
require_once 'include/functions_alerts.php'; require_once $config['homedir'].'/vendor/autoload.php';
require_once 'include/ics-parser/class.iCalReader.php'; require_once $config['homedir'].'/include/class/CalendarManager.class.php';
check_login(); use PandoraFMS\CalendarManager;
if (! check_acl($config['id_user'], 0, 'LM')) { $ajaxPage = 'godmode/alerts/alert_special_days';
db_pandora_audit( $url = 'index.php?sec=galertas&sec2=godmode/alerts/alert_special_days';
'ACL Violation',
'Trying to access Alert Management' // Control call flow.
); try {
include 'general/noaccess.php'; // User access and validation is being processed on class constructor.
$cs = new CalendarManager($url, $ajaxPage);
} catch (Exception $e) {
if ((bool) is_ajax() === true) {
echo json_encode(['error' => '[CalendarManager]'.$e->getMessage() ]);
exit; exit;
} else {
echo '[CalendarManager]'.$e->getMessage();
} }
if (is_ajax()) { // Stop this execution, but continue 'globally'.
$get_alert_command = (bool) get_parameter('get_alert_command');
if ($get_alert_command) {
$id = (int) get_parameter('id');
$command = alerts_get_alert_command($id);
echo json_encode($command);
}
return; return;
} }
// Header // AJAX controller.
ui_print_page_header( if ((bool) is_ajax() === true) {
__('Alerts').' &raquo; '.__('Special days list'), $method = get_parameter('method');
'images/gm_alerts.png',
false,
'alert_special_days',
true
);
$update_special_day = (bool) get_parameter('update_special_day'); if (method_exists($cs, $method) === true) {
$create_special_day = (bool) get_parameter('create_special_day'); if (CalendarManager::ajaxMethod($method) === true) {
$delete_special_day = (bool) get_parameter('delete_special_day'); $cs->{$method}();
$upload_ical = (bool) get_parameter('upload_ical', 0);
$display_range = (int) get_parameter('display_range');
if ($upload_ical) {
$same_day = (string) get_parameter('same_day');
$overwrite = (bool) get_parameter('overwrite', 0);
$values = [];
$values['id_group'] = (string) get_parameter('id_group');
$values['same_day'] = $same_day;
$error = $_FILES['ical_file']['error'];
$extension = substr($_FILES['ical_file']['name'], -3);
if ($error == 0 && strcasecmp($extension, 'ics') == 0) {
$skipped_dates = '';
// $today = date ('Ymd');
$this_month = date('Ym');
$ical = new ICal($_FILES['ical_file']['tmp_name']);
$events = $ical->events();
foreach ($events as $event) {
$event_date = substr($event['DTSTART'], 0, 8);
$event_month = substr($event['DTSTART'], 0, 6);
if ($event_month >= $this_month) {
$values['description'] = @$event['SUMMARY'];
$values['date'] = $event_date;
$date = date('Y-m-d', strtotime($event_date));
$date_check = '';
$filter['id_group'] = $values['id_group'];
$filter['date'] = $date;
$date_check = db_get_value_filter('date', 'talert_special_days', $filter);
if ($date_check == $date) {
if ($overwrite) {
$id_special_day = db_get_value_filter('id', 'talert_special_days', $filter);
alerts_update_alert_special_day($id_special_day, $values);
} else { } else {
if ($skipped_dates == '') { $cs->error('Unavailable method.');
$skipped_dates = __('Skipped dates: ');
}
$skipped_dates .= $date.' ';
} }
} else { } else {
alerts_create_alert_special_day($date, $same_day, $values); $cs->error('Method not found. ['.$method.']');
}
}
} }
$result = true; // Stop any execution.
exit;
} else { } else {
$result = false; // Run.
$cs->run();
} }
if ($result) {
db_pandora_audit('Special days list', 'Upload iCalendar '.$_FILES['ical_file']['name']);
}
ui_print_result_message($result, __('Success to upload iCalendar').'<br />'.$skipped_dates, __('Fail to upload iCalendar'));
}
if ($create_special_day) {
$date = (string) get_parameter('date');
$same_day = (string) get_parameter('same_day');
$values = [];
$values['id_group'] = (string) get_parameter('id_group');
$values['description'] = io_safe_input(strip_tags(io_safe_output((string) get_parameter('description'))));
$aviable_description = true;
if (preg_match('/script/i', $values['description'])) {
$aviable_description = false;
}
$array_date = explode('-', $date);
$year = $array_date[0];
$month = $array_date[1];
$day = $array_date[2];
if ($year == '*') {
// '0001' means every year.
$year = '0001';
$date = $year.'-'.$month.'-'.$day;
}
if (!checkdate($month, $day, $year)) {
$result = '';
} else {
$date_check = '';
$filter['id_group'] = $values['id_group'];
$filter['date'] = $date;
$date_check = db_get_value_filter('date', 'talert_special_days', $filter);
if ($date_check == $date) {
$result = '';
$messageAction = __('Could not be created, it already exists');
} else {
if ($aviable_description) {
$result = alerts_create_alert_special_day($date, $same_day, $values);
$info = '{"Date":"'.$date.'","Same day of the week":"'.$same_day.'","Description":"'.$values['description'].'"}';
} else {
$result = false;
}
}
}
if ($result) {
db_pandora_audit('Command management', 'Create special day '.$result, false, false, $info);
} else {
db_pandora_audit('Command management', 'Fail try to create special day', false, false);
}
// Show errors
if (!isset($messageAction)) {
$messageAction = __('Could not be created');
}
$messageAction = ui_print_result_message(
$result,
__('Successfully created'),
$messageAction
);
}
if ($update_special_day) {
$id = (int) get_parameter('id');
$alert = alerts_get_alert_special_day($id);
$date = (string) get_parameter('date');
$date_orig = (string) get_parameter('date_orig');
$same_day = (string) get_parameter('same_day');
$description = io_safe_input(strip_tags(io_safe_output((string) get_parameter('description'))));
$id_group = (string) get_parameter('id_group');
$id_group_orig = (string) get_parameter('id_group_orig');
$aviable_description = true;
if (preg_match('/script/i', $description)) {
$aviable_description = false;
}
$array_date = explode('-', $date);
$year = $array_date[0];
$month = $array_date[1];
$day = $array_date[2];
if ($year == '*') {
// '0001' means every year.
$year = '0001';
$date = $year.'-'.$month.'-'.$day;
}
$values = [];
$values['date'] = $date;
$values['id_group'] = $id_group;
$values['same_day'] = $same_day;
$values['description'] = $description;
if (!checkdate($month, $day, $year)) {
$result = '';
} else {
if ($id_group != $id_group_orig || $date != $date_orig) {
$date_check = '';
$filter['id_group'] = $id_group;
$filter['date'] = $date;
$date_check = db_get_value_filter('date', 'talert_special_days', $filter);
if ($date_check == $date) {
$result = '';
$messageAction = __('Could not be updated, it already exists');
} else {
if ($aviable_description !== false) {
$result = alerts_update_alert_special_day($id, $values);
$info = '{"Date":"'.$date.'","Same day of the week":"'.$same_day.'","Description":"'.$description.'"}';
}
}
} else {
if ($aviable_description !== false) {
$result = alerts_update_alert_special_day($id, $values);
$info = '{"Date":"'.$date.'","Same day of the week":"'.$same_day.'","Description":"'.$description.'"}';
}
}
}
if ($result) {
db_pandora_audit('Command management', 'Update special day '.$id, false, false, $info);
} else {
db_pandora_audit('Command management', 'Fail to update special day '.$id, false, false);
}
// Show errors
if (!isset($messageAction)) {
$messageAction = __('Could not be updated');
}
$messageAction = ui_print_result_message(
$result,
__('Successfully updated'),
$messageAction
);
}
if ($delete_special_day) {
$id = (int) get_parameter('id');
$result = alerts_delete_alert_special_day($id);
if ($result) {
db_pandora_audit('Command management', 'Delete special day '.$id);
} else {
db_pandora_audit('Command management', 'Fail to delete special day '.$id);
}
ui_print_result_message(
$result,
__('Successfully deleted'),
__('Could not be deleted')
);
}
echo "<table cellpadding='4' cellspacing='4' class='databox upload bolder margin-bottom-10' width='100%
'><tr>";
echo "<form method='post' enctype='multipart/form-data' action='index.php?sec=gagente&sec2=godmode/alerts/alert_special_days'>";
echo '<td>';
echo __('iCalendar(.ics) file').'&nbsp;';
html_print_input_file('ical_file', false, false);
echo '</td><td>';
echo __('Same day of the week');
$days = [];
$days['monday'] = __('Monday');
$days['tuesday'] = __('Tuesday');
$days['wednesday'] = __('Wednesday');
$days['thursday'] = __('Thursday');
$days['friday'] = __('Friday');
$days['saturday'] = __('Saturday');
$days['sunday'] = __('Sunday');
html_print_select($days, 'same_day', $same_day, '', '', 0, false, false, false);
echo '</td><td>';
echo __('Group').'&nbsp;';
$own_info = get_user_info($config['id_user']);
if (!users_can_manage_group_all('LM')) {
$can_manage_group_all = false;
} else {
$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);
echo '&nbsp;';
html_print_checkbox('overwrite', 1, $overwrite, false, false, false, true);
echo '</td><td>';
html_print_input_hidden('upload_ical', 1);
echo "<input name='srcbutton' type='submit' class='sub next' value='".__('Upload')."'>";
echo '</td></form>';
echo '</tr></table>';
$this_year = date('Y');
$this_month = date('m');
$filter = [];
if (!is_user_admin($config['id_user'])) {
$filter['id_group'] = array_keys(users_get_groups(false, 'LM'));
}
// Show display range.
$html = "<table cellpadding='4' cellspacing='4' width='100%' margin-bottom: 10px;'><tr><td>".__('Display range: ');
if ($display_range) {
$html .= '<a href="index.php?sec=galertas&sec2=godmode/alerts/alert_special_days">['.__('Default').']</a>&nbsp;&nbsp;';
if ($display_range > 1970) {
$html .= '<a href="index.php?sec=galertas&sec2=godmode/alerts/alert_special_days&display_range=';
$html .= ($display_range - 1);
$html .= '">&lt;&lt;&nbsp;</a>';
}
$html .= '<a href="index.php?sec=galertas&sec2=godmode/alerts/alert_special_days&display_range='.$display_range.'" class="bolder">['.$display_range.']</a>';
$html .= '<a href="index.php?sec=galertas&sec2=godmode/alerts/alert_special_days&display_range=';
$html .= ($display_range + 1);
$html .= '">&nbsp;&gt;&gt;</a>';
} else {
$html .= '<a href="index.php?sec=galertas&sec2=godmode/alerts/alert_special_days" class="bolder">['.__('Default').']</a>&nbsp;&nbsp;';
$html .= '<a href="index.php?sec=galertas&sec2=godmode/alerts/alert_special_days&display_range=';
$html .= ($this_year - 1);
$html .= '">&lt;&lt;&nbsp;</a>';
$html .= '<a href="index.php?sec=galertas&sec2=godmode/alerts/alert_special_days&display_range=';
$html .= $this_year;
$html .= '">[';
$html .= $this_year;
$html .= ']</a>';
$html .= '<a href="index.php?sec=galertas&sec2=godmode/alerts/alert_special_days&display_range=';
$html .= ($this_year + 1);
$html .= '">&nbsp;&gt;&gt;</a>';
}
$html .= '</td></tr>';
echo $html;
// Show calendar
for ($month = 1; $month <= 12; $month++) {
if ($display_range) {
$display_month = $month;
$display_year = $display_range;
} else {
$display_month = ($this_month + $month - 1);
$display_year = $this_year;
}
if ($display_month > 12) {
$display_month -= 12;
$display_year += 1;
}
$cal_table = new stdClass();
$cal_table->width = '100%';
$cal_table->class = 'databox data';
$cal_table->data = [];
$cal_table->head = [];
$cal_table->head[0] = __('Sun');
$cal_table->head[1] = __('Mon');
$cal_table->head[2] = __('Tue');
$cal_table->head[3] = __('Wed');
$cal_table->head[4] = __('Thu');
$cal_table->head[5] = __('Fri');
$cal_table->head[6] = __('Sat');
$cal_table->cellstyle = [];
$cal_table->size = [];
$cal_table->size[0] = '14%';
$cal_table->size[1] = '14%';
$cal_table->size[2] = '14%';
$cal_table->size[3] = '14%';
$cal_table->size[4] = '14%';
$cal_table->size[5] = '14%';
$cal_table->size[6] = '14%';
$cal_table->align = [];
$cal_table->border = '1';
$cal_table->titlestyle = 'text-align:center; font-weight: bold;';
switch ($display_month) {
case 1:
$cal_table->title = __('January');
break;
case 2:
$cal_table->title = __('February');
break;
case 3:
$cal_table->title = __('March');
break;
case 4:
$cal_table->title = __('April');
break;
case 5:
$cal_table->title = __('May');
break;
case 6:
$cal_table->title = __('June');
break;
case 7:
$cal_table->title = __('July');
break;
case 8:
$cal_table->title = __('August');
break;
case 9:
$cal_table->title = __('September');
break;
case 10:
$cal_table->title = __('October');
break;
case 11:
$cal_table->title = __('November');
break;
case 12:
$cal_table->title = __('December');
break;
}
$cal_table->title .= ' / '.$display_year;
$last_day = date('j', mktime(0, 0, 0, ($display_month + 1), 0, $display_year));
$cal_line = 0;
for ($day = 1; $day < ($last_day + 1); $day++) {
$week = date('w', mktime(0, 0, 0, $display_month, $day, $display_year));
if ($cal_line == 0 && $week != 0 && $day == 1) {
for ($i = 0; $i < $week; $i++) {
$cal_table->cellstyle[$cal_line][$i] = 'font-size: 18px;';
$cal_table->data[$cal_line][$i] = '-';
}
}
if ($week == 0 || $week == 6) {
$cal_table->cellstyle[$cal_line][$week] = 'color: red;';
}
$date = sprintf('%04d-%02d-%02d', $display_year, $display_month, $day);
$date_wildcard = sprintf('0001-%02d-%02d', $display_month, $day);
$special_days = '';
$filter['date'] = [
$date,
$date_wildcard,
];
$filter['order']['field'] = 'date';
$filter['order']['order'] = 'DESC';
$special_days = db_get_all_rows_filter('talert_special_days', $filter);
if ($special_days != '') {
foreach ($special_days as $special_day) {
$cal_table->data[$cal_line][$week] .= '<div class="font_18px" style="';
if ($special_day['same_day'] == 'sunday' || $special_day['same_day'] == 'saturday') {
$cal_table->data[$cal_line][$week] .= 'color: red;';
}
$cal_table->data[$cal_line][$week] .= '">';
$cal_table->data[$cal_line][$week] .= $day;
$cal_table->data[$cal_line][$week] .= '</div>';
$cal_table->data[$cal_line][$week] .= ui_print_group_icon($special_day['id_group'], true);
if ($special_day['date'] == $date_wildcard) {
$cal_table->data[$cal_line][$week] .= '('.ui_print_help_tip('This is valid every year. However, this will be ignored if indivisual setting for the same group is available.', true).') ';
}
$cal_table->data[$cal_line][$week] .= __('Same as ');
switch ($special_day['same_day']) {
case 'monday':
$cal_table->data[$cal_line][$week] .= __('Monday');
break;
case 'tuesday':
$cal_table->data[$cal_line][$week] .= __('Tuesday');
break;
case 'wednesday':
$cal_table->data[$cal_line][$week] .= __('Wednesday');
break;
case 'thursday':
$cal_table->data[$cal_line][$week] .= __('Thursday');
break;
case 'friday':
$cal_table->data[$cal_line][$week] .= __('Friday');
break;
case 'saturday':
$cal_table->data[$cal_line][$week] .= __('Saturday');
break;
case 'sunday':
$cal_table->data[$cal_line][$week] .= __('Sunday');
break;
}
// Only show description if is filled.
if (empty($special_day['description']) === false) {
$cal_table->data[$cal_line][$week] .= ui_print_help_tip($special_day['description'], true);
}
if ($special_day['id_group'] || ($can_manage_group_all && $special_day['id_group'] == 0)) {
$cal_table->data[$cal_line][$week] .= '<a href="index.php?sec=galertas&sec2=godmode/alerts/configure_alert_special_days&id='.$special_day['id'].'" title=';
$cal_table->data[$cal_line][$week] .= __('Edit');
$cal_table->data[$cal_line][$week] .= '>'.html_print_image(
'images/config.png',
true,
['class' => 'invert_filter']
).'</a> &nbsp;';
$cal_table->data[$cal_line][$week] .= '<a href="index.php?sec=galertas&sec2=godmode/alerts/alert_special_days&delete_special_day=1&id='.$special_day['id'].'"onClick="if (!confirm(\''.__('Are you sure?').'\')) return false;" title=';
$cal_table->data[$cal_line][$week] .= __('Remove');
$cal_table->data[$cal_line][$week] .= '>'.html_print_image(
'images/cross.png',
true,
['class' => 'invert_filter']
).'</a>';
;
}
$cal_table->data[$cal_line][$week] .= '<br>';
$cal_table->cellstyle[$cal_line][$week] = 'font-weight: bold;';
}
} else {
$cal_table->cellstyle[$cal_line][$week] .= 'font-size: 18px;';
$cal_table->data[$cal_line][$week] = $day.'&nbsp;';
}
$cal_table->data[$cal_line][$week] .= '<a href="index.php?sec=galertas&sec2=godmode/alerts/configure_alert_special_days&create_special_day=1&date='.$date.'" title=';
$cal_table->data[$cal_line][$week] .= __('Create');
$cal_table->data[$cal_line][$week] .= '>'.html_print_image(
'images/add_mc.png',
true,
['class' => 'invert_filter']
).'</a>';
if ($week == 6) {
$cal_line++;
}
}
for ($padding = ($week + 1); $padding <= 6; $padding++) {
$cal_table->cellstyle[$cal_line][$padding] = 'font-size: 18px;';
$cal_table->data[$cal_line][$padding] = '-';
}
html_print_table($cal_table);
}
echo '<div class="action-buttons" style="width: '.$table->width.'">';
echo '<form method="post" action="index.php?sec=galertas&sec2=godmode/alerts/configure_alert_special_days">';
html_print_submit_button(__('Create'), 'create', false, 'class="sub next"');
html_print_input_hidden('create_special_day', 1);
echo '</form>';
echo '</div>';

View File

@ -21,8 +21,6 @@ enterprise_include_once('meta/include/functions_alerts_meta.php');
check_login(); check_login();
enterprise_hook('open_meta_frame');
if (! check_acl($config['id_user'], 0, 'LM')) { if (! check_acl($config['id_user'], 0, 'LM')) {
db_pandora_audit( db_pandora_audit(
'ACL Violation', 'ACL Violation',
@ -50,6 +48,8 @@ if (is_ajax()) {
} }
} }
enterprise_hook('open_meta_frame');
if (defined('METACONSOLE')) { if (defined('METACONSOLE')) {
$sec = 'advanced'; $sec = 'advanced';
} else { } else {
@ -237,7 +237,7 @@ $create_ticket_command_id = db_get_value('id', 'talert_commands', 'name', io_saf
$sql_exclude_command_id = ''; $sql_exclude_command_id = '';
if ($config['integria_enabled'] == 0 && $create_ticket_command_id !== false) { if (!is_metaconsole() && $config['integria_enabled'] == 0 && $create_ticket_command_id !== false) {
$sql_exclude_command_id = ' AND id <> '.$create_ticket_command_id; $sql_exclude_command_id = ' AND id <> '.$create_ticket_command_id;
} }
@ -597,6 +597,7 @@ $(document).ready (function () {
$("#id_command").change (function () { $("#id_command").change (function () {
values = Array (); values = Array ();
// No se envia el valor del commando.
values.push({ values.push({
name: "page", name: "page",
value: "godmode/alerts/alert_commands"}); value: "godmode/alerts/alert_commands"});
@ -693,8 +694,19 @@ $(document).ready (function () {
} }
} }
else { else {
var is_element_select = $("[name=field" + i + "_value]").is("select");
$("[name=field" + i + "_value]").val(old_value); $("[name=field" + i + "_value]").val(old_value);
if (is_element_select === true) {
$("[name=field" + i + "_value]").trigger('change');
}
$("[name=field" + i + "_recovery_value]").val(old_recovery_value); $("[name=field" + i + "_recovery_value]").val(old_recovery_value);
if (is_element_select === true) {
$("[name=field" + i + "_recovery_value]").trigger('change');
}
} }
} }
else { else {
@ -746,6 +758,7 @@ $(document).ready (function () {
if ($('#field5_value').val() !== '') { if ($('#field5_value').val() !== '') {
ajax_get_integria_custom_fields($('#field5_value').val(), integria_custom_fields_values, integria_custom_fields_rvalues); ajax_get_integria_custom_fields($('#field5_value').val(), integria_custom_fields_values, integria_custom_fields_rvalues);
$('#field5_value').trigger('change');
} }
$('#field5_value').on('change', function() { $('#field5_value').on('change', function() {

View File

@ -1,159 +0,0 @@
<?php
// Pandora FMS - http://pandorafms.com
// ==================================================
// Copyright (c) 2005-2021 Artica Soluciones Tecnologicas
// Copyright (c) 2012-2013 Junichi Satoh
// Please see http://pandorafms.org for full contribution list
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation for version 2.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Load global vars.
global $config;
require_once 'include/functions_alerts.php';
check_login();
if (! check_acl($config['id_user'], 0, 'LM')) {
db_pandora_audit(
'ACL Violation',
'Trying to access Alert Management'
);
include 'general/noaccess.php';
exit;
}
ui_require_javascript_file('calendar');
$id = (int) get_parameter('id');
$date = (string) get_parameter('date');
$name = '';
$command = '';
$description = '';
$same_day = '';
$id_group = 0;
if ($id) {
$special_day = alerts_get_alert_special_day($id);
$date = str_replace('0001', '*', $special_day['date']);
$date_orig = $date;
$same_day = $special_day['same_day'];
$description = $special_day['description'];
$id_group = $special_day['id_group'];
$id_group_orig = $id_group;
}
if ($date == '') {
$date = date('Y-m-d', get_system_time());
}
// Header.
ui_print_page_header(
__('Alerts').' &raquo; '.__('Configure special day'),
'images/gm_alerts.png',
false,
'',
true
);
$table = new stdClass();
$table->width = '100%';
$table->class = 'databox filters';
$table->style = [];
$table->style[0] = 'font-weight: bold';
$table->size = [];
$table->size[0] = '20%';
$table->data = [];
$table->data[0][0] = __('Date');
$table->data[0][1] = html_print_input_text(
'date',
$date,
'',
10,
10,
true
);
$table->data[0][1] .= html_print_image(
'images/calendar_view_day.png',
true,
[
'alt' => 'calendar',
'onclick' => "scwShow(scwID('text-date'),this);",
'class' => 'invert_filter',
]
);
$table->data[1][0] = __('Group');
$groups = users_get_groups();
$own_info = get_user_info($config['id_user']);
// Only display group "All" if user is administrator or has "LM" privileges.
if (users_can_manage_group_all('LM')) {
$display_all_group = true;
} else {
$display_all_group = false;
}
$table->data[1][1] = html_print_select_groups(
false,
'LW',
$display_all_group,
'id_group',
$id_group,
'',
'',
0,
true
);
$table->data[2][0] = __('Same day of the week');
$days = [];
$days['monday'] = __('Monday');
$days['tuesday'] = __('Tuesday');
$days['wednesday'] = __('Wednesday');
$days['thursday'] = __('Thursday');
$days['friday'] = __('Friday');
$days['saturday'] = __('Saturday');
$days['sunday'] = __('Sunday');
$table->data[2][1] = html_print_select(
$days,
'same_day',
$same_day,
'',
'',
0,
true,
false,
false
);
$table->data[3][0] = __('Description');
$table->data[3][1] = html_print_textarea(
'description',
10,
30,
$description,
'',
true
);
echo '<form method="post" action="index.php?sec=galertas&sec2=godmode/alerts/alert_special_days">';
html_print_table($table);
echo '<div class="action-buttons" style="width: '.$table->width.'">';
if ($id) {
html_print_input_hidden('id', $id);
html_print_input_hidden('update_special_day', 1);
html_print_input_hidden('id_group_orig', $id_group_orig);
html_print_input_hidden('date_orig', $date_orig);
html_print_submit_button(__('Update'), 'create', false, 'class="sub upd"');
} else {
html_print_input_hidden('create_special_day', 1);
html_print_submit_button(__('Create'), 'create', false, 'class="sub wand"');
}
echo '</div>';
echo '</form>';

View File

@ -11,8 +11,11 @@
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU General Public License for more details.
// Load global vars // Load global vars.
global $config; global $config;
use PandoraFMS\Calendar;
require_once $config['homedir'].'/include/functions_alerts.php'; require_once $config['homedir'].'/include/functions_alerts.php';
require_once $config['homedir'].'/include/functions_users.php'; require_once $config['homedir'].'/include/functions_users.php';
enterprise_include_once('meta/include/functions_alerts_meta.php'); enterprise_include_once('meta/include/functions_alerts_meta.php');
@ -288,7 +291,7 @@ function update_template($step)
$friday = (bool) get_parameter('friday'); $friday = (bool) get_parameter('friday');
$saturday = (bool) get_parameter('saturday'); $saturday = (bool) get_parameter('saturday');
$sunday = (bool) get_parameter('sunday'); $sunday = (bool) get_parameter('sunday');
$special_day = (bool) get_parameter('special_day'); $special_day = (int) get_parameter('special_day');
$time_from = (string) get_parameter('time_from'); $time_from = (string) get_parameter('time_from');
$time_from = date('H:i:00', strtotime($time_from)); $time_from = date('H:i:00', strtotime($time_from));
$time_to = (string) get_parameter('time_to'); $time_to = (string) get_parameter('time_to');
@ -418,7 +421,7 @@ $thursday = true;
$friday = true; $friday = true;
$saturday = true; $saturday = true;
$sunday = true; $sunday = true;
$special_day = false; $special_day = 0;
$default_action = 0; $default_action = 0;
$fields = []; $fields = [];
for ($i = 1; $i <= $config['max_macro_fields']; $i++) { for ($i = 1; $i <= $config['max_macro_fields']; $i++) {
@ -561,7 +564,7 @@ if ($id && ! $create_template) {
$friday = (bool) $template['friday']; $friday = (bool) $template['friday'];
$saturday = (bool) $template['saturday']; $saturday = (bool) $template['saturday'];
$sunday = (bool) $template['sunday']; $sunday = (bool) $template['sunday'];
$special_day = (bool) $template['special_day']; $special_day = (int) $template['special_day'];
$max_alerts = $template['max_alerts']; $max_alerts = $template['max_alerts'];
$min_alerts = $template['min_alerts']; $min_alerts = $template['min_alerts'];
$min_alerts_reset_counter = $template['min_alerts_reset_counter']; $min_alerts_reset_counter = $template['min_alerts_reset_counter'];
@ -671,11 +674,36 @@ if ($step == 2) {
); );
$table->data[0][2] = __('Use special days list'); $table->data[0][2] = __('Use special days list');
$table->data[0][3] = html_print_checkbox( $data_special_days = Calendar::calendars(
// Fields.
[ '`talert_calendar`.*' ],
// Filter.
[],
// Count.
false,
// Offset.
null,
// Limit.
null,
// Order.
null,
// Sort field.
null,
// Reduce to a select.
true
);
$table->data[0][3] = html_print_select(
$data_special_days,
'special_day', 'special_day',
1,
$special_day, $special_day,
'',
__('None'),
0,
true, true,
false,
false,
'',
(!$is_management_allowed | $disabled) (!$is_management_allowed | $disabled)
); );

View File

@ -0,0 +1,71 @@
<?php
/**
* Audit log View.
*
* @category Audit log
* @package Pandora FMS
* @subpackage Community
* @version 1.0.0
* @license See below
*
* ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2005-2022 Artica Soluciones Tecnologicas
* Please see http://pandorafms.org for full contribution list
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation for version 2.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* ============================================================================
*/
// Begin.
global $config;
require_once $config['homedir'].'/include/class/AuditLog.class.php';
$ajaxPage = 'godmode/audit_log';
// Control call flow.
try {
// User access and validation is being processed on class constructor.
$controller = new AuditLog($ajaxPage);
} catch (Exception $e) {
if ((bool) is_ajax() === true) {
echo json_encode(['error' => '[AuditLog]'.$e->getMessage() ]);
exit;
} else {
echo '[AuditLog]'.$e->getMessage();
}
// Stop this execution, but continue 'globally'.
return;
}
// AJAX controller.
if ((bool) is_ajax() === true) {
$method = get_parameter('method');
if (method_exists($controller, $method) === true) {
if ($controller->ajaxMethod($method) === true) {
$controller->{$method}();
} else {
$controller->error('Unavailable method.');
}
} else {
$controller->error('Method not found. ['.$method.']');
}
// Stop any execution.
exit;
} else {
// Run.
$controller->run();
}

View File

@ -197,6 +197,18 @@ $data[0] = '<div id="command_timeout_label" class="labels invisible">'.__('Comma
$data[1] = '<div id="command_timeout_value" class="invisible">'.html_print_input_text('command_timeout', $event_response['command_timeout'], '', 4, 5, true); $data[1] = '<div id="command_timeout_value" class="invisible">'.html_print_input_text('command_timeout', $event_response['command_timeout'], '', 4, 5, true);
$table->data[5] = $data; $table->data[5] = $data;
$data = [];
$data[0] = __('Display command').ui_print_help_tip(__('If enabled the command will be displayed to any user that can execute this event response'), true);
$data[1] = html_print_checkbox_switch(
'display_command',
1,
$event_response['display_command'],
true
);
$table->data[6] = $data;
if ($event_response_id == 0) { if ($event_response_id == 0) {
echo '<form method="post" action="index.php?sec=geventos&sec2=godmode/events/events&section=responses&mode=list&action=create_response&amp;pure='.$config['pure'].'">'; echo '<form method="post" action="index.php?sec=geventos&sec2=godmode/events/events&section=responses&mode=list&action=create_response&amp;pure='.$config['pure'].'">';
html_print_table($table); html_print_table($table);

View File

@ -41,6 +41,7 @@ switch ($action) {
$values['modal_height'] = get_parameter('modal_height'); $values['modal_height'] = get_parameter('modal_height');
$values['new_window'] = get_parameter('new_window'); $values['new_window'] = get_parameter('new_window');
$values['params'] = get_parameter('params'); $values['params'] = get_parameter('params');
$values['display_command'] = get_parameter('display_command');
$values['server_to_exec'] = get_parameter('server_to_exec'); $values['server_to_exec'] = get_parameter('server_to_exec');
$values['command_timeout'] = get_parameter('command_timeout', 90); $values['command_timeout'] = get_parameter('command_timeout', 90);
@ -64,6 +65,7 @@ switch ($action) {
$values['modal_height'] = get_parameter('modal_height'); $values['modal_height'] = get_parameter('modal_height');
$values['new_window'] = get_parameter('new_window'); $values['new_window'] = get_parameter('new_window');
$values['params'] = get_parameter('params'); $values['params'] = get_parameter('params');
$values['display_command'] = get_parameter('display_command');
$values['server_to_exec'] = get_parameter('server_to_exec'); $values['server_to_exec'] = get_parameter('server_to_exec');
$response_id = get_parameter('id_response', 0); $response_id = get_parameter('id_response', 0);
$values['command_timeout'] = get_parameter('command_timeout', '90'); $values['command_timeout'] = get_parameter('command_timeout', '90');

View File

@ -71,6 +71,40 @@ foreach ($layer_ids as $layer_id) {
$next_action = 'new_map'; $next_action = 'new_map';
$buttons['gis_maps_list'] = [
'active' => false,
'text' => '<a href="index.php?sec=godgismaps&sec2=operation/gis_maps/gis_map">'.html_print_image(
'images/list.png',
true,
[
'title' => __('GIS Maps list'),
'class' => 'invert_filter',
]
).'</a>',
];
if ($idMap) {
$buttons['view_gis'] = [
'active' => false,
'text' => '<a href="index.php?sec=gismaps&sec2=operation/gis_maps/render_view&map_id='.$idMap.'">'.html_print_image(
'images/op_gis.png',
true,
[
'title' => __('View GIS'),
'class' => 'invert_filter',
]
).'</a>',
];
}
ui_print_page_header(
__('GIS Maps builder'),
'images/gm_gis.png',
false,
'configure_gis_map_edit',
true,
$buttons
);
switch ($action) { switch ($action) {
case 'save_new': case 'save_new':
$map_name = get_parameter('map_name'); $map_name = get_parameter('map_name');
@ -269,42 +303,6 @@ switch ($action) {
break; break;
} }
$url = 'index.php?sec='.$sec.'&sec2='.$sec2.'&map_id='.$idMap.'&action='.$next_action;
$buttons['gis_maps_list'] = [
'active' => false,
'text' => '<a href="index.php?sec=godgismaps&sec2=operation/gis_maps/gis_map">'.html_print_image(
'images/list.png',
true,
[
'title' => __('GIS Maps list'),
'class' => 'invert_filter',
]
).'</a>',
];
if ($idMap) {
$buttons['view_gis'] = [
'active' => false,
'text' => '<a href="index.php?sec=gismaps&sec2=operation/gis_maps/render_view&map_id='.$idMap.'">'.html_print_image(
'images/op_gis.png',
true,
[
'title' => __('View GIS'),
'class' => 'invert_filter',
]
).'</a>',
];
}
ui_print_page_header(
__('GIS Maps builder'),
'images/gm_gis.png',
false,
'configure_gis_map_edit',
true,
$buttons
);
?> ?>
<script type="text/javascript"> <script type="text/javascript">
@ -411,6 +409,7 @@ function addConnectionMap() {
</script> </script>
<?php <?php
$url = 'index.php?sec='.$sec.'&sec2='.$sec2.'&map_id='.$idMap.'&action='.$next_action;
echo '<form action="'.$url.'" id="form_setup" method="post">'; echo '<form action="'.$url.'" id="form_setup" method="post">';
// Load the data in edit or reload in update. // Load the data in edit or reload in update.
@ -539,6 +538,8 @@ $table->data[9][1] = html_print_input_text('map_default_altitude', $map_default_
html_print_table($table); html_print_table($table);
$user_groups = users_get_groups($config['user'], 'AR', false);
echo '<h3>'.__('Layers').'</h3>'; echo '<h3>'.__('Layers').'</h3>';
$table->width = '100%'; $table->width = '100%';
@ -562,7 +563,7 @@ $table->data[1][1] = '<div id="form_layer" class="invisible">
</tr> </tr>
<tr> <tr>
<td>'.__('Show agents from group').':</td> <td>'.__('Show agents from group').':</td>
<td colspan="3">'.html_print_select_groups(false, $access, $display_all_group, 'layer_group_form', '-1', '', __('None'), '-1', true).'</td> <td colspan="3">'.html_print_select($user_groups, 'layer_group_form', '-1', '', __('none'), '-1', true).'</td>
</tr> </tr>
<tr> <tr>
<td colspan="4"><hr /></td> <td colspan="4"><hr /></td>
@ -883,7 +884,7 @@ function setLayerEditorData (data) {
var $layerFormIdInput = $("input#hidden-current_edit_layer_id"); var $layerFormIdInput = $("input#hidden-current_edit_layer_id");
var $layerFormNameInput = $("input#text-layer_name_form"); var $layerFormNameInput = $("input#text-layer_name_form");
var $layerFormVisibleCheckbox = $("input#checkbox-layer_visible_form"); var $layerFormVisibleCheckbox = $("input#checkbox-layer_visible_form");
var $layerFormAgentsFromGroupSelect = $("select#layer_group_form"); var $layerFormAgentsFromGroupSelect = $("#layer_group_form");
var $layerFormAgentInput = $("input#text-agent_alias"); var $layerFormAgentInput = $("input#text-agent_alias");
var $layerFormAgentButton = $("input#button-add_agent"); var $layerFormAgentButton = $("input#button-add_agent");
var $layerFormAgentsListItems = $("tr.agents_list_item"); var $layerFormAgentsListItems = $("tr.agents_list_item");
@ -892,7 +893,8 @@ function setLayerEditorData (data) {
$layerFormIdInput.val(data.id); $layerFormIdInput.val(data.id);
$layerFormNameInput.val(data.name); $layerFormNameInput.val(data.name);
$layerFormVisibleCheckbox.prop("checked", data.visible); $layerFormVisibleCheckbox.prop("checked", data.visible);
$layerFormAgentsFromGroupSelect.val(data.agentsFromGroup); $(`#layer_group_form option[value=${data.agentsFromGroup}]`).attr('selected', 'selected');
$(`#layer_group_form`).trigger('change');
$layerFormAgentInput.val(""); $layerFormAgentInput.val("");
$layerFormAgentButton.prop("disabled", true); $layerFormAgentButton.prop("disabled", true);
$layerFormAgentsListItems.remove(); $layerFormAgentsListItems.remove();
@ -981,7 +983,7 @@ function unbindLayerEditorEvents () {
$layerFormNameInput.unbind("change"); $layerFormNameInput.unbind("change");
$layerFormVisibleCheckbox.unbind("click"); $layerFormVisibleCheckbox.unbind("click");
$layerFormAgentsFromGroupSelect.unbind("change"); $layerFormAgentsFromGroupSelect.val('-1');
} }
function getAgentRow (layerId, agentId, agentAlias) { function getAgentRow (layerId, agentId, agentAlias) {
@ -990,7 +992,7 @@ function getAgentRow (layerId, agentId, agentAlias) {
var $deleteCol = $("<td />"); var $deleteCol = $("<td />");
var $agentAlias = $("<span class=\"agent_alias\" data-agent-id=\"" + agentId + "\">" + agentAlias + "</span>"); var $agentAlias = $("<span class=\"agent_alias\" data-agent-id=\"" + agentId + "\">" + agentAlias + "</span>");
var $removeBtn = $('<a class="delete_row" href="javascript:" <?php echo html_print_image('images/cross.png', true, ['class' => 'invert_filter']); ?> </a>'); var $removeBtn = $('<a class="delete_row" href="javascript:" <?php echo html_print_image('images/cross.png', false, ['class' => 'invert_filter']); ?> </a>');
$removeBtn.click(function (event) { $removeBtn.click(function (event) {
var $layerRow = $("tr#layer_row_" + layerId); var $layerRow = $("tr#layer_row_" + layerId);

View File

@ -113,6 +113,7 @@ if (is_ajax() === true) {
'|' '|'
); );
$force_serialized = (bool) get_parameter('force_serialized', false); $force_serialized = (bool) get_parameter('force_serialized', false);
$nodes = (array) get_parameter('nodes', []);
if ((bool) check_acl($config['id_user'], $id_group, 'AR') === false) { if ((bool) check_acl($config['id_user'], $id_group, 'AR') === false) {
db_pandora_audit( db_pandora_audit(
@ -154,6 +155,10 @@ if (is_ajax() === true) {
$filter[$_sql_post] = '1'; $filter[$_sql_post] = '1';
} }
if (is_metaconsole() === true && empty($nodes) === false) {
$filter['id_server'] = $nodes;
}
$id_groups_get_agents = $id_group; $id_groups_get_agents = $id_group;
if ($id_group == 0 && $privilege != '') { if ($id_group == 0 && $privilege != '') {
$groups = users_get_groups($config['id_user'], $privilege, false); $groups = users_get_groups($config['id_user'], $privilege, false);

View File

@ -14,7 +14,7 @@
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______| * |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
* *
* ============================================================================ * ============================================================================
* Copyright (c) 2005-2021 Artica Soluciones Tecnologicas * Copyright (c) 2005-2022 Artica Soluciones Tecnologicas
* Please see http://pandorafms.org for full contribution list * Please see http://pandorafms.org for full contribution list
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -26,10 +26,13 @@
* ============================================================================ * ============================================================================
*/ */
use PandoraFMS\Agent;
use PandoraFMS\Enterprise\Metaconsole\Node;
// Begin. // Begin.
check_login(); check_login();
if (! check_acl($config['id_user'], 0, 'AW')) { if ((bool) check_acl($config['id_user'], 0, 'AW') === false) {
db_pandora_audit( db_pandora_audit(
'ACL Violation', 'ACL Violation',
'Trying to access massive agent deletion section' 'Trying to access massive agent deletion section'
@ -38,30 +41,63 @@ if (! check_acl($config['id_user'], 0, 'AW')) {
return; return;
} }
require_once 'include/functions_agents.php'; require_once $config['homedir'].'/include/functions_agents.php';
require_once 'include/functions_alerts.php'; require_once $config['homedir'].'/include/functions_alerts.php';
require_once 'include/functions_modules.php'; require_once $config['homedir'].'/include/functions_modules.php';
require_once 'include/functions_users.php'; require_once $config['homedir'].'/include/functions_users.php';
require_once $config['homedir'].'/include/functions_massive_operations.php';
/**
* Bulk operations Delete.
*
* @param array $id_agents Agents to delete.
*
* @return boolean
*/
function process_manage_delete($id_agents) function process_manage_delete($id_agents)
{ {
if (empty($id_agents)) { if (empty($id_agents) === true) {
ui_print_error_message(__('No agents selected')); ui_print_error_message(__('No agents selected'));
return false; return false;
} }
$id_agents = (array) $id_agents; $id_agents = (array) $id_agents;
$copy_modules = (bool) get_parameter('copy_modules');
$copy_alerts = (bool) get_parameter('copy_alerts');
$error = false;
$count_deleted = 0; $count_deleted = 0;
$agent_id_restore = 0; $agent_id_restore = 0;
foreach ($id_agents as $id_agent) { foreach ($id_agents as $id_agent) {
$success = agents_delete_agent($id_agent); if (is_metaconsole() === true) {
if (! $success) { $array_id = explode('|', $id_agent);
try {
$node = new Node((int) $array_id[0]);
$node->connect();
$agent = new Agent((int) $array_id[1]);
$success = $agent->delete();
$node->disconnect();
$success = agent_delete_from_metaconsole(
$array_id[1],
$array_id[0]
);
} catch (\Exception $e) {
// Unexistent agent.
$success = false;
$node->disconnect();
}
} else {
try {
$agent = new Agent($id_agent);
$success = $agent->delete();
} catch (\Exception $e) {
// Unexistent agent.
$success = false;
}
}
if ($success === false) {
$agent_id_restore = $id_agent; $agent_id_restore = $id_agent;
break; break;
} }
@ -69,11 +105,22 @@ function process_manage_delete($id_agents)
$count_deleted++; $count_deleted++;
} }
if (! $success) { if ($success === false) {
if (is_metaconsole() === true) {
$array_id = explode('|', $agent_id_restore);
$alias = agents_get_alias_metaconsole(
$array_id[1],
'none',
$array_id[0]
);
} else {
$alias = agents_get_alias($agent_id_restore);
}
ui_print_error_message( ui_print_error_message(
sprintf( sprintf(
__('There was an error deleting the agent, the operation has been cancelled Could not delete agent %s'), __('There was an error deleting the agent, the operation has been cancelled Could not delete agent %s'),
agents_get_name($agent_id_restore) $alias
) )
); );
@ -96,22 +143,32 @@ function process_manage_delete($id_agents)
$id_group = (int) get_parameter('id_group'); $id_group = (int) get_parameter('id_group');
$id_agents = get_parameter('id_agents'); $id_agents = get_parameter('id_agents');
$recursion = get_parameter('recursion'); $recursion = get_parameter('recursion');
$delete = (bool) get_parameter_post('delete'); $delete = (bool) get_parameter_post('delete');
if ($delete) { if ($delete === true) {
$result = process_manage_delete($id_agents); $result = process_manage_delete($id_agents);
$info = '{"Agent":"'.implode(',', $id_agents).'"}'; $info = '{"Agent":"'.implode(',', $id_agents).'"}';
if ($result) { if ($result === true) {
db_pandora_audit('Massive management', 'Delete agent ', false, false, $info); db_pandora_audit(
'Massive management',
'Delete agent ',
false,
false,
$info
);
} else { } else {
db_pandora_audit('Massive management', 'Fail try to delete agent', false, false, $info); db_pandora_audit(
'Massive management',
'Fail try to delete agent',
false,
false,
$info
);
} }
} }
$groups = users_get_groups(); $table = new stdClass;
$table->id = 'delete_table'; $table->id = 'delete_table';
$table->class = 'databox filters'; $table->class = 'databox filters';
$table->width = '100%'; $table->width = '100%';
@ -177,31 +234,98 @@ $table->data[1][3] = html_print_select(
__('All'), __('All'),
2, 2,
true, true,
false,
true,
'', '',
'', false,
'',
'',
'width:30%;' 'width:30%;'
); );
$table->data[2][0] = __('Agents'); if (is_metaconsole() === true) {
$table->data[2][0] .= '<span id="agent_loading" class="invisible">'; $servers = metaconsole_get_servers();
$table->data[2][0] .= html_print_image('images/spinner.png', true); $server_fields = [];
$table->data[2][0] .= '</span>'; foreach ($servers as $key => $server) {
$table->data[2][1] = html_print_select( $server_fields[$key] = $server['server_name'];
agents_get_group_agents(array_keys(users_get_groups($config['id_user'], 'AW', false)), false, 'none'), }
$table->data[2][2] = __('Node');
$table->data[2][3] = html_print_select(
$server_fields,
'nodes[]',
0,
false,
'',
'',
true,
true,
true,
'',
false,
'min-width: 500px; max-width: 500px; max-height: 100px',
false,
false,
false,
'',
false,
false,
false,
false,
true,
true,
true
);
}
$table->data[3][0] = __('Agents');
$table->data[3][0] .= '<span id="agent_loading" class="invisible">';
$table->data[3][0] .= html_print_image('images/spinner.png', true);
$table->data[3][0] .= '</span>';
$agents = agents_get_group_agents(
array_keys(users_get_groups($config['id_user'], 'AW', false)),
['disabled' => 2],
'none',
false,
false,
is_metaconsole(),
'|'
);
$table->data[3][1] = html_print_select(
$agents,
'id_agents[]', 'id_agents[]',
0, 0,
false, false,
'', '',
'', '',
true, true,
true,
true,
'',
false,
'min-width: 500px; max-width: 500px; max-height: 100px',
false,
false,
false,
'',
false,
false,
false,
false,
true,
true,
true true
); );
echo '<form method="post" id="form_agents" action="index.php?sec=gmassive&sec2=godmode/massive/massive_operations&option=delete_agents">'; $url = 'index.php?sec=gmassive&sec2=godmode/massive/massive_operations&option=delete_agents';
if (is_metaconsole() === true) {
$url = 'index.php?sec=advanced&sec2=advanced/massive_operations&tab=massive_agents&pure=0&option=delete_agents';
}
echo '<form method="post" id="form_agent" action="'.$url.'">';
html_print_table($table); html_print_table($table);
if (is_management_allowed() === true) {
if (is_metaconsole() === true || is_management_allowed() === true) {
attachActionButton('delete', 'delete', $table->width); attachActionButton('delete', 'delete', $table->width);
} }
@ -215,25 +339,34 @@ ui_require_jquery_file('pandora.controls');
<script type="text/javascript"> <script type="text/javascript">
$(document).ready (function () { $(document).ready (function () {
// Check Metaconsole.
var metaconsole = '<?php echo (is_metaconsole() === true) ? 1 : 0; ?>';
// Listeners.
var recursion; var recursion;
$("#checkbox-recursion").click(function () { $("#checkbox-recursion").click(function () {
recursion = this.checked ? 1 : 0; recursion = this.checked ? 1 : 0;
$("#id_group").trigger("change"); $("#id_group").trigger("change");
}); });
var disabled; var disabled;
$("#disabled").change(function () {
$("#disabled").click(function () {
disabled = this.value; disabled = this.value;
$("#id_group").trigger("change"); $("#id_group").trigger("change");
}); });
$("#id_group").pandoraSelectGroupAgent ({ var nodes;
$("#nodes").change(function () {
nodes = $("#nodes").val();
$("#id_group").trigger("change");
});
$("#status_agents").change(function() {
$("#id_group").trigger("change");
});
// Build data.
var data = {
status_agents: function () { status_agents: function () {
return $("#status_agents").val(); return $("#status_agents").val();
}, },
@ -244,16 +377,18 @@ ui_require_jquery_file('pandora.controls');
}, },
disabled: function() { disabled: function() {
return disabled; return disabled;
},
} }
});
$("#status_agents").change(function() { if (metaconsole == 1) {
$("#id_group").trigger("change"); data.serialized = true;
}); data.serialized_separator = '|';
data.nodes = function() {
disabled = 2; return nodes;
};
$("#id_group").trigger("change"); }
// Change agents.
$("#id_group").pandoraSelectGroupAgent(data);
}); });
</script> </script>

View File

@ -683,6 +683,7 @@ $(document).ready (function () {
var params = { var params = {
"page" : "operation/agentes/ver_agente", "page" : "operation/agentes/ver_agente",
"get_agent_modules_json" : 1, "get_agent_modules_json" : 1,
"truncate_module_names": 1,
"get_distinct_name" : 1, "get_distinct_name" : 1,
"indexed" : 0, "indexed" : 0,
"privilege" : "AW", "privilege" : "AW",
@ -712,7 +713,7 @@ $(document).ready (function () {
function (data, status) { function (data, status) {
jQuery.each (data, function (id, value) { jQuery.each (data, function (id, value) {
option = $("<option></option>") option = $("<option></option>")
.attr("value", value["nombre"]) .attr({value: value["nombre"], title: value["nombre"]})
.html(value["safe_name"]); .html(value["safe_name"]);
$("#module_name").append (option); $("#module_name").append (option);
}); });

View File

@ -38,13 +38,13 @@ if (! check_acl($config['id_user'], 0, 'AW')) {
return; return;
} }
require_once 'include/functions_agents.php'; require_once $config['homedir'].'/include/functions_agents.php';
require_once 'include/functions_ui.php'; require_once $config['homedir'].'/include/functions_ui.php';
require_once 'include/functions_alerts.php'; require_once $config['homedir'].'/include/functions_alerts.php';
require_once 'include/functions_modules.php'; require_once $config['homedir'].'/include/functions_modules.php';
require_once 'include/functions_servers.php'; require_once $config['homedir'].'/include/functions_servers.php';
require_once 'include/functions_gis.php'; require_once $config['homedir'].'/include/functions_gis.php';
require_once 'include/functions_users.php'; require_once $config['homedir'].'/include/functions_users.php';
enterprise_include_once('include/functions_config_agents.php'); enterprise_include_once('include/functions_config_agents.php');
if (is_ajax()) { if (is_ajax()) {
@ -171,7 +171,7 @@ if ($update_agents) {
} }
} }
// CONF FILE DELETION // CONF FILE DELETION.
if (isset($values['delete_conf'])) { if (isset($values['delete_conf'])) {
unset($values['delete_conf']); unset($values['delete_conf']);
$n_deleted = 0; $n_deleted = 0;
@ -339,7 +339,7 @@ if ($update_agents) {
} }
$info = []; $info = [];
// Update Custom Fields // Update Custom Fields.
foreach ($fields as $field) { foreach ($fields as $field) {
$info[$field['id_field']] = $field['name']; $info[$field['id_field']] = $field['name'];
$value = get_parameter('customvalue_'.$field['id_field']); $value = get_parameter('customvalue_'.$field['id_field']);
@ -354,7 +354,7 @@ if ($update_agents) {
); );
if ($old_value === false) { if ($old_value === false) {
// Create custom field if not exist // Create custom field if not exist.
$result = db_process_sql_insert( $result = db_process_sql_insert(
'tagent_custom_data', 'tagent_custom_data',
[ [
@ -400,8 +400,6 @@ if ($update_agents) {
$id_group = 0; $id_group = 0;
$groups = users_get_groups();
$table = new StdClass(); $table = new StdClass();
$table->id = 'delete_table'; $table->id = 'delete_table';
$table->class = 'databox filters'; $table->class = 'databox filters';
@ -468,18 +466,22 @@ $table->data[1][3] = html_print_select(
__('All'), __('All'),
2, 2,
true, true,
false,
true,
'', '',
'', false,
'',
'',
'width:30%;' 'width:30%;'
); );
$table->data[2][0] = __('Agents'); $table->data[2][0] = __('Agents');
$table->data[2][0] .= '<span id="agent_loading" class="invisible">'; $table->data[2][0] .= '<span id="agent_loading" class="invisible">';
$table->data[2][0] .= html_print_image('images/spinner.png', true); $table->data[2][0] .= html_print_image('images/spinner.png', true);
$table->data[2][0] .= '</span>'; $table->data[2][0] .= '</span>';
$enabled_agents = agents_get_group_agents(array_keys(users_get_groups($config['id_user'], 'AW', false)), ['disabled' => 0], 'none'); $all_agents = agents_get_group_agents(
$all_agents = (agents_get_group_agents(array_keys(users_get_groups($config['id_user'], 'AW', false)), ['disabled' => 1], 'none') + $enabled_agents); array_keys(users_get_groups($config['id_user'], 'AW', false)),
['disabled' => 2],
'none'
);
$table->data[2][1] = html_print_select( $table->data[2][1] = html_print_select(
$all_agents, $all_agents,
@ -489,10 +491,27 @@ $table->data[2][1] = html_print_select(
'', '',
'', '',
true, true,
true,
true,
'',
false,
'min-width: 500px; max-width: 500px; max-height: 100px',
false,
false,
false,
'',
false,
false,
false,
false,
true,
true,
true true
); );
echo '<form method="post" id="form_agent" action="index.php?sec=gmassive&sec2=godmode/massive/massive_operations&option=edit_agents">'; echo '<form method="post" autocomplete="off" id="form_agent" action="index.php?sec=gmassive&sec2=godmode/massive/massive_operations&option=edit_agents">';
echo html_print_avoid_autocomplete();
html_print_table($table); html_print_table($table);
$nombre_agente = ''; $nombre_agente = '';
@ -522,9 +541,6 @@ $table->size[3] = '35%';
$table->data = []; $table->data = [];
$groups = users_get_groups($config['id_user'], 'AW', false);
$agents = agents_get_group_agents(array_keys($groups));
$modules = db_get_all_rows_sql( $modules = db_get_all_rows_sql(
'SELECT id_agente_modulo as id_module, nombre as name FROM tagente_modulo 'SELECT id_agente_modulo as id_module, nombre as name FROM tagente_modulo
WHERE id_agente = '.$id_parent WHERE id_agente = '.$id_parent
@ -609,7 +625,7 @@ $table->data[3][1] .= ' <span id="os_preview">';
$table->data[3][1] .= ui_print_os_icon($id_os, false, true); $table->data[3][1] .= ui_print_os_icon($id_os, false, true);
$table->data[3][1] .= '</span>'; $table->data[3][1] .= '</span>';
// Network server // Network server.
$none = ''; $none = '';
if ($server_name == '' && $id_agente) { if ($server_name == '' && $id_agente) {
$none = __('None'); $none = __('None');
@ -631,7 +647,7 @@ $table->data[4][1] = html_print_select(
'width: 150px;' 'width: 150px;'
); );
// Description // Description.
$table->data[5][0] = __('Description'); $table->data[5][0] = __('Description');
$table->data[5][1] = html_print_input_text('description', $description, '', 45, 255, true); $table->data[5][1] = html_print_input_text('description', $description, '', 45, 255, true);
@ -662,27 +678,27 @@ $table->style = [];
$table->style[0] = 'font-weight: bold; width: 150px;'; $table->style[0] = 'font-weight: bold; width: 150px;';
$table->data = []; $table->data = [];
// Custom ID // Custom ID.
$table->data[0][0] = __('Custom ID'); $table->data[0][0] = __('Custom ID');
$table->data[0][1] = html_print_input_text('custom_id', $custom_id, '', 16, 255, true); $table->data[0][1] = html_print_input_text('custom_id', $custom_id, '', 16, 255, true);
// Learn mode / Normal mode // Learn mode / Normal mode.
$table->data[1][0] = __('Module definition'); $table->data[1][0] = __('Module definition');
$table->data[1][1] = __('No change').' '.html_print_radio_button_extended('mode', -1, '', $mode, false, '', 'class="mrgn_right_40px"', true); $table->data[1][1] = __('No change').' '.html_print_radio_button_extended('mode', -1, '', $mode, false, '', 'class="mrgn_right_40px"', true);
$table->data[1][1] .= __('Learning mode').' '.html_print_radio_button_extended('mode', 1, '', $mode, false, '', 'class="mrgn_right_40px"', true); $table->data[1][1] .= __('Learning mode').' '.html_print_radio_button_extended('mode', 1, '', $mode, false, '', 'class="mrgn_right_40px"', true);
$table->data[1][1] .= __('Normal mode').' '.html_print_radio_button_extended('mode', 0, '', $mode, false, '', 'class="mrgn_right_40px"', true); $table->data[1][1] .= __('Normal mode').' '.html_print_radio_button_extended('mode', 0, '', $mode, false, '', 'class="mrgn_right_40px"', true);
$table->data[1][1] .= __('Autodisable mode').' '.html_print_radio_button_extended('mode', 2, '', $mode, false, '', 'class="mrgn_right_40px"', true); $table->data[1][1] .= __('Autodisable mode').' '.html_print_radio_button_extended('mode', 2, '', $mode, false, '', 'class="mrgn_right_40px"', true);
// Status (Disabled / Enabled) // Status (Disabled / Enabled).
$table->data[2][0] = __('Status'); $table->data[2][0] = __('Status');
$table->data[2][1] = __('No change').' '.html_print_radio_button_extended('disabled', -1, '', $disabled, false, '', 'class="mrgn_right_40px"', true); $table->data[2][1] = __('No change').' '.html_print_radio_button_extended('disabled', -1, '', $disabled, false, '', 'class="mrgn_right_40px"', true);
$table->data[2][1] .= __('Disabled').' '.ui_print_help_tip(__('If the remote configuration is enabled, it will also go into standby mode when disabling it.'), true).' '.html_print_radio_button_extended('disabled', 1, '', $disabled, false, '', 'class="mrgn_right_40px"', true); $table->data[2][1] .= __('Disabled').' '.ui_print_help_tip(__('If the remote configuration is enabled, it will also go into standby mode when disabling it.'), true).' '.html_print_radio_button_extended('disabled', 1, '', $disabled, false, '', 'class="mrgn_right_40px"', true);
$table->data[2][1] .= __('Active').' '.html_print_radio_button_extended('disabled', 0, '', $disabled, false, '', 'class="mrgn_right_40px"', true); $table->data[2][1] .= __('Active').' '.html_print_radio_button_extended('disabled', 0, '', $disabled, false, '', 'class="mrgn_right_40px"', true);
// Remote configuration // Remote configuration.
$table->data[3][0] = __('Remote configuration'); $table->data[3][0] = __('Remote configuration');
// Delete remote configuration // Delete remote configuration.
$table->data[3][1] = '<div id="delete_configurations" class="invisible">'.__('Delete available remote configurations').' ('; $table->data[3][1] = '<div id="delete_configurations" class="invisible">'.__('Delete available remote configurations').' (';
$table->data[3][1] .= '<span id="n_configurations"></span>'; $table->data[3][1] .= '<span id="n_configurations"></span>';
$table->data[3][1] .= ') '.html_print_checkbox_extended('delete_conf', 1, 0, false, '', 'class="mrgn_right_40px"', true).'</div>'; $table->data[3][1] .= ') '.html_print_checkbox_extended('delete_conf', 1, 0, false, '', 'class="mrgn_right_40px"', true).'</div>';
@ -700,7 +716,7 @@ $path = 'images/gis_map/icons/';
// TODO set better method the path // TODO set better method the path
if ($icon_path == '') { if ($icon_path == '') {
$display_icons = 'none'; $display_icons = 'none';
// Hack to show no icon. Use any given image to fix not found image errors // Hack to show no icon. Use any given image to fix not found image errors.
$path_without = 'images/spinner.png'; $path_without = 'images/spinner.png';
$path_default = 'images/spinner.png'; $path_default = 'images/spinner.png';
$path_ok = 'images/spinner.png'; $path_ok = 'images/spinner.png';
@ -801,7 +817,8 @@ foreach ($fields as $field) {
} }
if ($field['is_password_type']) { if ($field['is_password_type']) {
$data[1] = html_print_input_text_extended( $data[1] = html_print_input_password_avoid_autocomplete();
$data[1] .= html_print_input_text_extended(
'customvalue_'.$field['id_field'], 'customvalue_'.$field['id_field'],
$custom_value, $custom_value,
'customvalue_'.$field['id_field'], 'customvalue_'.$field['id_field'],
@ -864,7 +881,6 @@ var limit_parameters_massive = <?php echo $config['limit_parameters_massive']; ?
//Use this function for change 3 icons when change the selectbox //Use this function for change 3 icons when change the selectbox
$(document).ready (function () { $(document).ready (function () {
var checked = $("#cascade_protection").val(); var checked = $("#cascade_protection").val();
$("#cascade_protection_module").attr("disabled", 'disabled'); $("#cascade_protection_module").attr("disabled", 'disabled');
$("#cascade_protection").change(function () { $("#cascade_protection").change(function () {
@ -926,7 +942,6 @@ $(document).ready (function () {
); );
} }
$("#form_agent").submit(function() { $("#form_agent").submit(function() {
var get_parameters_count = window.location.href.slice( var get_parameters_count = window.location.href.slice(
window.location.href.indexOf('?') + 1).split('&').length; window.location.href.indexOf('?') + 1).split('&').length;
@ -942,11 +957,8 @@ $(document).ready (function () {
}); });
var disabled; var disabled;
$("#disabled").change(function () {
$("#disabled").click(function () {
disabled = this.value; disabled = this.value;
$("#id_group").trigger("change"); $("#id_group").trigger("change");
}); });
@ -1011,10 +1023,9 @@ $(document).ready (function () {
$("#id_group").trigger("change"); $("#id_group").trigger("change");
}); });
disabled = 2; disabled = 2;
$("#id_group").trigger("change"); //$("#id_group").trigger("change");
}); });

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