From 3f0fd30eb890e99fbae488220dc3b32dfe9e662d Mon Sep 17 00:00:00 2001 From: "alejandro.campos@artica.es" Date: Tue, 16 Nov 2021 14:13:45 +0100 Subject: [PATCH 1/6] added resolution field in creation and update operations --- .../configure_integriaims_incident.php | 75 +++++++++++++++++-- 1 file changed, 70 insertions(+), 5 deletions(-) diff --git a/pandora_console/operation/incidents/configure_integriaims_incident.php b/pandora_console/operation/incidents/configure_integriaims_incident.php index 972ae67e8f..8fdbe319cf 100644 --- a/pandora_console/operation/incidents/configure_integriaims_incident.php +++ b/pandora_console/operation/incidents/configure_integriaims_incident.php @@ -78,6 +78,10 @@ $integria_types_csv = integria_api_call(null, null, null, null, 'get_types'); get_array_from_csv_data_pair($integria_types_csv, $integria_types_values); +$integria_resolution_csv = integria_api_call(null, null, null, null, 'get_incidents_resolutions'); + +get_array_from_csv_data_pair($integria_resolution_csv, $integria_resolution_values); + $event_id = (int) get_parameter('from_event'); $incident_id_edit = (int) get_parameter('incident_id'); $create_incident = (bool) get_parameter('create_incident', 0); @@ -88,6 +92,7 @@ $incident_owner = get_parameter('owner'); $incident_type = (int) get_parameter('type'); $incident_creator = get_parameter('creator'); $incident_status = (int) get_parameter('status'); +$incident_resolution = (int) get_parameter('resolution'); $incident_title = events_get_field_value_by_event_id($event_id, get_parameter('incident_title')); $incident_content = events_get_field_value_by_event_id($event_id, get_parameter('incident_content')); @@ -97,8 +102,13 @@ $incident_content = str_replace(',', ':::', $incident_content); // Perform action. if ($create_incident === true) { + // Disregard incident resolution unless status is 'closed'. + if ($incident_status !== 7) { + $incident_resolution = 0; + } + // Call Integria IMS API method to create an incident. - $result_api_call = integria_api_call(null, null, null, null, 'create_incident', [$incident_title, $incident_group_id, $incident_criticity_id, $incident_content, '', $incident_type, '', $incident_owner, '0', $incident_status], false, '', ','); + $result_api_call = integria_api_call(null, null, null, null, 'create_incident', [$incident_title, $incident_group_id, $incident_criticity_id, $incident_content, '', $incident_type, '', $incident_owner, '0', $incident_status, '', $incident_resolution], false, '', ','); // Necessary to explicitly set true if not false because function returns api call result in case of success instead of true value. $incident_created_ok = ($result_api_call != false) ? true : false; @@ -109,8 +119,13 @@ if ($create_incident === true) { __('Could not be created in Integria IMS') ); } else if ($update_incident === true) { + // Disregard incident resolution unless status is 'closed'. + if ($incident_status !== 7) { + $incident_resolution = 0; + } + // Call Integria IMS API method to update an incident. - $result_api_call = integria_api_call(null, null, null, null, 'update_incident', [$incident_id_edit, $incident_title, $incident_content, '', $incident_group_id, $incident_criticity_id, 0, $incident_status, $incident_owner, 0, $incident_type], false, '', ','); + $result_api_call = integria_api_call(null, null, null, null, 'update_incident', [$incident_id_edit, $incident_title, $incident_content, '', $incident_group_id, $incident_criticity_id, $incident_resolution, $incident_status, $incident_owner, 0, $incident_type], false, '', ','); // Necessary to explicitly set true if not false because function returns api call result in case of success instead of true value. $incident_updated_ok = ($result_api_call != false) ? true : false; @@ -152,7 +167,7 @@ $table->style[0] = 'width: 33%; padding-right: 50px; padding-left: 100px;'; $table->style[1] = 'width: 33%; padding-right: 50px; padding-left: 50px;'; $table->style[2] = 'width: 33%; padding-right: 100px; padding-left: 50px;'; $table->colspan[0][0] = 2; -$table->colspan[3][0] = 3; +$table->colspan[4][0] = 3; $help_macros = isset($_GET['from_event']) ? ui_print_help_icon('response_macros', true) : ''; @@ -164,6 +179,7 @@ if ($update) { $input_value_criticity = $incident_details[7]; $input_value_owner = $incident_details[5]; $input_value_content = $incident_details[4]; + $input_value_resolution = $incident_details[12]; } else if (isset($_GET['from_event'])) { $input_value_title = $config['cr_incident_title']; $input_value_type = $config['cr_incident_type']; @@ -172,6 +188,7 @@ if ($update) { $input_value_criticity = $config['cr_default_criticity']; $input_value_owner = $config['cr_default_owner']; $input_value_content = $config['cr_incident_content']; + $input_value_resolution = 0; } else { $input_value_title = ''; $input_value_type = ''; @@ -180,6 +197,7 @@ if ($update) { $input_value_criticity = ''; $input_value_owner = ''; $input_value_content = ''; + $input_value_resolution = 0; } $table->data[0][0] = '

'.__('Title').': '.$help_macros.'

'; @@ -293,8 +311,26 @@ $table->data[2][2] .= '
'.html_print_autocomplet 'w100p' ).'
'; -$table->data[3][0] = '

'.__('Description').': '.$help_macros.'

'; -$table->data[3][0] .= '
'.html_print_textarea( + +$table->data[3][0] = '

'.__('Resolution').':

'; + +$table->data[3][0] .= '
'.html_print_select( + $integria_resolution_values, + 'resolution', + $input_value_resolution, + '', + __('Select'), + 1, + true, + false, + true, + '', + false, + 'width: 100%;' +).'
'; + +$table->data[4][0] = '

'.__('Description').': '.$help_macros.'

'; +$table->data[4][0] .= '
'.html_print_textarea( 'incident_content', 3, 20, @@ -323,3 +359,32 @@ if ($update) { } echo '
'; +?> + + From a842381754228cab3454061030f110069ec70fb9 Mon Sep 17 00:00:00 2001 From: "alejandro.campos@artica.es" Date: Wed, 17 Nov 2021 10:32:04 +0100 Subject: [PATCH 2/6] minor change --- .../operation/incidents/configure_integriaims_incident.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandora_console/operation/incidents/configure_integriaims_incident.php b/pandora_console/operation/incidents/configure_integriaims_incident.php index 8fdbe319cf..ef1ba0003c 100644 --- a/pandora_console/operation/incidents/configure_integriaims_incident.php +++ b/pandora_console/operation/incidents/configure_integriaims_incident.php @@ -319,7 +319,7 @@ $table->data[3][0] .= '
'.html_print_select( 'resolution', $input_value_resolution, '', - __('Select'), + '', 1, true, false, From 79757d8f4bd94e7c77cd5c37712a8a82a4bf3403 Mon Sep 17 00:00:00 2001 From: Daniel Maya Date: Mon, 22 Nov 2021 12:12:32 +0100 Subject: [PATCH 3/6] #8278 Fixed graph --- pandora_console/include/functions_graph.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pandora_console/include/functions_graph.php b/pandora_console/include/functions_graph.php index 70aceab133..f561705896 100644 --- a/pandora_console/include/functions_graph.php +++ b/pandora_console/include/functions_graph.php @@ -1574,7 +1574,9 @@ function graphic_combined_module( $date_array['final_date'] = $params['date']; $date_array['start_date'] = ($params['date'] - $params['period']); - $server_name = metaconsole_get_server_by_id($modules[0]['server']); + if (is_metaconsole()) { + $server_name = metaconsole_get_server_by_id($modules[0]['server']); + } if ($params_combined['projection']) { $output_projection = forecast_projection_graph( From aae0016191813377e92549018f1a7c556d0a9e48 Mon Sep 17 00:00:00 2001 From: Daniel Barbero Martin Date: Tue, 23 Nov 2021 13:14:56 +0100 Subject: [PATCH 4/6] fix chart area --- pandora_console/operation/reporting/graph_viewer.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/pandora_console/operation/reporting/graph_viewer.php b/pandora_console/operation/reporting/graph_viewer.php index c35f450261..549c7ba08e 100644 --- a/pandora_console/operation/reporting/graph_viewer.php +++ b/pandora_console/operation/reporting/graph_viewer.php @@ -48,7 +48,7 @@ if ($id_graph !== 0) { } } -// Delete module SQL code +// Delete module SQL code. if ($delete_graph) { if (check_acl($config['id_user'], 0, 'AW')) { $res = db_process_sql_delete('tgraph_source', ['id_graph' => $id_graph]); @@ -239,7 +239,7 @@ if ($view_graph) { ] ).''; - // In full screen, the manage options are not available + // In full screen, the manage options are not available. $options = [ 'view' => $options['view'], 'screen' => $options['screen'], @@ -277,6 +277,12 @@ if ($view_graph) { 'fullscale' => $fullscale, ]; + if ($stacked === CUSTOM_GRAPH_AREA || $stacked === CUSTOM_GRAPH_STACKED_AREA) { + $params['type_graph'] = 'area'; + } else if ($stacked === CUSTOM_GRAPH_LINE || $stacked === CUSTOM_GRAPH_STACKED_LINE) { + $params['type_graph'] = 'line'; + } + $params_combined = [ 'stacked' => $stacked, 'id_graph' => $id_graph, From e0fec6470d3aa606b718fa5373de9d777c5468d0 Mon Sep 17 00:00:00 2001 From: Daniel Barbero Martin Date: Tue, 23 Nov 2021 18:04:34 +0100 Subject: [PATCH 5/6] minor fix --- pandora_server/util/pandora_manage.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandora_server/util/pandora_manage.pl b/pandora_server/util/pandora_manage.pl index 04ee72ea70..71dcfe4662 100755 --- a/pandora_server/util/pandora_manage.pl +++ b/pandora_server/util/pandora_manage.pl @@ -978,7 +978,7 @@ sub pandora_get_same_day_id ($$) { my $weeks = { 'monday' => 1, 'tuesday' => 2, 'wednesday' => 3, 'thursday' => 4, 'friday' => 5, 'saturday' => 6, 'sunday' => 7, 'holiday' => 8}; - return defined ($weeks{$same_day}) ? $weeks{$same_day} : -1; + return defined ($weeks->{$same_day}) ? $weeks->{$same_day} : -1; } ########################################################################## From 98f4bfbcc17484bca3f0ab84438c52a6878128f0 Mon Sep 17 00:00:00 2001 From: artica Date: Wed, 24 Nov 2021 01:00:10 +0100 Subject: [PATCH 6/6] Auto-updated build strings. --- pandora_agents/unix/DEBIAN/control | 2 +- pandora_agents/unix/DEBIAN/make_deb_package.sh | 2 +- pandora_agents/unix/pandora_agent | 2 +- pandora_agents/unix/pandora_agent.redhat.spec | 2 +- pandora_agents/unix/pandora_agent.spec | 2 +- pandora_agents/unix/pandora_agent_installer | 2 +- pandora_agents/win32/installer/pandora.mpi | 4 ++-- pandora_agents/win32/pandora.cc | 2 +- pandora_agents/win32/versioninfo.rc | 2 +- pandora_console/DEBIAN/control | 2 +- pandora_console/DEBIAN/make_deb_package.sh | 2 +- pandora_console/include/config_process.php | 2 +- pandora_console/install.php | 2 +- pandora_console/pandora_console.redhat.spec | 2 +- pandora_console/pandora_console.rhel7.spec | 2 +- pandora_console/pandora_console.spec | 2 +- pandora_server/DEBIAN/control | 2 +- pandora_server/DEBIAN/make_deb_package.sh | 2 +- pandora_server/lib/PandoraFMS/Config.pm | 2 +- pandora_server/lib/PandoraFMS/PluginTools.pm | 2 +- pandora_server/pandora_server.redhat.spec | 2 +- pandora_server/pandora_server.spec | 2 +- pandora_server/pandora_server_installer | 2 +- pandora_server/util/pandora_db.pl | 2 +- pandora_server/util/pandora_manage.pl | 2 +- 25 files changed, 26 insertions(+), 26 deletions(-) diff --git a/pandora_agents/unix/DEBIAN/control b/pandora_agents/unix/DEBIAN/control index 0b1e75c18d..af15d73edd 100644 --- a/pandora_agents/unix/DEBIAN/control +++ b/pandora_agents/unix/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-agent-unix -Version: 7.0NG.758.1 +Version: 7.0NG.758.1-211124 Architecture: all Priority: optional Section: admin diff --git a/pandora_agents/unix/DEBIAN/make_deb_package.sh b/pandora_agents/unix/DEBIAN/make_deb_package.sh index 64160f67cb..11889caa18 100644 --- a/pandora_agents/unix/DEBIAN/make_deb_package.sh +++ b/pandora_agents/unix/DEBIAN/make_deb_package.sh @@ -14,7 +14,7 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -pandora_version="7.0NG.758.1" +pandora_version="7.0NG.758.1-211124" echo "Test if you has the tools for to make the packages." whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null diff --git a/pandora_agents/unix/pandora_agent b/pandora_agents/unix/pandora_agent index dd9a985b2a..93182e14f0 100755 --- a/pandora_agents/unix/pandora_agent +++ b/pandora_agents/unix/pandora_agent @@ -1015,7 +1015,7 @@ my $Sem = undef; my $ThreadSem = undef; use constant AGENT_VERSION => '7.0NG.758.1'; -use constant AGENT_BUILD => '211123'; +use constant AGENT_BUILD => '211124'; # Agent log default file size maximum and instances use constant DEFAULT_MAX_LOG_SIZE => 600000; diff --git a/pandora_agents/unix/pandora_agent.redhat.spec b/pandora_agents/unix/pandora_agent.redhat.spec index 1d6b37e224..a2ee889051 100644 --- a/pandora_agents/unix/pandora_agent.redhat.spec +++ b/pandora_agents/unix/pandora_agent.redhat.spec @@ -3,7 +3,7 @@ # %define name pandorafms_agent_unix %define version 7.0NG.758.1 -%define release 1 +%define release 211124 Summary: Pandora FMS Linux agent, PERL version Name: %{name} diff --git a/pandora_agents/unix/pandora_agent.spec b/pandora_agents/unix/pandora_agent.spec index 6af4554bf8..42e64f5f30 100644 --- a/pandora_agents/unix/pandora_agent.spec +++ b/pandora_agents/unix/pandora_agent.spec @@ -3,7 +3,7 @@ # %define name pandorafms_agent_unix %define version 7.0NG.758.1 -%define release 1 +%define release 211124 Summary: Pandora FMS Linux agent, PERL version Name: %{name} diff --git a/pandora_agents/unix/pandora_agent_installer b/pandora_agents/unix/pandora_agent_installer index 4b9eb3b45f..ff4c5d907b 100755 --- a/pandora_agents/unix/pandora_agent_installer +++ b/pandora_agents/unix/pandora_agent_installer @@ -10,7 +10,7 @@ # ********************************************************************** PI_VERSION="7.0NG.758.1" -PI_BUILD="211123" +PI_BUILD="211124" OS_NAME=`uname -s` FORCE=0 diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi index 482887f788..8cb5daeb54 100644 --- a/pandora_agents/win32/installer/pandora.mpi +++ b/pandora_agents/win32/installer/pandora.mpi @@ -186,7 +186,7 @@ UpgradeApplicationID {} Version -{211123} +{211124} ViewReadme {Yes} @@ -2387,7 +2387,7 @@ Windows,BuildSeparateArchives {No} Windows,Executable -{<%AppName%>-Setup<%Ext%>} +{<%AppName%>-<%Version%>-Setup<%Ext%>} Windows,FileDescription {<%AppName%> <%Version%> Setup} diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc index 70b96f6105..5672b0027c 100644 --- a/pandora_agents/win32/pandora.cc +++ b/pandora_agents/win32/pandora.cc @@ -30,7 +30,7 @@ using namespace Pandora; using namespace Pandora_Strutils; #define PATH_SIZE _MAX_PATH+1 -#define PANDORA_VERSION ("7.0NG.758.1 Build 211123") +#define PANDORA_VERSION ("7.0NG.758.1 Build 211124") string pandora_path; string pandora_dir; diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc index 01329528c1..2173a630bb 100644 --- a/pandora_agents/win32/versioninfo.rc +++ b/pandora_agents/win32/versioninfo.rc @@ -11,7 +11,7 @@ BEGIN VALUE "LegalCopyright", "Artica ST" VALUE "OriginalFilename", "PandoraAgent.exe" VALUE "ProductName", "Pandora FMS Windows Agent" - VALUE "ProductVersion", "(7.0NG.758.1(Build 211123))" + VALUE "ProductVersion", "(7.0NG.758.1(Build 211124))" VALUE "FileVersion", "1.0.0.0" END END diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control index 819e869aca..9e124dc08f 100644 --- a/pandora_console/DEBIAN/control +++ b/pandora_console/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-console -Version: 7.0NG.758.1 +Version: 7.0NG.758.1-211124 Architecture: all Priority: optional Section: admin diff --git a/pandora_console/DEBIAN/make_deb_package.sh b/pandora_console/DEBIAN/make_deb_package.sh index f99c5db429..3fe0d36394 100644 --- a/pandora_console/DEBIAN/make_deb_package.sh +++ b/pandora_console/DEBIAN/make_deb_package.sh @@ -14,7 +14,7 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -pandora_version="7.0NG.758.1" +pandora_version="7.0NG.758.1-211124" package_pear=0 package_pandora=1 diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php index 7ef7781787..81d3f45bd2 100644 --- a/pandora_console/include/config_process.php +++ b/pandora_console/include/config_process.php @@ -20,7 +20,7 @@ /** * Pandora build version and version */ -$build_version = 'PC211123'; +$build_version = 'PC211124'; $pandora_version = 'v7.0NG.758.1'; // Do not overwrite default timezone set if defined. diff --git a/pandora_console/install.php b/pandora_console/install.php index 58daf611e0..8be5d1da62 100644 --- a/pandora_console/install.php +++ b/pandora_console/install.php @@ -129,7 +129,7 @@
[ qw() ] ); diff --git a/pandora_server/pandora_server.redhat.spec b/pandora_server/pandora_server.redhat.spec index d4aaf02aa0..90df423bb1 100644 --- a/pandora_server/pandora_server.redhat.spec +++ b/pandora_server/pandora_server.redhat.spec @@ -3,7 +3,7 @@ # %define name pandorafms_server %define version 7.0NG.758.1 -%define release 1 +%define release 211124 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server.spec b/pandora_server/pandora_server.spec index 709068a5c7..cd3f108426 100644 --- a/pandora_server/pandora_server.spec +++ b/pandora_server/pandora_server.spec @@ -3,7 +3,7 @@ # %define name pandorafms_server %define version 7.0NG.758.1 -%define release 1 +%define release 211124 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server_installer b/pandora_server/pandora_server_installer index f11e995164..46256d0e9f 100755 --- a/pandora_server/pandora_server_installer +++ b/pandora_server/pandora_server_installer @@ -9,7 +9,7 @@ # ********************************************************************** PI_VERSION="7.0NG.758.1" -PI_BUILD="211123" +PI_BUILD="211124" MODE=$1 if [ $# -gt 1 ]; then diff --git a/pandora_server/util/pandora_db.pl b/pandora_server/util/pandora_db.pl index 4e9660bfb4..c74711afa5 100755 --- a/pandora_server/util/pandora_db.pl +++ b/pandora_server/util/pandora_db.pl @@ -35,7 +35,7 @@ use PandoraFMS::Config; use PandoraFMS::DB; # version: define current version -my $version = "7.0NG.758.1 Build 211123"; +my $version = "7.0NG.758.1 Build 211124"; # Pandora server configuration my %conf; diff --git a/pandora_server/util/pandora_manage.pl b/pandora_server/util/pandora_manage.pl index 04ee72ea70..deec93e43f 100755 --- a/pandora_server/util/pandora_manage.pl +++ b/pandora_server/util/pandora_manage.pl @@ -36,7 +36,7 @@ use Encode::Locale; Encode::Locale::decode_argv; # version: define current version -my $version = "7.0NG.758.1 Build 211123"; +my $version = "7.0NG.758.1 Build 211124"; # save program name for logging my $progname = basename($0);