Merge remote-tracking branch 'origin/develop' into 3207-6970-update-manager-offline-no-funciona-v729

This commit is contained in:
fbsanchez 2018-12-03 17:02:15 +01:00
commit e5a658edf9
72 changed files with 1229 additions and 792 deletions

View File

@ -248,3 +248,10 @@ button h3 {
.sev-Maintenance { .sev-Maintenance {
background: #A8A8A8; background: #A8A8A8;
} }
.sev-Minor {
background: #F099A2;
color: #333;
}
.sev-Major {
background: #C97A4A;
}

View File

@ -29,11 +29,13 @@ function main() {
if (isFetching) return; if (isFetching) return;
isFetching = true; 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 = new XMLHttpRequest();
req.onload = handleResponse; req.onload = handleResponse;
req.onerror = handleError; req.onerror = handleError;
req.open("GET", feedUrl, true); req.open("GET", feedUrl, true);
req.withCredentials = true
req.send(null); req.send(null);
} }
@ -132,25 +134,23 @@ function fetchNewEvents(A,B){
function parseReplyEvents (reply) { function parseReplyEvents (reply) {
// Split the API response // 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 // Form a properly object
var fetchedEvents=new Array(); var fetchedEvents=new Array();
for(var i=0;i<e_array.length;i++){ for(var i=0;i<e_array.length;i++){
// Avoid to parse empty lines var event=e_array[i];
if (e_array[i].length == 0) continue;
var event=e_array[i].split(";");
fetchedEvents.push({ fetchedEvents.push({
'id' : event[0], 'id' : event.id_evento,
'agent_name' : event[1], 'agent_name' : event.agent_name,
'agent' : event[2], 'agent' : event.id_agent,
'date' : event[5], 'date' : event.timestamp,
'title' : event[6], 'title' : event.evento,
'module' : event[9], 'module' : event.id_agentmodule,
'type' : event[14], 'type' : event.event_type,
'source' : event[17], 'source' : event.source,
'severity' : event[28], 'severity' : event.criticity_name,
'visited' : false 'visited' : false
}); });
} }

View File

@ -1,17 +1,14 @@
console.log("hola");
var url = window.location.href; var url = window.location.href;
var re = /\?event=(\d+)/; var re = /\?event=(\d+)/;
console.log("hola");
if(re.exec(url)) { if(re.exec(url)) {
if(!isNaN(RegExp.$1)) { if(!isNaN(RegExp.$1)) {
var eventId = RegExp.$1; var eventId = RegExp.$1;
document.write(chrome.extension.getBackgroundPage().getNotification(eventId)); document.write(chrome.extension.getBackgroundPage().getNotification(eventId));
} }
} }
console.log("hola");
window.onload = function () { window.onload = function () {
setTimeout(function() { setTimeout(function() {
window.close(); window.close();
}, 10000); }, 10000);
} }
console.log("hola");

View File

@ -1,6 +1,6 @@
{ {
"name": "__MSG_name__", "name": "__MSG_name__",
"version": "2.0", "version": "2.1",
"manifest_version": 2, "manifest_version": 2,
"description": "Pandora FMS Event viewer Chrome extension", "description": "Pandora FMS Event viewer Chrome extension",
"homepage_url": "http://pandorafms.com", "homepage_url": "http://pandorafms.com",
@ -23,6 +23,7 @@
"tabs", "tabs",
"notifications", "notifications",
"http://*/*", "http://*/*",
"https://*/*",
"background" "background"
], ],
"default_locale": "en" "default_locale": "en"

View File

@ -58,8 +58,17 @@ use strict;
use File::Basename; use File::Basename;
use Getopt::Std; use Getopt::Std;
use IO::Select; use IO::Select;
use IO::Compress::Zip qw(zip $ZipError); my $zlib_available = 1;
use IO::Uncompress::Unzip qw(unzip $UnzipError);
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)); use Socket (qw(SOCK_STREAM AF_INET AF_INET6));
my $SOCKET_MODULE = my $SOCKET_MODULE =
eval { require IO::Socket::INET6 } ? 'IO::Socket::INET6' eval { require IO::Socket::INET6 } ? 'IO::Socket::INET6'
@ -324,8 +333,10 @@ sub parse_options {
# Compress data # Compress data
if (defined ($opts{'z'})) { if (defined ($opts{'z'})) {
if ($zlib_available == 1) {
$t_zip = 1; $t_zip = 1;
} }
}
} }
################################################################################ ################################################################################
@ -622,7 +633,7 @@ sub zrecv_file {
# Receive file # Receive file
$zdata = recv_data_block ($size); $zdata = recv_data_block ($size);
if (!unzip(\$zdata => \$data)) { if (!unzip(\$zdata => \$data)) {
print_log ("Uncompress error: $UnzipError"); print_log ("Uncompress error: $IO::Uncompress::Unzip::UnzipError");
send_data ("ZRECV ERR\n"); send_data ("ZRECV ERR\n");
return; return;
} }
@ -705,7 +716,7 @@ sub zsend_file {
# Read the file and compress its contents # Read the file and compress its contents
if (! zip($file => \$data)) { if (! zip($file => \$data)) {
send_data ("QUIT\n"); send_data ("QUIT\n");
error ("Compression error: $ZipError"); error ("Compression error: $IO::Compress::Zip::ZipError");
return; return;
} }
@ -725,7 +736,7 @@ sub zsend_file {
error ("Server responded $response."); error ("Server responded $response.");
} }
print_log ("Server responded SEND OK"); print_log ("Server responded ZSEND OK");
send_data ($data); send_data ($data);
# Wait for server response # Wait for server response

View File

@ -58,8 +58,17 @@ use strict;
use File::Basename; use File::Basename;
use Getopt::Std; use Getopt::Std;
use IO::Select; use IO::Select;
use IO::Compress::Zip qw(zip $ZipError); my $zlib_available = 1;
use IO::Uncompress::Unzip qw(unzip $UnzipError);
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)); use Socket (qw(SOCK_STREAM AF_INET AF_INET6));
my $SOCKET_MODULE = my $SOCKET_MODULE =
eval { require IO::Socket::INET6 } ? 'IO::Socket::INET6' eval { require IO::Socket::INET6 } ? 'IO::Socket::INET6'
@ -324,8 +333,10 @@ sub parse_options {
# Compress data # Compress data
if (defined ($opts{'z'})) { if (defined ($opts{'z'})) {
if ($zlib_available == 1) {
$t_zip = 1; $t_zip = 1;
} }
}
} }
################################################################################ ################################################################################
@ -622,7 +633,7 @@ sub zrecv_file {
# Receive file # Receive file
$zdata = recv_data_block ($size); $zdata = recv_data_block ($size);
if (!unzip(\$zdata => \$data)) { if (!unzip(\$zdata => \$data)) {
print_log ("Uncompress error: $UnzipError"); print_log ("Uncompress error: $IO::Uncompress::Unzip::UnzipError");
send_data ("ZRECV ERR\n"); send_data ("ZRECV ERR\n");
return; return;
} }
@ -705,7 +716,7 @@ sub zsend_file {
# Read the file and compress its contents # Read the file and compress its contents
if (! zip($file => \$data)) { if (! zip($file => \$data)) {
send_data ("QUIT\n"); send_data ("QUIT\n");
error ("Compression error: $ZipError"); error ("Compression error: $IO::Compress::Zip::ZipError");
return; return;
} }
@ -725,7 +736,7 @@ sub zsend_file {
error ("Server responded $response."); error ("Server responded $response.");
} }
print_log ("Server responded SEND OK"); print_log ("Server responded ZSEND OK");
send_data ($data); send_data ($data);
# Wait for server response # Wait for server response

View File

@ -58,8 +58,17 @@ use strict;
use File::Basename; use File::Basename;
use Getopt::Std; use Getopt::Std;
use IO::Select; use IO::Select;
use IO::Compress::Zip qw(zip $ZipError); my $zlib_available = 1;
use IO::Uncompress::Unzip qw(unzip $UnzipError);
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)); use Socket (qw(SOCK_STREAM AF_INET AF_INET6));
my $SOCKET_MODULE = my $SOCKET_MODULE =
eval { require IO::Socket::INET6 } ? 'IO::Socket::INET6' eval { require IO::Socket::INET6 } ? 'IO::Socket::INET6'
@ -324,8 +333,10 @@ sub parse_options {
# Compress data # Compress data
if (defined ($opts{'z'})) { if (defined ($opts{'z'})) {
if ($zlib_available == 1) {
$t_zip = 1; $t_zip = 1;
} }
}
} }
################################################################################ ################################################################################
@ -622,7 +633,7 @@ sub zrecv_file {
# Receive file # Receive file
$zdata = recv_data_block ($size); $zdata = recv_data_block ($size);
if (!unzip(\$zdata => \$data)) { if (!unzip(\$zdata => \$data)) {
print_log ("Uncompress error: $UnzipError"); print_log ("Uncompress error: $IO::Uncompress::Unzip::UnzipError");
send_data ("ZRECV ERR\n"); send_data ("ZRECV ERR\n");
return; return;
} }
@ -705,7 +716,7 @@ sub zsend_file {
# Read the file and compress its contents # Read the file and compress its contents
if (! zip($file => \$data)) { if (! zip($file => \$data)) {
send_data ("QUIT\n"); send_data ("QUIT\n");
error ("Compression error: $ZipError"); error ("Compression error: $IO::Compress::Zip::ZipError");
return; return;
} }
@ -725,7 +736,7 @@ sub zsend_file {
error ("Server responded $response."); error ("Server responded $response.");
} }
print_log ("Server responded SEND OK"); print_log ("Server responded ZSEND OK");
send_data ($data); send_data ($data);
# Wait for server response # Wait for server response

View File

@ -1,5 +1,5 @@
package: pandorafms-agent-unix package: pandorafms-agent-unix
Version: 7.0NG.729-181127 Version: 7.0NG.729-181203
Architecture: all Architecture: all
Priority: optional Priority: optional
Section: admin Section: admin

View File

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

View File

@ -42,7 +42,7 @@ my $Sem = undef;
my $ThreadSem = undef; my $ThreadSem = undef;
use constant AGENT_VERSION => '7.0NG.729'; 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 # Agent log default file size maximum and instances
use constant DEFAULT_MAX_LOG_SIZE => 600000; use constant DEFAULT_MAX_LOG_SIZE => 600000;

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_agent_unix %define name pandorafms_agent_unix
%define version 7.0NG.729 %define version 7.0NG.729
%define release 181127 %define release 181203
Summary: Pandora FMS Linux agent, PERL version Summary: Pandora FMS Linux agent, PERL version
Name: %{name} Name: %{name}

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_agent_unix %define name pandorafms_agent_unix
%define version 7.0NG.729 %define version 7.0NG.729
%define release 181127 %define release 181203
Summary: Pandora FMS Linux agent, PERL version Summary: Pandora FMS Linux agent, PERL version
Name: %{name} Name: %{name}

View File

@ -10,7 +10,7 @@
# ********************************************************************** # **********************************************************************
PI_VERSION="7.0NG.729" PI_VERSION="7.0NG.729"
PI_BUILD="181127" PI_BUILD="181203"
OS_NAME=`uname -s` OS_NAME=`uname -s`
FORCE=0 FORCE=0

View File

@ -58,8 +58,17 @@ use strict;
use File::Basename; use File::Basename;
use Getopt::Std; use Getopt::Std;
use IO::Select; use IO::Select;
use IO::Compress::Zip qw(zip $ZipError); my $zlib_available = 1;
use IO::Uncompress::Unzip qw(unzip $UnzipError);
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)); use Socket (qw(SOCK_STREAM AF_INET AF_INET6));
my $SOCKET_MODULE = my $SOCKET_MODULE =
eval { require IO::Socket::INET6 } ? 'IO::Socket::INET6' eval { require IO::Socket::INET6 } ? 'IO::Socket::INET6'
@ -324,8 +333,10 @@ sub parse_options {
# Compress data # Compress data
if (defined ($opts{'z'})) { if (defined ($opts{'z'})) {
if ($zlib_available == 1) {
$t_zip = 1; $t_zip = 1;
} }
}
} }
################################################################################ ################################################################################
@ -622,7 +633,7 @@ sub zrecv_file {
# Receive file # Receive file
$zdata = recv_data_block ($size); $zdata = recv_data_block ($size);
if (!unzip(\$zdata => \$data)) { if (!unzip(\$zdata => \$data)) {
print_log ("Uncompress error: $UnzipError"); print_log ("Uncompress error: $IO::Uncompress::Unzip::UnzipError");
send_data ("ZRECV ERR\n"); send_data ("ZRECV ERR\n");
return; return;
} }
@ -705,7 +716,7 @@ sub zsend_file {
# Read the file and compress its contents # Read the file and compress its contents
if (! zip($file => \$data)) { if (! zip($file => \$data)) {
send_data ("QUIT\n"); send_data ("QUIT\n");
error ("Compression error: $ZipError"); error ("Compression error: $IO::Compress::Zip::ZipError");
return; return;
} }
@ -725,7 +736,7 @@ sub zsend_file {
error ("Server responded $response."); error ("Server responded $response.");
} }
print_log ("Server responded SEND OK"); print_log ("Server responded ZSEND OK");
send_data ($data); send_data ($data);
# Wait for server response # Wait for server response

View File

@ -186,7 +186,7 @@ UpgradeApplicationID
{} {}
Version Version
{181127} {181203}
ViewReadme ViewReadme
{Yes} {Yes}

View File

@ -30,7 +30,7 @@ using namespace Pandora;
using namespace Pandora_Strutils; using namespace Pandora_Strutils;
#define PATH_SIZE _MAX_PATH+1 #define PATH_SIZE _MAX_PATH+1
#define PANDORA_VERSION ("7.0NG.729(Build 181127)") #define PANDORA_VERSION ("7.0NG.729(Build 181203)")
string pandora_path; string pandora_path;
string pandora_dir; string pandora_dir;

View File

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

View File

@ -1,5 +1,5 @@
package: pandorafms-console package: pandorafms-console
Version: 7.0NG.729-181127 Version: 7.0NG.729-181203
Architecture: all Architecture: all
Priority: optional Priority: optional
Section: admin Section: admin

View File

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

View File

@ -46,7 +46,7 @@ else{
echo sprintf(__('%s %s - Build %s - MR %s', get_product_name(), $pandora_version, $build_package_version, $config["MR"])); echo sprintf(__('%s %s - Build %s - MR %s', get_product_name(), $pandora_version, $build_package_version, $config["MR"]));
echo '</a><br />'; 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">&reg; '.get_copyright_notice().'</span>'; echo '</a><br /><span style="color:#eff">&reg; '.get_copyright_notice().'</span>';
if (isset ($config['debug'])) { if (isset ($config['debug'])) {

View File

@ -261,7 +261,7 @@ if ($snmpwalk) {
} }
if ($create_modules) { if ($create_modules) {
$modules = get_parameter("module", array()); $modules = io_safe_output(get_parameter("module", array()));
$devices = array(); $devices = array();
$processes = array(); $processes = array();

View File

@ -229,15 +229,31 @@ $(document).ready (function () {
}); });
$("#left").click (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) { jQuery.each($("select[name='fields_selected[]'] option:selected"), function (key, value) {
field_name = $(value).html(); field_name = $(value).html();
if (field_name != <?php echo "'".__('None')."'"; ?>) { selected_fields.push(field_name);
id_field = $(value).attr('value'); selected_fields_total = selected_fields.length;
$("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();
}
}); });
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 () { $("#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> </script>

View File

@ -16,6 +16,8 @@
global $config; global $config;
include_once($config['homedir'] . "/include/functions_event_responses.php");
check_login (); check_login ();
if (! check_acl($config['id_user'], 0, "PM")) { if (! check_acl($config['id_user'], 0, "PM")) {
@ -25,14 +27,7 @@ if (! check_acl($config['id_user'], 0, "PM")) {
return; return;
} }
if (!is_user_admin($config['id_user'])) { $event_responses = event_responses_get_responses();
$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');
}
if(empty($event_responses)) { if(empty($event_responses)) {
ui_print_info_message ( array('no_close'=>true, 'message'=> __('No responses found') ) ); ui_print_info_message ( array('no_close'=>true, 'message'=> __('No responses found') ) );

View File

@ -40,24 +40,9 @@ switch($action) {
$values['modal_height'] = get_parameter('modal_height'); $values['modal_height'] = get_parameter('modal_height');
$values['new_window'] = get_parameter('new_window'); $values['new_window'] = get_parameter('new_window');
$values['params'] = get_parameter('params'); $values['params'] = get_parameter('params');
if (enterprise_installed()) {
if ($values['type'] == 'command') {
$values['server_to_exec'] = get_parameter('server_to_exec'); $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) { $result = event_responses_create_response($values);
$values['modal_width'] = 0;
$values['modal_height'] = 0;
}
$result = db_process_sql_insert('tevent_response', $values);
if($result) { if($result) {
ui_print_success_message(__('Response added succesfully')); ui_print_success_message(__('Response added succesfully'));
@ -78,26 +63,10 @@ switch($action) {
$values['modal_height'] = get_parameter('modal_height'); $values['modal_height'] = get_parameter('modal_height');
$values['new_window'] = get_parameter('new_window'); $values['new_window'] = get_parameter('new_window');
$values['params'] = get_parameter('params'); $values['params'] = get_parameter('params');
if (enterprise_installed()) {
if ($values['type'] == 'command') {
$values['server_to_exec'] = get_parameter('server_to_exec'); $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;
}
$response_id = get_parameter('id_response',0); $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) { if($result) {
ui_print_success_message(__('Response updated succesfully')); ui_print_success_message(__('Response updated succesfully'));

View File

@ -120,7 +120,9 @@ if (check_acl ($config['id_user'], 0, "AW")) {
$sub2["godmode/massive/massive_operations&amp;tab=massive_users"]["text"] = __('Users operations'); $sub2["godmode/massive/massive_operations&amp;tab=massive_users"]["text"] = __('Users operations');
} }
$sub2["godmode/massive/massive_operations&amp;tab=massive_alerts"]["text"] = __('Alerts operations'); $sub2["godmode/massive/massive_operations&amp;tab=massive_alerts"]["text"] = __('Alerts operations');
if ($config["centralized_management"] != 1) {
enterprise_hook('massivepolicies_submenu'); enterprise_hook('massivepolicies_submenu');
}
enterprise_hook('massivesnmp_submenu'); enterprise_hook('massivesnmp_submenu');
enterprise_hook('massivesatellite_submenu'); enterprise_hook('massivesatellite_submenu');

View File

@ -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') . ' &raquo; ' . ui_print_page_header (__('Module management') . ' &raquo; ' .
__('Network component management'), "", false, __('Network component management'), "", false,
"network_component", true,"",true,"modulemodal"); "network_component", true,"",false,"modulemodal");
$sec = 'gmodules'; $sec = 'gmodules';
} }

View File

@ -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"> <tr id="row_historical_db_check" style="" class="datos">
<td style="font-weight:bold;"> <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>
<td style=""> <td style="">
<?php <?php

View File

@ -220,7 +220,6 @@ function update_button_palette_callback() {
// TODO VALIDATE DATA // TODO VALIDATE DATA
switch (selectedItem) { switch (selectedItem) {
case 'background': case 'background':
if(values['width'] < 1024 || values['height'] < 768){ if(values['width'] < 1024 || values['height'] < 768){
alert('Min allowed size is 1024x768'); alert('Min allowed size is 1024x768');
return false; return false;
@ -235,7 +234,6 @@ function update_button_palette_callback() {
$("#background").css('width', values['width']); $("#background").css('width', values['width']);
$("#background").css('height', values['height']); $("#background").css('height', values['height']);
//$("#background").css('background', 'url(images/console/background/' + values['background'] + ')');
var image = values['background']; var image = values['background'];
$("#background_img").attr('src', "images/spinner.gif"); $("#background_img").attr('src', "images/spinner.gif");
set_image("background", null, image); set_image("background", null, image);
@ -243,7 +241,6 @@ function update_button_palette_callback() {
idElement = 0; idElement = 0;
break; break;
case 'box_item': case 'box_item':
if($('input[name=width_box]').val() == ''){ if($('input[name=width_box]').val() == ''){
alert('Undefined width'); alert('Undefined width');
return false; return false;
@ -275,39 +272,29 @@ function update_button_palette_callback() {
$("#text_" + idItem).html(values['label']); $("#text_" + idItem).html(values['label']);
if(values['show_statistics'] == 1){ if(values['show_statistics'] == 1){
if (!$('#image_'+idItem).length) { if (!$('#image_'+idItem).length) {
if(values['label_position'] == 'left'){ if(values['label_position'] == 'left'){
var $image = $('<img></img>') var $image = $('<img></img>')
.attr('id', 'image_' + idItem) .attr('id', 'image_' + idItem)
.attr('class', 'image') .attr('class', 'image')
.attr('src', 'images/console/icons/'+values["image"]+".png") .attr('src', 'images/console/icons/'+values["image"]+".png")
.attr('style','float:right;'); .attr('style','float:right;');
} }
else if(values['label_position'] == 'right'){ else if(values['label_position'] == 'right'){
var $image = $('<img></img>') var $image = $('<img></img>')
.attr('id', 'image_' + idItem) .attr('id', 'image_' + idItem)
.attr('class', 'image') .attr('class', 'image')
.attr('src', 'images/console/icons/'+values["image"]+".png") .attr('src', 'images/console/icons/'+values["image"]+".png")
.attr('style','float:left;'); .attr('style','float:left;');
} }
else{ else{
var $image = $('<img></img>') var $image = $('<img></img>')
.attr('id', 'image_' + idItem) .attr('id', 'image_' + idItem)
.attr('class', 'image') .attr('class', 'image')
.attr('src', 'images/console/icons/'+values["image"]+".png"); .attr('src', 'images/console/icons/'+values["image"]+".png");
} }
$('#'+idItem).append($image); $('#'+idItem).append($image);
} }
if ((values['width'] == 0) || (values['height'] == 0)) { if ((values['width'] == 0) || (values['height'] == 0)) {
@ -318,7 +305,6 @@ function update_button_palette_callback() {
$("#image_" + idItem).css('width', '520px'); $("#image_" + idItem).css('width', '520px');
$("#image_" + idItem).css('height', '80px'); $("#image_" + idItem).css('height', '80px');
$("#image_" + idItem).attr('src', 'images/console/signes/group_status.png'); $("#image_" + idItem).attr('src', 'images/console/signes/group_status.png');
} }
else { else {
$("#image_" + idItem).removeAttr('width'); $("#image_" + idItem).removeAttr('width');
@ -329,46 +315,33 @@ function update_button_palette_callback() {
$("#image_" + idItem).css('height', values['height'] + 'px'); $("#image_" + idItem).css('height', values['height'] + 'px');
$("#image_" + idItem).attr('src', 'images/console/signes/group_status.png'); $("#image_" + idItem).attr('src', 'images/console/signes/group_status.png');
} }
} }
else{ else{
if ((values['width'] == 0) || (values['height'] == 0)) { if ((values['width'] == 0) || (values['height'] == 0)) {
if(values['image'] != '' && values['image'] != 'none'){ if(values['image'] != '' && values['image'] != 'none'){
if (!$('#image_'+idItem).length) { if (!$('#image_'+idItem).length) {
if(values['label_position'] == 'left'){ if(values['label_position'] == 'left'){
var $image = $('<img></img>') var $image = $('<img></img>')
.attr('id', 'image_' + idItem) .attr('id', 'image_' + idItem)
.attr('class', 'image') .attr('class', 'image')
.attr('src', 'images/console/icons/'+values["image"]+".png") .attr('src', 'images/console/icons/'+values["image"]+".png")
.attr('style','float:right;'); .attr('style','float:right;');
} }
else if(values['label_position'] == 'right'){ else if(values['label_position'] == 'right'){
var $image = $('<img></img>') var $image = $('<img></img>')
.attr('id', 'image_' + idItem) .attr('id', 'image_' + idItem)
.attr('class', 'image') .attr('class', 'image')
.attr('src', 'images/console/icons/'+values["image"]+".png") .attr('src', 'images/console/icons/'+values["image"]+".png")
.attr('style','float:left;'); .attr('style','float:left;');
} }
else{ else{
var $image = $('<img></img>') var $image = $('<img></img>')
.attr('id', 'image_' + idItem) .attr('id', 'image_' + idItem)
.attr('class', 'image') .attr('class', 'image')
.attr('src', 'images/console/icons/'+values["image"]+".png"); .attr('src', 'images/console/icons/'+values["image"]+".png");
} }
$('#'+idItem).append($image); $('#'+idItem).append($image);
} }
if($('#preview > img').prop('naturalWidth') == null || $('#preview > img')[0].naturalWidth > 150 || $('#preview > img')[0].naturalHeight > 150){ if($('#preview > img').prop('naturalWidth') == null || $('#preview > img')[0].naturalWidth > 150 || $('#preview > img')[0].naturalHeight > 150){
@ -382,15 +355,11 @@ function update_button_palette_callback() {
else{ else{
$("#image_" + idItem).removeAttr('width'); $("#image_" + idItem).removeAttr('width');
$("#image_" + idItem).removeAttr('height'); $("#image_" + idItem).removeAttr('height');
$("#image_" + idItem).attr('width', $('#preview > img')[0].naturalHeight); $("#image_" + idItem).attr('width', $('#preview > img')[0].naturalHeight);
$("#image_" + idItem).attr('height', $('#preview > img')[0].naturalHeight); $("#image_" + idItem).attr('height', $('#preview > img')[0].naturalHeight);
$("#image_" + idItem).css('width', $('#preview > img')[0].naturalHeight+'px'); $("#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{ else{
$("#image_" + idItem).removeAttr('width'); $("#image_" + idItem).removeAttr('width');
@ -401,7 +370,6 @@ function update_button_palette_callback() {
$("#image_" + idItem).css('height', '70px'); $("#image_" + idItem).css('height', '70px');
$("#image_" + idItem).remove(); $("#image_" + idItem).remove();
} }
} }
else { else {
$("#image_" + idItem).removeAttr('width'); $("#image_" + idItem).removeAttr('width');
@ -411,14 +379,9 @@ function update_button_palette_callback() {
$("#image_" + idItem).css('width', values['width'] + 'px'); $("#image_" + idItem).css('width', values['width'] + 'px');
$("#image_" + idItem).css('height', values['height'] + 'px'); $("#image_" + idItem).css('height', values['height'] + 'px');
} }
} }
break; break;
case 'static_graph': case 'static_graph':
if($('input[name=width]').val() == ''){ if($('input[name=width]').val() == ''){
alert('Undefined width'); alert('Undefined width');
return false; return false;
@ -435,8 +398,6 @@ function update_button_palette_callback() {
$("#text_" + idItem).html(values['label']); $("#text_" + idItem).html(values['label']);
if(values['show_statistics'] == 1){ if(values['show_statistics'] == 1){
if ((values['width'] == 0) || (values['height'] == 0)) { if ((values['width'] == 0) || (values['height'] == 0)) {
$("#image_" + idItem).removeAttr('width'); $("#image_" + idItem).removeAttr('width');
$("#image_" + idItem).removeAttr('height'); $("#image_" + idItem).removeAttr('height');
@ -445,7 +406,6 @@ function update_button_palette_callback() {
$("#image_" + idItem).css('width', '520px'); $("#image_" + idItem).css('width', '520px');
$("#image_" + idItem).css('height', '80px'); $("#image_" + idItem).css('height', '80px');
$("#image_" + idItem).attr('src', 'images/console/signes/group_status.png'); $("#image_" + idItem).attr('src', 'images/console/signes/group_status.png');
} }
else { else {
$("#image_" + idItem).removeAttr('width'); $("#image_" + idItem).removeAttr('width');
@ -456,49 +416,34 @@ function update_button_palette_callback() {
$("#image_" + idItem).css('height', values['height'] + 'px'); $("#image_" + idItem).css('height', values['height'] + 'px');
$("#image_" + idItem).attr('src', 'images/console/signes/group_status.png'); $("#image_" + idItem).attr('src', 'images/console/signes/group_status.png');
} }
} }
else{ else{
if ((values['width'] == 0) || (values['height'] == 0)) { if ((values['width'] == 0) || (values['height'] == 0)) {
if(values['image'] != '' && values['image'] != 'none'){ if(values['image'] != '' && values['image'] != 'none'){
if (!$('#image_'+idItem).length) { if (!$('#image_'+idItem).length) {
if(values['label_position'] == 'left'){ if(values['label_position'] == 'left'){
var $image = $('<img></img>') var $image = $('<img></img>')
.attr('id', 'image_' + idItem) .attr('id', 'image_' + idItem)
.attr('class', 'image') .attr('class', 'image')
.attr('src', 'images/console/icons/'+values["image"]+".png") .attr('src', 'images/console/icons/'+values["image"]+".png")
.attr('style','float:right;'); .attr('style','float:right;');
} }
else if(values['label_position'] == 'right'){ else if(values['label_position'] == 'right'){
var $image = $('<img></img>') var $image = $('<img></img>')
.attr('id', 'image_' + idItem) .attr('id', 'image_' + idItem)
.attr('class', 'image') .attr('class', 'image')
.attr('src', 'images/console/icons/'+values["image"]+".png") .attr('src', 'images/console/icons/'+values["image"]+".png")
.attr('style','float:left;'); .attr('style','float:left;');
} }
else{ else{
var $image = $('<img></img>') var $image = $('<img></img>')
.attr('id', 'image_' + idItem) .attr('id', 'image_' + idItem)
.attr('class', 'image') .attr('class', 'image')
.attr('src', 'images/console/icons/'+values["image"]+".png"); .attr('src', 'images/console/icons/'+values["image"]+".png");
} }
$('#'+idItem).append($image); $('#'+idItem).append($image);
} }
if($('#preview > img').prop('naturalWidth') == null || $('#preview > img')[0].naturalWidth > 150 || $('#preview > img')[0].naturalHeight > 150){ if($('#preview > img').prop('naturalWidth') == null || $('#preview > img')[0].naturalWidth > 150 || $('#preview > img')[0].naturalHeight > 150){
$("#image_" + idItem).removeAttr('width'); $("#image_" + idItem).removeAttr('width');
$("#image_" + idItem).removeAttr('height'); $("#image_" + idItem).removeAttr('height');
@ -510,15 +455,11 @@ function update_button_palette_callback() {
else{ else{
$("#image_" + idItem).removeAttr('width'); $("#image_" + idItem).removeAttr('width');
$("#image_" + idItem).removeAttr('height'); $("#image_" + idItem).removeAttr('height');
$("#image_" + idItem).attr('width', $('#preview > img')[0].naturalHeight); $("#image_" + idItem).attr('width', $('#preview > img')[0].naturalHeight);
$("#image_" + idItem).attr('height', $('#preview > img')[0].naturalHeight); $("#image_" + idItem).attr('height', $('#preview > img')[0].naturalHeight);
$("#image_" + idItem).css('width', $('#preview > img')[0].naturalHeight+'px'); $("#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{ else{
$("#image_" + idItem).removeAttr('width'); $("#image_" + idItem).removeAttr('width');
@ -529,7 +470,6 @@ function update_button_palette_callback() {
$("#image_" + idItem).css('height', '70px'); $("#image_" + idItem).css('height', '70px');
$("#image_" + idItem).remove(); $("#image_" + idItem).remove();
} }
} }
else { else {
$("#image_" + idItem).removeAttr('width'); $("#image_" + idItem).removeAttr('width');
@ -539,9 +479,7 @@ function update_button_palette_callback() {
$("#image_" + idItem).css('width', values['width'] + 'px'); $("#image_" + idItem).css('width', values['width'] + 'px');
$("#image_" + idItem).css('height', values['height'] + 'px'); $("#image_" + idItem).css('height', values['height'] + 'px');
} }
} }
break; break;
case 'percentile_bar': case 'percentile_bar':
case 'percentile_item': case 'percentile_item':
@ -549,6 +487,7 @@ function update_button_palette_callback() {
alert('Undefined width'); alert('Undefined width');
return false; return false;
} }
if($('input[name=height_percentile]').val() == ''){ if($('input[name=height_percentile]').val() == ''){
alert('Undefined height'); alert('Undefined height');
return false; return false;
@ -556,6 +495,7 @@ function update_button_palette_callback() {
$("#text_" + idItem).html(values['label']); $("#text_" + idItem).html(values['label']);
$("#image_" + idItem).attr("src", "images/spinner.gif"); $("#image_" + idItem).attr("src", "images/spinner.gif");
if (values['type_percentile'] == 'bubble') { if (values['type_percentile'] == 'bubble') {
setPercentileBubble(idItem, values); setPercentileBubble(idItem, values);
} }
@ -801,6 +741,10 @@ function readFields() {
values['label'] = $("input[name=label]").val(); values['label'] = $("input[name=label]").val();
var text = tinymce.get('text-label').getContent(); var text = tinymce.get('text-label').getContent();
values['label'] = text; 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['line-height'] = $("#text-label_ifr").contents().find("p").css('line-height');
values['type_graph'] = $("select[name=type_graph]").val(); values['type_graph'] = $("select[name=type_graph]").val();
values['image'] = $("select[name=image]").val(); values['image'] = $("select[name=image]").val();
@ -2479,7 +2423,6 @@ function setPercentileCircular (id_data, values) {
width_percentile = values['width_percentile']; width_percentile = values['width_percentile'];
var parameter = Array(); var parameter = Array();
parameter.push ({name: "page", value: "include/ajax/visual_console_builder.ajax"}); parameter.push ({name: "page", value: "include/ajax/visual_console_builder.ajax"});
parameter.push ({name: "action", value: "get_module_value"}); parameter.push ({name: "action", value: "get_module_value"});
parameter.push ({name: "id_element", value: id_data}); parameter.push ({name: "id_element", value: id_data});
@ -3835,14 +3778,12 @@ function updateDB_visual(type, idElement , values, event, top, left) {
case 'clock': case 'clock':
case 'auto_sla_graph': case 'auto_sla_graph':
case 'donut_graph': case 'donut_graph':
if ((typeof(values['absolute_left']) != 'undefined') &&
if ((typeof(values['mov_left']) != 'undefined') && (typeof(values['absolute_top']) != 'undefined')) {
(typeof(values['mov_top']) != 'undefined')) {
$("#" + idElement).css('top', '0px').css('top', top + 'px'); $("#" + idElement).css('top', '0px').css('top', top + 'px');
$("#" + idElement).css('left', '0px').css('left', left + 'px'); $("#" + idElement).css('left', '0px').css('left', left + 'px');
} }
else if ((typeof(values['absolute_left']) != 'undefined') && else{
(typeof(values['absolute_top']) != 'undefined')) {
$("#" + idElement).css('top', '0px').css('top', top + 'px'); $("#" + idElement).css('top', '0px').css('top', top + 'px');
$("#" + idElement).css('left', '0px').css('left', left + '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}); parameter.push({name: key, value: val});
}); });
switch (type) { switch (type) {
// -- line_item -- // -- line_item --
case 'handler_start': case 'handler_start':

View File

@ -66,40 +66,19 @@ $id_profile = (int) get_parameter ('id');
// Profile deletion // Profile deletion
if ($delete_profile) { 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.'));
}
else {
// Delete profile // Delete profile
$profile = db_get_row('tperfil', 'id_perfil', $id_profile); $profile = db_get_row('tperfil', 'id_perfil', $id_profile);
$sql = sprintf ('DELETE FROM tperfil WHERE id_perfil = %d', $id_profile); $ret = profile_delete_profile_and_clean_users ($id_profile);
$ret = db_process_sql ($sql);
if ($ret === false) { if ($ret === false) {
ui_print_error_message(__('There was a problem deleting the profile')); ui_print_error_message(__('There was a problem deleting the profile'));
} }
else { else {
db_pandora_audit("Profile management", db_pandora_audit("Profile management",
"Delete profile ". $profile['name']); "Delete profile ". $profile['name']);
ui_print_success_message(__('Successfully deleted')); 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; $id_profile = 0;
}
} }
// Store the variables when create or update // Store the variables when create or update

View File

@ -472,16 +472,17 @@ if ($list_modules) {
$sort = get_parameter('sort', 'none'); $sort = get_parameter('sort', 'none');
$selected = 'border: 1px solid black;'; $selected = 'border: 1px solid black;';
$order[] = array('field' => 'tmodule_group.name', 'order' => 'ASC');
switch ($sortField) { switch ($sortField) {
case 'type': case 'type':
switch ($sort) { switch ($sort) {
case 'up': case 'up':
$selectTypeUp = $selected; $selectTypeUp = $selected;
$order = array('field' => 'tagente_modulo.id_modulo', 'order' => 'ASC'); $order[] = array('field' => 'tagente_modulo.id_modulo', 'order' => 'ASC');
break; break;
case 'down': case 'down':
$selectTypeDown = $selected; $selectTypeDown = $selected;
$order = array('field' => 'tagente_modulo.id_modulo', 'order' => 'DESC'); $order[] = array('field' => 'tagente_modulo.id_modulo', 'order' => 'DESC');
break; break;
} }
break; break;
@ -489,11 +490,11 @@ if ($list_modules) {
switch ($sort) { switch ($sort) {
case 'up': case 'up':
$selectNameUp = $selected; $selectNameUp = $selected;
$order = array('field' => 'tagente_modulo.nombre', 'order' => 'ASC'); $order[] = array('field' => 'tagente_modulo.nombre', 'order' => 'ASC');
break; break;
case 'down': case 'down':
$selectNameDown = $selected; $selectNameDown = $selected;
$order = array('field' => 'tagente_modulo.nombre', 'order' => 'DESC'); $order[] = array('field' => 'tagente_modulo.nombre', 'order' => 'DESC');
break; break;
} }
break; break;
@ -501,11 +502,11 @@ if ($list_modules) {
switch ($sort) { switch ($sort) {
case 'up': case 'up':
$selectStatusUp = $selected; $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; break;
case 'down': case 'down':
$selectStatusDown = $selected; $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;
} }
break; break;
@ -513,11 +514,11 @@ if ($list_modules) {
switch ($sort) { switch ($sort) {
case 'up': case 'up':
$selectLastContactUp = $selected; $selectLastContactUp = $selected;
$order = array('field' => 'tagente_estado.utimestamp', 'order' => 'ASC'); $order[] = array('field' => 'tagente_estado.utimestamp', 'order' => 'ASC');
break; break;
case 'down': case 'down':
$selectLastContactDown = $selected; $selectLastContactDown = $selected;
$order = array('field' => 'tagente_estado.utimestamp', 'order' => 'DESC'); $order[] = array('field' => 'tagente_estado.utimestamp', 'order' => 'DESC');
break; break;
} }
break; break;
@ -533,7 +534,7 @@ if ($list_modules) {
$selectLastContactUp = ''; $selectLastContactUp = '';
$selectLastContactDown = ''; $selectLastContactDown = '';
$order = array('field' => 'tagente_modulo.nombre', 'order' => 'ASC'); $order[] = array('field' => 'tagente_modulo.nombre', 'order' => 'ASC');
break; break;
} }
@ -588,7 +589,20 @@ if ($list_modules) {
} }
//Count monitors/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 $sql_condition = "FROM tagente_modulo
$tags_join $tags_join
INNER JOIN tagente_estado INNER JOIN tagente_estado

View File

@ -29,7 +29,6 @@ if ($get_image_path_status){
$result['bad'] = html_print_image($img_src . '_bad.png', true, '', $only_src); $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['ok'] = html_print_image($img_src . '_ok.png', true, '', $only_src);
$result['warning'] = html_print_image($img_src . '_warning.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); $result['normal'] = html_print_image($img_src . '.png', true, '', $only_src);
echo json_encode($result); echo json_encode($result);

View File

@ -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"];
?>

View File

@ -123,7 +123,7 @@ if (file_exists ('languages/'.$user_language.'.mo')) {
$params['height'], $params['height'],
$params['water_mark_url'], $params['water_mark_url'],
$params['font'], $params['font'],
$params['font_size'], $config['font_size'],
$params['legend_position'], $params['legend_position'],
$params['colors'], $params['colors'],
$params['hide_labels'] $params['hide_labels']
@ -142,7 +142,7 @@ if (file_exists ('languages/'.$user_language.'.mo')) {
$params['water_mark_url'], $params['water_mark_url'],
$params['homedir'], $params['homedir'],
$params['font'], $params['font'],
$params['font_size'], $config['font_size'],
$params['from_ux'], $params['from_ux'],
$params['from_wux'], $params['from_wux'],
$params['backgroundColor'], $params['backgroundColor'],
@ -156,7 +156,7 @@ if (file_exists ('languages/'.$user_language.'.mo')) {
$params['height'], $params['height'],
$params['water_mark_url'], $params['water_mark_url'],
$params['font'], $params['font'],
$params['font_size'], $config['font_size'],
$params['backgroundColor'], $params['backgroundColor'],
$params['tick_color'], $params['tick_color'],
$params['val_min'], $params['val_min'],
@ -176,7 +176,7 @@ if (file_exists ('languages/'.$user_language.'.mo')) {
'', '',
$params['water_mark'], $params['water_mark'],
$params['font'], $params['font'],
$params['font_size'], $config['font_size'],
$params['unit'], $params['unit'],
$params['ttl'], $params['ttl'],
$params['homeurl'], $params['homeurl'],
@ -213,6 +213,16 @@ if (file_exists ('languages/'.$user_language.'.mo')) {
$config['font_size'] = $aux_font_size; $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> </body>
</html> </html>

View File

@ -22,7 +22,7 @@
/** /**
* Pandora build version and version * Pandora build version and version
*/ */
$build_version = 'PC181127'; $build_version = 'PC181203';
$pandora_version = 'v7.0NG.729'; $pandora_version = 'v7.0NG.729';
// Do not overwrite default timezone set if defined. // Do not overwrite default timezone set if defined.

View File

@ -3320,12 +3320,13 @@ function generator_chart_to_pdf($type_graph_pdf, $params, $params_combined = fal
. ' "' . $session_id . '"' . ' "' . $session_id . '"'
. ' "' . $params['return_img_base_64'] . '"'; . ' "' . $params['return_img_base_64'] . '"';
$result = exec($cmd); exec($cmd, $result);
$img_content = join("\n", $result);
if($params['return_img_base_64']){ if($params['return_img_base_64']){
// To be used in alerts // To be used in alerts
$width_img = 500; $width_img = 500;
return $result; return $img_content;
} }
else{ else{
// to be used in PDF files // to be used in PDF files

View File

@ -360,12 +360,13 @@ function agents_get_agents ($filter = false, $fields = false,
AND unknown_count > 0)"; AND unknown_count > 0)";
break; break;
case AGENT_STATUS_NOT_NORMAL: case AGENT_STATUS_NOT_NORMAL:
$status_sql = "( $status_sql =
critical_count > 0 "normal_count <> total_count";
OR warning_count > 0 //The AGENT_STATUS_NOT_NORMAL filter must show all agents that are not in normal status
OR unknown_count > 0 /*"(
OR total_count = 0 normal_count <> total_count
OR total_count = notinit_count)"; AND
(normal_count + notinit_count) <> total_count)";*/
break; break;
case AGENT_STATUS_NOT_INIT: case AGENT_STATUS_NOT_INIT:
$status_sql = "( $status_sql = "(

View File

@ -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) { if ($count !== false) {
$selectText = 'COUNT(talert_template_modules.id) AS count'; $selectText = 'COUNT(DISTINCT talert_template_modules.id) AS count';
} }
$sql = sprintf ("SELECT %s $sql = sprintf ("SELECT %s

View File

@ -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_netflow.php");
include_once($config['homedir'] . "/include/functions_servers.php"); include_once($config['homedir'] . "/include/functions_servers.php");
include_once($config['homedir'] . "/include/functions_planned_downtimes.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_local_components.php');
enterprise_include_once ('include/functions_events.php'); enterprise_include_once ('include/functions_events.php');
enterprise_include_once ('include/functions_agents.php'); enterprise_include_once ('include/functions_agents.php');
@ -8721,6 +8723,210 @@ function api_set_delete_user_profile($id, $thrash1, $other, $thrash2) {
returnData('string', array('type' => 'string', 'data' => __('Delete user profile.'))); 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. * Create new incident in Pandora.
* *
@ -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){ function api_get_cluster_items ($cluster_id){
global $config; global $config;
@ -11512,6 +11871,140 @@ function util_api_check_agent_and_print_error($id_agent, $returnType, $access =
return false; 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.');
}
}

View File

@ -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)
);
}
?>

View File

@ -853,10 +853,15 @@ function events_print_event_table ($filter = "", $limit = 10, $width = 440, $ret
$filter = '1 = 1'; $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.* $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 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); $result = db_get_all_rows_sql ($sql);

View File

@ -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; return false;
} }
@ -912,7 +912,9 @@ function grafico_modulo_sparse ($params) {
else{ else{
$return = graph_nodata_image( $return = graph_nodata_image(
$params['width'], $params['width'],
$params['height'] $params['height'],
'area',
__('No data to display within the selected interval')
); );
} }
} }
@ -2456,7 +2458,9 @@ function graph_sla_slicebar (
0, 0,
array(), array(),
true, true,
$ttl $ttl,
false,
false
); );
} }
@ -3282,13 +3286,10 @@ function graph_graphic_moduleevents ($id_agent, $id_module, $width, $height, $pe
$data = array (); $data = array ();
//$resolution = $config['graph_res'] * ($period * 2 / $width); // Number of "slices" we want in graph $interval = 24;
$resolution = 5 * ($period * 2 / $width); // Number of "slices" we want in graph $date = get_system_time();
$interval = (int) ($period / $resolution);
$date = get_system_time ();
$datelimit = $date - $period; $datelimit = $date - $period;
$periodtime = floor ($period / $interval); $periodtime = floor ($period / $interval);
$time = array ();
$data = array (); $data = array ();
$legend = array(); $legend = array();
$full_legend = array(); $full_legend = array();
@ -3592,6 +3593,7 @@ function fullscale_data (
} }
} }
else{ else{
if ($data_uncompress === false) $data_uncompress = array();
foreach ($data_uncompress as $k) { foreach ($data_uncompress as $k) {
foreach ($k["data"] as $v) { foreach ($k["data"] as $v) {
if (isset($v["type"]) && $v["type"] == 1) { # skip unnecesary virtual data 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]['min'] = $min_value_min;
$data["sum" . $series_suffix]['max'] = $max_value_max; $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){ 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 = '') { 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); false, false, false);
// if ($text == '') { // if ($text == '') {
// $text = __('No data to show'); // $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 . '\');">' . $div = '<div style="width:' . $width . 'px; height:' . $height . 'px; background-color: white; margin: 0 auto;">' .
$text_div . '</div>';
$div = '<div style="width:' . $width . 'px; height:' . $height . 'px; border: 1px dotted #ddd; background-color: white; margin: 0 auto;">' .
$image_div . '</div>'; $image_div . '</div>';
return $div; return $div;

View File

@ -144,6 +144,20 @@ function profile_delete_profile ($id_profile) {
return (bool)db_process_sql_delete('tperfil', array('id_perfil' => $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 * Print the table to display, create and delete profiles
* *

View File

@ -144,6 +144,35 @@ function reporting_make_reporting_data($report = null, $id_report,
$metaconsole_on = is_metaconsole(); $metaconsole_on = is_metaconsole();
$index_content = 0; $index_content = 0;
foreach ($contents as $content) { 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']; $server_name = $content['server_name'];
// General reports with 0 period means last value // 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']); $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']); $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; $i = 0;
$index = 0; $index = 0;
$is_string = array(); $is_string = array();
foreach ($generals as $row) { foreach ($generals as $row) {
//Metaconsole connection //Metaconsole connection
$server_name = $row ['server_name']; $server_name = $row ['server_name'];
@ -6352,7 +6382,17 @@ function reporting_custom_graph($report, $content, $type = 'dinamic',
} }
} }
else{ else{
if ($content['id_agent_module']) {
$modules[] = $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; $id_graph = 0;
} }
@ -6407,7 +6447,7 @@ function reporting_custom_graph($report, $content, $type = 'dinamic',
break; break;
} }
if ($config['metaconsole'] && $type_report != 'automatic_graph') { if ($config['metaconsole']) {
metaconsole_restore_db(); 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'] = "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']; $urls['monitor_alerts_fired'] = "index.php?sec=estado&sec2=operation/agentes/alerts_status&filter=fired&pure=" . $config['pure'];
} else { } else {
$urls['monitor_alerts'] = "index.php?sec=estado&amp;sec2=operation/agentes/alerts_status&amp;refr=60"; $urls['monitor_alerts'] = $config['homeurl']."index.php?sec=estado&amp;sec2=operation/agentes/alerts_status&amp;refr=60";
$urls['monitor_alerts_fired'] = "index.php?sec=estado&amp;sec2=operation/agentes/alerts_status&amp;refr=60&filter=fired"; $urls['monitor_alerts_fired'] = $config['homeurl']."index.php?sec=estado&amp;sec2=operation/agentes/alerts_status&amp;refr=60&filter=fired";
} }
} }
@ -7560,19 +7600,19 @@ function reporting_get_stats_modules_status($data, $graph_width = 250, $graph_he
// Link URLS // Link URLS
if ($links === false) { if ($links === false) {
$urls = array(); $urls = array();
$urls['monitor_critical'] = "index.php?" . $urls['monitor_critical'] = $config['homeurl']."index.php?" .
"sec=view&amp;sec2=operation/agentes/status_monitor&amp;" . "sec=view&amp;sec2=operation/agentes/status_monitor&amp;" .
"refr=60&amp;status=" . AGENT_MODULE_STATUS_CRITICAL_BAD . "&pure=" . $config['pure']; "refr=60&amp;status=" . AGENT_MODULE_STATUS_CRITICAL_BAD . "&pure=" . $config['pure'];
$urls['monitor_warning'] = "index.php?" . $urls['monitor_warning'] = $config['homeurl']."index.php?" .
"sec=view&amp;sec2=operation/agentes/status_monitor&amp;" . "sec=view&amp;sec2=operation/agentes/status_monitor&amp;" .
"refr=60&amp;status=" . AGENT_MODULE_STATUS_WARNING . "&pure=" . $config['pure']; "refr=60&amp;status=" . AGENT_MODULE_STATUS_WARNING . "&pure=" . $config['pure'];
$urls['monitor_ok'] = "index.php?" . $urls['monitor_ok'] = $config['homeurl']."index.php?" .
"sec=view&amp;sec2=operation/agentes/status_monitor&amp;" . "sec=view&amp;sec2=operation/agentes/status_monitor&amp;" .
"refr=60&amp;status=" . AGENT_MODULE_STATUS_NORMAL . "&pure=" . $config['pure']; "refr=60&amp;status=" . AGENT_MODULE_STATUS_NORMAL . "&pure=" . $config['pure'];
$urls['monitor_unknown'] = "index.php?" . $urls['monitor_unknown'] = $config['homeurl']."index.php?" .
"sec=view&amp;sec2=operation/agentes/status_monitor&amp;" . "sec=view&amp;sec2=operation/agentes/status_monitor&amp;" .
"refr=60&amp;status=" . AGENT_MODULE_STATUS_UNKNOWN . "&pure=" . $config['pure']; "refr=60&amp;status=" . AGENT_MODULE_STATUS_UNKNOWN . "&pure=" . $config['pure'];
$urls['monitor_not_init'] = "index.php?" . $urls['monitor_not_init'] = $config['homeurl']."index.php?" .
"sec=view&amp;sec2=operation/agentes/status_monitor&amp;" . "sec=view&amp;sec2=operation/agentes/status_monitor&amp;" .
"refr=60&amp;status=" . AGENT_MODULE_STATUS_NOT_INIT . "&pure=" . $config['pure']; "refr=60&amp;status=" . AGENT_MODULE_STATUS_NOT_INIT . "&pure=" . $config['pure'];
} }
@ -7675,8 +7715,8 @@ function reporting_get_stats_agents_monitors($data) {
} }
else { else {
$urls = array(); $urls = array();
$urls['total_agents'] = "index.php?sec=estado&amp;sec2=operation/agentes/estado_agente&amp;refr=60"; $urls['total_agents'] = $config['homeurl']."index.php?sec=estado&amp;sec2=operation/agentes/estado_agente&amp;refr=60";
$urls['monitor_checks'] = "index.php?sec=view&amp;sec2=operation/agentes/status_monitor&amp;refr=60&amp;status=-1"; $urls['monitor_checks'] = $config['homeurl']."index.php?sec=view&amp;sec2=operation/agentes/status_monitor&amp;refr=60&amp;status=-1";
} }
// Agents and modules table // Agents and modules table

View File

@ -3640,7 +3640,9 @@ function reporting_get_event_histogram ($events, $text_header_event = false) {
0, 0,
array(), array(),
true, true,
$ttl $ttl,
false,
false
); );
$table->data[0][0] = $slicebar; $table->data[0][0] = $slicebar;
@ -3823,7 +3825,9 @@ function reporting_get_event_histogram_meta ($width) {
0, 0,
$full_legend_date, $full_legend_date,
true, true,
1 1,
false,
false
); );
$table->data[0][0] = $slicebar; $table->data[0][0] = $slicebar;

View File

@ -548,7 +548,7 @@ function ui_print_group_icon ($id_group, $return = false, $path = "groups_small"
$link = false; $link = false;
if ($link) if ($link)
$output = '<a href="index.php?sec=estado&amp;sec2=operation/agentes/estado_agente&amp;refr=60&amp;group_id='.$id_group.'">'; $output = '<a href="'.$config["homeurl"].'index.php?sec=estado&amp;sec2=operation/agentes/estado_agente&amp;refr=60&amp;group_id='.$id_group.'">';
if ($config['show_group_name']) { if ($config['show_group_name']) {
$output .= '<span title="'. groups_get_name($id_group, true) .'">' . $output .= '<span title="'. groups_get_name($id_group, true) .'">' .

View File

@ -1205,7 +1205,7 @@ function visual_map_print_item($mode = "read", $layoutData,
$img = '<div style="float:right;height:'.$himg.'px;">'. $img = '<div style="float:right;height:'.$himg.'px;">'.
hbar_graph($module_data, hbar_graph($module_data,
400, 400, $color, array(), array(), 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, "", "", $water_mark, $config['fontpath'], 6,
"", 0, $config['homeurl'], $layoutData['image'], $layoutData['border_color']) . '</div>'; "", 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;">'. $img = '<div style="float:right;height:'.$himg.'px;">'.
vbar_graph($module_data, vbar_graph($module_data,
400, 400, $color, array(), array(), 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, "", "", $water_mark, $config['fontpath'], 6,
"", 0, $config['homeurl'], $layoutData['image'], true, false, $layoutData['border_color']) . '</div>'; "", 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;">'. $img = '<div style="float:left;height:'.$himg.'px;">'.
hbar_graph($module_data, hbar_graph($module_data,
400, 400, $color, array(), array(), 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, "", "", $water_mark, $config['fontpath'], 6,
"", 0, $config['homeurl'], $layoutData['image'], $layoutData['border_color']) . '</div>'; "", 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;">'. $img = '<div style="float:left;height:'.$himg.'px;">'.
vbar_graph($module_data, vbar_graph($module_data,
400, 400, $color, array(), array(), 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, "", "", $water_mark, $config['fontpath'], 6,
"", 0, $config['homeurl'], $layoutData['image'], true, false, $layoutData['border_color']) . '</div>'; "", 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') { if ($layoutData['type_graph'] == 'horizontal') {
$img = hbar_graph($module_data, $img = hbar_graph($module_data,
400, 400, $color, array(), array(), 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, "", "", $water_mark, $config['fontpath'], 6,
"", 0, $config['homeurl'], $layoutData['image'], $layoutData['border_color']); "", 0, $config['homeurl'], $layoutData['image'], $layoutData['border_color']);
} }
else { else {
$img = vbar_graph($module_data, $img = vbar_graph($module_data,
400, 400, $color, array(), array(), 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, "", "", $water_mark, $config['fontpath'], 6,
"", 0, $config['homeurl'], $layoutData['image'], true, false, $layoutData['border_color']); "", 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;">'. $img = '<div style="float:right;height:'.$himg.'px;">'.
hbar_graph($module_data, hbar_graph($module_data,
$width, $height, $color, array(), array(), $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, "", "", $water_mark, $config['fontpath'], 6,
"", 0, $config['homeurl'], $layoutData['image'], $layoutData['border_color']) . '</div>'; "", 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;">'. $img = '<div style="float:right;height:'.$himg.'px;">'.
vbar_graph($module_data, vbar_graph($module_data,
$width, $height, $color, array(), array(), $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, "", "", $water_mark, $config['fontpath'], 6,
"", 0, $config['homeurl'], $layoutData['image'], true, false, $layoutData['border_color']) . '</div>'; "", 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;">'. $img = '<div style="float:left;height:'.$himg.'px;">'.
hbar_graph($module_data, hbar_graph($module_data,
$width, $height, $color, array(), array(), $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, "", "", $water_mark, $config['fontpath'], 6,
"", 0, $config['homeurl'], $layoutData['image'], $layoutData['border_color']) . '</div>'; "", 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;">'. $img = '<div style="float:left;height:'.$himg.'px;">'.
vbar_graph($module_data, vbar_graph($module_data,
$width, $height, $color, array(), array(), $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, "", "", $water_mark, $config['fontpath'], 6,
"", 0, $config['homeurl'], $layoutData['image'], true, false, $layoutData['border_color']) . '</div>'; "", 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') { if ($layoutData['type_graph'] == 'horizontal') {
$img = hbar_graph($module_data, $img = hbar_graph($module_data,
$width, $height, $color, array(), array(), $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, "", "", $water_mark, $config['fontpath'], 6,
"", 0, $config['homeurl'], $layoutData['image'], $layoutData['border_color']); "", 0, $config['homeurl'], $layoutData['image'], $layoutData['border_color']);
} }
else { else {
$img = vbar_graph($module_data, $img = vbar_graph($module_data,
$width, $height, $color, array(), array(), $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, "", "", $water_mark, $config['fontpath'], 6,
"", 0, $config['homeurl'], $layoutData['image'], true, false, $layoutData['border_color']); "", 0, $config['homeurl'], $layoutData['image'], true, false, $layoutData['border_color']);
} }
@ -1633,78 +1633,11 @@ function visual_map_print_item($mode = "read", $layoutData,
break; break;
case STATIC_GRAPH: case STATIC_GRAPH:
case GROUP_ITEM: 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) { if (($layoutData['image'] != null && $layoutData['image'] != 'none') || $layoutData['show_statistics'] == 1) {
$img_style_title = strip_tags($label); $img_style_title = strip_tags($label);
if ($layoutData['type'] == STATIC_GRAPH) { if ($layoutData['type'] == STATIC_GRAPH) {
if ($layoutData['id_agente_modulo'] != 0) { if ($layoutData['id_agente_modulo'] != 0) {
if ($layoutData['id_metaconsole'] != 0) { if ($layoutData['id_metaconsole'] != 0) {
//Metaconsole db connection //Metaconsole db connection
$connection = db_get_row_filter ('tmetaconsole_setup', $connection = db_get_row_filter ('tmetaconsole_setup',
@ -1780,68 +1713,71 @@ function visual_map_print_item($mode = "read", $layoutData,
else if($layoutData['label_position']=='right'){ else if($layoutData['label_position']=='right'){
$imgpos = 'float:left'; $imgpos = 'float:left';
} }
$varsize = getimagesize($config['homedir'] . '/' . $img); $varsize = getimagesize($config['homedir'] . '/' . $img);
if($layoutData['show_statistics'] == 1) {
if($layoutData['show_statistics'] == 1){
if (get_parameter('action') == 'edit') { if (get_parameter('action') == 'edit') {
if ($width == 0 || $height == 0) { 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{ 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{ else{
$agents_critical = agents_get_agents(
$agents_critical = agents_get_agents(array ( array (
'disabled' => 0, 'disabled' => 0,
'id_grupo' => $layoutData['id_group'], 'id_grupo' => $layoutData['id_group'],
'status' => AGENT_STATUS_CRITICAL), 'status' => AGENT_STATUS_CRITICAL
array ('COUNT(*) as total'), 'AR', false); ),
array ('COUNT(*) as total'),
$agents_warning = agents_get_agents(array ( 'AR',
false
);
$agents_warning = agents_get_agents(
array (
'disabled' => 0, 'disabled' => 0,
'id_grupo' => $layoutData['id_group'], 'id_grupo' => $layoutData['id_group'],
'status' => AGENT_STATUS_WARNING), 'status' => AGENT_STATUS_WARNING
array ('COUNT(*) as total'), 'AR', false); ),
array ('COUNT(*) as total'),
$agents_unknown = agents_get_agents(array ( 'AR',
false
);
$agents_unknown = agents_get_agents(
array (
'disabled' => 0, 'disabled' => 0,
'id_grupo' => $layoutData['id_group'], 'id_grupo' => $layoutData['id_group'],
'status' => AGENT_STATUS_UNKNOWN), 'status' => AGENT_STATUS_UNKNOWN
array ('COUNT(*) as total'), 'AR', false); ),
array ('COUNT(*) as total'),
$agents_ok = agents_get_agents(array ( 'AR',
false
);
$agents_ok = agents_get_agents(
array (
'disabled' => 0, 'disabled' => 0,
'id_grupo' => $layoutData['id_group'], 'id_grupo' => $layoutData['id_group'],
'status' => AGENT_STATUS_OK), 'status' => AGENT_STATUS_OK
array ('COUNT(*) as total'), 'AR', false); ),
array ('COUNT(*) as total'),
'AR',
false
);
$total_agents = $agents_critical[0]['total'] + $agents_warning[0]['total'] + $agents_unknown[0]['total'] + $agents_ok[0]['total']; $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_ok = $agents_ok[0]['total']/$total_agents*100;
$stat_agent_wa = $agents_warning[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_cr = $agents_critical[0]['total']/$total_agents*100;
$stat_agent_un = $agents_unknown[0]['total']/$total_agents*100; $stat_agent_un = $agents_unknown[0]['total']/$total_agents*100;
if($width == 0 || $height == 0){ if($width == 0 || $height == 0){
$dyn_width = 520; $dyn_width = 520;
$dyn_height = 80; $dyn_height = 80;
} } else {
else{
$dyn_width = $width; $dyn_width = $width;
$dyn_height = $height; $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;'; 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'){ if($layoutData['label_position'] == 'left'){
echo "float:right;"; echo "float:right;";
} }
@ -1850,10 +1786,8 @@ function visual_map_print_item($mode = "read", $layoutData,
} }
echo '">'; echo '">';
echo "<tr style='height:10%;'>"; 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 "<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>";
echo "<tr style='background-color:whitesmoke;height:90%;'>"; echo "<tr style='background-color:whitesmoke;height:90%;'>";
echo "<td>"; echo "<td>";
@ -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='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='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 "<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 "</td>";
echo "</tr>"; echo "</tr>";
echo "</table>"; echo "</table>";
} }
} else {
} $options = array(
else{ "class" => "image",
"id" => "image_" . $id,
"title" => $img_style_title,
"style" => $borderStyle.$imgpos
);
if ($width == 0 || $height == 0) { if ($width == 0 || $height == 0) {
if($varsize[0] > 150 || $varsize[1] > 150){ if($varsize[0] > 150 || $varsize[1] > 150){
echo html_print_image($img, true, $options['width'] = "70px";
array("class" => "image", $options['height'] = "70px";
"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);
} }
} }
else{ else{
echo html_print_image($img, true, $options['width'] = $width;
array("class" => "image", $options['height'] = $height;
"id" => "image_" . $id, }
"width" => $width, echo html_print_image($img, true, $options,
"height" => $height, false, false, false, $isExternalLink);
"title" => $img_style_title, }
"style" => $borderStyle.$imgpos), false,
false, false, $isExternalLink);
} }
} if ($layoutData['label_position'] != 'up') {
}
if($layoutData['label_position']=='down'){
echo io_safe_output($text);
}
else if($layoutData['label_position']=='left' || $layoutData['label_position']=='right'){
echo io_safe_output($text); echo io_safe_output($text);
} }
if (! defined ('METACONSOLE')) { if (is_metaconsole()) metaconsole_restore_db();
}
else {
metaconsole_restore_db();
}
break; break;
case PERCENTILE_BAR: case PERCENTILE_BAR:
if (($layoutData['image'] == 'value') && ($value_text !== false)) { if (($layoutData['image'] == 'value') && ($value_text !== false)) {
$unit_text = db_get_sql ('SELECT unit $unit_text = db_get_sql ('SELECT unit
@ -1963,6 +1867,7 @@ function visual_map_print_item($mode = "read", $layoutData,
} }
echo $img; echo $img;
echo io_safe_output($text);
break; break;
case PERCENTILE_BUBBLE: case PERCENTILE_BUBBLE:
@ -2006,6 +1911,7 @@ function visual_map_print_item($mode = "read", $layoutData,
} }
echo $img; echo $img;
echo io_safe_output($text);
break; break;
case CIRCULAR_PROGRESS_BAR: case CIRCULAR_PROGRESS_BAR:
@ -2049,6 +1955,7 @@ function visual_map_print_item($mode = "read", $layoutData,
} }
echo $img; echo $img;
echo io_safe_output($text);
break; break;
case CIRCULAR_INTERIOR_PROGRESS_BAR: case CIRCULAR_INTERIOR_PROGRESS_BAR:
@ -2093,6 +2000,7 @@ function visual_map_print_item($mode = "read", $layoutData,
} }
echo $img; echo $img;
echo io_safe_output($text);
break; break;
case MODULE_GRAPH: case MODULE_GRAPH:
@ -2284,9 +2192,7 @@ function visual_map_print_item($mode = "read", $layoutData,
array('id' => $layoutData['parent_item'])); array('id' => $layoutData['parent_item']));
echo '<script type="text/javascript">'; echo '<script type="text/javascript">';
echo '$(document).ready (function() { 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"]) . '"});';
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>'; echo '</script>';
} }
} }
@ -2306,19 +2212,35 @@ function get_if_module_is_image ($id_module) {
} }
function get_bars_module_data ($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.
$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)) { if (preg_match("/\r\n/", $mod_values)) {
$values = explode("\r\n", $mod_values); $values = explode("\r\n", $mod_values);
} }
elseif (preg_match("/\n/", $mod_values)) { elseif (preg_match("/\n/", $mod_values)) {
$values = explode("\n", $mod_values); $values = explode("\n", $mod_values);
} }
}
$values_to_return = array(); $values_to_return = array();
$index = 0; $index = 0;
$color_index = 0; $color_index = 0;
$total = 0; $total = 0;
if(!$values) return false;
foreach ($values as $val) { foreach ($values as $val) {
$data = explode(",", $val); $data = explode(",", $val);
$values_to_return[$data[0]] = array('g' =>$data[1]); $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 '<script type="text/javascript">';
echo '$(document).ready (function() { echo 'user_lines.push(' . json_encode($line) . ');';
user_lines.push(' . json_encode($line) . ');
});';
echo '</script>'; echo '</script>';
} }

View File

@ -586,7 +586,7 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) {
$form_items['show_on_top_row']['html'] = $form_items['show_on_top_row']['html'] =
'<td align="left" style="">' . __('Always show on top') . '</td> '<td align="left" style="">' . __('Always show on top') . '</td>
<td align="left" style="">' . <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')); $show_last_value = array('0' => __('Hide last value on boolean modules'), '1' => __('Enabled'), '2' => __('Disabled'));
$form_items['show_last_value_row'] = array(); $form_items['show_last_value_row'] = array();

View File

@ -27,9 +27,9 @@ check_login ();
$auth_method = db_get_value('value', 'tconfig', 'token', 'auth'); $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"); 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;"; $styleError = "background:url(\"../images/err.png\") no-repeat scroll 0 0 transparent; padding:4px 1px 6px 30px; color:#CC0000;";

View File

@ -141,7 +141,17 @@ function vbar_graph(
setup_watermark($water_mark, $water_mark_file, $water_mark_url); setup_watermark($water_mark, $water_mark_file, $water_mark_url);
if (empty($chart_data)) { 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){ if($ttl == 2){
@ -271,7 +281,17 @@ function hbar_graph($chart_data, $width, $height,
setup_watermark($water_mark, $water_mark_file, $water_mark_url); setup_watermark($water_mark, $water_mark_file, $water_mark_url);
if (empty($chart_data)) { 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){ if($ttl == 2){

View File

@ -204,7 +204,7 @@
$form $form
.prop('method', 'POST') .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) .append($dataInput, $typeInput, $separatorInput, $excelInput)
.hide() .hide()
// Firefox made me write into the DOM for this :( // Firefox made me write into the DOM for this :(
@ -394,7 +394,7 @@
$form $form
.prop('method', 'POST') .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) .append($dataInput, $typeInput, $separatorInput, $excelInput)
.hide() .hide()
// Firefox made me write into the DOM for this :( // Firefox made me write into the DOM for this :(

View File

@ -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, 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); values = values.split(separator2);
labels = labels.split(separator); labels = labels.split(separator);
@ -728,6 +728,7 @@ function pandoraFlotSlicebar(graph_id, values, datacolor, labels, legend, acumul
tickColor: '#fff' tickColor: '#fff'
}, },
xaxes: [ { xaxes: [ {
show:show_date,
tickFormatter: xFormatter, tickFormatter: xFormatter,
color: '', color: '',
tickSize: intervaltick, 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['max'] = ranges.yaxis.to;
max_draw['min'] = ranges.yaxis.from; max_draw['min'] = ranges.yaxis.from;
@ -2330,7 +2331,7 @@ function pandoraFlotArea( graph_id, values, legend,
legend: { show: true } legend: { show: true }
})); }));
$('#menu_cancelzoom_' + graph_id) $('#menu_cancelzoom_' + graph_id)
.attr('src', homeurl + '/images/zoom_cross.disabled.png'); .attr('src', homeurl + 'images/zoom_cross.disabled.png');
overview.clearSelection(); overview.clearSelection();
currentRanges = null; currentRanges = null;
thresholded = false; thresholded = false;

View File

@ -691,7 +691,7 @@ function flot_slicesbar_graph (
$adapt_key = '', $stat_win = false, $adapt_key = '', $stat_win = false,
$id_agent = 0, $full_legend_date = array(), $id_agent = 0, $full_legend_date = array(),
$not_interactive = 0, $ttl = 1, $not_interactive = 0, $ttl = 1,
$widgets = false) { $widgets = false, $show = true) {
global $config; global $config;
@ -839,7 +839,7 @@ function flot_slicesbar_graph (
// Javascript code // Javascript code
$return .= "<script type='text/javascript'>"; $return .= "<script type='text/javascript'>";
$return .= "//<![CDATA[\n"; $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 .= "\n//]]>";
$return .= "</script>"; $return .= "</script>";

View File

@ -3,6 +3,7 @@ div.olMap {
padding: 0px!important; padding: 0px!important;
margin: 0px!important; margin: 0px!important;
cursor: default; cursor: default;
position: relative !important;
} }
div.olMapViewport { div.olMapViewport {

View File

@ -1384,7 +1384,7 @@ table.databox {
border: 0px none #E2E2E2; 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; padding: 9px 7px;
font-weight: normal; font-weight: normal;
color: #fff; color: #fff;

View File

@ -4,8 +4,6 @@ if (system.args.length < 3 || system.args.length > 11) {
phantom.exit(1); phantom.exit(1);
} }
var webPage = require('webpage');
var page = webPage.create();
var url = system.args[1]; var url = system.args[1];
var type_graph_pdf = system.args[2]; var type_graph_pdf = system.args[2];
var url_params = system.args[3]; var url_params = system.args[3];
@ -39,26 +37,32 @@ else{
"&session_id=" + session_id; "&session_id=" + session_id;
} }
var page = require('webpage').create();
page.viewportSize = { page.viewportSize = {
width: viewport_width, width: viewport_width,
height: viewport_height height: viewport_height
}; };
page.zoomFactor = 1; page.zoomFactor = 1;
page.open(url, 'POST', post_data, function start(status) {
}); page.onCallback = function (st){
page.onLoadFinished = function (status) {
if(!base_64){ if(!base_64){
page.render(output_filename, {format: 'png'}); page.render(output_filename, {format: 'png'});
} } else{
else{
var base64 = page.renderBase64('png'); var base64 = page.renderBase64('png');
//XXXX // do not remove this console.output
console.log(base64); console.log(base64);
} }
phantom.exit(); phantom.exit();
}
};
page.open(url, 'POST', post_data, function (status) {
});

View File

@ -120,6 +120,7 @@ if (isset($config["error"])) {
// If metaconsole activated, redirect to it // If metaconsole activated, redirect to it
if ($config['metaconsole'] == 1 && $config['enterprise_installed'] == 1) { if ($config['metaconsole'] == 1 && $config['enterprise_installed'] == 1) {
header ("Location: " . $config['homeurl'] . "enterprise/meta"); header ("Location: " . $config['homeurl'] . "enterprise/meta");
exit; //Always exit after sending location headers
} }
if (file_exists (ENTERPRISE_DIR . "/include/functions_login.php")) { 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); $redirect_url .= '&'.safe_url_extraclean($key).'='.safe_url_extraclean($value);
} }
header("Location: ".$config['homeurl']."index.php".$redirect_url); header("Location: ".$config['homeurl']."index.php".$redirect_url);
exit; //Always exit after sending location headers
} }
// Hash login process // Hash login process
elseif (isset ($_GET["loginhash"])) { elseif (isset ($_GET["loginhash"])) {

View File

@ -71,7 +71,7 @@
<div style='height: 10px'> <div style='height: 10px'>
<?php <?php
$version = '7.0NG.729'; $version = '7.0NG.729';
$build = '181127'; $build = '181203';
$banner = "v$version Build $build"; $banner = "v$version Build $build";
error_reporting(0); error_reporting(0);

View File

@ -336,6 +336,16 @@ if (is_ajax ()) {
$filter .= ' AND t1.id_agente_modulo IN (SELECT id_agente_modulo FROM tagente_estado where ' . $sql_conditions; $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()) { if (is_metaconsole()) {
$result = array(); $result = array();
$nameModules = array(); $nameModules = array();
@ -396,9 +406,10 @@ if (is_ajax ()) {
} }
//Get agent's modules //Get agent's modules
$sql = sprintf('SELECT t1.id_agente, t1.id_agente_modulo, t1.nombre $sql = sprintf(
FROM tagente_modulo t1 'SELECT t1.id_agente, t1.id_agente_modulo, t1.nombre
WHERE %s FROM tagente_modulo t1 %s
WHERE %s %s
AND t1.delete_pending = 0 AND t1.delete_pending = 0
AND t1.id_agente IN (%s) AND t1.id_agente IN (%s)
AND ( AND (
@ -407,7 +418,7 @@ if (is_ajax ()) {
WHERE t2.delete_pending = 0 WHERE t2.delete_pending = 0
AND t1.nombre = t2.nombre AND t1.nombre = t2.nombre
AND t2.id_agente IN (%s)) = (%d)', 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)); implode(',', $id_agents), count($id_agents));
$modules = db_get_all_rows_sql($sql); $modules = db_get_all_rows_sql($sql);
@ -458,34 +469,27 @@ if (is_ajax ()) {
} }
else { else {
if($idAgents[0] < 0){ if($idAgents[0] < 0){
if($selection_mode == 'common'){ if($selection_mode == 'common') {
$sql_agent_total = 'SELECT count(*) FROM tagente WHERE disabled=0'; $sql_agent_total = 'SELECT count(*) FROM tagente WHERE disabled=0';
$agent_total = db_get_value_sql($sql_agent_total); $agent_total = db_get_value_sql($sql_agent_total);
$sql = "SELECT tam.nombre, tam.id_agente_modulo $sql = sprintf ("SELECT t1.nombre, t1.id_agente_modulo FROM tagente_modulo t1
FROM tagente_modulo tam JOIN (SELECT COUNT(*) AS num_names, nombre FROM tagente_modulo
JOIN ( WHERE disabled=0 AND delete_pending=0 GROUP BY nombre) AS tj
SELECT COUNT(*) AS num_names, nombre ON tj.num_names = $agent_total AND tj.nombre = t1.nombre %s %s",
FROM tagente_modulo $sql_tags_join, (empty($where_tags)) ? "" : " WHERE 1=1 $where_tags");
WHERE disabled=0 } else {
AND delete_pending=0 $sql = sprintf('SELECT t1.nombre, t1.id_agente_modulo FROM tagente_modulo t1 %s %s',
GROUP BY nombre $sql_tags_join, (empty($where_tags)) ? "" : " WHERE 1=1 $where_tags");
) AS tj
ON tj.num_names = $agent_total
AND tj.nombre = tam.nombre ";
}
else{
$sql = 'SELECT nombre, id_agente_modulo
FROM tagente_modulo';
} }
} }
else { else {
$sql = 'SELECT DISTINCT nombre, t1.id_agente_modulo $sql = sprintf (
FROM tagente_modulo t1, tagente_estado t2 'SELECT DISTINCT t1.nombre, t1.id_agente_modulo FROM tagente_modulo t1
WHERE t1.id_agente_modulo = t2.id_agente_modulo AND INNER JOIN tagente_estado t2 ON t1.id_agente_modulo = t2.id_agente_modulo
' . $filter . ' %s WHERE %s AND t1.delete_pending = 0
AND t1.delete_pending = 0 AND t1.id_agente IN ('. implode(',', $idAgents) .')
AND t1.id_agente IN (' . implode(',', $idAgents) . ') %s %s',
AND t2.datos NOT LIKE "%image%"'; $sql_tags_join, $filter, ' AND t2.datos NOT LIKE "%image%"', $where_tags);
if ($selection_mode == 'common') { if ($selection_mode == 'common') {
$sql .= ' AND ( $sql .= ' AND (

View File

@ -78,10 +78,13 @@ if ($group_rep == 2) {
$table->head[1] = __('Agent'); $table->head[1] = __('Agent');
$table->head[5] = __('More detail'); $table->head[5] = __('More detail');
$url = html_print_sort_arrows( //$url = html_print_sort_arrows(
array_merge($params, array('sort_field' => 'status')), // array_merge($params, array('sort_field' => 'status')),
'sort' // 'sort'
); //);
$params_sort_field_status = array_merge($params, array('sort_field' => 'status'));
$url = "index.php?" . http_build_query($params_sort_field_status, '', '&amp;');
foreach ($result as $key => $res) { foreach ($result as $key => $res) {
@ -164,14 +167,6 @@ else {
$table->align[$i] = 'left'; $table->align[$i] = 'left';
$i++; $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') { if ($fields == 'id_evento') {
$table->head[$i] = __('Event ID') . html_print_sort_arrows( $table->head[$i] = __('Event ID') . html_print_sort_arrows(
array_merge($params, array('sort_field' => 'event_id')), array_merge($params, array('sort_field' => 'event_id')),
@ -341,6 +336,18 @@ else {
$i++; $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) { if ($i != 0 && $allow_action) {
$table->head[$i] = __('Action'); $table->head[$i] = __('Action');
$table->align[$i] = 'left'; $table->align[$i] = 'left';
@ -491,14 +498,6 @@ else {
$table->cellclass[count($table->data)][$i] = $myclass; $table->cellclass[count($table->data)][$i] = $myclass;
$i++; $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') { if ($fields == 'id_evento') {
$data[$i] = $event["id_evento"]; $data[$i] = $event["id_evento"];
$table->cellclass[count($table->data)][$i] = $myclass; $table->cellclass[count($table->data)][$i] = $myclass;
@ -778,6 +777,15 @@ else {
} }
} }
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) { if ($i != 0 && $allow_action) {
//Actions //Actions
$data[$i] = '<a href="javascript:" onclick="show_event_dialog(' . $event["id_evento"] . ', '.$group_rep.');">'; $data[$i] = '<a href="javascript:" onclick="show_event_dialog(' . $event["id_evento"] . ', '.$group_rep.');">';

View File

@ -491,7 +491,7 @@ $data[0] .= $table_ichanges;
//time autorefresh //time autorefresh
$times = get_refresh_time_array(); $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>'; $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[] = ''; $table->rowclass[] = '';

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_console %define name pandorafms_console
%define version 7.0NG.729 %define version 7.0NG.729
%define release 181127 %define release 181203
# User and Group under which Apache is running # User and Group under which Apache is running
%define httpd_name httpd %define httpd_name httpd

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_console %define name pandorafms_console
%define version 7.0NG.729 %define version 7.0NG.729
%define release 181127 %define release 181203
%define httpd_name httpd %define httpd_name httpd
# User and Group under which Apache is running # User and Group under which Apache is running
%define httpd_name apache2 %define httpd_name apache2

View File

@ -1,5 +1,5 @@
package: pandorafms-server package: pandorafms-server
Version: 7.0NG.729-181127 Version: 7.0NG.729-181203
Architecture: all Architecture: all
Priority: optional Priority: optional
Section: admin Section: admin

View File

@ -14,7 +14,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details. # GNU General Public License for more details.
pandora_version="7.0NG.729-181127" pandora_version="7.0NG.729-181203"
package_cpan=0 package_cpan=0
package_pandora=1 package_pandora=1

View File

@ -45,7 +45,7 @@ our @EXPORT = qw(
# version: Defines actual version of Pandora Server for this module only # version: Defines actual version of Pandora Server for this module only
my $pandora_version = "7.0NG.729"; my $pandora_version = "7.0NG.729";
my $pandora_build = "181127"; my $pandora_build = "181203";
our $VERSION = $pandora_version." ".$pandora_build; our $VERSION = $pandora_version." ".$pandora_build;
# Setup hash # Setup hash

View File

@ -4580,7 +4580,7 @@ Process groups statistics for statistics table
########################################################################## ##########################################################################
sub pandora_process_event_replication ($) { sub pandora_process_event_replication ($) {
my $pa_config = shift; my $pa_config = shift;
my $dbh_metaconsole;
my %pa_config = %{$pa_config}; my %pa_config = %{$pa_config};
# Get the console DB connection # Get the console DB connection
@ -4594,20 +4594,28 @@ sub pandora_process_event_replication ($) {
# desactivated the event replication or the replication # desactivated the event replication or the replication
# interval is wrong: abort # interval is wrong: abort
if($is_event_replication_enabled == 0) { if($is_event_replication_enabled == 0) {
db_disconnect($dbh);
return; return;
} }
if($replication_interval <= 0) { 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; return;
} }
# Get the metaconsole DB connection logger($pa_config, "Started event replication thread.", 1);
my $dbh_metaconsole = enterprise_hook('get_metaconsole_dbh', [$pa_config, $dbh]);
if($dbh_metaconsole eq '') { while($THRRUN == 1) {
logger($pa_config, "Metaconsole DB connection error. Event replication thread will be aborted.", 1); eval {{
return; 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 # Get server id on metaconsole
@ -4615,14 +4623,13 @@ sub pandora_process_event_replication ($) {
# If the server name is not found in metaconsole setup: abort # If the server name is not found in metaconsole setup: abort
if($metaconsole_server_id == -1) { if($metaconsole_server_id == -1) {
logger($pa_config, "The server name is not configured in metaconsole. Event replication thread will be aborted.", 1); logger($pa_config, "The server name is not configured in metaconsole. Event replication postponed.", 5);
return; db_disconnect($dbh_metaconsole);
next;
} }
my $replication_mode = enterprise_hook('get_event_replication_mode', [$dbh]); my $replication_mode = enterprise_hook('get_event_replication_mode', [$dbh]);
logger($pa_config, "Starting replication events process.", 1);
while($THRRUN == 1) { while($THRRUN == 1) {
# If we are not the master server sleep and check again. # If we are not the master server sleep and check again.
@ -4632,8 +4639,12 @@ sub pandora_process_event_replication ($) {
} }
# Check the queue each N seconds # Check the queue each N seconds
sleep ($replication_interval);
enterprise_hook('pandora_replicate_copy_events',[$pa_config, $dbh, $dbh_metaconsole, $metaconsole_server_id, $replication_mode]); 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);
} }
db_disconnect($dbh); db_disconnect($dbh);

View File

@ -32,7 +32,7 @@ our @ISA = qw(Exporter);
# version: Defines actual version of Pandora Server for this module only # version: Defines actual version of Pandora Server for this module only
my $pandora_version = "7.0NG.729"; my $pandora_version = "7.0NG.729";
my $pandora_build = "181127"; my $pandora_build = "181203";
our $VERSION = $pandora_version." ".$pandora_build; our $VERSION = $pandora_version." ".$pandora_build;
our %EXPORT_TAGS = ( 'all' => [ qw() ] ); our %EXPORT_TAGS = ( 'all' => [ qw() ] );

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_server %define name pandorafms_server
%define version 7.0NG.729 %define version 7.0NG.729
%define release 181127 %define release 181203
Summary: Pandora FMS Server Summary: Pandora FMS Server
Name: %{name} Name: %{name}

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_server %define name pandorafms_server
%define version 7.0NG.729 %define version 7.0NG.729
%define release 181127 %define release 181203
Summary: Pandora FMS Server Summary: Pandora FMS Server
Name: %{name} Name: %{name}

View File

@ -9,7 +9,7 @@
# ********************************************************************** # **********************************************************************
PI_VERSION="7.0NG.729" PI_VERSION="7.0NG.729"
PI_BUILD="181127" PI_BUILD="181203"
MODE=$1 MODE=$1
if [ $# -gt 1 ]; then if [ $# -gt 1 ]; then

View File

@ -34,7 +34,7 @@ use PandoraFMS::Config;
use PandoraFMS::DB; use PandoraFMS::DB;
# version: define current version # version: define current version
my $version = "7.0NG.729 PS181127"; my $version = "7.0NG.729 PS181203";
# Pandora server configuration # Pandora server configuration
my %conf; my %conf;

View File

@ -36,7 +36,7 @@ use Encode::Locale;
Encode::Locale::decode_argv; Encode::Locale::decode_argv;
# version: define current version # version: define current version
my $version = "7.0NG.729 PS181127"; my $version = "7.0NG.729 PS181203";
# save program name for logging # save program name for logging
my $progname = basename($0); my $progname = basename($0);