Merge branch 'develop' into feature/new_networkmap
Conflicts: pandora_console/include/functions_modules.php
This commit is contained in:
commit
30f806f41c
|
@ -1,5 +1,7 @@
|
|||
<a href="http://pandorafms.com"><img src="http://pandorafms.com/github/logo_2.png" align="left" hspace="10" vspace="6"></a>Pandora FMS is a monitoring software for IT infrastructure management which includes network equipment, Windows and Unix servers, virtual infrastructure and all different kind of applications. It has a large amount of features, making it a new generation software which discovers all the monitoring issues that an organization may need.
|
||||
<br />
|
||||
For community support you can visit our forums at http://forums.pandorafms.org. Visit our community page at http://pandorafms.org and if you need commercial information or/and professional support visit http://pandorafms.com.
|
||||
<br />
|
||||
<br />
|
||||
###How to install Pandora FMS
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ RUN mkdir /docker-entrypoint-initdb.d
|
|||
# File::Copy
|
||||
# Sys::Hostname
|
||||
# Data::Dumper
|
||||
RUN apt-get update && apt-get install -y perl pwgen git --no-install-recommends && rm -rf /var/lib/apt/lists/*
|
||||
RUN apt-get update && apt-get install -y perl pwgen git openssh-client --no-install-recommends && rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# gpg: key 5072E1F5: public key "MySQL Release Engineering <mysql-build@oss.oracle.com>" imported
|
||||
RUN apt-key adv --keyserver ha.pool.sks-keyservers.net --recv-keys A4A9406876FCBD3C456770C88C718D3B5072E1F5
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
package: pandorafms-agent-unix
|
||||
Version: 6.1dev-160329
|
||||
Version: 6.1dev-160420
|
||||
Architecture: all
|
||||
Priority: optional
|
||||
Section: admin
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
pandora_version="6.1dev-160329"
|
||||
pandora_version="6.1dev-160420"
|
||||
|
||||
echo "Test if you has the tools for to make the packages."
|
||||
whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null
|
||||
|
|
|
@ -41,7 +41,7 @@ my $Sem = undef;
|
|||
my $ThreadSem = undef;
|
||||
|
||||
use constant AGENT_VERSION => '6.1dev';
|
||||
use constant AGENT_BUILD => '160329';
|
||||
use constant AGENT_BUILD => '160420';
|
||||
|
||||
# Commands to retrieve total memory information in kB
|
||||
use constant TOTALMEMORY_CMDS => {
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#
|
||||
%define name pandorafms_agent_unix
|
||||
%define version 6.1dev
|
||||
%define release 160329
|
||||
%define release 160420
|
||||
|
||||
Summary: Pandora FMS Linux agent, PERL version
|
||||
Name: %{name}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#
|
||||
%define name pandorafms_agent_unix
|
||||
%define version 6.1dev
|
||||
%define release 160329
|
||||
%define release 160420
|
||||
|
||||
Summary: Pandora FMS Linux agent, PERL version
|
||||
Name: %{name}
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
# **********************************************************************
|
||||
|
||||
PI_VERSION="6.1dev"
|
||||
PI_BUILD="160329"
|
||||
PI_BUILD="160420"
|
||||
OS_NAME=`uname -s`
|
||||
|
||||
FORCE=0
|
||||
|
|
|
@ -186,7 +186,7 @@ UpgradeApplicationID
|
|||
{}
|
||||
|
||||
Version
|
||||
{160329}
|
||||
{160420}
|
||||
|
||||
ViewReadme
|
||||
{Yes}
|
||||
|
|
|
@ -30,7 +30,7 @@ using namespace Pandora;
|
|||
using namespace Pandora_Strutils;
|
||||
|
||||
#define PATH_SIZE _MAX_PATH+1
|
||||
#define PANDORA_VERSION ("6.1dev(Build 160329)")
|
||||
#define PANDORA_VERSION ("6.1dev(Build 160420)")
|
||||
|
||||
string pandora_path;
|
||||
string pandora_dir;
|
||||
|
|
|
@ -11,7 +11,7 @@ BEGIN
|
|||
VALUE "LegalCopyright", "Artica ST"
|
||||
VALUE "OriginalFilename", "PandoraAgent.exe"
|
||||
VALUE "ProductName", "Pandora FMS Windows Agent"
|
||||
VALUE "ProductVersion", "(6.1dev(Build 160329))"
|
||||
VALUE "ProductVersion", "(6.1dev(Build 160420))"
|
||||
VALUE "FileVersion", "1.0.0.0"
|
||||
END
|
||||
END
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
package: pandorafms-console
|
||||
Version: 6.1dev-160329
|
||||
Version: 6.1dev-160420
|
||||
Architecture: all
|
||||
Priority: optional
|
||||
Section: admin
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
pandora_version="6.1dev-160329"
|
||||
pandora_version="6.1dev-160420"
|
||||
|
||||
package_pear=0
|
||||
package_pandora=1
|
||||
|
|
|
@ -9,3 +9,28 @@ ALTER TABLE talert_templates ADD COLUMN `min_alerts_reset_counter` tinyint(1) DE
|
|||
-- ----------------------------------------------------------------------
|
||||
|
||||
ALTER TABLE tserver ADD COLUMN `server_keepalive` int(11) DEFAULT 0;
|
||||
|
||||
-- ----------------------------------------------------------------------
|
||||
-- Table `tagente_estado`
|
||||
-- ----------------------------------------------------------------------
|
||||
|
||||
ALTER TABLE tagente_estado MODIFY `status_changes` tinyint(4) unsigned default 0;
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Table `talert_actions`
|
||||
-- ---------------------------------------------------------------------
|
||||
UPDATE talert_actions SET `field4` = 'integria',
|
||||
`field5` = '_agent_: _alert_name_',
|
||||
`field6` = '1',
|
||||
`field7` = '3',
|
||||
`field8` = 'copy@dom.com',
|
||||
`field9` = 'admin',
|
||||
`field10` = '_alert_description_'
|
||||
WHERE `id` = 4 AND `id_alert_command` = 11;
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Table `talert_commands`
|
||||
-- ---------------------------------------------------------------------
|
||||
UPDATE `talert_commands` SET `fields_descriptions` = '[\"Integria IMS API path\",\"Integria IMS API pass\",\"Integria IMS user\",\"Integria IMS user pass\",\"Ticket title\",\"Ticket group ID\",\"Ticket priority\",\"Email copy\",\"Ticket owner\",\"Ticket description\"]', `fields_values` = '[\"\",\"\",\"\",\"\",\"\",\"\",\"10,Maintenance;0,Informative;1,Low;2,Medium;3,Serious;4,Very Serious\",\"\",\"\",\"\"]' WHERE `id` = 11 AND `name` = 'Integria IMS Ticket';
|
||||
|
||||
|
||||
|
|
|
@ -9,3 +9,20 @@ ALTER TABLE talert_templates ADD COLUMN min_alerts_reset_counter NUMBER(5, 0) DE
|
|||
-- ----------------------------------------------------------------------
|
||||
|
||||
ALTER TABLE tserver ADD COLUMN server_keepalive NUMBER(10, 0) DEFAULT 0;
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Table `talert_actions`
|
||||
-- ---------------------------------------------------------------------
|
||||
UPDATE talert_actions SET field4 = 'integria',
|
||||
field5 = '_agent_: _alert_name_',
|
||||
field6 = '1',
|
||||
field7 = '3',
|
||||
field8 = 'copy@dom.com',
|
||||
field9 = 'admin',
|
||||
field10 = '_alert_description_'
|
||||
WHERE id = 4 AND id_alert_command = 11;
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Table `talert_commands`
|
||||
-- ---------------------------------------------------------------------
|
||||
UPDATE talert_commands SET fields_descriptions = '[\"Integria IMS API path\",\"Integria IMS API pass\",\"Integria IMS user\",\"Integria IMS user pass\",\"Ticket title\",\"Ticket group ID\",\"Ticket priority\",\"Email copy\",\"Ticket owner\",\"Ticket description\"]', fields_values = '[\"\",\"\",\"\",\"\",\"\",\"\",\"10,Maintenance;0,Informative;1,Low;2,Medium;3,Serious;4,Very Serious\",\"\",\"\",\"\"]' WHERE id = 11 AND name = 'Integria IMS Ticket';
|
||||
|
|
|
@ -602,7 +602,14 @@ switch ($action) {
|
|||
|
||||
$data[1] = $report['description'];
|
||||
|
||||
if (!$report['non_interactive']) {
|
||||
//Remove html and xml button if items are larger than limit
|
||||
$item_count = db_get_num_rows ('SELECT * FROM treport_content WHERE id_report=' . $report['id_report']);
|
||||
$report['overload'] = $item_count >= $config['report_limit'];
|
||||
if ($report['overload']) {
|
||||
$data[2] = html_print_image("images/application_not_writable.png", true, array('title' => __('This report exceeds the item limit for realtime operations')));
|
||||
$data[3] = null;
|
||||
}
|
||||
else if (!$report['non_interactive']) {
|
||||
$data[2] = '<a href="' . $config['homeurl'] . 'index.php?sec=reporting&sec2=operation/reporting/reporting_viewer&id='.$report['id_report'].'&pure='.$pure.'">' .
|
||||
html_print_image("images/html.png", true, array('title' => __('HTML view'))) . '</a>';
|
||||
$data[3] = '<a href="'. ui_get_full_url(false, false, false, false) . 'ajax.php?page=' . $config['homedir'] . '/operation/reporting/reporting_xml&id='.$report['id_report'].'">' . html_print_image("images/xml.png", true, array('title' => __('Export to XML'))) . '</a>'; //I chose ajax.php because it's supposed to give XML anyway
|
||||
|
|
|
@ -77,8 +77,12 @@ $table_other->style[0] = "font-weight: bold";
|
|||
$table_other->size[0] = '70%';
|
||||
$table_other->size[1] = '30%';
|
||||
|
||||
$table_other->data[1][0] = __('Compact interpolation in hours (1 Fine-20 bad)') . ui_print_help_tip(__('Data will be compacted in intervals of the specified length.'), true);
|
||||
$table_other->data[1][1] = html_print_input_text ('step_compact',
|
||||
$table_other->data[1][0] = __('Item limit for realtime reports') . ui_print_help_tip(__('Set a value too high cause a slowdown on console and a performance penalty in the system.'), true);
|
||||
$table_other->data[1][1] = html_print_input_text ('report_limit',
|
||||
$config["report_limit"], '', 5, 5, true);
|
||||
|
||||
$table_other->data[2][0] = __('Compact interpolation in hours (1 Fine-20 bad)') . ui_print_help_tip(__('Data will be compacted in intervals of the specified length.'), true);
|
||||
$table_other->data[2][1] = html_print_input_text ('step_compact',
|
||||
$config["step_compact"], '', 5, 5, true);
|
||||
|
||||
$intervals = array ();
|
||||
|
|
|
@ -18,6 +18,14 @@ global $config;
|
|||
|
||||
// ui_require_css_file('update_manager', 'godmode/update_manager/');
|
||||
|
||||
check_login ();
|
||||
|
||||
// ui_require_css_file('update_manager', 'godmode/update_manager/');
|
||||
if (! check_acl ($config['id_user'], 0, "PM") && ! is_user_admin ($config['id_user'])) {
|
||||
db_pandora_audit("ACL Violation", "Trying to access Setup Management");
|
||||
require ("general/noaccess.php");
|
||||
return;
|
||||
}
|
||||
$baseurl = ui_get_full_url(false, false, false, false);
|
||||
|
||||
?>
|
||||
|
|
|
@ -16,6 +16,14 @@
|
|||
|
||||
global $config;
|
||||
|
||||
check_login ();
|
||||
|
||||
if (! check_acl ($config['id_user'], 0, "PM") && ! is_user_admin ($config['id_user'])) {
|
||||
db_pandora_audit("ACL Violation", "Trying to access Setup Management");
|
||||
require ("general/noaccess.php");
|
||||
return;
|
||||
}
|
||||
|
||||
ui_require_css_file('update_manager', 'godmode/update_manager/');
|
||||
require_once("include/functions_update_manager.php");
|
||||
enterprise_include_once("include/functions_update_manager.php");
|
||||
|
|
|
@ -16,9 +16,16 @@
|
|||
|
||||
global $config;
|
||||
|
||||
check_login ();
|
||||
//The ajax is in
|
||||
// include/ajax/update_manager.ajax.php
|
||||
|
||||
if (! check_acl ($config['id_user'], 0, "PM") && ! is_user_admin ($config['id_user'])) {
|
||||
db_pandora_audit("ACL Violation", "Trying to access Setup Management");
|
||||
require ("general/noaccess.php");
|
||||
return;
|
||||
}
|
||||
|
||||
$tab = get_parameter('tab', 'online');
|
||||
|
||||
$buttons = array(
|
||||
|
|
|
@ -16,6 +16,14 @@
|
|||
|
||||
global $config;
|
||||
|
||||
check_login ();
|
||||
|
||||
if (! check_acl ($config['id_user'], 0, "PM") && ! is_user_admin ($config['id_user'])) {
|
||||
db_pandora_audit("ACL Violation", "Trying to access Setup Management");
|
||||
require ("general/noaccess.php");
|
||||
return;
|
||||
}
|
||||
|
||||
$action_update_url_update_manager = (bool)get_parameter(
|
||||
'action_update_url_update_manager', 0);
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
/**
|
||||
* Pandora build version and version
|
||||
*/
|
||||
$build_version = 'PC160329';
|
||||
$build_version = 'PC160420';
|
||||
$pandora_version = 'v6.1dev';
|
||||
|
||||
// Do not overwrite default timezone set if defined.
|
||||
|
|
|
@ -1202,11 +1202,13 @@ function agents_get_modules ($id_agent = null, $details = false,
|
|||
|
||||
//$where .= " AND id_policy_module = 0 ";
|
||||
|
||||
$where_tags = tags_get_acl_tags($config['id_user'], $id_groups, 'AR',
|
||||
'module_condition', 'AND', 'tagente_modulo', false, array(),
|
||||
true);
|
||||
|
||||
$where .= "\n\n" . $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);
|
||||
|
||||
$where .= "\n\n" . $where_tags;
|
||||
}
|
||||
|
||||
$sql = sprintf ('SELECT %s%s
|
||||
FROM tagente_modulo
|
||||
|
|
|
@ -376,6 +376,8 @@ function config_update_config () {
|
|||
$error_update[] = __('Max. days before delete unknown modules');
|
||||
if (!config_update_value ('days_compact', (int) get_parameter ('days_compact')))
|
||||
$error_update[] = __('Max. days before compact data');
|
||||
if (!config_update_value ('report_limit', (int) get_parameter ('report_limit')))
|
||||
$error_update[] = __('Item limit for realtime reports)');
|
||||
if (!config_update_value ('step_compact', (int) get_parameter ('step_compact')))
|
||||
$error_update[] = __('Compact interpolation in hours (1 Fine-20 bad)');
|
||||
if (!config_update_value ('event_view_hr', (int) get_parameter ('event_view_hr')))
|
||||
|
@ -708,6 +710,10 @@ function config_process_config () {
|
|||
config_update_value ('event_view_hr', 8);
|
||||
}
|
||||
|
||||
if (!isset ($config['report_limit'])) {
|
||||
config_update_value ('report_limit', 100);
|
||||
}
|
||||
|
||||
if (!isset ($config['loginhash_pwd'])) {
|
||||
config_update_value ('loginhash_pwd', io_input_password(rand (0, 1000) * rand (0, 1000)."pandorahash"));
|
||||
}
|
||||
|
|
|
@ -893,7 +893,7 @@ function grafico_modulo_sparse ($agent_module_id, $period, $show_events,
|
|||
$config['font_size'], $unit, $ttl, $series_type,
|
||||
$chart_extra_data, $warning_min, $critical_min,
|
||||
$adapt_key, false, $series_suffix_str, $menu,
|
||||
$backgroundColor, $dashboard, $vconsole);
|
||||
$backgroundColor, $dashboard, $vconsole, $agent_module_id);
|
||||
}
|
||||
}
|
||||
elseif ($config['type_module_charts'] === 'line') {
|
||||
|
|
|
@ -2241,6 +2241,85 @@ function modules_get_first_contact_date($id_agent_module) {
|
|||
return $first_date;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the unknown time status of a module in a period.
|
||||
* If there is more than 1 days between data, there is some unknown time modules
|
||||
*
|
||||
* @param int id_agent_module.
|
||||
* @param int ending interval timestamp
|
||||
* @param int interval duration
|
||||
*
|
||||
* @return int unknown seconds.
|
||||
*/
|
||||
function modules_get_unknown_time ($id_agent_module, $date, $period){
|
||||
|
||||
// TODO REMOVE THE TIME IN PLANNED DOWNTIME
|
||||
|
||||
if (empty($id_agent_module) || empty($date))
|
||||
return false;
|
||||
|
||||
// Set initial conditions
|
||||
$unknown_seconds = 0;
|
||||
$datelimit = $date - $period;
|
||||
$search_in_history_db = db_search_in_history_db($datelimit);
|
||||
|
||||
// Get interval data
|
||||
$sql = sprintf ('SELECT utimestamp
|
||||
FROM tagente_datos
|
||||
WHERE id_agente_modulo = %d
|
||||
AND utimestamp > %d AND utimestamp <= %d',
|
||||
$id_agent_module, $datelimit, $date);
|
||||
$sql .= ' ORDER BY utimestamp ASC';
|
||||
$interval_data = db_get_all_rows_sql ($sql, $search_in_history_db);
|
||||
|
||||
$previous_data = modules_get_previous_data ($id_agent_module, $datelimit);
|
||||
|
||||
// All alternatives on first data
|
||||
if ($previous_data === false && $interval_data === false) {
|
||||
return false;
|
||||
} else if($previous_data !== false && $interval_data === false) {
|
||||
if (($date - $previous_data['utimestamp']) <= SECONDS_1DAY) {
|
||||
return 0;
|
||||
}
|
||||
if (($previous_data['utimestamp'] + SECONDS_1DAY) >= $datelimit) {
|
||||
return $date - ($previous_data['utimestamp'] + SECONDS_1DAY);
|
||||
} else {
|
||||
return $period;
|
||||
}
|
||||
} else if ($previous_data === false && $interval_data !== false) {
|
||||
$first_data = array_shift ($interval_data);
|
||||
$unknown_seconds += $first_data['utimestamp'] - $datelimit;
|
||||
array_unshift ($interval_data, $first_data);
|
||||
} else {
|
||||
$first_data = array_shift ($interval_data);
|
||||
if (($previous_data['utimestamp'] + SECONDS_1DAY) >= $first_data['utimestamp']) {
|
||||
if (($previous_data['utimestamp'] + SECONDS_1DAY) >= $datelimit) {
|
||||
$unknown_seconds += $previous_data['utimestamp'] + SECONDS_1DAY - $first_data['utimestamp'];
|
||||
} else {
|
||||
$unknown_seconds += $first_data['utimestamp'] - $datetime;
|
||||
}
|
||||
}
|
||||
array_unshift ($interval_data, $first_data);
|
||||
}
|
||||
|
||||
// Put utimestamp like last data
|
||||
$last_data['utimestamp'] = $date;
|
||||
array_push ($interval_data, $last_data);
|
||||
$previous_data = array_shift ($previous_data);
|
||||
|
||||
// Check if all datas have data maximum one day before
|
||||
foreach ($interval_data as $data) {
|
||||
$previous_1day = $previous_data['utimestamp'] + SECONDS_1DAY;
|
||||
if ($previous_1day >= $data['utimestamp']) {
|
||||
$unknown_period += $previous_1day - $data['utimestamp'];
|
||||
}
|
||||
$previous_data = $data;
|
||||
}
|
||||
|
||||
return $unknown_seconds;
|
||||
}
|
||||
|
||||
|
||||
function modules_get_module_group_status($id_agent, $id_module_group) {
|
||||
$status_return = null;
|
||||
|
||||
|
|
|
@ -3859,11 +3859,11 @@ function reporting_availability($report, $content) {
|
|||
$content['time_from'],
|
||||
$content['time_to']);
|
||||
|
||||
$count_checks = modules_get_count_datas(
|
||||
$item['id_agent_module'],
|
||||
$report["datetime"] - $content['period'],
|
||||
$report["datetime"]);
|
||||
|
||||
$item['interval_agent_module'] = modules_get_interval ($item['id_agent_module']);
|
||||
$unknown_seconds = modules_get_unknown_time ($item['id_agent_module'], $report["datetime"], $content['period']);
|
||||
if ($unknown_seconds !== false) {
|
||||
$count_checks = (int)(($content['period'] - $unknown_seconds)/$item['interval_agent_module']);
|
||||
}
|
||||
|
||||
if ($sla_value === false) {
|
||||
$row['checks'] = __('Unknown');
|
||||
|
@ -3887,11 +3887,13 @@ function reporting_availability($report, $content) {
|
|||
$row['failed'] =
|
||||
format_numeric($percent_fail * $count_checks / 100, 0);
|
||||
|
||||
|
||||
$row['poling_time'] = "-";
|
||||
if ($percent_ok > 0) {
|
||||
$row['poling_time'] =
|
||||
human_time_description_raw(
|
||||
($percent_ok * $count_checks / 100) * modules_get_interval($item['id_agent_module']),
|
||||
true);
|
||||
}
|
||||
|
||||
$row['time_unavaliable'] = "-";
|
||||
if ($percent_fail > 0) {
|
||||
|
|
|
@ -93,7 +93,7 @@ function ui_print_truncate_text($text, $numChars = GENERIC_SIZE_TEXT, $showTextI
|
|||
else {
|
||||
echo $text;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$text = io_safe_output($text);
|
||||
if (mb_strlen($text, "UTF-8") > ($numChars)) {
|
||||
|
@ -134,10 +134,10 @@ function ui_print_truncate_text($text, $numChars = GENERIC_SIZE_TEXT, $showTextI
|
|||
}
|
||||
}
|
||||
else {
|
||||
if ($style !== false) {
|
||||
if ($style !== false) {
|
||||
$truncateText = '<span style="' . $style . '">' . $text . '</span>';
|
||||
}
|
||||
else {
|
||||
else {
|
||||
$truncateText = $text;
|
||||
}
|
||||
}
|
||||
|
@ -183,7 +183,7 @@ function printSmallFont ($string, $return = true) {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Prints a generic message between tags.
|
||||
*
|
||||
* @param mixed The string message or array ('title', 'message', 'icon', 'no_close', 'force_style') to be displayed
|
||||
|
@ -267,7 +267,7 @@ function ui_print_message ($message, $class = '', $attributes = '', $return = fa
|
|||
<td class="title" style="text-transform: uppercase; padding-top: 10px;"><b>' . $text_title . '</b></td>
|
||||
<td class="icon" style="text-align: right; padding-right: 3px;">';
|
||||
if (!$no_close_bool) {
|
||||
//Use the no_meta parameter because this image is only in the base console
|
||||
//Use the no_meta parameter because this image is only in the base console
|
||||
$output .= '<a href="javascript: close_info_box(\'' . $id . '\')">' .
|
||||
html_print_image('images/blade.png', true, false, false, false, true) . '</a>';
|
||||
}
|
||||
|
@ -296,11 +296,11 @@ function ui_print_message ($message, $class = '', $attributes = '', $return = fa
|
|||
return $output;
|
||||
else
|
||||
echo $output;
|
||||
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Prints an error message.
|
||||
*
|
||||
* @param mixed The string error message or array ('title', 'message', 'icon', 'no_close') to be displayed
|
||||
|
@ -315,7 +315,7 @@ function ui_print_error_message ($message, $attributes = '', $return = false, $t
|
|||
return ui_print_message ($message, 'error', $attributes, $return, $tag);
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Prints an operation success message.
|
||||
*
|
||||
* @param mixed The string message or array ('title', 'message', 'icon', 'no_close') to be displayed
|
||||
|
@ -330,7 +330,7 @@ function ui_print_success_message ($message, $attributes = '', $return = false,
|
|||
return ui_print_message ($message, 'suc', $attributes, $return, $tag);
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Prints an operation info message.
|
||||
*
|
||||
* @param mixed The string message or array ('title', 'message', 'icon', 'no_close') to be displayed
|
||||
|
@ -349,10 +349,10 @@ function ui_print_empty_data($message, $attributes = '', $return = false, $tag =
|
|||
return ui_print_message ($message, 'info', $attributes, $return, $tag);
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Evaluates a result using empty() and then prints an error or success message
|
||||
*
|
||||
* @param mixed The results to evaluate. 0, NULL, false, '' or
|
||||
* @param mixed The results to evaluate. 0, NULL, false, '' or
|
||||
* array() is bad, the rest is good
|
||||
* @param mixed The string or array ('title', 'message') to be displayed if the result was good
|
||||
* @param mixed The string or array ('title', 'message') to be displayed if the result was bad
|
||||
|
@ -378,7 +378,7 @@ function ui_print_result_message ($result, $good = '', $bad = '', $attributes =
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Prints an warning message.
|
||||
*
|
||||
* @param mixed The string warning message or array ('title', 'message', 'icon', 'no_close') to be displayed
|
||||
|
@ -517,7 +517,7 @@ function ui_print_tags_warning ($return = false) {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Print group icon within a link
|
||||
*
|
||||
* @param int Group id
|
||||
|
@ -543,7 +543,7 @@ function ui_print_group_icon ($id_group, $return = false, $path = "groups_small"
|
|||
if (defined('METACONSOLE'))
|
||||
$link = false;
|
||||
|
||||
if ($link)
|
||||
if ($link)
|
||||
$output = '<a href="index.php?sec=estado&sec2=operation/agentes/estado_agente&refr=60&group_id='.$id_group.'">';
|
||||
|
||||
if ($config['show_group_name']) {
|
||||
|
@ -559,7 +559,7 @@ function ui_print_group_icon ($id_group, $return = false, $path = "groups_small"
|
|||
}
|
||||
}
|
||||
|
||||
if ($link)
|
||||
if ($link)
|
||||
$output .= '</a>';
|
||||
|
||||
if (!$return)
|
||||
|
@ -568,7 +568,7 @@ function ui_print_group_icon ($id_group, $return = false, $path = "groups_small"
|
|||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Print group icon within a link. Other version.
|
||||
*
|
||||
* @param int Group id
|
||||
|
@ -587,7 +587,7 @@ function ui_print_group_icon_path ($id_group, $return = false, $path = "images/g
|
|||
$style = 'width: 16px; height: 16px;';
|
||||
|
||||
$output = '';
|
||||
if ($link)
|
||||
if ($link)
|
||||
$output = '<a href="index.php?sec=estado&sec2=operation/agentes/estado_agente&refr=60&group_id='.$id_group.'">';
|
||||
|
||||
if (empty ($icon))
|
||||
|
@ -595,7 +595,7 @@ function ui_print_group_icon_path ($id_group, $return = false, $path = "images/g
|
|||
else
|
||||
$output .= '<img style="' . $style . '" class="bot" src="'.$path.'/'.$icon.'.png" alt="'.groups_get_name ($id_group, true).'" title="'.groups_get_name ($id_group, true).'" />';
|
||||
|
||||
if ($link)
|
||||
if ($link)
|
||||
$output .= '</a>';
|
||||
|
||||
if (!$return)
|
||||
|
@ -604,12 +604,12 @@ function ui_print_group_icon_path ($id_group, $return = false, $path = "images/g
|
|||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Get the icon of an operating system.
|
||||
*
|
||||
* @param int Operating system id
|
||||
* @param bool Whether to also append the name of the OS after the icon
|
||||
* @param bool Whether to return or echo the result
|
||||
* @param bool Whether to return or echo the result
|
||||
* @param bool Whether to apply skin or not
|
||||
*
|
||||
* @return string HTML with icon of the OS
|
||||
|
@ -636,8 +636,7 @@ function ui_print_os_icon ($id_os, $name = true, $return = false,
|
|||
return "-";
|
||||
}
|
||||
}
|
||||
|
||||
if ($apply_skin) {
|
||||
else if ($apply_skin) {
|
||||
if ($only_src) {
|
||||
$output = html_print_image("images/" . $subfolter . "/" . $icon, true, $options, true, $relative);
|
||||
}
|
||||
|
@ -690,7 +689,7 @@ function ui_print_agent_name ($id_agent, $return = false, $cutoff = 'agent_mediu
|
|||
}
|
||||
|
||||
if ($link) {
|
||||
$url = $server_url . 'index.php?sec=estado&'.
|
||||
$url = $server_url . 'index.php?sec=estado&'.
|
||||
'sec2=operation/agentes/ver_agente&' .
|
||||
'id_agente=' . $id_agent.$extra_params;
|
||||
|
||||
|
@ -710,7 +709,7 @@ function ui_print_agent_name ($id_agent, $return = false, $cutoff = 'agent_mediu
|
|||
echo $output;
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Formats a row from the alert table and returns an array usable in the table function
|
||||
*
|
||||
* @param array A valid (non empty) row from the alert table
|
||||
|
@ -769,12 +768,12 @@ function ui_format_alert_row ($alert, $agent = true, $url = '', $agent_style = f
|
|||
}
|
||||
|
||||
if ($alert['disabled']) {
|
||||
$disabledHtmlStart = '<span style="font-style: italic; color: #aaaaaa;">';
|
||||
$disabledHtmlStart = '<span style="font-style: italic; color: #aaaaaa;">';
|
||||
$disabledHtmlEnd = '</span>';
|
||||
$styleDisabled = "font-style: italic; color: #aaaaaa;";
|
||||
}
|
||||
else {
|
||||
$disabledHtmlStart = '';
|
||||
$disabledHtmlStart = '';
|
||||
$disabledHtmlEnd = '';
|
||||
$styleDisabled = "";
|
||||
}
|
||||
|
@ -802,7 +801,7 @@ function ui_format_alert_row ($alert, $agent = true, $url = '', $agent_style = f
|
|||
else {
|
||||
$img = 'images/policies.png';
|
||||
|
||||
$data[$index['policy']] = '<a href="?sec=gpolicies&sec2=enterprise/godmode/policies/policies&id=' . $policyInfo['id'] . '">' .
|
||||
$data[$index['policy']] = '<a href="?sec=gpolicies&sec2=enterprise/godmode/policies/policies&id=' . $policyInfo['id'] . '">' .
|
||||
html_print_image($img,true, array('title' => $policyInfo['name'])) .
|
||||
'</a>';
|
||||
}
|
||||
|
@ -813,7 +812,7 @@ function ui_format_alert_row ($alert, $agent = true, $url = '', $agent_style = f
|
|||
$data[$index['standby']] = '';
|
||||
if (isset ($alert["standby"]) && $alert["standby"] == 1) {
|
||||
$data[$index['standby']] = html_print_image ('images/bell_pause.png', true, array('title' => __('Standby on')));
|
||||
}
|
||||
}
|
||||
|
||||
if (!defined('METACONSOLE')) {
|
||||
// Force alert execution
|
||||
|
@ -821,7 +820,7 @@ function ui_format_alert_row ($alert, $agent = true, $url = '', $agent_style = f
|
|||
if ($alert["force_execution"] == 0) {
|
||||
$data[$index['force_execution']] =
|
||||
'<a href="'.$url.'&id_alert='.$alert["id"].'&force_execution=1&refr=60">' . html_print_image("images/target.png", true, array("border" => '0', "title" => __('Force'))) . '</a>';
|
||||
}
|
||||
}
|
||||
else {
|
||||
$data[$index['force_execution']] =
|
||||
'<a href="'.$url.'&id_alert='.$alert["id"].'&refr=60">' . html_print_image("images/refresh.png", true) . '</a>';
|
||||
|
@ -832,7 +831,7 @@ function ui_format_alert_row ($alert, $agent = true, $url = '', $agent_style = f
|
|||
if ($agent == 0) {
|
||||
$data[$index['module_name']] .=
|
||||
ui_print_truncate_text(isset($alert['agent_module_name']) ? $alert['agent_module_name'] : modules_get_agentmodule_name ($alert["id_agent_module"]), 'module_small', false, true, true, '[…]', 'font-size: 7.2pt');
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (defined('METACONSOLE')) {
|
||||
$agent_name = $alert['agent_name'];
|
||||
|
@ -851,7 +850,7 @@ function ui_format_alert_row ($alert, $agent = true, $url = '', $agent_style = f
|
|||
$data[$index['agent_name']] .= ui_print_agent_name ($id_agent, true, 'agent_medium', $styleDisabled . " $agent_style", false, $console_url, $url_hash, $agent_name);
|
||||
}
|
||||
else {
|
||||
$data[$index['agent_name']] .= ui_print_agent_name ($id_agent, true, 'agent_medium', $styleDisabled, false, $console_url, $url_hash);
|
||||
$data[$index['agent_name']] .= ui_print_agent_name ($id_agent, true, 'agent_medium', $styleDisabled, false, $console_url, $url_hash);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -932,7 +931,7 @@ function ui_format_alert_row ($alert, $agent = true, $url = '', $agent_style = f
|
|||
}
|
||||
|
||||
/**
|
||||
* Prints a substracted string, length specified by cutoff, the full string will be in a rollover.
|
||||
* Prints a substracted string, length specified by cutoff, the full string will be in a rollover.
|
||||
*
|
||||
* @param string The string to be cut
|
||||
* @param int At how much characters to cut
|
||||
|
@ -1050,7 +1049,7 @@ function ui_print_alert_template_example ($id_alert_template, $return = false, $
|
|||
*
|
||||
* @param string Id of the help article
|
||||
* @param bool Whether to return or output the result
|
||||
* @param string Home url if its necessary
|
||||
* @param string Home url if its necessary
|
||||
* @param string Image path
|
||||
*
|
||||
* @return string The help tip
|
||||
|
@ -1063,7 +1062,7 @@ function ui_print_help_icon ($help_id, $return = false, $home_url = '', $image =
|
|||
$home_url = "../../" . $home_url;
|
||||
}
|
||||
|
||||
$output = html_print_image ($image, true,
|
||||
$output = html_print_image ($image, true,
|
||||
array ("class" => "img_help",
|
||||
"title" => __('Help'),
|
||||
"onclick" => "open_help ('" . $help_id . "','" . $home_url . "')"));
|
||||
|
@ -1257,7 +1256,7 @@ function ui_require_jquery_file ($name, $path = 'include/javascript/', $echo_tag
|
|||
* @param string Callback will fill this with the current buffer.
|
||||
* @param bitfield Callback will fill this with a bitfield (see ob_start)
|
||||
*
|
||||
* @return string String to return to the browser
|
||||
* @return string String to return to the browser
|
||||
*/
|
||||
function ui_process_page_head ($string, $bitfield) {
|
||||
global $config;
|
||||
|
@ -1286,7 +1285,7 @@ function ui_process_page_head ($string, $bitfield) {
|
|||
$_GET['sec2'] == 'enterprise/dashboard/main_dashboard') {
|
||||
|
||||
$query = ui_get_url_refresh (false, false);
|
||||
$output .= '<meta http-equiv="refresh" content="' .
|
||||
$output .= '<meta http-equiv="refresh" content="' .
|
||||
$config_refr . '; URL=' . $query . '" />';
|
||||
|
||||
}
|
||||
|
@ -1357,7 +1356,7 @@ function ui_process_page_head ($string, $bitfield) {
|
|||
|
||||
$exists_css = false;
|
||||
if ($login_ok and $isFunctionSkins !== ENTERPRISE_NOT_HOOK) {
|
||||
//Checks if user's skin is available
|
||||
//Checks if user's skin is available
|
||||
$exists_skin = enterprise_hook('skins_is_path_set');
|
||||
if ($exists_skin) {
|
||||
$skin_path = enterprise_hook('skins_get_skin_path');
|
||||
|
@ -1369,15 +1368,15 @@ function ui_process_page_head ($string, $bitfield) {
|
|||
if ($exists_css) {
|
||||
foreach ($skin_styles as $filename => $name) {
|
||||
$style = substr ($filename, 0, strlen ($filename) - 4);
|
||||
$config['css'][$style] = $skin_path . 'include/styles/' . $filename;
|
||||
$config['css'][$style] = $skin_path . 'include/styles/' . $filename;
|
||||
}
|
||||
}
|
||||
}
|
||||
//Otherwise assign default and user's css
|
||||
else {
|
||||
//User style should go last so it can rewrite common styles
|
||||
$config['css'] = array_merge (array (
|
||||
"common" => "include/styles/common.css",
|
||||
"menu" => "include/styles/menu.css",
|
||||
"common" => "include/styles/common.css",
|
||||
"menu" => "include/styles/menu.css",
|
||||
$config['style'] => "include/styles/" . $config['style'] . ".css"),
|
||||
$config['css']);
|
||||
}
|
||||
|
@ -1552,7 +1551,7 @@ function ui_process_page_body ($string, $bitfield) {
|
|||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Prints a pagination menu to browse into a collection of data.
|
||||
*
|
||||
* @param int $count Number of elements in the collection.
|
||||
|
@ -1562,7 +1561,7 @@ function ui_process_page_body ($string, $bitfield) {
|
|||
* taken from $_REQUEST['offset']
|
||||
* @param int $pagination Current pagination size. If a user requests a larger
|
||||
* pagination than config["block_size"]
|
||||
* @param bool $return Whether to return or print this
|
||||
* @param bool $return Whether to return or print this
|
||||
* @param string $offset_name The name of parameter for the offset.
|
||||
* @param bool $print_total_items Show the text with the total items. By default true.
|
||||
*
|
||||
|
@ -1596,8 +1595,8 @@ function ui_pagination ($count, $url = false, $offset = 0,
|
|||
/*
|
||||
URL passed render links with some parameter
|
||||
&offset - Offset records passed to next page
|
||||
&counter - Number of items to be blocked
|
||||
Pagination needs $url to build the base URL to render links, its a base url, like
|
||||
&counter - Number of items to be blocked
|
||||
Pagination needs $url to build the base URL to render links, its a base url, like
|
||||
" http://pandora/index.php?sec=godmode&sec2=godmode/admin_access_logs "
|
||||
*/
|
||||
$block_limit = PAGINATION_BLOCKS_LIMIT; // Visualize only $block_limit blocks
|
||||
|
@ -1793,7 +1792,7 @@ function ui_pagination ($count, $url = false, $offset = 0,
|
|||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Prints only a tip button which shows a text when the user puts the mouse over it.
|
||||
*
|
||||
* @param string Complete text to show in the tip
|
||||
|
@ -1804,8 +1803,8 @@ function ui_pagination ($count, $url = false, $offset = 0,
|
|||
*/
|
||||
function ui_print_session_action_icon ($action, $return = false) {
|
||||
$key_icon = array(
|
||||
'acl' => 'images/delete.png',
|
||||
'agent' => 'images/agent.png',
|
||||
'acl' => 'images/delete.png',
|
||||
'agent' => 'images/agent.png',
|
||||
'module' => 'images/module.png',
|
||||
'alert' => 'images/bell.png',
|
||||
'incident' => 'images/default_list.png',
|
||||
|
@ -1831,7 +1830,7 @@ function ui_print_session_action_icon ($action, $return = false) {
|
|||
$output = '';
|
||||
foreach($key_icon as $key => $icon) {
|
||||
if (stristr($action, $key) !== false) {
|
||||
$output = html_print_image($icon, true, array('title' => $action)) . ' ';
|
||||
$output = html_print_image($icon, true, array('title' => $action)) . ' ';
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -1841,7 +1840,7 @@ function ui_print_session_action_icon ($action, $return = false) {
|
|||
echo $output;
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Prints only a tip button which shows a text when the user puts the mouse over it.
|
||||
*
|
||||
* @param string Complete text to show in the tip
|
||||
|
@ -1889,7 +1888,7 @@ function ui_debug ($var, $backtrace = true) {
|
|||
foreach ($traces as $trace) {
|
||||
$trace_id++;
|
||||
|
||||
/* Many classes are used to allow better customization.
|
||||
/* Many classes are used to allow better customization.
|
||||
Please, do not remove them */
|
||||
echo '<li>';
|
||||
if (isset ($trace['class']))
|
||||
|
@ -1947,7 +1946,7 @@ function ui_print_moduletype_icon ($id_moduletype, $return = false, $relative =
|
|||
$type = db_get_row ("ttipo_modulo", "id_tipo", (int) $id_moduletype, array ("descripcion", "icon"));
|
||||
if ($type === false) {
|
||||
$type = array ();
|
||||
$type["descripcion"] = __('Unknown type');
|
||||
$type["descripcion"] = __('Unknown type');
|
||||
$type["icon"] = 'b_down.png';
|
||||
}
|
||||
$imagepath = 'images/'.$type["icon"];
|
||||
|
@ -1987,7 +1986,7 @@ function ui_print_module_warn_value ($max_warning, $min_warning, $str_warning, $
|
|||
}
|
||||
else {
|
||||
$data .= __("N/A");
|
||||
}
|
||||
}
|
||||
|
||||
$data .= " - ";
|
||||
|
||||
|
@ -2032,7 +2031,7 @@ function ui_get_status_images_path () {
|
|||
|
||||
$imageset = $config["status_images_set"];
|
||||
|
||||
if (strpos ($imageset, ",") === false)
|
||||
if (strpos ($imageset, ",") === false)
|
||||
$imageset .= ",40x18";
|
||||
list ($imageset, $sizes) = preg_split ("/\,/", $imageset);
|
||||
|
||||
|
@ -2049,7 +2048,7 @@ function ui_get_status_images_path () {
|
|||
* Prints an image representing a status.
|
||||
*
|
||||
* @param string
|
||||
* @param string
|
||||
* @param string
|
||||
* @param bool Whether to return an output string or echo now (optional, echo by default).
|
||||
* @param array options to set image attributes: I.E.: style
|
||||
* @param Path of the image, if not provided use the status path
|
||||
|
@ -2158,7 +2157,7 @@ function ui_toggle($code, $name, $title = '', $hidden_default = true, $return =
|
|||
function ui_get_url_refresh ($params = false, $relative = true, $add_post = true) {
|
||||
// Agent selection filters and refresh
|
||||
global $config;
|
||||
|
||||
|
||||
// slerena, 8/Ene/2015 - Need to put index.php on URL which have it.
|
||||
if (strpos($_SERVER['REQUEST_URI'], 'index.php') === false)
|
||||
$url = '';
|
||||
|
@ -2381,7 +2380,7 @@ function ui_get_full_url ($url = '', $no_proxy = false, $add_name_php_file = fal
|
|||
* @param boolean Return (false will print using a echo)
|
||||
* @param boolean help (Help ID to print the Help link)
|
||||
* @param boolean Godmode (false = operation mode).
|
||||
* @param string Options (HTML code for make tabs or just a brief info string
|
||||
* @param string Options (HTML code for make tabs or just a brief info string
|
||||
* @return string Header HTML
|
||||
*/
|
||||
|
||||
|
@ -2399,7 +2398,7 @@ function ui_print_page_header ($title, $icon = "", $return = false, $help = "",
|
|||
$type = "view";
|
||||
$type2 = "menu_tab_frame_view";
|
||||
$separator_class = "separator";
|
||||
}
|
||||
}
|
||||
else {
|
||||
$type = "view";
|
||||
$type2 = "menu_tab_frame_view";
|
||||
|
@ -2411,7 +2410,7 @@ function ui_print_page_header ($title, $icon = "", $return = false, $help = "",
|
|||
|
||||
|
||||
$buffer .= '<ul class="mn"><li class="' . $type . '"> ' . ' ';
|
||||
$buffer .= '<span style="">' .
|
||||
$buffer .= '<span style="">' .
|
||||
ui_print_truncate_text($title, 38);
|
||||
if ($help != "")
|
||||
$buffer .= "<div class='head_help' style='float: right; margin-top: -2px !important; margin-left: 2px !important;'>" .
|
||||
|
@ -2627,7 +2626,7 @@ function ui_print_page_header ($title, $icon = "", $return = false, $help = "",
|
|||
*
|
||||
* - $parameters['javascript_function_action_after_select_js_call'] The
|
||||
* call of this function to call after user select a agent into the
|
||||
* list in the autocomplete field. Instead the
|
||||
* list in the autocomplete field. Instead the
|
||||
* $parameters['javascript_function_action_after_select'], this is
|
||||
* overwrite the previous element. And this is necesary when you need
|
||||
* to set some params in your custom function.
|
||||
|
@ -3214,7 +3213,7 @@ function ui_print_agent_autocomplete_input($parameters) {
|
|||
server_id = ui.item.id_server;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//Put the name
|
||||
$(this).val(agent_name);
|
||||
|
@ -3535,7 +3534,7 @@ function ui_get_error ($error_code) {
|
|||
case 'error_dbconfig':
|
||||
$title = __('Problem with Pandora FMS database');
|
||||
$message = __('Cannot connect to the database, please check your database setup in the <b>include/config.php</b> file.<i><br/><br/>
|
||||
Probably your database, hostname, user or password values are incorrect or
|
||||
Probably your database, hostname, user or password values are incorrect or
|
||||
the database server is not running.').'<br /><br />';
|
||||
$message .= '<span class="red">';
|
||||
$message .= '<b>' . __('DB ERROR') . ':</b><br>';
|
||||
|
@ -3577,9 +3576,9 @@ function ui_get_error ($error_code) {
|
|||
break;
|
||||
case 'error_perms':
|
||||
$title = __('Bad permission for include/config.php');
|
||||
$message = __('For security reasons, <i>config.php</i> must have restrictive permissions, and "other" users
|
||||
should not read it or write to it. It should be written only for owner
|
||||
(usually www-data or http daemon user), normal operation is not possible until you change
|
||||
$message = __('For security reasons, <i>config.php</i> must have restrictive permissions, and "other" users
|
||||
should not read it or write to it. It should be written only for owner
|
||||
(usually www-data or http daemon user), normal operation is not possible until you change
|
||||
permissions for <i>include/config.php</i> file. Please do it, it is for your security.');
|
||||
break;
|
||||
}
|
||||
|
@ -3700,4 +3699,4 @@ function ui_print_module_string_value($value, $id_agente_module,
|
|||
|
||||
return $salida;
|
||||
}
|
||||
?>
|
||||
?>
|
|
@ -776,9 +776,14 @@ function visual_map_print_item($mode = "read", $layoutData,
|
|||
true, true, true, 1, false, $graph_javascript);
|
||||
}
|
||||
else {
|
||||
if ($isExternalLink)
|
||||
$homeurl = $config['homeurl'];
|
||||
else
|
||||
$homeurl = '';
|
||||
|
||||
$img = grafico_modulo_sparse($id_module, $period, 0, $width,
|
||||
$height, '', null, false, 1, false, 0, '', 0, 0,
|
||||
true, true, '', 1, false, '', false, false, true,
|
||||
true, true, $homeurl, 1, false, '', false, false, true,
|
||||
$layoutData['image'], null, false, $graph_javascript);
|
||||
}
|
||||
|
||||
|
|
|
@ -46,6 +46,7 @@ if (!empty($graph_type)) {
|
|||
include_once($homeurl . 'include/graphs/functions_gd.php');
|
||||
include_once($homeurl . 'include/graphs/functions_utils.php');
|
||||
include_once($homeurl . 'include/graphs/functions_d3.php');
|
||||
include_once($homeurl . 'include/graphs/functions_flot.php');
|
||||
}
|
||||
|
||||
// Clean the output buffer and turn off output buffering
|
||||
|
@ -218,8 +219,9 @@ function area_graph($flash_chart, $chart_data, $width, $height, $color,
|
|||
$chart_extra_data = array(), $yellow_threshold = 0,
|
||||
$red_threshold = 0, $adapt_key = '', $force_integer = false,
|
||||
$series_suffix_str = '', $menu = true, $backgroundColor = 'white',
|
||||
$dashboard = false, $vconsole = false) {
|
||||
$dashboard = false, $vconsole = false, $agent_module_id = 0) {
|
||||
|
||||
include_once('functions_flot.php');
|
||||
|
||||
setup_watermark($water_mark, $water_mark_file, $water_mark_url);
|
||||
|
||||
|
@ -257,7 +259,9 @@ function area_graph($flash_chart, $chart_data, $width, $height, $color,
|
|||
$series_suffix_str,
|
||||
$menu,
|
||||
$backgroundColor,
|
||||
$dashboard);
|
||||
$dashboard,
|
||||
false,
|
||||
$agent_module_id);
|
||||
}
|
||||
else {
|
||||
if ($vconsole) {
|
||||
|
@ -281,7 +285,8 @@ function area_graph($flash_chart, $chart_data, $width, $height, $color,
|
|||
$menu,
|
||||
$backgroundColor,
|
||||
$dashboard,
|
||||
$vconsole);
|
||||
$vconsole,
|
||||
$agent_module_id);
|
||||
}
|
||||
else {
|
||||
$graph = array();
|
||||
|
@ -316,7 +321,7 @@ function stacked_area_graph($flash_chart, $chart_data, $width, $height,
|
|||
$color, $legend, $long_index, $no_data_image, $xaxisname = "",
|
||||
$yaxisname = "", $water_mark = "", $font = '', $font_size = '',
|
||||
$unit = '', $ttl = 1, $homeurl = '', $backgroundColor = 'white',
|
||||
$dashboard = false, $vconsole = false) {
|
||||
$dashboard = false, $vconsole = false, $agent_module_id) {
|
||||
|
||||
setup_watermark($water_mark, $water_mark_file, $water_mark_url);
|
||||
|
||||
|
@ -368,7 +373,8 @@ function stacked_area_graph($flash_chart, $chart_data, $width, $height,
|
|||
true,
|
||||
$backgroundColor,
|
||||
$dashboard,
|
||||
$vconsole);
|
||||
$vconsole,
|
||||
$agent_module_id);
|
||||
}
|
||||
else {
|
||||
//Stack the data
|
||||
|
@ -537,6 +543,8 @@ function line_graph($flash_chart, $chart_data, $width, $height, $color,
|
|||
$unit = '', $ttl = 1, $homeurl = '', $backgroundColor = 'white',
|
||||
$dashboard = false, $vconsole = false) {
|
||||
|
||||
include_once("functions_flot.php");
|
||||
|
||||
setup_watermark($water_mark, $water_mark_file, $water_mark_url);
|
||||
|
||||
if (empty($chart_data)) {
|
||||
|
|
|
@ -804,7 +804,9 @@ function pandoraFlotArea(graph_id, values, labels, labels_long, legend,
|
|||
colors, type, serie_types, water_mark, width, max_x, homeurl, unit,
|
||||
font_size, menu, events, event_ids, legend_events, alerts,
|
||||
alert_ids, legend_alerts, yellow_threshold, red_threshold,
|
||||
force_integer, separator, separator2, series_suffix_str, vconsole) {
|
||||
force_integer, separator, separator2,
|
||||
yellow_up, red_up, yellow_inverse, red_inverse,
|
||||
series_suffix_str, vconsole) {
|
||||
|
||||
var threshold = true;
|
||||
var thresholded = false;
|
||||
|
@ -861,14 +863,8 @@ function pandoraFlotArea(graph_id, values, labels, labels_long, legend,
|
|||
for (i = 0; i < values.length; i++) {
|
||||
var serie = values[i].split(separator);
|
||||
var aux = new Array();
|
||||
var critical_min = new Array();
|
||||
var warning_min = new Array();
|
||||
$.each(serie, function(i, v) {
|
||||
aux.push([i, v]);
|
||||
if (threshold) {
|
||||
critical_min.push([i,red_threshold]);
|
||||
warning_min.push([i,yellow_threshold]);
|
||||
}
|
||||
});
|
||||
|
||||
switch (serie_types[i]) {
|
||||
|
@ -958,24 +954,518 @@ function pandoraFlotArea(graph_id, values, labels, labels_long, legend,
|
|||
// showed[i] = true;
|
||||
}
|
||||
|
||||
var threshold_data = new Array();
|
||||
// If threshold and up are the same, that critical or warning is disabled
|
||||
if (yellow_threshold == yellow_up) yellow_inverse = false;
|
||||
if (red_threshold == red_up) red_inverse = false;
|
||||
|
||||
//Array with points to be painted
|
||||
var threshold_data = new Array();
|
||||
//Array with some interesting points
|
||||
var extremes = new Array ();
|
||||
|
||||
yellow_threshold = parseFloat (yellow_threshold);
|
||||
yellow_up = parseFloat (yellow_up);
|
||||
red_threshold = parseFloat (red_threshold);
|
||||
red_up = parseFloat (red_up);
|
||||
var yellow_only_min = ((yellow_up == 0) && (yellow_threshold != 0));
|
||||
red_only_min = ((red_up == 0) && (red_threshold != 0));
|
||||
|
||||
if (threshold) {
|
||||
// Warning and critical treshold
|
||||
threshold_data.push({
|
||||
id: 'critical_min',
|
||||
data: critical_min,
|
||||
label: null,
|
||||
color: critical,
|
||||
lines: { show: true, fill: false, lineWidth:3}
|
||||
});
|
||||
threshold_data.push({
|
||||
id: 'warning_min',
|
||||
data: warning_min,
|
||||
label: null,
|
||||
color: warning,
|
||||
lines: { show: true, fill: false, lineWidth:3}
|
||||
});
|
||||
// Warning interval. Change extremes depends on critical interval
|
||||
if (yellow_inverse && red_inverse) {
|
||||
if (red_only_min && yellow_only_min) {
|
||||
// C: |-------- |
|
||||
// W: |········==== |
|
||||
|
||||
if (yellow_threshold > red_threshold) {
|
||||
threshold_data.push({
|
||||
id: 'warning_normal_fdown',
|
||||
data: [[max_x, red_threshold]],
|
||||
label: null,
|
||||
color: warning,
|
||||
bars: {show: true, align: "left", barWidth: yellow_threshold - red_threshold, lineWidth: 0, horizontal: true}
|
||||
});
|
||||
extremes['warning_normal_fdown_1'] = red_threshold;
|
||||
extremes['warning_normal_fdown_2'] = yellow_threshold;
|
||||
}
|
||||
} else if (!red_only_min && yellow_only_min) {
|
||||
// C: |-------- ------|
|
||||
// W: |········===· |
|
||||
|
||||
if (yellow_threshold > red_up) {
|
||||
yellow_threshold = red_up;
|
||||
}
|
||||
if (yellow_threshold > red_threshold) {
|
||||
threshold_data.push({
|
||||
id: 'warning_normal_fdown',
|
||||
data: [[max_x, red_threshold]],
|
||||
label: null,
|
||||
color: warning,
|
||||
bars: {show: true, align: "left", barWidth: yellow_threshold - red_threshold, lineWidth: 0, horizontal: true}
|
||||
});
|
||||
extremes['warning_normal_fdown_1'] = red_threshold;
|
||||
extremes['warning_normal_fdown_2'] = yellow_threshold;
|
||||
}
|
||||
} else if (red_only_min && !yellow_only_min) {
|
||||
// C: |------- |
|
||||
// W: |·······==== ===|
|
||||
if (red_threshold < yellow_threshold) {
|
||||
threshold_data.push({
|
||||
id: 'warning_normal_fdown',
|
||||
data: [[max_x, red_threshold]],
|
||||
label: null,
|
||||
color: warning,
|
||||
bars: {show: true, align: "left", barWidth: yellow_threshold - red_threshold, lineWidth: 0, horizontal: true}
|
||||
});
|
||||
extremes['warning_normal_fdown_1'] = red_threshold;
|
||||
extremes['warning_normal_fdown_2'] = yellow_threshold;
|
||||
}
|
||||
|
||||
if (yellow_up < red_threshold) {
|
||||
yellow_up = red_threshold;
|
||||
}
|
||||
threshold_data.push({ // barWidth will be correct on draw time
|
||||
id: 'warning_up',
|
||||
data: [[max_x, yellow_up]],
|
||||
label: null,
|
||||
color: warning,
|
||||
bars: {show: true, align: "left", barWidth: 1, lineWidth: 0, horizontal: true}
|
||||
});
|
||||
extremes['warning_up'] = yellow_up;
|
||||
|
||||
} else {
|
||||
if (yellow_threshold > red_threshold) {
|
||||
// C: |-------- ------|
|
||||
// W: |········===· ···|
|
||||
if (yellow_threshold > red_up) {
|
||||
yellow_threshold = red_up;
|
||||
}
|
||||
threshold_data.push({
|
||||
id: 'warning_normal_fdown',
|
||||
data: [[max_x, red_threshold]],
|
||||
label: null,
|
||||
color: warning,
|
||||
bars: {show: true, align: "left", barWidth: yellow_threshold - red_threshold, lineWidth: 0, horizontal: true}
|
||||
});
|
||||
extremes['warning_normal_fdown_1'] = red_threshold;
|
||||
extremes['warning_normal_fdown_2'] = yellow_threshold;
|
||||
}
|
||||
if (yellow_up < red_up) {
|
||||
// C: |-------- ---|
|
||||
// W: |····· ·======···|
|
||||
if (yellow_up < red_threshold) {
|
||||
yellow_up = red_up;
|
||||
}
|
||||
threshold_data.push({
|
||||
id: 'warning_normal_fup',
|
||||
data: [[max_x, yellow_up]],
|
||||
label: null,
|
||||
color: warning,
|
||||
bars: {show: true, align: "left", barWidth: red_up - yellow_up, lineWidth: 0, horizontal: true}
|
||||
});
|
||||
extremes['warning_normal_fup_1'] = red_up;
|
||||
extremes['warning_normal_fup_2'] = yellow_up;
|
||||
}
|
||||
// If warning is under critical completely do not paint anything yellow
|
||||
// C: |-------- -----|
|
||||
// W: |···· ···|
|
||||
}
|
||||
} else if (yellow_inverse && !red_inverse) {
|
||||
if (red_only_min && yellow_only_min) {
|
||||
// C: | -----|
|
||||
// W: |============··· |
|
||||
if (yellow_threshold > red_threshold) {
|
||||
yellow_threshold = red_threshold;
|
||||
}
|
||||
threshold_data.push({ // barWidth will be correct on draw time
|
||||
id: 'warning_down',
|
||||
data: [[max_x, yellow_threshold]],
|
||||
label: null,
|
||||
color: warning,
|
||||
bars: {show: true, align: "left", barWidth: 1, lineWidth: 0, horizontal: true}
|
||||
});
|
||||
extremes['warning_down'] = yellow_threshold;
|
||||
|
||||
} else if (!red_only_min && yellow_only_min) {
|
||||
// C: | ---- |
|
||||
// W: |======····=== |
|
||||
|
||||
if (yellow_threshold > red_up) {
|
||||
threshold_data.push({
|
||||
id: 'warning_normal_fdown',
|
||||
data: [[max_x, red_up]],
|
||||
label: null,
|
||||
color: warning,
|
||||
bars: {show: true, align: "left", barWidth: yellow_threshold - red_up, lineWidth: 0, horizontal: true}
|
||||
});
|
||||
extremes['warning_normal_fdown_1'] = red_up;
|
||||
extremes['warning_normal_fdown_2'] = yellow_threshold;
|
||||
}
|
||||
|
||||
if (yellow_threshold > red_threshold) {
|
||||
yellow_threshold = red_threshold;
|
||||
}
|
||||
threshold_data.push({ // barWidth will be correct on draw time
|
||||
id: 'warning_down',
|
||||
data: [[max_x, yellow_threshold]],
|
||||
label: null,
|
||||
color: warning,
|
||||
bars: {show: true, align: "left", barWidth: 1, lineWidth: 0, horizontal: true}
|
||||
});
|
||||
extremes['warning_down'] = yellow_threshold;
|
||||
|
||||
} else if (red_only_min && !yellow_only_min) {
|
||||
if (yellow_threshold < red_threshold) {
|
||||
// C: | -----|
|
||||
// W: |======= ===·····|
|
||||
threshold_data.push({ // barWidth will be correct on draw time
|
||||
id: 'warning_down',
|
||||
data: [[max_x, yellow_threshold]],
|
||||
label: null,
|
||||
color: warning,
|
||||
bars: {show: true, align: "left", barWidth: 1, lineWidth: 0, horizontal: true}
|
||||
});
|
||||
extremes['warning_down'] = yellow_threshold;
|
||||
|
||||
if (red_threshold > yellow_up) {
|
||||
threshold_data.push({
|
||||
id: 'warning_normal_fup',
|
||||
data: [[max_x, yellow_up]],
|
||||
label: null,
|
||||
color: warning,
|
||||
bars: {show: true, align: "left", barWidth: red_threshold - yellow_up, lineWidth: 0, horizontal: true}
|
||||
});
|
||||
extremes['warning_normal_fup_1'] = yellow_up;
|
||||
extremes['warning_normal_fup_2'] = red_threshold;
|
||||
}
|
||||
} else {
|
||||
// C: | ------------|
|
||||
// W: |=====·· ········|
|
||||
threshold_data.push({ // barWidth will be correct on draw time
|
||||
id: 'warning_down',
|
||||
data: [[max_x, red_threshold]],
|
||||
label: null,
|
||||
color: warning,
|
||||
bars: {show: true, align: "left", barWidth: 1, lineWidth: 0, horizontal: true}
|
||||
});
|
||||
extremes['warning_down'] = red_threshold;
|
||||
}
|
||||
} else {
|
||||
if (yellow_threshold > red_up) {
|
||||
// C: | ----- |
|
||||
// W: |====·····=== ===|
|
||||
threshold_data.push({ // barWidth will be correct on draw time
|
||||
id: 'warning_down',
|
||||
data: [[max_x, red_threshold]],
|
||||
label: null,
|
||||
color: warning,
|
||||
bars: {show: true, align: "left", barWidth: 1, lineWidth: 0, horizontal: true}
|
||||
});
|
||||
extremes['warning_down'] = red_threshold;
|
||||
|
||||
threshold_data.push({
|
||||
id: 'warning_normal_fdown',
|
||||
data: [[max_x, red_up]],
|
||||
label: null,
|
||||
color: warning,
|
||||
bars: {show: true, align: "left", barWidth: yellow_threshold - red_up, lineWidth: 0, horizontal: true}
|
||||
});
|
||||
extremes['warning_normal_fdown_1'] = red_up;
|
||||
extremes['warning_normal_fdown_2'] = yellow_threshold;
|
||||
|
||||
threshold_data.push({ // barWidth will be correct on draw time
|
||||
id: 'warning_up',
|
||||
data: [[max_x, yellow_up]],
|
||||
label: null,
|
||||
color: warning,
|
||||
bars: {show: true, align: "left", barWidth: 1, lineWidth: 0, horizontal: true}
|
||||
});
|
||||
extremes['warning_up'] = yellow_up;
|
||||
} else if (red_threshold > yellow_up){
|
||||
// C: | ----- |
|
||||
// W: |=== ===·····==|
|
||||
threshold_data.push({ // barWidth will be correct on draw time
|
||||
id: 'warning_down',
|
||||
data: [[max_x, yellow_threshold]],
|
||||
label: null,
|
||||
color: warning,
|
||||
bars: {show: true, align: "left", barWidth: 1, lineWidth: 0, horizontal: true}
|
||||
});
|
||||
extremes['warning_down'] = yellow_threshold;
|
||||
|
||||
threshold_data.push({
|
||||
id: 'warning_normal_fup',
|
||||
data: [[max_x, yellow_up]],
|
||||
label: null,
|
||||
color: warning,
|
||||
bars: {show: true, align: "left", barWidth: red_threshold - yellow_up, lineWidth: 0, horizontal: true}
|
||||
});
|
||||
extremes['warning_normal_fup_1'] = yellow_up;
|
||||
extremes['warning_normal_fup_2'] = red_threshold;
|
||||
|
||||
threshold_data.push({ // barWidth will be correct on draw time
|
||||
id: 'warning_up',
|
||||
data: [[max_x, red_up]],
|
||||
label: null,
|
||||
color: warning,
|
||||
bars: {show: true, align: "left", barWidth: 1, lineWidth: 0, horizontal: true}
|
||||
});
|
||||
extremes['warning_up'] = red_up;
|
||||
} else {
|
||||
// C: | -------- |
|
||||
// W: |==· ···=======|
|
||||
if (yellow_threshold > red_threshold) {
|
||||
yellow_threshold = red_threshold;
|
||||
}
|
||||
if (yellow_up < red_up) {
|
||||
yellow_up = red_up;
|
||||
}
|
||||
|
||||
threshold_data.push({ // barWidth will be correct on draw time
|
||||
id: 'warning_down',
|
||||
data: [[max_x, yellow_threshold]],
|
||||
label: null,
|
||||
color: warning,
|
||||
bars: {show: true, align: "left", barWidth: 1, lineWidth: 0, horizontal: true}
|
||||
});
|
||||
extremes['warning_down'] = yellow_threshold;
|
||||
|
||||
threshold_data.push({ // barWidth will be correct on draw time
|
||||
id: 'warning_up',
|
||||
data: [[max_x, yellow_up]],
|
||||
label: null,
|
||||
color: warning,
|
||||
bars: {show: true, align: "left", barWidth: 1, lineWidth: 0, horizontal: true}
|
||||
});
|
||||
extremes['warning_up'] = yellow_up;
|
||||
}
|
||||
}
|
||||
} else if (!yellow_inverse && red_inverse) {
|
||||
if (yellow_only_min && red_only_min) {
|
||||
// C: |----- |
|
||||
// W: | ··============|
|
||||
if (yellow_threshold < red_threshold) {
|
||||
yellow_threshold = red_threshold;
|
||||
}
|
||||
threshold_data.push({ // barWidth will be correct on draw time
|
||||
id: 'warning_up',
|
||||
data: [[max_x, yellow_threshold]],
|
||||
label: null,
|
||||
color: warning,
|
||||
bars: {show: true, align: "left", barWidth: 1, lineWidth: 0, horizontal: true}
|
||||
});
|
||||
extremes['warning_up'] = yellow_threshold;
|
||||
|
||||
} else if (!yellow_only_min && red_only_min) {
|
||||
// C: |----- |
|
||||
// W: | ··======== |
|
||||
if (yellow_threshold < red_threshold) {
|
||||
yellow_threshold = red_threshold;
|
||||
}
|
||||
if (yellow_up > red_threshold) {
|
||||
threshold_data.push({
|
||||
id: 'warning_normal',
|
||||
data: [[max_x, yellow_threshold]],
|
||||
label: null,
|
||||
color: warning,
|
||||
bars: {show: true, align: "left", barWidth: (yellow_up - yellow_threshold), lineWidth: 0, horizontal: true}
|
||||
});
|
||||
extremes['warning_normal_1'] = yellow_threshold;
|
||||
extremes['warning_normal_2'] = yellow_up;
|
||||
}
|
||||
} else if (yellow_only_min && !red_only_min) {
|
||||
// C: |----- ------|
|
||||
// W: | ··======······|
|
||||
if (yellow_threshold < red_threshold) {
|
||||
yellow_threshold = red_threshold;
|
||||
}
|
||||
if (yellow_threshold < red_up) {
|
||||
threshold_data.push({
|
||||
id: 'warning_normal',
|
||||
data: [[max_x, yellow_threshold]],
|
||||
label: null,
|
||||
color: warning,
|
||||
bars: {show: true, align: "left", barWidth: (red_up - yellow_threshold), lineWidth: 0, horizontal: true}
|
||||
});
|
||||
extremes['warning_normal_1'] = yellow_threshold;
|
||||
extremes['warning_normal_2'] = red_up;
|
||||
}
|
||||
// If warning is under critical completely do not paint anything yellow
|
||||
// C: |-------- -----|
|
||||
// W: | ···|
|
||||
} else {
|
||||
if (red_up > yellow_threshold && red_threshold < yellow_up) {
|
||||
// C: |----- ------|
|
||||
// W: | ··======· |
|
||||
if (yellow_threshold < red_threshold) {
|
||||
yellow_threshold = red_threshold;
|
||||
}
|
||||
if (yellow_up > red_up) {
|
||||
yellow_up = red_up;
|
||||
}
|
||||
|
||||
threshold_data.push({
|
||||
id: 'warning_normal',
|
||||
data: [[max_x, yellow_threshold]],
|
||||
label: null,
|
||||
color: warning,
|
||||
bars: {show: true, align: "left", barWidth: (yellow_up - yellow_threshold), lineWidth: 0, horizontal: true}
|
||||
});
|
||||
extremes['warning_normal_1'] = yellow_threshold;
|
||||
extremes['warning_normal_2'] = yellow_up;
|
||||
}
|
||||
}
|
||||
}
|
||||
// If warning is under critical completely do not paint anything yellow
|
||||
// C: |-------- -----| or // C: |-------- -----|
|
||||
// W: | ···· | // W: | ·· |
|
||||
else {
|
||||
if (red_only_min && yellow_only_min) {
|
||||
if (yellow_threshold < red_threshold) {
|
||||
// C: | ---------|
|
||||
// W: | =====·········|
|
||||
threshold_data.push({
|
||||
id: 'warning_normal',
|
||||
data: [[max_x, yellow_threshold]],
|
||||
label: null,
|
||||
color: warning,
|
||||
bars: {show: true, align: "left", barWidth: (red_threshold - yellow_threshold), lineWidth: 0, horizontal: true}
|
||||
});
|
||||
extremes['warning_normal_1'] = yellow_threshold;
|
||||
extremes['warning_normal_2'] = red_threshold;
|
||||
}
|
||||
} else if (red_only_min && !yellow_only_min) {
|
||||
// C: | ---------|
|
||||
// W: | =====··· |
|
||||
if (yellow_up > red_threshold) {
|
||||
yellow_up = red_threshold;
|
||||
}
|
||||
if (yellow_threshold < red_threshold) {
|
||||
threshold_data.push({
|
||||
id: 'warning_normal',
|
||||
data: [[max_x, yellow_threshold]],
|
||||
label: null,
|
||||
color: warning,
|
||||
bars: {show: true, align: "left", barWidth: (yellow_up - yellow_threshold), lineWidth: 0, horizontal: true}
|
||||
});
|
||||
extremes['warning_normal_1'] = yellow_threshold;
|
||||
extremes['warning_normal_2'] = yellow_up;
|
||||
}
|
||||
} else if (!red_only_min && yellow_only_min) {
|
||||
// C: | ------- |
|
||||
// W: | ==·······=====|
|
||||
|
||||
if (yellow_threshold < red_threshold) {
|
||||
threshold_data.push({
|
||||
id: 'warning_normal_fdown',
|
||||
data: [[max_x, yellow_threshold]],
|
||||
label: null,
|
||||
color: warning,
|
||||
bars: {show: true, align: "left", barWidth: red_threshold - yellow_threshold, lineWidth: 0, horizontal: true}
|
||||
});
|
||||
extremes['warning_normal_fdown_1'] = yellow_threshold;
|
||||
extremes['warning_normal_fdown_2'] = red_threshold;
|
||||
}
|
||||
|
||||
if (yellow_threshold < red_up) {
|
||||
yellow_threshold = red_up;
|
||||
}
|
||||
|
||||
threshold_data.push({ // barWidth will be correct on draw time
|
||||
id: 'warning_up',
|
||||
data: [[max_x, yellow_threshold]],
|
||||
label: null,
|
||||
color: warning,
|
||||
bars: {show: true, align: "left", barWidth: 1, lineWidth: 0, horizontal: true}
|
||||
});
|
||||
extremes['warning_up'] = yellow_threshold;
|
||||
|
||||
} else {
|
||||
if (red_threshold > yellow_threshold && red_up < yellow_up ) {
|
||||
// C: | ------ |
|
||||
// W: | ==······==== |
|
||||
threshold_data.push({
|
||||
id: 'warning_normal_fdown',
|
||||
data: [[max_x, yellow_threshold]],
|
||||
label: null,
|
||||
color: warning,
|
||||
bars: {show: true, align: "left", barWidth: red_threshold - yellow_threshold, lineWidth: 0, horizontal: true}
|
||||
});
|
||||
extremes['warning_normal_fdown_1'] = yellow_threshold;
|
||||
extremes['warning_normal_fdown_2'] = red_threshold;
|
||||
|
||||
threshold_data.push({
|
||||
id: 'warning_normal_fup',
|
||||
data: [[max_x, red_up]],
|
||||
label: null,
|
||||
color: warning,
|
||||
bars: {show: true, align: "left", barWidth: yellow_up - red_up, lineWidth: 0, horizontal: true}
|
||||
});
|
||||
extremes['warning_normal_fup_1'] = red_up;
|
||||
extremes['warning_normal_fup_2'] = yellow_up;
|
||||
} else if (red_threshold < yellow_threshold && red_up > yellow_up) {
|
||||
// If warning is under critical completely do not paint anything yellow
|
||||
// C: | -------- |
|
||||
// W: | ···· |
|
||||
} else {
|
||||
// C: | -------- | or // C: | ------ |
|
||||
// W: | ==·· | // W: | ···==== |
|
||||
if ((yellow_up > red_threshold) && (yellow_up < red_up)) {
|
||||
yellow_up = red_threshold;
|
||||
}
|
||||
if ((yellow_threshold < red_up) && (yellow_threshold > red_threshold)) {
|
||||
yellow_threshold = red_up;
|
||||
}
|
||||
threshold_data.push({
|
||||
id: 'warning_normal',
|
||||
data: [[max_x, yellow_threshold]],
|
||||
label: null,
|
||||
color: warning,
|
||||
bars: {show: true, align: "left", barWidth: (yellow_up - yellow_threshold), lineWidth: 0, horizontal: true}
|
||||
});
|
||||
extremes['warning_normal_1'] = yellow_threshold;
|
||||
extremes['warning_normal_2'] = yellow_up;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Critical interval
|
||||
if (red_inverse) {
|
||||
if (!red_only_min) {
|
||||
threshold_data.push({ // barWidth will be correct on draw time
|
||||
id: 'critical_up',
|
||||
data: [[max_x, red_up]],
|
||||
label: null,
|
||||
color: critical,
|
||||
bars: {show: true, align: "left", barWidth: 1, lineWidth: 0, horizontal: true}
|
||||
});
|
||||
}
|
||||
threshold_data.push({ // barWidth will be correct on draw time
|
||||
id: 'critical_down',
|
||||
data: [[max_x, red_threshold]],
|
||||
label: null,
|
||||
color: critical,
|
||||
bars: {show: true, align: "left", barWidth: 1, lineWidth: 0, horizontal: true}
|
||||
});
|
||||
} else {
|
||||
if (red_up == 0 && red_threshold != 0) {
|
||||
threshold_data.push({ // barWidth will be correct on draw time
|
||||
id: 'critical_up',
|
||||
data: [[max_x, red_threshold]],
|
||||
label: null,
|
||||
color: critical,
|
||||
bars: {show: true, align: "left", barWidth: 1, lineWidth: 0, horizontal: true}
|
||||
});
|
||||
} else {
|
||||
threshold_data.push({
|
||||
id: 'critical_normal',
|
||||
data: [[max_x, red_threshold]],
|
||||
label: null,
|
||||
color: critical,
|
||||
bars: {show: true, align: "left", barWidth: (red_up - red_threshold), lineWidth: 0, horizontal: true}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// The first execution, the graph data is the base data
|
||||
|
@ -1082,7 +1572,7 @@ function pandoraFlotArea(graph_id, values, labels, labels_long, legend,
|
|||
|
||||
new_steps = parseInt(factor * steps);
|
||||
|
||||
plot = $.plot($('#' + graph_id), datas,
|
||||
plot = $.plot($('#' + graph_id), data_base,
|
||||
$.extend(true, {}, options, {
|
||||
xaxis: { min: ranges.xaxis.from, max: ranges.xaxis.to},
|
||||
xaxes: [ {
|
||||
|
@ -1092,6 +1582,15 @@ function pandoraFlotArea(graph_id, values, labels, labels_long, legend,
|
|||
} ],
|
||||
legend: { show: false }
|
||||
}));
|
||||
if (thresholded) {
|
||||
var zoom_data_threshold = new Array ();
|
||||
|
||||
zoom_data_threshold = add_threshold (data_base, threshold_data, plot.getAxes().yaxis.min, plot.getAxes().yaxis.max,
|
||||
yellow_threshold, red_threshold, extremes, red_up);
|
||||
plot.setData(zoom_data_threshold);
|
||||
plot.draw();
|
||||
}
|
||||
|
||||
|
||||
$('#menu_cancelzoom_' + graph_id)
|
||||
.attr('src', homeurl + '/images/zoom_cross_grey.png');
|
||||
|
@ -1535,23 +2034,21 @@ function pandoraFlotArea(graph_id, values, labels, labels_long, legend,
|
|||
datas = new Array();
|
||||
|
||||
if (thresholded) {
|
||||
thresholded = false;
|
||||
}
|
||||
else {
|
||||
$.each(threshold_data, function() {
|
||||
datas.push(this);
|
||||
$.each(data_base, function() {
|
||||
// Prepared to turning series
|
||||
//if(showed[this.id.split('_')[1]]) {
|
||||
datas.push(this);
|
||||
//}
|
||||
});
|
||||
thresholded = false;
|
||||
} else {
|
||||
datas = add_threshold (data_base, threshold_data, plot.getAxes().yaxis.min, plot.getAxes().yaxis.max,
|
||||
yellow_threshold, red_threshold, extremes, red_up);
|
||||
thresholded = true;
|
||||
}
|
||||
|
||||
$.each(data_base, function() {
|
||||
// Prepared to turning series
|
||||
//if(showed[this.id.split('_')[1]]) {
|
||||
datas.push(this);
|
||||
//}
|
||||
});
|
||||
|
||||
plot = $.plot($('#' + graph_id), datas, options);
|
||||
plot.setData(datas);
|
||||
plot.draw();
|
||||
|
||||
plot.setSelection(currentRanges);
|
||||
});
|
||||
|
@ -1568,6 +2065,8 @@ function pandoraFlotArea(graph_id, values, labels, labels_long, legend,
|
|||
.attr('src', homeurl + '/images/zoom_cross.disabled.png');
|
||||
overview.clearSelection();
|
||||
currentRanges = null;
|
||||
|
||||
thresholded = false;
|
||||
});
|
||||
|
||||
// Adjust the menu image on top of the plot
|
||||
|
@ -1735,3 +2234,51 @@ function number_format(number, force_integer, unit) {
|
|||
|
||||
return number + ' ' + shorts[pos] + unit;
|
||||
}
|
||||
function add_threshold (data_base, threshold_data, y_min, y_max, yellow_threshold,
|
||||
red_threshold, extremes, red_up) {
|
||||
|
||||
var datas = new Array ();
|
||||
|
||||
$.each(data_base, function() {
|
||||
// Prepared to turning series
|
||||
//if(showed[this.id.split('_')[1]]) {
|
||||
datas.push(this);
|
||||
//}
|
||||
});
|
||||
|
||||
// Resize the threshold data
|
||||
$.each(threshold_data, function() {
|
||||
if (/_up/.test(this.id)){
|
||||
this.bars.barWidth = y_max - this.data[0][1];
|
||||
}
|
||||
if (/_down/.test(this.id)){
|
||||
var end;
|
||||
if (/critical/.test(this.id)) {
|
||||
end = red_threshold;
|
||||
} else {
|
||||
end = extremes[this.id];
|
||||
}
|
||||
this.bars.barWidth = end - y_min;
|
||||
this.data[0][1] = y_min;
|
||||
}
|
||||
if (/_normal/.test(this.id)){
|
||||
var end;
|
||||
if (/critical/.test(this.id)) {
|
||||
end = red_up;
|
||||
} else {
|
||||
end = extremes[this.id + '_2'];
|
||||
}
|
||||
if (this.data[0][1] < y_min) {
|
||||
this.bars.barWidth = end - y_min;
|
||||
this.data[0][1] = y_min;
|
||||
end = this.bars.barWidth + this.data[0][1];
|
||||
}
|
||||
if (end > y_max) {
|
||||
this.bars.barWidth = y_max - this.data[0][1];
|
||||
}
|
||||
}
|
||||
datas.push(this);
|
||||
});
|
||||
|
||||
return datas;
|
||||
}
|
||||
|
|
|
@ -94,7 +94,7 @@ function flot_area_stacked_graph($chart_data, $width, $height, $color,
|
|||
$serie_types = array(), $chart_extra_data = array(),
|
||||
$yellow_threshold = 0, $red_threshold = 0, $adapt_key= '',
|
||||
$force_integer = false, $series_suffix_str = '', $menu = true,
|
||||
$background_color = 'white', $dashboard = false, $vconsole = false) {
|
||||
$background_color = 'white', $dashboard = false, $vconsole = false, $agent_module_id = 0) {
|
||||
|
||||
global $config;
|
||||
|
||||
|
@ -102,7 +102,7 @@ function flot_area_stacked_graph($chart_data, $width, $height, $color,
|
|||
$legend, $long_index, $homeurl, $unit, 'area_stacked',
|
||||
$water_mark, $serie_types, $chart_extra_data, $yellow_threshold,
|
||||
$red_threshold, $adapt_key, $force_integer, $series_suffix_str,
|
||||
$menu, $background_color, $dashboard, $vconsole);
|
||||
$menu, $background_color, $dashboard, $vconsole, $agent_module_id);
|
||||
}
|
||||
|
||||
function flot_area_simple_graph($chart_data, $width, $height, $color,
|
||||
|
@ -110,7 +110,7 @@ function flot_area_simple_graph($chart_data, $width, $height, $color,
|
|||
$serie_types = array(), $chart_extra_data = array(),
|
||||
$yellow_threshold = 0, $red_threshold = 0, $adapt_key= '',
|
||||
$force_integer = false, $series_suffix_str = '', $menu = true,
|
||||
$background_color = 'white', $dashboard = false, $vconsole = false) {
|
||||
$background_color = 'white', $dashboard = false, $vconsole = false, $agent_module_id = 0) {
|
||||
|
||||
global $config;
|
||||
|
||||
|
@ -118,7 +118,7 @@ function flot_area_simple_graph($chart_data, $width, $height, $color,
|
|||
$legend, $long_index, $homeurl, $unit, 'area_simple',
|
||||
$water_mark, $serie_types, $chart_extra_data, $yellow_threshold,
|
||||
$red_threshold, $adapt_key, $force_integer, $series_suffix_str,
|
||||
$menu, $background_color, $dashboard, $vconsole);
|
||||
$menu, $background_color, $dashboard, $vconsole, $agent_module_id);
|
||||
}
|
||||
|
||||
function flot_line_stacked_graph($chart_data, $width, $height, $color,
|
||||
|
@ -126,7 +126,7 @@ function flot_line_stacked_graph($chart_data, $width, $height, $color,
|
|||
$serie_types = array(), $chart_extra_data = array(),
|
||||
$yellow_threshold = 0, $red_threshold = 0, $adapt_key= '',
|
||||
$force_integer = false, $series_suffix_str = '', $menu = true,
|
||||
$background_color = 'white', $dashboard = false, $vconsole = false) {
|
||||
$background_color = 'white', $dashboard = false, $vconsole = false, $agent_module_id = 0) {
|
||||
|
||||
global $config;
|
||||
|
||||
|
@ -134,7 +134,7 @@ function flot_line_stacked_graph($chart_data, $width, $height, $color,
|
|||
$legend, $long_index, $homeurl, $unit, 'line_stacked',
|
||||
$water_mark, $serie_types, $chart_extra_data, $yellow_threshold,
|
||||
$red_threshold, $adapt_key, $force_integer, $series_suffix_str,
|
||||
$menu, $background_color, $dashboard, $vconsole);
|
||||
$menu, $background_color, $dashboard, $vconsole, $agent_module_id);
|
||||
}
|
||||
|
||||
function flot_line_simple_graph($chart_data, $width, $height, $color,
|
||||
|
@ -142,7 +142,7 @@ function flot_line_simple_graph($chart_data, $width, $height, $color,
|
|||
$serie_types = array(), $chart_extra_data = array(),
|
||||
$yellow_threshold = 0, $red_threshold = 0, $adapt_key= '',
|
||||
$force_integer = false, $series_suffix_str = '', $menu = true,
|
||||
$background_color = 'white', $dashboard = false, $vconsole = false) {
|
||||
$background_color = 'white', $dashboard = false, $vconsole = false, $agent_module_id = 0) {
|
||||
|
||||
global $config;
|
||||
|
||||
|
@ -157,7 +157,7 @@ function flot_area_graph($chart_data, $width, $height, $color, $legend,
|
|||
$long_index, $homeurl, $unit, $type, $water_mark, $serie_types,
|
||||
$chart_extra_data, $yellow_threshold, $red_threshold, $adapt_key,
|
||||
$force_integer, $series_suffix_str = '', $menu = true,
|
||||
$background_color = 'white', $dashboard = false, $vconsole = false) {
|
||||
$background_color = 'white', $dashboard = false, $vconsole = false, $agent_module_id = 0) {
|
||||
|
||||
global $config;
|
||||
|
||||
|
@ -189,9 +189,25 @@ function flot_area_graph($chart_data, $width, $height, $color, $legend,
|
|||
$return = "<div class='parent_graph' style='width: " . $width . "px; " . $background_style . "'>";
|
||||
// Set some containers to legend, graph, timestamp tooltip, etc.
|
||||
$return .= "<p id='legend_$graph_id' class='legend_graph' style='font-size:".$font_size."pt'></p>";
|
||||
|
||||
|
||||
// Get other required module datas to draw warning and critical
|
||||
if ($agent_module_id == 0) {
|
||||
$yellow_up = 0;
|
||||
$red_up = 0;
|
||||
$yellow_inverse = false;
|
||||
$red_inverse = false;
|
||||
} else {
|
||||
$module_data = db_get_row_sql ('SELECT * FROM tagente_modulo WHERE id_agente_modulo = ' . $agent_module_id);
|
||||
$yellow_up = $module_data['max_warning'];
|
||||
$red_up = $module_data['max_critical'];
|
||||
$yellow_inverse = !($module_data['warning_inverse'] == 0);
|
||||
$red_inverse = !($module_data['critical_inverse'] == 0);
|
||||
}
|
||||
|
||||
if ($menu) {
|
||||
$threshold = false;
|
||||
if ($yellow_threshold != 0 || $red_threshold != 0) {
|
||||
if ($yellow_threshold != $yellow_up || $red_threshold != $red_up) {
|
||||
$threshold = true;
|
||||
}
|
||||
|
||||
|
@ -426,6 +442,10 @@ function flot_area_graph($chart_data, $width, $height, $color, $legend,
|
|||
"$force_integer, \n" .
|
||||
"'$separator', \n" .
|
||||
"'$separator2', \n" .
|
||||
"'$yellow_up', \n" .
|
||||
"'$red_up', \n" .
|
||||
"'$yellow_inverse', \n" .
|
||||
"'$red_inverse', \n" .
|
||||
"'$series_suffix_str',
|
||||
'$vconsole');";
|
||||
$return .= "\n//]]>";
|
||||
|
|
|
@ -2556,6 +2556,7 @@
|
|||
if (floor($Value2) == 0) { return(0); }
|
||||
if (is_infinite($Value2)) { return(0); }
|
||||
if ($Value2 == 0.0) { return(0); }
|
||||
if ($Value1 > $Value2) { return(0); }
|
||||
if ($this->mod_check($Value1, $Value2)) { return(0); }
|
||||
if (floor($Value2) != 0) { return($Value1 % $Value2); }
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ if ($develop_bypass != 1) {
|
|||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (filesize("include/config.php") == 0) {
|
||||
include ("install.php");
|
||||
exit;
|
||||
|
@ -99,7 +99,7 @@ if (!empty ($config["https"]) && empty ($_SERVER['HTTPS'])) {
|
|||
if (sizeof ($_REQUEST))
|
||||
//Some (old) browsers don't like the ?&key=var
|
||||
$query .= '?1=1';
|
||||
|
||||
|
||||
//We don't clean these variables up as they're only being passed along
|
||||
foreach ($_GET as $key => $value) {
|
||||
if ($key == 1)
|
||||
|
@ -110,11 +110,11 @@ if (!empty ($config["https"]) && empty ($_SERVER['HTTPS'])) {
|
|||
$query .= '&'.$key.'='.$value;
|
||||
}
|
||||
$url = ui_get_full_url($query);
|
||||
|
||||
|
||||
// Prevent HTTP response splitting attacks
|
||||
// http://en.wikipedia.org/wiki/HTTP_response_splitting
|
||||
$url = str_replace ("\n", "", $url);
|
||||
|
||||
|
||||
header ('Location: '.$url);
|
||||
exit; //Always exit after sending location headers
|
||||
}
|
||||
|
@ -140,10 +140,10 @@ echo '<head>' . "\n";
|
|||
//This starts the page head. In the call back function, things from $page['head'] array will be processed into the head
|
||||
ob_start ('ui_process_page_head');
|
||||
|
||||
// Enterprise main
|
||||
// Enterprise main
|
||||
enterprise_include ('index.php');
|
||||
|
||||
// This tag is included in the buffer passed to ui_process_page_head so
|
||||
// This tag is included in the buffer passed to ui_process_page_head so
|
||||
// technically it can be stripped
|
||||
echo '</head>' . "\n";
|
||||
|
||||
|
@ -165,12 +165,12 @@ $process_login = false;
|
|||
$change_pass = get_parameter_post('renew_password', 0);
|
||||
|
||||
if ($change_pass == 1) {
|
||||
|
||||
|
||||
$password_old = (string) get_parameter_post ('old_password', '');
|
||||
$password_new = (string) get_parameter_post ('new_password', '');
|
||||
$password_confirm = (string) get_parameter_post ('confirm_new_password', '');
|
||||
$id = (string) get_parameter_post ('login', '');
|
||||
|
||||
|
||||
$changed_pass = login_update_password_check ($password_old, $password_new, $password_confirm, $id);
|
||||
}
|
||||
|
||||
|
@ -188,40 +188,40 @@ if (strlen($search) > 0) {
|
|||
if (! isset ($config['id_user'])) {
|
||||
if (isset ($_GET["login"])) {
|
||||
include_once('include/functions_db.php'); //Include it to use escape_string_sql function
|
||||
|
||||
|
||||
$config["auth_error"] = ""; //Set this to the error message from the authorization mechanism
|
||||
$nick = get_parameter_post ("nick"); //This is the variable with the login
|
||||
$pass = get_parameter_post ("pass"); //This is the variable with the password
|
||||
$nick = db_escape_string_sql($nick);
|
||||
$pass = db_escape_string_sql($pass);
|
||||
|
||||
|
||||
//Since now, only the $pass variable are needed
|
||||
unset ($_GET['pass'], $_POST['pass'], $_REQUEST['pass']);
|
||||
|
||||
|
||||
// If the auth_code exists, we assume the user has come through the double auth page
|
||||
if (isset ($_POST['auth_code'])) {
|
||||
$double_auth_success = false;
|
||||
|
||||
|
||||
// The double authentication is activated and the user has surpassed the first step (the login).
|
||||
// Now the authentication code provided will be checked.
|
||||
if (isset ($_SESSION['prepared_login_da'])) {
|
||||
if (isset ($_SESSION['prepared_login_da']['id_user'])
|
||||
&& isset ($_SESSION['prepared_login_da']['timestamp'])) {
|
||||
|
||||
|
||||
// The user has a maximum of 5 minutes to introduce the double auth code
|
||||
$dauth_period = SECONDS_2MINUTES;
|
||||
$now = time();
|
||||
$dauth_time = $_SESSION['prepared_login_da']['timestamp'];
|
||||
|
||||
|
||||
if ($now - $dauth_period < $dauth_time) {
|
||||
// Nick
|
||||
$nick = $_SESSION["prepared_login_da"]['id_user'];
|
||||
// Code
|
||||
$code = (string) get_parameter_post ("auth_code");
|
||||
|
||||
|
||||
if (!empty($code)) {
|
||||
$result = validate_double_auth_code($nick, $code);
|
||||
|
||||
|
||||
if ($result === true) {
|
||||
// Double auth success
|
||||
$double_auth_success = true;
|
||||
|
@ -231,7 +231,7 @@ if (! isset ($config['id_user'])) {
|
|||
$login_screen = 'double_auth';
|
||||
// Error message
|
||||
$config["auth_error"] = __("Invalid code");
|
||||
|
||||
|
||||
if (!isset($_SESSION['prepared_login_da']['attempts']))
|
||||
$_SESSION['prepared_login_da']['attempts'] = 0;
|
||||
$_SESSION['prepared_login_da']['attempts']++;
|
||||
|
@ -242,7 +242,7 @@ if (! isset ($config['id_user'])) {
|
|||
$login_screen = 'double_auth';
|
||||
// Error message
|
||||
$config["auth_error"] = __("The code shouldn't be empty");
|
||||
|
||||
|
||||
if (!isset($_SESSION['prepared_login_da']['attempts']))
|
||||
$_SESSION['prepared_login_da']['attempts'] = 0;
|
||||
$_SESSION['prepared_login_da']['attempts']++;
|
||||
|
@ -251,7 +251,7 @@ if (! isset ($config['id_user'])) {
|
|||
else {
|
||||
// Expired login
|
||||
unset ($_SESSION['prepared_login_da']);
|
||||
|
||||
|
||||
// Error message
|
||||
$config["auth_error"] = __('Expired login');
|
||||
}
|
||||
|
@ -259,7 +259,7 @@ if (! isset ($config['id_user'])) {
|
|||
else {
|
||||
// If the code doesn't exist, remove the prepared login
|
||||
unset ($_SESSION['prepared_login_da']);
|
||||
|
||||
|
||||
// Error message
|
||||
$config["auth_error"] = __('Login error');
|
||||
}
|
||||
|
@ -269,10 +269,10 @@ if (! isset ($config['id_user'])) {
|
|||
// Error message
|
||||
$config["auth_error"] = __('Login error');
|
||||
}
|
||||
|
||||
|
||||
// Remove the authenticator code
|
||||
unset ($_POST['auth_code'], $code);
|
||||
|
||||
|
||||
if (!$double_auth_success) {
|
||||
$login_failed = true;
|
||||
require_once ('general/login_page.php');
|
||||
|
@ -288,15 +288,10 @@ if (! isset ($config['id_user'])) {
|
|||
$nick_in_db = $_SESSION["prepared_login_da"]['id_user'];
|
||||
$expired_pass = false;
|
||||
}
|
||||
else if (($config['auth'] == 'saml') && $login_button_saml) {
|
||||
if (is_user_admin($nick)) {
|
||||
$nick_in_db = $nick;
|
||||
}
|
||||
else {
|
||||
include_once(ENTERPRISE_DIR . "/include/auth/saml.php");
|
||||
$saml_user_id = saml_process_user_login();
|
||||
$nick_in_db = $saml_user_id;
|
||||
}
|
||||
else if (($config['auth'] == 'saml') && $login_button_saml && !is_user_admin($nick)) {
|
||||
include_once(ENTERPRISE_DIR . "/include/auth/saml.php");
|
||||
$saml_user_id = saml_process_user_login();
|
||||
$nick_in_db = $saml_user_id;
|
||||
}
|
||||
else {
|
||||
// process_user_login is a virtual function which should be defined in each auth file.
|
||||
|
@ -304,27 +299,27 @@ if (! isset ($config['id_user'])) {
|
|||
// The auth file can set $config["auth_error"] to an informative error output or reference their internal error messages to it
|
||||
// process_user_login should return false in case of errors or invalid login, the nickname if correct
|
||||
$nick_in_db = process_user_login ($nick, $pass);
|
||||
|
||||
|
||||
$expired_pass = false;
|
||||
|
||||
|
||||
if (($nick_in_db != false) && ((!is_user_admin($nick)
|
||||
|| $config['enable_pass_policy_admin']))
|
||||
&& (defined('PANDORA_ENTERPRISE'))
|
||||
&& ($config['enable_pass_policy'])) {
|
||||
include_once(ENTERPRISE_DIR . "/include/auth/mysql.php");
|
||||
|
||||
|
||||
$blocked = login_check_blocked($nick);
|
||||
|
||||
|
||||
if ($blocked) {
|
||||
require_once ('general/login_page.php');
|
||||
db_pandora_audit("Password expired", "Password expired: ".$nick, $nick);
|
||||
while (@ob_end_flush ());
|
||||
exit ("</html>");
|
||||
}
|
||||
|
||||
|
||||
//Checks if password has expired
|
||||
$check_status = check_pass_status($nick, $pass);
|
||||
|
||||
|
||||
switch ($check_status) {
|
||||
case PASSSWORD_POLICIES_FIRST_CHANGE: //first change
|
||||
case PASSSWORD_POLICIES_EXPIRED: //pass expired
|
||||
|
@ -334,10 +329,10 @@ if (! isset ($config['id_user'])) {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (($nick_in_db !== false) && $expired_pass) {
|
||||
//login ok and password has expired
|
||||
|
||||
|
||||
require_once ('general/login_page.php');
|
||||
db_pandora_audit("Password expired",
|
||||
"Password expired: " . $nick, $nick);
|
||||
|
@ -346,7 +341,7 @@ if (! isset ($config['id_user'])) {
|
|||
}
|
||||
else if (($nick_in_db !== false) && (!$expired_pass)) {
|
||||
//login ok and password has not expired
|
||||
|
||||
|
||||
// Double auth check
|
||||
if ((!isset ($double_auth_success) || !$double_auth_success) && is_double_auth_enabled($nick_in_db)) {
|
||||
// Store this values in the session to know if the user login was correct
|
||||
|
@ -355,24 +350,24 @@ if (! isset ($config['id_user'])) {
|
|||
'timestamp' => time(),
|
||||
'attempts' => 0
|
||||
);
|
||||
|
||||
|
||||
// Load the page to introduce the double auth code
|
||||
$login_screen = 'double_auth';
|
||||
require_once ('general/login_page.php');
|
||||
while (@ob_end_flush ());
|
||||
exit ("</html>");
|
||||
}
|
||||
|
||||
|
||||
//login ok and password has not expired
|
||||
$process_login = true;
|
||||
|
||||
|
||||
echo "<script type='text/javascript'>var process_login_ok = 1;</script>";
|
||||
|
||||
|
||||
if (!isset($_GET["sec2"]) && !isset($_GET["sec"])) {
|
||||
// Avoid the show homepage when the user go to
|
||||
// a specific section of pandora
|
||||
// for example when timeout the sesion
|
||||
|
||||
|
||||
unset ($_GET["sec2"]);
|
||||
$_GET["sec"] = "general/logon_ok";
|
||||
$home_page ='';
|
||||
|
@ -424,24 +419,24 @@ if (! isset ($config['id_user'])) {
|
|||
$_GET["sec"] = "general/logon_ok";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
db_logon ($nick_in_db, $_SERVER['REMOTE_ADDR']);
|
||||
$_SESSION['id_usuario'] = $nick_in_db;
|
||||
$config['id_user'] = $nick_in_db;
|
||||
|
||||
|
||||
//==========================================================
|
||||
//-------- SET THE CUSTOM CONFIGS OF USER ------------------
|
||||
|
||||
|
||||
config_user_set_custom_config();
|
||||
//==========================================================
|
||||
|
||||
|
||||
//Remove everything that might have to do with people's passwords or logins
|
||||
unset ($pass, $login_good);
|
||||
|
||||
|
||||
$user_language = get_user_language($config['id_user']);
|
||||
|
||||
|
||||
$l10n = NULL;
|
||||
if (file_exists ('./include/languages/' . $user_language . '.mo')) {
|
||||
$l10n = new gettext_reader (new CachedFileReader ('./include/languages/'.$user_language.'.mo'));
|
||||
|
@ -450,11 +445,11 @@ if (! isset ($config['id_user'])) {
|
|||
}
|
||||
else { //login wrong
|
||||
$blocked = false;
|
||||
|
||||
|
||||
if ((!is_user_admin($nick) || $config['enable_pass_policy_admin']) && defined('PANDORA_ENTERPRISE')) {
|
||||
$blocked = login_check_blocked($nick);
|
||||
}
|
||||
|
||||
|
||||
if (!$blocked) {
|
||||
if (defined('PANDORA_ENTERPRISE')) {
|
||||
login_check_failed($nick); //Checks failed attempts
|
||||
|
@ -477,7 +472,7 @@ if (! isset ($config['id_user'])) {
|
|||
elseif (isset ($_GET["loginhash"])) {
|
||||
$loginhash_data = get_parameter("loginhash_data", "");
|
||||
$loginhash_user = str_rot13(get_parameter("loginhash_user", ""));
|
||||
|
||||
|
||||
if ($config["loginhash_pwd"] != "" && $loginhash_data == md5($loginhash_user.io_output_password($config["loginhash_pwd"]))) {
|
||||
db_logon ($loginhash_user, $_SERVER['REMOTE_ADDR']);
|
||||
$_SESSION['id_usuario'] = $loginhash_user;
|
||||
|
@ -530,12 +525,12 @@ extensions_load_extensions ($process_login);
|
|||
if ($process_login) {
|
||||
/* Call all extensions login function */
|
||||
extensions_call_login_function ();
|
||||
|
||||
|
||||
unset($_SESSION['new_update']);
|
||||
|
||||
|
||||
require_once("include/functions_update_manager.php");
|
||||
enterprise_include_once("include/functions_update_manager.php");
|
||||
|
||||
|
||||
if ($config["autoupdate"] == 1) {
|
||||
if (enterprise_installed()) {
|
||||
$result = update_manager_check_online_enterprise_packages_available();
|
||||
|
@ -545,12 +540,12 @@ if ($process_login) {
|
|||
}
|
||||
if ($result)
|
||||
$_SESSION['new_update'] = 'new';
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
//Set the initial global counter for chat.
|
||||
users_get_last_global_counter('session');
|
||||
|
||||
|
||||
$config['logged'] = true;
|
||||
}
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -564,7 +559,7 @@ if (isset($_SERVER['HTTP_REFERER']))
|
|||
$chunks = explode('?', $old_page);
|
||||
if (count($chunks) == 2) {
|
||||
$chunks = explode('&', $chunks[1]);
|
||||
|
||||
|
||||
foreach ($chunks as $chunk) {
|
||||
if (strstr($chunk, 'sec=') !== false) {
|
||||
$old_sec = str_replace('sec=', '', $chunk);
|
||||
|
@ -599,15 +594,15 @@ if ($old_global_counter_chat != $now_global_counter_chat) {
|
|||
if (get_parameter ('login', 0) !== 0) {
|
||||
// Display news dialog
|
||||
include_once("general/news_dialog.php");
|
||||
|
||||
|
||||
// Display login help info dialog
|
||||
// If it's configured to not skip this
|
||||
if (!isset($config['skip_login_help_dialog']) ||
|
||||
$config['skip_login_help_dialog'] == 0) {
|
||||
|
||||
|
||||
include_once("general/login_help_dialog.php");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
// Header
|
||||
|
@ -643,7 +638,7 @@ if ($searchPage) {
|
|||
}
|
||||
else {
|
||||
if ($page != "") {
|
||||
|
||||
|
||||
$main_sec = get_sec($sec);
|
||||
if ($main_sec == false) {
|
||||
if ($sec == 'extensions')
|
||||
|
@ -657,19 +652,19 @@ else {
|
|||
$sec2 = '';
|
||||
}
|
||||
$page .= '.php';
|
||||
|
||||
|
||||
// Enterprise ACL check
|
||||
if (enterprise_hook ('enterprise_acl',
|
||||
array ($config['id_user'], $main_sec, $sec, true,$sec2)) == false) {
|
||||
|
||||
|
||||
require ("general/noaccess.php");
|
||||
|
||||
|
||||
}
|
||||
else {
|
||||
$sec = $main_sec;
|
||||
if (file_exists ($page)) {
|
||||
if (! extensions_is_extension ($page)) {
|
||||
|
||||
|
||||
require_once($page);
|
||||
}
|
||||
else {
|
||||
|
@ -678,12 +673,12 @@ else {
|
|||
else
|
||||
extensions_call_main_function (basename ($page));
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
ui_print_error_message(__('Sorry! I can\'t find the page!'));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
//home screen chosen by the user
|
||||
$home_page ='';
|
||||
|
@ -692,9 +687,9 @@ else {
|
|||
$home_page = io_safe_output($user_info['section']);
|
||||
$home_url = $user_info['data_section'];
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if ($home_page != '') {
|
||||
switch ($home_page) {
|
||||
case 'Event list':
|
||||
|
@ -726,7 +721,7 @@ else {
|
|||
if (($home_url == '') || ($id_visualc == false)) {
|
||||
$str = 'sec=visualc&sec2=operation/visual_console/index&refr=60';
|
||||
}
|
||||
else
|
||||
else
|
||||
$str = 'sec=visualc&sec2=operation/visual_console/render_view&id='.$id_visualc .'&refr=60';
|
||||
parse_str($str, $res);
|
||||
foreach ($res as $key => $param) {
|
||||
|
@ -742,7 +737,7 @@ else {
|
|||
}
|
||||
if (isset($_GET['sec2'])) {
|
||||
$file = $_GET['sec2'] . '.php';
|
||||
|
||||
|
||||
if (!file_exists ($file)) {
|
||||
unset($_GET['sec2']);
|
||||
require('general/logon_ok.php');
|
||||
|
@ -803,15 +798,15 @@ require('include/php_to_js_values.php');
|
|||
<script type="text/javascript" language="javascript">
|
||||
//Initial load of page
|
||||
$(document).ready(adjustFooter);
|
||||
|
||||
|
||||
//Every resize of window
|
||||
$(window).resize(adjustFooter);
|
||||
|
||||
|
||||
//Every show/hide call may need footer re-layout
|
||||
(function() {
|
||||
var oShow = jQuery.fn.show;
|
||||
var oHide = jQuery.fn.hide;
|
||||
|
||||
|
||||
jQuery.fn.show = function () {
|
||||
var rv = oShow.apply(this, arguments);
|
||||
adjustFooter();
|
||||
|
@ -823,7 +818,7 @@ require('include/php_to_js_values.php');
|
|||
return rv;
|
||||
};
|
||||
})();
|
||||
|
||||
|
||||
//Dynamically assign footer position and width.
|
||||
function adjustFooter() {
|
||||
/*
|
||||
|
|
|
@ -63,7 +63,7 @@
|
|||
<div style='height: 10px'>
|
||||
<?php
|
||||
$version = '6.1dev';
|
||||
$build = '160329';
|
||||
$build = '160420';
|
||||
$banner = "v$version Build $build";
|
||||
|
||||
error_reporting(0);
|
||||
|
|
|
@ -124,7 +124,7 @@ if (!empty ($export_btn) && !empty ($module)) {
|
|||
}
|
||||
|
||||
$work_end = $end - $period + $work_period;
|
||||
$work_start = $end - $work_period;
|
||||
$work_start = $work_end - $work_period;
|
||||
//Buffer to get data, anyway this will report a memory exhaustin
|
||||
|
||||
$flag_last_time_slice = false;
|
||||
|
@ -166,7 +166,14 @@ if (!empty ($export_btn) && !empty ($module)) {
|
|||
$output .= $divider;
|
||||
$output .= $module['data'];
|
||||
$output .= $divider;
|
||||
$output .= date ("Y-m-d G:i:s", $work_start ) . ' - ' . date ("Y-m-d G:i:s", $module['utimestamp']);
|
||||
switch($export_type) {
|
||||
case "data":
|
||||
$output .= date("Y-m-d G:i:s", $module['utimestamp']);
|
||||
break;
|
||||
case "avg":
|
||||
$output .= date ("Y-m-d G:i:s", $work_start) . ' - ' . date ("Y-m-d G:i:s", $work_end);
|
||||
break;
|
||||
}
|
||||
$output .= $rowend;
|
||||
}
|
||||
|
||||
|
@ -196,6 +203,7 @@ if (!empty ($export_btn) && !empty ($module)) {
|
|||
else {
|
||||
$work_end = $work_end + $work_period;
|
||||
}
|
||||
$work_start = $work_end - $work_period;
|
||||
}
|
||||
unset ($output);
|
||||
$output = "";
|
||||
|
|
|
@ -201,6 +201,14 @@ switch ($config["dbtype"]) {
|
|||
break;
|
||||
}
|
||||
|
||||
if (empty ($address_by_user_groups)) {
|
||||
$address_by_user_groups = array ();
|
||||
array_unshift ($address_by_user_groups, "\"\"");
|
||||
}
|
||||
if (empty ($all_address_agents)) {
|
||||
$all_address_agents = array ();
|
||||
array_unshift ($all_address_agents, "\"\"");
|
||||
}
|
||||
|
||||
//Make query to extract traps of DB.
|
||||
switch ($config["dbtype"]) {
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#
|
||||
%define name pandorafms_console
|
||||
%define version 6.1dev
|
||||
%define release 160329
|
||||
%define release 160420
|
||||
|
||||
# User and Group under which Apache is running
|
||||
%define httpd_name httpd
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#
|
||||
%define name pandorafms_console
|
||||
%define version 6.1dev
|
||||
%define release 160329
|
||||
%define release 160420
|
||||
%define httpd_name httpd
|
||||
# User and Group under which Apache is running
|
||||
%define httpd_name apache2
|
||||
|
|
|
@ -65,7 +65,7 @@ INSERT INTO tconfig (token, value) VALUES ('graph_res','5');
|
|||
INSERT INTO tconfig (token, value) VALUES ('step_compact','1');
|
||||
INSERT INTO tconfig (token, value) VALUES ('db_scheme_first_version','6.0orc');
|
||||
INSERT INTO tconfig (token, value) VALUES('db_scheme_version','6.1dev');
|
||||
INSERT INTO tconfig (token, value) VALUES('db_scheme_build','PD160329');
|
||||
INSERT INTO tconfig (token, value) VALUES('db_scheme_build','PD160420');
|
||||
INSERT INTO tconfig (token, value) VALUES ('show_unknown','0');
|
||||
INSERT INTO tconfig (token, value) VALUES ('show_lastalerts','1');
|
||||
INSERT INTO tconfig (token, value) VALUES ('style','pandora');
|
||||
|
|
|
@ -150,7 +150,7 @@ CREATE TABLE IF NOT EXISTS `tagente_estado` (
|
|||
`current_interval` int(8) unsigned NOT NULL default '0',
|
||||
`running_by` smallint(4) unsigned default '0',
|
||||
`last_execution_try` bigint(20) NOT NULL default '0',
|
||||
`status_changes` tinyint(4) default 0,
|
||||
`status_changes` tinyint(4) unsigned default 0,
|
||||
`last_status` tinyint(4) default 0,
|
||||
`last_known_status` tinyint(4) default 0,
|
||||
`last_error` int(4) NOT NULL default '0',
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
package: pandorafms-server
|
||||
Version: 6.1dev-160329
|
||||
Version: 6.1dev-160420
|
||||
Architecture: all
|
||||
Priority: optional
|
||||
Section: admin
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
pandora_version="6.1dev-160329"
|
||||
pandora_version="6.1dev-160420"
|
||||
|
||||
package_cpan=0
|
||||
package_pandora=1
|
||||
|
|
|
@ -43,7 +43,7 @@ our @EXPORT = qw(
|
|||
|
||||
# version: Defines actual version of Pandora Server for this module only
|
||||
my $pandora_version = "6.1dev";
|
||||
my $pandora_build = "160329";
|
||||
my $pandora_build = "160420";
|
||||
our $VERSION = $pandora_version." ".$pandora_build;
|
||||
|
||||
# Setup hash
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#
|
||||
%define name pandorafms_server
|
||||
%define version 6.1dev
|
||||
%define release 160329
|
||||
%define release 160420
|
||||
|
||||
Summary: Pandora FMS Server
|
||||
Name: %{name}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#
|
||||
%define name pandorafms_server
|
||||
%define version 6.1dev
|
||||
%define release 160329
|
||||
%define release 160420
|
||||
|
||||
Summary: Pandora FMS Server
|
||||
Name: %{name}
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
# **********************************************************************
|
||||
|
||||
PI_VERSION="6.1dev"
|
||||
PI_BUILD="160329"
|
||||
PI_BUILD="160420"
|
||||
|
||||
MODE=$1
|
||||
if [ $# -gt 1 ]; then
|
||||
|
|
|
@ -33,7 +33,7 @@ use PandoraFMS::Tools;
|
|||
use PandoraFMS::DB;
|
||||
|
||||
# version: define current version
|
||||
my $version = "6.1dev PS160329";
|
||||
my $version = "6.1dev PS160420";
|
||||
|
||||
# Pandora server configuration
|
||||
my %conf;
|
||||
|
|
|
@ -35,7 +35,7 @@ use Encode::Locale;
|
|||
Encode::Locale::decode_argv;
|
||||
|
||||
# version: define current version
|
||||
my $version = "6.1dev PS160329";
|
||||
my $version = "6.1dev PS160420";
|
||||
|
||||
# save program name for logging
|
||||
my $progname = basename($0);
|
||||
|
@ -973,7 +973,6 @@ sub cli_delete_agent() {
|
|||
my $agent_name = @ARGV[2];
|
||||
|
||||
$agent_name = decode_entities($agent_name);
|
||||
print_log "[INFO] Deleting agent '$agent_name'\n\n";
|
||||
|
||||
if (is_metaconsole($conf) == 1) {
|
||||
my $agents_groups = enterprise_hook('get_metaconsole_agent',[$dbh, $agent_name]);
|
||||
|
@ -981,6 +980,7 @@ sub cli_delete_agent() {
|
|||
if (scalar(@{$agents_groups}) != 0) {
|
||||
foreach my $agent (@{$agents_groups}) {
|
||||
my $return = enterprise_hook('delete_metaconsole_agent',[$dbh,$agent->{'id_agente'}]);
|
||||
print_log "[INFO] Deleting agent '$agent_name' \n\n";
|
||||
}
|
||||
}
|
||||
my $servers = enterprise_hook('get_metaconsole_setup_servers',[$dbh]);
|
||||
|
@ -996,6 +996,7 @@ sub cli_delete_agent() {
|
|||
next;
|
||||
}
|
||||
else {
|
||||
print_log "[INFO] Deleting agent '$agent_name' in ID server: '$server'\n\n";
|
||||
pandora_delete_agent($dbh_metaconsole,$id_agent,$conf);
|
||||
}
|
||||
}
|
||||
|
@ -1005,6 +1006,7 @@ sub cli_delete_agent() {
|
|||
my $id_agent = get_agent_id($dbh,$agent_name);
|
||||
exist_check($id_agent,'agent',$agent_name);
|
||||
|
||||
print_log "[INFO] Deleting agent '$agent_name'\n\n";
|
||||
pandora_delete_agent($dbh,$id_agent,$conf);
|
||||
}
|
||||
}
|
||||
|
@ -3209,6 +3211,7 @@ sub cli_get_agent_group() {
|
|||
my $id_group = get_agent_group ($dbh_metaconsole, $id_agent);
|
||||
my $group_name = get_group_name ($dbh_metaconsole, $id_group);
|
||||
my $metaconsole_name = enterprise_hook('get_metaconsole_setup_server_name',[$dbh, $server]);
|
||||
$agent_name = safe_output($agent_name);
|
||||
print "[INFO] Server: $metaconsole_name Agent: $agent_name Name Group: $group_name\n\n";
|
||||
}
|
||||
}
|
||||
|
@ -3257,6 +3260,7 @@ sub cli_get_agent_group_id() {
|
|||
}
|
||||
else {
|
||||
my $id_group = get_agent_group ($dbh_metaconsole, $id_agent);
|
||||
$agent_name = safe_output($agent_name);
|
||||
print "Server: $metaconsole_name Agent: $agent_name ID Group: $id_group\n\n";
|
||||
}
|
||||
}
|
||||
|
@ -3881,7 +3885,7 @@ sub cli_locate_agent () {
|
|||
}
|
||||
}
|
||||
|
||||
if (defined(@list_servers)) {
|
||||
if (scalar(@list_servers) > 0) {
|
||||
$list_names_servers = join(',',@list_servers);
|
||||
print_log "[INFO] The agent: $agent_name find in server with IDS: $list_names_servers\n\n";
|
||||
}
|
||||
|
|
|
@ -24,6 +24,12 @@
|
|||
# Description: Tentacle Server startup script
|
||||
### END INIT INFO
|
||||
|
||||
# Uses a wait limit before sending a KILL signal, before trying to stop
|
||||
# Pandora FMS server nicely. Some big systems need some time before close
|
||||
# all pending tasks / threads.
|
||||
|
||||
export MAXWAIT=60
|
||||
|
||||
# Check for SUSE status scripts
|
||||
if [ -f /etc/rc.status ]
|
||||
then
|
||||
|
@ -51,6 +57,16 @@ function get_pid {
|
|||
echo $TENTACLE_PID
|
||||
}
|
||||
|
||||
function get_all_pid {
|
||||
# This sets COLUMNS to XXX chars, because if command is run
|
||||
# in a "strech" term, ps aux don't report more than COLUMNS
|
||||
# characters and this will not work.
|
||||
COLUMNS=300
|
||||
TENTACLE_PIDS=`ps aux | grep "$TENTACLE_PATH$TENTACLE_DAEMON" | grep -v grep | awk '{ print $2 }'`
|
||||
TENTACLE_PID="${TENTACLE_PIDS//\\n/' '}"
|
||||
echo $TENTACLE_PID
|
||||
}
|
||||
|
||||
# Pandora server settings
|
||||
PANDORA_SERVER_PATH="/var/spool/pandora/data_in"
|
||||
|
||||
|
@ -110,20 +126,31 @@ case "$1" in
|
|||
;;
|
||||
|
||||
stop)
|
||||
TENTACLE_PID=`get_pid`
|
||||
TENTACLE_PID=`get_all_pid`
|
||||
if [ -z "$TENTACLE_PID" ]; then
|
||||
echo "Tentacle Server does not seem to be running"
|
||||
rc_exit # running stop on a service already stopped or not running
|
||||
else
|
||||
kill $TENTACLE_PID
|
||||
sleep 1
|
||||
_PID=`get_pid`
|
||||
|
||||
COUNTER=0
|
||||
while [ $COUNTER -lt $MAXWAIT ]
|
||||
do
|
||||
_PID=`get_all_pid`
|
||||
if [ "$_PID" != "$TENTACLE_PID" ]
|
||||
# tentacle already stopped
|
||||
then
|
||||
COUNTER=$MAXWAIT
|
||||
fi
|
||||
COUNTER=`expr $COUNTER + 1`
|
||||
sleep 1
|
||||
done
|
||||
|
||||
if [ "$_PID" = "$TENTACLE_PID" ]; then
|
||||
echo "Tentacle Server could not be stopped"
|
||||
rc_failed
|
||||
if [ "$_PID" = "$TENTACLE_PID" ]
|
||||
then
|
||||
kill -9 $TENTACLE_PID > /dev/null 2>&1
|
||||
fi
|
||||
|
||||
|
||||
echo "Stopping Tentacle Server"
|
||||
rc_status -v
|
||||
fi
|
||||
|
|
Loading…
Reference in New Issue