Application Soft Delete (#15270)

* add the softdeletes migrations for applications

* add working migration file

* add deleted_at to db schema.yaml for applications

* update includes/html/forms/application-update.inc.php to work with softdeletes

* update includes/html/pages/device/edit/apps.inc.php for softdelete

* update includes/discovery/applications.inc.php to work with softdelete

* minor updates to application-update.inc.php for disabling

* style cleanup

* set discovered when running discovery

* update application tests to include deleted_at

* add deleted_at to a missed test

* a few more tweaks for opensips

* add a missing deleted_at for linux_suricata_extract-v1

* fix fillable for Application model

* massive cleanup of the application update widget thingy

* improve the code for discovery and using Laravel

* add a missing line to app/Models/Application

* add a missing include to app/Models/Application.php

* record includes for Application model

* remove apps from the applications table when a device is deleted

* revert to using upcert and where for discovery to fix CI

* make discovered fillable and set it when running discovery... convert back to firstOrNew

* clean up application discovery a bit and use observer

* style fix

* spelling fix... disablaed -> disabled

* rever removal to just use where

* cleanup app removal on delete

* add restored to ModuleModelObserver

* delete -> forcedelete fix

* apply the suggested changes

* use murrants other suggestion

* style fix
This commit is contained in:
Zane C. Bowers-Hadley
2023-09-06 16:34:39 -05:00
committed by GitHub
parent 013096c092
commit 2618a99be5
55 changed files with 269 additions and 134 deletions

View File

@@ -25,13 +25,15 @@
namespace App\Models;
use Illuminate\Database\Eloquent\SoftDeletes;
use LibreNMS\Util\StringHelpers;
class Application extends DeviceRelatedModel
{
use SoftDeletes;
public $timestamps = false;
protected $primaryKey = 'app_id';
protected $fillable = ['data'];
protected $fillable = ['device_id', 'app_type', 'app_instance', 'app_status', 'app_state', 'data', 'deleted_at', 'discovered'];
protected $casts = [
'data' => 'array',
];

View File

@@ -96,7 +96,7 @@ class DeviceObserver
$device->alerts()->delete();
\DB::table('alert_device_map')->where('device_id', $device->device_id)->delete();
$device->alertLogs()->delete();
$device->applications()->delete();
$device->applications()->forceDelete();
$device->attribs()->delete();
$device->availability()->delete();
$device->bgppeers()->delete();

View File

@@ -63,6 +63,15 @@ class ModuleModelObserver
d_echo($model->getDirty());
}
/**
* @param Eloquent $model
*/
public function restored($model)
{
d_echo('Restored data:', 'R');
d_echo($model->getDirty());
}
/**
* @param Eloquent $model
*/

View File

@@ -0,0 +1,32 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddApplicationsSoftDeleted extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('applications', function (Blueprint $table) {
$table->softDeletes();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('applications', function (Blueprint $table) {
$table->dropColumn('deleted_at');
});
}
}

View File

@@ -23,6 +23,8 @@
* @author Tony Murray <murraytony@gmail.com>
*/
use App\Models\Application;
use App\Observers\ModuleModelObserver;
use LibreNMS\Config;
echo "\nApplications: ";
@@ -56,7 +58,7 @@ d_echo('Checking for: ' . implode(', ', array_keys($results)) . PHP_EOL);
// Generate a list of enabled apps and a list of all discovered apps from the db
[$enabled_apps, $discovered_apps] = array_reduce(dbFetchRows(
'SELECT `app_type`,`discovered` FROM `applications` WHERE `device_id`=? ORDER BY `app_type`',
'SELECT `app_type`,`discovered` FROM `applications` WHERE `device_id`=? AND deleted_at IS NULL ORDER BY `app_type`',
[$device['device_id']]
), function ($result, $app) {
$result[0][] = $app['app_type'];
@@ -67,6 +69,9 @@ d_echo('Checking for: ' . implode(', ', array_keys($results)) . PHP_EOL);
return $result;
}, [[], []]);
// enable observer for printing changes
ModuleModelObserver::observe(\App\Models\Application::class);
// Enable applications
$current_apps = [];
foreach ($results as $extend => $result) {
@@ -74,18 +79,13 @@ foreach ($results as $extend => $result) {
$app = $applications[$extend];
$current_apps[] = $app;
if (in_array($app, $enabled_apps)) {
echo '.';
} else {
dbInsert([
'device_id' => $device['device_id'],
'app_type' => $app,
'discovered' => 1,
'app_status' => '',
'app_instance' => '',
], 'applications');
echo '+';
if (! in_array($app, $enabled_apps)) {
$app_obj = Application::withTrashed()->firstOrNew(['device_id' => $device['device_id'], 'app_type' => $app]);
if ($app_obj->trashed()) {
$app_obj->restore();
}
$app_obj->discovered = 1;
$app_obj->save();
log_event("Application enabled by discovery: $app", $device, 'application', 1);
}
}
@@ -93,20 +93,10 @@ foreach ($results as $extend => $result) {
// remove non-existing apps
$apps_to_remove = array_diff($discovered_apps, $current_apps);
$num = count($apps_to_remove);
if ($num > 0) {
echo str_repeat('-', $num);
$vars = $apps_to_remove;
array_unshift($vars, $device['device_id']);
dbDelete(
'applications',
'`device_id`=? AND `app_type` IN ' . dbGenPlaceholders($num),
$vars
);
foreach ($apps_to_remove as $app) {
log_event("Application disabled by discovery: $app", $device, 'application', 3);
}
}
DeviceCache::getPrimary()->applications()->whereIn('app_type', $apps_to_remove)->get()->each(function (Application $app) {
$app->delete();
\App\Models\Eventlog::log("Application disabled by discovery: $app->app_type", DeviceCache::getPrimary(), 'application', \LibreNMS\Enum\Severity::Notice);
});
// clean application_metrics
dbDeleteOrphans('application_metrics', ['applications.app_id']);

View File

@@ -22,6 +22,8 @@
* @copyright 2017 Tony Murray
* @author Tony Murray <murraytony@gmail.com>
*/
use App\Models\Application;
if (! Auth::user()->hasGlobalAdmin()) {
$status = ['status' => 1, 'message' => 'You need to be admin'];
} else {
@@ -32,21 +34,24 @@ if (! Auth::user()->hasGlobalAdmin()) {
$status = ['status' => 1, 'message' => 'Error with data'];
} else {
$status = ['status' => 1, 'message' => 'Database update failed'];
$app = Application::withTrashed()->firstOrNew(['device_id' => $device_id, 'app_type' => $app]);
if ($_POST['state'] == 'true') {
$update = [
'device_id' => $device_id,
'app_type' => $app,
'app_status' => '',
'app_instance' => '',
];
if (dbInsert($update, 'applications')) {
if ($app->trashed()) {
$app->restore();
}
if ($app->save()) {
log_event("Application enabled by user: $app", $device_id, 'application', 1);
$status = ['status' => 0, 'message' => 'Application enabled'];
} else {
$status = ['status' => 1, 'message' => 'Database update for enabling the application failed'];
}
} else {
if (dbDelete('applications', '`device_id`=? AND `app_type`=?', [$device_id, $app])) {
$app->delete();
if ($app->save()) {
log_event("Application disabled by user: $app", $device_id, 'application', 3);
$status = ['status' => 0, 'message' => 'Application disabled'];
} else {
$status = ['status' => 1, 'message' => 'Database update for disabling the application failed'];
}
}
}

View File

@@ -11,7 +11,7 @@ foreach (glob(Config::get('install_dir') . '/includes/polling/applications/*.inc
// Generate a list of enabled apps with a value of whether they are discovered or not
$enabled_apps = array_reduce(dbFetchRows(
'SELECT `app_type`,`discovered` FROM `applications` WHERE `device_id`=? ORDER BY `app_type`',
'SELECT `app_type`,`discovered` FROM `applications` WHERE `device_id`=? AND deleted_at IS NULL ORDER BY `app_type`',
[$device['device_id']]
), function ($result, $app) {
$result[$app['app_type']] = $app['discovered'];

View File

@@ -187,6 +187,7 @@ applications:
- { Field: timestamp, Type: timestamp, 'Null': false, Extra: 'on update CURRENT_TIMESTAMP', Default: CURRENT_TIMESTAMP }
- { Field: app_instance, Type: varchar(255), 'Null': false, Extra: '', Default: '' }
- { Field: data, Type: longtext, 'Null': true, Extra: '' }
- { Field: deleted_at, Type: timestamp, 'Null': true, Extra: '' }
Indexes:
PRIMARY: { Name: PRIMARY, Columns: [app_id], Unique: true, Type: BTREE }
applications_device_id_app_type_unique: { Name: applications_device_id_app_type_unique, Columns: [device_id, app_type], Unique: true, Type: BTREE }

View File

@@ -1674,7 +1674,8 @@
"app_state_prev": null,
"app_status": "",
"app_instance": "",
"data": null
"data": null,
"deleted_at": null
}
]
},
@@ -1687,7 +1688,8 @@
"app_state_prev": "UNKNOWN",
"app_status": "18",
"app_instance": "",
"data": null
"data": null,
"deleted_at": null
}
],
"application_metrics": [

View File

@@ -9,7 +9,8 @@
"app_state_prev": null,
"app_status": "",
"app_instance": "",
"data": null
"data": null,
"deleted_at": null
}
]
},
@@ -22,7 +23,8 @@
"app_state_prev": "UNKNOWN",
"app_status": "",
"app_instance": "",
"data": null
"data": null,
"deleted_at": null
}
],
"application_metrics": [

View File

@@ -9,7 +9,8 @@
"app_state_prev": null,
"app_status": "",
"app_instance": "",
"data": null
"data": null,
"deleted_at": null
}
]
},
@@ -22,7 +23,8 @@
"app_state_prev": "UNKNOWN",
"app_status": "",
"app_instance": "",
"data": null
"data": null,
"deleted_at": null
}
],
"application_metrics": [

View File

@@ -30,7 +30,8 @@
"app_state_prev": null,
"app_status": "",
"app_instance": "",
"data": null
"data": null,
"deleted_at": null
}
]
},
@@ -43,7 +44,8 @@
"app_state_prev": "UNKNOWN",
"app_status": "",
"app_instance": "",
"data": null
"data": null,
"deleted_at": null
}
],
"application_metrics": [

View File

@@ -9,7 +9,8 @@
"app_state_prev": null,
"app_status": "",
"app_instance": "",
"data": null
"data": null,
"deleted_at": null
}
]
},
@@ -22,7 +23,8 @@
"app_state_prev": "UNKNOWN",
"app_status": "",
"app_instance": "",
"data": "{\"sources\":[\"PPS\",\"GPS\"]}"
"data": "{\"sources\":[\"PPS\",\"GPS\"]}",
"deleted_at": null
}
],
"application_metrics": [

View File

@@ -9,7 +9,8 @@
"app_state_prev": null,
"app_status": "",
"app_instance": "",
"data": null
"data": null,
"deleted_at": null
}
]
},
@@ -22,7 +23,8 @@
"app_state_prev": "UNKNOWN",
"app_status": "LEGACY",
"app_instance": "",
"data": "{\"containers\":[\"foobar_laravel.test_1\",\"foobar_dashboard_1\",\"foobar_meilisearch_1\",\"foobar_mysql_1\",\"foobar_redis_1\"]}"
"data": "{\"containers\":[\"foobar_laravel.test_1\",\"foobar_dashboard_1\",\"foobar_meilisearch_1\",\"foobar_mysql_1\",\"foobar_redis_1\"]}",
"deleted_at": null
}
],
"application_metrics": [

View File

@@ -9,7 +9,8 @@
"app_state_prev": null,
"app_status": "",
"app_instance": "",
"data": null
"data": null,
"deleted_at": null
}
]
},
@@ -22,7 +23,8 @@
"app_state_prev": "UNKNOWN",
"app_status": "",
"app_instance": "",
"data": "{\"containers\":[\"foobar_laravel.test_1\",\"foobar_dashboard_1\",\"foobar_meilisearch_1\",\"foobar_mysql_1\",\"foobar_redis_1\"]}"
"data": "{\"containers\":[\"foobar_laravel.test_1\",\"foobar_dashboard_1\",\"foobar_meilisearch_1\",\"foobar_mysql_1\",\"foobar_redis_1\"]}",
"deleted_at": null
}
],
"application_metrics": [

View File

@@ -9,7 +9,8 @@
"app_state_prev": null,
"app_status": "",
"app_instance": "",
"data": null
"data": null,
"deleted_at": null
}
]
},
@@ -22,7 +23,8 @@
"app_state_prev": "UNKNOWN",
"app_status": "",
"app_instance": "",
"data": "{\"jails\":[\"dovecot\",\"sshd\"]}"
"data": "{\"jails\":[\"dovecot\",\"sshd\"]}",
"deleted_at": null
}
],
"application_metrics": [

View File

@@ -9,7 +9,8 @@
"app_state_prev": null,
"app_status": "",
"app_instance": "",
"data": null
"data": null,
"deleted_at": null
}
]
},
@@ -22,7 +23,8 @@
"app_state_prev": "UNKNOWN",
"app_status": "",
"app_instance": "",
"data": "{\"jails\":[\"sshd\",\"dovecot\"]}"
"data": "{\"jails\":[\"sshd\",\"dovecot\"]}",
"deleted_at": null
}
],
"application_metrics": [

View File

@@ -9,7 +9,8 @@
"app_state_prev": null,
"app_status": "",
"app_instance": "",
"data": null
"data": null,
"deleted_at": null
}
]
},
@@ -22,7 +23,8 @@
"app_state_prev": "UNKNOWN",
"app_status": "",
"app_instance": "",
"data": null
"data": null,
"deleted_at": null
}
],
"application_metrics": [

View File

@@ -9,7 +9,8 @@
"app_state_prev": null,
"app_status": "",
"app_instance": "",
"data": null
"data": null,
"deleted_at": null
}
]
},
@@ -22,7 +23,8 @@
"app_state_prev": "UNKNOWN",
"app_status": "",
"app_instance": "",
"data": null
"data": null,
"deleted_at": null
}
],
"application_metrics": [

View File

@@ -9,7 +9,8 @@
"app_state_prev": null,
"app_status": "",
"app_instance": "",
"data": null
"data": null,
"deleted_at": null
}
]
},
@@ -22,7 +23,8 @@
"app_state_prev": "UNKNOWN",
"app_status": "",
"app_instance": "",
"data": null
"data": null,
"deleted_at": null
}
],
"application_metrics": [

View File

@@ -9,7 +9,8 @@
"app_state_prev": null,
"app_status": "",
"app_instance": "",
"data": null
"data": null,
"deleted_at": null
}
]
},
@@ -22,7 +23,8 @@
"app_state_prev": "UNKNOWN",
"app_status": "",
"app_instance": "",
"data": null
"data": null,
"deleted_at": null
}
],
"application_metrics": [

View File

@@ -9,7 +9,8 @@
"app_state_prev": null,
"app_status": "",
"app_instance": "",
"data": null
"data": null,
"deleted_at": null
}
]
},
@@ -22,7 +23,8 @@
"app_state_prev": "UNKNOWN",
"app_status": "",
"app_instance": "",
"data": null
"data": null,
"deleted_at": null
}
],
"application_metrics": [

View File

@@ -9,7 +9,8 @@
"app_state_prev": null,
"app_status": "",
"app_instance": "",
"data": null
"data": null,
"deleted_at": null
}
]
},
@@ -22,7 +23,8 @@
"app_state_prev": "UNKNOWN",
"app_status": "",
"app_instance": "",
"data": "{\"hv\":\"libvirt\",\"VMs\":[\"cuckoo70\",\"cuckoo71\",\"cuckoo72\",\"win10\",\"win10-base\"],\"VMdisks\":{\"cuckoo70\":[\"sda\",\"sdb\"],\"cuckoo71\":[\"sda\",\"sdb\"],\"cuckoo72\":[\"sda\",\"sdb\"],\"win10\":[\"sda\",\"sdb\"],\"win10-base\":[\"sda\",\"sdb\"]},\"VMdifs\":[],\"VMdstatus\":[],\"VMifs\":{\"cuckoo70\":[],\"cuckoo71\":[],\"cuckoo72\":[],\"win10\":[],\"win10-base\":[]}}"
"data": "{\"hv\":\"libvirt\",\"VMs\":[\"cuckoo70\",\"cuckoo71\",\"cuckoo72\",\"win10\",\"win10-base\"],\"VMdisks\":{\"cuckoo70\":[\"sda\",\"sdb\"],\"cuckoo71\":[\"sda\",\"sdb\"],\"cuckoo72\":[\"sda\",\"sdb\"],\"win10\":[\"sda\",\"sdb\"],\"win10-base\":[\"sda\",\"sdb\"]},\"VMdifs\":[],\"VMdstatus\":[],\"VMifs\":{\"cuckoo70\":[],\"cuckoo71\":[],\"cuckoo72\":[],\"win10\":[],\"win10-base\":[]}}",
"deleted_at": null
}
],
"application_metrics": [

View File

@@ -879,7 +879,8 @@
"app_state_prev": null,
"app_status": "",
"app_instance": "",
"data": null
"data": null,
"deleted_at": null
}
]
},
@@ -892,7 +893,8 @@
"app_state_prev": "UNKNOWN",
"app_status": "",
"app_instance": "",
"data": null
"data": null,
"deleted_at": null
}
],
"application_metrics": [

View File

@@ -30,7 +30,8 @@
"app_state_prev": null,
"app_status": "",
"app_instance": "",
"data": null
"data": null,
"deleted_at": null
}
]
},
@@ -43,7 +44,8 @@
"app_state_prev": "UNKNOWN",
"app_status": "",
"app_instance": "",
"data": null
"data": null,
"deleted_at": null
}
],
"application_metrics": [

View File

@@ -9,7 +9,8 @@
"app_state_prev": null,
"app_status": "",
"app_instance": "",
"data": null
"data": null,
"deleted_at": null
}
]
},
@@ -22,7 +23,8 @@
"app_state_prev": "UNKNOWN",
"app_status": "",
"app_instance": "",
"data": "{\"budget\":\"300\",\"budget_usecs\":\"8000\"}"
"data": "{\"budget\":\"300\",\"budget_usecs\":\"8000\"}",
"deleted_at": null
}
},
"application_metrics": [

View File

@@ -9,7 +9,8 @@
"app_state_prev": null,
"app_status": "",
"app_instance": "",
"data": null
"data": null,
"deleted_at": null
}
]
},
@@ -22,7 +23,8 @@
"app_state_prev": "UNKNOWN",
"app_status": "",
"app_instance": "",
"data": "{\"sets\":{\"var_log\":{\"files\":[\"daemon\",\"mount\",\"devd\",\"utx\",\"setuid\",\"maillog\",\"Xorg.0\",\"xferlog\",\"mail\",\"snmpd\",\"bsdisks\",\"userlog\",\"ppp\",\"cron\",\"messages\",\"xdm\",\"dmesg\",\"security\",\"debug\",\"auth\"],\"max_size\":212661,\"mean_size\":32019.9,\"median_size\":2273.5,\"mode_size\":\"62\",\"min_size\":0,\"size\":640398,\"log_sizes\":{\"mail\":212661,\"maillog\":164271,\"Xorg.0\":64927,\"setuid\":48325,\"daemon\":46208,\"bsdisks\":38084,\"dmesg\":30308,\"cron\":25531,\"snmpd\":3796,\"userlog\":3488,\"xdm\":1059,\"auth\":724,\"mount\":371,\"messages\":331,\"xferlog\":64,\"ppp\":64,\"devd\":62,\"security\":62,\"debug\":62,\"utx\":0}}},\"no_minus_d\":null}"
"data": "{\"sets\":{\"var_log\":{\"files\":[\"daemon\",\"mount\",\"devd\",\"utx\",\"setuid\",\"maillog\",\"Xorg.0\",\"xferlog\",\"mail\",\"snmpd\",\"bsdisks\",\"userlog\",\"ppp\",\"cron\",\"messages\",\"xdm\",\"dmesg\",\"security\",\"debug\",\"auth\"],\"max_size\":212661,\"mean_size\":32019.9,\"median_size\":2273.5,\"mode_size\":\"62\",\"min_size\":0,\"size\":640398,\"log_sizes\":{\"mail\":212661,\"maillog\":164271,\"Xorg.0\":64927,\"setuid\":48325,\"daemon\":46208,\"bsdisks\":38084,\"dmesg\":30308,\"cron\":25531,\"snmpd\":3796,\"userlog\":3488,\"xdm\":1059,\"auth\":724,\"mount\":371,\"messages\":331,\"xferlog\":64,\"ppp\":64,\"devd\":62,\"security\":62,\"debug\":62,\"utx\":0}}},\"no_minus_d\":null}",
"deleted_at": null
}
],
"application_metrics": [

View File

@@ -11098,7 +11098,8 @@
"app_state_prev": null,
"app_status": "",
"app_instance": "",
"data": null
"data": null,
"deleted_at": null
}
]
},
@@ -11111,7 +11112,8 @@
"app_state_prev": "UNKNOWN",
"app_status": "",
"app_instance": "",
"data": null
"data": null,
"deleted_at": null
}
]
}

View File

@@ -9,7 +9,8 @@
"app_state_prev": null,
"app_status": "",
"app_instance": "",
"data": null
"data": null,
"deleted_at": null
}
]
},
@@ -22,7 +23,8 @@
"app_state_prev": "UNKNOWN",
"app_status": "",
"app_instance": "",
"data": null
"data": null,
"deleted_at": null
}
],
"application_metrics": [

View File

@@ -9,7 +9,8 @@
"app_state_prev": null,
"app_status": "",
"app_instance": "",
"data": null
"data": null,
"deleted_at": null
}
]
},
@@ -22,7 +23,8 @@
"app_state_prev": "UNKNOWN",
"app_status": "",
"app_instance": "",
"data": "{\"slugs\":[]}"
"data": "{\"slugs\":[]}",
"deleted_at": null
}
],
"application_metrics": [

View File

@@ -9,7 +9,8 @@
"app_state_prev": null,
"app_status": "",
"app_instance": "",
"data": null
"data": null,
"deleted_at": null
}
]
},
@@ -22,7 +23,8 @@
"app_state_prev": "UNKNOWN",
"app_status": "",
"app_instance": "",
"data": null
"data": null,
"deleted_at": null
}
],
"application_metrics": [

View File

@@ -9,7 +9,8 @@
"app_state_prev": null,
"app_status": "",
"app_instance": "",
"data": null
"data": null,
"deleted_at": null
}
]
},
@@ -22,7 +23,8 @@
"app_state_prev": "UNKNOWN",
"app_status": "",
"app_instance": "",
"data": null
"data": null,
"deleted_at": null
}
],
"application_metrics": [

View File

@@ -9,7 +9,8 @@
"app_state_prev": null,
"app_status": "",
"app_instance": "",
"data": null
"data": null,
"deleted_at": null
}
]
},
@@ -22,7 +23,8 @@
"app_state_prev": "UNKNOWN",
"app_status": "",
"app_instance": "",
"data": "{\"cluster\":\"vulpes\"}"
"data": "{\"cluster\":\"vulpes\"}",
"deleted_at": null
}
],
"application_metrics": [

View File

@@ -705,7 +705,8 @@
"app_state_prev": null,
"app_status": "",
"app_instance": "",
"data": null
"data": null,
"deleted_at": null
},
{
"app_type": "opensips",
@@ -714,7 +715,8 @@
"app_state_prev": null,
"app_status": "",
"app_instance": "",
"data": null
"data": null,
"deleted_at": null
}
]
},
@@ -727,7 +729,8 @@
"app_state_prev": "UNKNOWN",
"app_status": "",
"app_instance": "",
"data": null
"data": null,
"deleted_at": null
},
{
"app_type": "opensips",
@@ -736,7 +739,8 @@
"app_state_prev": "UNKNOWN",
"app_status": "",
"app_instance": "",
"data": null
"data": null,
"deleted_at": null
}
],
"application_metrics": [

View File

@@ -9,7 +9,8 @@
"app_state_prev": null,
"app_status": "",
"app_instance": "",
"data": null
"data": null,
"deleted_at": null
}
]
},
@@ -22,7 +23,8 @@
"app_state_prev": "UNKNOWN",
"app_status": "",
"app_instance": "",
"data": "{\"ports\":[\"ssh\"]}"
"data": "{\"ports\":[\"ssh\"]}",
"deleted_at": null
}
],
"application_metrics": [

View File

@@ -9,7 +9,8 @@
"app_state_prev": null,
"app_status": "",
"app_instance": "",
"data": null
"data": null,
"deleted_at": null
}
]
},
@@ -22,7 +23,8 @@
"app_state_prev": "UNKNOWN",
"app_status": "",
"app_instance": "",
"data": null
"data": null,
"deleted_at": null
}
],
"application_metrics": [

View File

@@ -9,7 +9,8 @@
"app_state_prev": null,
"app_status": "",
"app_instance": "",
"data": null
"data": null,
"deleted_at": null
}
]
},
@@ -22,7 +23,8 @@
"app_state_prev": "UNKNOWN",
"app_status": "",
"app_instance": "",
"data": null
"data": null,
"deleted_at": null
}
],
"application_metrics": [

View File

@@ -9,7 +9,8 @@
"app_state_prev": null,
"app_status": "",
"app_instance": "",
"data": null
"data": null,
"deleted_at": null
}
]
},
@@ -22,7 +23,8 @@
"app_state_prev": "UNKNOWN",
"app_status": "",
"app_instance": "",
"data": null
"data": null,
"deleted_at": null
}
],
"application_metrics": [

View File

@@ -9,7 +9,8 @@
"app_state_prev": null,
"app_status": "",
"app_instance": "",
"data": null
"data": null,
"deleted_at": null
}
]
},
@@ -22,7 +23,8 @@
"app_state_prev": "UNKNOWN",
"app_status": "",
"app_instance": "",
"data": null
"data": null,
"deleted_at": null
}
],
"application_metrics": [

View File

@@ -9,7 +9,8 @@
"app_state_prev": null,
"app_status": "",
"app_instance": "",
"data": null
"data": null,
"deleted_at": null
}
]
},
@@ -22,7 +23,8 @@
"app_state_prev": "UNKNOWN",
"app_status": "",
"app_instance": "",
"data": null
"data": null,
"deleted_at": null
}
],
"application_metrics": [

View File

@@ -30,7 +30,8 @@
"app_state_prev": null,
"app_status": "",
"app_instance": "",
"data": null
"data": null,
"deleted_at": null
}
]
},
@@ -43,7 +44,8 @@
"app_state_prev": "UNKNOWN",
"app_status": "",
"app_instance": "",
"data": null
"data": null,
"deleted_at": null
}
],
"application_metrics": [

View File

@@ -9,7 +9,8 @@
"app_state_prev": null,
"app_status": "",
"app_instance": "",
"data": null
"data": null,
"deleted_at": null
}
]
},
@@ -22,7 +23,8 @@
"app_state_prev": "UNKNOWN",
"app_status": "",
"app_instance": "",
"data": "{\"disks\":{\"Z304VCFY\":{\"10\":\"0\",\"173\":\"null\",\"177\":\"null\",\"183\":\"0\",\"184\":\"0\",\"187\":\"0\",\"188\":\"0\",\"190\":\"35\",\"194\":\"35\",\"196\":\"null\",\"197\":\"0\",\"198\":\"0\",\"199\":\"0\",\"231\":\"null\",\"233\":\"null\",\"5\":\"0\",\"9\":null,\"completed\":\"5\",\"interrupted\":\"1\",\"read_failure\":\"0\",\"unknown_failure\":\"0\",\"extended\":\"6\",\"short\":\"0\",\"conveyance\":\"0\",\"selective\":\"selective\",\"is_ssd\":0}},\"legacy\":1,\"disks_with_failed_tests\":[],\"disks_with_failed_health\":[],\"has\":{\"id5\":1,\"id9\":0,\"id10\":1,\"id173\":0,\"id177\":0,\"id183\":1,\"id184\":1,\"id187\":1,\"id188\":1,\"id190\":1,\"id194\":1,\"id196\":0,\"id197\":1,\"id198\":1,\"id199\":1,\"id231\":0,\"id232\":0,\"id233\":0}}"
"data": "{\"disks\":{\"Z304VCFY\":{\"10\":\"0\",\"173\":\"null\",\"177\":\"null\",\"183\":\"0\",\"184\":\"0\",\"187\":\"0\",\"188\":\"0\",\"190\":\"35\",\"194\":\"35\",\"196\":\"null\",\"197\":\"0\",\"198\":\"0\",\"199\":\"0\",\"231\":\"null\",\"233\":\"null\",\"5\":\"0\",\"9\":null,\"completed\":\"5\",\"interrupted\":\"1\",\"read_failure\":\"0\",\"unknown_failure\":\"0\",\"extended\":\"6\",\"short\":\"0\",\"conveyance\":\"0\",\"selective\":\"selective\",\"is_ssd\":0}},\"legacy\":1,\"disks_with_failed_tests\":[],\"disks_with_failed_health\":[],\"has\":{\"id5\":1,\"id9\":0,\"id10\":1,\"id173\":0,\"id177\":0,\"id183\":1,\"id184\":1,\"id187\":1,\"id188\":1,\"id190\":1,\"id194\":1,\"id196\":0,\"id197\":1,\"id198\":1,\"id199\":1,\"id231\":0,\"id232\":0,\"id233\":0}}",
"deleted_at": null
}
],
"application_metrics": [

View File

@@ -9,7 +9,8 @@
"app_state_prev": null,
"app_status": "",
"app_instance": "",
"data": null
"data": null,
"deleted_at": null
}
]
},
@@ -22,7 +23,8 @@
"app_state_prev": "UNKNOWN",
"app_status": "",
"app_instance": "",
"data": "{\"disks\":{\"da0\":{\"10\":\"0\",\"173\":\"null\",\"177\":\"null\",\"183\":\"0\",\"184\":\"0\",\"187\":\"0\",\"188\":0,\"190\":\"34\",\"194\":\"34\",\"196\":\"null\",\"197\":\"0\",\"198\":\"0\",\"199\":\"0\",\"231\":\"null\",\"232\":\"null\",\"233\":\"null\",\"5\":\"0\",\"9\":\"63417\",\"completed\":5,\"conveyance\":\"0\",\"device_model\":\"ST4000DM000-1F2168\",\"disk\":\"da0 -d sat\",\"exit\":0,\"extended\":6,\"fw_version\":\"CC54\",\"health_pass\":1,\"interrupted\":1,\"max_temp\":\"34\",\"model_family\":\"Seagate Desktop HDD.15\",\"offline\":\"0\",\"read_failure\":\"0\",\"selective\":\"0\",\"selftest_log\":\"Num Test_Description Status Remaining LifeTime(hours) LBA_of_first_errorn# 1 Extended offline Completed without error 00% 63322 -n# 2 Extended offline Completed without error 00% 32177 -n# 3 Extended offline Completed without error 00% 9042 -n# 4 Extended offline Completed without error 00% 8432 -n# 5 Extended offline Completed without error 00% 29 -n# 6 Extended offline Interrupted (host reset) 00% 0 -\",\"serial\":\"Z304VCFY\",\"short\":\"0\",\"unknown_failure\":\"0\",\"is_ssd\":0}},\"exit_nonzero\":0,\"unhealthy\":0,\"disks_with_failed_tests\":[],\"disks_with_failed_health\":[],\"has\":{\"id5\":1,\"id9\":1,\"id10\":1,\"id173\":0,\"id177\":0,\"id183\":1,\"id184\":1,\"id187\":1,\"id188\":1,\"id190\":1,\"id194\":1,\"id196\":0,\"id197\":1,\"id198\":1,\"id199\":1,\"id231\":0,\"id232\":0,\"id233\":0}}"
"data": "{\"disks\":{\"da0\":{\"10\":\"0\",\"173\":\"null\",\"177\":\"null\",\"183\":\"0\",\"184\":\"0\",\"187\":\"0\",\"188\":0,\"190\":\"34\",\"194\":\"34\",\"196\":\"null\",\"197\":\"0\",\"198\":\"0\",\"199\":\"0\",\"231\":\"null\",\"232\":\"null\",\"233\":\"null\",\"5\":\"0\",\"9\":\"63417\",\"completed\":5,\"conveyance\":\"0\",\"device_model\":\"ST4000DM000-1F2168\",\"disk\":\"da0 -d sat\",\"exit\":0,\"extended\":6,\"fw_version\":\"CC54\",\"health_pass\":1,\"interrupted\":1,\"max_temp\":\"34\",\"model_family\":\"Seagate Desktop HDD.15\",\"offline\":\"0\",\"read_failure\":\"0\",\"selective\":\"0\",\"selftest_log\":\"Num Test_Description Status Remaining LifeTime(hours) LBA_of_first_errorn# 1 Extended offline Completed without error 00% 63322 -n# 2 Extended offline Completed without error 00% 32177 -n# 3 Extended offline Completed without error 00% 9042 -n# 4 Extended offline Completed without error 00% 8432 -n# 5 Extended offline Completed without error 00% 29 -n# 6 Extended offline Interrupted (host reset) 00% 0 -\",\"serial\":\"Z304VCFY\",\"short\":\"0\",\"unknown_failure\":\"0\",\"is_ssd\":0}},\"exit_nonzero\":0,\"unhealthy\":0,\"disks_with_failed_tests\":[],\"disks_with_failed_health\":[],\"has\":{\"id5\":1,\"id9\":1,\"id10\":1,\"id173\":0,\"id177\":0,\"id183\":1,\"id184\":1,\"id187\":1,\"id188\":1,\"id190\":1,\"id194\":1,\"id196\":0,\"id197\":1,\"id198\":1,\"id199\":1,\"id231\":0,\"id232\":0,\"id233\":0}}",
"deleted_at": null
}
],
"application_metrics": [

View File

@@ -9,7 +9,8 @@
"app_state_prev": null,
"app_status": "",
"app_instance": "",
"data": null
"data": null,
"deleted_at": null
}
]
},
@@ -22,7 +23,8 @@
"app_state_prev": "UNKNOWN",
"app_status": "",
"app_instance": "",
"data": "{\"data\":{\"alert\":0,\"alertString\":\"\",\"checks\":{\"clamav\":{\"check\":\"\\/usr\\/lib\\/nagios\\/plugins\\/check_clamav -w 2 -c 3\",\"exit\":0,\"output\":\"ClamAV OK: daily.cvd 26579 (Tue Jun 21 08:15:30 2022) is up to date\",\"ran\":\"\\/usr\\/lib\\/nagios\\/plugins\\/check_clamav -w 2 -c 3\"},\"entropy\":{\"check\":\"\\/usr\\/lib\\/nagios\\/plugins\\/check_entropy\",\"exit\":0,\"output\":\"OK: 3649 bytes in the pool.|entropy=3649 bytes\",\"ran\":\"\\/usr\\/lib\\/nagios\\/plugins\\/check_entropy\"},\"http\":{\"check\":\"\\/usr\\/lib\\/nagios\\/plugins\\/check_http -H 127.0.0.1:8000\",\"exit\":0,\"output\":\"HTTP OK: HTTP\\/1.1 200 OK - 6249 bytes in 0.057 second response time |time=0.057237s;;;0.000000;10.000000 size=6249B;;;0\",\"ran\":\"\\/usr\\/lib\\/nagios\\/plugins\\/check_http -H 127.0.0.1:8000\"},\"ipmi_sensor\":{\"check\":\"\\/usr\\/lib\\/nagios\\/plugins\\/check_ipmi_sensor --nosel\",\"exit\":0,\"output\":\"IPMI Status: OK | 'CPU Temp'=50.00;0.00:97.00;0.00:102.00 'System Temp'=37.00;0.00:80.00;-5.00:85.00 'Peripheral Temp'=47.00;0.00:80.00;-5.00:85.00 'DIMMB1 Temp'=36.00;5.00:80.00;0.00:85.00 'DIMMB2 Temp'=38.00;5.00:80.00;0.00:85.00 'FAN1'=4100.00;700.00:25300.00;500.00:25400.00 'FAN2'=3400.00;700.00:25300.00;500.00:25400.00 'FAN3'=4300.00;700.00:25300.00;500.00:25400.00 'VCCP'=1.86;1.57:2.02;1.46:2.13 'VDIMM'=1.20;1.05:1.34;0.97:1.43 '12V'=12.13;10.78:12.96;10.27:13.28 '5VCC'=5.03;4.48:5.39;4.30:5.55 '3.3VCC'=3.40;2.96:3.55;2.82:3.66 'VBAT'=3.14;2.59:3.49;2.47:3.57 '5V Dual'=5.00;4.49:5.38;4.30:5.54 '3.3V AUX'=3.32;2.96:3.55;2.82:3.66\",\"ran\":\"\\/usr\\/lib\\/nagios\\/plugins\\/check_ipmi_sensor --nosel\"},\"mongodb\":{\"check\":\"\\/usr\\/lib\\/nagios\\/plugins\\/check_mongodb.py\",\"exit\":0,\"output\":\"OK - Connection took 0.011 seconds\",\"ran\":\"\\/usr\\/lib\\/nagios\\/plugins\\/check_mongodb.py\"},\"raid\":{\"check\":\"\\/usr\\/lib\\/nagios\\/plugins\\/check_raid\",\"exit\":0,\"output\":\"OK: mdstat:[md0(2.73 TiB raid1):UU]\",\"ran\":\"\\/usr\\/lib\\/nagios\\/plugins\\/check_raid\"},\"virtqemud_procs\":{\"check\":\"\\/usr\\/lib\\/nagios\\/plugins\\/check_procs --ereg-argument-array '^\\/usr\\/sbin\\/virtqemud' 1:2\",\"exit\":0,\"output\":\"PROCS OK: 1 process with regex args '^\\/usr\\/sbin\\/virtqemud' | procs=1;1:2;;0;\",\"ran\":\"\\/usr\\/lib\\/nagios\\/plugins\\/check_procs --ereg-argument-array '^\\/usr\\/sbin\\/virtqemud' 1:2\"}},\"critical\":0,\"errored\":0,\"hostname\":\"nagi\",\"ok\":7,\"time\":1655835901,\"unknown\":0,\"vars\":[],\"warning\":0},\"error\":0,\"errorString\":\"\",\"version\":1}"
"data": "{\"data\":{\"alert\":0,\"alertString\":\"\",\"checks\":{\"clamav\":{\"check\":\"\\/usr\\/lib\\/nagios\\/plugins\\/check_clamav -w 2 -c 3\",\"exit\":0,\"output\":\"ClamAV OK: daily.cvd 26579 (Tue Jun 21 08:15:30 2022) is up to date\",\"ran\":\"\\/usr\\/lib\\/nagios\\/plugins\\/check_clamav -w 2 -c 3\"},\"entropy\":{\"check\":\"\\/usr\\/lib\\/nagios\\/plugins\\/check_entropy\",\"exit\":0,\"output\":\"OK: 3649 bytes in the pool.|entropy=3649 bytes\",\"ran\":\"\\/usr\\/lib\\/nagios\\/plugins\\/check_entropy\"},\"http\":{\"check\":\"\\/usr\\/lib\\/nagios\\/plugins\\/check_http -H 127.0.0.1:8000\",\"exit\":0,\"output\":\"HTTP OK: HTTP\\/1.1 200 OK - 6249 bytes in 0.057 second response time |time=0.057237s;;;0.000000;10.000000 size=6249B;;;0\",\"ran\":\"\\/usr\\/lib\\/nagios\\/plugins\\/check_http -H 127.0.0.1:8000\"},\"ipmi_sensor\":{\"check\":\"\\/usr\\/lib\\/nagios\\/plugins\\/check_ipmi_sensor --nosel\",\"exit\":0,\"output\":\"IPMI Status: OK | 'CPU Temp'=50.00;0.00:97.00;0.00:102.00 'System Temp'=37.00;0.00:80.00;-5.00:85.00 'Peripheral Temp'=47.00;0.00:80.00;-5.00:85.00 'DIMMB1 Temp'=36.00;5.00:80.00;0.00:85.00 'DIMMB2 Temp'=38.00;5.00:80.00;0.00:85.00 'FAN1'=4100.00;700.00:25300.00;500.00:25400.00 'FAN2'=3400.00;700.00:25300.00;500.00:25400.00 'FAN3'=4300.00;700.00:25300.00;500.00:25400.00 'VCCP'=1.86;1.57:2.02;1.46:2.13 'VDIMM'=1.20;1.05:1.34;0.97:1.43 '12V'=12.13;10.78:12.96;10.27:13.28 '5VCC'=5.03;4.48:5.39;4.30:5.55 '3.3VCC'=3.40;2.96:3.55;2.82:3.66 'VBAT'=3.14;2.59:3.49;2.47:3.57 '5V Dual'=5.00;4.49:5.38;4.30:5.54 '3.3V AUX'=3.32;2.96:3.55;2.82:3.66\",\"ran\":\"\\/usr\\/lib\\/nagios\\/plugins\\/check_ipmi_sensor --nosel\"},\"mongodb\":{\"check\":\"\\/usr\\/lib\\/nagios\\/plugins\\/check_mongodb.py\",\"exit\":0,\"output\":\"OK - Connection took 0.011 seconds\",\"ran\":\"\\/usr\\/lib\\/nagios\\/plugins\\/check_mongodb.py\"},\"raid\":{\"check\":\"\\/usr\\/lib\\/nagios\\/plugins\\/check_raid\",\"exit\":0,\"output\":\"OK: mdstat:[md0(2.73 TiB raid1):UU]\",\"ran\":\"\\/usr\\/lib\\/nagios\\/plugins\\/check_raid\"},\"virtqemud_procs\":{\"check\":\"\\/usr\\/lib\\/nagios\\/plugins\\/check_procs --ereg-argument-array '^\\/usr\\/sbin\\/virtqemud' 1:2\",\"exit\":0,\"output\":\"PROCS OK: 1 process with regex args '^\\/usr\\/sbin\\/virtqemud' | procs=1;1:2;;0;\",\"ran\":\"\\/usr\\/lib\\/nagios\\/plugins\\/check_procs --ereg-argument-array '^\\/usr\\/sbin\\/virtqemud' 1:2\"}},\"critical\":0,\"errored\":0,\"hostname\":\"nagi\",\"ok\":7,\"time\":1655835901,\"unknown\":0,\"vars\":[],\"warning\":0},\"error\":0,\"errorString\":\"\",\"version\":1}",
"deleted_at": null
}
],
"application_metrics": [

View File

@@ -9,7 +9,8 @@
"app_state_prev": null,
"app_status": "",
"app_instance": "",
"data": null
"data": null,
"deleted_at": null
}
]
},
@@ -22,7 +23,8 @@
"app_state_prev": "UNKNOWN",
"app_status": "",
"app_instance": "",
"data": null
"data": null,
"deleted_at": null
}
],
"application_metrics": [

View File

@@ -9,7 +9,8 @@
"app_state_prev": null,
"app_status": "",
"app_instance": "",
"data": null
"data": null,
"deleted_at": null
}
]
},
@@ -22,7 +23,8 @@
"app_state_prev": "UNKNOWN",
"app_status": "",
"app_instance": "",
"data": "{\"instances\":[\"ids\"]}"
"data": "{\"instances\":[\"ids\"]}",
"deleted_at": null
}
],
"application_metrics": [

View File

@@ -9,7 +9,8 @@
"app_state_prev": null,
"app_status": "",
"app_instance": "",
"data": null
"data": null,
"deleted_at": null
}
]
},
@@ -22,7 +23,8 @@
"app_state_prev": "UNKNOWN",
"app_status": "",
"app_instance": "",
"data": null
"data": null,
"deleted_at": null
}
],
"application_metrics": [

View File

@@ -30,7 +30,8 @@
"app_state_prev": null,
"app_status": "",
"app_instance": "",
"data": null
"data": null,
"deleted_at": null
}
]
},
@@ -43,7 +44,8 @@
"app_state_prev": "UNKNOWN",
"app_status": "",
"app_instance": "",
"data": null
"data": null,
"deleted_at": null
}
],
"application_metrics": [

View File

@@ -9,7 +9,8 @@
"app_state_prev": null,
"app_status": "",
"app_instance": "",
"data": null
"data": null,
"deleted_at": null
}
]
},
@@ -22,7 +23,8 @@
"app_state_prev": "UNKNOWN",
"app_status": "",
"app_instance": "",
"data": null
"data": null,
"deleted_at": null
}
],
"application_metrics": [

View File

@@ -9,7 +9,8 @@
"app_state_prev": null,
"app_status": "",
"app_instance": "",
"data": null
"data": null,
"deleted_at": null
}
]
},
@@ -22,7 +23,8 @@
"app_state_prev": "UNKNOWN",
"app_status": "",
"app_instance": "",
"data": null
"data": null,
"deleted_at": null
}
],
"application_metrics": [

View File

@@ -30,7 +30,8 @@
"app_state_prev": null,
"app_status": "",
"app_instance": "",
"data": null
"data": null,
"deleted_at": null
}
]
},
@@ -43,7 +44,8 @@
"app_state_prev": "UNKNOWN",
"app_status": "",
"app_instance": "",
"data": "{\"mappings\":{\"wg0\":[\"client1.domain.com\",\"client2\",\"my_phone\",\"it_admin.domain.org\",\"computer\"]}}"
"data": "{\"mappings\":{\"wg0\":[\"client1.domain.com\",\"client2\",\"my_phone\",\"it_admin.domain.org\",\"computer\"]}}",
"deleted_at": null
}
],
"application_metrics": [

View File

@@ -9,7 +9,8 @@
"app_state_prev": null,
"app_status": "",
"app_instance": "",
"data": null
"data": null,
"deleted_at": null
}
]
},
@@ -22,7 +23,8 @@
"app_state_prev": "UNKNOWN",
"app_status": "",
"app_instance": "",
"data": "{\"pools\":[\"arc\"],\"health\":1,\"l2_errors\":null}"
"data": "{\"pools\":[\"arc\"],\"health\":1,\"l2_errors\":null}",
"deleted_at": null
}
],
"application_metrics": [

View File

@@ -9,7 +9,8 @@
"app_state_prev": null,
"app_status": "",
"app_instance": "",
"data": null
"data": null,
"deleted_at": null
}
]
},
@@ -22,7 +23,8 @@
"app_state_prev": "UNKNOWN",
"app_status": "",
"app_instance": "",
"data": "{\"pools\":[\"arc\"],\"health\":1,\"l2_errors\":null}"
"data": "{\"pools\":[\"arc\"],\"health\":1,\"l2_errors\":null}",
"deleted_at": null
}
],
"application_metrics": [

View File

@@ -9,7 +9,8 @@
"app_state_prev": null,
"app_status": "",
"app_instance": "",
"data": null
"data": null,
"deleted_at": null
}
]
},
@@ -22,7 +23,8 @@
"app_state_prev": "UNKNOWN",
"app_status": "",
"app_instance": "",
"data": "{\"pools\":[\"arc\"],\"health\":1,\"l2_errors\":null}"
"data": "{\"pools\":[\"arc\"],\"health\":1,\"l2_errors\":null}",
"deleted_at": null
}
],
"application_metrics": [

View File

@@ -9,7 +9,8 @@
"app_state_prev": null,
"app_status": "",
"app_instance": "",
"data": null
"data": null,
"deleted_at": null
}
]
},
@@ -22,7 +23,8 @@
"app_state_prev": "UNKNOWN",
"app_status": "",
"app_instance": "",
"data": "{\"pools\":[\"arc\"],\"health\":1,\"l2_errors\":0}"
"data": "{\"pools\":[\"arc\"],\"health\":1,\"l2_errors\":0}",
"deleted_at": null
}
],
"application_metrics": [