Merge remote-tracking branch 'origin/ent-3431-discovery-host-devices' into ent-1798-monitorizacion-aws-amazon
Conflicts: pandora_console/godmode/wizards/Wizard.main.php Former-commit-id: dead86a654f8b2873721387233a9c9797b0cd8b1
This commit is contained in:
commit
73a5e691ef
|
@ -292,8 +292,13 @@ class DiscoveryTaskList extends Wizard
|
|||
$data[7] = ui_print_timestamp($task['utimestamp'], true);
|
||||
|
||||
if (check_acl($config['id_user'], $task['id_group'], 'PM')) {
|
||||
// Check if is a H&D, Cloud or Application.
|
||||
$data[8] = '<a href="'.ui_get_full_url(
|
||||
'index.php?sec=gservers&sec2=godmode/servers/discovery&wiz=hd&mode=netscan&page=0&task='.$task['id_rt']
|
||||
sprintf(
|
||||
'index.php?sec=gservers&sec2=godmode/servers/discovery&%s&page=0&task=%d',
|
||||
$this->getTargetWiz($task),
|
||||
$task['id_rt']
|
||||
)
|
||||
).'">'.html_print_image(
|
||||
'images/wrench_orange.png',
|
||||
true
|
||||
|
@ -348,4 +353,24 @@ class DiscoveryTaskList extends Wizard
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return target url sub-string to edit target task.
|
||||
*
|
||||
* @param array $task With all data.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getTargetWiz($task)
|
||||
{
|
||||
// TODO: Do not use description. Use recon_script ID instead.
|
||||
switch ($task['description']) {
|
||||
case 'Discovery.Application.VMware':
|
||||
return 'wiz=app&mode=vmware';
|
||||
|
||||
default:
|
||||
return 'wiz=hd&mode=netscan';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -92,7 +92,15 @@ class HostDevices extends Wizard
|
|||
$mode = get_parameter('mode', null);
|
||||
|
||||
if ($mode === null) {
|
||||
$this->setBreadcrum(['<div class="arrow_box"><a href="index.php?sec=gservers&sec2=godmode/servers/discovery&wiz=hd" class="text_color">Host & devices</a></div>']);
|
||||
$this->prepareBreadcrum(
|
||||
[
|
||||
[
|
||||
'link' => $this->url.'&wiz=hd',
|
||||
'label' => __('    Host & devices'),
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->printHeader();
|
||||
$this->printBigButtonsList(
|
||||
[
|
||||
|
@ -115,10 +123,16 @@ class HostDevices extends Wizard
|
|||
|
||||
if (enterprise_installed()) {
|
||||
if ($mode == 'importcsv') {
|
||||
$this->setBreadcrum(
|
||||
$this->prepareBreadcrum(
|
||||
[
|
||||
'<div class="arrow_box"><a href="index.php?sec=gservers&sec2=godmode/servers/discovery&wiz=hd" class="text_color">Host & devices</a></div>',
|
||||
'<div class="arrow_box"><a href="index.php?sec=gservers&sec2=godmode/servers/discovery&wiz=hd&mode=importcsv" class="text_color">Import CSV</a></div>',
|
||||
[
|
||||
'link' => $this->url.'&wiz=hd',
|
||||
'label' => __('    Host & devices'),
|
||||
],
|
||||
[
|
||||
'link' => $this->url.'&wiz=hd&mode=importcsv',
|
||||
'label' => __('      Import CSV'),
|
||||
],
|
||||
]
|
||||
);
|
||||
$this->printHeader();
|
||||
|
@ -128,20 +142,36 @@ class HostDevices extends Wizard
|
|||
}
|
||||
|
||||
if ($mode == 'netscan') {
|
||||
if ($this->page != 3) {
|
||||
if ($this->page != 2) {
|
||||
// Do not paint breadcrum in last page. Redirected.
|
||||
$this->setBreadcrum(
|
||||
$this->prepareBreadcrum(
|
||||
[
|
||||
'<div class="arrow_box"><a href="index.php?sec=gservers&sec2=godmode/servers/discovery&wiz=hd"class="text_color">Host & devices</a></div>',
|
||||
'<div class="arrow_box"><a href="index.php?sec=gservers&sec2=godmode/servers/discovery&wiz=hd&mode=netscan" class="text_color">Net scan definition</a></div>',
|
||||
[
|
||||
'link' => $this->url.'&wiz=hd',
|
||||
'label' => __('    Host & devices'),
|
||||
],
|
||||
[
|
||||
'link' => $this->url.'&wiz=hd&mode=netscan',
|
||||
'label' => __('      Net scan definition'),
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
if ($this->page == 1) {
|
||||
$this->setBreadcrum(
|
||||
$this->prepareBreadcrum(
|
||||
[
|
||||
'<div class="arrow_box"><a href="index.php?sec=gservers&sec2=godmode/servers/discovery&wiz=hd"class="text_color">Host & devices</a></div>',
|
||||
'<div class="arrow_box"><a href="index.php?sec=gservers&sec2=godmode/servers/discovery&wiz=hd&mode=netscan" class="text_color">Net scan definition</a></div>',
|
||||
'<div class="arrow_box"><a href="index.php?sec=gservers&sec2=godmode/servers/discovery&wiz=hd&mode=netscan&page=1" class="text_color">Net scan features</a></div>',
|
||||
[
|
||||
'link' => $this->url.'&wiz=hd',
|
||||
'label' => __('    Host & devices'),
|
||||
],
|
||||
[
|
||||
'link' => $this->url.'&wiz=hd&mode=netscan',
|
||||
'label' => __('      Net scan definition'),
|
||||
],
|
||||
[
|
||||
'link' => $this->url.'&wiz=hd&mode=netscan&page=1',
|
||||
'label' => __('      Net scan features'),
|
||||
],
|
||||
]
|
||||
);
|
||||
}
|
||||
|
@ -1096,4 +1126,26 @@ $(function() {
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Builder for breadcrum
|
||||
*
|
||||
* @param array $urls Array of urls to be stored in breadcrum.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function prepareBreadcrum(array $urls)
|
||||
{
|
||||
$bc = [];
|
||||
$i = 0;
|
||||
foreach ($urls as $url) {
|
||||
$bc[$i] = '<a href="'.$url['link'].'" class="text_color">';
|
||||
$bc[$i] .= '<div class="arrow_box">'.$url['label'].'</div>';
|
||||
$bc[$i++] .= '</a>';
|
||||
}
|
||||
|
||||
$this->setBreadcrum($bc);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -78,7 +78,7 @@ class Wizard
|
|||
{
|
||||
return $this->breadcrum;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Add an element to breadcrum array.
|
||||
|
@ -87,7 +87,8 @@ class Wizard
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function addBreadcrum($string) {
|
||||
protected function addBreadcrum($string)
|
||||
{
|
||||
if (empty($string)) {
|
||||
return;
|
||||
}
|
||||
|
@ -96,6 +97,52 @@ class Wizard
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Setter for label
|
||||
*
|
||||
* @param string $str Label.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setLabel(string $str)
|
||||
{
|
||||
$this->label = $str;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Getter for label
|
||||
*
|
||||
* @return array Breadcrum.
|
||||
*/
|
||||
public function getLabel()
|
||||
{
|
||||
return $this->label;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Builder for breadcrum
|
||||
*
|
||||
* @param array $urls Array of urls to be stored in breadcrum.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function prepareBreadcrum(array $urls)
|
||||
{
|
||||
$bc = [];
|
||||
$i = 0;
|
||||
foreach ($urls as $url) {
|
||||
$bc[$i] = '<a href="'.$url['link'].'" class="text_color">';
|
||||
$bc[$i] .= '<div class="arrow_box">'.$url['label'].'</div>';
|
||||
$bc[$i++] .= '</a>';
|
||||
}
|
||||
|
||||
$this->setBreadcrum($bc);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* To be overwritten.
|
||||
*
|
||||
|
@ -371,6 +418,17 @@ class Wizard
|
|||
((isset($data['unique']) === true) ? $data['unique'] : false)
|
||||
);
|
||||
|
||||
case 'textarea':
|
||||
return html_print_textarea(
|
||||
$data['name'],
|
||||
$data['rows'],
|
||||
$data['columns'],
|
||||
((isset($data['value']) === true) ? $data['value'] : ''),
|
||||
((isset($data['attributes']) === true) ? $data['attributes'] : ''),
|
||||
((isset($data['return']) === true) ? $data['return'] : false),
|
||||
((isset($data['class']) === true) ? $data['class'] : '')
|
||||
);
|
||||
|
||||
default:
|
||||
// Ignore.
|
||||
break;
|
||||
|
@ -385,14 +443,18 @@ class Wizard
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function printGoBackButton()
|
||||
public function printGoBackButton($url=null)
|
||||
{
|
||||
if (isset($url) === false) {
|
||||
$url = ui_get_full_url(
|
||||
'index.php?sec=gservers&sec2=godmode/servers/discovery'
|
||||
);
|
||||
}
|
||||
|
||||
$form = [
|
||||
'form' => [
|
||||
'method' => 'POST',
|
||||
'action' => ui_get_full_url(
|
||||
'index.php?sec=gservers&sec2=godmode/servers/discovery'
|
||||
),
|
||||
'action' => $url,
|
||||
],
|
||||
'inputs' => [
|
||||
[
|
||||
|
@ -548,7 +610,8 @@ class Wizard
|
|||
*
|
||||
* @return void Print the full list.
|
||||
*/
|
||||
public static function printBigButtonsList($list_data){
|
||||
public static function printBigButtonsList($list_data)
|
||||
{
|
||||
echo '<ul>';
|
||||
array_map('self::printBigButtonElement', $list_data);
|
||||
echo '</ul>';
|
||||
|
|
|
@ -501,6 +501,7 @@ class ConsoleSupervisor
|
|||
case 'NOTIF.UPDATEMANAGER.OPENSETUP':
|
||||
case 'NOTIF.UPDATEMANAGER.UPDATE':
|
||||
case 'NOTIF.UPDATEMANAGER.MINOR':
|
||||
case 'NOTIF.CRON.CONFIGURED':
|
||||
default:
|
||||
// NOTIF.SERVER.STATUS.
|
||||
// NOTIF.SERVER.STATUS.ID_SERVER.
|
||||
|
@ -1379,7 +1380,10 @@ class ConsoleSupervisor
|
|||
[
|
||||
'type' => 'NOTIF.PANDORADB',
|
||||
'title' => __('Database maintance problem'),
|
||||
'message' => __('Your database is not maintained correctly. It seems that more than 48hrs have passed without proper maintenance. Please review documents of %s on how to perform this maintenance process (DB Tool) and enable it as soon as possible.', get_product_name()),
|
||||
'message' => __(
|
||||
'Your database is not maintained correctly. It seems that more than 48hrs have passed without proper maintenance. Please review documents of %s on how to perform this maintenance process (DB Tool) and enable it as soon as possible.',
|
||||
io_safe_output(get_product_name())
|
||||
),
|
||||
'url' => ui_get_full_url(
|
||||
'index.php?sec=general&sec2=godmode/setup/setup§ion=perf'
|
||||
),
|
||||
|
@ -2081,4 +2085,55 @@ class ConsoleSupervisor
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check if CRON utility has been configured.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function checkCronRunning()
|
||||
{
|
||||
global $config;
|
||||
|
||||
// Check if DiscoveryCronTasks is running. Warn user if not.
|
||||
if ($config['cron_last_run'] == 0
|
||||
|| (get_system_time() - $config['cron_last_run']) > 3600
|
||||
) {
|
||||
$message_conf_cron = __('DiscoveryConsoleTasks is not running properly');
|
||||
if (strtoupper(substr(PHP_OS, 0, 3)) != 'WIN') {
|
||||
$message_conf_cron .= __('Discovery relies on a proper setup of cron, the time-based scheduling service');
|
||||
$message_conf_cron .= '. '.__('Please, add the following line to your crontab file:');
|
||||
$message_conf_cron .= '<pre>* * * * * <user> wget -q -O - --no-check-certificate ';
|
||||
$message_conf_cron .= str_replace(
|
||||
ENTERPRISE_DIR.'/meta/',
|
||||
'',
|
||||
ui_get_full_url(false)
|
||||
);
|
||||
$message_conf_cron .= ENTERPRISE_DIR.'/'.EXTENSIONS_DIR;
|
||||
$message_conf_cron .= '/cron/cron.php >> ';
|
||||
$message_conf_cron .= $config['homedir'].'/pandora_console.log</pre>';
|
||||
}
|
||||
|
||||
if (isset($config['cron_last_run']) === true) {
|
||||
$message_conf_cron .= __('Last execution').': ';
|
||||
$message_conf_cron .= date('Y/m/d H:i:s', $config['cron_last_run']);
|
||||
$message_conf_cron .= __('Please check process is no locked.');
|
||||
}
|
||||
|
||||
$this->notify(
|
||||
[
|
||||
'type' => 'NOTIF.CRON.CONFIGURED',
|
||||
'title' => __('DiscoveryConsoleTasks is not configured.'),
|
||||
'message' => __($message_conf_cron),
|
||||
'url' => ui_get_full_url(
|
||||
'index.php?extension_in_menu=gservers&sec=extensions&sec2=enterprise/extensions/cron'
|
||||
),
|
||||
]
|
||||
);
|
||||
} else {
|
||||
$this->cleanNotifications('NOTIF.CRON.CONFIGURED');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -2673,9 +2673,14 @@ function config_check()
|
|||
include_once __DIR__.'/class/ConsoleSupervisor.php';
|
||||
|
||||
// Enterprise customers launch supervisor using discovery task.
|
||||
if (license_free()) {
|
||||
if (enterprise_installed() === false) {
|
||||
$supervisor = new ConsoleSupervisor(false);
|
||||
$supervisor->run();
|
||||
} else if ($config['cron_last_run'] == 0
|
||||
|| (get_system_time() - $config['cron_last_run']) > 3600
|
||||
) {
|
||||
$supervisor = new ConsoleSupervisor(false);
|
||||
$supervisor->checkCronRunning();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -61,8 +61,7 @@ div.data_container:hover {
|
|||
display: inline-block;
|
||||
position: relative;
|
||||
background: #82b92e;
|
||||
width: 15%;
|
||||
padding: 1%;
|
||||
padding: 14px;
|
||||
margin-left: 20px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
|
|
@ -4305,6 +4305,7 @@ div#dialog_messages table th:last-child {
|
|||
position: absolute;
|
||||
width: 400px;
|
||||
margin-top: -5px;
|
||||
border-radius: 5px;
|
||||
}
|
||||
#notification-wrapper::before {
|
||||
content: "";
|
||||
|
@ -4338,12 +4339,15 @@ div#dialog_messages table th:last-child {
|
|||
background: whitesmoke;
|
||||
height: 100px;
|
||||
margin: 7px;
|
||||
border: #cccccc solid 1px;
|
||||
border: #e4e4e4 solid 1px;
|
||||
display: flex;
|
||||
flex-flow: row nowrap;
|
||||
align-items: center;
|
||||
padding: 5px;
|
||||
}
|
||||
.notification-item:hover {
|
||||
border: #ccc solid 1px;
|
||||
}
|
||||
.notification-item > * {
|
||||
padding-left: 15px;
|
||||
pointer-events: none;
|
||||
|
@ -4357,6 +4361,9 @@ div#dialog_messages table th:last-child {
|
|||
width: 87%;
|
||||
display: flex;
|
||||
flex-flow: column nowrap;
|
||||
overflow: hidden;
|
||||
max-height: 83px;
|
||||
line-height: 1.4em;
|
||||
}
|
||||
.notification-item img {
|
||||
max-width: 100%;
|
||||
|
|
|
@ -10,6 +10,12 @@ ul.wizard li {
|
|||
}
|
||||
|
||||
ul.wizard li > label:not(.p-switch) {
|
||||
width: 250px;
|
||||
vertical-align: top;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
ul.wizard li > textarea {
|
||||
width: 250px;
|
||||
display: inline-block;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue