width = '100%';
$table->class = 'floating_form';
$table->id = 'tree_view_module_data';
$table->style = [];
$table->style['title'] = 'height: 32px; width: 30%; padding-right: 5px; text-align: end;';
$table->style['data'] = 'height: 32px; width: 70%; padding-left: 5px; font-family: \'Pandora-Regular\';';
$table->data = [];
// Module name.
$cellName = ((bool) $module['disabled'] === true) ? ''.$module['nombre'].''.ui_print_help_tip(__('Disabled'), true) : $module['nombre'];
$row = [];
$row['title'] = __('Name');
$row['data'] = html_print_anchor(
[
'href' => $console_url.'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&id_agente='.$module['id_agente'].'&tab=module&edit_module=1&id_agent_module='.$module['id_agente_modulo'].$url_hash,
'title' => __('Click here for view this module'),
'class' => 'font_11',
'content' => $cellName,
],
true
);
$table->data['name'] = $row;
// Interval.
$row = [];
$row['title'] = __('Interval');
$row['data'] = human_time_description_raw(modules_get_interval($module['id_agente_modulo']), true);
$table->data['interval'] = $row;
// Warning Min/Max.
if (modules_is_string_type($module['id_tipo_modulo'])) {
$warning_status_str = __('Str.').': '.$module['str_warning'];
} else {
$warning_status_str = __('Min.').': '.(float) $module['min_warning'].'
'.__('Max.').': '.(float) $module['max_warning'];
}
$row = [];
$row['title'] = __('Warning status');
$row['data'] = $warning_status_str;
$table->data['warning_status'] = $row;
// Critical Min/Max.
if (modules_is_string_type($module['id_tipo_modulo'])) {
$critical_status_str = __('Str.').': '.$module['str_warning'];
} else {
$critical_status_str = __('Min.').': '.(float) $module['min_critical'].'
'.__('Max.').': '.(float) $module['max_critical'];
}
$row = [];
$row['title'] = __('Critical status');
$row['data'] = $critical_status_str;
$table->data['critical_status'] = $row;
// Module group.
$module_group = modules_get_modulegroup_name($module['id_module_group']);
if ($module_group === false) {
$module_group = __('Not assigned');
} else {
$module_group = __("$module_group");
}
$row = [];
$row['title'] = __('Module group');
$row['data'] = $module_group;
$table->data['module_group'] = $row;
$row = [];
$row['title'] = __('Description');
$row['data'] = $module['descripcion'];
$table->data['description'] = $row;
// Tags.
$tags = tags_get_module_tags($module['id_agente_modulo']);
if (empty($tags) === false) {
$user_tags = tags_get_user_tags($config['id_user']);
foreach ($tags as $k => $v) {
if (!array_key_exists($v, $user_tags)) {
// Only show user's tags.
unset($tags[$k]);
} else {
$tag_name = tags_get_name($v);
if (empty($tag_name) === true) {
unset($tags[$k]);
} else {
$tags[$k] = $tag_name;
}
}
}
}
$row = [];
$row['title'] = __('Tags');
$row['data'] = (empty($tags) === true) ? ''.__('N/A').'' : implode(', ', $tags);
$table->data['tags'] = $row;
// Data.
$last_data = db_get_row_filter('tagente_estado', ['id_agente_modulo' => $module['id_agente_modulo'], 'order' => ['field' => 'id_agente_estado', 'order' => 'DESC']]);
if ($config['render_proc']) {
switch ($module['id_tipo_modulo']) {
case 2:
case 6:
case 9:
case 18:
case 21:
case 31:
if (is_numeric($last_data['datos']) && $last_data['datos'] >= 1) {
$data = "".$config['render_proc_ok'].'';
} else {
$data = "".$config['render_proc_fail'].'';
}
break;
default:
switch ($module['id_tipo_modulo']) {
case 15:
$value = db_get_value('snmp_oid', 'tagente_modulo', 'id_agente_modulo', $module['id_agente_modulo']);
if ($value == '.1.3.6.1.2.1.1.3.0' || $value == '.1.3.6.1.2.1.25.1.1.0') {
$data = "".human_milliseconds_to_string($last_data['datos']).'';
} else if (is_numeric($last_data['datos'])) {
$data = "".remove_right_zeros(number_format($last_data['datos'], $config['graph_precision'], $config['decimal_separator'], $config['thousand_separator'])).'';
} else {
$data = ui_print_truncate_text(
io_safe_output($last_data['datos']),
GENERIC_SIZE_TEXT,
true,
true,
true,
'...',
'white-space: nowrap;'
);
}
break;
default:
if (is_numeric($last_data['datos'])) {
$data = "".remove_right_zeros(number_format($last_data['datos'], $config['graph_precision'], $config['decimal_separator'], $config['thousand_separator'])).'';
} else {
$data = ui_print_truncate_text(
io_safe_output($last_data['datos']),
GENERIC_SIZE_TEXT,
true,
true,
true,
'...',
'white-space: nowrap;'
);
}
break;
}
break;
}
} else {
switch ($module['id_tipo_modulo']) {
case 15:
$value = db_get_value('snmp_oid', 'tagente_modulo', 'id_agente_modulo', $module['id_agente_modulo']);
if ($value === '.1.3.6.1.2.1.1.3.0' || $value === '.1.3.6.1.2.1.25.1.1.0') {
$data = "".human_milliseconds_to_string($last_data['datos']).'';
} else if (is_numeric($last_data['datos']) === true) {
$data = "".remove_right_zeros(number_format($last_data['datos'], $config['graph_precision'], $config['decimal_separator'], $config['thousand_separator'])).'';
} else {
$data = ui_print_truncate_text(
io_safe_output($last_data['datos']),
GENERIC_SIZE_TEXT,
true,
true,
true,
'...',
'white-space: nowrap;'
);
}
break;
default:
if (is_numeric($last_data['datos'])) {
$data = "".remove_right_zeros(number_format($last_data['datos'], $config['graph_precision'], $config['decimal_separator'], $config['thousand_separator'])).'';
} else {
$data = ui_print_truncate_text(
io_safe_output($last_data['datos']),
GENERIC_SIZE_TEXT,
true,
true,
true,
'...',
'white-space: nowrap;'
);
}
break;
}
}
if (empty($last_data['utimestamp']) === false) {
$last_data_str = $data;
if (empty($module['unit']) === false) {
$data_macro = modules_get_unit_macro($last_data['datos'], $module['unit']);
if ($data_macro !== false) {
if (is_numeric($data_macro) === true) {
$last_data_str = "".remove_right_zeros(number_format($data_macro, $config['graph_precision'], $config['decimal_separator'], $config['thousand_separator'])).'';
} else {
$last_data_str = ui_print_truncate_text(
io_safe_output($data_macro),
GENERIC_SIZE_TEXT,
true,
true,
true,
'...',
'white-space: nowrap;'
);
}
} else {
$last_data_str .= ' ';
$last_data_str .= '('.$module['unit'].')';
}
}
$last_data_str .= ' ';
$last_data_str .= html_print_image('images/clock.svg', true, ['title' => $last_data['timestamp'], 'style' => 'margin-top: 3px; width: 20px', 'class' => 'invert_filter']);
$is_snapshot = is_snapshot_data($last_data['datos']);
$is_large_image = is_text_to_black_string($last_data['datos']);
if (($config['command_snapshot']) && ($is_snapshot || $is_large_image)) {
$link = ui_get_snapshot_link(
[
'id_module' => $module['id_agente_modulo'],
'interval' => $module['current_interval'],
'module_name' => $module['module_name'],
'id_node' => empty($server_id) ? 0 : $server_id,
]
);
$salida = ui_get_snapshot_image($link, $is_snapshot).' ';
}
if ($salida !== null) {
$last_data_str = html_print_image('images/clock2.png', true, ['title' => $last_data['timestamp'], 'width' => '18px', 'class' => 'invert_filter']);
}
$last_data_str .= $salida;
} else {
$last_data_str = ''.__('No data').'';
}
$row = [];
$row['title'] = __('Last data');
$row['data'] = $last_data_str;
$table->data['last_data'] = $row;
// Last status change.
$last_status_change = db_get_value('last_status_change', 'tagente_estado', 'id_agente_modulo', $module['id_agente_modulo']);
$row = [];
$row['title'] = __('Last status change');
$time_elapsed = ($last_status_change > 0) ? human_time_comparation($last_status_change) : __('N/A');
$row['data'] = $time_elapsed;
$table->data['tags'] = $row;
// Title.
echo ' ';
// End of table.
html_print_table($table);
$id_group = agents_get_agent_group($module['id_agente']);
$group_name = db_get_value('nombre', 'tgrupo', 'id_grupo', $id_group);
$agent_name = db_get_value('nombre', 'tagente', 'id_agente', $module['id_agente']);
/*
if ($user_access_node && check_acl($config['id_user'], $id_group, 'AW')) {
// Actions table
echo '