mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Do not include the applications, but enable them in the database. The application poller will run them. Also, reduce code-duplication.
This commit is contained in:
@@ -83,16 +83,6 @@ if ($device['os_group'] == 'unix') {
|
||||
}
|
||||
}
|
||||
|
||||
foreach (array_keys($agent_data['app']) as $key) {
|
||||
if (file_exists("includes/polling/applications/$key.inc.php")) {
|
||||
if ($debug) {
|
||||
echo "Including: applications/$key.inc.php";
|
||||
}
|
||||
|
||||
include "applications/$key.inc.php";
|
||||
}
|
||||
}
|
||||
|
||||
// Processes
|
||||
if (!empty($agent_data['ps'])) {
|
||||
echo 'Processes: ';
|
||||
@@ -111,12 +101,18 @@ if ($device['os_group'] == 'unix') {
|
||||
echo "\n";
|
||||
}
|
||||
|
||||
// Apache
|
||||
if (!empty($agent_data['app']['apache'])) {
|
||||
$app_found['apache'] = true;
|
||||
if (dbFetchCell('SELECT COUNT(*) FROM `applications` WHERE `device_id` = ? AND `app_type` = ?', array($device['device_id'], 'apache')) == '0') {
|
||||
echo "Found new application 'Apache'\n";
|
||||
dbInsert(array('device_id' => $device['device_id'], 'app_type' => 'apache'), 'applications');
|
||||
foreach (array_keys($agent_data['app']) as $key) {
|
||||
if (file_exists("includes/polling/applications/$key.inc.php")) {
|
||||
if ($debug) {
|
||||
echo "Enabling $key for $device['hostname'] if not yet enabled\n";
|
||||
}
|
||||
|
||||
if (in_array($key, array('apache', 'mysql', 'nginx')) {
|
||||
if (dbFetchCell('SELECT COUNT(*) FROM `applications` WHERE `device_id` = ? AND `app_type` = ?', array($device['device_id'], $key)) == '0') {
|
||||
echo "Found new application '$key'\n";
|
||||
dbInsert(array('device_id' => $device['device_id'], 'app_type' => $key), 'applications');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -131,15 +127,6 @@ if ($device['os_group'] == 'unix') {
|
||||
}
|
||||
}
|
||||
|
||||
// MySQL
|
||||
if (!empty($agent_data['app']['mysql'])) {
|
||||
$app_found['mysql'] = true;
|
||||
if (dbFetchCell('SELECT COUNT(*) FROM `applications` WHERE `device_id` = ? AND `app_type` = ?', array($device['device_id'], 'mysql')) == '0') {
|
||||
echo "Found new application 'MySQL'\n";
|
||||
dbInsert(array('device_id' => $device['device_id'], 'app_type' => 'mysql'), 'applications');
|
||||
}
|
||||
}
|
||||
|
||||
// DRBD
|
||||
if (!empty($agent_data['drbd'])) {
|
||||
$agent_data['app']['drbd'] = array();
|
||||
|
Reference in New Issue
Block a user