Commit version 24.12.13800

This commit is contained in:
2025-01-06 17:35:06 -05:00
parent b7f6a79c2c
commit 55d9218816
6133 changed files with 4239740 additions and 1374287 deletions

View File

@ -4,41 +4,63 @@
*
* This file is part of Observium.
*
* @package observium
* @subpackage poller
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2021 Observium Limited
* @package observium
* @subpackage poller
* @copyright (C) Adam Armstrong
*
*/
// This is populated by UNIX-Agent module. Don't reset it! :D
//$valid_applications = [];
foreach (dbFetchRows("SELECT * FROM `applications` WHERE `device_id` = ?", array($device['device_id'])) as $entry) {
$valid_applications[$entry['app_type']] = $entry;
if (is_module_enabled($device, 'unix-agent')) {
$agent_data = get_agent_data($device);
if (is_array($agent_data['app'])) {
foreach (array_keys($agent_data['app']) as $key) {
if (file_exists('includes/polling/applications/' . $key . '.inc.php')) {
//echo(" ");
// FIXME Currently only used by drbd to get $app['app_instance'] - shouldn't the drbd parser get instances from somewhere else?
// $app = @dbFetchRow("SELECT * FROM `applications` WHERE `device_id` = ? AND `app_type` = ?", array($device['device_id'],$key));
// print_debug('Including: applications/'.$key.'.inc.php');
// echo($key);
//include('includes/polling/applications/'.$key.'.inc.php');
$valid_applications[$key] = $key;
}
}
}
}
foreach (dbFetchRows("SELECT * FROM `applications` WHERE `device_id` = ?", [$device['device_id']]) as $entry) {
$valid_applications[$entry['app_type']] = $entry;
}
if (safe_count($valid_applications)) {
print_cli_data_field("Applications", 2);
foreach ($valid_applications as $app_type => $entry) {
echo $app_type . ' ';
print_cli_data_field("Applications", 2);
foreach ($valid_applications as $app_type => $entry) {
echo $app_type . ' ';
// One include per application type. Multiple instances currently handled within the application code
$app_include = $config['install_dir'] . '/includes/polling/applications/' . $app_type . '.inc.php';
if (is_file($app_include)) {
include($app_include);
} else {
echo($app_type . ' include missing! ');
}
// One include per application type. Multiple instances currently handled within the application code
$app_include = $config['install_dir'].'/includes/polling/applications/'.$app_type.'.inc.php';
if (is_file($app_include)) {
include($app_include);
} else {
echo($app_type.' include missing! ');
}
}
echo(PHP_EOL);
echo(PHP_EOL);
}
$app_rows = dbFetchRows("SELECT * FROM `applications` WHERE `device_id` = ? AND `app_lastpolled` < ?", array($device['device_id'], time()-604800));
foreach ($app_rows as $app)
{
dbDelete('applications', '`app_id` = ?', array($app['app_id']));
echo '-';
$app_rows = dbFetchRows("SELECT * FROM `applications` WHERE `device_id` = ? AND `app_lastpolled` < ?", [$device['device_id'], time() - 604800]);
foreach ($app_rows as $app) {
dbDelete('applications', '`app_id` = ?', [$app['app_id']]);
echo '-';
}