mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-29 08:45:12 +02:00
#10144 added info plugin in centralized mode and added module info in metaç
This commit is contained in:
parent
9c593b062f
commit
9e495eaadd
@ -57,21 +57,9 @@ if (is_ajax()) {
|
|||||||
$network_components = [];
|
$network_components = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
$modules = db_get_all_rows_filter(
|
|
||||||
'tagente_modulo',
|
|
||||||
[
|
|
||||||
'delete_pending' => 0,
|
|
||||||
'id_plugin' => $id_plugin,
|
|
||||||
]
|
|
||||||
);
|
|
||||||
if (empty($modules)) {
|
|
||||||
$modules = [];
|
|
||||||
}
|
|
||||||
|
|
||||||
$table = new stdClass();
|
$table = new stdClass();
|
||||||
$table->width = '100%';
|
$table->width = '100%';
|
||||||
$table->head[0] = __('Network Components');
|
$table->head[0] = __('Network Components');
|
||||||
// $table->data = [];
|
|
||||||
foreach ($network_components as $net_comp) {
|
foreach ($network_components as $net_comp) {
|
||||||
$table->data[] = [$net_comp['name']];
|
$table->data[] = [$net_comp['name']];
|
||||||
}
|
}
|
||||||
@ -80,24 +68,86 @@ if (is_ajax()) {
|
|||||||
html_print_table($table);
|
html_print_table($table);
|
||||||
}
|
}
|
||||||
|
|
||||||
$table = new stdClass();
|
if (is_metaconsole() === true) {
|
||||||
$table->width = '100%';
|
$connection_names = metaconsole_get_connection_names();
|
||||||
$table->head[0] = __('Agent');
|
$modules = [];
|
||||||
$table->head[1] = __('Module');
|
foreach ($connection_names as $connection_name) {
|
||||||
foreach ($modules as $mod) {
|
$connected = metaconsole_connect(metaconsole_get_connection($connection_name));
|
||||||
$agent_name = '<a href="'.ui_get_full_url('index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$mod['id_agente']).'">'.modules_get_agentmodule_agent_alias(
|
if ($connected != NOERR) {
|
||||||
$mod['id_agente_modulo']
|
continue;
|
||||||
).'</a>';
|
}
|
||||||
|
|
||||||
|
$modules_node = db_get_all_rows_filter(
|
||||||
|
'tagente_modulo',
|
||||||
|
[
|
||||||
|
'delete_pending' => 0,
|
||||||
|
'id_plugin' => $id_plugin,
|
||||||
|
]
|
||||||
|
);
|
||||||
|
if (empty($modules_node) === false) {
|
||||||
|
foreach ($modules_node as $key => $mod) {
|
||||||
|
$modules_node[$key]['name_agent'] = modules_get_agentmodule_agent_alias($mod['id_agente_modulo']);
|
||||||
|
}
|
||||||
|
|
||||||
$table->data[] = [
|
$modules[$connection_name] = $modules_node;
|
||||||
$agent_name,
|
}
|
||||||
$mod['nombre'],
|
|
||||||
];
|
metaconsole_restore_db();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$modules = db_get_all_rows_filter(
|
||||||
|
'tagente_modulo',
|
||||||
|
[
|
||||||
|
'delete_pending' => 0,
|
||||||
|
'id_plugin' => $id_plugin,
|
||||||
|
]
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($table->data)) {
|
if (empty($modules)) {
|
||||||
html_print_table($table);
|
$modules = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (is_metaconsole() === true) {
|
||||||
|
foreach ($modules as $name_server => $modules_node) {
|
||||||
|
$table = new stdClass();
|
||||||
|
$table->width = '100%';
|
||||||
|
$table->head[0] = $name_server.' - '.__('Agent');
|
||||||
|
$table->head[1] = $name_server.' - '.__('Module');
|
||||||
|
foreach ($modules_node as $mod) {
|
||||||
|
$server = metaconsole_get_servers(metaconsole_get_id_server($name_server));
|
||||||
|
$agent_name = '<a href="'.$server['server_url'].'index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$mod['id_agente'].'">'.$mod['name_agent'].'</a>';
|
||||||
|
|
||||||
|
$table->data[] = [
|
||||||
|
$agent_name,
|
||||||
|
$mod['nombre'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($table->data)) {
|
||||||
|
html_print_table($table);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$table = new stdClass();
|
||||||
|
$table->width = '100%';
|
||||||
|
$table->head[0] = __('Agent');
|
||||||
|
$table->head[1] = __('Module');
|
||||||
|
foreach ($modules as $mod) {
|
||||||
|
$agent_name = '<a href="'.ui_get_full_url('index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$mod['id_agente']).'">'.modules_get_agentmodule_agent_alias(
|
||||||
|
$mod['id_agente_modulo']
|
||||||
|
).'</a>';
|
||||||
|
|
||||||
|
|
||||||
|
$table->data[] = [
|
||||||
|
$agent_name,
|
||||||
|
$mod['nombre'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($table->data)) {
|
||||||
|
html_print_table($table);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
@ -991,8 +1041,39 @@ if (empty($create) === false || empty($view) === false) {
|
|||||||
$pluginTable->data = [];
|
$pluginTable->data = [];
|
||||||
|
|
||||||
foreach ($rows as $k => $row) {
|
foreach ($rows as $k => $row) {
|
||||||
|
$tableActionButtons = [];
|
||||||
|
// Show it is locket.
|
||||||
|
$modules_using_plugin = db_get_value_filter(
|
||||||
|
'count(*)',
|
||||||
|
'tagente_modulo',
|
||||||
|
[
|
||||||
|
'delete_pending' => 0,
|
||||||
|
'id_plugin' => $row['id'],
|
||||||
|
]
|
||||||
|
);
|
||||||
|
$components_using_plugin = db_get_value_filter(
|
||||||
|
'count(*)',
|
||||||
|
'tnetwork_component',
|
||||||
|
['id_plugin' => $row['id']]
|
||||||
|
);
|
||||||
|
if (($components_using_plugin + $modules_using_plugin) > 0) {
|
||||||
|
$tableActionButtons[] = html_print_anchor(
|
||||||
|
[
|
||||||
|
'href' => 'javascript: show_locked_dialog('.$row['id'].', \''.$row['name'].'\');',
|
||||||
|
'content' => html_print_image(
|
||||||
|
'images/policy@svg.svg',
|
||||||
|
true,
|
||||||
|
[
|
||||||
|
'title' => __('Lock'),
|
||||||
|
'class' => 'invert_filter main_menu_icon',
|
||||||
|
]
|
||||||
|
),
|
||||||
|
],
|
||||||
|
true
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
if ($management_allowed === true) {
|
if ($management_allowed === true) {
|
||||||
$tableActionButtons = [];
|
|
||||||
$pluginNameContent = html_print_anchor(
|
$pluginNameContent = html_print_anchor(
|
||||||
[
|
[
|
||||||
'href' => 'index.php?sec=$sec&sec2=godmode/servers/plugin&view='.$row['id'].'&tab=plugins&pure='.$config['pure'],
|
'href' => 'index.php?sec=$sec&sec2=godmode/servers/plugin&view='.$row['id'].'&tab=plugins&pure='.$config['pure'],
|
||||||
@ -1001,37 +1082,6 @@ if (empty($create) === false || empty($view) === false) {
|
|||||||
true
|
true
|
||||||
);
|
);
|
||||||
|
|
||||||
// Show it is locket.
|
|
||||||
$modules_using_plugin = db_get_value_filter(
|
|
||||||
'count(*)',
|
|
||||||
'tagente_modulo',
|
|
||||||
[
|
|
||||||
'delete_pending' => 0,
|
|
||||||
'id_plugin' => $row['id'],
|
|
||||||
]
|
|
||||||
);
|
|
||||||
$components_using_plugin = db_get_value_filter(
|
|
||||||
'count(*)',
|
|
||||||
'tnetwork_component',
|
|
||||||
['id_plugin' => $row['id']]
|
|
||||||
);
|
|
||||||
if (($components_using_plugin + $modules_using_plugin) > 0) {
|
|
||||||
$tableActionButtons[] = html_print_anchor(
|
|
||||||
[
|
|
||||||
'href' => 'javascript: show_locked_dialog('.$row['id'].', \''.$row['name'].'\');',
|
|
||||||
'content' => html_print_image(
|
|
||||||
'images/policy@svg.svg',
|
|
||||||
true,
|
|
||||||
[
|
|
||||||
'title' => __('Lock'),
|
|
||||||
'class' => 'invert_filter main_menu_icon',
|
|
||||||
]
|
|
||||||
),
|
|
||||||
],
|
|
||||||
true
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
$tableActionButtons[] = html_print_anchor(
|
$tableActionButtons[] = html_print_anchor(
|
||||||
[
|
[
|
||||||
'href' => 'index.php?sec=$sec&sec2=godmode/servers/plugin&tab=$tab&view='.$row['id'].'&tab=plugins&pure='.$config['pure'],
|
'href' => 'index.php?sec=$sec&sec2=godmode/servers/plugin&tab=$tab&view='.$row['id'].'&tab=plugins&pure='.$config['pure'],
|
||||||
@ -1072,15 +1122,13 @@ if (empty($create) === false || empty($view) === false) {
|
|||||||
$pluginTable->data[$k][1] = ((int) $row['plugin_type'] === 0) ? __('Standard') : __('Nagios');
|
$pluginTable->data[$k][1] = ((int) $row['plugin_type'] === 0) ? __('Standard') : __('Nagios');
|
||||||
$pluginTable->data[$k][2] = $row['execute'];
|
$pluginTable->data[$k][2] = $row['execute'];
|
||||||
|
|
||||||
if ($management_allowed === true) {
|
$pluginTable->data[$k][3] = html_print_div(
|
||||||
$pluginTable->data[$k][3] = html_print_div(
|
[
|
||||||
[
|
'class' => 'table_action_buttons',
|
||||||
'class' => 'table_action_buttons',
|
'content' => implode('', $tableActionButtons),
|
||||||
'content' => implode('', $tableActionButtons),
|
],
|
||||||
],
|
true
|
||||||
true
|
);
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
html_print_table($pluginTable);
|
html_print_table($pluginTable);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user