Autopsy
4.12.0
Graphical digital forensics platform for The Sleuth Kit and other tools.
|
Inherits PropertyChangeListener.
Classes | |
class | DatabaseTimingResult |
class | PeriodicHealthMonitorTask |
class | TimingInfo |
class | UserData |
enum | UserEvent |
Public Member Functions | |
void | propertyChange (PropertyChangeEvent evt) |
Static Public Member Functions | |
static TimingMetric | getTimingMetric (String name) |
static void | submitNormalizedTimingMetric (TimingMetric metric, long normalization) |
static void | submitTimingMetric (TimingMetric metric) |
Private Member Functions | |
HealthMonitor () throws HealthMonitorException | |
synchronized void | activateMonitorLocally () throws HealthMonitorException |
void | addTimingMetric (TimingMetric metric) throws HealthMonitorException |
void | addUserEvent (UserEvent eventType) |
Connection | connect () throws HealthMonitorException |
void | createDatabase () throws HealthMonitorException |
boolean | databaseExists () throws HealthMonitorException |
boolean | databaseIsInitialized () throws HealthMonitorException |
synchronized void | deactivateMonitorLocally () throws HealthMonitorException |
void | gatherTimerBasedMetrics () throws HealthMonitorException |
CoordinationService.Lock | getExclusiveDbLock () throws HealthMonitorException |
boolean | getGlobalEnabledStatusFromDB () throws HealthMonitorException |
CoordinationService.Lock | getSharedDbLock () throws HealthMonitorException |
CaseDbSchemaVersionNumber | getVersion () throws HealthMonitorException |
void | initializeDatabaseSchema () throws HealthMonitorException |
void | performDatabaseQuery () throws HealthMonitorException |
void | setGlobalEnabledStatusInDB (boolean status) throws HealthMonitorException |
void | setupConnectionPool () throws HealthMonitorException |
void | shutdownConnections () throws HealthMonitorException |
synchronized void | startTimer () |
synchronized void | stopTimer () |
void | upgradeDatabaseSchema () throws HealthMonitorException |
void | writeCurrentStateToDatabase () throws HealthMonitorException |
Static Private Member Functions | |
static void | recordMetrics () |
Private Attributes | |
BasicDataSource | connectionPool = null |
CaseDbConnectionInfo | connectionSettingsInUse = null |
ScheduledThreadPoolExecutor | healthMonitorOutputTimer |
String | hostName |
final Map< String, TimingInfo > | timingInfoMap |
final List< UserData > | userInfoList |
Static Private Attributes | |
static final int | CONN_POOL_SIZE = 10 |
static final CaseDbSchemaVersionNumber | CURRENT_DB_SCHEMA_VERSION = new CaseDbSchemaVersionNumber(1, 1) |
static final String | DATABASE_NAME = "HealthMonitor" |
static final long | DATABASE_WRITE_INTERVAL = 60 |
static HealthMonitor | instance |
static final AtomicBoolean | isEnabled = new AtomicBoolean(false) |
static final Logger | logger = Logger.getLogger(HealthMonitor.class.getName()) |
Class for recording data on the health of the system.
For timing data: Modules will call getTimingMetric() before the code to be timed to get a TimingMetric object Modules will call submitTimingMetric() with the obtained TimingMetric object to log it
Definition at line 63 of file HealthMonitor.java.
|
private |
Definition at line 81 of file HealthMonitor.java.
References org.sleuthkit.autopsy.healthmonitor.HealthMonitor.startTimer().
|
private |
Activate the health monitor. Creates/initialized the database (if needed), clears any existing metrics out of the maps, and sets up the timer for writing to the database.
HealthMonitorException |
Definition at line 129 of file HealthMonitor.java.
References org.sleuthkit.autopsy.healthmonitor.HealthMonitor.createDatabase(), org.sleuthkit.autopsy.healthmonitor.HealthMonitor.databaseExists(), org.sleuthkit.autopsy.healthmonitor.HealthMonitor.databaseIsInitialized(), org.sleuthkit.autopsy.healthmonitor.HealthMonitor.getExclusiveDbLock(), org.sleuthkit.autopsy.core.UserPreferences.getIsMultiUserModeEnabled(), org.sleuthkit.autopsy.healthmonitor.HealthMonitor.getVersion(), org.sleuthkit.autopsy.healthmonitor.HealthMonitor.initializeDatabaseSchema(), org.sleuthkit.autopsy.healthmonitor.HealthMonitor.shutdownConnections(), and org.sleuthkit.autopsy.healthmonitor.HealthMonitor.upgradeDatabaseSchema().
|
private |
Add the timing metric data to the map.
metric | The metric to add. stopTiming() should already have been called. |
Definition at line 380 of file HealthMonitor.java.
Referenced by org.sleuthkit.autopsy.healthmonitor.HealthMonitor.submitNormalizedTimingMetric(), and org.sleuthkit.autopsy.healthmonitor.HealthMonitor.submitTimingMetric().
|
private |
Add a user event to the list.
eventType |
Definition at line 404 of file HealthMonitor.java.
Referenced by org.sleuthkit.autopsy.healthmonitor.HealthMonitor.propertyChange().
|
private |
Get a database connection. Sets up the connection pool if needed.
HealthMonitorException |
Definition at line 655 of file HealthMonitor.java.
References org.sleuthkit.autopsy.healthmonitor.HealthMonitor.setupConnectionPool().
Referenced by org.sleuthkit.autopsy.healthmonitor.HealthMonitor.databaseIsInitialized(), org.sleuthkit.autopsy.healthmonitor.HealthMonitor.getGlobalEnabledStatusFromDB(), org.sleuthkit.autopsy.healthmonitor.HealthMonitor.getVersion(), org.sleuthkit.autopsy.healthmonitor.HealthMonitor.initializeDatabaseSchema(), org.sleuthkit.autopsy.healthmonitor.HealthMonitor.setGlobalEnabledStatusInDB(), org.sleuthkit.autopsy.healthmonitor.HealthMonitor.upgradeDatabaseSchema(), and org.sleuthkit.autopsy.healthmonitor.HealthMonitor.writeCurrentStateToDatabase().
|
private |
Create a new health monitor database.
HealthMonitorException |
Definition at line 580 of file HealthMonitor.java.
References org.sleuthkit.autopsy.core.UserPreferences.getDatabaseConnectionInfo().
Referenced by org.sleuthkit.autopsy.healthmonitor.HealthMonitor.activateMonitorLocally().
|
private |
Check whether the health monitor database exists. Does not check the schema.
HealthMonitorException |
Definition at line 551 of file HealthMonitor.java.
References org.sleuthkit.autopsy.core.UserPreferences.getDatabaseConnectionInfo().
Referenced by org.sleuthkit.autopsy.healthmonitor.HealthMonitor.activateMonitorLocally().
|
private |
Test whether the database schema has been initialized. We do this by looking for the version number.
HealthMonitorException |
Definition at line 677 of file HealthMonitor.java.
References org.sleuthkit.autopsy.healthmonitor.HealthMonitor.connect().
Referenced by org.sleuthkit.autopsy.healthmonitor.HealthMonitor.activateMonitorLocally().
|
private |
Deactivate the health monitor. This should only be used when disabling the monitor, not when Autopsy is closing. Clears out any metrics that haven't been written, stops the database write timer, and shuts down the connection pool.
HealthMonitorException |
Definition at line 231 of file HealthMonitor.java.
References org.sleuthkit.autopsy.healthmonitor.HealthMonitor.shutdownConnections().
|
private |
Collect metrics at a scheduled time.
HealthMonitorException |
Definition at line 452 of file HealthMonitor.java.
References org.sleuthkit.autopsy.healthmonitor.HealthMonitor.performDatabaseQuery().
Referenced by org.sleuthkit.autopsy.healthmonitor.HealthMonitor.recordMetrics().
|
private |
Get an exclusive lock for the health monitor database. Acquire this before creating, initializing, or updating the database schema.
HealthMonitorException |
Definition at line 1239 of file HealthMonitor.java.
References org.sleuthkit.autopsy.coordinationservice.CoordinationService.getInstance(), org.sleuthkit.autopsy.coordinationservice.CoordinationService.CategoryNode.HEALTH_MONITOR, and org.sleuthkit.autopsy.coordinationservice.CoordinationService.tryGetExclusiveLock().
Referenced by org.sleuthkit.autopsy.healthmonitor.HealthMonitor.activateMonitorLocally().
|
private |
Read the enabled status from the database. Check that the health monitor database exists before calling this.
HealthMonitorException |
Definition at line 783 of file HealthMonitor.java.
References org.sleuthkit.autopsy.healthmonitor.HealthMonitor.connect().
|
private |
Get an shared lock for the health monitor database. Acquire this before database reads or writes.
HealthMonitorException |
Definition at line 1260 of file HealthMonitor.java.
References org.sleuthkit.autopsy.healthmonitor.HealthMonitor.DATABASE_NAME, org.sleuthkit.autopsy.coordinationservice.CoordinationService.getInstance(), org.sleuthkit.autopsy.coordinationservice.CoordinationService.CategoryNode.HEALTH_MONITOR, and org.sleuthkit.autopsy.coordinationservice.CoordinationService.tryGetSharedLock().
Referenced by org.sleuthkit.autopsy.healthmonitor.HealthMonitor.writeCurrentStateToDatabase().
|
static |
Get a metric that will measure the time to execute a section of code. Call this before the section of code to be timed and then submit it afterward using submitTimingMetric(). This method is safe to call regardless of whether the health monitor is enabled.
name | A short but descriptive name describing the code being timed. This name will appear in the UI. |
Definition at line 324 of file HealthMonitor.java.
Referenced by org.sleuthkit.autopsy.keywordsearch.Server.openCore(), org.sleuthkit.autopsy.healthmonitor.HealthMonitor.performDatabaseQuery(), and org.sleuthkit.autopsy.modules.hashdatabase.HashDbIngestModule.process().
|
private |
Get the current schema version
HealthMonitorException |
Definition at line 820 of file HealthMonitor.java.
References org.sleuthkit.autopsy.healthmonitor.HealthMonitor.connect().
Referenced by org.sleuthkit.autopsy.healthmonitor.HealthMonitor.activateMonitorLocally(), and org.sleuthkit.autopsy.healthmonitor.HealthMonitor.upgradeDatabaseSchema().
|
private |
Initialize the database.
HealthMonitorException |
Definition at line 874 of file HealthMonitor.java.
References org.sleuthkit.autopsy.healthmonitor.HealthMonitor.connect().
Referenced by org.sleuthkit.autopsy.healthmonitor.HealthMonitor.activateMonitorLocally().
|
private |
Time a database query. Database queries are hard to test in normal processing because the time is so dependent on the size of the tables being queried. We use getImages here because every table it queries is the same size (one entry for each image) so we a) know the size of the tables and b) can use that table size to do normalization.
HealthMonitorException |
Definition at line 420 of file HealthMonitor.java.
References org.sleuthkit.autopsy.casemodule.Case.getCurrentCaseThrows(), org.sleuthkit.autopsy.casemodule.Case.getSleuthkitCase(), org.sleuthkit.autopsy.healthmonitor.HealthMonitor.getTimingMetric(), and org.sleuthkit.autopsy.healthmonitor.HealthMonitor.submitNormalizedTimingMetric().
Referenced by org.sleuthkit.autopsy.healthmonitor.HealthMonitor.gatherTimerBasedMetrics().
void org.sleuthkit.autopsy.healthmonitor.HealthMonitor.propertyChange | ( | PropertyChangeEvent | evt | ) |
Definition at line 961 of file HealthMonitor.java.
References org.sleuthkit.autopsy.healthmonitor.HealthMonitor.addUserEvent().
|
staticprivate |
Perform all periodic tasks: - Check if monitoring has been enabled / disabled in the database - Gather any additional metrics - Write current metric data to the database Do not run this from a new thread if the case/application is closing.
Definition at line 948 of file HealthMonitor.java.
References org.sleuthkit.autopsy.healthmonitor.HealthMonitor.gatherTimerBasedMetrics(), and org.sleuthkit.autopsy.healthmonitor.HealthMonitor.writeCurrentStateToDatabase().
|
private |
Set the global enabled status in the database.
HealthMonitorException |
Definition at line 803 of file HealthMonitor.java.
References org.sleuthkit.autopsy.healthmonitor.HealthMonitor.connect().
|
private |
Setup a connection pool for db connections.
HealthMonitorException |
Definition at line 601 of file HealthMonitor.java.
References org.sleuthkit.autopsy.core.UserPreferences.getDatabaseConnectionInfo().
Referenced by org.sleuthkit.autopsy.healthmonitor.HealthMonitor.connect().
|
private |
Shut down the connection pool
HealthMonitorException |
Definition at line 635 of file HealthMonitor.java.
Referenced by org.sleuthkit.autopsy.healthmonitor.HealthMonitor.activateMonitorLocally(), and org.sleuthkit.autopsy.healthmonitor.HealthMonitor.deactivateMonitorLocally().
|
private |
Start the ScheduledThreadPoolExecutor that will handle the database writes.
Definition at line 246 of file HealthMonitor.java.
References org.sleuthkit.autopsy.healthmonitor.HealthMonitor.stopTimer().
Referenced by org.sleuthkit.autopsy.healthmonitor.HealthMonitor.HealthMonitor().
|
private |
Stop the ScheduledThreadPoolExecutor to prevent further database writes.
Definition at line 257 of file HealthMonitor.java.
References org.sleuthkit.autopsy.coreutils.ThreadUtils.shutDownTaskExecutor().
Referenced by org.sleuthkit.autopsy.healthmonitor.HealthMonitor.startTimer().
|
static |
Submit the metric that was previously obtained through getTimingMetric(), incorporating a count that the time should be divided by. Call this immediately after the section of code being timed. This method is safe to call regardless of whether the health monitor is enabled.
metric | The TimingMetric object obtained from getTimingMetric() |
normalization | The number to divide the time by (a zero here will be treated as a one) |
Definition at line 361 of file HealthMonitor.java.
References org.sleuthkit.autopsy.healthmonitor.HealthMonitor.addTimingMetric().
Referenced by org.sleuthkit.autopsy.healthmonitor.HealthMonitor.performDatabaseQuery(), and org.sleuthkit.autopsy.modules.hashdatabase.HashDbIngestModule.process().
|
static |
Submit the metric that was previously obtained through getTimingMetric(). Call this immediately after the section of code being timed. This method is safe to call regardless of whether the health monitor is enabled.
metric | The TimingMetric object obtained from getTimingMetric() |
Definition at line 338 of file HealthMonitor.java.
References org.sleuthkit.autopsy.healthmonitor.HealthMonitor.addTimingMetric().
Referenced by org.sleuthkit.autopsy.keywordsearch.Server.openCore(), and org.sleuthkit.autopsy.modules.hashdatabase.HashDbIngestModule.process().
|
private |
Upgrade an older database
Definition at line 173 of file HealthMonitor.java.
References org.sleuthkit.autopsy.healthmonitor.HealthMonitor.connect(), and org.sleuthkit.autopsy.healthmonitor.HealthMonitor.getVersion().
Referenced by org.sleuthkit.autopsy.healthmonitor.HealthMonitor.activateMonitorLocally().
|
private |
Write the collected metrics to the database.
HealthMonitorException |
Definition at line 461 of file HealthMonitor.java.
References org.sleuthkit.autopsy.healthmonitor.HealthMonitor.connect(), org.sleuthkit.autopsy.healthmonitor.HealthMonitor.getSharedDbLock(), org.sleuthkit.autopsy.healthmonitor.HealthMonitor.timingInfoMap, and org.sleuthkit.autopsy.healthmonitor.HealthMonitor.userInfoList.
Referenced by org.sleuthkit.autopsy.healthmonitor.HealthMonitor.recordMetrics().
|
staticprivate |
Definition at line 76 of file HealthMonitor.java.
|
private |
Definition at line 77 of file HealthMonitor.java.
|
private |
Definition at line 78 of file HealthMonitor.java.
|
staticprivate |
Definition at line 68 of file HealthMonitor.java.
|
staticprivate |
Definition at line 66 of file HealthMonitor.java.
Referenced by org.sleuthkit.autopsy.healthmonitor.HealthMonitor.getSharedDbLock().
|
staticprivate |
Definition at line 67 of file HealthMonitor.java.
|
private |
Definition at line 73 of file HealthMonitor.java.
|
private |
Definition at line 79 of file HealthMonitor.java.
|
staticprivate |
Definition at line 71 of file HealthMonitor.java.
|
staticprivate |
Definition at line 70 of file HealthMonitor.java.
|
staticprivate |
Definition at line 65 of file HealthMonitor.java.
|
private |
Definition at line 74 of file HealthMonitor.java.
Referenced by org.sleuthkit.autopsy.healthmonitor.HealthMonitor.writeCurrentStateToDatabase().
|
private |
Definition at line 75 of file HealthMonitor.java.
Referenced by org.sleuthkit.autopsy.healthmonitor.HealthMonitor.writeCurrentStateToDatabase().
Copyright © 2012-2018 Basis Technology. Generated on: Wed Sep 18 2019
This work is licensed under a
Creative Commons Attribution-Share Alike 3.0 United States License.