Merge remote-tracking branch 'origin/ent-4772-omnishell' into ent-EDF

This commit is contained in:
fbsanchez 2019-11-15 13:08:09 +01:00
commit 9440570548
7 changed files with 66 additions and 15 deletions

View File

@ -1439,7 +1439,7 @@ sub prepare_commands {
my $rcmd_file = $ConfDir.'/commands/'.$ref.'.rcmd';
# Check for local .rcmd.done files
if (-e $Conf{'temporal'}.'/'.$ref.'.rcmd.done') {
if (-e $rcmd_file.'.done') {
# Ignore.
delete $Conf{'commands'}->{$ref};
next;

View File

@ -26,8 +26,8 @@ CREATE TABLE `tremote_command_target` (
`rcmd_id` bigint unsigned NOT NULL,
`id_agent` int(10) unsigned NOT NULL,
`utimestamp` int(20) unsigned NOT NULL default 0,
`stdout` text,
`stderr` text,
`stdout` MEDIUMTEXT,
`stderr` MEDIUMTEXT,
`errorlevel` int(10) unsigned NOT NULL default 0,
PRIMARY KEY (`id`),
FOREIGN KEY (`rcmd_id`) REFERENCES `tremote_command`(`id`)

View File

@ -2324,8 +2324,8 @@ CREATE TABLE `tremote_command_target` (
`rcmd_id` bigint unsigned NOT NULL,
`id_agent` int(10) unsigned NOT NULL,
`utimestamp` int(20) unsigned NOT NULL default 0,
`stdout` text,
`stderr` text,
`stdout` MEDIUMTEXT,
`stderr` MEDIUMTEXT,
`errorlevel` int(10) unsigned NOT NULL default 0,
PRIMARY KEY (`id`),
FOREIGN KEY (`rcmd_id`) REFERENCES `tremote_command`(`id`)

View File

@ -132,6 +132,32 @@ function agents_get_agent_id_by_alias($alias)
}
/**
* Return seconds left to contact again with agent.
*
* @param integer $id_agente Target agent
*
* @return integer|null Seconds left.
*/
function agents_get_next_contact_time_left(int $id_agente)
{
$last_contact = false;
if ($id_agente > 0) {
$last_contact = db_get_value_sql(
sprintf(
'SELECT format(intervalo,2) - (UNIX_TIMESTAMP() - UNIX_TIMESTAMP(IF(ultimo_contacto > ultimo_contacto_remoto, ultimo_contacto, ultimo_contacto_remoto))) as "val"
FROM `tagente`
WHERE id_agente = %d ',
$id_agente
)
);
}
return $last_contact;
}
/**
* Creates an agent.
*

View File

@ -25,6 +25,32 @@
height: 100px;
}
.element-target-big:hover {
box-shadow: 0 0 10px -5px #424242;
}
.element-target-big:before {
content: attr(data-label);
position: relative;
text-align: center;
width: 100%;
height: 100%;
color: #373737;
font-weight: bolder;
display: flex;
flex-direction: row;
font-size: 1.8em;
align-items: center;
justify-content: center;
overflow: hidden;
font-family: "lato-bolder", "Open Sans", sans-serif;
text-decoration: none;
}
.container-target a:hover {
text-decoration: none;
}
.status-normal {
background-color: #add570;
}
@ -156,6 +182,12 @@ ul.wizard {
display: flex;
}
.no-class.action-buttons.mw120px.textright.sorting_disabled,
.textright {
text-align: right;
padding-right: 2em;
}
/*
* Discovery css global
*/

View File

@ -68,14 +68,7 @@ if (is_ajax()) {
if ($refresh_contact) {
$id_agente = get_parameter('id_agente', 0);
if ($id_agente > 0) {
$last_contact = db_get_value_sql(
sprintf(
'SELECT format(intervalo,2) - (UNIX_TIMESTAMP() - UNIX_TIMESTAMP(IF(ultimo_contacto > ultimo_contacto_remoto, ultimo_contacto, ultimo_contacto_remoto))) as "val"
FROM `tagente`
WHERE id_agente = %d ',
$id_agente
)
);
$last_contact = agents_get_next_contact_time_left($id_agente);
$progress = agents_get_next_contact($id_agente);
if ($progress < 0 || $progress > 100) {

View File

@ -3683,8 +3683,8 @@ CREATE TABLE `tremote_command_target` (
`rcmd_id` bigint unsigned NOT NULL,
`id_agent` int(10) unsigned NOT NULL,
`utimestamp` int(20) unsigned NOT NULL default 0,
`stdout` text,
`stderr` text,
`stdout` MEDIUMTEXT,
`stderr` MEDIUMTEXT,
`errorlevel` int(10) unsigned NOT NULL default 0,
PRIMARY KEY (`id`),
FOREIGN KEY (`rcmd_id`) REFERENCES `tremote_command`(`id`)