Merge remote-tracking branch 'origin/develop' into 3207-6970-update-manager-offline-no-funciona-v729
This commit is contained in:
commit
e5a658edf9
|
@ -247,4 +247,11 @@ button h3 {
|
|||
}
|
||||
.sev-Maintenance {
|
||||
background: #A8A8A8;
|
||||
}
|
||||
.sev-Minor {
|
||||
background: #F099A2;
|
||||
color: #333;
|
||||
}
|
||||
.sev-Major {
|
||||
background: #C97A4A;
|
||||
}
|
|
@ -29,11 +29,13 @@ function main() {
|
|||
if (isFetching) return;
|
||||
isFetching = true;
|
||||
|
||||
var feedUrl = localStorage["ip_address"]+'/include/api.php?op=get&op2=events&return_type=csv&apipass='+localStorage["api_pass"]+'&user='+localStorage["user_name"]+'&pass='+localStorage["pass"];
|
||||
var feedUrl = localStorage["ip_address"]+'/include/api.php?op=get&op2=events&return_type=json&apipass='+localStorage["api_pass"]+'&user='+localStorage["user_name"]+'&pass='+localStorage["pass"];
|
||||
|
||||
req = new XMLHttpRequest();
|
||||
req.onload = handleResponse;
|
||||
req.onerror = handleError;
|
||||
req.open("GET", feedUrl, true);
|
||||
req.withCredentials = true
|
||||
req.send(null);
|
||||
}
|
||||
|
||||
|
@ -132,25 +134,23 @@ function fetchNewEvents(A,B){
|
|||
function parseReplyEvents (reply) {
|
||||
|
||||
// Split the API response
|
||||
var e_array = reply.split("\n");
|
||||
var data = JSON.parse(reply)
|
||||
var e_array = JSON.parse(reply).data;
|
||||
|
||||
// Form a properly object
|
||||
var fetchedEvents=new Array();
|
||||
for(var i=0;i<e_array.length;i++){
|
||||
// Avoid to parse empty lines
|
||||
if (e_array[i].length == 0) continue;
|
||||
|
||||
var event=e_array[i].split(";");
|
||||
var event=e_array[i];
|
||||
fetchedEvents.push({
|
||||
'id' : event[0],
|
||||
'agent_name' : event[1],
|
||||
'agent' : event[2],
|
||||
'date' : event[5],
|
||||
'title' : event[6],
|
||||
'module' : event[9],
|
||||
'type' : event[14],
|
||||
'source' : event[17],
|
||||
'severity' : event[28],
|
||||
'id' : event.id_evento,
|
||||
'agent_name' : event.agent_name,
|
||||
'agent' : event.id_agent,
|
||||
'date' : event.timestamp,
|
||||
'title' : event.evento,
|
||||
'module' : event.id_agentmodule,
|
||||
'type' : event.event_type,
|
||||
'source' : event.source,
|
||||
'severity' : event.criticity_name,
|
||||
'visited' : false
|
||||
});
|
||||
}
|
||||
|
|
|
@ -1,17 +1,14 @@
|
|||
console.log("hola");
|
||||
|
||||
var url = window.location.href;
|
||||
var re = /\?event=(\d+)/;
|
||||
console.log("hola");
|
||||
if(re.exec(url)) {
|
||||
if(!isNaN(RegExp.$1)) {
|
||||
var eventId = RegExp.$1;
|
||||
document.write(chrome.extension.getBackgroundPage().getNotification(eventId));
|
||||
}
|
||||
}
|
||||
console.log("hola");
|
||||
window.onload = function () {
|
||||
setTimeout(function() {
|
||||
window.close();
|
||||
}, 10000);
|
||||
}
|
||||
console.log("hola");
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "__MSG_name__",
|
||||
"version": "2.0",
|
||||
"version": "2.1",
|
||||
"manifest_version": 2,
|
||||
"description": "Pandora FMS Event viewer Chrome extension",
|
||||
"homepage_url": "http://pandorafms.com",
|
||||
|
@ -23,6 +23,7 @@
|
|||
"tabs",
|
||||
"notifications",
|
||||
"http://*/*",
|
||||
"https://*/*",
|
||||
"background"
|
||||
],
|
||||
"default_locale": "en"
|
||||
|
|
|
@ -58,8 +58,17 @@ use strict;
|
|||
use File::Basename;
|
||||
use Getopt::Std;
|
||||
use IO::Select;
|
||||
use IO::Compress::Zip qw(zip $ZipError);
|
||||
use IO::Uncompress::Unzip qw(unzip $UnzipError);
|
||||
my $zlib_available = 1;
|
||||
|
||||
eval {
|
||||
eval "use IO::Compress::Zip qw(zip);1" or die($@);
|
||||
eval "use IO::Uncompress::Unzip qw(unzip);1" or die($@);
|
||||
};
|
||||
if ($@) {
|
||||
print_log ("Zip transfer not available, required libraries not found (IO::Compress::Zip, IO::Uncompress::Unzip).");
|
||||
$zlib_available = 0;
|
||||
}
|
||||
|
||||
use Socket (qw(SOCK_STREAM AF_INET AF_INET6));
|
||||
my $SOCKET_MODULE =
|
||||
eval { require IO::Socket::INET6 } ? 'IO::Socket::INET6'
|
||||
|
@ -324,7 +333,9 @@ sub parse_options {
|
|||
|
||||
# Compress data
|
||||
if (defined ($opts{'z'})) {
|
||||
$t_zip = 1;
|
||||
if ($zlib_available == 1) {
|
||||
$t_zip = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -622,7 +633,7 @@ sub zrecv_file {
|
|||
# Receive file
|
||||
$zdata = recv_data_block ($size);
|
||||
if (!unzip(\$zdata => \$data)) {
|
||||
print_log ("Uncompress error: $UnzipError");
|
||||
print_log ("Uncompress error: $IO::Uncompress::Unzip::UnzipError");
|
||||
send_data ("ZRECV ERR\n");
|
||||
return;
|
||||
}
|
||||
|
@ -705,7 +716,7 @@ sub zsend_file {
|
|||
# Read the file and compress its contents
|
||||
if (! zip($file => \$data)) {
|
||||
send_data ("QUIT\n");
|
||||
error ("Compression error: $ZipError");
|
||||
error ("Compression error: $IO::Compress::Zip::ZipError");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -725,7 +736,7 @@ sub zsend_file {
|
|||
error ("Server responded $response.");
|
||||
}
|
||||
|
||||
print_log ("Server responded SEND OK");
|
||||
print_log ("Server responded ZSEND OK");
|
||||
send_data ($data);
|
||||
|
||||
# Wait for server response
|
||||
|
|
|
@ -58,8 +58,17 @@ use strict;
|
|||
use File::Basename;
|
||||
use Getopt::Std;
|
||||
use IO::Select;
|
||||
use IO::Compress::Zip qw(zip $ZipError);
|
||||
use IO::Uncompress::Unzip qw(unzip $UnzipError);
|
||||
my $zlib_available = 1;
|
||||
|
||||
eval {
|
||||
eval "use IO::Compress::Zip qw(zip);1" or die($@);
|
||||
eval "use IO::Uncompress::Unzip qw(unzip);1" or die($@);
|
||||
};
|
||||
if ($@) {
|
||||
print_log ("Zip transfer not available, required libraries not found (IO::Compress::Zip, IO::Uncompress::Unzip).");
|
||||
$zlib_available = 0;
|
||||
}
|
||||
|
||||
use Socket (qw(SOCK_STREAM AF_INET AF_INET6));
|
||||
my $SOCKET_MODULE =
|
||||
eval { require IO::Socket::INET6 } ? 'IO::Socket::INET6'
|
||||
|
@ -324,7 +333,9 @@ sub parse_options {
|
|||
|
||||
# Compress data
|
||||
if (defined ($opts{'z'})) {
|
||||
$t_zip = 1;
|
||||
if ($zlib_available == 1) {
|
||||
$t_zip = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -622,7 +633,7 @@ sub zrecv_file {
|
|||
# Receive file
|
||||
$zdata = recv_data_block ($size);
|
||||
if (!unzip(\$zdata => \$data)) {
|
||||
print_log ("Uncompress error: $UnzipError");
|
||||
print_log ("Uncompress error: $IO::Uncompress::Unzip::UnzipError");
|
||||
send_data ("ZRECV ERR\n");
|
||||
return;
|
||||
}
|
||||
|
@ -705,7 +716,7 @@ sub zsend_file {
|
|||
# Read the file and compress its contents
|
||||
if (! zip($file => \$data)) {
|
||||
send_data ("QUIT\n");
|
||||
error ("Compression error: $ZipError");
|
||||
error ("Compression error: $IO::Compress::Zip::ZipError");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -725,7 +736,7 @@ sub zsend_file {
|
|||
error ("Server responded $response.");
|
||||
}
|
||||
|
||||
print_log ("Server responded SEND OK");
|
||||
print_log ("Server responded ZSEND OK");
|
||||
send_data ($data);
|
||||
|
||||
# Wait for server response
|
||||
|
|
|
@ -58,8 +58,17 @@ use strict;
|
|||
use File::Basename;
|
||||
use Getopt::Std;
|
||||
use IO::Select;
|
||||
use IO::Compress::Zip qw(zip $ZipError);
|
||||
use IO::Uncompress::Unzip qw(unzip $UnzipError);
|
||||
my $zlib_available = 1;
|
||||
|
||||
eval {
|
||||
eval "use IO::Compress::Zip qw(zip);1" or die($@);
|
||||
eval "use IO::Uncompress::Unzip qw(unzip);1" or die($@);
|
||||
};
|
||||
if ($@) {
|
||||
print_log ("Zip transfer not available, required libraries not found (IO::Compress::Zip, IO::Uncompress::Unzip).");
|
||||
$zlib_available = 0;
|
||||
}
|
||||
|
||||
use Socket (qw(SOCK_STREAM AF_INET AF_INET6));
|
||||
my $SOCKET_MODULE =
|
||||
eval { require IO::Socket::INET6 } ? 'IO::Socket::INET6'
|
||||
|
@ -324,7 +333,9 @@ sub parse_options {
|
|||
|
||||
# Compress data
|
||||
if (defined ($opts{'z'})) {
|
||||
$t_zip = 1;
|
||||
if ($zlib_available == 1) {
|
||||
$t_zip = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -622,7 +633,7 @@ sub zrecv_file {
|
|||
# Receive file
|
||||
$zdata = recv_data_block ($size);
|
||||
if (!unzip(\$zdata => \$data)) {
|
||||
print_log ("Uncompress error: $UnzipError");
|
||||
print_log ("Uncompress error: $IO::Uncompress::Unzip::UnzipError");
|
||||
send_data ("ZRECV ERR\n");
|
||||
return;
|
||||
}
|
||||
|
@ -705,7 +716,7 @@ sub zsend_file {
|
|||
# Read the file and compress its contents
|
||||
if (! zip($file => \$data)) {
|
||||
send_data ("QUIT\n");
|
||||
error ("Compression error: $ZipError");
|
||||
error ("Compression error: $IO::Compress::Zip::ZipError");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -725,7 +736,7 @@ sub zsend_file {
|
|||
error ("Server responded $response.");
|
||||
}
|
||||
|
||||
print_log ("Server responded SEND OK");
|
||||
print_log ("Server responded ZSEND OK");
|
||||
send_data ($data);
|
||||
|
||||
# Wait for server response
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
package: pandorafms-agent-unix
|
||||
Version: 7.0NG.729-181127
|
||||
Version: 7.0NG.729-181203
|
||||
Architecture: all
|
||||
Priority: optional
|
||||
Section: admin
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
pandora_version="7.0NG.729-181127"
|
||||
pandora_version="7.0NG.729-181203"
|
||||
|
||||
echo "Test if you has the tools for to make the packages."
|
||||
whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null
|
||||
|
|
|
@ -42,7 +42,7 @@ my $Sem = undef;
|
|||
my $ThreadSem = undef;
|
||||
|
||||
use constant AGENT_VERSION => '7.0NG.729';
|
||||
use constant AGENT_BUILD => '181127';
|
||||
use constant AGENT_BUILD => '181203';
|
||||
|
||||
# Agent log default file size maximum and instances
|
||||
use constant DEFAULT_MAX_LOG_SIZE => 600000;
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#
|
||||
%define name pandorafms_agent_unix
|
||||
%define version 7.0NG.729
|
||||
%define release 181127
|
||||
%define release 181203
|
||||
|
||||
Summary: Pandora FMS Linux agent, PERL version
|
||||
Name: %{name}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#
|
||||
%define name pandorafms_agent_unix
|
||||
%define version 7.0NG.729
|
||||
%define release 181127
|
||||
%define release 181203
|
||||
|
||||
Summary: Pandora FMS Linux agent, PERL version
|
||||
Name: %{name}
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
# **********************************************************************
|
||||
|
||||
PI_VERSION="7.0NG.729"
|
||||
PI_BUILD="181127"
|
||||
PI_BUILD="181203"
|
||||
OS_NAME=`uname -s`
|
||||
|
||||
FORCE=0
|
||||
|
|
|
@ -58,8 +58,17 @@ use strict;
|
|||
use File::Basename;
|
||||
use Getopt::Std;
|
||||
use IO::Select;
|
||||
use IO::Compress::Zip qw(zip $ZipError);
|
||||
use IO::Uncompress::Unzip qw(unzip $UnzipError);
|
||||
my $zlib_available = 1;
|
||||
|
||||
eval {
|
||||
eval "use IO::Compress::Zip qw(zip);1" or die($@);
|
||||
eval "use IO::Uncompress::Unzip qw(unzip);1" or die($@);
|
||||
};
|
||||
if ($@) {
|
||||
print_log ("Zip transfer not available, required libraries not found (IO::Compress::Zip, IO::Uncompress::Unzip).");
|
||||
$zlib_available = 0;
|
||||
}
|
||||
|
||||
use Socket (qw(SOCK_STREAM AF_INET AF_INET6));
|
||||
my $SOCKET_MODULE =
|
||||
eval { require IO::Socket::INET6 } ? 'IO::Socket::INET6'
|
||||
|
@ -324,7 +333,9 @@ sub parse_options {
|
|||
|
||||
# Compress data
|
||||
if (defined ($opts{'z'})) {
|
||||
$t_zip = 1;
|
||||
if ($zlib_available == 1) {
|
||||
$t_zip = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -622,7 +633,7 @@ sub zrecv_file {
|
|||
# Receive file
|
||||
$zdata = recv_data_block ($size);
|
||||
if (!unzip(\$zdata => \$data)) {
|
||||
print_log ("Uncompress error: $UnzipError");
|
||||
print_log ("Uncompress error: $IO::Uncompress::Unzip::UnzipError");
|
||||
send_data ("ZRECV ERR\n");
|
||||
return;
|
||||
}
|
||||
|
@ -705,7 +716,7 @@ sub zsend_file {
|
|||
# Read the file and compress its contents
|
||||
if (! zip($file => \$data)) {
|
||||
send_data ("QUIT\n");
|
||||
error ("Compression error: $ZipError");
|
||||
error ("Compression error: $IO::Compress::Zip::ZipError");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -725,7 +736,7 @@ sub zsend_file {
|
|||
error ("Server responded $response.");
|
||||
}
|
||||
|
||||
print_log ("Server responded SEND OK");
|
||||
print_log ("Server responded ZSEND OK");
|
||||
send_data ($data);
|
||||
|
||||
# Wait for server response
|
||||
|
|
|
@ -186,7 +186,7 @@ UpgradeApplicationID
|
|||
{}
|
||||
|
||||
Version
|
||||
{181127}
|
||||
{181203}
|
||||
|
||||
ViewReadme
|
||||
{Yes}
|
||||
|
|
|
@ -30,7 +30,7 @@ using namespace Pandora;
|
|||
using namespace Pandora_Strutils;
|
||||
|
||||
#define PATH_SIZE _MAX_PATH+1
|
||||
#define PANDORA_VERSION ("7.0NG.729(Build 181127)")
|
||||
#define PANDORA_VERSION ("7.0NG.729(Build 181203)")
|
||||
|
||||
string pandora_path;
|
||||
string pandora_dir;
|
||||
|
|
|
@ -11,7 +11,7 @@ BEGIN
|
|||
VALUE "LegalCopyright", "Artica ST"
|
||||
VALUE "OriginalFilename", "PandoraAgent.exe"
|
||||
VALUE "ProductName", "Pandora FMS Windows Agent"
|
||||
VALUE "ProductVersion", "(7.0NG.729(Build 181127))"
|
||||
VALUE "ProductVersion", "(7.0NG.729(Build 181203))"
|
||||
VALUE "FileVersion", "1.0.0.0"
|
||||
END
|
||||
END
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
package: pandorafms-console
|
||||
Version: 7.0NG.729-181127
|
||||
Version: 7.0NG.729-181203
|
||||
Architecture: all
|
||||
Priority: optional
|
||||
Section: admin
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
pandora_version="7.0NG.729-181127"
|
||||
pandora_version="7.0NG.729-181203"
|
||||
|
||||
package_pear=0
|
||||
package_pandora=1
|
||||
|
|
|
@ -46,7 +46,7 @@ else{
|
|||
echo sprintf(__('%s %s - Build %s - MR %s', get_product_name(), $pandora_version, $build_package_version, $config["MR"]));
|
||||
|
||||
echo '</a><br />';
|
||||
echo '<a class="white footer">'. __('Page generated at') . ' '. date('F j, Y h:i a'); //Always use timestamp here
|
||||
echo '<a class="white footer">'. __('Page generated at') . ' '. date($config["date_format"]);
|
||||
echo '</a><br /><span style="color:#eff">® '.get_copyright_notice().'</span>';
|
||||
|
||||
if (isset ($config['debug'])) {
|
||||
|
|
|
@ -261,7 +261,7 @@ if ($snmpwalk) {
|
|||
}
|
||||
|
||||
if ($create_modules) {
|
||||
$modules = get_parameter("module", array());
|
||||
$modules = io_safe_output(get_parameter("module", array()));
|
||||
|
||||
$devices = array();
|
||||
$processes = array();
|
||||
|
|
|
@ -229,15 +229,31 @@ $(document).ready (function () {
|
|||
});
|
||||
|
||||
$("#left").click (function () {
|
||||
var current_fields_size = ($('#fields_selected option').size());
|
||||
var selected_fields = [];
|
||||
var selected_fields_total = '';
|
||||
|
||||
jQuery.each($("select[name='fields_selected[]'] option:selected"), function (key, value) {
|
||||
field_name = $(value).html();
|
||||
if (field_name != <?php echo "'".__('None')."'"; ?>) {
|
||||
id_field = $(value).attr('value');
|
||||
$("select[name='fields_available[]']").append($("<option></option>").val(id_field).html('<i>' + field_name + '</i>'));
|
||||
$("#fields_selected").find("option[value='" + id_field + "']").remove();
|
||||
$("#fields_available").find("option[value='0']").remove();
|
||||
}
|
||||
field_name = $(value).html();
|
||||
selected_fields.push(field_name);
|
||||
selected_fields_total = selected_fields.length;
|
||||
});
|
||||
|
||||
if(selected_fields_total === current_fields_size){
|
||||
display_confirm_dialog(
|
||||
"<?php echo '<span style=text-transform:none;font-size:9.5pt;>'.__('There must be at least one custom field. Timestamp will be set by default').'</span>'; ?>",
|
||||
"<?php echo __('Confirm'); ?>",
|
||||
"<?php echo __('Cancel'); ?>",
|
||||
function () {
|
||||
move_left();
|
||||
$("#fields_available").find("option[value='timestamp']").remove();
|
||||
$("select[name='fields_selected[]']").append($("<option></option>").val('timestamp').html('<i>' + 'Timestamp' + '</i>'));
|
||||
}
|
||||
);
|
||||
}
|
||||
else{
|
||||
move_left();
|
||||
}
|
||||
});
|
||||
|
||||
$("#submit-upd_button").click(function () {
|
||||
|
@ -247,4 +263,16 @@ $(document).ready (function () {
|
|||
});
|
||||
});
|
||||
});
|
||||
|
||||
function move_left(){
|
||||
jQuery.each($("select[name='fields_selected[]'] option:selected"), function (key, value) {
|
||||
field_name = $(value).html();
|
||||
if (field_name != <?php echo "'".__('None')."'"; ?>) {
|
||||
id_field = $(value).attr('value');
|
||||
$("select[name='fields_available[]']").append($("<option></option>").val(id_field).html('<i>' + field_name + '</i>'));
|
||||
$("#fields_selected").find("option[value='" + id_field + "']").remove();
|
||||
$("#fields_available").find("option[value='0']").remove();
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -16,6 +16,8 @@
|
|||
|
||||
global $config;
|
||||
|
||||
include_once($config['homedir'] . "/include/functions_event_responses.php");
|
||||
|
||||
check_login ();
|
||||
|
||||
if (! check_acl($config['id_user'], 0, "PM")) {
|
||||
|
@ -25,14 +27,7 @@ if (! check_acl($config['id_user'], 0, "PM")) {
|
|||
return;
|
||||
}
|
||||
|
||||
if (!is_user_admin($config['id_user'])) {
|
||||
$id_groups = array_keys(users_get_groups(false, "PM"));
|
||||
$event_responses = db_get_all_rows_filter('tevent_response',
|
||||
array('id_group' => $id_groups));
|
||||
}
|
||||
else {
|
||||
$event_responses = db_get_all_rows_in_table('tevent_response');
|
||||
}
|
||||
$event_responses = event_responses_get_responses();
|
||||
|
||||
if(empty($event_responses)) {
|
||||
ui_print_info_message ( array('no_close'=>true, 'message'=> __('No responses found') ) );
|
||||
|
|
|
@ -40,24 +40,9 @@ switch($action) {
|
|||
$values['modal_height'] = get_parameter('modal_height');
|
||||
$values['new_window'] = get_parameter('new_window');
|
||||
$values['params'] = get_parameter('params');
|
||||
if (enterprise_installed()) {
|
||||
if ($values['type'] == 'command') {
|
||||
$values['server_to_exec'] = get_parameter('server_to_exec');
|
||||
}
|
||||
else {
|
||||
$values['server_to_exec'] = 0;
|
||||
}
|
||||
}
|
||||
else {
|
||||
$values['server_to_exec'] = 0;
|
||||
}
|
||||
|
||||
if($values['new_window'] == 1) {
|
||||
$values['modal_width'] = 0;
|
||||
$values['modal_height'] = 0;
|
||||
}
|
||||
|
||||
$result = db_process_sql_insert('tevent_response', $values);
|
||||
$values['server_to_exec'] = get_parameter('server_to_exec');
|
||||
|
||||
$result = event_responses_create_response($values);
|
||||
|
||||
if($result) {
|
||||
ui_print_success_message(__('Response added succesfully'));
|
||||
|
@ -78,26 +63,10 @@ switch($action) {
|
|||
$values['modal_height'] = get_parameter('modal_height');
|
||||
$values['new_window'] = get_parameter('new_window');
|
||||
$values['params'] = get_parameter('params');
|
||||
if (enterprise_installed()) {
|
||||
if ($values['type'] == 'command') {
|
||||
$values['server_to_exec'] = get_parameter('server_to_exec');
|
||||
}
|
||||
else {
|
||||
$values['server_to_exec'] = 0;
|
||||
}
|
||||
}
|
||||
else {
|
||||
$values['server_to_exec'] = 0;
|
||||
}
|
||||
|
||||
if($values['new_window'] == 1) {
|
||||
$values['modal_width'] = 0;
|
||||
$values['modal_height'] = 0;
|
||||
}
|
||||
|
||||
$values['server_to_exec'] = get_parameter('server_to_exec');
|
||||
$response_id = get_parameter('id_response',0);
|
||||
|
||||
$result = db_process_sql_update('tevent_response', $values, array('id' => $response_id));
|
||||
|
||||
$result = event_responses_update_response($response_id, $values);
|
||||
|
||||
if($result) {
|
||||
ui_print_success_message(__('Response updated succesfully'));
|
||||
|
|
|
@ -120,7 +120,9 @@ if (check_acl ($config['id_user'], 0, "AW")) {
|
|||
$sub2["godmode/massive/massive_operations&tab=massive_users"]["text"] = __('Users operations');
|
||||
}
|
||||
$sub2["godmode/massive/massive_operations&tab=massive_alerts"]["text"] = __('Alerts operations');
|
||||
enterprise_hook('massivepolicies_submenu');
|
||||
if ($config["centralized_management"] != 1) {
|
||||
enterprise_hook('massivepolicies_submenu');
|
||||
}
|
||||
enterprise_hook('massivesnmp_submenu');
|
||||
enterprise_hook('massivesatellite_submenu');
|
||||
|
||||
|
|
|
@ -49,7 +49,7 @@ You can of course remove the warnings, that's why we include the source and do n
|
|||
|
||||
ui_print_page_header (__('Module management') . ' » ' .
|
||||
__('Network component management'), "", false,
|
||||
"network_component", true,"",true,"modulemodal");
|
||||
"network_component", true,"",false,"modulemodal");
|
||||
$sec = 'gmodules';
|
||||
}
|
||||
|
||||
|
|
|
@ -1574,7 +1574,8 @@ You can of course remove the warnings, that's why we include the source and do n
|
|||
|
||||
<tr id="row_historical_db_check" style="" class="datos">
|
||||
<td style="font-weight:bold;">
|
||||
<?php echo __('Query History Database'); ?>
|
||||
<?php echo __('Query History Database')
|
||||
. ui_print_help_tip(__('With the token enabled the query will affect the Historical Database, which may mean a small drop in performance.'), true); ?>
|
||||
</td>
|
||||
<td style="">
|
||||
<?php
|
||||
|
|
|
@ -220,12 +220,11 @@ function update_button_palette_callback() {
|
|||
// TODO VALIDATE DATA
|
||||
switch (selectedItem) {
|
||||
case 'background':
|
||||
|
||||
if(values['width'] < 1024 || values['height'] < 768){
|
||||
alert('Min allowed size is 1024x768');
|
||||
return false;
|
||||
alert('Min allowed size is 1024x768');
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
if(values['width'] == 0 && values['height'] == 0) {
|
||||
values['width'] =
|
||||
$("#hidden-background_original_width").val();
|
||||
|
@ -235,7 +234,6 @@ function update_button_palette_callback() {
|
|||
$("#background").css('width', values['width']);
|
||||
$("#background").css('height', values['height']);
|
||||
|
||||
//$("#background").css('background', 'url(images/console/background/' + values['background'] + ')');
|
||||
var image = values['background'];
|
||||
$("#background_img").attr('src', "images/spinner.gif");
|
||||
set_image("background", null, image);
|
||||
|
@ -243,7 +241,6 @@ function update_button_palette_callback() {
|
|||
idElement = 0;
|
||||
break;
|
||||
case 'box_item':
|
||||
|
||||
if($('input[name=width_box]').val() == ''){
|
||||
alert('Undefined width');
|
||||
return false;
|
||||
|
@ -252,11 +249,11 @@ function update_button_palette_callback() {
|
|||
alert('Undefined height');
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
$("#" + idItem + " div").css('background-color', values['fill_color']);
|
||||
$("#" + idItem + " div").css('border-color', values['border_color']);
|
||||
$("#" + idItem + " div").css('border-width', values['border_width'] + "px");
|
||||
|
||||
|
||||
if(values['height_box']==0 || values['width_box']==0){
|
||||
$("#" + idItem + " div").css('width', "300px");
|
||||
$("#" + idItem + " div").css('height', "180px");
|
||||
|
@ -271,54 +268,43 @@ function update_button_palette_callback() {
|
|||
alert('Undefined image');
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
$("#text_" + idItem).html(values['label']);
|
||||
|
||||
|
||||
if(values['show_statistics'] == 1){
|
||||
|
||||
if (!$('#image_'+idItem).length) {
|
||||
|
||||
if(values['label_position'] == 'left'){
|
||||
|
||||
var $image = $('<img></img>')
|
||||
.attr('id', 'image_' + idItem)
|
||||
.attr('class', 'image')
|
||||
.attr('src', 'images/console/icons/'+values["image"]+".png")
|
||||
.attr('style','float:right;');
|
||||
|
||||
}
|
||||
else if(values['label_position'] == 'right'){
|
||||
|
||||
var $image = $('<img></img>')
|
||||
.attr('id', 'image_' + idItem)
|
||||
.attr('class', 'image')
|
||||
.attr('src', 'images/console/icons/'+values["image"]+".png")
|
||||
.attr('style','float:left;');
|
||||
|
||||
}
|
||||
else{
|
||||
|
||||
var $image = $('<img></img>')
|
||||
.attr('id', 'image_' + idItem)
|
||||
.attr('class', 'image')
|
||||
.attr('src', 'images/console/icons/'+values["image"]+".png");
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
$('#'+idItem).append($image);
|
||||
|
||||
}
|
||||
|
||||
|
||||
if ((values['width'] == 0) || (values['height'] == 0)) {
|
||||
$("#image_" + idItem).removeAttr('width');
|
||||
$("#image_" + idItem).removeAttr('height');
|
||||
$("#image_" + idItem).attr('width', 520);
|
||||
$("#image_" + idItem).attr('height', 80);
|
||||
$("#image_" + idItem).css('width', '520px');
|
||||
$("#image_" + idItem).css('height', '80px');
|
||||
$("#image_" + idItem).attr('src', 'images/console/signes/group_status.png');
|
||||
|
||||
$("#image_" + idItem).removeAttr('width');
|
||||
$("#image_" + idItem).removeAttr('height');
|
||||
$("#image_" + idItem).attr('width', 520);
|
||||
$("#image_" + idItem).attr('height', 80);
|
||||
$("#image_" + idItem).css('width', '520px');
|
||||
$("#image_" + idItem).css('height', '80px');
|
||||
$("#image_" + idItem).attr('src', 'images/console/signes/group_status.png');
|
||||
}
|
||||
else {
|
||||
$("#image_" + idItem).removeAttr('width');
|
||||
|
@ -328,49 +314,36 @@ function update_button_palette_callback() {
|
|||
$("#image_" + idItem).css('width', values['width'] + 'px');
|
||||
$("#image_" + idItem).css('height', values['height'] + 'px');
|
||||
$("#image_" + idItem).attr('src', 'images/console/signes/group_status.png');
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
else{
|
||||
|
||||
if ((values['width'] == 0) || (values['height'] == 0)) {
|
||||
|
||||
if(values['image'] != '' && values['image'] != 'none'){
|
||||
|
||||
if (!$('#image_'+idItem).length) {
|
||||
|
||||
if(values['label_position'] == 'left'){
|
||||
|
||||
var $image = $('<img></img>')
|
||||
.attr('id', 'image_' + idItem)
|
||||
.attr('class', 'image')
|
||||
.attr('src', 'images/console/icons/'+values["image"]+".png")
|
||||
.attr('style','float:right;');
|
||||
|
||||
}
|
||||
else if(values['label_position'] == 'right'){
|
||||
|
||||
var $image = $('<img></img>')
|
||||
.attr('id', 'image_' + idItem)
|
||||
.attr('class', 'image')
|
||||
.attr('src', 'images/console/icons/'+values["image"]+".png")
|
||||
.attr('style','float:left;');
|
||||
|
||||
}
|
||||
else{
|
||||
|
||||
var $image = $('<img></img>')
|
||||
.attr('id', 'image_' + idItem)
|
||||
.attr('class', 'image')
|
||||
.attr('src', 'images/console/icons/'+values["image"]+".png");
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
$('#'+idItem).append($image);
|
||||
|
||||
}
|
||||
|
||||
|
||||
if($('#preview > img').prop('naturalWidth') == null || $('#preview > img')[0].naturalWidth > 150 || $('#preview > img')[0].naturalHeight > 150){
|
||||
$("#image_" + idItem).removeAttr('width');
|
||||
$("#image_" + idItem).removeAttr('height');
|
||||
|
@ -382,15 +355,11 @@ function update_button_palette_callback() {
|
|||
else{
|
||||
$("#image_" + idItem).removeAttr('width');
|
||||
$("#image_" + idItem).removeAttr('height');
|
||||
|
||||
$("#image_" + idItem).attr('width', $('#preview > img')[0].naturalHeight);
|
||||
$("#image_" + idItem).attr('height', $('#preview > img')[0].naturalHeight);
|
||||
$("#image_" + idItem).css('width', $('#preview > img')[0].naturalHeight+'px');
|
||||
$("#image_" + idItem).css('height', $('#preview > img')[0].naturalHeight+'px');
|
||||
|
||||
|
||||
$("#image_" + idItem).css('height', $('#preview > img')[0].naturalHeight+'px');
|
||||
}
|
||||
|
||||
}
|
||||
else{
|
||||
$("#image_" + idItem).removeAttr('width');
|
||||
|
@ -401,7 +370,6 @@ function update_button_palette_callback() {
|
|||
$("#image_" + idItem).css('height', '70px');
|
||||
$("#image_" + idItem).remove();
|
||||
}
|
||||
|
||||
}
|
||||
else {
|
||||
$("#image_" + idItem).removeAttr('width');
|
||||
|
@ -411,14 +379,9 @@ function update_button_palette_callback() {
|
|||
$("#image_" + idItem).css('width', values['width'] + 'px');
|
||||
$("#image_" + idItem).css('height', values['height'] + 'px');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
break;
|
||||
case 'static_graph':
|
||||
|
||||
if($('input[name=width]').val() == ''){
|
||||
alert('Undefined width');
|
||||
return false;
|
||||
|
@ -433,10 +396,8 @@ function update_button_palette_callback() {
|
|||
}
|
||||
|
||||
$("#text_" + idItem).html(values['label']);
|
||||
|
||||
|
||||
if(values['show_statistics'] == 1){
|
||||
|
||||
|
||||
if ((values['width'] == 0) || (values['height'] == 0)) {
|
||||
$("#image_" + idItem).removeAttr('width');
|
||||
$("#image_" + idItem).removeAttr('height');
|
||||
|
@ -445,7 +406,6 @@ function update_button_palette_callback() {
|
|||
$("#image_" + idItem).css('width', '520px');
|
||||
$("#image_" + idItem).css('height', '80px');
|
||||
$("#image_" + idItem).attr('src', 'images/console/signes/group_status.png');
|
||||
|
||||
}
|
||||
else {
|
||||
$("#image_" + idItem).removeAttr('width');
|
||||
|
@ -455,50 +415,35 @@ function update_button_palette_callback() {
|
|||
$("#image_" + idItem).css('width', values['width'] + 'px');
|
||||
$("#image_" + idItem).css('height', values['height'] + 'px');
|
||||
$("#image_" + idItem).attr('src', 'images/console/signes/group_status.png');
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
else{
|
||||
|
||||
if ((values['width'] == 0) || (values['height'] == 0)) {
|
||||
|
||||
if(values['image'] != '' && values['image'] != 'none'){
|
||||
|
||||
if (!$('#image_'+idItem).length) {
|
||||
|
||||
if(values['label_position'] == 'left'){
|
||||
|
||||
var $image = $('<img></img>')
|
||||
.attr('id', 'image_' + idItem)
|
||||
.attr('class', 'image')
|
||||
.attr('src', 'images/console/icons/'+values["image"]+".png")
|
||||
.attr('style','float:right;');
|
||||
|
||||
}
|
||||
else if(values['label_position'] == 'right'){
|
||||
|
||||
var $image = $('<img></img>')
|
||||
.attr('id', 'image_' + idItem)
|
||||
.attr('class', 'image')
|
||||
.attr('src', 'images/console/icons/'+values["image"]+".png")
|
||||
.attr('style','float:left;');
|
||||
|
||||
}
|
||||
else{
|
||||
|
||||
var $image = $('<img></img>')
|
||||
.attr('id', 'image_' + idItem)
|
||||
.attr('class', 'image')
|
||||
.attr('src', 'images/console/icons/'+values["image"]+".png");
|
||||
|
||||
}
|
||||
|
||||
|
||||
$('#'+idItem).append($image);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
if($('#preview > img').prop('naturalWidth') == null || $('#preview > img')[0].naturalWidth > 150 || $('#preview > img')[0].naturalHeight > 150){
|
||||
$("#image_" + idItem).removeAttr('width');
|
||||
$("#image_" + idItem).removeAttr('height');
|
||||
|
@ -510,15 +455,11 @@ function update_button_palette_callback() {
|
|||
else{
|
||||
$("#image_" + idItem).removeAttr('width');
|
||||
$("#image_" + idItem).removeAttr('height');
|
||||
|
||||
$("#image_" + idItem).attr('width', $('#preview > img')[0].naturalHeight);
|
||||
$("#image_" + idItem).attr('height', $('#preview > img')[0].naturalHeight);
|
||||
$("#image_" + idItem).css('width', $('#preview > img')[0].naturalHeight+'px');
|
||||
$("#image_" + idItem).css('height', $('#preview > img')[0].naturalHeight+'px');
|
||||
|
||||
|
||||
$("#image_" + idItem).css('height', $('#preview > img')[0].naturalHeight+'px');
|
||||
}
|
||||
|
||||
}
|
||||
else{
|
||||
$("#image_" + idItem).removeAttr('width');
|
||||
|
@ -529,7 +470,6 @@ function update_button_palette_callback() {
|
|||
$("#image_" + idItem).css('height', '70px');
|
||||
$("#image_" + idItem).remove();
|
||||
}
|
||||
|
||||
}
|
||||
else {
|
||||
$("#image_" + idItem).removeAttr('width');
|
||||
|
@ -539,9 +479,7 @@ function update_button_palette_callback() {
|
|||
$("#image_" + idItem).css('width', values['width'] + 'px');
|
||||
$("#image_" + idItem).css('height', values['height'] + 'px');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
break;
|
||||
case 'percentile_bar':
|
||||
case 'percentile_item':
|
||||
|
@ -549,13 +487,15 @@ function update_button_palette_callback() {
|
|||
alert('Undefined width');
|
||||
return false;
|
||||
}
|
||||
|
||||
if($('input[name=height_percentile]').val() == ''){
|
||||
alert('Undefined height');
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
$("#text_" + idItem).html(values['label']);
|
||||
$("#image_" + idItem).attr("src", "images/spinner.gif");
|
||||
|
||||
if (values['type_percentile'] == 'bubble') {
|
||||
setPercentileBubble(idItem, values);
|
||||
}
|
||||
|
@ -568,7 +508,7 @@ function update_button_palette_callback() {
|
|||
else {
|
||||
setPercentileBar(idItem, values);
|
||||
}
|
||||
|
||||
|
||||
break;
|
||||
case 'module_graph':
|
||||
if($('#dir_items').html() == 'horizontal'){
|
||||
|
@ -801,6 +741,10 @@ function readFields() {
|
|||
values['label'] = $("input[name=label]").val();
|
||||
var text = tinymce.get('text-label').getContent();
|
||||
values['label'] = text;
|
||||
|
||||
if ($("input[name=percentile_label]").val().length > 0)
|
||||
values['label'] = $("input[name=percentile_label]").val();
|
||||
|
||||
values['line-height'] = $("#text-label_ifr").contents().find("p").css('line-height');
|
||||
values['type_graph'] = $("select[name=type_graph]").val();
|
||||
values['image'] = $("select[name=image]").val();
|
||||
|
@ -2479,7 +2423,6 @@ function setPercentileCircular (id_data, values) {
|
|||
width_percentile = values['width_percentile'];
|
||||
|
||||
var parameter = Array();
|
||||
|
||||
parameter.push ({name: "page", value: "include/ajax/visual_console_builder.ajax"});
|
||||
parameter.push ({name: "action", value: "get_module_value"});
|
||||
parameter.push ({name: "id_element", value: id_data});
|
||||
|
@ -2514,7 +2457,7 @@ function setPercentileCircular (id_data, values) {
|
|||
else {
|
||||
value_text = module_value + " " + unit_text;
|
||||
}
|
||||
|
||||
|
||||
$("#" + id_data + " img").attr('src', url_hack_metaconsole + 'images/console/signes/circular-progress-bar.png');
|
||||
if($('#text-width_percentile').val() == 0){
|
||||
$("#" + id_data + " img").css('width', '130px');
|
||||
|
@ -2524,12 +2467,12 @@ function setPercentileCircular (id_data, values) {
|
|||
$("#" + id_data + " img").css('width', $('#text-width_percentile').val()+'px');
|
||||
$("#" + id_data + " img").css('height', $('#text-width_percentile').val()+'px');
|
||||
}
|
||||
|
||||
|
||||
if($('#'+id_data+' table').css('float') == 'right' || $('#'+id_data+ ' table').css('float') == 'left'){
|
||||
$('#'+id_data+ ' img').css('margin-top', parseInt($('#'+id_data).css('height'))/2 - parseInt($('#'+id_data+ ' img').css('height'))/2);
|
||||
$('#'+id_data+ ' img').css('margin-top', parseInt($('#'+id_data).css('height'))/2 - parseInt($('#'+id_data+ ' img').css('height'))/2);
|
||||
}
|
||||
else{
|
||||
$('#'+id_data+ ' img').css('margin-left',parseInt($('#'+id_data).css('width'))/2 - parseInt($('#'+id_data+ ' img').css('width'))/2);
|
||||
$('#'+id_data+ ' img').css('margin-left',parseInt($('#'+id_data).css('width'))/2 - parseInt($('#'+id_data+ ' img').css('width'))/2);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -3835,14 +3778,12 @@ function updateDB_visual(type, idElement , values, event, top, left) {
|
|||
case 'clock':
|
||||
case 'auto_sla_graph':
|
||||
case 'donut_graph':
|
||||
|
||||
if ((typeof(values['mov_left']) != 'undefined') &&
|
||||
(typeof(values['mov_top']) != 'undefined')) {
|
||||
if ((typeof(values['absolute_left']) != 'undefined') &&
|
||||
(typeof(values['absolute_top']) != 'undefined')) {
|
||||
$("#" + idElement).css('top', '0px').css('top', top + 'px');
|
||||
$("#" + idElement).css('left', '0px').css('left', left + 'px');
|
||||
}
|
||||
else if ((typeof(values['absolute_left']) != 'undefined') &&
|
||||
(typeof(values['absolute_top']) != 'undefined')) {
|
||||
else{
|
||||
$("#" + idElement).css('top', '0px').css('top', top + 'px');
|
||||
$("#" + idElement).css('left', '0px').css('left', left + 'px');
|
||||
}
|
||||
|
@ -3952,7 +3893,6 @@ function updateDB(type, idElement , values, event) {
|
|||
parameter.push({name: key, value: val});
|
||||
});
|
||||
|
||||
|
||||
switch (type) {
|
||||
// -- line_item --
|
||||
case 'handler_start':
|
||||
|
|
|
@ -66,40 +66,19 @@ $id_profile = (int) get_parameter ('id');
|
|||
|
||||
// Profile deletion
|
||||
if ($delete_profile) {
|
||||
|
||||
$count_users_admin_in_profile = db_get_value_sql("
|
||||
SELECT COUNT(*)
|
||||
FROM tusuario
|
||||
WHERE is_admin = 1 AND id_user IN (
|
||||
SELECT id_usuario
|
||||
FROM tusuario_perfil
|
||||
WHERE id_perfil = " . $id_profile . ")");
|
||||
|
||||
if ($count_users_admin_in_profile >= 1) {
|
||||
ui_print_error_message(
|
||||
__('Unsucessful delete profile. Because the profile is used by some admin users.'));
|
||||
// Delete profile
|
||||
$profile = db_get_row('tperfil', 'id_perfil', $id_profile);
|
||||
$ret = profile_delete_profile_and_clean_users ($id_profile);
|
||||
if ($ret === false) {
|
||||
ui_print_error_message(__('There was a problem deleting the profile'));
|
||||
}
|
||||
else {
|
||||
// Delete profile
|
||||
$profile = db_get_row('tperfil', 'id_perfil', $id_profile);
|
||||
$sql = sprintf ('DELETE FROM tperfil WHERE id_perfil = %d', $id_profile);
|
||||
$ret = db_process_sql ($sql);
|
||||
if ($ret === false) {
|
||||
ui_print_error_message(__('There was a problem deleting the profile'));
|
||||
}
|
||||
else {
|
||||
db_pandora_audit("Profile management",
|
||||
"Delete profile ". $profile['name']);
|
||||
|
||||
ui_print_success_message(__('Successfully deleted'));
|
||||
}
|
||||
|
||||
//Delete profile from user data
|
||||
$sql = sprintf ('DELETE FROM tusuario_perfil WHERE id_perfil = %d', $id_profile);
|
||||
db_process_sql ($sql);
|
||||
|
||||
$id_profile = 0;
|
||||
db_pandora_audit("Profile management",
|
||||
"Delete profile ". $profile['name']);
|
||||
ui_print_success_message(__('Successfully deleted'));
|
||||
}
|
||||
|
||||
$id_profile = 0;
|
||||
}
|
||||
|
||||
// Store the variables when create or update
|
||||
|
|
|
@ -472,16 +472,17 @@ if ($list_modules) {
|
|||
$sort = get_parameter('sort', 'none');
|
||||
$selected = 'border: 1px solid black;';
|
||||
|
||||
$order[] = array('field' => 'tmodule_group.name', 'order' => 'ASC');
|
||||
switch ($sortField) {
|
||||
case 'type':
|
||||
switch ($sort) {
|
||||
case 'up':
|
||||
$selectTypeUp = $selected;
|
||||
$order = array('field' => 'tagente_modulo.id_modulo', 'order' => 'ASC');
|
||||
$order[] = array('field' => 'tagente_modulo.id_modulo', 'order' => 'ASC');
|
||||
break;
|
||||
case 'down':
|
||||
$selectTypeDown = $selected;
|
||||
$order = array('field' => 'tagente_modulo.id_modulo', 'order' => 'DESC');
|
||||
$order[] = array('field' => 'tagente_modulo.id_modulo', 'order' => 'DESC');
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
@ -489,11 +490,11 @@ if ($list_modules) {
|
|||
switch ($sort) {
|
||||
case 'up':
|
||||
$selectNameUp = $selected;
|
||||
$order = array('field' => 'tagente_modulo.nombre', 'order' => 'ASC');
|
||||
$order[] = array('field' => 'tagente_modulo.nombre', 'order' => 'ASC');
|
||||
break;
|
||||
case 'down':
|
||||
$selectNameDown = $selected;
|
||||
$order = array('field' => 'tagente_modulo.nombre', 'order' => 'DESC');
|
||||
$order[] = array('field' => 'tagente_modulo.nombre', 'order' => 'DESC');
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
@ -501,11 +502,11 @@ if ($list_modules) {
|
|||
switch ($sort) {
|
||||
case 'up':
|
||||
$selectStatusUp = $selected;
|
||||
$order = array('field' => 'tagente_estado.estado=0 DESC,tagente_estado.estado=3 DESC,tagente_estado.estado=2 DESC,tagente_estado.estado=1 DESC', 'order' => '');
|
||||
$order[] = array('field' => 'tagente_estado.estado=0 DESC,tagente_estado.estado=3 DESC,tagente_estado.estado=2 DESC,tagente_estado.estado=1 DESC', 'order' => '');
|
||||
break;
|
||||
case 'down':
|
||||
$selectStatusDown = $selected;
|
||||
$order = array('field' => 'tagente_estado.estado=1 DESC,tagente_estado.estado=2 DESC,tagente_estado.estado=3 DESC,tagente_estado.estado=0 DESC', 'order' => '');
|
||||
$order[] = array('field' => 'tagente_estado.estado=1 DESC,tagente_estado.estado=2 DESC,tagente_estado.estado=3 DESC,tagente_estado.estado=0 DESC', 'order' => '');
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
@ -513,11 +514,11 @@ if ($list_modules) {
|
|||
switch ($sort) {
|
||||
case 'up':
|
||||
$selectLastContactUp = $selected;
|
||||
$order = array('field' => 'tagente_estado.utimestamp', 'order' => 'ASC');
|
||||
$order[] = array('field' => 'tagente_estado.utimestamp', 'order' => 'ASC');
|
||||
break;
|
||||
case 'down':
|
||||
$selectLastContactDown = $selected;
|
||||
$order = array('field' => 'tagente_estado.utimestamp', 'order' => 'DESC');
|
||||
$order[] = array('field' => 'tagente_estado.utimestamp', 'order' => 'DESC');
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
@ -533,7 +534,7 @@ if ($list_modules) {
|
|||
$selectLastContactUp = '';
|
||||
$selectLastContactDown = '';
|
||||
|
||||
$order = array('field' => 'tagente_modulo.nombre', 'order' => 'ASC');
|
||||
$order[] = array('field' => 'tagente_modulo.nombre', 'order' => 'ASC');
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -588,7 +589,20 @@ if ($list_modules) {
|
|||
}
|
||||
|
||||
//Count monitors/modules
|
||||
$order_sql = $order['field'] . " " . $order['order'];
|
||||
|
||||
// Build the order sql
|
||||
$first = true;
|
||||
foreach ($order as $ord) {
|
||||
if ($first) {
|
||||
$first = false;
|
||||
}
|
||||
else {
|
||||
$order_sql .= ',';
|
||||
}
|
||||
|
||||
$order_sql .= $ord['field'].' '.$ord['order'];
|
||||
}
|
||||
|
||||
$sql_condition = "FROM tagente_modulo
|
||||
$tags_join
|
||||
INNER JOIN tagente_estado
|
||||
|
|
|
@ -25,13 +25,12 @@ if ($get_image_path_status){
|
|||
$only_src = get_parameter("only_src", 0);
|
||||
|
||||
$result = array();
|
||||
|
||||
|
||||
$result['bad'] = html_print_image($img_src . '_bad.png', true, '', $only_src);
|
||||
$result['ok'] = html_print_image($img_src . '_ok.png', true, '', $only_src);
|
||||
$result['warning'] = html_print_image($img_src . '_warning.png', true, '', $only_src);
|
||||
$result['ok'] = html_print_image($img_src . '_ok.png', true, '', $only_src);
|
||||
$result['normal'] = html_print_image($img_src . '.png', true, '', $only_src);
|
||||
|
||||
|
||||
echo json_encode($result);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -1,160 +0,0 @@
|
|||
<?php
|
||||
// Pandora FMS - http://pandorafms.com
|
||||
// ==================================================
|
||||
// Copyright (c) 2005-2009 Artica Soluciones Tecnologicas
|
||||
// Please see http://pandorafms.org for full contribution list
|
||||
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public License
|
||||
// as published by the Free Software Foundation; version 2
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
/**
|
||||
* @package Include/auth
|
||||
*/
|
||||
|
||||
|
||||
if (!isset ($config)) {
|
||||
die ('
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
<html>
|
||||
<head>
|
||||
<title>Pandora FMS - The Flexible Monitoring System - Console error</title>
|
||||
<meta http-equiv="expires" content="0">
|
||||
<meta http-equiv="content-type" content="text/html; charset=utf8">
|
||||
<meta name="resource-type" content="document">
|
||||
<meta name="distribution" content="global">
|
||||
<meta name="author" content="Artica ST">
|
||||
<meta name="copyright" content="(c) Artica ST">
|
||||
<meta name="robots" content="index, follow">
|
||||
<link rel="icon" href="../../images/pandora.ico" type="image/ico">
|
||||
<link rel="stylesheet" href="../styles/pandora.css" type="text/css">
|
||||
</head>
|
||||
<body>
|
||||
<div id="main" style="float:left; margin-left: 100px">
|
||||
<div align="center">
|
||||
<div id="login_f">
|
||||
<h1 id="log_f" class="error">You cannot access this file</h1>
|
||||
<div>
|
||||
<img src="../../images/pandora_logo.png" border="0"></a>
|
||||
</div>
|
||||
<div class="msg">
|
||||
<span class="error"><b>ERROR:</b>
|
||||
You can\'t access this file directly!</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
');
|
||||
}
|
||||
|
||||
$config["user_can_update_password"] = false;
|
||||
$config["admin_can_add_user"] = false;
|
||||
$config["admin_can_delete_user"] = false;
|
||||
$config["admin_can_disable_user"] = false;
|
||||
|
||||
global $dev_cache; //This variable needs to be globalized because this file is called from within a function and thus local
|
||||
|
||||
//DON'T USE THIS IF YOU DON'T KNOW WHAT YOU'RE DOING
|
||||
die ("This is a very dangerous authentication scheme. Only use for programming in case you should uncomment this line");
|
||||
|
||||
/**
|
||||
* process_user_login accepts $login and $pass and handles it according to current authentication scheme
|
||||
*
|
||||
* @param string $login
|
||||
* @param string $pass
|
||||
*
|
||||
* @return mixed False in case of error or invalid credentials, the username in case it's correct.
|
||||
*/
|
||||
function process_user_login ($login, $pass) {
|
||||
return false; //Error
|
||||
return $login; //Good
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a user is administrator.
|
||||
*
|
||||
* @param string User id.
|
||||
*
|
||||
* @return bool True is the user is admin
|
||||
*/
|
||||
function is_user_admin ($user) {
|
||||
return true; //User is admin
|
||||
return false; //User isn't
|
||||
}
|
||||
|
||||
/**
|
||||
* Check is a user exists in the system
|
||||
*
|
||||
* @param string User id.
|
||||
*
|
||||
* @return bool True if the user exists.
|
||||
*/
|
||||
function is_user ($id_user) {
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the users real name
|
||||
*
|
||||
* @param string User id.
|
||||
*
|
||||
* @return string The users full name
|
||||
*/
|
||||
function get_user_fullname ($id_user) {
|
||||
return "admin";
|
||||
return "";
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the users email
|
||||
*
|
||||
* @param string User id.
|
||||
*
|
||||
* @return string The users email address
|
||||
*/
|
||||
function get_user_email ($id_user) {
|
||||
return "test@example.com";
|
||||
return "";
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a list of all users in an array [username] => real name
|
||||
*
|
||||
* @param string Field to order by (id_usuario, nombre_real or fecha_registro)
|
||||
*
|
||||
* @return array An array of users
|
||||
*/
|
||||
function get_users ($order = "nombre_real") {
|
||||
return array ("admin" => "Admini Strator");
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the last login for a user
|
||||
*
|
||||
* @param string User id
|
||||
*/
|
||||
function process_user_contact ($id_user) {
|
||||
//void
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes the user
|
||||
*
|
||||
* @param string User id
|
||||
*/
|
||||
function delete_user ($id_user) {
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
//Reference the global use authorization error to last ldap error.
|
||||
$config["auth_error"] = &$dev_cache["auth_error"];
|
||||
?>
|
|
@ -123,7 +123,7 @@ if (file_exists ('languages/'.$user_language.'.mo')) {
|
|||
$params['height'],
|
||||
$params['water_mark_url'],
|
||||
$params['font'],
|
||||
$params['font_size'],
|
||||
$config['font_size'],
|
||||
$params['legend_position'],
|
||||
$params['colors'],
|
||||
$params['hide_labels']
|
||||
|
@ -142,7 +142,7 @@ if (file_exists ('languages/'.$user_language.'.mo')) {
|
|||
$params['water_mark_url'],
|
||||
$params['homedir'],
|
||||
$params['font'],
|
||||
$params['font_size'],
|
||||
$config['font_size'],
|
||||
$params['from_ux'],
|
||||
$params['from_wux'],
|
||||
$params['backgroundColor'],
|
||||
|
@ -156,7 +156,7 @@ if (file_exists ('languages/'.$user_language.'.mo')) {
|
|||
$params['height'],
|
||||
$params['water_mark_url'],
|
||||
$params['font'],
|
||||
$params['font_size'],
|
||||
$config['font_size'],
|
||||
$params['backgroundColor'],
|
||||
$params['tick_color'],
|
||||
$params['val_min'],
|
||||
|
@ -176,7 +176,7 @@ if (file_exists ('languages/'.$user_language.'.mo')) {
|
|||
'',
|
||||
$params['water_mark'],
|
||||
$params['font'],
|
||||
$params['font_size'],
|
||||
$config['font_size'],
|
||||
$params['unit'],
|
||||
$params['ttl'],
|
||||
$params['homeurl'],
|
||||
|
@ -213,6 +213,16 @@ if (file_exists ('languages/'.$user_language.'.mo')) {
|
|||
|
||||
$config['font_size'] = $aux_font_size;
|
||||
?>
|
||||
|
||||
<script type="text/javascript">
|
||||
$('document').ready(function () {
|
||||
setTimeout(function () {
|
||||
if (typeof window.callPhantom === 'function') {
|
||||
window.callPhantom("loaded");
|
||||
}
|
||||
}, 10);
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
/**
|
||||
* Pandora build version and version
|
||||
*/
|
||||
$build_version = 'PC181127';
|
||||
$build_version = 'PC181203';
|
||||
$pandora_version = 'v7.0NG.729';
|
||||
|
||||
// Do not overwrite default timezone set if defined.
|
||||
|
|
|
@ -3320,12 +3320,13 @@ function generator_chart_to_pdf($type_graph_pdf, $params, $params_combined = fal
|
|||
. ' "' . $session_id . '"'
|
||||
. ' "' . $params['return_img_base_64'] . '"';
|
||||
|
||||
$result = exec($cmd);
|
||||
exec($cmd, $result);
|
||||
$img_content = join("\n", $result);
|
||||
|
||||
if($params['return_img_base_64']){
|
||||
// To be used in alerts
|
||||
$width_img = 500;
|
||||
return $result;
|
||||
return $img_content;
|
||||
}
|
||||
else{
|
||||
// to be used in PDF files
|
||||
|
|
|
@ -360,12 +360,13 @@ function agents_get_agents ($filter = false, $fields = false,
|
|||
AND unknown_count > 0)";
|
||||
break;
|
||||
case AGENT_STATUS_NOT_NORMAL:
|
||||
$status_sql = "(
|
||||
critical_count > 0
|
||||
OR warning_count > 0
|
||||
OR unknown_count > 0
|
||||
OR total_count = 0
|
||||
OR total_count = notinit_count)";
|
||||
$status_sql =
|
||||
"normal_count <> total_count";
|
||||
//The AGENT_STATUS_NOT_NORMAL filter must show all agents that are not in normal status
|
||||
/*"(
|
||||
normal_count <> total_count
|
||||
AND
|
||||
(normal_count + notinit_count) <> total_count)";*/
|
||||
break;
|
||||
case AGENT_STATUS_NOT_INIT:
|
||||
$status_sql = "(
|
||||
|
|
|
@ -1845,9 +1845,9 @@ function get_group_alerts($id_group, $filter = '', $options = false,
|
|||
}
|
||||
}
|
||||
|
||||
$selectText = 'talert_template_modules.*, t2.nombre AS agent_module_name, t3.alias AS agent_name, t4.name AS template_name';
|
||||
$selectText = 'DISTINCT talert_template_modules.*, t2.nombre AS agent_module_name, t3.alias AS agent_name, t4.name AS template_name';
|
||||
if ($count !== false) {
|
||||
$selectText = 'COUNT(talert_template_modules.id) AS count';
|
||||
$selectText = 'COUNT(DISTINCT talert_template_modules.id) AS count';
|
||||
}
|
||||
|
||||
$sql = sprintf ("SELECT %s
|
||||
|
@ -1871,7 +1871,7 @@ function get_group_alerts($id_group, $filter = '', $options = false,
|
|||
return $alerts[0]['count'];
|
||||
}
|
||||
else {
|
||||
return $alerts;
|
||||
return $alerts;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -30,6 +30,8 @@ include_once($config['homedir'] . "/include/functions_network_components.php");
|
|||
include_once($config['homedir'] . "/include/functions_netflow.php");
|
||||
include_once($config['homedir'] . "/include/functions_servers.php");
|
||||
include_once($config['homedir'] . "/include/functions_planned_downtimes.php");
|
||||
include_once($config['homedir'] . "/include/functions_db.php");
|
||||
include_once($config['homedir'] . "/include/functions_event_responses.php");
|
||||
enterprise_include_once ('include/functions_local_components.php');
|
||||
enterprise_include_once ('include/functions_events.php');
|
||||
enterprise_include_once ('include/functions_agents.php');
|
||||
|
@ -8721,9 +8723,213 @@ function api_set_delete_user_profile($id, $thrash1, $other, $thrash2) {
|
|||
returnData('string', array('type' => 'string', 'data' => __('Delete user profile.')));
|
||||
}
|
||||
|
||||
/**
|
||||
* List all user profiles.
|
||||
*
|
||||
* @param Reserved $thrash1
|
||||
* @param Reserved $thrash2
|
||||
* @param Reserved $thrash3
|
||||
* @param string Return type (csv, json, string...)
|
||||
*
|
||||
* api.php?op=get&op2=user_profiles_info&return_type=json&apipass=1234&user=admin&pass=pandora
|
||||
*/
|
||||
function api_get_user_profiles_info ($thrash1, $thrash2, $thrash3, $returnType) {
|
||||
global $config;
|
||||
|
||||
if (!check_acl($config['id_user'], 0, "PM")){
|
||||
returnError('forbidden', 'string');
|
||||
return;
|
||||
}
|
||||
|
||||
$profiles = db_get_all_rows_filter(
|
||||
'tperfil',
|
||||
array(),
|
||||
array(
|
||||
"id_perfil",
|
||||
"name",
|
||||
"incident_view as IR",
|
||||
"incident_edit as IW",
|
||||
"incident_management as IM",
|
||||
"agent_view as AR",
|
||||
"agent_edit as AW",
|
||||
"agent_disable as AD",
|
||||
"alert_edit as LW",
|
||||
"alert_management as LM",
|
||||
"user_management as UM",
|
||||
"db_management as DM",
|
||||
"event_view as ER",
|
||||
"event_edit as EW",
|
||||
"event_management as EM",
|
||||
"report_view as RR",
|
||||
"report_edit as RW",
|
||||
"report_management as RM",
|
||||
"map_view as MR",
|
||||
"map_edit as MW",
|
||||
"map_management as MM",
|
||||
"vconsole_view as VR",
|
||||
"vconsole_edit as VW",
|
||||
"vconsole_management as VM",
|
||||
"pandora_management as PM"
|
||||
)
|
||||
);
|
||||
|
||||
if ($profiles === false) {
|
||||
returnError('error_list_profiles', __('Error retrieving profiles'));
|
||||
} else {
|
||||
returnData($returnType, array('type' => 'array', 'data' => $profiles));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an user profile.
|
||||
*
|
||||
* @param Reserved $thrash1
|
||||
* @param Reserved $thrash2
|
||||
* @param array parameters in array: name|IR|IW|IM|AR|AW|AD|LW|LM|UM|DM|ER|EW|EM|RR|RW|RM|MR|MW|MM|VR|VW|VM|PM
|
||||
* @param string Return type (csv, json, string...)
|
||||
*
|
||||
* api.php?op=set&op2=create_user_profile_info&return_type=json&other=API_profile%7C1%7C0%7C0%7C1%7C0%7C0%7C0%7C0%7C0%7C0%7C1%7C0%7C0%7C1%7C0%7C0%7C1%7C0%7C0%7C1%7C0%7C0%7C0&other_mode=url_encode_separator_%7C&apipass=1234&user=admin&pass=pandora
|
||||
*/
|
||||
function api_set_create_user_profile_info ($thrash1, $thrash2, $other, $returnType) {
|
||||
global $config;
|
||||
|
||||
if (!check_acl($config['id_user'], 0, "PM")){
|
||||
returnError('forbidden', 'string');
|
||||
return;
|
||||
}
|
||||
|
||||
$values = array(
|
||||
'name' => (string)$other['data'][0],
|
||||
'incident_view' => (bool)$other['data'][1] ? 1 : 0,
|
||||
'incident_edit' => (bool)$other['data'][2] ? 1 : 0,
|
||||
'incident_management' => (bool)$other['data'][3] ? 1 : 0,
|
||||
'agent_view' => (bool)$other['data'][4] ? 1 : 0,
|
||||
'agent_edit' => (bool)$other['data'][5] ? 1 : 0,
|
||||
'agent_disable' => (bool)$other['data'][6] ? 1 : 0,
|
||||
'alert_edit' => (bool)$other['data'][7] ? 1 : 0,
|
||||
'alert_management' => (bool)$other['data'][8] ? 1 : 0,
|
||||
'user_management' => (bool)$other['data'][9] ? 1 : 0,
|
||||
'db_management' => (bool)$other['data'][10] ? 1 : 0,
|
||||
'event_view' => (bool)$other['data'][11] ? 1 : 0,
|
||||
'event_edit' => (bool)$other['data'][12] ? 1 : 0,
|
||||
'event_management' => (bool)$other['data'][13] ? 1 : 0,
|
||||
'report_view' => (bool)$other['data'][14] ? 1 : 0,
|
||||
'report_edit' => (bool)$other['data'][15] ? 1 : 0,
|
||||
'report_management' => (bool)$other['data'][16] ? 1 : 0,
|
||||
'map_view' => (bool)$other['data'][17] ? 1 : 0,
|
||||
'map_edit' => (bool)$other['data'][18] ? 1 : 0,
|
||||
'map_management' => (bool)$other['data'][19] ? 1 : 0,
|
||||
'vconsole_view' => (bool)$other['data'][20] ? 1 : 0,
|
||||
'vconsole_edit' => (bool)$other['data'][21] ? 1 : 0,
|
||||
'vconsole_management' => (bool)$other['data'][22] ? 1 : 0,
|
||||
'pandora_management' => (bool)$other['data'][23] ? 1 : 0
|
||||
);
|
||||
|
||||
$return = db_process_sql_insert('tperfil', $values);
|
||||
|
||||
if ($return === false) {
|
||||
returnError('error_create_user_profile_info', __('Error creating user profile'));
|
||||
} else {
|
||||
returnData($returnType, array('type' => 'array', 'data' => 1));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update an user profile.
|
||||
*
|
||||
* @param int Profile id
|
||||
* @param Reserved $thrash1
|
||||
* @param array parameters in array: name|IR|IW|IM|AR|AW|AD|LW|LM|UM|DM|ER|EW|EM|RR|RW|RM|MR|MW|MM|VR|VW|VM|PM
|
||||
* @param string Return type (csv, json, string...)
|
||||
*
|
||||
* api.php?op=set&op2=update_user_profile_info&return_type=json&id=6&other=API_profile_updated%7C%7C%7C%7C1%7C1%7C1%7C%7C%7C%7C%7C%7C%7C%7C%7C%7C%7C%7C%7C%7C%7C%7C%7C&other_mode=url_encode_separator_%7C&apipass=1234&user=admin&pass=pandora
|
||||
*/
|
||||
function api_set_update_user_profile_info ($id_profile, $thrash1, $other, $returnType) {
|
||||
global $config;
|
||||
|
||||
if (!check_acl($config['id_user'], 0, "PM")){
|
||||
returnError('forbidden', 'string');
|
||||
return;
|
||||
}
|
||||
|
||||
$profile = db_get_row ('tperfil', 'id_perfil', $id_profile);
|
||||
if ($profile === false) {
|
||||
returnError('id_not_found', 'string');
|
||||
return;
|
||||
}
|
||||
|
||||
$values = array(
|
||||
'name' => $other['data'][0] == '' ? $profile['name'] : (string)$other['data'][0],
|
||||
'incident_view' => $other['data'][1] == '' ? $profile['incident_view'] : (bool)$other['data'][1] ? 1 : 0,
|
||||
'incident_edit' => $other['data'][2] == '' ? $profile['incident_edit'] : (bool)$other['data'][2] ? 1 : 0,
|
||||
'incident_management' => $other['data'][3] == '' ? $profile['incident_management'] : (bool)$other['data'][3] ? 1 : 0,
|
||||
'agent_view' => $other['data'][4] == '' ? $profile['agent_view'] : (bool)$other['data'][4] ? 1 : 0,
|
||||
'agent_edit' => $other['data'][5] == '' ? $profile['agent_edit'] : (bool)$other['data'][5] ? 1 : 0,
|
||||
'agent_disable' => $other['data'][6] == '' ? $profile['agent_disable'] : (bool)$other['data'][6] ? 1 : 0,
|
||||
'alert_edit' => $other['data'][7] == '' ? $profile['alert_edit'] : (bool)$other['data'][7] ? 1 : 0,
|
||||
'alert_management' => $other['data'][8] == '' ? $profile['alert_management'] : (bool)$other['data'][8] ? 1 : 0,
|
||||
'user_management' => $other['data'][9] == '' ? $profile['user_management'] : (bool)$other['data'][9] ? 1 : 0,
|
||||
'db_management' => $other['data'][10] == '' ? $profile['db_management'] : (bool)$other['data'][10] ? 1 : 0,
|
||||
'event_view' => $other['data'][11] == '' ? $profile['event_view'] : (bool)$other['data'][11] ? 1 : 0,
|
||||
'event_edit' => $other['data'][12] == '' ? $profile['event_edit'] : (bool)$other['data'][12] ? 1 : 0,
|
||||
'event_management' => $other['data'][13] == '' ? $profile['event_management'] : (bool)$other['data'][13] ? 1 : 0,
|
||||
'report_view' => $other['data'][14] == '' ? $profile['report_view'] : (bool)$other['data'][14] ? 1 : 0,
|
||||
'report_edit' => $other['data'][15] == '' ? $profile['report_edit'] : (bool)$other['data'][15] ? 1 : 0,
|
||||
'report_management' => $other['data'][16] == '' ? $profile['report_management'] : (bool)$other['data'][16] ? 1 : 0,
|
||||
'map_view' => $other['data'][17] == '' ? $profile['map_view'] : (bool)$other['data'][17] ? 1 : 0,
|
||||
'map_edit' => $other['data'][18] == '' ? $profile['map_edit'] : (bool)$other['data'][18] ? 1 : 0,
|
||||
'map_management' => $other['data'][19] == '' ? $profile['map_management'] : (bool)$other['data'][19] ? 1 : 0,
|
||||
'vconsole_view' => $other['data'][20] == '' ? $profile['vconsole_view'] : (bool)$other['data'][20] ? 1 : 0,
|
||||
'vconsole_edit' => $other['data'][21] == '' ? $profile['vconsole_edit'] : (bool)$other['data'][21] ? 1 : 0,
|
||||
'vconsole_management' => $other['data'][22] == '' ? $profile['vconsole_management'] : (bool)$other['data'][22] ? 1 : 0,
|
||||
'pandora_management' => $other['data'][23] == '' ? $profile['pandora_management'] : (bool)$other['data'][23] ? 1 : 0
|
||||
);
|
||||
|
||||
$return = db_process_sql_update('tperfil', $values, array('id_perfil' => $id_profile));
|
||||
|
||||
if ($return === false) {
|
||||
returnError('error_update_user_profile_info', __('Error updating user profile'));
|
||||
} else {
|
||||
returnData($returnType, array('type' => 'array', 'data' => 1));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete an user profile.
|
||||
*
|
||||
* @param int Profile id
|
||||
* @param Reserved $thrash1
|
||||
* @param Reserved $thrash2
|
||||
* @param string Return type (csv, json, string...)
|
||||
*
|
||||
* api.php?op=set&op2=delete_user_profile_info&return_type=json&id=7&other_mode=url_encode_separator_%7C&apipass=1234&user=admin&pass=pandora
|
||||
*/
|
||||
function api_set_delete_user_profile_info ($id_profile, $thrash1, $thrash2, $returnType) {
|
||||
global $config;
|
||||
|
||||
if (!check_acl($config['id_user'], 0, "PM")){
|
||||
returnError('forbidden', 'string');
|
||||
return;
|
||||
}
|
||||
|
||||
$profile = db_get_value ('id_perfil', 'tperfil', 'id_perfil', $id_profile);
|
||||
if ($profile === false) {
|
||||
returnError('id_not_found', 'string');
|
||||
return;
|
||||
}
|
||||
|
||||
$return = profile_delete_profile_and_clean_users($id_profile);
|
||||
|
||||
if ($return === false) {
|
||||
returnError('error_delete_user_profile_info', __('Error deleting user profile'));
|
||||
} else {
|
||||
returnData($returnType, array('type' => 'array', 'data' => 1));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Create new incident in Pandora.
|
||||
*
|
||||
*
|
||||
* @param $thrash1 Don't use.
|
||||
* @param $thrash2 Don't use.
|
||||
* @param array $other it's array, $other as param is <title>;<description>;
|
||||
|
@ -11468,6 +11674,159 @@ function api_get_modules_id_name_by_cluster_name ($cluster_name){
|
|||
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $trash1
|
||||
* @param $trash2
|
||||
* @param mixed $trash3
|
||||
* @param $returnType
|
||||
* Example:
|
||||
* api.php?op=get&op2=event_responses&return_type=csv&apipass=1234&user=admin&pass=pandora
|
||||
*/
|
||||
function api_get_event_responses($trash1, $trash2, $trash3, $returnType) {
|
||||
global $config;
|
||||
|
||||
// Error if user cannot read event responses.
|
||||
if (!check_acl($config['id_user'], 0, "PM")) {
|
||||
returnError('forbidden', $returnType);
|
||||
return;
|
||||
}
|
||||
|
||||
$responses = event_responses_get_responses();
|
||||
if (empty($responses)) {
|
||||
returnError('no_data_to_show', $returnType);
|
||||
return;
|
||||
}
|
||||
|
||||
returnData ($returnType, array('type' => 'array', 'data' => $responses));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $id_response
|
||||
* @param $trash2
|
||||
* @param mixed $trash3
|
||||
* @param $returnType
|
||||
* Example:
|
||||
* api.php?op=set&op2=delete_event_response&id=7&apipass=1234&user=admin&pass=pandora
|
||||
*/
|
||||
function api_set_delete_event_response($id_response, $trash1, $trash2, $returnType) {
|
||||
global $config;
|
||||
|
||||
// Error if user cannot read event responses.
|
||||
if (!check_acl($config['id_user'], 0, "PM")) {
|
||||
returnError('forbidden', $returnType);
|
||||
return;
|
||||
}
|
||||
|
||||
// Check if id exists
|
||||
$event_group = db_get_value('id_group', 'tevent_response','id', $id_response);
|
||||
if ($event_group === false) {
|
||||
returnError('id_not_found', $returnType);
|
||||
return;
|
||||
}
|
||||
|
||||
// Check user if can edit the module
|
||||
if (!check_acl($config['id_user'], $event_group, "PM")) {
|
||||
returnError('forbidden', $returnType);
|
||||
return;
|
||||
}
|
||||
|
||||
$result = db_process_sql_delete('tevent_response', array('id' => $id_response));
|
||||
returnData ($returnType, array('type' => 'string', 'data' => $result));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $trash1
|
||||
* @param $trash2
|
||||
* @param mixed $other. Serialized params
|
||||
* @param $returnType
|
||||
* Example:
|
||||
* api.php?op=set&op2=create_event_response&other=response%7Cdescription%20response%7Ctouch%7Ccommand%7C0%7C650%7C400%7C0%7Cresponse%7C0&other_mode=url_encode_separator_%7C&apipass=1234&user=admin&pass=pandora
|
||||
*/
|
||||
function api_set_create_event_response($trash1, $trash2, $other, $returnType) {
|
||||
global $config;
|
||||
|
||||
// Error if user cannot read event responses.
|
||||
if (!check_acl($config['id_user'], 0, "PM")) {
|
||||
returnError('forbidden', $returnType);
|
||||
return;
|
||||
}
|
||||
|
||||
$values = array();
|
||||
$values['name'] = $other['data'][0];
|
||||
$values['description'] = $other['data'][1];
|
||||
$values['target'] = $other['data'][2];
|
||||
$values['type'] = $other['data'][3];
|
||||
$values['id_group'] = $other['data'][4];
|
||||
$values['modal_width'] = $other['data'][5];
|
||||
$values['modal_height'] = $other['data'][6];
|
||||
$values['new_window'] = $other['data'][7];
|
||||
$values['params'] = $other['data'][8];
|
||||
$values['server_to_exec'] = $other['data'][9];
|
||||
|
||||
// Error if user has not permission for the group.
|
||||
if (!check_acl($config['id_user'], $values['id_group'], "PM")) {
|
||||
returnError('forbidden', $returnType);
|
||||
return;
|
||||
}
|
||||
|
||||
$return = event_responses_create_response($values) ? 1 : 0;
|
||||
|
||||
returnData ($returnType, array('type' => 'string', 'data' => $return));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $id_response
|
||||
* @param $trash2
|
||||
* @param mixed $other. Serialized params
|
||||
* @param $returnType
|
||||
* Example:
|
||||
* api.php?op=set&op2=update_event_response&id=7&other=response%7Cdescription%20response%7Ctouch%7Ccommand%7C0%7C650%7C400%7C0%7Cresponse%7C0&other_mode=url_encode_separator_%7C&apipass=1234&user=admin&pass=pandora
|
||||
*/
|
||||
function api_set_update_event_response($id_response, $trash1, $other, $returnType) {
|
||||
global $config;
|
||||
|
||||
// Error if user cannot read event responses.
|
||||
if (!check_acl($config['id_user'], 0, "PM")) {
|
||||
returnError('forbidden', $returnType);
|
||||
return;
|
||||
}
|
||||
|
||||
// Check if id exists
|
||||
$event_response = db_get_row('tevent_response','id', $id_response);
|
||||
if ($event_response === false) {
|
||||
returnError('id_not_found', $returnType);
|
||||
return;
|
||||
}
|
||||
|
||||
// Check user if can edit the module
|
||||
if (!check_acl($config['id_user'], $event_response['id_group'], "PM")) {
|
||||
returnError('forbidden', $returnType);
|
||||
return;
|
||||
}
|
||||
|
||||
$values = array();
|
||||
$values['name'] = $other['data'][0] == '' ? $event_response['name'] : $other['data'][0];
|
||||
$values['description'] = $other['data'][1] == '' ? $event_response['description'] : $other['data'][1];
|
||||
$values['target'] = $other['data'][2] == '' ? $event_response['target'] : $other['data'][2];
|
||||
$values['type'] = $other['data'][3] == '' ? $event_response['type'] : $other['data'][3];
|
||||
$values['id_group'] = $other['data'][4] == '' ? $event_response['id_group'] : $other['data'][4];
|
||||
$values['modal_width'] = $other['data'][5] == '' ? $event_response['modal_width'] : $other['data'][5];
|
||||
$values['modal_height'] = $other['data'][6] == '' ? $event_response['modal_height'] : $other['data'][6];
|
||||
$values['new_window'] = $other['data'][7] == '' ? $event_response['new_window'] : $other['data'][7];
|
||||
$values['params'] = $other['data'][8] == '' ? $event_response['params'] : $other['data'][8];
|
||||
$values['server_to_exec'] = $other['data'][9] == '' ? $event_response['server_to_exec'] : $other['data'][9];
|
||||
|
||||
// Error if user has not permission for the group.
|
||||
if (!check_acl($config['id_user'], $values['id_group'], "PM")) {
|
||||
returnError('forbidden', $returnType);
|
||||
return;
|
||||
}
|
||||
|
||||
$return = event_responses_update_response($id_response, $values) ? 1 : 0;
|
||||
|
||||
returnData ($returnType, array('type' => 'string', 'data' => $return));
|
||||
}
|
||||
|
||||
function api_get_cluster_items ($cluster_id){
|
||||
global $config;
|
||||
|
||||
|
@ -11512,8 +11871,142 @@ function util_api_check_agent_and_print_error($id_agent, $returnType, $access =
|
|||
return false;
|
||||
}
|
||||
|
||||
function api_set_validate_traps ($id, $thrash2, $other, $thrash3) {
|
||||
|
||||
if (defined ('METACONSOLE')) {
|
||||
return;
|
||||
}
|
||||
|
||||
if($id == 'all'){
|
||||
$result = db_process_sql_update('ttrap',array('status' => 1));
|
||||
}
|
||||
else{
|
||||
$result = db_process_sql_update('ttrap',
|
||||
array('status' => 1), array('id_trap' => $id));
|
||||
}
|
||||
|
||||
if (is_error($result)) {
|
||||
// TODO: Improve the error returning more info
|
||||
returnError('error_update_trap', __('Error in trap update.'));
|
||||
}
|
||||
else {
|
||||
returnData('string',
|
||||
array('type' => 'string',
|
||||
'data' => __('Validated traps.')));
|
||||
}
|
||||
}
|
||||
|
||||
function api_set_delete_traps ($id, $thrash2, $other, $thrash3) {
|
||||
|
||||
if (defined ('METACONSOLE')) {
|
||||
return;
|
||||
}
|
||||
|
||||
if($id == 'all'){
|
||||
$result = db_process_sql ('delete from ttrap');
|
||||
}
|
||||
else{
|
||||
$result = db_process_sql_delete('ttrap',array('id_trap' => $id));
|
||||
}
|
||||
|
||||
if (is_error($result)) {
|
||||
// TODO: Improve the error returning more info
|
||||
returnError('error_delete_trap', __('Error in trap delete.'));
|
||||
}
|
||||
else {
|
||||
returnData('string',
|
||||
array('type' => 'string',
|
||||
'data' => __('Deleted traps.')));
|
||||
}
|
||||
}
|
||||
|
||||
function api_get_group_id_by_name($thrash1, $thrash2, $other, $thrash3) {
|
||||
if (defined ('METACONSOLE')) {
|
||||
return;
|
||||
}
|
||||
|
||||
$sql = sprintf('SELECT id_grupo
|
||||
FROM tgrupo WHERE nombre = "'.$other['data'].'"');
|
||||
|
||||
$group_id = db_get_all_rows_sql($sql);
|
||||
|
||||
if (count($group_id) > 0 and $group_id !== false) {
|
||||
$data = array('type' => 'array', 'data' => $group_id);
|
||||
|
||||
returnData('csv', $data, ';');
|
||||
}
|
||||
else {
|
||||
returnError('error_group_name', 'No groups retrieved.');
|
||||
}
|
||||
}
|
||||
|
||||
function api_get_timezone($thrash1, $thrash2, $other, $thrash3) {
|
||||
if (defined ('METACONSOLE')) {
|
||||
return;
|
||||
}
|
||||
|
||||
$sql = sprintf('SELECT value
|
||||
FROM tconfig WHERE token = "timezone"');
|
||||
|
||||
$timezone = db_get_all_rows_sql($sql);
|
||||
|
||||
if (count($timezone) > 0 and $timezone !== false) {
|
||||
|
||||
$data = array('type' => 'string', 'data' => $timezone);
|
||||
|
||||
returnData('string',array('type' => 'string','data' => $data['data'][0]['value']));
|
||||
|
||||
}
|
||||
else {
|
||||
returnError('error_timezone', 'No timezone retrieved.');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function api_get_language($thrash1, $thrash2, $other, $thrash3) {
|
||||
if (defined ('METACONSOLE')) {
|
||||
return;
|
||||
}
|
||||
|
||||
$sql = sprintf('SELECT value
|
||||
FROM tconfig WHERE token = "language"');
|
||||
|
||||
$language = db_get_all_rows_sql($sql);
|
||||
|
||||
if (count($language) > 0 and $language !== false) {
|
||||
|
||||
$data = array('type' => 'string', 'data' => $language);
|
||||
|
||||
returnData('string',array('type' => 'string','data' => $data['data'][0]['value']));
|
||||
|
||||
}
|
||||
else {
|
||||
returnError('error_language', 'No language retrieved.');
|
||||
}
|
||||
}
|
||||
|
||||
function api_get_session_timeout($thrash1, $thrash2, $other, $thrash3) {
|
||||
if (defined ('METACONSOLE')) {
|
||||
return;
|
||||
}
|
||||
|
||||
$sql = sprintf('SELECT value
|
||||
FROM tconfig WHERE token = "session_timeout"');
|
||||
|
||||
$language = db_get_all_rows_sql($sql);
|
||||
|
||||
if (count($language) > 0 and $language !== false) {
|
||||
|
||||
$data = array('type' => 'string', 'data' => $language);
|
||||
|
||||
returnData('string',array('type' => 'string','data' => $data['data'][0]['value']));
|
||||
|
||||
}
|
||||
else {
|
||||
returnError('error_session_timeout', 'No session timeout retrieved.');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
?>
|
||||
|
|
|
@ -0,0 +1,80 @@
|
|||
<?php
|
||||
|
||||
// Pandora FMS - http://pandorafms.com
|
||||
// ==================================================
|
||||
// Copyright (c) 2005-2018 Artica Soluciones Tecnologicas
|
||||
// Please see http://pandorafms.org for full contribution list
|
||||
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public License
|
||||
// as published by the Free Software Foundation; version 2
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
/**
|
||||
* @package Include
|
||||
* @subpackage Event Responses
|
||||
*/
|
||||
|
||||
/**
|
||||
* Get all event responses with all values that user can access
|
||||
*
|
||||
* @return array With all table values
|
||||
*/
|
||||
function event_responses_get_responses() {
|
||||
global $config;
|
||||
$filter = array();
|
||||
|
||||
// Apply a filter if user cannot see all groups
|
||||
if (!users_can_manage_group_all()) {
|
||||
$id_groups = array_keys(users_get_groups(false, "PM"));
|
||||
$filter = array('id_group' => $id_groups);
|
||||
}
|
||||
return db_get_all_rows_filter('tevent_response', $filter);
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate the responses data to store in database
|
||||
*
|
||||
* @param array (by reference) Array with values to validate and modify
|
||||
*/
|
||||
function event_responses_validate_data (&$values) {
|
||||
if ($values['type'] != "command" || !enterprise_installed()) {
|
||||
$values['server_to_exec'] = 0;
|
||||
}
|
||||
if ($values['new_window'] == 1) {
|
||||
$values['modal_width'] = 0;
|
||||
$values['modal_height'] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an event response
|
||||
*
|
||||
* @param array With all event response data
|
||||
*
|
||||
* @return True if successful insertion
|
||||
*/
|
||||
function event_responses_create_response($values) {
|
||||
event_responses_validate_data($values);
|
||||
return db_process_sql_insert('tevent_response', $values);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update an event response
|
||||
*
|
||||
* @param array With all event response data
|
||||
*
|
||||
* @return True if successful insertion
|
||||
*/
|
||||
function event_responses_update_response($response_id, $values) {
|
||||
event_responses_validate_data($values);
|
||||
return db_process_sql_update(
|
||||
'tevent_response', $values, array('id' => $response_id)
|
||||
);
|
||||
}
|
||||
|
||||
?>
|
|
@ -853,10 +853,15 @@ function events_print_event_table ($filter = "", $limit = 10, $width = 440, $ret
|
|||
$filter = '1 = 1';
|
||||
}
|
||||
|
||||
$secondary_join = '';
|
||||
if (!users_can_manage_group_all("ER")) {
|
||||
$secondary_join = "LEFT JOIN tagent_secondary_group tasg ON tevento.id_agente = tasg.id_agent";
|
||||
}
|
||||
|
||||
$sql = sprintf ("SELECT DISTINCT tevento.*
|
||||
FROM tevento LEFT JOIN tagent_secondary_group tasg ON tevento.id_agente = tasg.id_agent
|
||||
FROM tevento %s
|
||||
WHERE %s %s
|
||||
ORDER BY utimestamp DESC LIMIT %d", $agent_condition, $filter, $limit);
|
||||
ORDER BY utimestamp DESC LIMIT %d", $secondary_join, $agent_condition, $filter, $limit);
|
||||
|
||||
$result = db_get_all_rows_sql ($sql);
|
||||
|
||||
|
|
|
@ -238,7 +238,7 @@ function grafico_modulo_sparse_data(
|
|||
}
|
||||
}
|
||||
|
||||
if($array_data === false){
|
||||
if($array_data === false || !isset($array_data['sum1']['data'][0][1])){
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -912,7 +912,9 @@ function grafico_modulo_sparse ($params) {
|
|||
else{
|
||||
$return = graph_nodata_image(
|
||||
$params['width'],
|
||||
$params['height']
|
||||
$params['height'],
|
||||
'area',
|
||||
__('No data to display within the selected interval')
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -2456,7 +2458,9 @@ function graph_sla_slicebar (
|
|||
0,
|
||||
array(),
|
||||
true,
|
||||
$ttl
|
||||
$ttl,
|
||||
false,
|
||||
false
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -3282,13 +3286,10 @@ function graph_graphic_moduleevents ($id_agent, $id_module, $width, $height, $pe
|
|||
|
||||
$data = array ();
|
||||
|
||||
//$resolution = $config['graph_res'] * ($period * 2 / $width); // Number of "slices" we want in graph
|
||||
$resolution = 5 * ($period * 2 / $width); // Number of "slices" we want in graph
|
||||
$interval = (int) ($period / $resolution);
|
||||
$date = get_system_time ();
|
||||
$interval = 24;
|
||||
$date = get_system_time();
|
||||
$datelimit = $date - $period;
|
||||
$periodtime = floor ($period / $interval);
|
||||
$time = array ();
|
||||
$data = array ();
|
||||
$legend = array();
|
||||
$full_legend = array();
|
||||
|
@ -3592,6 +3593,7 @@ function fullscale_data (
|
|||
}
|
||||
}
|
||||
else{
|
||||
if ($data_uncompress === false) $data_uncompress = array();
|
||||
foreach ($data_uncompress as $k) {
|
||||
foreach ($k["data"] as $v) {
|
||||
if (isset($v["type"]) && $v["type"] == 1) { # skip unnecesary virtual data
|
||||
|
@ -3660,7 +3662,9 @@ function fullscale_data (
|
|||
|
||||
$data["sum" . $series_suffix]['min'] = $min_value_min;
|
||||
$data["sum" . $series_suffix]['max'] = $max_value_max;
|
||||
$data["sum" . $series_suffix]['avg'] = $sum_data/$count_data;
|
||||
$data["sum" . $series_suffix]['avg'] = $count_data == 0
|
||||
? 0
|
||||
: $sum_data/$count_data;
|
||||
}
|
||||
|
||||
if($show_percentil && !$compare){
|
||||
|
@ -4068,19 +4072,17 @@ function graphic_module_events ($id_module, $width, $height, $period = 0, $homeu
|
|||
}
|
||||
|
||||
function graph_nodata_image($width = 300, $height = 110, $type = 'area', $text = '') {
|
||||
$image = ui_get_full_url('images/image_problem_area_small.png',
|
||||
$image = ui_get_full_url('images/image_problem_area.png',
|
||||
false, false, false);
|
||||
|
||||
// if ($text == '') {
|
||||
// $text = __('No data to show');
|
||||
// }
|
||||
$text_div = '<div class="nodata_text" style="text-align:center; padding: 30px 0; display:block; font-size:9.5pt;">' . $text . '</div>';
|
||||
|
||||
$text_div = '<div class="nodata_text">' . $text . '</div>';
|
||||
$image_div = $text_div . '<div class="nodata_container" style="background-position: top; width:40%;height:40%;background-size: contain;background-image: url(\'' . $image . '\');"><div></div></div>';
|
||||
|
||||
$image_div = '<div class="nodata_container" style="width:80%;height:80%;background-size: 80% 80%;background-image: url(\'' . $image . '\');">' .
|
||||
$text_div . '</div>';
|
||||
|
||||
$div = '<div style="width:' . $width . 'px; height:' . $height . 'px; border: 1px dotted #ddd; background-color: white; margin: 0 auto;">' .
|
||||
$div = '<div style="width:' . $width . 'px; height:' . $height . 'px; background-color: white; margin: 0 auto;">' .
|
||||
$image_div . '</div>';
|
||||
|
||||
return $div;
|
||||
|
|
|
@ -144,6 +144,20 @@ function profile_delete_profile ($id_profile) {
|
|||
return (bool)db_process_sql_delete('tperfil', array('id_perfil' => $id_profile));
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete profile from database and remove from the assigned users (tusuario_perfil)
|
||||
*
|
||||
* @param int Profile ID
|
||||
*
|
||||
* @return bool Whether or not it's deleted in both tables
|
||||
*/
|
||||
function profile_delete_profile_and_clean_users ($id_profile) {
|
||||
return
|
||||
(bool)db_process_sql_delete('tperfil', array('id_perfil' => $id_profile)) &&
|
||||
(bool)db_process_sql_delete('tusuario_perfil', array('id_perfil' => $id_profile))
|
||||
;
|
||||
}
|
||||
|
||||
/**
|
||||
* Print the table to display, create and delete profiles
|
||||
*
|
||||
|
|
|
@ -144,6 +144,35 @@ function reporting_make_reporting_data($report = null, $id_report,
|
|||
$metaconsole_on = is_metaconsole();
|
||||
$index_content = 0;
|
||||
foreach ($contents as $content) {
|
||||
|
||||
if (!empty($content["id_agent_module"]) && !empty($content["id_agent"])
|
||||
&& tags_has_user_acl_tags($config['id_user'])) {
|
||||
$where_tags = tags_get_acl_tags(
|
||||
$config['id_user'],
|
||||
$id_groups,
|
||||
'AR',
|
||||
'module_condition',
|
||||
'AND',
|
||||
'tagente_modulo',
|
||||
false,
|
||||
array(),
|
||||
true);
|
||||
|
||||
$sql_tags_join = "INNER JOIN tagente ON tagente.id_agente = t1.id_agente
|
||||
INNER JOIN ttag_module ON ttag_module.id_agente_modulo = t1.id_agente_modulo";
|
||||
|
||||
$sql = sprintf('SELECT count(*) FROM tagente_modulo t1
|
||||
%s WHERE t1.delete_pending = 0 AND t1.id_agente_modulo = '. $content["id_agent_module"] .'
|
||||
AND t1.id_agente = ' . $content['id_agent'] . ' %s',
|
||||
$sql_tags_join, $where_tags);
|
||||
|
||||
$result_tags = db_get_value_sql($sql);
|
||||
|
||||
if (!$result_tags) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
$server_name = $content['server_name'];
|
||||
|
||||
// General reports with 0 period means last value
|
||||
|
@ -218,11 +247,11 @@ function reporting_make_reporting_data($report = null, $id_report,
|
|||
}
|
||||
}
|
||||
|
||||
if(sizeof($content['id_agent']) != 1){
|
||||
if(is_array($content['id_agent']) && sizeof($content['id_agent']) != 1){
|
||||
$content['style']['name_label'] = str_replace("_agent_",sizeof($content['id_agent']).__(' agents'),$content['style']['name_label']);
|
||||
}
|
||||
|
||||
if(sizeof($content['id_agent_module']) != 1){
|
||||
if(is_array($content['id_agent_module']) && sizeof($content['id_agent_module']) != 1){
|
||||
$content['style']['name_label'] = str_replace("_module_",sizeof($content['id_agent_module']).__(' modules'),$content['style']['name_label']);
|
||||
}
|
||||
|
||||
|
@ -6063,6 +6092,7 @@ function reporting_general($report, $content) {
|
|||
$i = 0;
|
||||
$index = 0;
|
||||
$is_string = array();
|
||||
|
||||
foreach ($generals as $row) {
|
||||
//Metaconsole connection
|
||||
$server_name = $row ['server_name'];
|
||||
|
@ -6352,7 +6382,17 @@ function reporting_custom_graph($report, $content, $type = 'dinamic',
|
|||
}
|
||||
}
|
||||
else{
|
||||
$modules[] = $content['id_agent_module'];
|
||||
if ($content['id_agent_module']) {
|
||||
$modules[] = $content['id_agent_module'];
|
||||
} else {
|
||||
// restore to metaconsole database
|
||||
metaconsole_restore_db();
|
||||
$module_source = db_get_all_rows_sql("SELECT id_agent_module FROM tgraph_source WHERE id_graph = " . $content['id_gs']);
|
||||
foreach ($module_source as $key => $value) {
|
||||
$modules[$key] = $value['id_agent_module'];
|
||||
}
|
||||
metaconsole_connect($server);
|
||||
}
|
||||
}
|
||||
$id_graph = 0;
|
||||
}
|
||||
|
@ -6407,7 +6447,7 @@ function reporting_custom_graph($report, $content, $type = 'dinamic',
|
|||
break;
|
||||
}
|
||||
|
||||
if ($config['metaconsole'] && $type_report != 'automatic_graph') {
|
||||
if ($config['metaconsole']) {
|
||||
metaconsole_restore_db();
|
||||
}
|
||||
|
||||
|
@ -7503,8 +7543,8 @@ function reporting_get_stats_alerts($data, $links = false) {
|
|||
$urls['monitor_alerts'] = "index.php?sec=estado&sec2=operation/agentes/alerts_status&pure=" . $config['pure'];
|
||||
$urls['monitor_alerts_fired'] = "index.php?sec=estado&sec2=operation/agentes/alerts_status&filter=fired&pure=" . $config['pure'];
|
||||
} else {
|
||||
$urls['monitor_alerts'] = "index.php?sec=estado&sec2=operation/agentes/alerts_status&refr=60";
|
||||
$urls['monitor_alerts_fired'] = "index.php?sec=estado&sec2=operation/agentes/alerts_status&refr=60&filter=fired";
|
||||
$urls['monitor_alerts'] = $config['homeurl']."index.php?sec=estado&sec2=operation/agentes/alerts_status&refr=60";
|
||||
$urls['monitor_alerts_fired'] = $config['homeurl']."index.php?sec=estado&sec2=operation/agentes/alerts_status&refr=60&filter=fired";
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -7560,19 +7600,19 @@ function reporting_get_stats_modules_status($data, $graph_width = 250, $graph_he
|
|||
// Link URLS
|
||||
if ($links === false) {
|
||||
$urls = array();
|
||||
$urls['monitor_critical'] = "index.php?" .
|
||||
$urls['monitor_critical'] = $config['homeurl']."index.php?" .
|
||||
"sec=view&sec2=operation/agentes/status_monitor&" .
|
||||
"refr=60&status=" . AGENT_MODULE_STATUS_CRITICAL_BAD . "&pure=" . $config['pure'];
|
||||
$urls['monitor_warning'] = "index.php?" .
|
||||
$urls['monitor_warning'] = $config['homeurl']."index.php?" .
|
||||
"sec=view&sec2=operation/agentes/status_monitor&" .
|
||||
"refr=60&status=" . AGENT_MODULE_STATUS_WARNING . "&pure=" . $config['pure'];
|
||||
$urls['monitor_ok'] = "index.php?" .
|
||||
$urls['monitor_ok'] = $config['homeurl']."index.php?" .
|
||||
"sec=view&sec2=operation/agentes/status_monitor&" .
|
||||
"refr=60&status=" . AGENT_MODULE_STATUS_NORMAL . "&pure=" . $config['pure'];
|
||||
$urls['monitor_unknown'] = "index.php?" .
|
||||
$urls['monitor_unknown'] = $config['homeurl']."index.php?" .
|
||||
"sec=view&sec2=operation/agentes/status_monitor&" .
|
||||
"refr=60&status=" . AGENT_MODULE_STATUS_UNKNOWN . "&pure=" . $config['pure'];
|
||||
$urls['monitor_not_init'] = "index.php?" .
|
||||
$urls['monitor_not_init'] = $config['homeurl']."index.php?" .
|
||||
"sec=view&sec2=operation/agentes/status_monitor&" .
|
||||
"refr=60&status=" . AGENT_MODULE_STATUS_NOT_INIT . "&pure=" . $config['pure'];
|
||||
}
|
||||
|
@ -7675,8 +7715,8 @@ function reporting_get_stats_agents_monitors($data) {
|
|||
}
|
||||
else {
|
||||
$urls = array();
|
||||
$urls['total_agents'] = "index.php?sec=estado&sec2=operation/agentes/estado_agente&refr=60";
|
||||
$urls['monitor_checks'] = "index.php?sec=view&sec2=operation/agentes/status_monitor&refr=60&status=-1";
|
||||
$urls['total_agents'] = $config['homeurl']."index.php?sec=estado&sec2=operation/agentes/estado_agente&refr=60";
|
||||
$urls['monitor_checks'] = $config['homeurl']."index.php?sec=view&sec2=operation/agentes/status_monitor&refr=60&status=-1";
|
||||
}
|
||||
|
||||
// Agents and modules table
|
||||
|
|
|
@ -3640,7 +3640,9 @@ function reporting_get_event_histogram ($events, $text_header_event = false) {
|
|||
0,
|
||||
array(),
|
||||
true,
|
||||
$ttl
|
||||
$ttl,
|
||||
false,
|
||||
false
|
||||
);
|
||||
|
||||
$table->data[0][0] = $slicebar;
|
||||
|
@ -3823,7 +3825,9 @@ function reporting_get_event_histogram_meta ($width) {
|
|||
0,
|
||||
$full_legend_date,
|
||||
true,
|
||||
1
|
||||
1,
|
||||
false,
|
||||
false
|
||||
);
|
||||
|
||||
$table->data[0][0] = $slicebar;
|
||||
|
|
|
@ -548,7 +548,7 @@ function ui_print_group_icon ($id_group, $return = false, $path = "groups_small"
|
|||
$link = false;
|
||||
|
||||
if ($link)
|
||||
$output = '<a href="index.php?sec=estado&sec2=operation/agentes/estado_agente&refr=60&group_id='.$id_group.'">';
|
||||
$output = '<a href="'.$config["homeurl"].'index.php?sec=estado&sec2=operation/agentes/estado_agente&refr=60&group_id='.$id_group.'">';
|
||||
|
||||
if ($config['show_group_name']) {
|
||||
$output .= '<span title="'. groups_get_name($id_group, true) .'">' .
|
||||
|
|
|
@ -1205,7 +1205,7 @@ function visual_map_print_item($mode = "read", $layoutData,
|
|||
$img = '<div style="float:right;height:'.$himg.'px;">'.
|
||||
hbar_graph($module_data,
|
||||
400, 400, $color, array(), array(),
|
||||
ui_get_full_url("images/image_problem.opaque.png", false, false, false),
|
||||
ui_get_full_url("images/image_problem_area.png", false, false, false),
|
||||
"", "", $water_mark, $config['fontpath'], 6,
|
||||
"", 0, $config['homeurl'], $layoutData['image'], $layoutData['border_color']) . '</div>';
|
||||
}
|
||||
|
@ -1213,7 +1213,7 @@ function visual_map_print_item($mode = "read", $layoutData,
|
|||
$img = '<div style="float:right;height:'.$himg.'px;">'.
|
||||
vbar_graph($module_data,
|
||||
400, 400, $color, array(), array(),
|
||||
ui_get_full_url("images/image_problem.opaque.png", false, false, false),
|
||||
ui_get_full_url("images/image_problem_area.png", false, false, false),
|
||||
"", "", $water_mark, $config['fontpath'], 6,
|
||||
"", 0, $config['homeurl'], $layoutData['image'], true, false, $layoutData['border_color']) . '</div>';
|
||||
}
|
||||
|
@ -1223,7 +1223,7 @@ function visual_map_print_item($mode = "read", $layoutData,
|
|||
$img = '<div style="float:left;height:'.$himg.'px;">'.
|
||||
hbar_graph($module_data,
|
||||
400, 400, $color, array(), array(),
|
||||
ui_get_full_url("images/image_problem.opaque.png", false, false, false),
|
||||
ui_get_full_url("images/image_problem_area.png", false, false, false),
|
||||
"", "", $water_mark, $config['fontpath'], 6,
|
||||
"", 0, $config['homeurl'], $layoutData['image'], $layoutData['border_color']) . '</div>';
|
||||
}
|
||||
|
@ -1231,7 +1231,7 @@ function visual_map_print_item($mode = "read", $layoutData,
|
|||
$img = '<div style="float:left;height:'.$himg.'px;">'.
|
||||
vbar_graph($module_data,
|
||||
400, 400, $color, array(), array(),
|
||||
ui_get_full_url("images/image_problem.opaque.png", false, false, false),
|
||||
ui_get_full_url("images/image_problem_area.png", false, false, false),
|
||||
"", "", $water_mark, $config['fontpath'], 6,
|
||||
"", 0, $config['homeurl'], $layoutData['image'], true, false, $layoutData['border_color']) . '</div>';
|
||||
}
|
||||
|
@ -1240,14 +1240,14 @@ function visual_map_print_item($mode = "read", $layoutData,
|
|||
if ($layoutData['type_graph'] == 'horizontal') {
|
||||
$img = hbar_graph($module_data,
|
||||
400, 400, $color, array(), array(),
|
||||
ui_get_full_url("images/image_problem.opaque.png", false, false, false),
|
||||
ui_get_full_url("images/image_problem_area.png", false, false, false),
|
||||
"", "", $water_mark, $config['fontpath'], 6,
|
||||
"", 0, $config['homeurl'], $layoutData['image'], $layoutData['border_color']);
|
||||
}
|
||||
else {
|
||||
$img = vbar_graph($module_data,
|
||||
400, 400, $color, array(), array(),
|
||||
ui_get_full_url("images/image_problem.opaque.png", false, false, false),
|
||||
ui_get_full_url("images/image_problem_area.png", false, false, false),
|
||||
"", "", $water_mark, $config['fontpath'], 6,
|
||||
"", 0, $config['homeurl'], $layoutData['image'], true, false, $layoutData['border_color']);
|
||||
}
|
||||
|
@ -1259,7 +1259,7 @@ function visual_map_print_item($mode = "read", $layoutData,
|
|||
$img = '<div style="float:right;height:'.$himg.'px;">'.
|
||||
hbar_graph($module_data,
|
||||
$width, $height, $color, array(), array(),
|
||||
ui_get_full_url("images/image_problem.opaque.png", false, false, false),
|
||||
ui_get_full_url("images/image_problem_area.png", false, false, false),
|
||||
"", "", $water_mark, $config['fontpath'], 6,
|
||||
"", 0, $config['homeurl'], $layoutData['image'], $layoutData['border_color']) . '</div>';
|
||||
}
|
||||
|
@ -1267,7 +1267,7 @@ function visual_map_print_item($mode = "read", $layoutData,
|
|||
$img = '<div style="float:right;height:'.$himg.'px;">'.
|
||||
vbar_graph($module_data,
|
||||
$width, $height, $color, array(), array(),
|
||||
ui_get_full_url("images/image_problem.opaque.png", false, false, false),
|
||||
ui_get_full_url("images/image_problem_area.png", false, false, false),
|
||||
"", "", $water_mark, $config['fontpath'], 6,
|
||||
"", 0, $config['homeurl'], $layoutData['image'], true, false, $layoutData['border_color']) . '</div>';
|
||||
}
|
||||
|
@ -1277,7 +1277,7 @@ function visual_map_print_item($mode = "read", $layoutData,
|
|||
$img = '<div style="float:left;height:'.$himg.'px;">'.
|
||||
hbar_graph($module_data,
|
||||
$width, $height, $color, array(), array(),
|
||||
ui_get_full_url("images/image_problem.opaque.png", false, false, false),
|
||||
ui_get_full_url("images/image_problem_area.png", false, false, false),
|
||||
"", "", $water_mark, $config['fontpath'], 6,
|
||||
"", 0, $config['homeurl'], $layoutData['image'], $layoutData['border_color']) . '</div>';
|
||||
}
|
||||
|
@ -1285,7 +1285,7 @@ function visual_map_print_item($mode = "read", $layoutData,
|
|||
$img = '<div style="float:left;height:'.$himg.'px;">'.
|
||||
vbar_graph($module_data,
|
||||
$width, $height, $color, array(), array(),
|
||||
ui_get_full_url("images/image_problem.opaque.png", false, false, false),
|
||||
ui_get_full_url("images/image_problem_area.png", false, false, false),
|
||||
"", "", $water_mark, $config['fontpath'], 6,
|
||||
"", 0, $config['homeurl'], $layoutData['image'], true, false, $layoutData['border_color']) . '</div>';
|
||||
}
|
||||
|
@ -1294,14 +1294,14 @@ function visual_map_print_item($mode = "read", $layoutData,
|
|||
if ($layoutData['type_graph'] == 'horizontal') {
|
||||
$img = hbar_graph($module_data,
|
||||
$width, $height, $color, array(), array(),
|
||||
ui_get_full_url("images/image_problem.opaque.png", false, false, false),
|
||||
ui_get_full_url("images/image_problem_area.png", false, false, false),
|
||||
"", "", $water_mark, $config['fontpath'], 6,
|
||||
"", 0, $config['homeurl'], $layoutData['image'], $layoutData['border_color']);
|
||||
}
|
||||
else {
|
||||
$img = vbar_graph($module_data,
|
||||
$width, $height, $color, array(), array(),
|
||||
ui_get_full_url("images/image_problem.opaque.png", false, false, false),
|
||||
ui_get_full_url("images/image_problem_area.png", false, false, false),
|
||||
"", "", $water_mark, $config['fontpath'], 6,
|
||||
"", 0, $config['homeurl'], $layoutData['image'], true, false, $layoutData['border_color']);
|
||||
}
|
||||
|
@ -1633,78 +1633,11 @@ function visual_map_print_item($mode = "read", $layoutData,
|
|||
break;
|
||||
case STATIC_GRAPH:
|
||||
case GROUP_ITEM:
|
||||
|
||||
|
||||
if (! defined ('METACONSOLE')) {
|
||||
}
|
||||
else {
|
||||
// For each server defined and not disabled:
|
||||
$servers = db_get_all_rows_sql ('SELECT *
|
||||
FROM tmetaconsole_setup
|
||||
WHERE disabled = 0');
|
||||
if ($servers === false)
|
||||
$servers = array();
|
||||
|
||||
$result = array();
|
||||
$count_modules = 0;
|
||||
foreach ($servers as $server) {
|
||||
// If connection was good then retrieve all data server
|
||||
if (metaconsole_connect($server) == NOERR)
|
||||
$connection = true;
|
||||
else
|
||||
$connection = false;
|
||||
|
||||
$result_server = db_get_all_rows_sql ($sql);
|
||||
|
||||
if (!empty($result_server)) {
|
||||
|
||||
// Create HASH login info
|
||||
$pwd = $server['auth_token'];
|
||||
$auth_serialized = json_decode($pwd,true);
|
||||
|
||||
if (is_array($auth_serialized)) {
|
||||
$pwd = $auth_serialized['auth_token'];
|
||||
$api_password = $auth_serialized['api_password'];
|
||||
$console_user = $auth_serialized['console_user'];
|
||||
$console_password = $auth_serialized['console_password'];
|
||||
}
|
||||
|
||||
$user = $config['id_user'];
|
||||
$user_rot13 = str_rot13($config['id_user']);
|
||||
$hashdata = $user.$pwd;
|
||||
$hashdata = md5($hashdata);
|
||||
$url_hash = '&' .
|
||||
'loginhash=auto&' .
|
||||
'loginhash_data=' . $hashdata . '&' .
|
||||
'loginhash_user=' . $user_rot13;
|
||||
|
||||
foreach ($result_server as $result_element_key => $result_element_value) {
|
||||
|
||||
$result_server[$result_element_key]['server_id'] = $server['id'];
|
||||
$result_server[$result_element_key]['server_name'] = $server['server_name'];
|
||||
$result_server[$result_element_key]['server_url'] = $server['server_url'].'/';
|
||||
$result_server[$result_element_key]['hashdata'] = $hashdata;
|
||||
$result_server[$result_element_key]['user'] = $config['id_user'];
|
||||
|
||||
$count_modules++;
|
||||
|
||||
}
|
||||
|
||||
$result = array_merge($result, $result_server);
|
||||
}
|
||||
|
||||
if ($connection) {
|
||||
metaconsole_restore_db();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (($layoutData['image'] != null && $layoutData['image'] != 'none') || $layoutData['show_statistics'] == 1) {
|
||||
|
||||
$img_style_title = strip_tags($label);
|
||||
if ($layoutData['type'] == STATIC_GRAPH) {
|
||||
if ($layoutData['id_agente_modulo'] != 0) {
|
||||
|
||||
if ($layoutData['id_metaconsole'] != 0) {
|
||||
//Metaconsole db connection
|
||||
$connection = db_get_row_filter ('tmetaconsole_setup',
|
||||
|
@ -1780,83 +1713,84 @@ function visual_map_print_item($mode = "read", $layoutData,
|
|||
else if($layoutData['label_position']=='right'){
|
||||
$imgpos = 'float:left';
|
||||
}
|
||||
|
||||
$varsize = getimagesize($config['homedir'] . '/' . $img);
|
||||
|
||||
|
||||
if($layoutData['show_statistics'] == 1){
|
||||
|
||||
|
||||
if($layoutData['show_statistics'] == 1) {
|
||||
if (get_parameter('action') == 'edit') {
|
||||
|
||||
if ($width == 0 || $height == 0) {
|
||||
|
||||
echo '<img id="image_'.$id.'" src="images/console/signes/group_status.png" style="width:520px;height:80px;'.$imgpos.'">';
|
||||
echo '<img id="image_'.$id.'" src="images/console/signes/group_status.png" style="width:520px;height:80px;'.$imgpos.'">';
|
||||
}
|
||||
else{
|
||||
echo '<img id="image_'.$id.'" src="images/console/signes/group_status.png" style="width:'.$width.'px;height:'.$height.'px;'.$imgpos.'">';
|
||||
echo '<img id="image_'.$id.'" src="images/console/signes/group_status.png" style="width:'.$width.'px;height:'.$height.'px;'.$imgpos.'">';
|
||||
}
|
||||
|
||||
}
|
||||
else{
|
||||
|
||||
$agents_critical = agents_get_agents(array (
|
||||
'disabled' => 0,
|
||||
'id_grupo' => $layoutData['id_group'],
|
||||
'status' => AGENT_STATUS_CRITICAL),
|
||||
array ('COUNT(*) as total'), 'AR', false);
|
||||
|
||||
$agents_warning = agents_get_agents(array (
|
||||
'disabled' => 0,
|
||||
'id_grupo' => $layoutData['id_group'],
|
||||
'status' => AGENT_STATUS_WARNING),
|
||||
array ('COUNT(*) as total'), 'AR', false);
|
||||
|
||||
$agents_unknown = agents_get_agents(array (
|
||||
'disabled' => 0,
|
||||
'id_grupo' => $layoutData['id_group'],
|
||||
'status' => AGENT_STATUS_UNKNOWN),
|
||||
array ('COUNT(*) as total'), 'AR', false);
|
||||
|
||||
$agents_ok = agents_get_agents(array (
|
||||
'disabled' => 0,
|
||||
'id_grupo' => $layoutData['id_group'],
|
||||
'status' => AGENT_STATUS_OK),
|
||||
array ('COUNT(*) as total'), 'AR', false);
|
||||
|
||||
$total_agents = $agents_critical[0]['total'] + $agents_warning[0]['total'] + $agents_unknown[0]['total'] + $agents_ok[0]['total'];
|
||||
|
||||
$stat_agent_ok = $agents_ok[0]['total']/$total_agents*100;
|
||||
$stat_agent_wa = $agents_warning[0]['total']/$total_agents*100;
|
||||
$stat_agent_cr = $agents_critical[0]['total']/$total_agents*100;
|
||||
$stat_agent_un = $agents_unknown[0]['total']/$total_agents*100;
|
||||
|
||||
if($width == 0 || $height == 0){
|
||||
$dyn_width = 520;
|
||||
$dyn_height = 80;
|
||||
}
|
||||
else{
|
||||
$dyn_width = $width;
|
||||
$dyn_height = $height;
|
||||
}
|
||||
|
||||
|
||||
echo '<table cellpadding="0" cellspacing="0" border="0" class="databox" style="width:'.$dyn_width.'px;height:'.$dyn_height.'px;text-align:center;';
|
||||
|
||||
if($layoutData['label_position'] == 'left'){
|
||||
echo "float:right;";
|
||||
}
|
||||
elseif ($layoutData['label_position'] == 'right') {
|
||||
echo "float:left;";
|
||||
}
|
||||
|
||||
echo '">';
|
||||
|
||||
echo "<tr style='height:10%;'>";
|
||||
echo "<th style='text-align:center;background-color:#9d9ea0;color:black;font-weight:bold;'>" .groups_get_name($layoutData['id_group'],true) . "</th>";
|
||||
|
||||
echo "</tr>";
|
||||
echo "<tr style='background-color:whitesmoke;height:90%;'>";
|
||||
echo "<td>";
|
||||
$agents_critical = agents_get_agents(
|
||||
array (
|
||||
'disabled' => 0,
|
||||
'id_grupo' => $layoutData['id_group'],
|
||||
'status' => AGENT_STATUS_CRITICAL
|
||||
),
|
||||
array ('COUNT(*) as total'),
|
||||
'AR',
|
||||
false
|
||||
);
|
||||
$agents_warning = agents_get_agents(
|
||||
array (
|
||||
'disabled' => 0,
|
||||
'id_grupo' => $layoutData['id_group'],
|
||||
'status' => AGENT_STATUS_WARNING
|
||||
),
|
||||
array ('COUNT(*) as total'),
|
||||
'AR',
|
||||
false
|
||||
);
|
||||
$agents_unknown = agents_get_agents(
|
||||
array (
|
||||
'disabled' => 0,
|
||||
'id_grupo' => $layoutData['id_group'],
|
||||
'status' => AGENT_STATUS_UNKNOWN
|
||||
),
|
||||
array ('COUNT(*) as total'),
|
||||
'AR',
|
||||
false
|
||||
);
|
||||
$agents_ok = agents_get_agents(
|
||||
array (
|
||||
'disabled' => 0,
|
||||
'id_grupo' => $layoutData['id_group'],
|
||||
'status' => AGENT_STATUS_OK
|
||||
),
|
||||
array ('COUNT(*) as total'),
|
||||
'AR',
|
||||
false
|
||||
);
|
||||
$total_agents = $agents_critical[0]['total'] + $agents_warning[0]['total'] + $agents_unknown[0]['total'] + $agents_ok[0]['total'];
|
||||
$stat_agent_ok = $agents_ok[0]['total']/$total_agents*100;
|
||||
$stat_agent_wa = $agents_warning[0]['total']/$total_agents*100;
|
||||
$stat_agent_cr = $agents_critical[0]['total']/$total_agents*100;
|
||||
$stat_agent_un = $agents_unknown[0]['total']/$total_agents*100;
|
||||
if($width == 0 || $height == 0){
|
||||
$dyn_width = 520;
|
||||
$dyn_height = 80;
|
||||
} else {
|
||||
$dyn_width = $width;
|
||||
$dyn_height = $height;
|
||||
}
|
||||
echo '<table cellpadding="0" cellspacing="0" border="0" class="databox" style="width:'.$dyn_width.'px;height:'.$dyn_height.'px;text-align:center;';
|
||||
if($layoutData['label_position'] == 'left'){
|
||||
echo "float:right;";
|
||||
}
|
||||
elseif ($layoutData['label_position'] == 'right') {
|
||||
echo "float:left;";
|
||||
}
|
||||
|
||||
echo '">';
|
||||
echo "<tr style='height:10%;'>";
|
||||
echo "<th style='text-align:center;background-color:#9d9ea0;color:black;font-weight:bold;'>" .groups_get_name($layoutData['id_group'],true) . "</th>";
|
||||
echo "</tr>";
|
||||
echo "<tr style='background-color:whitesmoke;height:90%;'>";
|
||||
echo "<td>";
|
||||
echo "<div style='margin-left:2%;color: #FFF;font-size: 12px;display:inline;background-color:#FC4444;position:relative;height:80%;width:9.4%;height:80%;border-radius:2px;text-align:center;padding:5px;'>". remove_right_zeros(number_format($stat_agent_cr, 2)) ."%</div>";
|
||||
echo "<div style='background-color:white;color: black ;font-size: 12px;display:inline;position:relative;height:80%;width:9.4%;height:80%;border-radius:2px;text-align:center;padding:5px;'>Critical</div>";
|
||||
echo "<div style='margin-left:2%;color: #FFF;font-size: 12px;display:inline;background-color:#f8db3f;position:relative;height:80%;width:9.4%;height:80%;border-radius:2px;text-align:center;padding:5px;'>". remove_right_zeros(number_format($stat_agent_wa, 2)) ."%</div>";
|
||||
|
@ -1865,68 +1799,38 @@ function visual_map_print_item($mode = "read", $layoutData,
|
|||
echo "<div style='background-color:white;color: black ;font-size: 12px;display:inline;position:relative;height:80%;width:9.4%;height:80%;border-radius:2px;text-align:center;padding:5px;'>Normal</div>";
|
||||
echo "<div style='margin-left:2%;color: #FFF;font-size: 12px;display:inline;background-color:#9d9ea0;position:relative;height:80%;width:9.4%;height:80%;border-radius:2px;text-align:center;padding:5px;'>". remove_right_zeros(number_format($stat_agent_un, 2)) ."%</div>";
|
||||
echo "<div style='background-color:white;color: black ;font-size: 12px;display:inline;position:relative;height:80%;width:9.4%;height:80%;border-radius:2px;text-align:center;padding:5px;'>Unknown</div>";
|
||||
|
||||
echo "</td>";
|
||||
echo "</tr>";
|
||||
echo "</table>";
|
||||
|
||||
|
||||
echo "</td>";
|
||||
echo "</tr>";
|
||||
echo "</table>";
|
||||
}
|
||||
|
||||
}
|
||||
else{
|
||||
|
||||
} else {
|
||||
$options = array(
|
||||
"class" => "image",
|
||||
"id" => "image_" . $id,
|
||||
"title" => $img_style_title,
|
||||
"style" => $borderStyle.$imgpos
|
||||
);
|
||||
if ($width == 0 || $height == 0) {
|
||||
if($varsize[0] > 150 || $varsize[1] > 150){
|
||||
echo html_print_image($img, true,
|
||||
array("class" => "image",
|
||||
"id" => "image_" . $id,
|
||||
"width" => "70px",
|
||||
"height" => "70px",
|
||||
"title" => $img_style_title,
|
||||
"style" => $borderStyle.$imgpos), false,
|
||||
false, false, $isExternalLink);
|
||||
}
|
||||
else{
|
||||
echo html_print_image($img, true,
|
||||
array("class" => "image",
|
||||
"id" => "image_" . $id,
|
||||
"title" => $img_style_title,
|
||||
"style" => $borderStyle.$imgpos), false,
|
||||
false, false, $isExternalLink);
|
||||
$options['width'] = "70px";
|
||||
$options['height'] = "70px";
|
||||
}
|
||||
}
|
||||
else{
|
||||
echo html_print_image($img, true,
|
||||
array("class" => "image",
|
||||
"id" => "image_" . $id,
|
||||
"width" => $width,
|
||||
"height" => $height,
|
||||
"title" => $img_style_title,
|
||||
"style" => $borderStyle.$imgpos), false,
|
||||
false, false, $isExternalLink);
|
||||
$options['width'] = $width;
|
||||
$options['height'] = $height;
|
||||
}
|
||||
|
||||
echo html_print_image($img, true, $options,
|
||||
false, false, false, $isExternalLink);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if($layoutData['label_position']=='down'){
|
||||
echo io_safe_output($text);
|
||||
}
|
||||
else if($layoutData['label_position']=='left' || $layoutData['label_position']=='right'){
|
||||
|
||||
if ($layoutData['label_position'] != 'up') {
|
||||
echo io_safe_output($text);
|
||||
}
|
||||
|
||||
if (! defined ('METACONSOLE')) {
|
||||
}
|
||||
else {
|
||||
metaconsole_restore_db();
|
||||
}
|
||||
|
||||
|
||||
break;
|
||||
|
||||
|
||||
if (is_metaconsole()) metaconsole_restore_db();
|
||||
break;
|
||||
case PERCENTILE_BAR:
|
||||
if (($layoutData['image'] == 'value') && ($value_text !== false)) {
|
||||
$unit_text = db_get_sql ('SELECT unit
|
||||
|
@ -1963,6 +1867,7 @@ function visual_map_print_item($mode = "read", $layoutData,
|
|||
}
|
||||
|
||||
echo $img;
|
||||
echo io_safe_output($text);
|
||||
|
||||
break;
|
||||
case PERCENTILE_BUBBLE:
|
||||
|
@ -2006,6 +1911,7 @@ function visual_map_print_item($mode = "read", $layoutData,
|
|||
}
|
||||
|
||||
echo $img;
|
||||
echo io_safe_output($text);
|
||||
|
||||
break;
|
||||
case CIRCULAR_PROGRESS_BAR:
|
||||
|
@ -2049,6 +1955,7 @@ function visual_map_print_item($mode = "read", $layoutData,
|
|||
}
|
||||
|
||||
echo $img;
|
||||
echo io_safe_output($text);
|
||||
|
||||
break;
|
||||
case CIRCULAR_INTERIOR_PROGRESS_BAR:
|
||||
|
@ -2093,6 +2000,7 @@ function visual_map_print_item($mode = "read", $layoutData,
|
|||
}
|
||||
|
||||
echo $img;
|
||||
echo io_safe_output($text);
|
||||
|
||||
break;
|
||||
case MODULE_GRAPH:
|
||||
|
@ -2282,11 +2190,9 @@ function visual_map_print_item($mode = "read", $layoutData,
|
|||
if ($layoutData['parent_item'] != 0) {
|
||||
$parent = db_get_row_filter('tlayout_data',
|
||||
array('id' => $layoutData['parent_item']));
|
||||
|
||||
|
||||
echo '<script type="text/javascript">';
|
||||
echo '$(document).ready (function() {
|
||||
lines.push({"id": "' . $id . '" , "node_begin":"' . $layoutData['parent_item'] . '","node_end":"' . $id . '","color":"' . visual_map_get_color_line_status($parent) . '","thickness":"' . (empty($config["vc_line_thickness"]) ? 2 : $config["vc_line_thickness"]) . '"});
|
||||
});';
|
||||
echo 'lines.push({"id": "' . $id . '" , "node_begin":"' . $layoutData['parent_item'] . '","node_end":"' . $id . '","color":"' . visual_map_get_color_line_status($parent) . '","thickness":"' . (empty($config["vc_line_thickness"]) ? 2 : $config["vc_line_thickness"]) . '"});';
|
||||
echo '</script>';
|
||||
}
|
||||
}
|
||||
|
@ -2306,19 +2212,35 @@ function get_if_module_is_image ($id_module) {
|
|||
}
|
||||
|
||||
function get_bars_module_data ($id_module) {
|
||||
$mod_values = db_get_value_filter('datos', 'tagente_estado', array('id_agente_modulo' => $id_module));
|
||||
//This charts is only serialize graphs.
|
||||
//In other string show image no data to show.
|
||||
|
||||
if (preg_match("/\r\n/", $mod_values)) {
|
||||
$values = explode("\r\n", $mod_values);
|
||||
}
|
||||
elseif (preg_match("/\n/", $mod_values)) {
|
||||
$values = explode("\n", $mod_values);
|
||||
$mod_values = db_get_value_filter(
|
||||
'datos',
|
||||
'tagente_estado',
|
||||
array(
|
||||
'id_agente_modulo' => $id_module
|
||||
)
|
||||
);
|
||||
|
||||
$values = false;
|
||||
//avoid showing the image type modules. WUX
|
||||
if(strpos($mod_values, 'data:image/png;base64') !== 0){
|
||||
if (preg_match("/\r\n/", $mod_values)) {
|
||||
$values = explode("\r\n", $mod_values);
|
||||
}
|
||||
elseif (preg_match("/\n/", $mod_values)) {
|
||||
$values = explode("\n", $mod_values);
|
||||
}
|
||||
}
|
||||
|
||||
$values_to_return = array();
|
||||
$index = 0;
|
||||
$color_index = 0;
|
||||
$total = 0;
|
||||
|
||||
if(!$values) return false;
|
||||
|
||||
foreach ($values as $val) {
|
||||
$data = explode(",", $val);
|
||||
$values_to_return[$data[0]] = array('g' =>$data[1]);
|
||||
|
@ -3323,9 +3245,7 @@ function visual_map_print_user_lines($layout_data, $proportion = null) {
|
|||
}
|
||||
|
||||
echo '<script type="text/javascript">';
|
||||
echo '$(document).ready (function() {
|
||||
user_lines.push(' . json_encode($line) . ');
|
||||
});';
|
||||
echo 'user_lines.push(' . json_encode($line) . ');';
|
||||
echo '</script>';
|
||||
}
|
||||
|
||||
|
|
|
@ -586,7 +586,7 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) {
|
|||
$form_items['show_on_top_row']['html'] =
|
||||
'<td align="left" style="">' . __('Always show on top') . '</td>
|
||||
<td align="left" style="">' .
|
||||
html_print_checkbox('show_on_top', 1, '', true) . '</td>';
|
||||
html_print_checkbox('show_on_top', 1, '', true) .ui_print_help_tip (__("It allows the element to be superimposed to the rest of items of the visual console"), true) . '</td>';
|
||||
|
||||
$show_last_value = array('0' => __('Hide last value on boolean modules'), '1' => __('Enabled'), '2' => __('Disabled'));
|
||||
$form_items['show_last_value_row'] = array();
|
||||
|
|
|
@ -27,9 +27,9 @@ check_login ();
|
|||
|
||||
$auth_method = db_get_value('value', 'tconfig', 'token', 'auth');
|
||||
|
||||
if($auth_method != 'ad')
|
||||
if($auth_method != 'ad' && $auth_method != 'ldap'){
|
||||
require_once("auth/" . $auth_method . ".php");
|
||||
|
||||
}
|
||||
|
||||
|
||||
$styleError = "background:url(\"../images/err.png\") no-repeat scroll 0 0 transparent; padding:4px 1px 6px 30px; color:#CC0000;";
|
||||
|
|
|
@ -141,7 +141,17 @@ function vbar_graph(
|
|||
setup_watermark($water_mark, $water_mark_file, $water_mark_url);
|
||||
|
||||
if (empty($chart_data)) {
|
||||
return '<img src="' . $no_data_image . '" />';
|
||||
return html_print_image (
|
||||
$no_data_image,
|
||||
true,
|
||||
array(
|
||||
'width' => $width,
|
||||
'height' => $height,
|
||||
'title' => __('No data to show')
|
||||
),
|
||||
false,
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
if($ttl == 2){
|
||||
|
@ -271,7 +281,17 @@ function hbar_graph($chart_data, $width, $height,
|
|||
setup_watermark($water_mark, $water_mark_file, $water_mark_url);
|
||||
|
||||
if (empty($chart_data)) {
|
||||
return '<img src="' . $no_data_image . '" />';
|
||||
return html_print_image (
|
||||
$no_data_image,
|
||||
true,
|
||||
array(
|
||||
'width' => $width,
|
||||
'height' => $height,
|
||||
'title' => __('No data to show')
|
||||
),
|
||||
false,
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
if($ttl == 2){
|
||||
|
|
|
@ -204,7 +204,7 @@
|
|||
|
||||
$form
|
||||
.prop('method', 'POST')
|
||||
.prop('action', plot.getOptions().export.homeurl + '/include/graphs/export_data.php')
|
||||
.prop('action', plot.getOptions().export.homeurl + 'include/graphs/export_data.php')
|
||||
.append($dataInput, $typeInput, $separatorInput, $excelInput)
|
||||
.hide()
|
||||
// Firefox made me write into the DOM for this :(
|
||||
|
@ -394,7 +394,7 @@
|
|||
|
||||
$form
|
||||
.prop('method', 'POST')
|
||||
.prop('action', plot.getOptions().export.homeurl + '/include/graphs/export_data.php')
|
||||
.prop('action', plot.getOptions().export.homeurl + 'include/graphs/export_data.php')
|
||||
.append($dataInput, $typeInput, $separatorInput, $excelInput)
|
||||
.hide()
|
||||
// Firefox made me write into the DOM for this :(
|
||||
|
|
|
@ -670,7 +670,7 @@ function pandoraFlotVBars(graph_id, values, labels, labels_long, legend, colors,
|
|||
}
|
||||
|
||||
function pandoraFlotSlicebar(graph_id, values, datacolor, labels, legend, acumulate_data, intervaltick,
|
||||
font, font_size, separator, separator2, id_agent, full_legend, not_interactive) {
|
||||
font, font_size, separator, separator2, id_agent, full_legend, not_interactive, show_date) {
|
||||
|
||||
values = values.split(separator2);
|
||||
labels = labels.split(separator);
|
||||
|
@ -728,6 +728,7 @@ function pandoraFlotSlicebar(graph_id, values, datacolor, labels, legend, acumul
|
|||
tickColor: '#fff'
|
||||
},
|
||||
xaxes: [ {
|
||||
show:show_date,
|
||||
tickFormatter: xFormatter,
|
||||
color: '',
|
||||
tickSize: intervaltick,
|
||||
|
@ -1873,7 +1874,7 @@ function pandoraFlotArea( graph_id, values, legend,
|
|||
}));
|
||||
}
|
||||
|
||||
$('#menu_cancelzoom_' + graph_id).attr('src', homeurl + '/images/zoom_cross_grey.png');
|
||||
$('#menu_cancelzoom_' + graph_id).attr('src', homeurl + 'images/zoom_cross_grey.png');
|
||||
|
||||
max_draw['max'] = ranges.yaxis.to;
|
||||
max_draw['min'] = ranges.yaxis.from;
|
||||
|
@ -2330,7 +2331,7 @@ function pandoraFlotArea( graph_id, values, legend,
|
|||
legend: { show: true }
|
||||
}));
|
||||
$('#menu_cancelzoom_' + graph_id)
|
||||
.attr('src', homeurl + '/images/zoom_cross.disabled.png');
|
||||
.attr('src', homeurl + 'images/zoom_cross.disabled.png');
|
||||
overview.clearSelection();
|
||||
currentRanges = null;
|
||||
thresholded = false;
|
||||
|
|
|
@ -691,7 +691,7 @@ function flot_slicesbar_graph (
|
|||
$adapt_key = '', $stat_win = false,
|
||||
$id_agent = 0, $full_legend_date = array(),
|
||||
$not_interactive = 0, $ttl = 1,
|
||||
$widgets = false) {
|
||||
$widgets = false, $show = true) {
|
||||
|
||||
global $config;
|
||||
|
||||
|
@ -839,7 +839,7 @@ function flot_slicesbar_graph (
|
|||
// Javascript code
|
||||
$return .= "<script type='text/javascript'>";
|
||||
$return .= "//<![CDATA[\n";
|
||||
$return .= "pandoraFlotSlicebar('$graph_id','$values','$datacolor','$labels','$legend','$acumulate_data',$intervaltick,'$fontpath',$fontsize,'$separator','$separator2',$id_agent,'$full_legend_date',$not_interactive)";
|
||||
$return .= "pandoraFlotSlicebar('$graph_id','$values','$datacolor','$labels','$legend','$acumulate_data',$intervaltick,'$fontpath',$fontsize,'$separator','$separator2',$id_agent,'$full_legend_date',$not_interactive, '$show')";
|
||||
$return .= "\n//]]>";
|
||||
$return .= "</script>";
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@ div.olMap {
|
|||
padding: 0px!important;
|
||||
margin: 0px!important;
|
||||
cursor: default;
|
||||
position: relative !important;
|
||||
}
|
||||
|
||||
div.olMapViewport {
|
||||
|
|
|
@ -1384,7 +1384,7 @@ table.databox {
|
|||
border: 0px none #E2E2E2;
|
||||
}
|
||||
|
||||
.databox>thead>tr>th, .databox>tbody>tr>th {
|
||||
.databox>thead>tr>th, .databox>tbody>tr>th, .databox>thead>tr>th a {
|
||||
padding: 9px 7px;
|
||||
font-weight: normal;
|
||||
color: #fff;
|
||||
|
|
|
@ -4,8 +4,6 @@ if (system.args.length < 3 || system.args.length > 11) {
|
|||
phantom.exit(1);
|
||||
}
|
||||
|
||||
var webPage = require('webpage');
|
||||
var page = webPage.create();
|
||||
var url = system.args[1];
|
||||
var type_graph_pdf = system.args[2];
|
||||
var url_params = system.args[3];
|
||||
|
@ -39,26 +37,32 @@ else{
|
|||
"&session_id=" + session_id;
|
||||
}
|
||||
|
||||
|
||||
|
||||
var page = require('webpage').create();
|
||||
|
||||
|
||||
page.viewportSize = {
|
||||
width: viewport_width,
|
||||
height: viewport_height
|
||||
};
|
||||
|
||||
page.zoomFactor = 1;
|
||||
|
||||
page.open(url, 'POST', post_data, function start(status) {
|
||||
|
||||
});
|
||||
|
||||
page.onLoadFinished = function (status) {
|
||||
page.onCallback = function (st){
|
||||
if(!base_64){
|
||||
page.render(output_filename, {format: 'png'});
|
||||
}
|
||||
else{
|
||||
} else{
|
||||
var base64 = page.renderBase64('png');
|
||||
//XXXX
|
||||
// do not remove this console.output
|
||||
console.log(base64);
|
||||
}
|
||||
phantom.exit();
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
page.open(url, 'POST', post_data, function (status) {
|
||||
});
|
||||
|
||||
|
|
|
@ -120,6 +120,7 @@ if (isset($config["error"])) {
|
|||
// If metaconsole activated, redirect to it
|
||||
if ($config['metaconsole'] == 1 && $config['enterprise_installed'] == 1) {
|
||||
header ("Location: " . $config['homeurl'] . "enterprise/meta");
|
||||
exit; //Always exit after sending location headers
|
||||
}
|
||||
|
||||
if (file_exists (ENTERPRISE_DIR . "/include/functions_login.php")) {
|
||||
|
@ -568,6 +569,7 @@ if (! isset ($config['id_user'])) {
|
|||
$redirect_url .= '&'.safe_url_extraclean($key).'='.safe_url_extraclean($value);
|
||||
}
|
||||
header("Location: ".$config['homeurl']."index.php".$redirect_url);
|
||||
exit; //Always exit after sending location headers
|
||||
}
|
||||
// Hash login process
|
||||
elseif (isset ($_GET["loginhash"])) {
|
||||
|
|
|
@ -71,7 +71,7 @@
|
|||
<div style='height: 10px'>
|
||||
<?php
|
||||
$version = '7.0NG.729';
|
||||
$build = '181127';
|
||||
$build = '181203';
|
||||
$banner = "v$version Build $build";
|
||||
|
||||
error_reporting(0);
|
||||
|
|
|
@ -336,6 +336,16 @@ if (is_ajax ()) {
|
|||
$filter .= ' AND t1.id_agente_modulo IN (SELECT id_agente_modulo FROM tagente_estado where ' . $sql_conditions;
|
||||
}
|
||||
|
||||
$sql_tags_join = "";
|
||||
$where_tags = "";
|
||||
if (tags_has_user_acl_tags($config['id_user'])) {
|
||||
$where_tags = tags_get_acl_tags($config['id_user'], $id_groups, 'AR',
|
||||
'module_condition', 'AND', 'tagente_modulo', false, array(), true);
|
||||
|
||||
$sql_tags_join = "INNER JOIN tagente ON tagente.id_agente = t1.id_agente
|
||||
INNER JOIN ttag_module ON ttag_module.id_agente_modulo = t1.id_agente_modulo";
|
||||
}
|
||||
|
||||
if (is_metaconsole()) {
|
||||
$result = array();
|
||||
$nameModules = array();
|
||||
|
@ -396,9 +406,10 @@ if (is_ajax ()) {
|
|||
}
|
||||
|
||||
//Get agent's modules
|
||||
$sql = sprintf('SELECT t1.id_agente, t1.id_agente_modulo, t1.nombre
|
||||
FROM tagente_modulo t1
|
||||
WHERE %s
|
||||
$sql = sprintf(
|
||||
'SELECT t1.id_agente, t1.id_agente_modulo, t1.nombre
|
||||
FROM tagente_modulo t1 %s
|
||||
WHERE %s %s
|
||||
AND t1.delete_pending = 0
|
||||
AND t1.id_agente IN (%s)
|
||||
AND (
|
||||
|
@ -407,7 +418,7 @@ if (is_ajax ()) {
|
|||
WHERE t2.delete_pending = 0
|
||||
AND t1.nombre = t2.nombre
|
||||
AND t2.id_agente IN (%s)) = (%d)',
|
||||
$filter, implode(',', $id_agents),
|
||||
$sql_tags_join, $filter, $where_tags, implode(',', $id_agents),
|
||||
implode(',', $id_agents), count($id_agents));
|
||||
|
||||
$modules = db_get_all_rows_sql($sql);
|
||||
|
@ -458,34 +469,27 @@ if (is_ajax ()) {
|
|||
}
|
||||
else {
|
||||
if($idAgents[0] < 0){
|
||||
if($selection_mode == 'common'){
|
||||
if($selection_mode == 'common') {
|
||||
$sql_agent_total = 'SELECT count(*) FROM tagente WHERE disabled=0';
|
||||
$agent_total = db_get_value_sql($sql_agent_total);
|
||||
$sql = "SELECT tam.nombre, tam.id_agente_modulo
|
||||
FROM tagente_modulo tam
|
||||
JOIN (
|
||||
SELECT COUNT(*) AS num_names, nombre
|
||||
FROM tagente_modulo
|
||||
WHERE disabled=0
|
||||
AND delete_pending=0
|
||||
GROUP BY nombre
|
||||
) AS tj
|
||||
ON tj.num_names = $agent_total
|
||||
AND tj.nombre = tam.nombre ";
|
||||
}
|
||||
else{
|
||||
$sql = 'SELECT nombre, id_agente_modulo
|
||||
FROM tagente_modulo';
|
||||
$sql = sprintf ("SELECT t1.nombre, t1.id_agente_modulo FROM tagente_modulo t1
|
||||
JOIN (SELECT COUNT(*) AS num_names, nombre FROM tagente_modulo
|
||||
WHERE disabled=0 AND delete_pending=0 GROUP BY nombre) AS tj
|
||||
ON tj.num_names = $agent_total AND tj.nombre = t1.nombre %s %s",
|
||||
$sql_tags_join, (empty($where_tags)) ? "" : " WHERE 1=1 $where_tags");
|
||||
} else {
|
||||
$sql = sprintf('SELECT t1.nombre, t1.id_agente_modulo FROM tagente_modulo t1 %s %s',
|
||||
$sql_tags_join, (empty($where_tags)) ? "" : " WHERE 1=1 $where_tags");
|
||||
}
|
||||
}
|
||||
else {
|
||||
$sql = 'SELECT DISTINCT nombre, t1.id_agente_modulo
|
||||
FROM tagente_modulo t1, tagente_estado t2
|
||||
WHERE t1.id_agente_modulo = t2.id_agente_modulo AND
|
||||
' . $filter . '
|
||||
AND t1.delete_pending = 0
|
||||
AND t1.id_agente IN (' . implode(',', $idAgents) . ')
|
||||
AND t2.datos NOT LIKE "%image%"';
|
||||
$sql = sprintf (
|
||||
'SELECT DISTINCT t1.nombre, t1.id_agente_modulo FROM tagente_modulo t1
|
||||
INNER JOIN tagente_estado t2 ON t1.id_agente_modulo = t2.id_agente_modulo
|
||||
%s WHERE %s AND t1.delete_pending = 0
|
||||
AND t1.id_agente IN ('. implode(',', $idAgents) .')
|
||||
%s %s',
|
||||
$sql_tags_join, $filter, ' AND t2.datos NOT LIKE "%image%"', $where_tags);
|
||||
|
||||
if ($selection_mode == 'common') {
|
||||
$sql .= ' AND (
|
||||
|
|
|
@ -78,10 +78,13 @@ if ($group_rep == 2) {
|
|||
$table->head[1] = __('Agent');
|
||||
$table->head[5] = __('More detail');
|
||||
|
||||
$url = html_print_sort_arrows(
|
||||
array_merge($params, array('sort_field' => 'status')),
|
||||
'sort'
|
||||
);
|
||||
//$url = html_print_sort_arrows(
|
||||
// array_merge($params, array('sort_field' => 'status')),
|
||||
// 'sort'
|
||||
//);
|
||||
|
||||
$params_sort_field_status = array_merge($params, array('sort_field' => 'status'));
|
||||
$url = "index.php?" . http_build_query($params_sort_field_status, '', '&');
|
||||
|
||||
foreach ($result as $key => $res) {
|
||||
|
||||
|
@ -164,14 +167,6 @@ else {
|
|||
$table->align[$i] = 'left';
|
||||
$i++;
|
||||
}
|
||||
if ($fields == 'estado') {
|
||||
$table->head[$i] = __('Status') . html_print_sort_arrows(
|
||||
array_merge($params, array('sort_field' => 'status')),
|
||||
'sort'
|
||||
);
|
||||
$table->align[$i] = 'left';
|
||||
$i++;
|
||||
}
|
||||
if ($fields == 'id_evento') {
|
||||
$table->head[$i] = __('Event ID') . html_print_sort_arrows(
|
||||
array_merge($params, array('sort_field' => 'event_id')),
|
||||
|
@ -341,6 +336,18 @@ else {
|
|||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
if (in_array('estado', $show_fields)) {
|
||||
$table->head[$i] = '<span style="white-space: nowrap;">'.__('Status') . html_print_sort_arrows(
|
||||
array_merge($params, array('sort_field' => 'status')),
|
||||
'sort'
|
||||
).'</span>';
|
||||
$table->align[$i] = 'left';
|
||||
$table->style[$i] = 'white-space: nowrap !important; width: 1px !important;';
|
||||
$i++;
|
||||
}
|
||||
|
||||
|
||||
if ($i != 0 && $allow_action) {
|
||||
$table->head[$i] = __('Action');
|
||||
$table->align[$i] = 'left';
|
||||
|
@ -491,14 +498,6 @@ else {
|
|||
$table->cellclass[count($table->data)][$i] = $myclass;
|
||||
$i++;
|
||||
}
|
||||
if ($fields == 'estado') {
|
||||
$data[$i] = html_print_image ($img_st, true,
|
||||
array ("class" => "image_status",
|
||||
"title" => $title_st,
|
||||
"id" => 'status_img_'.$event["id_evento"]));
|
||||
$table->cellstyle[count($table->data)][$i] = 'background: #F3F3F3;';
|
||||
$i++;
|
||||
}
|
||||
if ($fields == 'id_evento') {
|
||||
$data[$i] = $event["id_evento"];
|
||||
$table->cellclass[count($table->data)][$i] = $myclass;
|
||||
|
@ -777,6 +776,15 @@ else {
|
|||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
if (in_array('estado', $show_fields)) {
|
||||
$data[$i] = html_print_image ($img_st, true,
|
||||
array ("class" => "image_status",
|
||||
"title" => $title_st,
|
||||
"id" => 'status_img_'.$event["id_evento"]));
|
||||
$table->cellstyle[count($table->data)][$i] = 'background: #F3F3F3; white-space: nowrap; width: 1px;';
|
||||
$i++;
|
||||
}
|
||||
|
||||
if ($i != 0 && $allow_action) {
|
||||
//Actions
|
||||
|
|
|
@ -491,7 +491,7 @@ $data[0] .= $table_ichanges;
|
|||
|
||||
//time autorefresh
|
||||
$times = get_refresh_time_array();
|
||||
$data[1] = '<span style="width:40%;float:left;">'.__('Time autorefresh').'</span>';
|
||||
$data[1] = '<span style="width:40%;float:left;">'.__('Time autorefresh'). ui_print_help_tip(__('Interval of autorefresh of the elements, by default they are 30 seconds, needing to enable the autorefresh first'), true).'</span>';
|
||||
$data[1] .= $jump . '<span style="width:20%;float:left;">'. html_print_select ($times, 'time_autorefresh', $user_info["time_autorefresh"], '', '', '', true,false,false).'</span>';
|
||||
|
||||
$table->rowclass[] = '';
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#
|
||||
%define name pandorafms_console
|
||||
%define version 7.0NG.729
|
||||
%define release 181127
|
||||
%define release 181203
|
||||
|
||||
# User and Group under which Apache is running
|
||||
%define httpd_name httpd
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#
|
||||
%define name pandorafms_console
|
||||
%define version 7.0NG.729
|
||||
%define release 181127
|
||||
%define release 181203
|
||||
%define httpd_name httpd
|
||||
# User and Group under which Apache is running
|
||||
%define httpd_name apache2
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
package: pandorafms-server
|
||||
Version: 7.0NG.729-181127
|
||||
Version: 7.0NG.729-181203
|
||||
Architecture: all
|
||||
Priority: optional
|
||||
Section: admin
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
pandora_version="7.0NG.729-181127"
|
||||
pandora_version="7.0NG.729-181203"
|
||||
|
||||
package_cpan=0
|
||||
package_pandora=1
|
||||
|
|
|
@ -45,7 +45,7 @@ our @EXPORT = qw(
|
|||
|
||||
# version: Defines actual version of Pandora Server for this module only
|
||||
my $pandora_version = "7.0NG.729";
|
||||
my $pandora_build = "181127";
|
||||
my $pandora_build = "181203";
|
||||
our $VERSION = $pandora_version." ".$pandora_build;
|
||||
|
||||
# Setup hash
|
||||
|
|
|
@ -4580,7 +4580,7 @@ Process groups statistics for statistics table
|
|||
##########################################################################
|
||||
sub pandora_process_event_replication ($) {
|
||||
my $pa_config = shift;
|
||||
|
||||
my $dbh_metaconsole;
|
||||
my %pa_config = %{$pa_config};
|
||||
|
||||
# Get the console DB connection
|
||||
|
@ -4594,46 +4594,57 @@ sub pandora_process_event_replication ($) {
|
|||
# desactivated the event replication or the replication
|
||||
# interval is wrong: abort
|
||||
if($is_event_replication_enabled == 0) {
|
||||
db_disconnect($dbh);
|
||||
return;
|
||||
}
|
||||
|
||||
if($replication_interval <= 0) {
|
||||
logger($pa_config, "Replication interval configuration is not a value greater than 0. Event replication thread will be aborted.", 1);
|
||||
logger($pa_config, "The event replication interval must be greater than 0. Event replication aborted.", 1);
|
||||
db_disconnect($dbh);
|
||||
return;
|
||||
}
|
||||
|
||||
# Get the metaconsole DB connection
|
||||
my $dbh_metaconsole = enterprise_hook('get_metaconsole_dbh', [$pa_config, $dbh]);
|
||||
|
||||
if($dbh_metaconsole eq '') {
|
||||
logger($pa_config, "Metaconsole DB connection error. Event replication thread will be aborted.", 1);
|
||||
return;
|
||||
}
|
||||
|
||||
# Get server id on metaconsole
|
||||
my $metaconsole_server_id = enterprise_hook('get_metaconsole_setup_server_id', [$dbh_metaconsole, safe_input($pa_config->{'servername'})]);
|
||||
|
||||
# If the server name is not found in metaconsole setup: abort
|
||||
if($metaconsole_server_id == -1) {
|
||||
logger($pa_config, "The server name is not configured in metaconsole. Event replication thread will be aborted.", 1);
|
||||
return;
|
||||
}
|
||||
|
||||
my $replication_mode = enterprise_hook('get_event_replication_mode', [$dbh]);
|
||||
|
||||
logger($pa_config, "Starting replication events process.", 1);
|
||||
logger($pa_config, "Started event replication thread.", 1);
|
||||
|
||||
while($THRRUN == 1) {
|
||||
|
||||
# If we are not the master server sleep and check again.
|
||||
if (pandora_is_master($pa_config) == 0) {
|
||||
sleep ($pa_config->{'server_threshold'});
|
||||
next;
|
||||
}
|
||||
|
||||
# Check the queue each N seconds
|
||||
eval {{
|
||||
local $SIG{__DIE__};
|
||||
|
||||
# Get the metaconsole DB connection
|
||||
$dbh_metaconsole = enterprise_hook('get_metaconsole_dbh', [$pa_config, $dbh]);
|
||||
$dbh_metaconsole = undef if $dbh_metaconsole eq '';
|
||||
if (!defined($dbh_metaconsole)) {
|
||||
logger($pa_config, "Metaconsole DB connection error. Event replication postponed.", 5);
|
||||
next;
|
||||
}
|
||||
|
||||
# Get server id on metaconsole
|
||||
my $metaconsole_server_id = enterprise_hook('get_metaconsole_setup_server_id', [$dbh_metaconsole, safe_input($pa_config->{'servername'})]);
|
||||
|
||||
# If the server name is not found in metaconsole setup: abort
|
||||
if($metaconsole_server_id == -1) {
|
||||
logger($pa_config, "The server name is not configured in metaconsole. Event replication postponed.", 5);
|
||||
db_disconnect($dbh_metaconsole);
|
||||
next;
|
||||
}
|
||||
|
||||
my $replication_mode = enterprise_hook('get_event_replication_mode', [$dbh]);
|
||||
|
||||
while($THRRUN == 1) {
|
||||
|
||||
# If we are not the master server sleep and check again.
|
||||
if (pandora_is_master($pa_config) == 0) {
|
||||
sleep ($pa_config->{'server_threshold'});
|
||||
next;
|
||||
}
|
||||
|
||||
# Check the queue each N seconds
|
||||
enterprise_hook('pandora_replicate_copy_events',[$pa_config, $dbh, $dbh_metaconsole, $metaconsole_server_id, $replication_mode]);
|
||||
sleep ($replication_interval);
|
||||
}
|
||||
}};
|
||||
db_disconnect($dbh_metaconsole) if defined($dbh_metaconsole);
|
||||
sleep ($replication_interval);
|
||||
enterprise_hook('pandora_replicate_copy_events',[$pa_config, $dbh, $dbh_metaconsole, $metaconsole_server_id, $replication_mode]);
|
||||
}
|
||||
|
||||
db_disconnect($dbh);
|
||||
|
|
|
@ -32,7 +32,7 @@ our @ISA = qw(Exporter);
|
|||
|
||||
# version: Defines actual version of Pandora Server for this module only
|
||||
my $pandora_version = "7.0NG.729";
|
||||
my $pandora_build = "181127";
|
||||
my $pandora_build = "181203";
|
||||
our $VERSION = $pandora_version." ".$pandora_build;
|
||||
|
||||
our %EXPORT_TAGS = ( 'all' => [ qw() ] );
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#
|
||||
%define name pandorafms_server
|
||||
%define version 7.0NG.729
|
||||
%define release 181127
|
||||
%define release 181203
|
||||
|
||||
Summary: Pandora FMS Server
|
||||
Name: %{name}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#
|
||||
%define name pandorafms_server
|
||||
%define version 7.0NG.729
|
||||
%define release 181127
|
||||
%define release 181203
|
||||
|
||||
Summary: Pandora FMS Server
|
||||
Name: %{name}
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
# **********************************************************************
|
||||
|
||||
PI_VERSION="7.0NG.729"
|
||||
PI_BUILD="181127"
|
||||
PI_BUILD="181203"
|
||||
|
||||
MODE=$1
|
||||
if [ $# -gt 1 ]; then
|
||||
|
|
|
@ -34,7 +34,7 @@ use PandoraFMS::Config;
|
|||
use PandoraFMS::DB;
|
||||
|
||||
# version: define current version
|
||||
my $version = "7.0NG.729 PS181127";
|
||||
my $version = "7.0NG.729 PS181203";
|
||||
|
||||
# Pandora server configuration
|
||||
my %conf;
|
||||
|
|
|
@ -36,7 +36,7 @@ use Encode::Locale;
|
|||
Encode::Locale::decode_argv;
|
||||
|
||||
# version: define current version
|
||||
my $version = "7.0NG.729 PS181127";
|
||||
my $version = "7.0NG.729 PS181203";
|
||||
|
||||
# save program name for logging
|
||||
my $progname = basename($0);
|
||||
|
|
Loading…
Reference in New Issue