Merge branch 'develop' of https://192.168.50.5:8081/artica/pandorafms into develop

This commit is contained in:
m-lopez-f 2016-12-13 13:11:18 +01:00
commit c75a5a86f4
43 changed files with 313 additions and 80 deletions

View File

@ -1,5 +1,5 @@
package: pandorafms-agent-unix package: pandorafms-agent-unix
Version: 7.0dev-161204 Version: 7.0dev-161213
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="7.0dev-161204" pandora_version="7.0dev-161213"
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 => '7.0dev'; use constant AGENT_VERSION => '7.0dev';
use constant AGENT_BUILD => '161204'; use constant AGENT_BUILD => '161213';
# 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;
@ -131,6 +131,7 @@ my %DefaultConf = (
'temporal' => '/var/spool/pandora', 'temporal' => '/var/spool/pandora',
'interval' => 300, 'interval' => 300,
'debug' => 0, 'debug' => 0,
'ehorus_conf' => undef,
'agent_name' => hostname (), 'agent_name' => hostname (),
'agent_name_cmd' => '', 'agent_name_cmd' => '',
'description' => '', 'description' => '',
@ -2194,6 +2195,39 @@ sub init_module ($) {
$module->{'alert_template'} = undef; $module->{'alert_template'} = undef;
} }
################################################################################
# Get the eHorus key from the eHorus agent configuration file.
################################################################################
sub get_ehkey {
my $fh;
return '' unless defined($Conf{'ehorus_conf'});
# Open the eHorus configuration file.
if (!open($fh, '<', $Conf{'ehorus_conf'})) {
# Do not write to the log, since ehorus_conf points to the default eHorus configuration file by default.
return '';
}
# Look for the eHorus key.
while (my $line = <$fh>) {
# Skip comments.
next if ($line =~ m/^\s*#/);
if ($line =~ m/\s*eh_key\s+(\S+)/) {
my $eh_key = $1;
close($fh);
return $eh_key;
}
}
# Not found.
close($fh);
return '';
}
################################################################################ ################################################################################
# Main. # Main.
################################################################################ ################################################################################
@ -2373,11 +2407,14 @@ while (1) {
# Clear the XML # Clear the XML
$Xml = ""; $Xml = "";
# Get the eHorus key.
my $eh_key = get_ehkey();
# Custom fields # Custom fields
my @customfieldskeys = keys(%Customfields); my @customfieldskeys = keys(%Customfields);
if ($#customfieldskeys > -1) { if ($#customfieldskeys > -1 || $eh_key ne '') {
$Xml .= "<custom_fields>\n"; $Xml .= "<custom_fields>\n";
foreach my $customfieldkey (@customfieldskeys) { foreach my $customfieldkey (@customfieldskeys) {
if($customfieldkey =~ m/^(custom_field\d+_)name/) { if($customfieldkey =~ m/^(custom_field\d+_)name/) {
if(defined($Customfields{$1."value"})) { if(defined($Customfields{$1."value"})) {
@ -2388,6 +2425,15 @@ while (1) {
} }
} }
} }
# Add the eHorus key as a custom field.
if ($eh_key ne '') {
$Xml .= " <field>\n";
$Xml .= " <name>eHorusID</name>\n";
$Xml .= " <value><![CDATA[". $eh_key ."]]></value>\n";
$Xml .= " </field>\n";
}
$Xml .= "</custom_fields>\n"; $Xml .= "</custom_fields>\n";
} }
@ -2475,6 +2521,7 @@ while (1) {
$xml_header .= "' position_description='" .$Conf{'position_description'}; $xml_header .= "' position_description='" .$Conf{'position_description'};
} }
} }
$xml_header .= "'>\n"; $xml_header .= "'>\n";
$Xml = $xml_header . $Xml . "</agent_data>"; $Xml = $xml_header . $Xml . "</agent_data>";

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_agent_unix %define name pandorafms_agent_unix
%define version 7.0dev %define version 7.0dev
%define release 161204 %define release 161213
Summary: Pandora FMS Linux agent, PERL version Summary: Pandora FMS Linux agent, PERL version
Name: %{name} Name: %{name}
@ -24,7 +24,7 @@ Requires(preun): chkconfig /bin/rm /usr/sbin/userdel
Requires: fileutils textutils unzip Requires: fileutils textutils unzip
Requires: util-linux procps grep Requires: util-linux procps grep
Requires: /sbin/ip /bin/awk Requires: /sbin/ip /bin/awk
Requires: perl perl(Sys::Syslog) Requires: perl perl(Sys::Syslog) perl(IO::Socket::SSL)
# Required by plugins # Required by plugins
#Requires: sh-utils sed passwd net-tools rpm #Requires: sh-utils sed passwd net-tools rpm
AutoReq: 0 AutoReq: 0

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_agent_unix %define name pandorafms_agent_unix
%define version 7.0dev %define version 7.0dev
%define release 161204 %define release 161213
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="7.0dev" PI_VERSION="7.0dev"
PI_BUILD="161204" PI_BUILD="161213"
OS_NAME=`uname -s` OS_NAME=`uname -s`
FORCE=0 FORCE=0

View File

@ -186,7 +186,7 @@ UpgradeApplicationID
{} {}
Version Version
{161204} {161213}
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 ("7.0dev(Build 161204)") #define PANDORA_VERSION ("7.0dev(Build 161213)")
string pandora_path; string pandora_path;
string pandora_dir; string pandora_dir;

View File

@ -385,7 +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, agent_mode; string custom_id, url_address, latitude, longitude, altitude, position_description, gis_exec, gis_result, agent_mode;
string group_password; string group_password, ehorus_conf;
time_t ctime; time_t ctime;
struct tm *ctime_tm = NULL; struct tm *ctime_tm = NULL;
int pos; int pos;
@ -479,13 +479,12 @@ Pandora_Windows_Service::getXmlHeader () {
xml += url_address; xml += url_address;
} }
// Get Url Address // Get group password
group_password = conf->getValue ("group_password"); group_password = conf->getValue ("group_password");
if (group_password != "") { if (group_password != "") {
xml += "\" group_password=\""; xml += "\" group_password=\"";
xml += group_password; xml += group_password;
} }
// Get Coordinates // Get Coordinates
gis_exec = conf->getValue ("gis_exec"); gis_exec = conf->getValue ("gis_exec");
@ -1634,6 +1633,7 @@ Pandora_Windows_Service::sendXml (Pandora_Module_List *modules) {
string xml_filename, random_integer; string xml_filename, random_integer;
string tmp_filename, tmp_filepath; string tmp_filename, tmp_filepath;
string encoding; string encoding;
string ehorus_conf, eh_key;
static HANDLE mutex = 0; static HANDLE mutex = 0;
ULARGE_INTEGER free_bytes; ULARGE_INTEGER free_bytes;
double min_free_bytes = 0; double min_free_bytes = 0;
@ -1653,6 +1653,12 @@ Pandora_Windows_Service::sendXml (Pandora_Module_List *modules) {
data_xml = getXmlHeader (); data_xml = getXmlHeader ();
/* Get the eHorus key. */
ehorus_conf = conf->getValue ("ehorus_conf");
if (ehorus_conf != "") {
eh_key = getEHKey(ehorus_conf);
}
/* Write custom fields */ /* Write custom fields */
int c = 1; int c = 1;
@ -1662,8 +1668,8 @@ Pandora_Windows_Service::sendXml (Pandora_Module_List *modules) {
sprintf(token_value_token, "custom_field%d_value", c); sprintf(token_value_token, "custom_field%d_value", c);
string token_name = conf->getValue (token_name_token); string token_name = conf->getValue (token_name_token);
string token_value = conf->getValue (token_value_token); string token_value = conf->getValue (token_value_token);
if(token_name != "" && token_value != "") { if((token_name != "" && token_value != "") || eh_key != "") {
data_xml += "<custom_fields>\n"; data_xml += "<custom_fields>\n";
while(token_name != "" && token_value != "") { while(token_name != "" && token_value != "") {
data_xml += " <field>\n"; data_xml += " <field>\n";
@ -1677,6 +1683,15 @@ Pandora_Windows_Service::sendXml (Pandora_Module_List *modules) {
token_name = conf->getValue (token_name_token); token_name = conf->getValue (token_name_token);
token_value = conf->getValue (token_value_token); token_value = conf->getValue (token_value_token);
} }
/* Add the eHorus key as a custom field. */
if (eh_key != "") {
data_xml += " <field>\n";
data_xml += " <name>eHorusID</name>\n";
data_xml += " <value><![CDATA["+ eh_key +"]]></value>\n";
data_xml += " </field>\n";
}
data_xml += "</custom_fields>\n"; data_xml += "</custom_fields>\n";
} }
@ -2034,6 +2049,37 @@ Pandora_Windows_Service::getConf () {
return this->conf; return this->conf;
} }
string
Pandora_Windows_Service::getEHKey (string ehorus_conf) {
string buffer, eh_key;
std::ifstream ifs(ehorus_conf.c_str());
int pos;
if (! ifs.is_open ()) {
pandoraDebug ("Error opening eHorus configuration file %s", ehorus_conf.c_str ());
return eh_key;
}
/* Look for the eHorus key. */
while (ifs.good ()) {
getline (ifs, buffer);
/* Skip comments. */
if (buffer.empty() || buffer.at(0) == '#') {
continue;
}
pos = buffer.find("eh_key");
if (pos != string::npos){
eh_key = buffer.substr(pos + 7); /* pos + strlen("eh_key ") */
eh_key = trim(eh_key);
return eh_key;
}
}
return eh_key;
}
long long
Pandora_Windows_Service::getInterval () { Pandora_Windows_Service::getInterval () {
return this->interval; return this->interval;

View File

@ -114,6 +114,7 @@ namespace Pandora {
int sendXml (Pandora_Module_List *modules); int sendXml (Pandora_Module_List *modules);
void sendBufferedXml (string path); void sendBufferedXml (string path);
Pandora_Agent_Conf *getConf (); Pandora_Agent_Conf *getConf ();
string getEHKey (string ehorus_conf);
long getInterval (); long getInterval ();
long getIntensiveInterval (); long getIntensiveInterval ();

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", "(7.0dev(Build 161204))" VALUE "ProductVersion", "(7.0dev(Build 161213))"
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: 7.0dev-161204 Version: 7.0dev-161213
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="7.0dev-161204" pandora_version="7.0dev-161213"
package_pear=0 package_pear=0
package_pandora=1 package_pandora=1

View File

@ -123,3 +123,8 @@ ALTER TABLE tlayout ADD `background_color` varchar(50) NOT NULL default '#FFF';
-- Table `tlayout_data` -- Table `tlayout_data`
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
ALTER TABLE tlayout_data ADD `type_graph` varchar(50) NOT NULL default 'area'; ALTER TABLE tlayout_data ADD `type_graph` varchar(50) NOT NULL default 'area';
-- ---------------------------------------------------------------------
-- Table `tagent_custom_fields`
-- ---------------------------------------------------------------------
INSERT INTO `tagent_custom_fields` (`name`) VALUES ('eHorusID');

View File

@ -101,3 +101,8 @@ ALTER TABLE tlayout ADD COLUMN background_color varchar(50) NOT NULL default '#F
-- Table `tlayout_data` -- Table `tlayout_data`
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
ALTER TABLE tlayout_data ADD COLUMN type_graph varchar(50) NOT NULL default 'area'; ALTER TABLE tlayout_data ADD COLUMN type_graph varchar(50) NOT NULL default 'area';
-- ---------------------------------------------------------------------
-- Table `tagent_custom_fields`
-- ---------------------------------------------------------------------
INSERT INTO tagent_custom_fields (name) VALUES ('eHorusID');

View File

@ -299,7 +299,7 @@ html_print_table ($table);
echo '<div style="width: '.$table->width.'" class="action-buttons">'; echo '<div style="width: '.$table->width.'" class="action-buttons">';
echo '<a href="' . echo '<a href="' .
ui_get_full_url(false, false, false, false) . 'index.php?sec=gextensions&sec2=godmode/audit_log_csv&tipo_log='.$tipo_log.'&user_filter='.$user_filter.'&filter_text='.$filter_text.'&filter_hours_old='.$filter_hours_old.'&filter_ip='.$filter_ip.'"'. ui_get_full_url(false, false, false, false) . 'index.php?sec=gextensions&sec2=godmode/audit_log_csv&tipo_log='.$tipo_log.'&user_filter='.$user_filter.'&filter_text='.$filter_text.'&filter_hours_old='.$filter_hours_old.'&filter_ip='.$filter_ip.'"'.
'target="_new">' . '>' .
html_print_button (__('Export to CSV '), 'export_csv', false, '', 'class=sub upd', true, false). '</a>'; html_print_button (__('Export to CSV '), 'export_csv', false, '', 'class=sub upd', true, false). '</a>';
echo '</div>'; echo '</div>';

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

View File

@ -22,7 +22,7 @@
/** /**
* Pandora build version and version * Pandora build version and version
*/ */
$build_version = 'PC161204'; $build_version = 'PC161213';
$pandora_version = 'v7.0dev'; $pandora_version = 'v7.0dev';
// Do not overwrite default timezone set if defined. // Do not overwrite default timezone set if defined.

View File

@ -28,8 +28,12 @@ function mysql_connect_db($host = null, $db = null, $user = null, $pass = null,
if ($port === null) if ($port === null)
$port = $config["dbport"]; $port = $config["dbport"];
if ($config["mysqli"] === null && extension_loaded(mysqli)) if ($config["mysqli"] === null && extension_loaded(mysqli)) {
$config["mysqli"] = true; $config["mysqli"] = true;
}
else {
$config["mysqli"] = false;
}
// Non-persistent connection: This will help to avoid mysql errors like "has gone away" or locking problems // Non-persistent connection: This will help to avoid mysql errors like "has gone away" or locking problems
// If you want persistent connections change it to mysql_pconnect(). // If you want persistent connections change it to mysql_pconnect().

View File

@ -2293,6 +2293,11 @@ function print_audit_csv ($data) {
global $config; global $config;
global $graphic_type; global $graphic_type;
if (!$data) {
echo __('No data found to export');
return 0;
}
$config['ignore_callback'] = true; $config['ignore_callback'] = true;
while (@ob_end_clean ()); while (@ob_end_clean ());
@ -2300,20 +2305,20 @@ function print_audit_csv ($data) {
header("Content-Disposition: attachment; filename=audit_log".date("Y-m-d_His").".csv"); header("Content-Disposition: attachment; filename=audit_log".date("Y-m-d_His").".csv");
header("Pragma: no-cache"); header("Pragma: no-cache");
header("Expires: 0"); header("Expires: 0");
// BOM
print pack('C*',0xEF,0xBB,0xBF);
if ($data) { echo __('User') . ';' .
echo __('User') . ';' . __('Action') . ';' .
__('Action') . ';' . __('Date') . ';' .
__('Date') . ';' . __('Source ID') . ';' .
__('Source ID') . ';' . __('Comments') ."\n";
__('Comments') ."\n"; foreach ($data as $line) {
foreach ($data as $line) { echo io_safe_output($line['id_usuario']) . ';' . io_safe_output($line['accion']) . ';' . $line['fecha'] . ';' . $line['ip_origen'] . ';'. io_safe_output($line['descripcion']). "\n";
echo io_safe_output($line['id_usuario']) . ';' . io_safe_output($line['accion']) . ';' . $line['fecha'] . ';' . $line['ip_origen'] . ';'. io_safe_output($line['descripcion']). "\n";
}
}
else {
echo __('No data found to export');
} }
exit;
} }
/** /**

View File

@ -132,7 +132,7 @@ function alerts_get_alerts($id_group = 0, $free_search = "", $status = "all", $s
* *
* @return mixed Return id if the group have any alert is fired or false is not. * @return mixed Return id if the group have any alert is fired or false is not.
*/ */
function alerts_get_event_status_group($idGroup, $type = "alert_fired", $query = 'AND 1=1') { function alerts_get_event_status_group($idGroup, $type = "alert_fired", $query = 'AND 1=1', $agents = null) {
global $config; global $config;
$return = false; $return = false;
@ -151,9 +151,14 @@ function alerts_get_event_status_group($idGroup, $type = "alert_fired", $query =
$typeWhere = ' AND event_type IN (' . implode(',', $temp) . ')'; $typeWhere = ' AND event_type IN (' . implode(',', $temp) . ')';
} }
$agents = agents_get_group_agents($idGroup, false, "lower", false); if ($agents == null) {
$agents = agents_get_group_agents($idGroup, false, "lower", false);
$idAgents = array_keys($agents);
$idAgents = array_keys($agents);
}
else {
$idAgents = array_values($agents);
}
$result = db_get_all_rows_sql('SELECT id_evento $result = db_get_all_rows_sql('SELECT id_evento
FROM tevento FROM tevento

View File

@ -1339,6 +1339,8 @@ function reporting_event_report_group($report, $content,
metaconsole_restore_db(); metaconsole_restore_db();
} }
$return['total_events'] = count($return['data']);
return reporting_check_structure_content($return); return reporting_check_structure_content($return);
} }
@ -1383,6 +1385,8 @@ function reporting_event_report_module($report, $content) {
metaconsole_restore_db(); metaconsole_restore_db();
} }
$return['total_events'] = count($return['data']);
return reporting_check_structure_content($return); return reporting_check_structure_content($return);
} }
@ -2201,6 +2205,8 @@ function reporting_event_report_agent($report, $content,
metaconsole_restore_db(); metaconsole_restore_db();
} }
$return['total_events'] = count($return['data']);
return reporting_check_structure_content($return); return reporting_check_structure_content($return);
} }

View File

@ -130,10 +130,8 @@ function reporting_html_print_report($report, $mini = false) {
$item['date']['to'], $item['date']['to'],
$label); $label);
if ($item["description"] != "") { $table->data['description_row']['description'] = $item["description"]." - Total events: ".$item["total_events"];
$table->data['description_row']['description'] = $item["description"];
$table->colspan['description_row']['description'] = 3; $table->colspan['description_row']['description'] = 3;
}
switch ($item['type']) { switch ($item['type']) {
case 'availability': case 'availability':

View File

@ -247,6 +247,42 @@ function treeview_printModuleTable($id_module, $server_data = false, $no_head =
$last_data_str .= "&nbsp;"; $last_data_str .= "&nbsp;";
$last_data_str .= html_print_image('images/clock2.png', true, array('title' => $last_data["timestamp"], 'width' => '18px')); $last_data_str .= html_print_image('images/clock2.png', true, array('title' => $last_data["timestamp"], 'width' => '18px'));
$is_snapshot = is_snapshot_data ( $last_data["datos"] );
if (($config['command_snapshot']) && ($is_snapshot)) {
$handle = 'snapshot_' . $module['id_agente_modulo'];
$url = 'include/procesos.php?agente=' . $row['id_agente_modulo'];
$win_handle = dechex(crc32($handle));
if (! defined ('METACONSOLE')) {
$link = "winopeng_var('operation/agentes/snapshot_view.php?" .
"id=" . $module['id_agente_modulo'] .
"&refr=" . $module['current_interval'] .
"&label=" . rawurlencode(urlencode(io_safe_output($module['module_name']))) . "','" . $win_handle . "', 700,480)";
}
else{
$link = "winopeng_var('$last_data[datos]','',700,480)";
}
if(!is_image_data($last_data["datos"])){
$salida = '<a href="javascript:' . $link . '">' .
html_print_image('images/default_list.png', true,
array('border' => '0',
'alt' => '',
'title' => __('Snapshot view'))) . '</a> &nbsp;&nbsp;';
}
else {
$salida = '<a href="javascript:' . $link . '">' .
html_print_image('images/photo.png', true,
array('border' => '0',
'alt' => '',
'title' => __('Snapshot view'))) . '</a> &nbsp;&nbsp;';
}
}
$last_data_str .= $salida;
} }
else { else {
$last_data_str = '<i>' . __('No data') . '</i>'; $last_data_str = '<i>' . __('No data') . '</i>';

View File

@ -3509,6 +3509,17 @@ div.simple_value > a > span.text p
font-size:13pt; font-size:13pt;
top:8px; top:8px;
} }
.modalheaderh1{
text-align:center;
width:100%;
height:37px;
left:0px;
background-color:#82b92e;
color:white;
position:relative;
font-family:Nunito;
font-size:13pt;
}
.modalclosex{ .modalclosex{
cursor:pointer; cursor:pointer;
display:inline; display:inline;

View File

@ -71,7 +71,7 @@
<div style='height: 10px'> <div style='height: 10px'>
<?php <?php
$version = '7.0dev'; $version = '7.0dev';
$build = '161204'; $build = '161213';
$banner = "v$version Build $build"; $banner = "v$version Build $build";
error_reporting(0); error_reporting(0);

View File

@ -62,14 +62,14 @@ $label = get_parameter ("label");
FROM tagente_estado FROM tagente_estado
WHERE id_agente_modulo = $id"); WHERE id_agente_modulo = $id");
echo "<h2 id='title_snapshot_view'>"; echo "<h2 style='text-align:center;' id='title_snapshot_view'>";
echo __("Current data at"); echo __("Current data at");
echo " "; echo " ";
echo $row["timestamp"]; echo $row["timestamp"];
echo "</h2>"; echo "</h2>";
$datos = io_safe_output($row["datos"]); $datos = io_safe_output($row["datos"]);
if (is_image_data($datos)) { if (is_image_data($datos)) {
echo '<img src="' . $datos . '" alt="image"/>'; echo '<center><img src="' . $datos . '" alt="image"/></center>';
} }
else { else {
$datos = preg_replace ('/</', '&lt;', $datos); $datos = preg_replace ('/</', '&lt;', $datos);

View File

@ -133,24 +133,30 @@ if (is_ajax ()) {
$id = get_parameter('id_row'); $id = get_parameter('id_row');
$idGroup = get_parameter('id_group'); $idGroup = get_parameter('id_group');
$agents = get_parameter('agents', null);
$query = ' AND id_evento > ' . $id; $query = ' AND id_evento > ' . $id;
$type = array(); $type = array();
$alert = get_parameter('alert_fired'); $alert = get_parameter('alert_fired');
if ($alert == 'true') { if ($alert == 'true') {
$resultAlert = alerts_get_event_status_group($idGroup, $resultAlert = alerts_get_event_status_group($idGroup,
'alert_fired', $query); 'alert_fired', $query, $agents);
} }
$critical = get_parameter('critical'); $critical = get_parameter('critical');
if ($critical == 'true') { if ($critical == 'true') {
$resultCritical = alerts_get_event_status_group($idGroup, $resultCritical = alerts_get_event_status_group($idGroup,
'going_up_critical', $query); 'going_up_critical', $query, $agents);
} }
$warning = get_parameter('warning'); $warning = get_parameter('warning');
if ($warning == 'true') { if ($warning == 'true') {
$resultWarning = alerts_get_event_status_group($idGroup, $resultWarning = alerts_get_event_status_group($idGroup,
'going_up_warning', $query); 'going_up_warning', $query, $agents);
}
$unknown = get_parameter('unknown');
if ($unknown == 'true') {
$resultUnknown = alerts_get_event_status_group($idGroup,
'going_unknown', $query, $agents);
} }
if ($resultAlert) { if ($resultAlert) {
@ -165,6 +171,10 @@ if (is_ajax ()) {
$return = array('fired' => $resultWarning, $return = array('fired' => $resultWarning,
'sound' => $config['sound_warning']); 'sound' => $config['sound_warning']);
} }
else if ($resultUnknown) {
$return = array('fired' => $resultWarning,
'sound' => $config['sound_alert']);
}
else { else {
$return = array('fired' => 0); $return = array('fired' => 0);
} }
@ -427,7 +437,7 @@ if ($config["pure"] == 0 || $meta) {
echo ui_get_full_url('operation/events/sound_events.php'); echo ui_get_full_url('operation/events/sound_events.php');
?>'; ?>';
window.open(url, '<?php __('Sound Alerts'); ?>','width=300, height=300, toolbar=no, location=no, directories=no, status=no, menubar=no, resizable=yes'); window.open(url, '<?php __('Sound Alerts'); ?>','width=400, height=380, toolbar=no, location=no, directories=no, status=no, menubar=no, resizable=no');
} }
</script> </script>
<?php <?php

View File

@ -44,6 +44,8 @@ if (! check_acl ($config['id_user'], 0, "ER") && ! check_acl ($config['id_user']
return; return;
} }
$agents = agents_get_group_agents(0, false, "none", false, true);
echo "<html>"; echo "<html>";
echo "<head>"; echo "<head>";
echo "<title>" . __("Sound Events") . "</title>"; echo "<title>" . __("Sound Events") . "</title>";
@ -62,32 +64,40 @@ echo "<title>" . __("Sound Events") . "</title>";
echo '<link rel="icon" href="../../images/pandora.ico" type="image/ico" />'; echo '<link rel="icon" href="../../images/pandora.ico" type="image/ico" />';
echo '<link rel="stylesheet" href="../../include/styles/pandora.css" type="text/css" />'; echo '<link rel="stylesheet" href="../../include/styles/pandora.css" type="text/css" />';
echo "</head>"; echo "</head>";
echo "<body>"; echo "<body style='max-width: 400px; max-height: 400px;'>";
echo html_print_image('images/pandora_logo_head.png', true); echo "<h1 class='modalheaderh1'>" . __("Sound console"). "</h1>";
echo "<h1 style='background: #66AA44; color: #fff;'>" . __("Sound console"). "</h1>";
$table = null; $table = null;
$table->width = '100%'; $table->width = '100%';
$table->size[0] = '10%'; $table->size[0] = '10%';
$table->size[1] = '90%';
$table->style[0] = 'font-weight: bold; vertical-align: top;'; $table->style[0] = 'font-weight: bold; vertical-align: top;';
$table->style[1] = 'font-weight: bold; vertical-align: top;';
$table->data[0][0] = __('Group'); $table->data[0][0] = __('Group');
$table->data[0][1] = html_print_select_groups(false, $access, true, 'group', '', 'changeGroup();', '', 0, true); $table->data[0][0] .= html_print_select_groups(false, $access, true, 'group', '', 'changeGroup();', '', 0, true) . '<br />' . '<br />';
$table->data[1][0] = __('Type'); $table->data[0][0] .= __('Agent');
$table->data[1][1] = html_print_checkbox('alert_fired', 'alert_fired', true, true, false, 'changeType();') . __('Alert fired') . '<br />' . $table->data[0][0] .= html_print_select($agents, 'id_agents[]', true, false, '', '', true, true);
$table->data[0][1] = __('Type');
$table->data[0][1] .= '<br />' . html_print_checkbox('alert_fired', 'alert_fired', true, true, false, 'changeType();') . __('Alert fired') . '<br />' .
html_print_checkbox('critical', 'critical', true, true, false, 'changeType();') . __('Monitor critical') . '<br />' . html_print_checkbox('critical', 'critical', true, true, false, 'changeType();') . __('Monitor critical') . '<br />' .
html_print_checkbox('warning', 'warning', true, true, false, 'changeType();') . __('Monitor warning') . '<br />' . html_print_checkbox('unknown', 'unknown', true, true, false, 'changeType();') . __('Monitor unknown') . '<br />' .
$table->data[2][0] = ''; html_print_checkbox('warning', 'warning', true, true, false, 'changeType();') . __('Monitor warning') . '<br />';
$table->data[2][1] = '<a href="javascript: toggleButton();">' .
html_print_image("images/play.button.png", true, array("id" => "button")) .
'</a>';
$table->data[2][1] .= '<a href="javascript: ok();">' .
html_print_image("images/ok.button.png", true,
array("style" => "margin-left: 10px;")) . '</a>';
html_print_table($table); html_print_table($table);
echo '<br />';
echo '<a href="javascript: toggleButton();">' .
html_print_image("images/icono_play.png", true, array("id" => "button")) .
'</a>';
echo '<a href="javascript: ok();">' .
html_print_image("images/icono_ok.png", true, array("style" => "margin-left: 15px;")) .
'</a>';
echo '<a href="javascript: test_sound_button();">' .
html_print_image("images/icono_test.png", true, array("id" => "button_try", "style" => "margin-left: 15px;")) .
'</a>';
?> ?>
<script src="../../include/javascript/jquery.js" type="text/javascript"></script> <script src="../../include/javascript/jquery.js" type="text/javascript"></script>
<script type="text/javascript"> <script type="text/javascript">
@ -95,6 +105,7 @@ var group = 0;
var alert_fired = true; var alert_fired = true;
var critical = true; var critical = true;
var warning = true; var warning = true;
var unknown = true;
var running = false; var running = false;
var fired = false; var fired = false;
@ -105,14 +116,48 @@ var redBackground = false;
var button_play_status = "play"; var button_play_status = "play";
var test_sound = false;
function test_sound_button() {
if (!test_sound) {
$("#button_try").attr('src', '../../images/icono_test_active.png');
$('body').append("<audio src='../../include/sounds/Star_Trek_emergency_simulation.wav' autoplay='true' hidden='true' loop='false'>");
test_sound = true;
}
else {
$("#button_try").attr('src', '../../images/icono_test.png');
$('body audio').remove();
test_sound = false;
}
}
function changeGroup() { function changeGroup() {
group = $("#group").val(); group = $("#group").val();
jQuery.post ("../../ajax.php",
{"page" : "include/ajax/agent",
"get_agents_group": 1,
"id_group": group
},
function (data) {
$("#id_agents").empty();
$("#id_agents").style("size", 0);
jQuery.each (data, function (id, value) {
if (value != "") {
$("#id_agents").append('<option value="' + id + '">' + value + '</option>');
}
});
},
"json"
);
} }
function changeType() { function changeType() {
alert_fired = $("input[name=alert_fired]").attr('checked'); alert_fired = $("input[name=alert_fired]").attr('checked');
critical = $("input[name=critical]").attr('checked'); critical = $("input[name=critical]").attr('checked');
warning = $("input[name=warning]").attr('checked'); warning = $("input[name=warning]").attr('checked');
unknown = $("input[name=unknown]").attr('checked');
} }
function toggleButton() { function toggleButton() {
@ -120,14 +165,14 @@ function toggleButton() {
if (button_play_status == 'pause') { if (button_play_status == 'pause') {
//~ if ($("#button").attr('src') == '../../images/pause.button.png') { //~ if ($("#button").attr('src') == '../../images/pause.button.png') {
$("#button").attr('src', '../../images/play.button.png'); $("#button").attr('src', '../../images/icono_play.png');
stopSound(); stopSound();
button_play_status = 'play'; button_play_status = 'play';
} }
else { else {
$("#button").attr('src', '../../images/pause.button.png'); $("#button").attr('src', '../../images/icono_pausa.png');
forgetPreviousEvents(); forgetPreviousEvents();
startSound(); startSound();
@ -152,17 +197,21 @@ function stopSound() {
} }
function startSound() { function startSound() {
//running = true; running = true;
} }
function forgetPreviousEvents() { function forgetPreviousEvents() {
var agents = $("#id_agents").val();
jQuery.post ("../../ajax.php", jQuery.post ("../../ajax.php",
{"page" : "operation/events/events", {"page" : "operation/events/events",
"get_events_fired": 1, "get_events_fired": 1,
"id_group": group, "id_group": group,
"agents[]" : agents,
"alert_fired": alert_fired, "alert_fired": alert_fired,
"critical": critical, "critical": critical,
"warning": warning, "warning": warning,
"unknown": unknown,
"id_row": id_row "id_row": id_row
}, },
function (data) { function (data) {
@ -177,15 +226,19 @@ function forgetPreviousEvents() {
} }
function check_event() { function check_event() {
var agents = $("#id_agents").val();
if (running) { if (running) {
if (!fired) { if (!fired) {
jQuery.post ("../../ajax.php", jQuery.post ("../../ajax.php",
{"page" : "operation/events/events", {"page" : "operation/events/events",
"get_events_fired": 1, "get_events_fired": 1,
"id_group": group, "id_group": group,
"agents[]" : agents,
"alert_fired": alert_fired, "alert_fired": alert_fired,
"critical": critical, "critical": critical,
"warning": warning, "warning": warning,
"unknown": unknown,
"id_row": id_row "id_row": id_row
}, },
function (data) { function (data) {

View File

@ -317,7 +317,7 @@ if (check_acl ($config['id_user'], 0, "ER")
window.open(url, window.open(url,
'<?php __('Sound Alerts'); ?>', '<?php __('Sound Alerts'); ?>',
'width=400, height=350, resizable=yes, toolbar=no, location=no, directories=no, status=no, menubar=no'); 'width=400, height=380, resizable=no, toolbar=no, location=no, directories=no, status=no, menubar=no');
} }
</script> </script>
<?php <?php

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_console %define name pandorafms_console
%define version 7.0dev %define version 7.0dev
%define release 161204 %define release 161213
# 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 7.0dev %define version 7.0dev
%define release 161204 %define release 161213
%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

@ -66,7 +66,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','7.0dev'); INSERT INTO tconfig (token, value) VALUES('db_scheme_version','7.0dev');
INSERT INTO tconfig (token, value) VALUES('db_scheme_build','PD161204'); INSERT INTO tconfig (token, value) VALUES('db_scheme_build','PD161213');
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');
@ -1371,6 +1371,7 @@ EXECUTE IMMEDIATE 'ALTER TRIGGER tagent_custom_fields_inc DISABLE';
INSERT INTO tagent_custom_fields VALUES (1,'Serial&#x20;Number',0); INSERT INTO tagent_custom_fields VALUES (1,'Serial&#x20;Number',0);
INSERT INTO tagent_custom_fields VALUES (2,'Department',0); INSERT INTO tagent_custom_fields VALUES (2,'Department',0);
INSERT INTO tagent_custom_fields VALUES (3,'Additional&#x20;ID',0); INSERT INTO tagent_custom_fields VALUES (3,'Additional&#x20;ID',0);
INSERT INTO tagent_custom_fields VALUES (4,'eHorusID',0);
-- Update curr val of sequence -- Update curr val of sequence
update_currval('tagent_custom_fields', 'id_field'); update_currval('tagent_custom_fields', 'id_field');

View File

@ -1033,7 +1033,7 @@ INSERT INTO `tplugin` (`id`, `name`, `description`, `max_timeout`, `execute`, `p
INSERT INTO `tplugin` (`id`, `name`, `description`, `max_timeout`, `max_retries`, `execute`, `net_dst_opt`, `net_port_opt`, `user_opt`, `pass_opt`, `plugin_type`, `macros`, `parameters`) VALUES (9,'Packet&#x20;Loss','Checks&#x20;for&#x20;dropped&#x20;packages&#x20;after&#x20;X&#x20;seconds&#x20;of&#x20;testing.&#x20;It&#x20;returns&#x20;%&#x20;of&#x20;dropped&#x20;packets.&#x20;It&#x20;uses&#x20;ping&#x20;flood&#x20;mode&#x20;to&#x20;launch&#x20;50&#x20;consecutive&#x20;pings&#x20;to&#x20;a&#x20;remote&#x20;destination.&#x20;On&#x20;local,&#x20;stable&#x20;networks,&#x20;value&#x20;should&#x20;be&#x20;0.&#x0d;&#x0a;',30,0,'/usr/share/pandora_server/util/plugin/packet_loss.sh','','','','',0,'{\"1\":{\"macro\":\"_field1_\",\"desc\":\"Test&#x20;time\",\"help\":\"\",\"value\":\"8\",\"hide\":\"\"},\"2\":{\"macro\":\"_field2_\",\"desc\":\"Target&#x20;IP\",\"help\":\"\",\"value\":\"\",\"hide\":\"\"}}','_field1_&#x20;_field2_'); INSERT INTO `tplugin` (`id`, `name`, `description`, `max_timeout`, `max_retries`, `execute`, `net_dst_opt`, `net_port_opt`, `user_opt`, `pass_opt`, `plugin_type`, `macros`, `parameters`) VALUES (9,'Packet&#x20;Loss','Checks&#x20;for&#x20;dropped&#x20;packages&#x20;after&#x20;X&#x20;seconds&#x20;of&#x20;testing.&#x20;It&#x20;returns&#x20;%&#x20;of&#x20;dropped&#x20;packets.&#x20;It&#x20;uses&#x20;ping&#x20;flood&#x20;mode&#x20;to&#x20;launch&#x20;50&#x20;consecutive&#x20;pings&#x20;to&#x20;a&#x20;remote&#x20;destination.&#x20;On&#x20;local,&#x20;stable&#x20;networks,&#x20;value&#x20;should&#x20;be&#x20;0.&#x0d;&#x0a;',30,0,'/usr/share/pandora_server/util/plugin/packet_loss.sh','','','','',0,'{\"1\":{\"macro\":\"_field1_\",\"desc\":\"Test&#x20;time\",\"help\":\"\",\"value\":\"8\",\"hide\":\"\"},\"2\":{\"macro\":\"_field2_\",\"desc\":\"Target&#x20;IP\",\"help\":\"\",\"value\":\"\",\"hide\":\"\"}}','_field1_&#x20;_field2_');
INSERT INTO `tagent_custom_fields` VALUES (1,'Serial&#x20;Number',0),(2,'Department',0),(3,'Additional&#x20;ID',0); INSERT INTO `tagent_custom_fields` VALUES (1,'Serial&#x20;Number',0),(2,'Department',0),(3,'Additional&#x20;ID',0),(4,'eHorusID',0);
INSERT INTO `ttag` VALUES (1,'network','Network&#x20;equipment','http://artica.es','',''),(2,'critical','Critical&#x20;modules','','',''),(3,'dmz','DMZ&#x20;Network&#x20;Zone','','',''),(4,'performance','Performance&#x20;anda&#x20;capacity&#x20;modules','','',''),(5,'configuration','','','',''); INSERT INTO `ttag` VALUES (1,'network','Network&#x20;equipment','http://artica.es','',''),(2,'critical','Critical&#x20;modules','','',''),(3,'dmz','DMZ&#x20;Network&#x20;Zone','','',''),(4,'performance','Performance&#x20;anda&#x20;capacity&#x20;modules','','',''),(5,'configuration','','','','');

View File

@ -1,5 +1,5 @@
package: pandorafms-server package: pandorafms-server
Version: 7.0dev-161204 Version: 7.0dev-161213
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="7.0dev-161204" pandora_version="7.0dev-161213"
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 = "7.0dev"; my $pandora_version = "7.0dev";
my $pandora_build = "161204"; my $pandora_build = "161213";
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 7.0dev %define version 7.0dev
%define release 161204 %define release 161213
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 7.0dev %define version 7.0dev
%define release 161204 %define release 161213
Summary: Pandora FMS Server Summary: Pandora FMS Server
Name: %{name} Name: %{name}

View File

@ -9,7 +9,7 @@
# ********************************************************************** # **********************************************************************
PI_VERSION="7.0dev" PI_VERSION="7.0dev"
PI_BUILD="161204" PI_BUILD="161213"
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 = "7.0dev PS161204"; my $version = "7.0dev PS161213";
# 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 = "7.0dev PS161204"; my $version = "7.0dev PS161213";
# save program name for logging # save program name for logging
my $progname = basename($0); my $progname = basename($0);