mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-30 17:25:26 +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,6 +68,67 @@ if (is_ajax()) {
|
|||||||
html_print_table($table);
|
html_print_table($table);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (is_metaconsole() === true) {
|
||||||
|
$connection_names = metaconsole_get_connection_names();
|
||||||
|
$modules = [];
|
||||||
|
foreach ($connection_names as $connection_name) {
|
||||||
|
$connected = metaconsole_connect(metaconsole_get_connection($connection_name));
|
||||||
|
if ($connected != NOERR) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$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']);
|
||||||
|
}
|
||||||
|
|
||||||
|
$modules[$connection_name] = $modules_node;
|
||||||
|
}
|
||||||
|
|
||||||
|
metaconsole_restore_db();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$modules = db_get_all_rows_filter(
|
||||||
|
'tagente_modulo',
|
||||||
|
[
|
||||||
|
'delete_pending' => 0,
|
||||||
|
'id_plugin' => $id_plugin,
|
||||||
|
]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (empty($modules)) {
|
||||||
|
$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 = new stdClass();
|
||||||
$table->width = '100%';
|
$table->width = '100%';
|
||||||
$table->head[0] = __('Agent');
|
$table->head[0] = __('Agent');
|
||||||
@ -99,6 +148,7 @@ if (is_ajax()) {
|
|||||||
if (!empty($table->data)) {
|
if (!empty($table->data)) {
|
||||||
html_print_table($table);
|
html_print_table($table);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -991,16 +1041,7 @@ if (empty($create) === false || empty($view) === false) {
|
|||||||
$pluginTable->data = [];
|
$pluginTable->data = [];
|
||||||
|
|
||||||
foreach ($rows as $k => $row) {
|
foreach ($rows as $k => $row) {
|
||||||
if ($management_allowed === true) {
|
|
||||||
$tableActionButtons = [];
|
$tableActionButtons = [];
|
||||||
$pluginNameContent = html_print_anchor(
|
|
||||||
[
|
|
||||||
'href' => 'index.php?sec=$sec&sec2=godmode/servers/plugin&view='.$row['id'].'&tab=plugins&pure='.$config['pure'],
|
|
||||||
'content' => $row['name'],
|
|
||||||
],
|
|
||||||
true
|
|
||||||
);
|
|
||||||
|
|
||||||
// Show it is locket.
|
// Show it is locket.
|
||||||
$modules_using_plugin = db_get_value_filter(
|
$modules_using_plugin = db_get_value_filter(
|
||||||
'count(*)',
|
'count(*)',
|
||||||
@ -1032,6 +1073,15 @@ if (empty($create) === false || empty($view) === false) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($management_allowed === true) {
|
||||||
|
$pluginNameContent = html_print_anchor(
|
||||||
|
[
|
||||||
|
'href' => 'index.php?sec=$sec&sec2=godmode/servers/plugin&view='.$row['id'].'&tab=plugins&pure='.$config['pure'],
|
||||||
|
'content' => $row['name'],
|
||||||
|
],
|
||||||
|
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,7 +1122,6 @@ 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',
|
||||||
@ -1081,7 +1130,6 @@ if (empty($create) === false || empty($view) === false) {
|
|||||||
true
|
true
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
html_print_table($pluginTable);
|
html_print_table($pluginTable);
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user