Merge branch 'pandora_6.0' of https://brutus.artica.lan:8081/artica/pandorafms into pandora_6.0

This commit is contained in:
Arturo Gonzalez 2016-11-29 15:31:53 +01:00
commit 8fb111952c
41 changed files with 2145 additions and 516 deletions

View File

@ -1,5 +1,5 @@
package: pandorafms-agent-unix package: pandorafms-agent-unix
Version: 6.0SP4-161125 Version: 6.0SP4-161129
Architecture: all Architecture: all
Priority: optional Priority: optional
Section: admin Section: admin

View File

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

View File

@ -41,7 +41,7 @@ my $Sem = undef;
my $ThreadSem = undef; my $ThreadSem = undef;
use constant AGENT_VERSION => '6.0SP4'; use constant AGENT_VERSION => '6.0SP4';
use constant AGENT_BUILD => '161125'; use constant AGENT_BUILD => '161129';
# Agent log default file size maximum and instances # Agent log default file size maximum and instances
use constant DEFAULT_MAX_LOG_SIZE => 600000; use constant DEFAULT_MAX_LOG_SIZE => 600000;
@ -135,6 +135,7 @@ my %DefaultConf = (
'agent_name_cmd' => '', 'agent_name_cmd' => '',
'description' => '', 'description' => '',
'group' => '', 'group' => '',
'group_password' => undef,
'encoding' => 'UTF-8', 'encoding' => 'UTF-8',
'server_port' => 41121, 'server_port' => 41121,
'transfer_mode' => 'tentacle', 'transfer_mode' => 'tentacle',
@ -2419,7 +2420,8 @@ while (1) {
# Compose the XML # Compose the XML
my $xml_header = "<?xml version='1.0' encoding='" . $Conf{'encoding'} . "'?>\n" . my $xml_header = "<?xml version='1.0' encoding='" . $Conf{'encoding'} . "'?>\n" .
"<agent_data description='" . $Conf{'description'} ."' group='" . $Conf{'group'} . "<agent_data description='" . $Conf{'description'} . "' group='" . $Conf{'group'} .
(defined($Conf{'group_password'}) ? ("' group_password='" . $Conf{'group_password'}) : '') .
"' os_name='$OS' os_version='$OS_VERSION' interval='" . $Conf{'interval'} . "' os_name='$OS' os_version='$OS_VERSION' interval='" . $Conf{'interval'} .
"' version='" . AGENT_VERSION . '(Build ' . AGENT_BUILD . ')' . ($Conf{'autotime'} eq '1' ? '' : "' timestamp='" . strftime ('%Y/%m/%d %H:%M:%S', localtime ())) . "' version='" . AGENT_VERSION . '(Build ' . AGENT_BUILD . ')' . ($Conf{'autotime'} eq '1' ? '' : "' timestamp='" . strftime ('%Y/%m/%d %H:%M:%S', localtime ())) .
"' agent_name='" . $Conf{'agent_name'} . "' timezone_offset='". $Conf{'timezone_offset'} . "' agent_name='" . $Conf{'agent_name'} . "' timezone_offset='". $Conf{'timezone_offset'} .

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_agent_unix %define name pandorafms_agent_unix
%define version 6.0SP4 %define version 6.0SP4
%define release 161125 %define release 161129
Summary: Pandora FMS Linux agent, PERL version Summary: Pandora FMS Linux agent, PERL version
Name: %{name} Name: %{name}

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_agent_unix %define name pandorafms_agent_unix
%define version 6.0SP4 %define version 6.0SP4
%define release 161125 %define release 161129
Summary: Pandora FMS Linux agent, PERL version Summary: Pandora FMS Linux agent, PERL version
Name: %{name} Name: %{name}

View File

@ -10,7 +10,7 @@
# ********************************************************************** # **********************************************************************
PI_VERSION="6.0SP4" PI_VERSION="6.0SP4"
PI_BUILD="161125" PI_BUILD="161129"
OS_NAME=`uname -s` OS_NAME=`uname -s`
FORCE=0 FORCE=0

View File

@ -186,7 +186,7 @@ UpgradeApplicationID
{} {}
Version Version
{161125} {161129}
ViewReadme ViewReadme
{Yes} {Yes}

View File

@ -30,7 +30,7 @@ using namespace Pandora;
using namespace Pandora_Strutils; using namespace Pandora_Strutils;
#define PATH_SIZE _MAX_PATH+1 #define PATH_SIZE _MAX_PATH+1
#define PANDORA_VERSION ("6.0SP4(Build 161125)") #define PANDORA_VERSION ("6.0SP4(Build 161129)")
string pandora_path; string pandora_path;
string pandora_dir; string pandora_dir;

View File

@ -385,6 +385,7 @@ Pandora_Windows_Service::getXmlHeader () {
char timestamp[20]; char timestamp[20];
string agent_name, os_name, os_version, encoding, value, xml, address, parent_agent_name, agent_name_cmd; string agent_name, os_name, os_version, encoding, value, xml, address, parent_agent_name, agent_name_cmd;
string custom_id, url_address, latitude, longitude, altitude, position_description, gis_exec, gis_result; string custom_id, url_address, latitude, longitude, altitude, position_description, gis_exec, gis_result;
string group_password;
time_t ctime; time_t ctime;
struct tm *ctime_tm = NULL; struct tm *ctime_tm = NULL;
int pos; int pos;
@ -478,6 +479,13 @@ Pandora_Windows_Service::getXmlHeader () {
xml += url_address; xml += url_address;
} }
// Get Url Address
group_password = conf->getValue ("group_password");
if (group_password != "") {
xml += "\" group_password=\"";
xml += group_password;
}
// Get Coordinates // Get Coordinates
gis_exec = conf->getValue ("gis_exec"); gis_exec = conf->getValue ("gis_exec");

View File

@ -11,7 +11,7 @@ BEGIN
VALUE "LegalCopyright", "Artica ST" VALUE "LegalCopyright", "Artica ST"
VALUE "OriginalFilename", "PandoraAgent.exe" VALUE "OriginalFilename", "PandoraAgent.exe"
VALUE "ProductName", "Pandora FMS Windows Agent" VALUE "ProductName", "Pandora FMS Windows Agent"
VALUE "ProductVersion", "(6.0SP4(Build 161125))" VALUE "ProductVersion", "(6.0SP4(Build 161129))"
VALUE "FileVersion", "1.0.0.0" VALUE "FileVersion", "1.0.0.0"
END END
END END

View File

@ -1,5 +1,5 @@
package: pandorafms-console package: pandorafms-console
Version: 6.0SP4-161125 Version: 6.0SP4-161129
Architecture: all Architecture: all
Priority: optional Priority: optional
Section: admin Section: admin

View File

@ -14,7 +14,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details. # GNU General Public License for more details.
pandora_version="6.0SP4-161125" pandora_version="6.0SP4-161129"
package_pear=0 package_pear=0
package_pandora=1 package_pandora=1

View File

@ -1015,7 +1015,7 @@ if ($update_module || $create_module) {
$throw_unknown_events = (bool)get_parameter('throw_unknown_events', false); $throw_unknown_events = (bool)get_parameter('throw_unknown_events', false);
//Set the event type that can show. //Set the event type that can show.
$disabled_types_event = array(EVENTS_GOING_UNKNOWN => (int)!$throw_unknown_events); $disabled_types_event = array(EVENTS_GOING_UNKNOWN => (int)$throw_unknown_events);
$disabled_types_event = io_json_mb_encode($disabled_types_event); $disabled_types_event = io_json_mb_encode($disabled_types_event);
$module_macro_names = (array) get_parameter('module_macro_names', array()); $module_macro_names = (array) get_parameter('module_macro_names', array());

View File

@ -30,7 +30,7 @@ if (is_ajax ()) {
$component = db_get_row ('tnetwork_component', 'id_nc', $id_component); $component = db_get_row ('tnetwork_component', 'id_nc', $id_component);
$component['throw_unknown_events'] = $component['throw_unknown_events'] =
!network_components_is_disable_type_event($id_component, EVENTS_GOING_UNKNOWN); network_components_is_disable_type_event($id_component, EVENTS_GOING_UNKNOWN);
// Decrypt passwords in the component. // Decrypt passwords in the component.
$component['plugin_pass'] = io_output_password($component['plugin_pass']); $component['plugin_pass'] = io_output_password($component['plugin_pass']);

View File

@ -403,13 +403,13 @@ $table_advanced->colspan[4][1] = 2;
// Code comes from module_editor // Code comes from module_editor
if ($__code_from == 'modules') { if ($__code_from == 'modules') {
$throw_unknown_events_check = $throw_unknown_events_check =
!modules_is_disable_type_event($id_agent_module, EVENTS_GOING_UNKNOWN); modules_is_disable_type_event($id_agent_module, EVENTS_GOING_UNKNOWN);
} }
else { else {
global $__id_pol_mod; global $__id_pol_mod;
$throw_unknown_events_check = $throw_unknown_events_check =
!policy_module_is_disable_type_event($__id_pol_mod, EVENTS_GOING_UNKNOWN); policy_module_is_disable_type_event($__id_pol_mod, EVENTS_GOING_UNKNOWN);
} }
$table_advanced->data[4][3] = __('Throw unknown events'); $table_advanced->data[4][3] = __('Throw unknown events');
$table_advanced->data[4][4] = html_print_checkbox('throw_unknown_events', $table_advanced->data[4][4] = html_print_checkbox('throw_unknown_events',

View File

@ -1066,7 +1066,7 @@ function process_manage_edit ($module_name, $agents_select = null) {
if ($throw_unknown_events !== '') { if ($throw_unknown_events !== '') {
//Set the event type that can show. //Set the event type that can show.
$disabled_types_event = array( $disabled_types_event = array(
EVENTS_GOING_UNKNOWN => (int)!$throw_unknown_events); EVENTS_GOING_UNKNOWN => (int)$throw_unknown_events);
$values['disabled_types_event'] = json_encode($disabled_types_event); $values['disabled_types_event'] = json_encode($disabled_types_event);
} }

View File

@ -135,7 +135,7 @@ $snmp3_security_level = (string) get_parameter('snmp3_security_level');
$throw_unknown_events = get_parameter('throw_unknown_events', false); $throw_unknown_events = get_parameter('throw_unknown_events', false);
//Set the event type that can show. //Set the event type that can show.
$disabled_types_event = array(EVENTS_GOING_UNKNOWN => (int)!$throw_unknown_events); $disabled_types_event = array(EVENTS_GOING_UNKNOWN => (int)$throw_unknown_events);
$disabled_types_event = json_encode($disabled_types_event); $disabled_types_event = json_encode($disabled_types_event);
$create_component = (bool) get_parameter ('create_component'); $create_component = (bool) get_parameter ('create_component');

View File

@ -22,7 +22,7 @@
/** /**
* Pandora build version and version * Pandora build version and version
*/ */
$build_version = 'PC161125'; $build_version = 'PC161129';
$pandora_version = 'v6.0SP4'; $pandora_version = 'v6.0SP4';
// Do not overwrite default timezone set if defined. // Do not overwrite default timezone set if defined.

View File

@ -466,6 +466,394 @@ function db_get_all_rows_sql($sql, $search_history_db = false, $cache = true, $d
} }
} }
/**
*
* Returns the time the module is in unknown status (by events)
*
* @param int $id_agente_modulo module to check
* @param int $tstart begin of search
* @param int $tend end of search
*
*/
function db_get_module_ranges_unknown($id_agente_modulo, $tstart = false, $tend = false) {
global $config;
if (!isset($id_agente_modulo)) {
return false;
}
if ((!isset($tstart)) || ($tstart === false)) {
// Return data from the begining
$tstart = 0;
}
if ((!isset($tend)) || ($tend === false)) {
// Return data until now
$tend = time();
}
if ($tstart > $tend) {
return false;
}
// Retrieve going unknown events in range
$query = "SELECT utimestamp,event_type FROM tevento WHERE id_agentmodule = " . $id_agente_modulo;
$query .= " AND event_type like 'going_%' ";
$query .= " AND utimestamp >= $tstart AND utimestamp <= $tend ";
$query .= " ORDER BY utimestamp ASC";
$events = db_get_all_rows_sql($query);
if (! is_array($events)){
return false;
}
$last_status = 0; // normal
$return = array();
$i=0;
foreach ($events as $event) {
switch ($event["event_type"]) {
case "going_up_critical":
case "going_up_warning":
case "going_up_normal": {
if ($last_status == 1) {
$return[$i]["time_to"] = $event["utimestamp"];
$i++;
$last_status = 0;
}
break;
}
case "going_unknown":{
if ($last_status == 0){
$return[$i] = array();
$return[$i]["time_from"] = $event["utimestamp"];
$last_status = 1;
}
break;
}
}
}
return $return;
}
/**
* Uncompresses and returns the data of a given id_agent_module
*
* @param int $id_agente_modulo id_agente_modulo
* @param utimestamp $tstart Begin of the catch
* @param utimestamp $tend End of the catch
* @param int $interval Size of slice (default-> module_interval)
*
* @return hash with the data uncompressed in blocks of module_interval
* false in case of empty result
*
* Note: All "unknown" data are marked as NULL
* Warning: Be careful with the amount of data, check your RAM size available
*
*/
function db_uncompress_module_data($id_agente_modulo, $tstart = false, $tend = false) {
global $config;
if (!isset($id_agente_modulo)) {
return false;
}
if ((!isset($tstart)) || ($tstart === false)) {
// Return data from the begining
$tstart = 0;
}
if ((!isset($tend)) || ($tend === false)) {
// Return data until now
$tend = time();
}
if ($tstart > $tend) {
return false;
}
$search_historydb = false;
$table = "tagente_datos";
$module = modules_get_agentmodule($id_agente_modulo);
if ($module === false){
// module not exists
return false;
}
$module_type = $module['id_tipo_modulo'];
$module_type_str = modules_get_type_name ($module_type);
if (strstr ($module_type_str, 'string') !== false) {
$table = "tagente_datos_string";
}
// Get first available utimestamp in active DB
$query = " SELECT utimestamp, datos FROM $table ";
$query .= " WHERE id_agente_modulo=$id_agente_modulo AND utimestamp < $tstart";
$query .= " ORDER BY utimestamp DESC LIMIT 1";
$ret = db_get_all_rows_sql( $query , $search_historydb);
if ( ( $ret === false ) || (( isset($ret[0]["utimestamp"]) && ($ret[0]["utimestamp"] > $tstart )))) {
// Value older than first retrieved from active DB
$search_historydb = true;
$ret = db_get_all_rows_sql( $query , $search_historydb);
}
else {
$first_data["utimestamp"] = $ret[0]["utimestamp"];
$first_data["datos"] = $ret[0]["datos"];
}
if ( ( $ret === false ) || (( isset($ret[0]["utimestamp"]) && ($ret[0]["utimestamp"] > $tstart )))) {
// No previous data. -> not init
// Avoid false unknown status
$first_data["utimestamp"] = time();
$first_data["datos"] = false;
}
else {
$first_data["utimestamp"] = $ret[0]["utimestamp"];
$first_data["datos"] = $ret[0]["datos"];
}
$query = " SELECT utimestamp, datos FROM $table ";
$query .= " WHERE id_agente_modulo=$id_agente_modulo AND utimestamp >= $tstart AND utimestamp <= $tend";
$query .= " ORDER BY utimestamp ASC";
// Retrieve all data from module in given range
$raw_data = db_get_all_rows_sql($query, $search_historydb);
if (($raw_data === false) && ($ret === false)) {
// No data
return false;
}
// Retrieve going unknown events in range
$unknown_events = db_get_module_ranges_unknown($id_agente_modulo, $tstart, $tend);
// Retrieve module_interval to build the template
$module_interval = modules_get_interval ($id_agente_modulo);
$slice_size = $module_interval;
// We'll return a bidimensional array
// Structure returned: schema:
//
// uncompressed_data =>
// pool_id (int)
// utimestamp (start of current slice)
// data
// array
// utimestamp
// datos
$return = array();
// Point current_timestamp to begin of the set and initialize flags
$current_timestamp = $tstart;
$last_inserted_value = $first_data["datos"];
$last_timestamp = $first_data["utimestamp"];
$data_found = 0;
// Build template
$pool_id = 0;
$now = time();
$in_unknown_status = 0;
if (is_array($unknown_events)) {
$current_unknown = array_shift($unknown_events);
}
while ( $current_timestamp < $tend ) {
$expected_data_generated = 0;
$return[$pool_id]["data"] = array();
$tmp_data = array();
$data_found = 0;
if (is_array($unknown_events)) {
$i = 0;
while ($current_timestamp >= $unknown_events[$i]["time_to"] ) {
// Skip unknown events in past
array_splice($unknown_events, $i,1);
$i++;
if (!isset($unknown_events[$i])) {
break;
}
}
if (isset($current_unknown)) {
// check if recovered from unknown status
if(is_array($unknown_events) && isset($current_unknown)) {
if ( (($current_timestamp+$slice_size) > $current_unknown["time_to"])
&& ($current_timestamp < $current_unknown["time_to"])
&& ($in_unknown_status == 1) ) {
// Recovered from unknown
if ( ($current_unknown["time_to"] > $current_timestamp)
&& ($expected_data_generated == 0) ) {
// also add the "expected" data
$tmp_data["utimestamp"] = $current_timestamp;
if ($in_unknown_status == 1) {
$tmp_data["datos"] = null;
}
else {
$tmp_data["datos"] = $last_inserted_value;
}
$return[$pool_id]["utimestamp"] = $current_timestamp;
array_push($return[$pool_id]["data"], $tmp_data);
$expected_data_generated = 1;
}
$tmp_data["utimestamp"] = $current_unknown["time_to"];
$tmp_data["datos"] = $last_inserted_value;
// debug purpose
//$tmp_data["obs"] = "event recovery data";
$return[$pool_id]["utimestamp"] = $current_timestamp;
array_push($return[$pool_id]["data"], $tmp_data);
$data_found = 1;
$in_unknown_status = 0;
}
if ( (($current_timestamp+$slice_size) > $current_unknown["time_from"])
&& (($current_timestamp+$slice_size) < $current_unknown["time_to"])
&& ($in_unknown_status == 0) ) {
// Add unknown state detected
if ( $current_unknown["time_from"] < ($current_timestamp+$slice_size)) {
if ( ($current_unknown["time_from"] > $current_timestamp)
&& ($expected_data_generated == 0) ) {
// also add the "expected" data
$tmp_data["utimestamp"] = $current_timestamp;
if ($in_unknown_status == 1) {
$tmp_data["datos"] = null;
}
else {
$tmp_data["datos"] = $last_inserted_value;
}
$return[$pool_id]["utimestamp"] = $current_timestamp;
array_push($return[$pool_id]["data"], $tmp_data);
$expected_data_generated = 1;
}
$tmp_data["utimestamp"] = $current_unknown["time_from"];
$tmp_data["datos"] = null;
// debug purpose
//$tmp_data["obs"] = "event data";
$return[$pool_id]["utimestamp"] = $current_timestamp;
array_push($return[$pool_id]["data"], $tmp_data);
$data_found = 1;
}
$in_unknown_status = 1;
}
if ( ($in_unknown_status == 0) && ($current_timestamp >= $current_unknown["time_to"]) ) {
$current_unknown = array_shift($unknown_events);
}
}
} // unknown events handle
}
// Search for data
$i=0;
if (is_array($raw_data)) {
foreach ($raw_data as $data) {
if ( ($data["utimestamp"] >= $current_timestamp)
&& ($data["utimestamp"] < ($current_timestamp+$slice_size)) ) {
// Data in block, push in, and remove from $raw_data (processed)
if ( ($data["utimestamp"] > $current_timestamp)
&& ($expected_data_generated == 0) ) {
// also add the "expected" data
$tmp_data["utimestamp"] = $current_timestamp;
if ($in_unknown_status == 1) {
$tmp_data["datos"] = null;
}
else {
$tmp_data["datos"] = $last_inserted_value;
}
//$tmp_data["obs"] = "expected data";
$return[$pool_id]["utimestamp"] = $current_timestamp;
array_push($return[$pool_id]["data"], $tmp_data);
$expected_data_generated = 1;
}
$tmp_data["utimestamp"] = intval($data["utimestamp"]);
$tmp_data["datos"] = $data["datos"];
// debug purpose
//$tmp_data["obs"] = "real data";
$return[$pool_id]["utimestamp"] = $current_timestamp;
array_push($return[$pool_id]["data"], $tmp_data);
$last_inserted_value = $data["datos"];
$last_timestamp = intval($data["utimestamp"]);
unset($raw_data[$i]);
$data_found = 1;
$in_unknown_status = 0;
}
elseif ($data["utimestamp"] > ($current_timestamp+$slice_size)) {
// Data in future, stop searching new ones
break;
}
}
$i++;
}
if ($data_found == 0) {
// No data found, lug the last_value until SECONDS_1DAY + 2*modules_get_interval
// UNKNOWN!
if (($current_timestamp > $now) || (($current_timestamp - $last_timestamp) > (SECONDS_1DAY + 2*$module_interval))) {
if (isset($last_inserted_value)) {
// unhandled unknown status control
$unhandled_time_unknown = $current_timestamp - (SECONDS_1DAY + 2*$module_interval) - $last_timestamp;
if ($unhandled_time_unknown > 0) {
// unhandled unknown status detected. Add to previous pool
$tmp_data["utimestamp"] = intval($last_timestamp) + (SECONDS_1DAY + 2*$module_interval);
$tmp_data["datos"] = null;
// debug purpose
//$tmp_data["obs"] = "unknown extra";
// add to previous pool if needed
if (isset($return[$pool_id-1])) {
array_push($return[$pool_id-1]["data"], $tmp_data);
}
}
}
$last_inserted_value = null;
}
$tmp_data["utimestamp"] = $current_timestamp;
if ($in_unknown_status == 1) {
$tmp_data["datos"] = null;
}
else {
$tmp_data["datos"] = $last_inserted_value;
}
// debug purpose
//$tmp_data["obs"] = "virtual data";
$return[$pool_id]["utimestamp"] = $current_timestamp;
array_push($return[$pool_id]["data"], $tmp_data);
}
$pool_id++;
$current_timestamp += $slice_size;
}
return $return;
}
/** /**
* Get all the rows of a table in the database that matches a filter. * Get all the rows of a table in the database that matches a filter.
* *

View File

@ -2130,7 +2130,9 @@ function graph_sla_slicebar ($id, $period, $sla_min, $sla_max, $date, $daysWeek
2 => COL_WARNING, 2 => COL_WARNING,
3 => COL_CRITICAL, 3 => COL_CRITICAL,
4 => COL_UNKNOWN, 4 => COL_UNKNOWN,
5 => $col_planned_downtime); 5 => "#ff8400",//COL_MINOR,
6 => COL_NOTINIT,
7 => "#ddd");//COL_MAJOR);
return slicesbar_graph($data, $period, $width, $height, $colors, return slicesbar_graph($data, $period, $width, $height, $colors,
$config['fontpath'], $round_corner, $home_url, $ttl); $config['fontpath'], $round_corner, $home_url, $ttl);

File diff suppressed because it is too large Load Diff

View File

@ -320,110 +320,316 @@ function reporting_html_SLA($table, $item, $mini) {
} }
} }
$table1 = new stdClass(); if(isset($item['data'])){
$table1->width = '99%'; $table1 = new stdClass();
$table1->width = '99%';
$table1->align = array(); $table1->align = array();
$table1->align[0] = 'left'; $table1->align[0] = 'left';
$table1->align[1] = 'left'; $table1->align[1] = 'left';
$table1->align[2] = 'right'; $table1->align[2] = 'right';
$table1->align[3] = 'right'; $table1->align[3] = 'right';
$table1->align[4] = 'right'; $table1->align[4] = 'right';
$table1->align[5] = 'right'; $table1->align[5] = 'right';
$table1->data = array (); $table1->data = array ();
$table1->head = array (); $table1->head = array ();
$table1->head[0] = __('Agent'); $table1->head[0] = __('Agent');
$table1->head[1] = __('Module'); $table1->head[1] = __('Module');
$table1->head[2] = __('Max/Min Values'); $table1->head[2] = __('Max/Min Values');
$table1->head[3] = __('SLA Limit'); $table1->head[3] = __('SLA Limit');
$table1->head[4] = __('SLA Compliance'); $table1->head[4] = __('SLA Compliance');
$table1->head[5] = __('Status'); $table1->head[5] = __('Status');
$table1->headstyle = array(); $table1->headstyle = array();
$table1->headstyle[2] = 'text-align: right'; $table1->headstyle[2] = 'text-align: right';
$table1->headstyle[3] = 'text-align: right'; $table1->headstyle[3] = 'text-align: right';
$table1->headstyle[4] = 'text-align: right'; $table1->headstyle[4] = 'text-align: right';
$table1->headstyle[5] = 'text-align: right'; $table1->headstyle[5] = 'text-align: right';
foreach ($item['data'] as $sla) { //second_table for time globals
$the_first_men_time = get_agent_first_time(io_safe_output($sla['agent'])); $table2 = new stdClass();
if (!$hide_notinit_agent) { $table2->width = '99%';
$row = array();
$row[] = $sla['agent'];
$row[] = $sla['module'];
$row[] = remove_right_zeros(number_format($sla['max'], $config['graph_precision'])) . " / " . remove_right_zeros(number_format($sla['min'], $config['graph_precision']));
$row[] = round($sla['sla_limit'], 2) . "%";
if ($sla['sla_value_unknown']) { $table2->align = array();
$row[] = '<span style="font: bold '.$font_size.'em Arial, Sans-serif; color: '.COL_UNKNOWN.';">' . $table2->align[0] = 'left';
__('N/A') . '</span>'; $table2->align[1] = 'left';
$row[] = '<span style="font: bold '.$font_size.'em Arial, Sans-serif; color: '.COL_UNKNOWN.';">' . $table2->align[2] = 'right';
__('Unknown') . '</span>'; $table2->align[3] = 'right';
} $table2->align[4] = 'right';
elseif ($sla['sla_status']) { $table2->align[5] = 'right';
$row[] = '<span style="font: bold '.$font_size.'em Arial, Sans-serif; color: '.COL_NORMAL.';">' . $table2->align[6] = 'right';
remove_right_zeros(number_format($sla['sla_value'], $config['graph_precision'])) . "%" . '</span>';
$row[] = '<span style="font: bold '.$font_size.'em Arial, Sans-serif; color: '.COL_NORMAL.';">' . $table2->data = array ();
__('OK') . '</span>';
} $table2->head = array ();
else { $table2->head[0] = __('Global Time');
$row[] = '<span style="font: bold '.$font_size.'em Arial, Sans-serif; color: '.COL_CRITICAL.';">' . $table2->head[1] = __('Time Total');
remove_right_zeros(number_format($sla['sla_value'], $config['graph_precision'])) . "%" . '</span>'; $table2->head[2] = __('Time Failed');
$row[] = '<span style="font: bold '.$font_size.'em Arial, Sans-serif; color: '.COL_CRITICAL.';">' . $table2->head[3] = __('Time OK');
__('Fail') . '</span>'; $table2->head[4] = __('Time Unknown');
} $table2->head[5] = __('Time Not Init');
} $table2->head[6] = __('Downtime');
else {
if ($item['date']['to'] > $the_first_men_time) { $table2->headstyle = array();
$row = array(); $table2->headstyle[2] = 'text-align: right';
$row[] = $sla['agent']; $table2->headstyle[3] = 'text-align: right';
$row[] = $sla['module']; $table2->headstyle[4] = 'text-align: right';
$row[] = remove_right_zeros(number_format($sla['max'], $config['graph_precision'])) . " / " . remove_right_zeros(number_format($sla['min'], $config['graph_precision'])); $table2->headstyle[5] = 'text-align: right';
$row[] = round($sla['sla_limit'], 2) . "%"; $table2->headstyle[6] = 'text-align: right';
//third_table for time globals
$table3 = new stdClass();
$table3->width = '99%';
$table3->align = array();
$table3->align[0] = 'left';
$table3->align[1] = 'left';
$table3->align[2] = 'right';
$table3->align[3] = 'right';
$table3->align[4] = 'right';
$table3->align[5] = 'right';
$table3->align[6] = 'right';
$table3->data = array ();
$table3->head = array ();
$table3->head[0] = __('Checks Time');
$table3->head[1] = __('Checks Total');
$table3->head[2] = __('Checks Failed');
$table3->head[3] = __('Checks OK');
$table3->head[4] = __('Checks Unknown');
$table3->headstyle = array();
$table3->headstyle[2] = 'text-align: right';
$table3->headstyle[3] = 'text-align: right';
$table3->headstyle[4] = 'text-align: right';
$table3->headstyle[5] = 'text-align: right';
foreach ($item['data'] as $sla) {
if(isset($sla)){
$the_first_men_time = get_agent_first_time(io_safe_output($sla['agent']));
if (!$hide_notinit_agent) {
//first_table
$row = array();
$row[] = $sla['agent'];
$row[] = $sla['module'];
if(is_numeric($sla['dinamic_text'])){
$row[] = remove_right_zeros(number_format($sla['max'], $config['graph_precision'])) . " / " .
remove_right_zeros(number_format($sla['min'], $config['graph_precision']));
}
else{
$row[] = $sla['dinamic_text'];
}
$row[] = round($sla['sla_limit'], 2) . "%";
if ($sla['sla_value_unknown']) {
$row[] = '<span style="font: bold '.$font_size.'em Arial, Sans-serif; color: '.COL_UNKNOWN.';">' .
__('N/A') . '</span>';
$row[] = '<span style="font: bold '.$font_size.'em Arial, Sans-serif; color: '.COL_UNKNOWN.';">' .
__('Unknown') . '</span>';
}
elseif ($sla['sla_status']) {
$row[] = '<span style="font: bold '.$font_size.'em Arial, Sans-serif; color: '.COL_NORMAL.';">' .
sla_truncate($sla['sla_value'], $config['graph_precision']) . "%" . '</span>';
$row[] = '<span style="font: bold '.$font_size.'em Arial, Sans-serif; color: '.COL_NORMAL.';">' .
__('OK') . '</span>';
}
else {
$row[] = '<span style="font: bold '.$font_size.'em Arial, Sans-serif; color: '.COL_CRITICAL.';">' .
sla_truncate($sla['sla_value'], $config['graph_precision']) . "%" . '</span>';
$row[] = '<span style="font: bold '.$font_size.'em Arial, Sans-serif; color: '.COL_CRITICAL.';">' .
__('Fail') . '</span>';
}
//second table for time globals
$row2 = array();
$row2[] = $sla['agent'] . ' -- [' . $sla['module'] . ']';
if($sla['time_total'] != 0)
$row2[] = human_time_description_raw($sla['time_total']);
else
$row2[] = '--';
if($sla['time_error'] != 0)
$row2[] = '<span style="color: '.COL_CRITICAL.';">' . human_time_description_raw($sla['time_error'], true) . '</span>';
else
$row2[] = '--';
if($sla['time_ok'] != 0)
$row2[] = '<span style="color: '.COL_NORMAL.';">' . human_time_description_raw($sla['time_ok'], true) . '</span>';
else
$row2[] = '--';
if($sla['time_unknown'] != 0)
$row2[] = '<span style="color: '.COL_UNKNOWN.';">' . human_time_description_raw($sla['time_unknown'], true) . '</span>';
else
$row2[] = '--';
if($sla['time_not_init'] != 0)
$row2[] = '<span style="color: '.COL_NOTINIT.';">' . human_time_description_raw($sla['time_not_init'], true) . '</span>';
else
$row2[] = '--';
if($sla['time_downtime'] != 0)
$row2[] = '<span style="color: #ff8400;">' . human_time_description_raw($sla['time_downtime'], true) . '</span>';
else
$row2[] = '--';
//third table for checks globals
$row3 = array();
$row3[] = $sla['agent'] . ' -- [' . $sla['module'] . ']';
$row3[] = $sla['checks_total'];
$row3[] = '<span style="color: '.COL_CRITICAL.';">' . $sla['checks_error'] . '</span>';
$row3[] = '<span style="color: '.COL_NORMAL.';">' . $sla['checks_ok'] . '</span>';
$row3[] = '<span style="color: '.COL_UNKNOWN.';">' . $sla['checks_unknown'] . '</span>';
if ($sla['sla_value_unknown']) {
$row[] = '<span style="font: bold '.$font_size.'em Arial, Sans-serif; color: '.COL_UNKNOWN.';">' .
__('N/A') . '</span>';
$row[] = '<span style="font: bold '.$font_size.'em Arial, Sans-serif; color: '.COL_UNKNOWN.';">' .
__('Unknown') . '</span>';
}
elseif ($sla['sla_status']) {
$row[] = '<span style="font: bold '.$font_size.'em Arial, Sans-serif; color: '.COL_NORMAL.';">' .
remove_right_zeros(number_format($sla['sla_value'], $config['graph_precision'])) . "%" . '</span>';
$row[] = '<span style="font: bold '.$font_size.'em Arial, Sans-serif; color: '.COL_NORMAL.';">' .
__('OK') . '</span>';
} }
else { else {
$row[] = '<span style="font: bold '.$font_size.'em Arial, Sans-serif; color: '.COL_CRITICAL.';">' . if ($item['date']['to'] > $the_first_men_time) {
remove_right_zeros(number_format($sla['sla_value'], $config['graph_precision'])) . "%" . '</span>'; //first_table
$row[] = '<span style="font: bold '.$font_size.'em Arial, Sans-serif; color: '.COL_CRITICAL.';">' . $row = array();
__('Fail') . '</span>'; $row[] = $sla['agent'];
$row[] = $sla['module'];
if(is_numeric($sla['dinamic_text'])){
$row[] = remove_right_zeros(number_format($sla['max'], $config['graph_precision'])) . " / " .
remove_right_zeros(number_format($sla['min'], $config['graph_precision']));
}
else{
$row[] = $sla['dinamic_text'];
}
$row[] = round($sla['sla_limit'], 2) . "%";
if ($sla['sla_value_unknown']) {
$row[] = '<span style="font: bold '.$font_size.'em Arial, Sans-serif; color: '.COL_UNKNOWN.';">' .
__('N/A') . '</span>';
$row[] = '<span style="font: bold '.$font_size.'em Arial, Sans-serif; color: '.COL_UNKNOWN.';">' .
__('Unknown') . '</span>';
}
elseif ($sla['sla_status']) {
$row[] = '<span style="font: bold '.$font_size.'em Arial, Sans-serif; color: '.COL_NORMAL.';">' .
sla_truncate($sla['sla_value'], $config['graph_precision']) . "%" . '</span>';
$row[] = '<span style="font: bold '.$font_size.'em Arial, Sans-serif; color: '.COL_NORMAL.';">' .
__('OK') . '</span>';
}
else {
$row[] = '<span style="font: bold '.$font_size.'em Arial, Sans-serif; color: '.COL_CRITICAL.';">' .
sla_truncate($sla['sla_value'], $config['graph_precision']) . "%" . '</span>';
$row[] = '<span style="font: bold '.$font_size.'em Arial, Sans-serif; color: '.COL_CRITICAL.';">' .
__('Fail') . '</span>';
}
//second table for time globals
$row2 = array();
$row2[] = $sla['agent'] . ' -- [' . $sla['module'] . ']';
if($sla['time_total'] != 0)
$row2[] = human_time_description_raw($sla['time_total']);
else
$row2[] = '--';
if($sla['time_error'] != 0)
$row2[] = '<span style="color: '.COL_CRITICAL.';">' . human_time_description_raw($sla['time_error'], true) . '</span>';
else
$row2[] = '--';
if($sla['time_ok'] != 0)
$row2[] = '<span style="color: '.COL_NORMAL.';">' . human_time_description_raw($sla['time_ok'], true) . '</span>';
else
$row2[] = '--';
if($sla['time_unknown'] != 0)
$row2[] = '<span style="color: '.COL_UNKNOWN.';">' . human_time_description_raw($sla['time_unknown'], true) . '</span>';
else
$row2[] = '--';
if($sla['time_not_init'] != 0)
$row2[] = '<span style="color: '.COL_NOTINIT.';">' . human_time_description_raw($sla['time_not_init'], true) . '</span>';
else
$row2[] = '--';
if($sla['time_downtime'] != 0)
$row2[] = '<span style="color: #ff8400;">' . human_time_description_raw($sla['time_downtime'], true) . '</span>';
else
$row2[] = '--';
//third table for checks globals
$row3 = array();
$row3[] = $sla['agent'] . ' -- [' . $sla['module'] . ']';
$row3[] = $sla['checks_total'];
$row3[] = '<span style="color: '.COL_CRITICAL.';">' . $sla['checks_error'] . '</span>';
$row3[] = '<span style="color: '.COL_NORMAL.';">' . $sla['checks_ok'] . '</span>';
$row3[] = '<span style="color: '.COL_UNKNOWN.';">' . $sla['checks_unknown'] . '</span>';
}
} }
$table1->data[] = $row;
$table2->data[] = $row2;
$table3->data[] = $row3;
} }
} }
$table1->data[] = $row; $table->colspan['sla']['cell'] = 2;
$table->data['sla']['cell'] = html_print_table($table1, true);
$table->colspan['time_global']['cell'] = 2;
$table->data['time_global']['cell'] = html_print_table($table2, true);
$table->colspan['checks_global']['cell'] = 2;
$table->data['checks_global']['cell'] = html_print_table($table3, true);
} }
$table->colspan['sla']['cell'] = 3;
$table->data['sla']['cell'] = html_print_table($table1, true);
if (!empty($item['charts'])) { if (!empty($item['charts'])) {
$table1 = new stdClass(); $table1 = new stdClass();
$table1->width = '99%'; $table1->width = '99%';
$table1->data = array (); $table1->data = array ();
if (!$hide_notinit_agent) {
foreach ($item['charts'] as $chart) { foreach ($item['charts'] as $chart) {
$table1->data[] = array( $table1->data[] = array(
$chart['agent'] . "<br />" . $chart['module'], $chart['agent'] . "<br />" . $chart['module'],
$chart['chart']); $chart['chart']);
}
} }
else{
$table->colspan['charts']['cell'] = 3; foreach ($item['charts'] as $chart) {
$the_first_men_time = get_agent_first_time(io_safe_output($chart['agent']));
if ($item['date']['to'] > $the_first_men_time) {
$table1->data[] = array(
$chart['agent'] . "<br />" . $chart['module'],
$chart['chart']);
}
}
}
$table->colspan['charts']['cell'] = 2;
$table->data['charts']['cell'] = html_print_table($table1, true); $table->data['charts']['cell'] = html_print_table($table1, true);
//table_legend_graphs;
$table1 = new stdClass();
$table1->width = '99%';
$table1->data = array ();
$table1->data[0][0] = '<div class="legend_graphs_sla" style="background-color:#80BA27"></div>';
$table1->data[0][0] .= '<span class="label_legend_graph">'.__('OK') . '</span>';
$table1->data[0][1] = '<div class="legend_graphs_sla" style="background-color:#FC4444"></div>';
$table1->data[0][1] .= '<span class="label_legend_graph">'.__('Critical'). '</span>';
$table1->data[0][2] = '<div class="legend_graphs_sla" style="background-color:#B2B2B2"></div>';
$table1->data[0][2] .= '<span class="label_legend_graph">'.__('Unknow'). '</span>';
$table1->data[0][3] = '<div class="legend_graphs_sla" style="background-color:#3BA0FF"></div>';
$table1->data[0][3] .= '<span class="label_legend_graph">'.__('Not Init'). '</span>';
$table1->data[0][4] = '<div class="legend_graphs_sla" style="background-color:#ff8400"></div>';
$table1->data[0][4] .= '<span class="label_legend_graph">'.__('Downtimes'). '</span>';
$table1->data[0][5] = '<div class="legend_graphs_sla" style="background-color:#ddd"></div>';
$table1->data[0][5] .= '<span class="label_legend_graph">'.__('Ignore time'). '</span>';
$table->colspan['legend']['cell'] = 2;
$table->data['legend']['cell'] = html_print_table($table1, true);
} }
} }
} }
@ -1718,29 +1924,71 @@ function reporting_html_availability(&$table, $item) {
else { else {
$table1->head[1] = __('Module'); $table1->head[1] = __('Module');
} }
$table1->head[2] = __('# Checks'); $table1->head[2] = __('Total time');
$table1->head[3] = __('# Failed'); $table1->head[3] = __('Time failed');
$table1->head[4] = __('% Fail'); $table1->head[4] = __('Time OK');
$table1->head[5] = __('Time available'); $table1->head[5] = __('Time Uknown');
$table1->head[6] = __('Time unavailable'); $table1->head[6] = __('Time Not Init Module');
$table1->head[7] = __('% Ok'); $table1->head[7] = __('Time Downtime');
$table1->head[8] = __('% Ok');
$table1->headstyle = array(); $table1->headstyle = array();
$table1->headstyle[2] = 'text-align: right'; $table1->headstyle[0] = 'text-align: left';
$table1->headstyle[3] = 'text-align: right'; $table1->headstyle[1] = 'text-align: left';
$table1->headstyle[4] = 'text-align: right'; $table1->headstyle[2] = 'text-align: right';
$table1->headstyle[5] = 'text-align: right'; $table1->headstyle[3] = 'text-align: right';
$table1->headstyle[6] = 'text-align: right'; $table1->headstyle[4] = 'text-align: right';
$table1->headstyle[7] = 'text-align: right'; $table1->headstyle[5] = 'text-align: right';
$table1->headstyle[6] = 'text-align: right';
$table1->headstyle[7] = 'text-align: right';
$table1->headstyle[8] = 'text-align: right';
$table1->style[0] = 'text-align: left'; $table1->style[0] = 'text-align: left';
$table1->style[1] = 'text-align: left'; $table1->style[1] = 'text-align: left';
$table1->style[2] = 'text-align: right'; $table1->style[2] = 'text-align: right';
$table1->style[3] = 'text-align: right'; $table1->style[3] = 'text-align: right';
$table1->style[4] = 'text-align: right'; $table1->style[4] = 'text-align: right';
$table1->style[5] = 'text-align: right'; $table1->style[5] = 'text-align: right';
$table1->style[6] = 'text-align: right'; $table1->style[6] = 'text-align: right';
$table1->style[7] = 'text-align: right'; $table1->style[7] = 'text-align: right';
$table1->style[8] = 'text-align: right';
$table2 = new stdClass();
$table2->width = '99%';
$table2->data = array ();
$table2->head = array ();
$table2->head[0] = __('Agent');
// HACK it is saved in show_graph field.
// Show interfaces instead the modules
if ($item['kind_availability'] == 'address') {
$table2->head[1] = __('IP Address');
}
else {
$table2->head[1] = __('Module');
}
$table2->head[2] = __('Total checks');
$table2->head[3] = __('Checks failed');
$table2->head[4] = __('Checks OK');
$table2->head[5] = __('Checks Uknown');
//$table2->head[6] = __('% Ok');
$table2->headstyle = array();
$table2->headstyle[0] = 'text-align: left';
$table2->headstyle[1] = 'text-align: left';
$table2->headstyle[2] = 'text-align: right';
$table2->headstyle[3] = 'text-align: right';
$table2->headstyle[4] = 'text-align: right';
$table2->headstyle[5] = 'text-align: right';
//$table2->headstyle[6] = 'text-align: right';
$table2->style[0] = 'text-align: left';
$table2->style[1] = 'text-align: left';
$table2->style[2] = 'text-align: right';
$table2->style[3] = 'text-align: right';
$table2->style[4] = 'text-align: right';
$table2->style[5] = 'text-align: right';
//$table2->style[6] = 'text-align: right';
foreach ($item['data'] as $row) { foreach ($item['data'] as $row) {
$the_first_men_time = get_agent_first_time(io_safe_output($row['agent'])); $the_first_men_time = get_agent_first_time(io_safe_output($row['agent']));
@ -1749,31 +1997,100 @@ function reporting_html_availability(&$table, $item) {
$table_row = array(); $table_row = array();
$table_row[] = $row['agent']; $table_row[] = $row['agent'];
$table_row[] = $row['availability_item']; $table_row[] = $row['availability_item'];
$table_row[] = $row['checks'];
$table_row[] = $row['failed']; if($row['time_total'] != 0)
$table_row[] = remove_right_zeros(number_format($row['fail'], $config['graph_precision'])); $table_row[] = human_time_description_raw($row['time_total'], true);
$table_row[] = $row['poling_time']; else
$table_row[] = $row['time_unavaliable']; $table_row[] = '--';
$table_row[] = remove_right_zeros(number_format($row['ok'], $config['graph_precision']));
if($row['time_error'] != 0)
$table_row[] = human_time_description_raw($row['time_error'], true);
else
$table_row[] = '--';
if($row['time_ok'] != 0)
$table_row[] = human_time_description_raw($row['time_ok'], true);
else
$table_row[] = '--';
if($row['time_unknown'] != 0)
$table_row[] = human_time_description_raw($row['time_unknown'], true);
else
$table_row[] = '--';
if($row['time_not_init'] != 0)
$table_row[] = human_time_description_raw($row['time_not_init'], true);
else
$table_row[] = '--';
if($row['time_downtime'] != 0)
$table_row[] = human_time_description_raw($row['time_downtime'], true);
else
$table_row[] = '--';
$table_row[] = '<span style="font-size: 1.2em; font-weight:bold;">' . sla_truncate($row['SLA'], $config['graph_precision']). '%</span>';
$table_row2 = array();
$table_row2[] = $row['agent'];
$table_row2[] = $row['availability_item'];
$table_row2[] = $row['checks_total'];
$table_row2[] = $row['checks_error'];
$table_row2[] = $row['checks_ok'];
$table_row2[] = $row['checks_unknown'];
} }
else { else {
if ($item['date']['to'] > $the_first_men_time) { if ($item['date']['to'] > $the_first_men_time) {
$table_row = array(); $table_row = array();
$table_row[] = $row['agent']; $table_row[] = $row['agent'];
$table_row[] = $row['availability_item']; $table_row[] = $row['availability_item'];
$table_row[] = $row['checks'];
$table_row[] = $row['failed']; if($row['time_total'] != 0)
$table_row[] = remove_right_zeros(number_format($row['fail'], $config['graph_precision'])); $table_row[] = human_time_description_raw($row['time_total'], true);
$table_row[] = $row['poling_time']; else
$table_row[] = $row['time_unavaliable']; $table_row[] = '--';
$table_row[] = remove_right_zeros(number_format($row['ok'], $config['graph_precision']));
if($row['time_error'] != 0)
$table_row[] = human_time_description_raw($row['time_error'], true);
else
$table_row[] = '--';
if($row['time_ok'] != 0)
$table_row[] = human_time_description_raw($row['time_ok'], true);
else
$table_row[] = '--';
if($row['time_unknown'] != 0)
$table_row[] = human_time_description_raw($row['time_unknown'], true);
else
$table_row[] = '--';
if($row['time_not_init'] != 0)
$table_row[] = human_time_description_raw($row['time_not_init'], true);
else
$table_row[] = '--';
if($row['time_downtime'] != 0)
$table_row[] = human_time_description_raw($row['time_downtime'], true);
else
$table_row[] = '--';
$table_row[] = '<span style="font-size: 1.2em; font-weight:bold;">' . sla_truncate($row['SLA'], $config['graph_precision']). '%</span>';
$table_row2 = array();
$table_row2[] = $row['agent'];
$table_row2[] = $row['availability_item'];
$table_row2[] = $row['checks_total'];
$table_row2[] = $row['checks_error'];
$table_row2[] = $row['checks_ok'];
$table_row2[] = $row['checks_unknown'];
} }
else { else {
$same_agent_in_resume = $row['agent']; $same_agent_in_resume = $item['data']['agent'];
} }
} }
$table1->data[] = $table_row; $table1->data[] = $table_row;
$table2->data[] = $table_row2;
} }
} }
else { else {
@ -1782,47 +2099,50 @@ function reporting_html_availability(&$table, $item) {
__('There are no Agent/Modules defined'); __('There are no Agent/Modules defined');
} }
$table->colspan[1][0] = 3; $table->colspan[1][0] = 2;
$table->colspan[2][0] = 2;
$data = array(); $data = array();
$data[0] = html_print_table($table1, true); $data[0] = html_print_table($table1, true);
$data2 = array();
$data2[0] = html_print_table($table2, true);
array_push ($table->data, $data); array_push ($table->data, $data);
array_push ($table->data, $data2);
if ($item['resume'] && !empty($item["data"])) { if ($item['resume']['resume'] && !empty($item["data"])) {
$table1->width = '99%'; $table1->width = '99%';
$table1->data = array (); $table1->data = array ();
if (($same_agent_in_resume == "") && (strpos($item['resume']['min_text'], $same_agent_in_resume) === false)) { if (($same_agent_in_resume == "") && (strpos($item['resume']['min_text'], $same_agent_in_resume) === false)) {
$table1->head = array (); $table1->head = array ();
$table1->head['max_text'] = __('Agent max value'); $table1->head['max_text'] = __('Agent max value');
$table1->head['max'] = __('Max Value'); $table1->head['max'] = __('Max Value');
$table1->head['avg'] = __('Average Value');
$table1->head['min_text'] = __('Agent min'); $table1->head['min_text'] = __('Agent min');
$table1->head['min'] = __('Agent min Value'); $table1->head['min'] = __('Agent min Value');
$table1->head['avg'] = __('Average Value');
$table1->headstyle = array(); $table1->headstyle = array();
$table1->headstyle['min_text'] = 'text-align: left'; $table1->headstyle['min_text'] = 'text-align: left';
$table1->headstyle['min'] = 'text-align: right'; $table1->headstyle['min'] = 'text-align: right';
$table1->headstyle['avg'] = 'text-align: right';
$table1->headstyle['max_text'] = 'text-align: left'; $table1->headstyle['max_text'] = 'text-align: left';
$table1->headstyle['max'] = 'text-align: right'; $table1->headstyle['max'] = 'text-align: right';
$table1->headstyle['avg'] = 'text-align: right';
$table1->style = array(); $table1->style = array();
$table1->style['min_text'] = 'text-align: left'; $table1->style['min_text'] = 'text-align: left';
$table1->style['min'] = 'text-align: right'; $table1->style['min'] = 'text-align: right';
$table1->style['avg'] = 'text-align: right';
$table1->style['max_text'] = 'text-align: left'; $table1->style['max_text'] = 'text-align: left';
$table1->style['max'] = 'text-align: right'; $table1->style['max'] = 'text-align: right';
$table1->style['avg'] = 'text-align: right';
$table1->data[] = array( $table1->data[] = array(
'max_text' => $item['resume']['max_text'], 'max_text' => $item['resume']['max_text'],
'max' => remove_right_zeros(number_format($item['resume']['max'], $config['graph_precision'])) . "%", 'max' => sla_truncate($item['resume']['max'], $config['graph_precision']) . "%",
'avg' => remove_right_zeros(number_format($item['resume']['avg'], $config['graph_precision'])) . "%",
'min_text' => $item['resume']['min_text'], 'min_text' => $item['resume']['min_text'],
'min' => remove_right_zeros(number_format($item['resume']['min'], $config['graph_precision'])) . "%" 'min' => sla_truncate($item['resume']['min'], $config['graph_precision']) . "%",
'avg' => '<span style="font-size: 1.2em; font-weight:bold;">' .remove_right_zeros(number_format($item['resume']['avg'], $config['graph_precision'])) . "%</span>"
); );
$table->colspan[2][0] = 3; $table->colspan[3][0] = 3;
$data = array(); $data = array();
$data[0] = html_print_table($table1, true); $data[0] = html_print_table($table1, true);
array_push ($table->data, $data); array_push ($table->data, $data);

View File

@ -162,7 +162,7 @@ function slicesbar_graph($chart_data, $period, $width, $height, $colors,
$id_graph = serialize_in_temp($graph, null, $ttl); $id_graph = serialize_in_temp($graph, null, $ttl);
return "<img src='".$home_url."include/graphs/functions_pchart.php?static_graph=1&graph_type=slicebar&ttl=".$ttl."&id_graph=".$id_graph."'>"; return "<img src='".$home_url."include/graphs/functions_pchart.php?static_graph=1&graph_type=slicebar&ttl=".$ttl."&id_graph=".$id_graph."' style='width:100%;'>";
} }
function vbar_graph($flash_chart, $chart_data, $width, $height, function vbar_graph($flash_chart, $chart_data, $width, $height,

View File

@ -3571,3 +3571,14 @@ color:#82b92e;font-family:Nunito;font-size:10pt;position:relative;top:6px;
.readonly{ .readonly{
background-color: #dedede !important; background-color: #dedede !important;
} }
.legend_graphs_sla{
width: 40px;
height: 15px;
float:left;
margin-left: 20px;
}
.label_legend_graph{
float:left;
margin-left: 20px;
}

View File

@ -71,7 +71,7 @@
<div style='height: 10px'> <div style='height: 10px'>
<?php <?php
$version = '6.0SP4'; $version = '6.0SP4';
$build = '161125'; $build = '161129';
$banner = "v$version Build $build"; $banner = "v$version Build $build";
error_reporting(0); error_reporting(0);

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_console %define name pandorafms_console
%define version 6.0SP4 %define version 6.0SP4
%define release 161125 %define release 161129
# User and Group under which Apache is running # User and Group under which Apache is running
%define httpd_name httpd %define httpd_name httpd

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_console %define name pandorafms_console
%define version 6.0SP4 %define version 6.0SP4
%define release 161125 %define release 161129
%define httpd_name httpd %define httpd_name httpd
# User and Group under which Apache is running # User and Group under which Apache is running
%define httpd_name apache2 %define httpd_name apache2

View File

@ -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 ('step_compact','1');
INSERT INTO tconfig (token, value) VALUES ('db_scheme_first_version','6.0orc'); INSERT INTO tconfig (token, value) VALUES ('db_scheme_first_version','6.0orc');
INSERT INTO tconfig (token, value) VALUES('db_scheme_version','6.0SP4'); INSERT INTO tconfig (token, value) VALUES('db_scheme_version','6.0SP4');
INSERT INTO tconfig (token, value) VALUES('db_scheme_build','PD161125'); INSERT INTO tconfig (token, value) VALUES('db_scheme_build','PD161129');
INSERT INTO tconfig (token, value) VALUES ('show_unknown','0'); INSERT INTO tconfig (token, value) VALUES ('show_unknown','0');
INSERT INTO tconfig (token, value) VALUES ('show_lastalerts','1'); INSERT INTO tconfig (token, value) VALUES ('show_lastalerts','1');
INSERT INTO tconfig (token, value) VALUES ('style','pandora'); INSERT INTO tconfig (token, value) VALUES ('style','pandora');

View File

@ -1,5 +1,5 @@
package: pandorafms-server package: pandorafms-server
Version: 6.0SP4-161125 Version: 6.0SP4-161129
Architecture: all Architecture: all
Priority: optional Priority: optional
Section: admin Section: admin

View File

@ -14,7 +14,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details. # GNU General Public License for more details.
pandora_version="6.0SP4-161125" pandora_version="6.0SP4-161129"
package_cpan=0 package_cpan=0
package_pandora=1 package_pandora=1

View File

@ -503,6 +503,9 @@ console_pass pandora
# Passphrase used to generate the key for password encryption (PANDORA FMS ENTERPRISE ONLY). # Passphrase used to generate the key for password encryption (PANDORA FMS ENTERPRISE ONLY).
#encryption_passphrase passphrase #encryption_passphrase passphrase
# Enable (1) or disable (0) events related to the unknown module status.
unknown_events 1
# Time interval (as a multiple of the module interval) before a module becomes unknown. Twice the module's interval by default. # Time interval (as a multiple of the module interval) before a module becomes unknown. Twice the module's interval by default.
#unknown_interval 2 #unknown_interval 2

View File

@ -310,6 +310,9 @@ console_pass pandora
# Passphrase used to generate the key for password encryption (PANDORA FMS ENTERPRISE ONLY). # Passphrase used to generate the key for password encryption (PANDORA FMS ENTERPRISE ONLY).
#encryption_passphrase passphrase #encryption_passphrase passphrase
# Enable (1) or disable (0) events related to the unknown module status.
unknown_events 1
# Time interval (as a multiple of the module interval) before a module becomes unknown. Twice the module's interval by default. # Time interval (as a multiple of the module interval) before a module becomes unknown. Twice the module's interval by default.
#unknown_interval 2 #unknown_interval 2

View File

@ -43,7 +43,7 @@ our @EXPORT = qw(
# version: Defines actual version of Pandora Server for this module only # version: Defines actual version of Pandora Server for this module only
my $pandora_version = "6.0SP4"; my $pandora_version = "6.0SP4";
my $pandora_build = "161125"; my $pandora_build = "161129";
our $VERSION = $pandora_version." ".$pandora_build; our $VERSION = $pandora_version." ".$pandora_build;
# Setup hash # Setup hash
@ -416,6 +416,9 @@ sub pandora_load_config {
# External .enc files for XML::Parser. # External .enc files for XML::Parser.
$pa_config->{"enc_dir"} = ""; # > 6.0SP4 $pa_config->{"enc_dir"} = ""; # > 6.0SP4
# Enable (1) or disable (0) events related to the unknown status.
$pa_config->{"unknown_events"} = 1; # > 6.0SP4
# Check for UID0 # Check for UID0
if ($pa_config->{"quiet"} != 0){ if ($pa_config->{"quiet"} != 0){
if ($> == 0){ if ($> == 0){
@ -919,6 +922,9 @@ sub pandora_load_config {
elsif ($parametro =~ m/^enc_dir\s+(.*)/i) { elsif ($parametro =~ m/^enc_dir\s+(.*)/i) {
$pa_config->{'enc_dir'} = clean_blank($1); $pa_config->{'enc_dir'} = clean_blank($1);
} }
elsif ($parametro =~ m/^unknown_events\s+([0-1])/i) {
$pa_config->{'unknown_events'} = clean_blank($1);
}
} # end of loop for parameter # } # end of loop for parameter #
# Set to RDBMS' standard port # Set to RDBMS' standard port

View File

@ -3810,6 +3810,11 @@ sub generate_status_event ($$$$$$$$) {
pandora_event ($pa_config, "Warmup mode for events ended.", 0, 0, 0, 0, 0, 'system', 0, $dbh); pandora_event ($pa_config, "Warmup mode for events ended.", 0, 0, 0, 0, 0, 'system', 0, $dbh);
} }
# Disable events related to the unknown status.
if ($pa_config->{'unknown_events'} == 0 && ($last_status == 3 || $status == 3)) {
return;
}
# disable event just recovering from 'Unknown' without status change # disable event just recovering from 'Unknown' without status change
if($last_status == 3 && $status == $last_known_status && $module->{'disabled_types_event'} ) { if($last_status == 3 && $status == $last_known_status && $module->{'disabled_types_event'} ) {
my $disabled_types_event; my $disabled_types_event;
@ -4228,6 +4233,13 @@ sub pandora_process_event_replication ($) {
logger($pa_config, "Starting replication events process.", 1); logger($pa_config, "Starting replication events process.", 1);
while(1) { while(1) {
# If we are not the master server sleep and check again.
if (pandora_is_master($pa_config) == 0) {
sleep ($pa_config->{'server_threshold'});
next;
}
# Check the queue each N seconds # Check the queue each N seconds
sleep ($replication_interval); sleep ($replication_interval);
enterprise_hook('pandora_replicate_copy_events',[$pa_config, $dbh, $dbh_metaconsole, $metaconsole_server_id, $replication_mode]); enterprise_hook('pandora_replicate_copy_events',[$pa_config, $dbh, $dbh_metaconsole, $metaconsole_server_id, $replication_mode]);
@ -4252,6 +4264,13 @@ sub pandora_process_policy_queue ($) {
logger($pa_config, "Starting policy queue patrol process.", 1); logger($pa_config, "Starting policy queue patrol process.", 1);
while(1) { while(1) {
# If we are not the master server sleep and check again.
if (pandora_is_master($pa_config) == 0) {
sleep ($pa_config->{'server_threshold'});
next;
}
# Check the queue each 5 seconds # Check the queue each 5 seconds
sleep (5); sleep (5);
@ -4590,8 +4609,11 @@ sub pandora_module_unknown ($$) {
load_module_macros ($module->{'module_macros'}, \%macros); load_module_macros ($module->{'module_macros'}, \%macros);
$description = subst_alert_macros ($description, \%macros, $pa_config, $dbh, $agent, $module); $description = subst_alert_macros ($description, \%macros, $pa_config, $dbh, $agent, $module);
pandora_event ($pa_config, $description, $agent->{'id_grupo'}, $module->{'id_agente'}, # Are unknown events enabled?
$severity, 0, $module->{'id_agente_modulo'}, $event_type, 0, $dbh, 'Pandora', '', '', '', '', $module->{'critical_instructions'}, $module->{'warning_instructions'}, $module->{'unknown_instructions'}); if ($pa_config->{'unknown_events'} == 1) {
pandora_event ($pa_config, $description, $agent->{'id_grupo'}, $module->{'id_agente'},
$severity, 0, $module->{'id_agente_modulo'}, $event_type, 0, $dbh, 'Pandora', '', '', '', '', $module->{'critical_instructions'}, $module->{'warning_instructions'}, $module->{'unknown_instructions'});
}
} }
# Regular module # Regular module
else { else {
@ -4617,8 +4639,12 @@ sub pandora_module_unknown ($$) {
logger($pa_config, "Alerts inhibited for agent '" . $agent->{'nombre'} . "'.", 10); logger($pa_config, "Alerts inhibited for agent '" . $agent->{'nombre'} . "'.", 10);
} }
my $do_event = 0; my $do_event;
if (!defined($module->{'disabled_types_event'}) || $module->{'disabled_types_event'} eq "") { # Are unknown events enabled?
if ($pa_config->{'unknown_events'} == 0) {
$do_event = 0;
}
elsif (!defined($module->{'disabled_types_event'}) || $module->{'disabled_types_event'} eq "") {
$do_event = 1; $do_event = 1;
} }
else { else {

View File

@ -351,6 +351,13 @@ sub process_xml_data ($$$$$) {
} }
} }
# Check the group password.
my $rc = enterprise_hook('check_group_password', [$dbh, $group_id, $data->{'group_password'}]);
if (defined($rc) && $rc != 1) {
logger($pa_config, "Agent $agent_name did not send a valid password for group id $group_id.", 10);
return;
}
my $description = ''; my $description = '';
$description = $data->{'description'} if (defined ($data->{'description'})); $description = $data->{'description'} if (defined ($data->{'description'}));

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_server %define name pandorafms_server
%define version 6.0SP4 %define version 6.0SP4
%define release 161125 %define release 161129
Summary: Pandora FMS Server Summary: Pandora FMS Server
Name: %{name} Name: %{name}

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_server %define name pandorafms_server
%define version 6.0SP4 %define version 6.0SP4
%define release 161125 %define release 161129
Summary: Pandora FMS Server Summary: Pandora FMS Server
Name: %{name} Name: %{name}

View File

@ -9,7 +9,7 @@
# ********************************************************************** # **********************************************************************
PI_VERSION="6.0SP4" PI_VERSION="6.0SP4"
PI_BUILD="161125" PI_BUILD="161129"
MODE=$1 MODE=$1
if [ $# -gt 1 ]; then if [ $# -gt 1 ]; then

View File

@ -33,7 +33,7 @@ use PandoraFMS::Tools;
use PandoraFMS::DB; use PandoraFMS::DB;
# version: define current version # version: define current version
my $version = "6.0SP4 PS161125"; my $version = "6.0SP4 PS161129";
# Pandora server configuration # Pandora server configuration
my %conf; my %conf;

View File

@ -35,7 +35,7 @@ use Encode::Locale;
Encode::Locale::decode_argv; Encode::Locale::decode_argv;
# version: define current version # version: define current version
my $version = "6.0SP4 PS161125"; my $version = "6.0SP4 PS161129";
# save program name for logging # save program name for logging
my $progname = basename($0); my $progname = basename($0);