mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-29 00:34:46 +02:00
Merge remote-tracking branch 'origin/develop' into 3170-Cambios_custom_fields_view
Former-commit-id: 858d273478e7e6fb985be64bd6041586207e1ac4
This commit is contained in:
commit
1fdba79162
@ -144,7 +144,7 @@ function parseReplyEvents (reply) {
|
||||
fetchedEvents.push({
|
||||
'id' : event.id_evento,
|
||||
'agent_name' : event.agent_name,
|
||||
'agent' : event.id_agent,
|
||||
'agent' : event.id_agente,
|
||||
'date' : event.timestamp,
|
||||
'title' : event.evento,
|
||||
'module' : event.id_agentmodule,
|
||||
@ -215,7 +215,7 @@ function getNotification(pEvent){
|
||||
if(pEvent['module'] != 0) even += " in the module with Id "+ pEvent['module'];
|
||||
even += ".";
|
||||
|
||||
var url = (pEvent['agent']=="")
|
||||
var url = (pEvent['agent'] == 0)
|
||||
? localStorage["ip_address"]+"/index.php?sec=eventos&sec2=operation/events/events"
|
||||
: localStorage["ip_address"]+"/index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=" + pEvent['agent'];
|
||||
|
||||
|
@ -91,12 +91,12 @@ function showEvents(){
|
||||
var a = document.createElement('a');
|
||||
var temp_style;
|
||||
|
||||
var agent_url = (allEvents[i]["agent_name"] == 0)
|
||||
var agent_url = (allEvents[i]["agent"] == 0)
|
||||
? localStorage["ip_address"]
|
||||
+ "/index.php?sec=eventos&sec2=operation/events/events"
|
||||
: localStorage["ip_address"]
|
||||
+ "/index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente="
|
||||
+ allEvents[i]['agent_name'];
|
||||
+ allEvents[i]['agent'];
|
||||
a.setAttribute("href",agent_url);
|
||||
a.target = "_blank";
|
||||
a.className = 'a_2_mo';
|
||||
|
@ -1,5 +1,5 @@
|
||||
package: pandorafms-agent-unix
|
||||
Version: 7.0NG.729-181204
|
||||
Version: 7.0NG.729-181210
|
||||
Architecture: all
|
||||
Priority: optional
|
||||
Section: admin
|
||||
|
@ -14,7 +14,7 @@
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
pandora_version="7.0NG.729-181204"
|
||||
pandora_version="7.0NG.729-181210"
|
||||
|
||||
echo "Test if you has the tools for to make the packages."
|
||||
whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null
|
||||
|
@ -42,7 +42,7 @@ my $Sem = undef;
|
||||
my $ThreadSem = undef;
|
||||
|
||||
use constant AGENT_VERSION => '7.0NG.729';
|
||||
use constant AGENT_BUILD => '181204';
|
||||
use constant AGENT_BUILD => '181210';
|
||||
|
||||
# Agent log default file size maximum and instances
|
||||
use constant DEFAULT_MAX_LOG_SIZE => 600000;
|
||||
|
@ -3,7 +3,7 @@
|
||||
#
|
||||
%define name pandorafms_agent_unix
|
||||
%define version 7.0NG.729
|
||||
%define release 181204
|
||||
%define release 181210
|
||||
|
||||
Summary: Pandora FMS Linux agent, PERL version
|
||||
Name: %{name}
|
||||
|
@ -3,7 +3,7 @@
|
||||
#
|
||||
%define name pandorafms_agent_unix
|
||||
%define version 7.0NG.729
|
||||
%define release 181204
|
||||
%define release 181210
|
||||
|
||||
Summary: Pandora FMS Linux agent, PERL version
|
||||
Name: %{name}
|
||||
|
@ -10,7 +10,7 @@
|
||||
# **********************************************************************
|
||||
|
||||
PI_VERSION="7.0NG.729"
|
||||
PI_BUILD="181204"
|
||||
PI_BUILD="181210"
|
||||
OS_NAME=`uname -s`
|
||||
|
||||
FORCE=0
|
||||
|
@ -186,7 +186,7 @@ UpgradeApplicationID
|
||||
{}
|
||||
|
||||
Version
|
||||
{181204}
|
||||
{181210}
|
||||
|
||||
ViewReadme
|
||||
{Yes}
|
||||
|
@ -30,7 +30,7 @@ using namespace Pandora;
|
||||
using namespace Pandora_Strutils;
|
||||
|
||||
#define PATH_SIZE _MAX_PATH+1
|
||||
#define PANDORA_VERSION ("7.0NG.729(Build 181204)")
|
||||
#define PANDORA_VERSION ("7.0NG.729(Build 181210)")
|
||||
|
||||
string pandora_path;
|
||||
string pandora_dir;
|
||||
|
@ -11,7 +11,7 @@ BEGIN
|
||||
VALUE "LegalCopyright", "Artica ST"
|
||||
VALUE "OriginalFilename", "PandoraAgent.exe"
|
||||
VALUE "ProductName", "Pandora FMS Windows Agent"
|
||||
VALUE "ProductVersion", "(7.0NG.729(Build 181204))"
|
||||
VALUE "ProductVersion", "(7.0NG.729(Build 181210))"
|
||||
VALUE "FileVersion", "1.0.0.0"
|
||||
END
|
||||
END
|
||||
|
@ -1,10 +1,10 @@
|
||||
package: pandorafms-console
|
||||
Version: 7.0NG.729-181204
|
||||
Version: 7.0NG.729-181210
|
||||
Architecture: all
|
||||
Priority: optional
|
||||
Section: admin
|
||||
Installed-Size: 42112
|
||||
Maintainer: Artica ST <deptec@artica.es>
|
||||
Homepage: http://pandorafms.org/
|
||||
Depends: php | php7.2, php7.2-snmp | php-snmp, php7.2-gd | php-gd, php7.2-mysqlnd | php-mysqlnd, php-db, php7.2-xmlrpc | php-xmlrpc, php-gettext, php7.2-curl | php-curl, graphviz, dbconfig-common, php7.2-ldap | php-ldap, mysql-client | virtual-mysql-client, php-xmlrpc
|
||||
Depends: php | php7.2, php7.2-snmp | php-snmp, php7.2-gd | php-gd, php7.2-mysqlnd | php-mysqlnd, php-db, php7.2-xmlrpc | php-xmlrpc, php-gettext, php7.2-curl | php-curl, graphviz, dbconfig-common, php7.2-ldap | php-ldap, mysql-client | virtual-mysql-client, php-xmlrpc, php7.2-zip | php-zip
|
||||
Description: Pandora FMS is an Open Source monitoring tool. It monitor your systems and applications, and allows you to control the status of any element of them. The web console is the graphical user interface (GUI) to manage the pool and to generate reports and graphs from the Pandora FMS monitoring process.
|
||||
|
@ -14,7 +14,7 @@
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
pandora_version="7.0NG.729-181204"
|
||||
pandora_version="7.0NG.729-181210"
|
||||
|
||||
package_pear=0
|
||||
package_pandora=1
|
||||
|
@ -229,7 +229,7 @@ $(document).ready (function () {
|
||||
});
|
||||
|
||||
$("#left").click (function () {
|
||||
var current_fields_size = ($('#fields_selected option').size());
|
||||
var current_fields_size = ($('#fields_selected option').length);
|
||||
var selected_fields = [];
|
||||
var selected_fields_total = '';
|
||||
|
||||
|
@ -742,8 +742,10 @@ function readFields() {
|
||||
var text = tinymce.get('text-label').getContent();
|
||||
values['label'] = text;
|
||||
|
||||
if ($("input[name=percentile_label]").val().length > 0)
|
||||
values['label'] = $("input[name=percentile_label]").val();
|
||||
if ($("input[name=percentile_label]").val().length > 0) {
|
||||
values['percentile_label_color'] = $("input[name=percentile_label_color]").val();
|
||||
values['label'] = "<span style='color:"+values['percentile_label_color']+";'>" + $("input[name=percentile_label]").val() + "</span>";
|
||||
}
|
||||
|
||||
values['line-height'] = $("#text-label_ifr").contents().find("p").css('line-height');
|
||||
values['type_graph'] = $("select[name=type_graph]").val();
|
||||
@ -784,7 +786,6 @@ function readFields() {
|
||||
values['event_max_time_row'] = $("select[name=event_max_time_row]").val();
|
||||
values['type_percentile'] = $("select[name=type_percentile]").val();
|
||||
values['percentile_color'] = $("input[name=percentile_color]").val();
|
||||
values['percentile_label_color'] = $("input[name=percentile_label_color]").val();
|
||||
values['percentile_label'] = $("input[name=percentile_label]").val();
|
||||
values['value_show'] = $("select[name=value_show]").val();
|
||||
|
||||
|
@ -202,7 +202,9 @@ if (file_exists ('languages/'.$user_language.'.mo')) {
|
||||
$params['id_agent'],
|
||||
$params['full_legend_daterray'],
|
||||
$params['not_interactive'],
|
||||
1
|
||||
$params['ttl'],
|
||||
$params['widgets'],
|
||||
$params['show']
|
||||
);
|
||||
break;
|
||||
default:
|
||||
|
@ -22,7 +22,7 @@
|
||||
/**
|
||||
* Pandora build version and version
|
||||
*/
|
||||
$build_version = 'PC181204';
|
||||
$build_version = 'PC181210';
|
||||
$pandora_version = 'v7.0NG.729';
|
||||
|
||||
// Do not overwrite default timezone set if defined.
|
||||
|
@ -485,6 +485,8 @@ define("OPTION_AGENT_AUTOCOMPLETE", 9);
|
||||
define("OPTION_SELECT_MULTISELECTION", 10);
|
||||
define("OPTION_COLOR_PICKER", 11);
|
||||
|
||||
define("DASHBOARD_WIDGET_ID_VISUAL_CONSOLE", 22);
|
||||
|
||||
/* Transactional map constants */
|
||||
define("NODE_TYPE", 0);
|
||||
define("ARROW_TYPE", 1);
|
||||
|
@ -360,8 +360,9 @@ function agents_get_agents ($filter = false, $fields = false,
|
||||
AND unknown_count > 0)";
|
||||
break;
|
||||
case AGENT_STATUS_NOT_NORMAL:
|
||||
$status_sql =
|
||||
"normal_count <> total_count";
|
||||
$status_sql = "(
|
||||
normal_count <> total_count
|
||||
OR total_count = notinit_count)";
|
||||
//The AGENT_STATUS_NOT_NORMAL filter must show all agents that are not in normal status
|
||||
/*"(
|
||||
normal_count <> total_count
|
||||
|
@ -1412,10 +1412,6 @@ function api_set_create_os($thrash1, $thrash2, $other, $thrash3) {
|
||||
returnError('forbidden', 'string');
|
||||
return;
|
||||
}
|
||||
|
||||
if (defined ('METACONSOLE')) {
|
||||
return;
|
||||
}
|
||||
|
||||
$values = array();
|
||||
|
||||
@ -1431,6 +1427,11 @@ function api_set_create_os($thrash1, $thrash2, $other, $thrash3) {
|
||||
$resultOrId = false;
|
||||
if ($other['data'][0] != '') {
|
||||
$resultOrId = db_process_sql_insert('tconfig_os', $values);
|
||||
|
||||
if ($resultOrId)
|
||||
echo __('Success creating OS');
|
||||
else
|
||||
echo __('Error creating OS');
|
||||
}
|
||||
|
||||
}
|
||||
@ -1438,10 +1439,6 @@ function api_set_create_os($thrash1, $thrash2, $other, $thrash3) {
|
||||
function api_set_update_os($id_os, $thrash2, $other, $thrash3) {
|
||||
global $config;
|
||||
|
||||
if (defined ('METACONSOLE')) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!check_acl($config['id_user'], 0, "AW")) {
|
||||
returnError('forbidden', 'string');
|
||||
return;
|
||||
@ -1459,7 +1456,10 @@ function api_set_update_os($id_os, $thrash2, $other, $thrash3) {
|
||||
|
||||
if ($other['data'][0] != '') {
|
||||
|
||||
$result = db_process_sql_update('tconfig_os', $values, array('id_os' => $id_os));
|
||||
if (db_process_sql_update('tconfig_os', $values, array('id_os' => $id_os)))
|
||||
echo __('Success updating OS');
|
||||
else
|
||||
echo __('Error updating OS');
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -853,10 +853,7 @@ function events_print_event_table ($filter = "", $limit = 10, $width = 440, $ret
|
||||
$filter = '1 = 1';
|
||||
}
|
||||
|
||||
$secondary_join = '';
|
||||
if (!users_can_manage_group_all("ER")) {
|
||||
$secondary_join = "LEFT JOIN tagent_secondary_group tasg ON tevento.id_agente = tasg.id_agent";
|
||||
}
|
||||
$secondary_join = "LEFT JOIN tagent_secondary_group tasg ON tevento.id_agente = tasg.id_agent";
|
||||
|
||||
$sql = sprintf ("SELECT DISTINCT tevento.*
|
||||
FROM tevento %s
|
||||
|
@ -175,6 +175,7 @@ function networkmap_process_networkmap($id = 0) {
|
||||
$nodes_and_relations['nodes'] = array();
|
||||
$index = 0;
|
||||
foreach ($nodes as $key => $node) {
|
||||
$nodes_and_relations['nodes'][$index]['id'] = $node["id"];
|
||||
$nodes_and_relations['nodes'][$index]['id_map'] = $id;
|
||||
|
||||
$nodes_and_relations['nodes'][$index]['x'] = (int)$node['coords'][0];
|
||||
@ -303,6 +304,7 @@ function networkmap_process_networkmap($id = 0) {
|
||||
$index = 0;
|
||||
$node_center = array();
|
||||
foreach ($nodes as $key => $node) {
|
||||
$nodes_and_relations['nodes'][$index]['id'] = $node["id"];
|
||||
$nodes_and_relations['nodes'][$index]['id_map'] = $id;
|
||||
|
||||
$children_count = 0;
|
||||
@ -1072,6 +1074,7 @@ function networkmap_loadfile($id = 0, $file = '',
|
||||
$node_id = $items[1];
|
||||
$node_x = $items[2] * 100; //200 is for show more big
|
||||
$node_y = $height_map - $items[3] * 100; //200 is for show more big
|
||||
$data['id'] = $node_id;
|
||||
$data['text'] = '';
|
||||
$data['image'] = '';
|
||||
$data['width'] = 10;
|
||||
|
@ -152,10 +152,15 @@ function profile_delete_profile ($id_profile) {
|
||||
* @return bool Whether or not it's deleted in both tables
|
||||
*/
|
||||
function profile_delete_profile_and_clean_users ($id_profile) {
|
||||
return
|
||||
(bool)db_process_sql_delete('tperfil', array('id_perfil' => $id_profile)) &&
|
||||
(bool)db_process_sql_delete('tusuario_perfil', array('id_perfil' => $id_profile))
|
||||
;
|
||||
|
||||
$profile_deletion = (bool)db_process_sql_delete('tperfil', array('id_perfil' => $id_profile));
|
||||
|
||||
// Delete in tusuario_perfil only if is needed
|
||||
if (!(bool)db_get_value('id_perfil', 'tusuario_perfil', 'id_perfil', $id_profile)) {
|
||||
return $profile_deletion;
|
||||
}
|
||||
return $profile_deletion &&
|
||||
(bool)db_process_sql_delete('tusuario_perfil', array('id_perfil' => $id_profile));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -663,7 +663,9 @@ function reporting_make_reporting_data($report = null, $id_report,
|
||||
$content,
|
||||
$type,
|
||||
$force_width_chart,
|
||||
$force_height_chart);
|
||||
$force_height_chart,
|
||||
$pdf
|
||||
);
|
||||
break;
|
||||
case 'module_histogram_graph':
|
||||
$report['contents'][] = reporting_enterprise_module_histogram_graph(
|
||||
@ -1201,10 +1203,10 @@ function reporting_event_top_n($report, $content, $type = 'dinamic',
|
||||
}
|
||||
}
|
||||
|
||||
$ag_name = modules_get_agentmodule_agent_alias($row ['id_agent_module']);
|
||||
$ag_name = modules_get_agentmodule_agent_alias($row ['id_agent_module']);
|
||||
$mod_name = modules_get_agentmodule_name ($row ['id_agent_module']);
|
||||
$unit = db_get_value('unit', 'tagente_modulo',
|
||||
'id_agente_modulo', $row ['id_agent_module']);
|
||||
'id_agente_modulo', $row ['id_agent_module']);
|
||||
|
||||
|
||||
switch ($top_n) {
|
||||
@ -9340,6 +9342,7 @@ function reporting_get_agentmodule_data_sum ($id_agent_module,
|
||||
$id_module_type);
|
||||
$module_interval = modules_get_interval ($id_agent_module);
|
||||
$uncompressed_module = is_module_uncompressed ($module_name);
|
||||
|
||||
|
||||
// Wrong module type
|
||||
if (is_module_data_string ($module_name)) {
|
||||
@ -9348,46 +9351,23 @@ function reporting_get_agentmodule_data_sum ($id_agent_module,
|
||||
|
||||
// Incremental modules are treated differently
|
||||
$module_inc = is_module_inc ($module_name);
|
||||
|
||||
// Get module data
|
||||
$interval_data = db_get_all_rows_sql('
|
||||
|
||||
if ($uncompressed_module) {
|
||||
// Get module data
|
||||
$interval_data = db_get_all_rows_sql('
|
||||
SELECT * FROM tagente_datos
|
||||
WHERE id_agente_modulo = ' . (int) $id_agent_module . '
|
||||
AND utimestamp > ' . (int) $datelimit . '
|
||||
AND utimestamp < ' . (int) $date . '
|
||||
ORDER BY utimestamp ASC', $search_in_history_db);
|
||||
|
||||
}
|
||||
else
|
||||
$interval_data = db_uncompress_module_data((int) $id_agent_module, (int) $datelimit, (int) $date);
|
||||
|
||||
if ($interval_data === false) $interval_data = array ();
|
||||
|
||||
// Uncompressed module data
|
||||
if ($uncompressed_module) {
|
||||
$min_necessary = 1;
|
||||
|
||||
// Compressed module data
|
||||
}
|
||||
else {
|
||||
// Get previous data
|
||||
$previous_data = modules_get_previous_data ($id_agent_module, $datelimit);
|
||||
if ($previous_data !== false) {
|
||||
$previous_data['utimestamp'] = $datelimit;
|
||||
array_unshift ($interval_data, $previous_data);
|
||||
}
|
||||
|
||||
// Get next data
|
||||
$next_data = modules_get_next_data ($id_agent_module, $date);
|
||||
if ($next_data !== false) {
|
||||
$next_data['utimestamp'] = $date;
|
||||
array_push ($interval_data, $next_data);
|
||||
}
|
||||
else if (count ($interval_data) > 0) {
|
||||
// Propagate the last known data to the end of the interval
|
||||
$next_data = array_pop ($interval_data);
|
||||
array_push ($interval_data, $next_data);
|
||||
$next_data['utimestamp'] = $date;
|
||||
array_push ($interval_data, $next_data);
|
||||
}
|
||||
|
||||
$min_necessary = 2;
|
||||
}
|
||||
$min_necessary = 1;
|
||||
|
||||
if (count ($interval_data) < $min_necessary) {
|
||||
return false;
|
||||
@ -9395,11 +9375,14 @@ function reporting_get_agentmodule_data_sum ($id_agent_module,
|
||||
|
||||
// Set initial conditions
|
||||
$total = 0;
|
||||
if (! $uncompressed_module) {
|
||||
$previous_data = array_shift ($interval_data);
|
||||
}
|
||||
|
||||
$partial_total = 0;
|
||||
$count_sum = 0;
|
||||
|
||||
foreach ($interval_data as $data) {
|
||||
|
||||
$partial_total = 0;
|
||||
$count_sum = 0;
|
||||
|
||||
switch ($config["dbtype"]) {
|
||||
case "mysql":
|
||||
case "postgresql":
|
||||
@ -9410,18 +9393,25 @@ function reporting_get_agentmodule_data_sum ($id_agent_module,
|
||||
oracle_format_float_to_php($data['datos']);
|
||||
break;
|
||||
}
|
||||
|
||||
if ($uncompressed_module) {
|
||||
$total += $data['datos'];
|
||||
}
|
||||
else if ($module_inc) {
|
||||
$total += $previous_data['datos'] * ($data['utimestamp'] - $previous_data['utimestamp']);
|
||||
|
||||
if (!$module_inc) {
|
||||
foreach ($data['data'] as $val) {
|
||||
if (is_numeric($val['datos'])) {
|
||||
$partial_total += $val['datos'];
|
||||
$count_sum++;
|
||||
}
|
||||
}
|
||||
|
||||
if ($count_sum===0) continue;
|
||||
|
||||
$total += $partial_total/$count_sum;
|
||||
}
|
||||
else {
|
||||
$total += $previous_data['datos'] * ($data['utimestamp'] - $previous_data['utimestamp']) / $module_interval;
|
||||
$last = end($data['data']);
|
||||
$total += $last['datos'];
|
||||
}
|
||||
$previous_data = $data;
|
||||
}
|
||||
|
||||
|
||||
return $total;
|
||||
}
|
||||
|
@ -2466,61 +2466,57 @@ function reporting_html_availability_graph(&$table, $item, $pdf=0) {
|
||||
$sla_value = sla_truncate($chart['sla_value'], $config['graph_precision']) . '%';
|
||||
$checks_resume = "(" . $chart['checks_ok'] . "/" . $chart['checks_total'] . ")";
|
||||
}
|
||||
$table1->data[] = array(
|
||||
$chart['agent'] . "<br />" . $chart['module'],
|
||||
$chart['chart'],
|
||||
"<span style = 'font: bold 2em Arial, Sans-serif; color: ".$color."'>" .
|
||||
$sla_value .
|
||||
'</span>',
|
||||
$checks_resume
|
||||
);
|
||||
|
||||
$table1->data[0][0] = $chart['agent'] . "<br />" . $chart['module'];
|
||||
$table1->data[0][1] = $chart['chart'];
|
||||
$table1->data[0][2] = "<span style = 'font: bold 2em Arial, Sans-serif; color: ".$color."'>" . $sla_value . '</span>';
|
||||
$table1->data[0][3] = $checks_resume;
|
||||
}
|
||||
|
||||
if($item['type'] == 'availability_graph'){
|
||||
//table_legend_graphs;
|
||||
$table2 = new stdClass();
|
||||
$table2->width = '99%';
|
||||
$table2->data = array ();
|
||||
$table2->size = array ();
|
||||
$table2->size[0] = '2%';
|
||||
$table2->data[0][0] = '<img src ="'. $src .'images/square_green.png">';
|
||||
$table2->size[1] = '14%';
|
||||
$table2->data[0][1] = '<span>'.__('OK') . '</span>';
|
||||
|
||||
//table_legend_graphs;
|
||||
$table2 = new stdClass();
|
||||
$table2->width = '99%';
|
||||
$table2->data = array ();
|
||||
$table2->size = array ();
|
||||
$table2->size[0] = '2%';
|
||||
$table2->data[0][0] = '<img src ="'. $src .'images/square_green.png">';
|
||||
$table2->size[1] = '14%';
|
||||
$table2->data[0][1] = '<span>'.__('OK') . '</span>';
|
||||
$table2->size[2] = '2%';
|
||||
$table2->data[0][2] = '<img src ="'. $src .'images/square_red.png">';
|
||||
$table2->size[3] = '14%';
|
||||
$table2->data[0][3] = '<span>'.__('Critical'). '</span>';
|
||||
|
||||
$table2->size[2] = '2%';
|
||||
$table2->data[0][2] = '<img src ="'. $src .'images/square_red.png">';
|
||||
$table2->size[3] = '14%';
|
||||
$table2->data[0][3] = '<span>'.__('Critical'). '</span>';
|
||||
$table2->size[4] = '2%';
|
||||
$table2->data[0][4] = '<img src ="'. $src .'images/square_gray.png">';
|
||||
$table2->size[5] = '14%';
|
||||
$table2->data[0][5] = '<span>'.__('Unknow'). '</span>';
|
||||
|
||||
$table2->size[4] = '2%';
|
||||
$table2->data[0][4] = '<img src ="'. $src .'images/square_gray.png">';
|
||||
$table2->size[5] = '14%';
|
||||
$table2->data[0][5] = '<span>'.__('Unknow'). '</span>';
|
||||
$table2->size[6] = '2%';
|
||||
$table2->data[0][6] = '<img src ="'. $src .'images/square_blue.png">';
|
||||
$table2->size[7] = '14%';
|
||||
$table2->data[0][7] = '<span>'.__('Not Init'). '</span>';
|
||||
|
||||
$table2->size[6] = '2%';
|
||||
$table2->data[0][6] = '<img src ="'. $src .'images/square_blue.png">';
|
||||
$table2->size[7] = '14%';
|
||||
$table2->data[0][7] = '<span>'.__('Not Init'). '</span>';
|
||||
|
||||
$table2->size[8] = '2%';
|
||||
$table2->data[0][8] = '<img src ="'. $src .'images/square_violet.png">';
|
||||
$table2->size[9] = '14%';
|
||||
$table2->data[0][9] = '<span>'.__('Downtimes'). '</span>';
|
||||
|
||||
$table2->size[10] = '2%';
|
||||
$table2->data[0][10] = '<img src ="'. $src .'images/square_light_gray.png">';
|
||||
$table2->size[11] = '15%';
|
||||
$table2->data[0][11] = '<span>'.__('Ignore time'). '</span>';
|
||||
$table2->size[8] = '2%';
|
||||
$table2->data[0][8] = '<img src ="'. $src .'images/square_violet.png">';
|
||||
$table2->size[9] = '14%';
|
||||
$table2->data[0][9] = '<span>'.__('Downtimes'). '</span>';
|
||||
|
||||
$table2->size[10] = '2%';
|
||||
$table2->data[0][10] = '<img src ="'. $src .'images/square_light_gray.png">';
|
||||
$table2->size[11] = '15%';
|
||||
$table2->data[0][11] = '<span>'.__('Ignore time'). '</span>';
|
||||
}
|
||||
|
||||
$table->colspan['charts']['cell'] = 2;
|
||||
$table->data['charts']['cell'] = html_print_table($table1, true);
|
||||
$table->colspan['legend']['cell'] = 2;
|
||||
$table->data['legend']['cell'] = html_print_table($table2, true);
|
||||
|
||||
if($pdf){
|
||||
return html_print_table($table, true);
|
||||
return html_print_table($table1, true) . '<br />' . html_print_table($table2, true);
|
||||
}
|
||||
}
|
||||
|
||||
@ -3919,4 +3915,4 @@ function reporting_html_planned_downtimes_table ($planned_downtimes) {
|
||||
return $downtimes_table;
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
||||
|
@ -770,7 +770,7 @@ function tags_get_acl_tags_module_condition($acltags, $modules_table = '') {
|
||||
function tags_get_acl_tags_event_condition($acltags, $meta = false, $force_group_and_tag = false, $force_equal = false) {
|
||||
|
||||
global $config;
|
||||
$condition = '';
|
||||
$condition = array();
|
||||
|
||||
// Get all tags of the system
|
||||
$all_tags = tags_get_all_tags(false);
|
||||
|
@ -1867,7 +1867,9 @@ function visual_map_print_item($mode = "read", $layoutData,
|
||||
}
|
||||
|
||||
echo $img;
|
||||
echo io_safe_output($text);
|
||||
|
||||
if (get_parameter('tab')=='editor')
|
||||
echo "<span style='color:".$fill_color.";'>".io_safe_output($text)."</span>";
|
||||
|
||||
break;
|
||||
case PERCENTILE_BUBBLE:
|
||||
@ -1911,7 +1913,9 @@ function visual_map_print_item($mode = "read", $layoutData,
|
||||
}
|
||||
|
||||
echo $img;
|
||||
echo io_safe_output($text);
|
||||
|
||||
if (get_parameter('tab')=='editor')
|
||||
echo "<span style='color:".$fill_color.";'>".io_safe_output($text)."</span>";
|
||||
|
||||
break;
|
||||
case CIRCULAR_PROGRESS_BAR:
|
||||
@ -1955,7 +1959,9 @@ function visual_map_print_item($mode = "read", $layoutData,
|
||||
}
|
||||
|
||||
echo $img;
|
||||
echo io_safe_output($text);
|
||||
|
||||
if (get_parameter('tab')=='editor')
|
||||
echo "<span style='color:".$fill_color.";'>".io_safe_output($text)."</span>";
|
||||
|
||||
break;
|
||||
case CIRCULAR_INTERIOR_PROGRESS_BAR:
|
||||
@ -2000,7 +2006,9 @@ function visual_map_print_item($mode = "read", $layoutData,
|
||||
}
|
||||
|
||||
echo $img;
|
||||
echo io_safe_output($text);
|
||||
|
||||
if (get_parameter('tab')=='editor')
|
||||
echo "<span style='color:".$fill_color.";'>".io_safe_output($text)."</span>";
|
||||
|
||||
break;
|
||||
case MODULE_GRAPH:
|
||||
|
@ -510,7 +510,7 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) {
|
||||
__('Max value') . '</td>
|
||||
<td align="left">' . html_print_input_text('max_percentile', 0, '', 3, 5, true) . '</td>';
|
||||
|
||||
$percentile_type = array('percentile' => __('Percentile'), 'bubble' => __('Bubble'), 'circular_progress_bar' => __('Circular porgress bar'), 'interior_circular_progress_bar' => __('Circular progress bar (interior)'));
|
||||
$percentile_type = array('percentile' => __('Percentile'), 'bubble' => __('Bubble'), 'circular_progress_bar' => __('Circular progress bar'), 'interior_circular_progress_bar' => __('Circular progress bar (interior)'));
|
||||
$percentile_value = array('percent' => __('Percent'), 'value' => __('Value'));
|
||||
if (is_metaconsole()){
|
||||
$form_items['percentile_item_row_3'] = array();
|
||||
@ -903,11 +903,6 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) {
|
||||
</tbody>
|
||||
</table>
|
||||
<?php
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
echo '</div>';
|
||||
|
||||
|
@ -706,13 +706,15 @@ function flot_slicesbar_graph (
|
||||
'fontpath' => $fontpath,
|
||||
'round_corner' => $round_corner,
|
||||
'homeurl' => $homeurl,
|
||||
'watermark' => $watermark = '',
|
||||
'adapt_key' => $adapt_key = '',
|
||||
'stat_win' => $stat_win = false,
|
||||
'id_agent' => $id_agent = 0,
|
||||
'full_legend_date' => $full_legend_date = array(),
|
||||
'not_interactive' => $not_interactive = 0,
|
||||
'ttl' => $ttl = 1
|
||||
'watermark' => $watermark,
|
||||
'adapt_key' => $adapt_key,
|
||||
'stat_win' => $stat_win,
|
||||
'id_agent' => $id_agent,
|
||||
'full_legend_date' => $full_legend_date,
|
||||
'not_interactive' => $not_interactive,
|
||||
'ttl' => 1,
|
||||
'widgets' => $widgets,
|
||||
'show' => $show
|
||||
);
|
||||
|
||||
return generator_chart_to_pdf('slicebar', $params);
|
||||
|
@ -2721,7 +2721,7 @@ function init_graph(parameter_object) {
|
||||
}
|
||||
window.scale_minimap = 4.2;
|
||||
window.translation = [0, 0];
|
||||
window.scale = (typeof (z_dash) != "undefined") ? z_dash : 0.5;
|
||||
window.scale = z_dash || 0.5;
|
||||
window.node_radius = 40;
|
||||
if (typeof (parameter_object.node_radius) != "undefined") {
|
||||
window.node_radius = parameter_object.node_radius;
|
||||
@ -3306,7 +3306,7 @@ function draw_elements_graph() {
|
||||
})
|
||||
.attr("startOffset", function (d) {
|
||||
if (d.source.x < d.target.x) {
|
||||
return "";
|
||||
return "0%";
|
||||
}
|
||||
else {
|
||||
return "85%";
|
||||
@ -3356,7 +3356,7 @@ function draw_elements_graph() {
|
||||
return "85%";
|
||||
}
|
||||
else {
|
||||
return "";
|
||||
return "0%";
|
||||
}
|
||||
})
|
||||
.attr("text-anchor", function (d) {
|
||||
|
Binary file not shown.
File diff suppressed because it is too large
Load Diff
@ -205,3 +205,67 @@ div.installation_step {
|
||||
color:white;
|
||||
}
|
||||
|
||||
:focus {
|
||||
outline: 0;
|
||||
}
|
||||
|
||||
/* POPUP */
|
||||
.popup-lightbox{
|
||||
position: fixed;
|
||||
z-index: 8888;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background-color: #000;
|
||||
opacity: 0.6;
|
||||
visibility: hidden;
|
||||
}
|
||||
|
||||
.popup{
|
||||
max-height: 450px;
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
top: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
-webkit-transform: translate(-50%, -50%);
|
||||
background-color: #FFF;
|
||||
z-index: 9999;
|
||||
display: none;
|
||||
}
|
||||
|
||||
.popup-title{
|
||||
background-color: #82b92e;
|
||||
padding: 10px 20px;
|
||||
color: #FFF;
|
||||
font-size:12pt;
|
||||
text-align: center;
|
||||
font-family:Sans, Arial, sans;
|
||||
}
|
||||
|
||||
.popup-inner{
|
||||
max-height: 350px;
|
||||
background: #FFF;
|
||||
/* overflow-y: scroll;*/
|
||||
padding: 25px 35px;
|
||||
font-size: 11pt;
|
||||
}
|
||||
|
||||
.popup-button-green{
|
||||
background-color: #82B92E;
|
||||
border: 1px solid transparent;
|
||||
color: blue;
|
||||
}
|
||||
|
||||
.popup-button-green span{
|
||||
color: #FFF !important;
|
||||
}
|
||||
|
||||
.popup-button-green:hover{
|
||||
background-color: transparent !important;
|
||||
border: 1px solid #82B92E;
|
||||
color: red !important;
|
||||
}
|
||||
|
||||
.popup-button-green:hover span{
|
||||
color: #82B92E !important;
|
||||
}
|
||||
/* POPUP -END */
|
||||
|
52
pandora_console/install.php
Executable file → Normal file
52
pandora_console/install.php
Executable file → Normal file
@ -66,12 +66,41 @@
|
||||
document.getElementById('tr_dbgrant').style["display"] = "none";
|
||||
}
|
||||
}
|
||||
function popupShow(){
|
||||
document.getElementsByTagName('body')[0].style["margin"] = "0";
|
||||
document.getElementById('install_container').style["padding-top"] = "45px";
|
||||
document.getElementById('install_container').style["margin-top"] = "0";
|
||||
document.getElementById('add-lightbox').style["visibility"] = "visible";
|
||||
document.getElementById('open_popup').style["display"] = "block";
|
||||
document.getElementById('open_popup').style["visibility"] = "visible";
|
||||
}
|
||||
function popupClose(){
|
||||
document.getElementById('add-lightbox').style["visibility"] = "hidden";
|
||||
document.getElementById('open_popup').style["display"] = "none";
|
||||
document.getElementById('open_popup').style["visibility"] = "hidden";
|
||||
}
|
||||
</script>
|
||||
<body>
|
||||
<div id='add-lightbox' onclick='popupClose();' class='popup-lightbox'></div>
|
||||
<div id='open_popup' class='popup' style='visibility:hidden;display: block;'>
|
||||
<div class='popup-title'>
|
||||
<span id='title_popup'>Warning</span>
|
||||
<a href='#' onclick='popupClose();'><img src='./images/icono_cerrar.png' alt='close' title='Close' style='float:right;'/></a>
|
||||
</div>
|
||||
<div id='editor_section' class='popup-inner' style='padding: 20px 40px;'>
|
||||
<?php
|
||||
echo "<p><strong>Attention</strong>, you are going to <strong>overwrite the data</strong> of your current installation.</p><p>This means that if you do not have a backup <strong>you will irremissibly LOSE ALL THE STORED DATA</strong>, the configuration and everything relevant to your installation.</p><p><strong>Are you sure of what you are going to do?</strong></p>";
|
||||
echo "<div style='text-align:right;';>";
|
||||
echo "<a id='step4popup' href='install.php?step=4'><button type='submit' class='btn_install_next'><span class='btn_install_next_text'>Yes, I'm sure I want to delete everything</span></button></a>";
|
||||
echo "<a href='javascript:popupClose();'><button type='submit' class='btn_install_next popup-button-green'><span class='btn_install_next_text'>Cancel</span></button></a>";
|
||||
echo "</div>";
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
<div style='height: 10px'>
|
||||
<?php
|
||||
$version = '7.0NG.729';
|
||||
$build = '181204';
|
||||
$build = '181210';
|
||||
$banner = "v$version Build $build";
|
||||
|
||||
error_reporting(0);
|
||||
@ -343,7 +372,7 @@ function adjust_paths_for_freebsd($engine, $connection = false) {
|
||||
|
||||
function install_step1() {
|
||||
global $banner;
|
||||
|
||||
|
||||
echo "
|
||||
<div id='install_container'>
|
||||
<div id='wizard'>
|
||||
@ -608,7 +637,7 @@ function install_step3() {
|
||||
|
||||
|
||||
echo " <td valign=top>Drop Database if exists<br>
|
||||
<input class='login' type='checkbox' name='drop' value=1>
|
||||
<input class='login' type='checkbox' name='drop' id='drop' value=1>
|
||||
</td>";
|
||||
|
||||
echo "<td>Full path to HTTP publication directory<br>
|
||||
@ -637,8 +666,23 @@ function install_step3() {
|
||||
if (!$error) {
|
||||
echo "<div style='text-align:right; width:100%;'>";
|
||||
echo "<a id='step4' href='install.php?step=4'>
|
||||
<button class='btn_install_next' type='submit'><span class='btn_install_next_text'>Next</span></button></a>";
|
||||
<button class='btn_install_next' type='submit' id='step4button'><span class='btn_install_next_text'>Next</span></button></a>";
|
||||
echo "</div>";
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
var checkDrop = document.getElementById('step4button').addEventListener("click", function(event){
|
||||
if(document.getElementById("drop").checked){
|
||||
popupShow();
|
||||
}
|
||||
else{
|
||||
document.getElementsByName('step2_form')[0].submit();
|
||||
}
|
||||
event.preventDefault();
|
||||
});
|
||||
var step3_form = document.getElementsByName('step2_form')[0];
|
||||
step3_form.addEventListener("submit", checkDrop, true);
|
||||
</script>
|
||||
<?php
|
||||
}
|
||||
|
||||
echo "</div>";
|
||||
|
@ -343,7 +343,8 @@ if (is_ajax ()) {
|
||||
'module_condition', 'AND', 'tagente_modulo', false, array(), true);
|
||||
|
||||
$sql_tags_join = "INNER JOIN tagente ON tagente.id_agente = t1.id_agente
|
||||
INNER JOIN ttag_module ON ttag_module.id_agente_modulo = t1.id_agente_modulo";
|
||||
INNER JOIN ttag_module ON ttag_module.id_agente_modulo = t1.id_agente_modulo
|
||||
LEFT JOIN tagent_secondary_group tasg ON tagente.id_agente = tasg.id_agent";
|
||||
}
|
||||
|
||||
if (is_metaconsole()) {
|
||||
@ -478,17 +479,17 @@ if (is_ajax ()) {
|
||||
ON tj.num_names = $agent_total AND tj.nombre = t1.nombre %s %s",
|
||||
$sql_tags_join, (empty($where_tags)) ? "" : " WHERE 1=1 $where_tags");
|
||||
} else {
|
||||
$sql = sprintf('SELECT t1.nombre, t1.id_agente_modulo FROM tagente_modulo t1 %s %s',
|
||||
$sql = sprintf('SELECT t1.nombre, t1.id_agente_modulo FROM tagente_modulo t1 %s %s',
|
||||
$sql_tags_join, (empty($where_tags)) ? "" : " WHERE 1=1 $where_tags");
|
||||
}
|
||||
}
|
||||
else {
|
||||
$sql = sprintf (
|
||||
'SELECT DISTINCT t1.nombre, t1.id_agente_modulo FROM tagente_modulo t1
|
||||
INNER JOIN tagente_estado t2 ON t1.id_agente_modulo = t2.id_agente_modulo
|
||||
%s WHERE %s AND t1.delete_pending = 0
|
||||
AND t1.id_agente IN ('. implode(',', $idAgents) .')
|
||||
%s %s',
|
||||
INNER JOIN tagente_estado t2 ON t1.id_agente_modulo = t2.id_agente_modulo
|
||||
%s WHERE %s AND t1.delete_pending = 0
|
||||
AND t1.id_agente IN ('. implode(',', $idAgents) .')
|
||||
%s %s',
|
||||
$sql_tags_join, $filter, ' AND t2.datos NOT LIKE "%image%"', $where_tags);
|
||||
|
||||
if ($selection_mode == 'common') {
|
||||
|
@ -3,7 +3,7 @@
|
||||
#
|
||||
%define name pandorafms_console
|
||||
%define version 7.0NG.729
|
||||
%define release 181204
|
||||
%define release 181210
|
||||
|
||||
# User and Group under which Apache is running
|
||||
%define httpd_name httpd
|
||||
|
@ -3,7 +3,7 @@
|
||||
#
|
||||
%define name pandorafms_console
|
||||
%define version 7.0NG.729
|
||||
%define release 181204
|
||||
%define release 181210
|
||||
%define httpd_name httpd
|
||||
# User and Group under which Apache is running
|
||||
%define httpd_name apache2
|
||||
|
@ -1,5 +1,5 @@
|
||||
package: pandorafms-server
|
||||
Version: 7.0NG.729-181204
|
||||
Version: 7.0NG.729-181210
|
||||
Architecture: all
|
||||
Priority: optional
|
||||
Section: admin
|
||||
|
@ -14,7 +14,7 @@
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
pandora_version="7.0NG.729-181204"
|
||||
pandora_version="7.0NG.729-181210"
|
||||
|
||||
package_cpan=0
|
||||
package_pandora=1
|
||||
|
@ -45,7 +45,7 @@ our @EXPORT = qw(
|
||||
|
||||
# version: Defines actual version of Pandora Server for this module only
|
||||
my $pandora_version = "7.0NG.729";
|
||||
my $pandora_build = "181204";
|
||||
my $pandora_build = "181210";
|
||||
our $VERSION = $pandora_version." ".$pandora_build;
|
||||
|
||||
# Setup hash
|
||||
|
@ -32,7 +32,7 @@ our @ISA = qw(Exporter);
|
||||
|
||||
# version: Defines actual version of Pandora Server for this module only
|
||||
my $pandora_version = "7.0NG.729";
|
||||
my $pandora_build = "181204";
|
||||
my $pandora_build = "181210";
|
||||
our $VERSION = $pandora_version." ".$pandora_build;
|
||||
|
||||
our %EXPORT_TAGS = ( 'all' => [ qw() ] );
|
||||
|
@ -595,7 +595,7 @@ sub logger ($$;$) {
|
||||
open (FILE, ">> $file") or die "[FATAL] Could not open logfile '$file'";
|
||||
# Get an exclusive lock on the file (LOCK_EX)
|
||||
flock (FILE, 2);
|
||||
print FILE strftime ("%Y-%m-%d %H:%M:%S", localtime()) . " " . $pa_config->{'servername'} . " [V". $level ."] " . $message . "\n";
|
||||
print FILE strftime ("%Y-%m-%d %H:%M:%S", localtime()) . " " . (defined($pa_config->{'servername'}) ? $pa_config->{'servername'} : '') . " [V". $level ."] " . $message . "\n";
|
||||
close (FILE);
|
||||
}
|
||||
}
|
||||
|
@ -3,7 +3,7 @@
|
||||
#
|
||||
%define name pandorafms_server
|
||||
%define version 7.0NG.729
|
||||
%define release 181204
|
||||
%define release 181210
|
||||
|
||||
Summary: Pandora FMS Server
|
||||
Name: %{name}
|
||||
|
@ -3,7 +3,7 @@
|
||||
#
|
||||
%define name pandorafms_server
|
||||
%define version 7.0NG.729
|
||||
%define release 181204
|
||||
%define release 181210
|
||||
|
||||
Summary: Pandora FMS Server
|
||||
Name: %{name}
|
||||
|
@ -9,7 +9,7 @@
|
||||
# **********************************************************************
|
||||
|
||||
PI_VERSION="7.0NG.729"
|
||||
PI_BUILD="181204"
|
||||
PI_BUILD="181210"
|
||||
|
||||
MODE=$1
|
||||
if [ $# -gt 1 ]; then
|
||||
|
@ -34,7 +34,7 @@ use PandoraFMS::Config;
|
||||
use PandoraFMS::DB;
|
||||
|
||||
# version: define current version
|
||||
my $version = "7.0NG.729 PS181204";
|
||||
my $version = "7.0NG.729 PS181210";
|
||||
|
||||
# Pandora server configuration
|
||||
my %conf;
|
||||
|
@ -36,7 +36,7 @@ use Encode::Locale;
|
||||
Encode::Locale::decode_argv;
|
||||
|
||||
# version: define current version
|
||||
my $version = "7.0NG.729 PS181204";
|
||||
my $version = "7.0NG.729 PS181210";
|
||||
|
||||
# save program name for logging
|
||||
my $progname = basename($0);
|
||||
|
21
pandora_server/util/pwrd/config.json
Normal file
21
pandora_server/util/pwrd/config.json
Normal file
@ -0,0 +1,21 @@
|
||||
{
|
||||
"capabilities": [
|
||||
{
|
||||
"browserName": "*firefox",
|
||||
"maxInstances": 1,
|
||||
"seleniumProtocol": "Selenium"
|
||||
},
|
||||
{
|
||||
"browserName": "firefox",
|
||||
"maxInstances": 1,
|
||||
"seleniumProtocol": "WebDriver"
|
||||
}
|
||||
],
|
||||
"configuration": {
|
||||
"proxy": "org.openqa.grid.selenium.proxy.DefaultRemoteProxy",
|
||||
"maxSession": 1,
|
||||
"port": 5555,
|
||||
"register": true,
|
||||
"registerCycle": 5000
|
||||
}
|
||||
}
|
20
pandora_server/util/pwrd/extras/crontab_entries_sample
Normal file
20
pandora_server/util/pwrd/extras/crontab_entries_sample
Normal file
@ -0,0 +1,20 @@
|
||||
# Sample PWRD crontab control tweaks
|
||||
|
||||
# Do not allow firefox running for more than 1h
|
||||
0 * * * * root /opt/pwrd_maintenance.sh -k
|
||||
|
||||
# Force node-start
|
||||
*/5 * * * * root /opt/pwrd_maintenance.sh -s
|
||||
|
||||
# Reset firefox version if does not match required 47.0.1
|
||||
* * * * * root /opt/pwrd_maintenance.sh -f
|
||||
|
||||
# Restart node if java process is not found
|
||||
* * * * * root /opt/pwrd_maintenance.sh -r
|
||||
|
||||
# Restart node if no activity since last check
|
||||
*/5 * * * * root /opt/pwrd_maintenance.sh -c1
|
||||
|
||||
# Restart node if connection have been lost to hub
|
||||
*/5 * * * * root /opt/pwrd_maintenance.sh -c2
|
||||
|
52
pandora_server/util/pwrd/extras/pwrd_maintenance.sh
Executable file
52
pandora_server/util/pwrd/extras/pwrd_maintenance.sh
Executable file
@ -0,0 +1,52 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Sample PWRD maintenance script
|
||||
# **********************************************************************
|
||||
|
||||
# **********************************************************************
|
||||
# Settings
|
||||
hub_ip="192.168.1.10"
|
||||
hub_port="4444"
|
||||
|
||||
# Customize PWR global installation directory
|
||||
PWR_FIREFOX_INSTALLDIR="/opt"
|
||||
|
||||
# **********************************************************************
|
||||
|
||||
if [ "$1" == "-k" ]; then
|
||||
killall --older-than 1h firefox >/dev/null 2>&1
|
||||
|
||||
elif [ "$1" == "-s" ]; then
|
||||
/etc/init.d/pwrd start-node http://$hub_ip:$hub_port/grid/register > /dev/null 2>&1
|
||||
|
||||
elif [ "$1" == "-f" ]; then
|
||||
if [ "`firefox --version`" != "Mozilla Firefox 47.0.1" ]; then
|
||||
$PWR_FIREFOX_INSTALLDIR/restore_firefox.sh >/dev/null 2>&1
|
||||
echo `date +"%c"` Firefox restored > /tmp/restore_firefox.log
|
||||
[`/etc/init.d/pwrd status | grep "Node is running" | wc -l` -eq 1 ] && /etc/init.d/pwrd restart-node http://$hub_ip:$hub_port/grid/register > /dev/null 2>&1
|
||||
[`/etc/init.d/pwrd status | grep "PWRD is running" | wc -l` -eq 1 ] && /etc/init.d/pwrd restart > /dev/null 2>&1
|
||||
fi
|
||||
|
||||
elif [ "$1" == "-r" ]; then
|
||||
if [ ` ps aux | grep "java -jar" | grep -v grep | wc -l` -lt 1 ]; then
|
||||
[`/etc/init.d/pwrd status | grep "Node is running" | wc -l` -eq 1 ] && /etc/init.d/pwrd restart-node http://$hub_ip:$hub_port/grid/register > /dev/null 2>&1
|
||||
[`/etc/init.d/pwrd status | grep "PWRD is running" | wc -l` -eq 1 ] && /etc/init.d/pwrd restart > /dev/null 2>&1
|
||||
echo `date +"%c"` PWRD restarted, java process not found > /tmp/pwrd_restart_detected.log
|
||||
fi
|
||||
|
||||
elif [ "$1" == "-c1" ]; then
|
||||
if [ $(/etc/pandora/plugins/grep_log /var/log/pwr/pwr_std.log check_pwrd ".*" | wc -l) -eq 0 ]; then
|
||||
[`/etc/init.d/pwrd status | grep "Node is running" | wc -l` -eq 1 ] && /etc/init.d/pwrd restart-node http://$hub_ip:$hub_port/grid/register > /dev/null 2>&1
|
||||
[`/etc/init.d/pwrd status | grep "PWRD is running" | wc -l` -eq 1 ] && /etc/init.d/pwrd restart > /dev/null 2>&1
|
||||
echo $(date +"%c") PWRD restarted, no output detected in log > /tmp/pwrd_restart_detected.log
|
||||
fi
|
||||
|
||||
elif [ "$1" == "-c2" ]; then
|
||||
if [ $(/etc/pandora/plugins/grep_log /var/log/pwr/pwr_std.log check_pwrd_err_conn "refused" | grep "$hub_ip:$hub_port [/$hub_ip] failed:" | wc -l) -gt 0 ]; then
|
||||
/etc/init.d/pwrd restart-node http://$hub_ip:$hub_port/grid/register > /dev/null 2>&1
|
||||
echo $(date +"%c") PWRD restarted, lost connection with hub > /tmp/pwrd_restart_detected.log
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
|
20
pandora_server/util/pwrd/extras/restore_firefox.sh
Executable file
20
pandora_server/util/pwrd/extras/restore_firefox.sh
Executable file
@ -0,0 +1,20 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Script to restore firefox to tar
|
||||
#
|
||||
# **********************************************************************
|
||||
|
||||
# Customize PWR global installation directory
|
||||
PWR_FIREFOX_INSTALLDIR="/opt"
|
||||
|
||||
cd $PWR_FIREFOX_INSTALLDIR
|
||||
|
||||
if [ -f firefox-47.0.1.tar ]; then
|
||||
rm -rf firefox-47 >/dev/null 2>&1
|
||||
mv firefox firefox_ >/dev/null 2>&1
|
||||
tar xvf firefox-47.0.1.tar >/dev/null 2>&1
|
||||
mv firefox firefox-47 >/dev/null 2>&1
|
||||
mv firefox_ firefox >/dev/null 2>&1
|
||||
else
|
||||
echo "firefox-47.0.1.tar not found, please leave a copy at $PWR_FIREFOX_INSTALLDIR"
|
||||
fi
|
Binary file not shown.
@ -0,0 +1 @@
|
||||
4881ba55982d75040775bafdffcdf57b2cd7ea13
|
116
pandora_server/util/pwrd/install_pwrd.sh
Normal file → Executable file
116
pandora_server/util/pwrd/install_pwrd.sh
Normal file → Executable file
@ -1,7 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [ "$1" == "" ] || [ "$1" != "--install" ]; then
|
||||
cat<<_HELP
|
||||
HELP=`cat<<_HELP
|
||||
**********************
|
||||
PWR Server installer
|
||||
**********************
|
||||
@ -9,44 +8,91 @@ if [ "$1" == "" ] || [ "$1" != "--install" ]; then
|
||||
To install the Pandora web robot daemon (pwrd)
|
||||
Please launch this script as root:
|
||||
|
||||
$0 --install
|
||||
$0 --install [[user] [directory]]
|
||||
|
||||
|
||||
_HELP
|
||||
`
|
||||
|
||||
if [ "$1" == "" ] || [ "$1" != "--install" ]; then
|
||||
echo "$HELP"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ "`rpm -qa | grep xorg-x11-server-Xvfb | wc -l`" == "0" ]; then
|
||||
echo "Package xorg-x11-server-Xvfb is required"
|
||||
exit 0
|
||||
if [ "`which rpm`" ]; then
|
||||
if [ "`rpm -qa | grep xorg-x11-server-Xvfb | wc -l`" == "0" ]; then
|
||||
echo "Package xorg-x11-server-Xvfb is required"
|
||||
exit 0
|
||||
fi
|
||||
else
|
||||
echo "Xvfb is required, please confirm is installed in your system"
|
||||
fi
|
||||
|
||||
# default user is running user
|
||||
GLOBAL_INST_USER=`whoami`
|
||||
|
||||
if [ "$2" != "" ]; then
|
||||
if [ `cat /etc/passwd | cut -f1 -d':' | grep -w "$2" | wc -l` -gt 0 ]; then
|
||||
GLOBAL_INST_USER=$2
|
||||
elif [ -d "$2" ]; then
|
||||
GLOBAL_INST_DIR=$2
|
||||
else
|
||||
echo "Cannot use \"$2\" as user nor directory"
|
||||
echo "$HELP"
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$3" != "" ]; then
|
||||
if [ -d "$3" ]; then
|
||||
GLOBAL_INST_DIR=$3
|
||||
elif [ `cat /etc/passwd | cut -f1 -d':' | grep -w "$3" | wc -l` -gt 0 ]; then
|
||||
GLOBAL_INST_USER=$3
|
||||
else
|
||||
echo "Cannot use \"$3\" as directory nor user"
|
||||
echo "$HELP"
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
|
||||
chmod +x pwrd
|
||||
|
||||
PWR_SERVER_DEST=/usr/lib/pwr
|
||||
PWR_SERVER_RSC=/etc/pwr/tmp
|
||||
PWR_SERVER_LOG=/var/log/pwr
|
||||
PWR_FIREFOX_INSTALLDIR=/opt
|
||||
PWR_SERVER_DEST=$GLOBAL_INST_DIR/usr/lib/pwr
|
||||
PWR_SERVER_RSC=$GLOBAL_INST_DIR/etc/pwr/tmp
|
||||
PWR_SERVER_LOG=$GLOBAL_INST_DIR/var/log/pwr
|
||||
PWR_FIREFOX_INSTALLDIR=$GLOBAL_INST_DIR/opt
|
||||
|
||||
mkdir -p $PWR_SERVER_DEST
|
||||
mkdir -p $PWR_SERVER_LOG
|
||||
mkdir -p $PWR_SERVER_RSC
|
||||
mkdir -p $PWR_FIREFOX_INSTALLDIR
|
||||
PWR_FIREFOX_INSTALLDIR_ESCAPED=`echo $PWR_FIREFOX_INSTALLDIR | sed 's/\\//\\\\\//g'`
|
||||
GLOBAL_INST_DIR_ESCAPED=`echo $GLOBAL_INST_DIR | sed 's/\\//\\\\\//g'`
|
||||
|
||||
[ -d $PWR_SERVER_DEST ] || mkdir -p $PWR_SERVER_DEST
|
||||
[ -d $PWR_SERVER_LOG ] || mkdir -p $PWR_SERVER_LOG
|
||||
[ -d $PWR_SERVER_RSC ] || mkdir -p $PWR_SERVER_RSC
|
||||
[ -d $PWR_FIREFOX_INSTALLDIR ] || mkdir -p $PWR_FIREFOX_INSTALLDIR
|
||||
[ -d $GLOBAL_INST_DIR/etc/init.d ] || mkdir -p $GLOBAL_INST_DIR/etc/init.d
|
||||
|
||||
tar xvf firefox-43.0.tar >/dev/null
|
||||
mv firefox $PWR_FIREFOX_INSTALLDIR/
|
||||
tar xvf firefox-47.0.1.tar >/dev/null
|
||||
mv firefox $PWR_FIREFOX_INSTALLDIR/firefox-47
|
||||
ln -s $PWR_FIREFOX_INSTALLDIR/firefox-47/firefox $PWR_FIREFOX_INSTALLDIR/firefox
|
||||
|
||||
tar xvzf firefox_profile.tar.gz >/dev/null
|
||||
chown -R `whoami`. firefox_profile
|
||||
mv firefox_profile $PWR_FIREFOX_INSTALLDIR
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Failed to deploy firefox profile, please retry installation"
|
||||
exit 1
|
||||
fi
|
||||
chown -R "$GLOBAL_INST_USER". firefox_profile
|
||||
[ ! -d "$PWR_FIREFOX_INSTALLDIR/firefox_profile" ] && mv firefox_profile $PWR_FIREFOX_INSTALLDIR
|
||||
|
||||
ln -s $PWR_FIREFOX_INSTALLDIR/firefox/firefox /usr/bin/firefox
|
||||
[ -d "$PWR_FIREFOX_INSTALLDIR/selenium" ] || mkdir -p $PWR_FIREFOX_INSTALLDIR/selenium
|
||||
|
||||
cp config.json $PWR_FIREFOX_INSTALLDIR/selenium/
|
||||
|
||||
ln -s $PWR_FIREFOX_INSTALLDIR/firefox /usr/bin/firefox
|
||||
|
||||
# Generate logrotate configuration
|
||||
|
||||
cat > /etc/logrotate.d/pwrd <<EO_LROTATE
|
||||
echo <<EO_LROTATE > /etc/logrotate.d/pwrd
|
||||
/var/log/pwr/pwr_std.log
|
||||
/var/log/pwr/xvfb.log
|
||||
/var/log/pwr/pwr_error.log {
|
||||
weekly
|
||||
missingok
|
||||
@ -60,10 +106,35 @@ cat > /etc/logrotate.d/pwrd <<EO_LROTATE
|
||||
|
||||
EO_LROTATE
|
||||
|
||||
cp ./extras/restore_firefox.sh $PWR_FIREFOX_INSTALLDIR/
|
||||
cp ./extras/pwrd_maintenance.sh $PWR_FIREFOX_INSTALLDIR/
|
||||
cp ./selenium-server-standalone-2.53.1.jar $PWR_SERVER_DEST/
|
||||
cp ./pwrd /etc/init.d/pwrd
|
||||
cp ./pwrd $GLOBAL_INST_DIR/etc/init.d/pwrd
|
||||
chmod +x /etc/init.d/pwrd
|
||||
|
||||
# Update pwrd daemon
|
||||
if [ "$GLOBAL_INST_DIR" != "" ]; then
|
||||
echo "Adjusting pwrd global directory to: $GLOBAL_INST_DIR"
|
||||
sed -i "s/PWR_GLOBAL_DIR=\"\"/PWR_GLOBAL_DIR=\"$GLOBAL_INST_DIR_ESCAPED\"/g" /etc/init.d/pwrd
|
||||
sed -i "s/PWR_GLOBAL_DIR=\"\"/PWR_GLOBAL_DIR=\"$GLOBAL_INST_DIR_ESCAPED\"/g" $GLOBAL_INST_DIR/etc/init.d/pwrd
|
||||
echo "Adjusting pwrd_maintenance global directory to: $PWR_FIREFOX_INSTALLDIR"
|
||||
sed -i "s/PWR_FIREFOX_INSTALLDIR=\"\/opt\"/PWR_FIREFOX_INSTALLDIR=\"$PWR_FIREFOX_INSTALLDIR_ESCAPED\"/g" $PWR_FIREFOX_INSTALLDIR/pwrd_maintenance.sh
|
||||
echo "Adjusting restore_firefox global directory to: $PWR_FIREFOX_INSTALLDIR"
|
||||
sed -i "s/PWR_FIREFOX_INSTALLDIR=\"\/opt\"/PWR_FIREFOX_INSTALLDIR=\"$PWR_FIREFOX_INSTALLDIR_ESCAPED\"/g" $PWR_FIREFOX_INSTALLDIR/restore_firefox.sh
|
||||
fi
|
||||
|
||||
if [ "$GLOBAL_INST_USER" != "" ]; then
|
||||
echo "Adjusting pwrd global user to: $GLOBAL_INST_USER"
|
||||
sed -i "s/USER=\"root\"/USER=\"$GLOBAL_INST_USER\"/g" /etc/init.d/pwrd
|
||||
sed -i "s/USER=\"root\"/USER=\"$GLOBAL_INST_USER\"/g" $GLOBAL_INST_DIR/etc/init.d/pwrd
|
||||
fi
|
||||
|
||||
|
||||
[ "$GLOBAL_INST_USER" != "" ] && chown -R "$GLOBAL_INST_USER". $PWR_SERVER_DEST
|
||||
[ "$GLOBAL_INST_USER" != "" ] && chown -R "$GLOBAL_INST_USER". $PWR_SERVER_LOG
|
||||
[ "$GLOBAL_INST_USER" != "" ] && chown -R "$GLOBAL_INST_USER". $PWR_SERVER_RSC
|
||||
|
||||
cat <<EOF
|
||||
*********************
|
||||
PWR Server deployed
|
||||
@ -71,10 +142,9 @@ cat <<EOF
|
||||
|
||||
Succesfully installed!
|
||||
|
||||
Please start the service with:
|
||||
Now you can start the service with:
|
||||
|
||||
/etc/init.d/pwrd start
|
||||
|
||||
|
||||
EOF
|
||||
|
||||
|
@ -1,9 +1,25 @@
|
||||
#!/bin/bash
|
||||
# pwr - this script starts and stops the pwr grid
|
||||
|
||||
# **********************************************************************
|
||||
# Pandora FMS PWR Server Daemon
|
||||
# (c) 2008-2018 Artica ST
|
||||
#
|
||||
# chkconfig: - 85 1# description: PWRD Grid is a distributed testing platform for browser-based automation.
|
||||
# Please see http://www.pandorafms.org
|
||||
# **********************************************************************
|
||||
|
||||
### BEGIN INIT INFO
|
||||
# Provides: pwrd
|
||||
# Required-Start: $network
|
||||
# Required-Stop: $network
|
||||
# Default-Start: 2 3 5
|
||||
# Default-Stop: 0 1 6
|
||||
# Short-Description: Startup script daemon for PWR server
|
||||
# Description: Startup script daemon for PWR server (linux)
|
||||
### END INIT INFO
|
||||
|
||||
# chkconfig: - 85 1
|
||||
# description: PWRD Grid is a distributed platform for browser-based automation.
|
||||
# processname: pwr
|
||||
# pidfile: $base_dir/pwr.pid
|
||||
|
||||
# Source function library.
|
||||
|
||||
@ -12,21 +28,55 @@ if [ -e /etc/rc.d/init.d/functions ]; then
|
||||
fi
|
||||
|
||||
|
||||
pwr_dir=/usr/lib/pwr
|
||||
log_dir=/var/log/pwr
|
||||
std_log=$log_dir/pwr_std.log
|
||||
base_dir=/etc/pwr/tmp
|
||||
java=/usr/bin/java
|
||||
pwr="$pwr_dir/selenium-server-standalone-2.53.1.jar"
|
||||
# Following parameters will control node capabilities: -browser browserName=firefox,maxInstances=1,platform=LINUX
|
||||
PWROPTS=" -firefoxProfileTemplate /opt/firefox_profile"
|
||||
PWR_HUB_OPTS=""
|
||||
user=root
|
||||
xvfb_pid_file=$base_dir/xvfb.pid
|
||||
# **********************************************************************
|
||||
# Configuration options
|
||||
# Example node capabilities: -browser browserName=firefox,maxInstances=1,platform=LINUX
|
||||
|
||||
# Customize Java binary path
|
||||
JAVA=/usr/bin/java
|
||||
|
||||
# Customize PWR global installation directory
|
||||
PWR_GLOBAL_DIR=""
|
||||
|
||||
# Customize PWR running user
|
||||
USER="root"
|
||||
|
||||
# Customize PWR application files directory
|
||||
PWR_INST_DIR="$PWR_GLOBAL_DIR/opt"
|
||||
|
||||
# Customize port for PWR
|
||||
PWR_PORT=4444
|
||||
PWR_HUB_PORT=4444
|
||||
PWR_NODE_PORT=5555
|
||||
|
||||
# Extra options for PWR
|
||||
PWR_OPTS=" -firefoxProfileTemplate $PWR_INST_DIR/firefox_profile "
|
||||
PWR_NODE_OPTS=" -nodeConfig $PWR_INST_DIR/selenium/config.json "
|
||||
PWR_HUB_OPTS=""
|
||||
|
||||
|
||||
# **********************************************************************
|
||||
# Default paths
|
||||
|
||||
PWR_DIR="$PWR_GLOBAL_DIR/usr/lib/pwr"
|
||||
LOG_DIR="$PWR_GLOBAL_DIR/var/log/pwr"
|
||||
STD_LOG="$LOG_DIR/pwr_std.log"
|
||||
BASE_DIR="$PWR_GLOBAL_DIR/etc/pwr/tmp"
|
||||
PWR="$PWR_DIR/selenium-server-standalone-2.53.1.jar"
|
||||
XVFB_PID_FILE="$BASE_DIR/xvfb.pid"
|
||||
|
||||
|
||||
|
||||
# **********************************************************************
|
||||
# Variables
|
||||
|
||||
# Variable
|
||||
host=`ip a show $(route -n | awk '/^0\.0\.0\.0/ {print $NF}') | grep "inet " | awk '{print $2}' | cut -f1 -d'/' | head -1`
|
||||
|
||||
|
||||
|
||||
# **********************************************************************
|
||||
# Functions
|
||||
|
||||
# Start Xvfb, required for firefox in server without X
|
||||
function start_xvfb() {
|
||||
`which Xvfb >/dev/null 2>&1`
|
||||
@ -37,45 +87,48 @@ function start_xvfb() {
|
||||
echo 1
|
||||
fi
|
||||
else
|
||||
Xvfb :99 -ac > /dev/null 2>&1 &
|
||||
Xvfb :99 -screen 0 1400x768x24 -ac +extension RANDR > $LOG_DIR/xvfb.log 2>&1 & echo $! > $XVFB_PID_FILE
|
||||
export DISPLAY=:99
|
||||
ps -eo pid,cmd | grep Xvfb | grep -v grep | awk {'print $1 '} > $xvfb_pid_file
|
||||
echo 0
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
# Stop Xvfb
|
||||
function stop_xvfb() {
|
||||
if test -f $xvfb_pid_file ; then
|
||||
echo
|
||||
if test -f $XVFB_PID_FILE ; then
|
||||
# Check if there's more instances of pwrd running i.e. standalone + node
|
||||
if [ ! -e "$base_dir/pwrd_node.pid" ] && [ ! -e "$base_dir/pwrd.pid" ]; then
|
||||
echo -n "Stopping Xvfb..."
|
||||
PID=$(cat $xvfb_pid_file)
|
||||
if [ `kill -9 $PID 2>&1 | grep "No such process" | wc -l` == "1" ]; then
|
||||
if [ ! -e "$BASE_DIR/pwrd_node.pid" ] && [ ! -e "$BASE_DIR/pwrd.pid" ]; then
|
||||
if [ ! -e /etc/rc.d/init.d/functions ]; then
|
||||
echo -n "Stopping Xvfb..."
|
||||
fi
|
||||
PID=$(cat $XVFB_PID_FILE)
|
||||
if [ "$PID" != "" ] && [ `kill -9 $PID 2>&1 | grep "No such process" | wc -l` == "1" ]; then
|
||||
# PID file exists but no process
|
||||
test -f $xvfb_pid_file && rm -f $xvfb_pid_file
|
||||
[ -f $XVFB_PID_FILE ] && rm -f $XVFB_PID_FILE
|
||||
if [ -e /etc/rc.d/init.d/functions ]; then
|
||||
success
|
||||
fi
|
||||
return 0
|
||||
fi
|
||||
else
|
||||
echo "(1) pwrd process left. Skipping Xvfb"
|
||||
[ -e $BASE_DIR/pwrd_node.pid ] && echo -n `cat $BASE_DIR/pwrd_node.pid`
|
||||
[ -e $BASE_DIR/pwrd.pid ] && echo -n `cat $BASE_DIR/pwrd.pid`
|
||||
echo -e "\nThere're pwrd processes left. Skipping Xvfb"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
################################################################################
|
||||
|
||||
########################################################################
|
||||
# START
|
||||
################################################################################
|
||||
########################################################################
|
||||
|
||||
# Start Selenium Standalone server
|
||||
function start() {
|
||||
if test -f $pid_file
|
||||
then
|
||||
if test -f $pid_file; then
|
||||
PID=`cat $pid_file`
|
||||
if ps --pid $PID >/dev/null; then
|
||||
if [ "$PID" != "" ] && ps --pid $PID >/dev/null; then
|
||||
echo "PWRD is already running: $PID"
|
||||
exit 2
|
||||
else
|
||||
@ -91,11 +144,12 @@ function start() {
|
||||
return 1
|
||||
fi
|
||||
|
||||
echo -n "Starting PWRD..."
|
||||
if [ ! -e /etc/rc.d/init.d/functions ]; then
|
||||
echo -n "Starting PWRD..."
|
||||
fi
|
||||
|
||||
export DISPLAY=:99
|
||||
su $user -c "$java -jar $pwr -host $host $PWROPTS > $std_log 2>&1 &"
|
||||
|
||||
PID=$(su $USER -c "$JAVA -jar $PWR -host $host -port $PWR_PORT $PWR_OPTS > $STD_LOG 2>&1 & echo \$!")
|
||||
if [ $? == "0" ]; then
|
||||
if [ -e /etc/rc.d/init.d/functions ]; then
|
||||
success
|
||||
@ -109,28 +163,29 @@ function start() {
|
||||
fi
|
||||
|
||||
# Store PID
|
||||
ps -eo pid,cmd | grep $pwr | grep -v "node" | grep -v "hub" | grep -v grep | awk {'print $1 '} > $pid_file
|
||||
echo -n $PID > $pid_file
|
||||
|
||||
}
|
||||
|
||||
# Start Selenium GRID server: HUB component
|
||||
function start-hub() {
|
||||
if test -f $pid_file
|
||||
then
|
||||
if test -f $pid_file; then
|
||||
PID=`cat $pid_file`
|
||||
if ps --pid $PID >/dev/null; then
|
||||
if [ "$PID" != "" ] && ps --pid $PID >/dev/null; then
|
||||
echo "PWRD is already running: $PID"
|
||||
exit 2
|
||||
else
|
||||
echo "Removing stale pid file: $pid_file"
|
||||
fi
|
||||
fi
|
||||
echo -n "Starting PWRD..."
|
||||
|
||||
if [ ! -e /etc/rc.d/init.d/functions ]; then
|
||||
echo -n "Starting PWRD..."
|
||||
fi
|
||||
|
||||
# No Xvfb needed in hub mode
|
||||
|
||||
su $user -c "$java -jar $pwr -host $host -role hub $PWR_HUB_OPTS > $std_log 2>&1 &"
|
||||
|
||||
PID=$(su $USER -c "$JAVA -jar $PWR -host $host -port $PWR_HUB_PORT -role hub $PWR_HUB_OPTS > $STD_LOG 2>&1 & echo \$!")
|
||||
if [ $? == "0" ]; then
|
||||
if [ -e /etc/rc.d/init.d/functions ]; then
|
||||
success
|
||||
@ -144,15 +199,17 @@ function start-hub() {
|
||||
fi
|
||||
|
||||
# Store PID
|
||||
ps -eo pid,cmd | grep $pwr | grep "hub" | grep -v grep | awk {'print $1 '} > $pid_file
|
||||
echo -n $PID > $pid_file
|
||||
|
||||
echo
|
||||
echo -e "Add nodes to HUB executing:\n $0 start-node http://$host:$PWR_HUB_PORT/grid/register"
|
||||
}
|
||||
|
||||
# Start Selenium GRID server: Node Connect to hub
|
||||
function start-node() {
|
||||
if test -f $pid_file
|
||||
then
|
||||
if test -f $pid_file ; then
|
||||
PID=`cat $pid_file`
|
||||
if ps --pid $PID >/dev/null; then
|
||||
if [ "$PID" != "" ] && ps --pid $PID >/dev/null; then
|
||||
echo "PWRD is already running: $PID"
|
||||
exit 2
|
||||
else
|
||||
@ -168,11 +225,12 @@ function start-node() {
|
||||
return 1
|
||||
fi
|
||||
|
||||
echo -n "Starting PWRD..."
|
||||
if [ ! -e /etc/rc.d/init.d/functions ]; then
|
||||
echo -n "Starting PWRD..."
|
||||
fi
|
||||
|
||||
export DISPLAY=:99
|
||||
su $user -c "$java -jar $pwr -host $host -role node -hub $1 $PWROPTS > $std_log 2>&1 &"
|
||||
|
||||
PID=$(su $USER -c "$JAVA -jar $PWR -host $host -port $PWR_NODE_PORT -role node -hub $1 $PWR_OPTS > $STD_LOG 2>&1 & echo \$!")
|
||||
if [ $? == "0" ]; then
|
||||
if [ -e /etc/rc.d/init.d/functions ]; then
|
||||
success
|
||||
@ -186,34 +244,39 @@ function start-node() {
|
||||
fi
|
||||
|
||||
# Store PID
|
||||
ps -C java -eo pid,cmd | grep $pwr | grep "node" | grep -v grep | awk {'print $1 '} > $pid_file
|
||||
echo -n $PID > $pid_file
|
||||
}
|
||||
|
||||
################################################################################
|
||||
|
||||
########################################################################
|
||||
# STOP
|
||||
################################################################################
|
||||
########################################################################
|
||||
|
||||
# Stop Selenium Standalone server
|
||||
function stop() {
|
||||
if test -f $pid_file ; then
|
||||
echo -n "Stopping PWRD..."
|
||||
PID=$(cat $pid_file)
|
||||
su $user -c "kill -3 $PID"
|
||||
kill -9 $PID >/dev/null 2>&1
|
||||
[ "$PID" == "" ] && PID=`ps aux | grep "$JAVA -jar $PWR" | grep -v grep | awk '{print $2}'`
|
||||
[ "$PID" != "" ] && ps --pid $PID >/dev/null && su $USER -c "kill -3 $PID"
|
||||
[ "$PID" != "" ] && ps --pid $PID >/dev/null && kill -9 $PID >/dev/null 2>&1
|
||||
if [ $? -eq 0 ]; then
|
||||
sleep 5
|
||||
test -f $pid_file && rm -f $pid_file
|
||||
sleep 2
|
||||
if [ -e /etc/rc.d/init.d/functions ]; then
|
||||
success
|
||||
fi
|
||||
test -f $pid_file && rm -f $pid_file
|
||||
|
||||
stop_xvfb
|
||||
else
|
||||
echo "PWRD could not be stopped..."
|
||||
if [ -e /etc/rc.d/init.d/functions ]; then
|
||||
failure
|
||||
else
|
||||
echo "Failed"
|
||||
fi
|
||||
echo "Failed"
|
||||
fi
|
||||
stop_xvfb
|
||||
# Clean pid file
|
||||
test -f $pid_file && rm -f $pid_file
|
||||
else
|
||||
echo "PWRD is not running."
|
||||
stop_xvfb
|
||||
@ -224,84 +287,94 @@ function stop() {
|
||||
echo
|
||||
}
|
||||
|
||||
################################################################################
|
||||
|
||||
########################################################################
|
||||
# STATUS
|
||||
################################################################################
|
||||
########################################################################
|
||||
|
||||
# Status of Selenium Standalone server
|
||||
function status() {
|
||||
mode=$1
|
||||
if test -f $pid_file ; then
|
||||
echo "checking: $pid_file"
|
||||
PID=`cat $pid_file`
|
||||
if ps --pid $PID >/dev/null ; then
|
||||
echo "PWRD is running: $PID"
|
||||
if test -f $xvfb_pid_file ; then
|
||||
PID=`cat $xvfb_pid_file`
|
||||
if test -f $xvfb_pid_file ; then
|
||||
if [ "$PID" != "" ] && ps --pid $PID >/dev/null; then
|
||||
echo "PWRD$mode is running: $PID"
|
||||
if test -f $XVFB_PID_FILE ; then
|
||||
PID=`cat $XVFB_PID_FILE`
|
||||
if test -f $XVFB_PID_FILE ; then
|
||||
echo "Xvfb is running: $PID"
|
||||
fi
|
||||
fi
|
||||
else
|
||||
echo "PWRD isn't running..."
|
||||
echo "PWRD$mode isn't running..."
|
||||
fi
|
||||
else
|
||||
echo "PWRD isn't running..."
|
||||
echo "PWRD$mode isn't running..."
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
########################################################################
|
||||
# MAIN
|
||||
########################################################################
|
||||
|
||||
if [ ! -x "$JAVA" ]; then
|
||||
echo "Please verify $JAVA is a valid java" 2>&1
|
||||
exit 1
|
||||
fi
|
||||
|
||||
case "$1" in
|
||||
start) # Standalone
|
||||
pid_file=$base_dir/pwrd.pid
|
||||
pid_file=$BASE_DIR/pwrd.pid
|
||||
start
|
||||
;;
|
||||
start-hub) # hub
|
||||
pid_file=$base_dir/pwrd_hub.pid
|
||||
pid_file=$BASE_DIR/pwrd_hub.pid
|
||||
start-hub
|
||||
;;
|
||||
start-node) # node
|
||||
pid_file=$base_dir/pwrd_node.pid
|
||||
pid_file=$BASE_DIR/pwrd_node.pid
|
||||
start-node $2
|
||||
;;
|
||||
stop) # standalone
|
||||
pid_file=$base_dir/pwrd.pid
|
||||
pid_file=$BASE_DIR/pwrd.pid
|
||||
stop
|
||||
;;
|
||||
stop-hub) # hub
|
||||
pid_file=$base_dir/pwrd_hub.pid
|
||||
pid_file=$BASE_DIR/pwrd_hub.pid
|
||||
stop
|
||||
;;
|
||||
stop-node) # node
|
||||
pid_file=$base_dir/pwrd_node.pid
|
||||
pid_file=$BASE_DIR/pwrd_node.pid
|
||||
stop
|
||||
;;
|
||||
restart) # standalone
|
||||
pid_file=$base_dir/pwrd.pid
|
||||
pid_file=$BASE_DIR/pwrd.pid
|
||||
stop
|
||||
start
|
||||
;;
|
||||
restart-hub) # hub
|
||||
pid_file=$base_dir/pwrd_hub.pid
|
||||
pid_file=$BASE_DIR/pwrd_hub.pid
|
||||
stop
|
||||
start-hub
|
||||
;;
|
||||
restart-node) # node
|
||||
pid_file=$base_dir/pwrd_node.pid
|
||||
pid_file=$BASE_DIR/pwrd_node.pid
|
||||
stop
|
||||
start-node $2
|
||||
;;
|
||||
status)
|
||||
pid_file=$base_dir/pwrd.pid
|
||||
status
|
||||
;;
|
||||
status-hub) # hub
|
||||
pid_file=$base_dir/pwrd_hub.pid
|
||||
status
|
||||
;;
|
||||
status-node) # node
|
||||
pid_file=$base_dir/pwrd_node.pid
|
||||
status
|
||||
pid_file=$BASE_DIR/pwrd.pid
|
||||
status ""
|
||||
pid_file=$BASE_DIR/pwrd_hub.pid
|
||||
status " HUB"
|
||||
pid_file=$BASE_DIR/pwrd_node.pid
|
||||
status " Node"
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $SELF start*|stop*|restart*|status*"
|
||||
echo "Usage: $SELF start*|stop*|restart*|status"
|
||||
echo " start* (standalone, hub or node)"
|
||||
echo " start"
|
||||
echo " start-hub"
|
||||
@ -314,12 +387,6 @@ case "$1" in
|
||||
echo " restart"
|
||||
echo " restart-hub"
|
||||
echo " restart-node http://hub:4444/grid/register"
|
||||
echo " status* (standalone, hub or node)"
|
||||
echo " status"
|
||||
echo " status-hub"
|
||||
echo " status-node"
|
||||
exit 9
|
||||
;;
|
||||
esac
|
||||
|
||||
echo FIN [$1]
|
||||
|
@ -2,7 +2,7 @@ FROM pandorafms/pandorafms-base
|
||||
MAINTAINER Pandora FMS Team <info@pandorafms.com>
|
||||
|
||||
# Pandora FMS Server dependencies
|
||||
RUN yum install -y fping perl-Test-WWW-Selenium perl-Crypt-Blowfish perl-Crypt-ECB perl-Net-OpenSSH
|
||||
RUN yum install -y fping perl-Test-WWW-Selenium perl-Crypt-Blowfish perl-Crypt-ECB perl-Crypt-Rijndael perl-Net-OpenSSH
|
||||
|
||||
RUN ln -s /usr/bin/braa /usr/local/bin/braa
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user