Merge branch 'develop' of https://github.com/pandorafms/pandorafms into develop

This commit is contained in:
mdtrooper 2016-01-27 13:08:39 +01:00
commit 694235c7ea
26 changed files with 238 additions and 258 deletions

View File

@ -1,5 +1,5 @@
package: pandorafms-agent-unix package: pandorafms-agent-unix
Version: 6.1dev-160125 Version: 6.1dev-160126
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.1dev-160125" pandora_version="6.1dev-160126"
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.1dev'; use constant AGENT_VERSION => '6.1dev';
use constant AGENT_BUILD => '160125'; use constant AGENT_BUILD => '160126';
# Commands to retrieve total memory information in kB # Commands to retrieve total memory information in kB
use constant TOTALMEMORY_CMDS => { use constant TOTALMEMORY_CMDS => {

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_agent_unix %define name pandorafms_agent_unix
%define version 6.1dev %define version 6.1dev
%define release 160125 %define release 160126
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.1dev %define version 6.1dev
%define release 160125 %define release 160126
Summary: Pandora FMS Linux agent, PERL version Summary: Pandora FMS Linux agent, PERL version
Name: %{name} Name: %{name}

5
pandora_agents/unix/pandora_agent_installer Normal file → Executable file
View File

@ -10,7 +10,7 @@
# ********************************************************************** # **********************************************************************
PI_VERSION="6.1dev" PI_VERSION="6.1dev"
PI_BUILD="160125" PI_BUILD="160126"
OS_NAME=`uname -s` OS_NAME=`uname -s`
FORCE=0 FORCE=0
@ -486,6 +486,9 @@ install () {
echo " ($HOME/.ssh/id_dsa) under /home/pandora/.ssh/authorized_keys " echo " ($HOME/.ssh/id_dsa) under /home/pandora/.ssh/authorized_keys "
echo "on your Pandora FMS Server host" echo "on your Pandora FMS Server host"
echo " " echo " "
echo "You may need to install manually some additional required dependencies:"
echo "perl-Sys-Syslog"
echo " "
echo "You also need to setup your $PANDORA_BASE$PANDORA_CFG/pandora_agent.conf config file" echo "You also need to setup your $PANDORA_BASE$PANDORA_CFG/pandora_agent.conf config file"
echo " " echo " "
if [ "$OS_NAME" = "FreeBSD" ] if [ "$OS_NAME" = "FreeBSD" ]

View File

@ -186,7 +186,7 @@ UpgradeApplicationID
{} {}
Version Version
{160125} {160126}
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.1dev(Build 160125)") #define PANDORA_VERSION ("6.1dev(Build 160126)")
string pandora_path; string pandora_path;
string pandora_dir; string pandora_dir;

View File

@ -11,7 +11,7 @@ BEGIN
VALUE "LegalCopyright", "Artica ST" VALUE "LegalCopyright", "Artica ST"
VALUE "OriginalFilename", "PandoraAgent.exe" VALUE "OriginalFilename", "PandoraAgent.exe"
VALUE "ProductName", "Pandora FMS Windows Agent" VALUE "ProductName", "Pandora FMS Windows Agent"
VALUE "ProductVersion", "(6.1dev(Build 160125))" VALUE "ProductVersion", "(6.1dev(Build 160126))"
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.1dev-160125 Version: 6.1dev-160126
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.1dev-160125" pandora_version="6.1dev-160126"
package_pear=0 package_pear=0
package_pandora=1 package_pandora=1

View File

@ -22,7 +22,7 @@
/** /**
* Pandora build version and version * Pandora build version and version
*/ */
$build_version = 'PC160125'; $build_version = 'PC160126';
$pandora_version = 'v6.1dev'; $pandora_version = 'v6.1dev';
// Do not overwrite default timezone set if defined. // Do not overwrite default timezone set if defined.

View File

@ -3792,198 +3792,200 @@ function reporting_availability($report, $content) {
$max = null; $max = null;
$max_text = ""; $max_text = "";
$count = 0; $count = 0;
foreach ($items as $item) {
//aaMetaconsole connection if (!empty($items)) {
$server_name = $item ['server_name']; foreach ($items as $item) {
if (($config ['metaconsole'] == 1) && $server_name != '' && defined('METACONSOLE')) { //aaMetaconsole connection
$connection = metaconsole_get_connection($server_name); $server_name = $item ['server_name'];
if (metaconsole_load_external_db($connection) != NOERR) { if (($config ['metaconsole'] == 1) && $server_name != '' && defined('METACONSOLE')) {
//ui_print_error_message ("Error connecting to ".$server_name); $connection = metaconsole_get_connection($server_name);
if (metaconsole_load_external_db($connection) != NOERR) {
//ui_print_error_message ("Error connecting to ".$server_name);
continue;
}
}
if (modules_is_disable_agent($item['id_agent_module'])
|| modules_is_not_init($item['id_agent_module'])) {
//Restore dbconnection
if (($config ['metaconsole'] == 1) && $server_name != '' && defined('METACONSOLE')) {
metaconsole_restore_db();
}
continue; continue;
} }
}
$row = array();
$text = "";
if (modules_is_disable_agent($item['id_agent_module'])
|| modules_is_not_init($item['id_agent_module'])) { // HACK it is saved in show_graph field.
// Show interfaces instead the modules
if ($content['show_graph']) {
$text = $row['availability_item'] = agents_get_address(
modules_get_agentmodule_agent($item['id_agent_module']));
if (empty($text)) {
$text = $row['availability_item'] = __('No Address');
}
}
else {
$text = $row['availability_item'] = modules_get_agentmodule_name(
$item['id_agent_module']);
}
$row['agent'] = modules_get_agentmodule_agent_name(
$item['id_agent_module']);
$text = $row['agent'] . " (" . $text . ")";
$sla_value = reporting_get_agentmodule_sla(
$item['id_agent_module'],
$content['period'],
0.50,
1.50,
$report["datetime"],
null,
$content['time_from'],
$content['time_to']);
$count_checks = modules_get_count_datas(
$item['id_agent_module'],
$report["datetime"] - $content['period'],
$report["datetime"]);
if ($sla_value === false) {
$row['checks'] = __('Unknown');
$row['failed'] = __('Unknown');
$row['fail'] = __('Unknown');
$row['poling_time'] = __('Unknown');
$row['time_unavaliable'] = __('Unknown');
$row['ok'] = __('Unknown');
$row['order'] = 0;
$percent_ok = 0;
}
else {
$percent_ok = format_numeric($sla_value, 2);
$percent_fail = (100 - $percent_ok);
$row['checks'] = format_numeric($count_checks, 0);
$row['ok'] = format_numeric($percent_ok,2) . " %";
$row['order'] = $percent_ok;
$row['fail'] = format_numeric($percent_fail,2) . " %";
$row['failed'] =
format_numeric($percent_fail * $count_checks / 100, 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) {
$row['time_unavaliable'] =
human_time_description_raw(
($percent_fail * $count_checks / 100) * modules_get_interval($item['id_agent_module']),
true);
}
}
$data[] = $row;
$avg = (($avg * $count) + $percent_ok) / ($count + 1);
if (is_null($min)) {
$min = $percent_ok;
$min_text = $text;
}
else {
if ($min > $percent_ok) {
$min = $percent_ok;
$min_text = $text;
}
}
if (is_null($max)) {
$max = $percent_ok;
$max_text = $text;
}
else {
if ($max < $percent_ok) {
$max = $percent_ok;
$max_text = $text;
}
}
//Restore dbconnection //Restore dbconnection
if (($config ['metaconsole'] == 1) && $server_name != '' && defined('METACONSOLE')) { if (($config ['metaconsole'] == 1) && $server_name != '' && defined('METACONSOLE')) {
metaconsole_restore_db(); metaconsole_restore_db();
} }
continue; $count++;
}
$row = array();
$text = "";
// HACK it is saved in show_graph field.
// Show interfaces instead the modules
if ($content['show_graph']) {
$text = $row['availability_item'] = agents_get_address(
modules_get_agentmodule_agent($item['id_agent_module']));
if (empty($text)) {
$text = $row['availability_item'] = __('No Address');
}
}
else {
$text = $row['availability_item'] = modules_get_agentmodule_name(
$item['id_agent_module']);
}
$row['agent'] = modules_get_agentmodule_agent_name(
$item['id_agent_module']);
$text = $row['agent'] . " (" . $text . ")";
$sla_value = reporting_get_agentmodule_sla(
$item['id_agent_module'],
$content['period'],
0.50,
1.50,
$report["datetime"],
null,
$content['time_from'],
$content['time_to']);
$count_checks = modules_get_count_datas(
$item['id_agent_module'],
$report["datetime"] - $content['period'],
$report["datetime"]);
if ($sla_value === false) {
$row['checks'] = __('Unknown');
$row['failed'] = __('Unknown');
$row['fail'] = __('Unknown');
$row['poling_time'] = __('Unknown');
$row['time_unavaliable'] = __('Unknown');
$row['ok'] = __('Unknown');
$row['order'] = 0;
$percent_ok = 0;
}
else {
$percent_ok = format_numeric($sla_value, 2);
$percent_fail = (100 - $percent_ok);
$row['checks'] = format_numeric($count_checks, 0);
$row['ok'] = format_numeric($percent_ok,2) . " %";
$row['order'] = $percent_ok;
$row['fail'] = format_numeric($percent_fail,2) . " %";
$row['failed'] =
format_numeric($percent_fail * $count_checks / 100, 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) {
$row['time_unavaliable'] =
human_time_description_raw(
($percent_fail * $count_checks / 100) * modules_get_interval($item['id_agent_module']),
true);
}
}
$data[] = $row;
$avg = (($avg * $count) + $percent_ok) / ($count + 1);
if (is_null($min)) {
$min = $percent_ok;
$min_text = $text;
}
else {
if ($min > $percent_ok) {
$min = $percent_ok;
$min_text = $text;
}
}
if (is_null($max)) {
$max = $percent_ok;
$max_text = $text;
}
else {
if ($max < $percent_ok) {
$max = $percent_ok;
$max_text = $text;
}
} }
//Restore dbconnection switch ($content['order_uptodown']) {
if (($config ['metaconsole'] == 1) && $server_name != '' && defined('METACONSOLE')) { case REPORT_ITEM_ORDER_BY_AGENT_NAME:
metaconsole_restore_db(); $temp = array();
foreach ($data as $row) {
$i = 0;
foreach ($temp as $t_row) {
if (strcmp($row['agent'], $t_row['agent']) < 0) {
break;
}
$i++;
}
array_splice($temp, $i, 0, array($row));
}
$data = $temp;
break;
case REPORT_ITEM_ORDER_BY_ASCENDING:
$temp = array();
foreach ($data as $row) {
$i = 0;
foreach ($temp as $t_row) {
if ($row['order'] < $t_row['order']) {
break;
}
$i++;
}
array_splice($temp, $i, 0, array($row));
}
$data = $temp;
break;
case REPORT_ITEM_ORDER_BY_DESCENDING:
$temp = array();
foreach ($data as $row) {
$i = 0;
foreach ($temp as $t_row) {
if ($row['order'] > $t_row['order']) {
break;
}
$i++;
}
array_splice($temp, $i, 0, array($row));
}
$data = $temp;
break;
} }
$count++;
} }
switch ($content['order_uptodown']) {
case REPORT_ITEM_ORDER_BY_AGENT_NAME:
$temp = array();
foreach ($data as $row) {
$i = 0;
foreach ($temp as $t_row) {
if (strcmp($row['agent'], $t_row['agent']) < 0) {
break;
}
$i++;
}
array_splice($temp, $i, 0, array($row));
}
$data = $temp;
break;
case REPORT_ITEM_ORDER_BY_ASCENDING:
$temp = array();
foreach ($data as $row) {
$i = 0;
foreach ($temp as $t_row) {
if ($row['order'] < $t_row['order']) {
break;
}
$i++;
}
array_splice($temp, $i, 0, array($row));
}
$data = $temp;
break;
case REPORT_ITEM_ORDER_BY_DESCENDING:
$temp = array();
foreach ($data as $row) {
$i = 0;
foreach ($temp as $t_row) {
if ($row['order'] > $t_row['order']) {
break;
}
$i++;
}
array_splice($temp, $i, 0, array($row));
}
$data = $temp;
break;
}
$return["data"] = $data; $return["data"] = $data;
$return["resume"] = array(); $return["resume"] = array();
$return["resume"]['min_text'] = $min_text; $return["resume"]['min_text'] = $min_text;

View File

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

View File

@ -178,62 +178,33 @@ $table->style[0] = 'text-align:center;';
$table->data = array (); $table->data = array ();
$table->data[0][0] = html_print_image("images/reporting32.png", true, $table->data[0][0] = html_print_image("images/reporting32.png", true,
array("width" => "32", "height" => "32")); array("width" => "32", "height" => "32"));
if (defined("METACONSOLE")) {
if ($report['description'] != '') { if (reporting_get_description($id_report)) {
$table->data[0][1] = '<div style="">' . __("Description: ") . $report['description'] . '</div>'; $table->data[0][1] = '<div style="float:left">' .
} reporting_get_description($id_report) . '</div>';
else {
$table->data[0][1] = '<div style="">' . __("Name: ") . $report['name'] . '</div>';
}
$table->data[0][1] .= '<div style=" width:100%;">'.__('Set initial date') . html_print_checkbox('enable_init_date', 1, $enable_init_date, true);
$html_enterprise = enterprise_hook('reporting_print_button_PDF', array($id_report));
if ($html_enterprise !== ENTERPRISE_NOT_HOOK) {
$table->data[0][1] .= $html_enterprise;
}
$table->data[0][1] .= '</div>';
$table->data[1][1] = '<div style="">' . __('From') . ': ';
$table->data[1][1] .= html_print_input_text ('date_init', $date_init, '', 12, 10, true). ' ';
$table->data[1][1] .= html_print_input_text ('time_init', $time_init, '', 10, 7, true). ' </div>';
$table->data[1][2] = '<div style="display:'.$display_item.';" id="string_items">' . __('Items period before') . ':';
$table->data[1][2] .= html_print_input_text ('date', $date, '', 12, 10, true) . ' ';
$table->data[1][2] .= html_print_input_text ('time', $time, '', 10, 7, true) . ' ';
$table->data[1][2] .= html_print_submit_button (__('Update'), 'date_submit', false, 'class="sub next"', true) . ' </div>';
$table->data[1][2] .= '<div style="display:'.$display_to.';" id="string_to">' . __('to') . ':';
$table->data[1][2] .= html_print_input_text ('date', $date, '', 12, 10, true) . ' ';
$table->data[1][2] .= html_print_input_text ('time', $time, '', 10, 7, true) . ' ';
$table->data[1][2] .= html_print_submit_button (__('Update'), 'date_submit', false, 'class="sub next"', true) . ' </div>';
} }
else { else {
if (reporting_get_description($id_report)) { $table->data[0][1] = '<div style="float:left">' .
$table->data[0][1] = '<div style="float:left">' . reporting_get_name($id_report) . '</div>';
reporting_get_description($id_report) . '</div>';
}
else {
$table->data[0][1] = '<div style="float:left">' .
reporting_get_name($id_report) . '</div>';
}
$table->data[0][1] .= '<div style="text-align:right; width:100%; margin-right:50px">'.__('Set initial date') . html_print_checkbox('enable_init_date', 1, $enable_init_date, true);
$html_enterprise = enterprise_hook('reporting_print_button_PDF',
array($id_report));
if ($html_enterprise !== ENTERPRISE_NOT_HOOK) {
$table->data[0][1] .= $html_enterprise;
}
$table->data[0][1] .= '</div>';
$table->data[1][1] = '<div style="float:left;padding-top:3px;">' . __('From') . ': </div>';
$table->data[1][1] .= html_print_input_text ('date_init', $date_init, '', 12, 10, true). ' ';
$table->data[1][1] .= html_print_input_text ('time_init', $time_init, '', 10, 7, true). ' ';
$table->data[1][2] = '<div style="float:left;padding-top:3px;display:'.$display_item.'" id="string_items">' . __('Items period before') . ':</div>';
$table->data[1][2] .= '<div style="float:left;padding-top:3px;display:'.$display_to.'" id="string_to">' . __('to') . ':</div>';
$table->data[1][2] .= html_print_input_text ('date', $date, '', 12, 10, true). ' ';
$table->data[1][2] .= html_print_input_text ('time', $time, '', 10, 7, true). ' ';
$table->data[1][2] .= html_print_submit_button (__('Update'), 'date_submit', false, 'class="sub next"', true);
} }
$table->data[0][1] .= '<div style="text-align:right; width:100%; margin-right:50px">'.__('Set initial date') . html_print_checkbox('enable_init_date', 1, $enable_init_date, true);
$html_enterprise = enterprise_hook('reporting_print_button_PDF',
array($id_report));
if ($html_enterprise !== ENTERPRISE_NOT_HOOK) {
$table->data[0][1] .= $html_enterprise;
}
$table->data[0][1] .= '</div>';
$table->data[1][1] = '<div style="float:left;padding-top:3px;">' . __('From') . ': </div>';
$table->data[1][1] .= html_print_input_text ('date_init', $date_init, '', 12, 10, true). ' ';
$table->data[1][1] .= html_print_input_text ('time_init', $time_init, '', 10, 7, true). ' ';
$table->data[1][2] = '<div style="float:left;padding-top:3px;display:'.$display_item.'" id="string_items">' . __('Items period before') . ':</div>';
$table->data[1][2] .= '<div style="float:left;padding-top:3px;display:'.$display_to.'" id="string_to">' . __('to') . ':</div>';
$table->data[1][2] .= html_print_input_text ('date', $date, '', 12, 10, true). ' ';
$table->data[1][2] .= html_print_input_text ('time', $time, '', 10, 7, true). ' ';
$table->data[1][2] .= html_print_submit_button (__('Update'), 'date_submit', false, 'class="sub next"', true);
echo '<form method="post" action="' . $url . '&pure=' . $config["pure"] . '" style="margin-right: 0px;">'; echo '<form method="post" action="' . $url . '&pure=' . $config["pure"] . '" style="margin-right: 0px;">';
html_print_table ($table); html_print_table ($table);
html_print_input_hidden ('id_report', $id_report); html_print_input_hidden ('id_report', $id_report);

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_console %define name pandorafms_console
%define version 6.1dev %define version 6.1dev
%define release 160125 %define release 160126
# 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.1dev %define version 6.1dev
%define release 160125 %define release 160126
%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.1dev'); INSERT INTO tconfig (token, value) VALUES('db_scheme_version','6.1dev');
INSERT INTO tconfig (token, value) VALUES('db_scheme_build','PD160125'); INSERT INTO tconfig (token, value) VALUES('db_scheme_build','PD160126');
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.1dev-160125 Version: 6.1dev-160126
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.1dev-160125" pandora_version="6.1dev-160126"
package_cpan=0 package_cpan=0
package_pandora=1 package_pandora=1

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.1dev"; my $pandora_version = "6.1dev";
my $pandora_build = "160125"; my $pandora_build = "160126";
our $VERSION = $pandora_version." ".$pandora_build; our $VERSION = $pandora_version." ".$pandora_build;
# Setup hash # Setup hash

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_server %define name pandorafms_server
%define version 6.1dev %define version 6.1dev
%define release 160125 %define release 160126
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.1dev %define version 6.1dev
%define release 160125 %define release 160126
Summary: Pandora FMS Server Summary: Pandora FMS Server
Name: %{name} Name: %{name}

View File

@ -9,7 +9,7 @@
# ********************************************************************** # **********************************************************************
PI_VERSION="6.1dev" PI_VERSION="6.1dev"
PI_BUILD="160125" PI_BUILD="160126"
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.1dev PS160125"; my $version = "6.1dev PS160126";
# 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.1dev PS160125"; my $version = "6.1dev PS160126";
# save program name for logging # save program name for logging
my $progname = basename($0); my $progname = basename($0);
@ -3320,17 +3320,17 @@ sub cli_create_synthetic() {
my $agent_name = @ARGV[4]; my $agent_name = @ARGV[4];
my @module_data = @ARGV[5..$#ARGV]; my @module_data = @ARGV[5..$#ARGV];
my $module; my $module;
my (@filterdata,@data_module,$module_data); my (@filterdata,@data_module);
if ($synthetic_type ne 'arithmetic' && $synthetic_type ne 'average') { if ($synthetic_type ne 'arithmetic' && $synthetic_type ne 'average') {
print("[ERROR] Type of syntethic module doesn't exists \n\n"); print("[ERROR] Type of syntethic module doesn't exists \n\n");
exit 1; exit 1;
} }
if (scalar(@{$module_data}) == 0) { if (scalar(@{module_data}) == 0) {
print("[ERROR] No modules data \n\n"); print("[ERROR] No modules data \n\n");
exit 1; exit 1;
} }
if ($name_module == '') { if ($name_module eq '') {
print("[ERROR] No module name \n\n"); print("[ERROR] No module name \n\n");
exit 1; exit 1;
} }
@ -3384,7 +3384,9 @@ sub cli_create_synthetic() {
$module->{'id_agente'} = $id_agent; $module->{'id_agente'} = $id_agent;
$module->{'nombre'} = safe_input($name_module); $module->{'nombre'} = safe_input($name_module);
my $id_tipo_modulo = get_db_value ($dbh, "SELECT id_tipo FROM ttipo_modulo WHERE nombre = ?", "generic_data");
$module->{'id_modulo'} = 5; $module->{'id_modulo'} = 5;
$module->{'id_tipo_modulo'} = $id_tipo_modulo;
my $id_module = db_process_insert($dbh, 'id_agente_modulo', 'tagente_modulo', $module); my $id_module = db_process_insert($dbh, 'id_agente_modulo', 'tagente_modulo', $module);
@ -3395,10 +3397,12 @@ sub cli_create_synthetic() {
print("[OK] The modules are creating ID: $id_module \n\n"); print("[OK] The modules are creating ID: $id_module \n\n");
} }
else { else {
db_do ($dbh, 'DELETE FROM tagente_modulo WHERE id_agente_modulo = ?', $id_module);
print("[ERROR] Problems with creating data module. \n\n"); print("[ERROR] Problems with creating data module. \n\n");
} }
} }
else { else {
db_do ($dbh, 'DELETE FROM tagente_modulo WHERE nombre = ? AND id_agente = ?', $name_module, $id_agent);
print("[INFO] Problems with creating module \n\n"); print("[INFO] Problems with creating module \n\n");
} }
} }