Merge branch 'develop' into feature/new_networkmap

Conflicts:
	pandora_console/include/functions_modules.php
This commit is contained in:
mdtrooper 2016-04-25 15:25:16 +02:00
commit 30f806f41c
50 changed files with 1048 additions and 251 deletions

View File

@ -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

View File

@ -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

View File

@ -1,5 +1,5 @@
package: pandorafms-agent-unix
Version: 6.1dev-160329
Version: 6.1dev-160420
Architecture: all
Priority: optional
Section: admin

View File

@ -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

View File

@ -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 => {

View File

@ -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}

View File

@ -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}

View File

@ -10,7 +10,7 @@
# **********************************************************************
PI_VERSION="6.1dev"
PI_BUILD="160329"
PI_BUILD="160420"
OS_NAME=`uname -s`
FORCE=0

View File

@ -186,7 +186,7 @@ UpgradeApplicationID
{}
Version
{160329}
{160420}
ViewReadme
{Yes}

View File

@ -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;

View File

@ -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

View File

@ -1,5 +1,5 @@
package: pandorafms-console
Version: 6.1dev-160329
Version: 6.1dev-160420
Architecture: all
Priority: optional
Section: admin

View File

@ -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

View File

@ -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_:&#x20;_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&#x20;IMS&#x20;API&#x20;path\",\"Integria&#x20;IMS&#x20;API&#x20;pass\",\"Integria&#x20;IMS&#x20;user\",\"Integria&#x20;IMS&#x20;user&#x20;pass\",\"Ticket&#x20;title\",\"Ticket&#x20;group&#x20;ID\",\"Ticket&#x20;priority\",\"Email&#x20;copy\",\"Ticket&#x20;owner\",\"Ticket&#x20;description\"]', `fields_values` = '[\"\",\"\",\"\",\"\",\"\",\"\",\"10,Maintenance;0,Informative;1,Low;2,Medium;3,Serious;4,Very&#x20;Serious\",\"\",\"\",\"\"]' WHERE `id` = 11 AND `name` = 'Integria&#x20;IMS&#x20;Ticket';

View File

@ -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_:&#x20;_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&#x20;IMS&#x20;API&#x20;path\",\"Integria&#x20;IMS&#x20;API&#x20;pass\",\"Integria&#x20;IMS&#x20;user\",\"Integria&#x20;IMS&#x20;user&#x20;pass\",\"Ticket&#x20;title\",\"Ticket&#x20;group&#x20;ID\",\"Ticket&#x20;priority\",\"Email&#x20;copy\",\"Ticket&#x20;owner\",\"Ticket&#x20;description\"]', fields_values = '[\"\",\"\",\"\",\"\",\"\",\"\",\"10,Maintenance;0,Informative;1,Low;2,Medium;3,Serious;4,Very&#x20;Serious\",\"\",\"\",\"\"]' WHERE id = 11 AND name = 'Integria&#x20;IMS&#x20;Ticket';

View File

@ -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

View File

@ -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 ();

View File

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

View File

@ -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");

View File

@ -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(

View File

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

View File

@ -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.

View File

@ -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);
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;
$where .= "\n\n" . $where_tags;
}
$sql = sprintf ('SELECT %s%s
FROM tagente_modulo

View File

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

View File

@ -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') {

View File

@ -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;

View File

@ -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) {

View File

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

View File

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

View File

@ -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)) {

View File

@ -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;
}
// 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;
}

View File

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

View File

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

View File

@ -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.

View File

@ -63,7 +63,7 @@
<div style='height: 10px'>
<?php
$version = '6.1dev';
$build = '160329';
$build = '160420';
$banner = "v$version Build $build";
error_reporting(0);

View File

@ -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 = "";

View File

@ -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"]) {

View File

@ -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

View File

@ -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

View File

@ -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');

View File

@ -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',

View File

@ -1,5 +1,5 @@
package: pandorafms-server
Version: 6.1dev-160329
Version: 6.1dev-160420
Architecture: all
Priority: optional
Section: admin

View File

@ -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

View File

@ -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

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_server
%define version 6.1dev
%define release 160329
%define release 160420
Summary: Pandora FMS Server
Name: %{name}

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_server
%define version 6.1dev
%define release 160329
%define release 160420
Summary: Pandora FMS Server
Name: %{name}

View File

@ -9,7 +9,7 @@
# **********************************************************************
PI_VERSION="6.1dev"
PI_BUILD="160329"
PI_BUILD="160420"
MODE=$1
if [ $# -gt 1 ]; then

View File

@ -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;

View File

@ -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";
}

View File

@ -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,18 +126,29 @@ 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`
if [ "$_PID" = "$TENTACLE_PID" ]; then
echo "Tentacle Server could not be stopped"
rc_failed
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
kill -9 $TENTACLE_PID > /dev/null 2>&1
fi
echo "Stopping Tentacle Server"