Autopsy  4.6.0
Graphical digital forensics platform for The Sleuth Kit and other tools.
Classes | Public Member Functions | Static Public Member Functions | Static Public Attributes | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
org.sleuthkit.autopsy.healthmonitor.EnterpriseHealthMonitor Class Reference

Inherits PropertyChangeListener.

Classes

class  DatabaseWriteTask
 
class  TimingInfo
 

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)
 

Static Public Attributes

static final CaseDbSchemaVersionNumber CURRENT_DB_SCHEMA_VERSION = new CaseDbSchemaVersionNumber(1, 0)
 

Private Member Functions

 EnterpriseHealthMonitor () throws HealthMonitorException
 
synchronized void activateMonitor () throws HealthMonitorException
 
void addTimingMetric (TimingMetric metric) throws HealthMonitorException
 
Connection connect () throws HealthMonitorException
 
void createDatabase () throws HealthMonitorException
 
boolean databaseExists () throws HealthMonitorException
 
boolean databaseIsInitialized () throws HealthMonitorException
 
synchronized void deactivateMonitor () throws HealthMonitorException
 
void gatherTimerBasedMetrics () throws HealthMonitorException
 
CoordinationService.Lock getExclusiveDbLock () throws HealthMonitorException
 
CoordinationService.Lock getSharedDbLock () throws HealthMonitorException
 
CaseDbSchemaVersionNumber getVersion () throws HealthMonitorException
 
void initializeDatabaseSchema () throws HealthMonitorException
 
void performDatabaseQuery () throws HealthMonitorException
 
void setupConnectionPool () throws HealthMonitorException
 
void shutdownConnections () throws HealthMonitorException
 
synchronized void startTimer ()
 
synchronized void stopTimer ()
 
void writeCurrentStateToDatabase () throws HealthMonitorException
 

Private Attributes

BasicDataSource connectionPool = null
 
final ExecutorService healthMonitorExecutor
 
ScheduledThreadPoolExecutor healthMonitorOutputTimer
 
String hostName
 
final Map< String, TimingInfotimingInfoMap
 

Static Private Attributes

static final int CONN_POOL_SIZE = 10
 
static final String DATABASE_NAME = "EnterpriseHealthMonitor"
 
static final long DATABASE_WRITE_INTERVAL = 60
 
static final String HEALTH_MONITOR_EVENT_THREAD_NAME = "Health-Monitor-Event-Listener-%d"
 
static EnterpriseHealthMonitor instance
 
static final String IS_ENABLED_KEY = "is_enabled"
 
static final AtomicBoolean isEnabled = new AtomicBoolean(false)
 
static final Logger logger = Logger.getLogger(EnterpriseHealthMonitor.class.getName())
 
static final String MODULE_NAME = "EnterpriseHealthMonitor"
 

Detailed Description

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 EnterpriseHealthMonitor.java.

Constructor & Destructor Documentation

org.sleuthkit.autopsy.healthmonitor.EnterpriseHealthMonitor.EnterpriseHealthMonitor ( ) throws HealthMonitorException
private

Member Function Documentation

synchronized void org.sleuthkit.autopsy.healthmonitor.EnterpriseHealthMonitor.activateMonitor ( ) throws HealthMonitorException
private
void org.sleuthkit.autopsy.healthmonitor.EnterpriseHealthMonitor.addTimingMetric ( TimingMetric  metric) throws HealthMonitorException
private

Add the timing metric data to the map.

Parameters
metricThe metric to add. stopTiming() should already have been called.

Definition at line 311 of file EnterpriseHealthMonitor.java.

Referenced by org.sleuthkit.autopsy.healthmonitor.EnterpriseHealthMonitor.submitNormalizedTimingMetric(), and org.sleuthkit.autopsy.healthmonitor.EnterpriseHealthMonitor.submitTimingMetric().

Connection org.sleuthkit.autopsy.healthmonitor.EnterpriseHealthMonitor.connect ( ) throws HealthMonitorException
private
void org.sleuthkit.autopsy.healthmonitor.EnterpriseHealthMonitor.createDatabase ( ) throws HealthMonitorException
private

Create a new health monitor database.

Exceptions
HealthMonitorException

Definition at line 481 of file EnterpriseHealthMonitor.java.

References org.sleuthkit.autopsy.core.UserPreferences.getDatabaseConnectionInfo().

Referenced by org.sleuthkit.autopsy.healthmonitor.EnterpriseHealthMonitor.activateMonitor().

boolean org.sleuthkit.autopsy.healthmonitor.EnterpriseHealthMonitor.databaseExists ( ) throws HealthMonitorException
private

Check whether the health monitor database exists. Does not check the schema.

Returns
true if the database exists, false otherwise
Exceptions
HealthMonitorException

Definition at line 452 of file EnterpriseHealthMonitor.java.

References org.sleuthkit.autopsy.core.UserPreferences.getDatabaseConnectionInfo().

Referenced by org.sleuthkit.autopsy.healthmonitor.EnterpriseHealthMonitor.activateMonitor().

boolean org.sleuthkit.autopsy.healthmonitor.EnterpriseHealthMonitor.databaseIsInitialized ( ) throws HealthMonitorException
private

Test whether the database schema has been initialized. We do this by looking for the version number.

Returns
True if it has been initialized, false otherwise.
Exceptions
HealthMonitorException

Definition at line 572 of file EnterpriseHealthMonitor.java.

References org.sleuthkit.autopsy.healthmonitor.EnterpriseHealthMonitor.connect().

Referenced by org.sleuthkit.autopsy.healthmonitor.EnterpriseHealthMonitor.activateMonitor().

synchronized void org.sleuthkit.autopsy.healthmonitor.EnterpriseHealthMonitor.deactivateMonitor ( ) throws HealthMonitorException
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.

Exceptions
HealthMonitorException

Definition at line 183 of file EnterpriseHealthMonitor.java.

References org.sleuthkit.autopsy.healthmonitor.EnterpriseHealthMonitor.shutdownConnections(), and org.sleuthkit.autopsy.healthmonitor.EnterpriseHealthMonitor.stopTimer().

void org.sleuthkit.autopsy.healthmonitor.EnterpriseHealthMonitor.gatherTimerBasedMetrics ( ) throws HealthMonitorException
private

Collect metrics at a scheduled time.

Exceptions
HealthMonitorException

Definition at line 370 of file EnterpriseHealthMonitor.java.

References org.sleuthkit.autopsy.healthmonitor.EnterpriseHealthMonitor.performDatabaseQuery().

CoordinationService.Lock org.sleuthkit.autopsy.healthmonitor.EnterpriseHealthMonitor.getExclusiveDbLock ( ) throws HealthMonitorException
private

Get an exclusive lock for the health monitor database. Acquire this before creating, initializing, or updating the database schema.

Returns
The lock
Exceptions
HealthMonitorException

Definition at line 749 of file EnterpriseHealthMonitor.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.EnterpriseHealthMonitor.activateMonitor().

CoordinationService.Lock org.sleuthkit.autopsy.healthmonitor.EnterpriseHealthMonitor.getSharedDbLock ( ) throws HealthMonitorException
private
static TimingMetric org.sleuthkit.autopsy.healthmonitor.EnterpriseHealthMonitor.getTimingMetric ( String  name)
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 Enterprise Health Monitor is enabled.

Parameters
nameA short but descriptive name describing the code being timed. This name will appear in the UI.
Returns
The TimingMetric object

Definition at line 259 of file EnterpriseHealthMonitor.java.

Referenced by org.sleuthkit.autopsy.keywordsearch.Server.openCore(), org.sleuthkit.autopsy.healthmonitor.EnterpriseHealthMonitor.performDatabaseQuery(), and org.sleuthkit.autopsy.modules.hashdatabase.HashDbIngestModule.process().

CaseDbSchemaVersionNumber org.sleuthkit.autopsy.healthmonitor.EnterpriseHealthMonitor.getVersion ( ) throws HealthMonitorException
private

Get the current schema version

Returns
the current schema version
Exceptions
HealthMonitorException

Definition at line 606 of file EnterpriseHealthMonitor.java.

References org.sleuthkit.autopsy.healthmonitor.EnterpriseHealthMonitor.connect().

void org.sleuthkit.autopsy.healthmonitor.EnterpriseHealthMonitor.initializeDatabaseSchema ( ) throws HealthMonitorException
private
void org.sleuthkit.autopsy.healthmonitor.EnterpriseHealthMonitor.performDatabaseQuery ( ) throws HealthMonitorException
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.

Exceptions
HealthMonitorException

Definition at line 339 of file EnterpriseHealthMonitor.java.

References org.sleuthkit.autopsy.casemodule.Case.getOpenCase(), org.sleuthkit.autopsy.casemodule.Case.getSleuthkitCase(), org.sleuthkit.autopsy.healthmonitor.EnterpriseHealthMonitor.getTimingMetric(), and org.sleuthkit.autopsy.healthmonitor.EnterpriseHealthMonitor.submitNormalizedTimingMetric().

Referenced by org.sleuthkit.autopsy.healthmonitor.EnterpriseHealthMonitor.gatherTimerBasedMetrics().

void org.sleuthkit.autopsy.healthmonitor.EnterpriseHealthMonitor.propertyChange ( PropertyChangeEvent  evt)

Definition at line 730 of file EnterpriseHealthMonitor.java.

void org.sleuthkit.autopsy.healthmonitor.EnterpriseHealthMonitor.setupConnectionPool ( ) throws HealthMonitorException
private

Setup a connection pool for db connections.

Exceptions
HealthMonitorException

Definition at line 501 of file EnterpriseHealthMonitor.java.

References org.sleuthkit.autopsy.core.UserPreferences.getDatabaseConnectionInfo().

Referenced by org.sleuthkit.autopsy.healthmonitor.EnterpriseHealthMonitor.connect().

void org.sleuthkit.autopsy.healthmonitor.EnterpriseHealthMonitor.shutdownConnections ( ) throws HealthMonitorException
private

Shut down the connection pool

Exceptions
HealthMonitorException

Definition at line 533 of file EnterpriseHealthMonitor.java.

Referenced by org.sleuthkit.autopsy.healthmonitor.EnterpriseHealthMonitor.deactivateMonitor().

synchronized void org.sleuthkit.autopsy.healthmonitor.EnterpriseHealthMonitor.startTimer ( )
private

Start the ScheduledThreadPoolExecutor that will handle the database writes.

Definition at line 200 of file EnterpriseHealthMonitor.java.

References org.sleuthkit.autopsy.healthmonitor.EnterpriseHealthMonitor.stopTimer().

Referenced by org.sleuthkit.autopsy.healthmonitor.EnterpriseHealthMonitor.activateMonitor().

synchronized void org.sleuthkit.autopsy.healthmonitor.EnterpriseHealthMonitor.stopTimer ( )
private
static void org.sleuthkit.autopsy.healthmonitor.EnterpriseHealthMonitor.submitNormalizedTimingMetric ( TimingMetric  metric,
long  normalization 
)
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 Enterprise Health Monitor is enabled.

Parameters
metricThe TimingMetric object obtained from getTimingMetric()
normalizationThe number to divide the time by (a zero here will be treated as a one)

Definition at line 294 of file EnterpriseHealthMonitor.java.

References org.sleuthkit.autopsy.healthmonitor.EnterpriseHealthMonitor.addTimingMetric().

Referenced by org.sleuthkit.autopsy.healthmonitor.EnterpriseHealthMonitor.performDatabaseQuery(), and org.sleuthkit.autopsy.modules.hashdatabase.HashDbIngestModule.process().

static void org.sleuthkit.autopsy.healthmonitor.EnterpriseHealthMonitor.submitTimingMetric ( TimingMetric  metric)
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 Enterprise Health Monitor is enabled.

Parameters
metricThe TimingMetric object obtained from getTimingMetric()

Definition at line 273 of file EnterpriseHealthMonitor.java.

References org.sleuthkit.autopsy.healthmonitor.EnterpriseHealthMonitor.addTimingMetric().

Referenced by org.sleuthkit.autopsy.keywordsearch.Server.openCore(), and org.sleuthkit.autopsy.modules.hashdatabase.HashDbIngestModule.process().

void org.sleuthkit.autopsy.healthmonitor.EnterpriseHealthMonitor.writeCurrentStateToDatabase ( ) throws HealthMonitorException
private

Member Data Documentation

final int org.sleuthkit.autopsy.healthmonitor.EnterpriseHealthMonitor.CONN_POOL_SIZE = 10
staticprivate

Definition at line 81 of file EnterpriseHealthMonitor.java.

BasicDataSource org.sleuthkit.autopsy.healthmonitor.EnterpriseHealthMonitor.connectionPool = null
private

Definition at line 82 of file EnterpriseHealthMonitor.java.

final CaseDbSchemaVersionNumber org.sleuthkit.autopsy.healthmonitor.EnterpriseHealthMonitor.CURRENT_DB_SCHEMA_VERSION = new CaseDbSchemaVersionNumber(1, 0)
static
final String org.sleuthkit.autopsy.healthmonitor.EnterpriseHealthMonitor.DATABASE_NAME = "EnterpriseHealthMonitor"
staticprivate
final long org.sleuthkit.autopsy.healthmonitor.EnterpriseHealthMonitor.DATABASE_WRITE_INTERVAL = 60
staticprivate

Definition at line 69 of file EnterpriseHealthMonitor.java.

final String org.sleuthkit.autopsy.healthmonitor.EnterpriseHealthMonitor.HEALTH_MONITOR_EVENT_THREAD_NAME = "Health-Monitor-Event-Listener-%d"
staticprivate

Definition at line 77 of file EnterpriseHealthMonitor.java.

final ExecutorService org.sleuthkit.autopsy.healthmonitor.EnterpriseHealthMonitor.healthMonitorExecutor
private

Definition at line 76 of file EnterpriseHealthMonitor.java.

ScheduledThreadPoolExecutor org.sleuthkit.autopsy.healthmonitor.EnterpriseHealthMonitor.healthMonitorOutputTimer
private

Definition at line 79 of file EnterpriseHealthMonitor.java.

String org.sleuthkit.autopsy.healthmonitor.EnterpriseHealthMonitor.hostName
private

Definition at line 83 of file EnterpriseHealthMonitor.java.

EnterpriseHealthMonitor org.sleuthkit.autopsy.healthmonitor.EnterpriseHealthMonitor.instance
staticprivate

Definition at line 74 of file EnterpriseHealthMonitor.java.

final String org.sleuthkit.autopsy.healthmonitor.EnterpriseHealthMonitor.IS_ENABLED_KEY = "is_enabled"
staticprivate

Definition at line 68 of file EnterpriseHealthMonitor.java.

final AtomicBoolean org.sleuthkit.autopsy.healthmonitor.EnterpriseHealthMonitor.isEnabled = new AtomicBoolean(false)
staticprivate

Definition at line 73 of file EnterpriseHealthMonitor.java.

final Logger org.sleuthkit.autopsy.healthmonitor.EnterpriseHealthMonitor.logger = Logger.getLogger(EnterpriseHealthMonitor.class.getName())
staticprivate

Definition at line 65 of file EnterpriseHealthMonitor.java.

final String org.sleuthkit.autopsy.healthmonitor.EnterpriseHealthMonitor.MODULE_NAME = "EnterpriseHealthMonitor"
staticprivate

Definition at line 67 of file EnterpriseHealthMonitor.java.

final Map<String, TimingInfo> org.sleuthkit.autopsy.healthmonitor.EnterpriseHealthMonitor.timingInfoMap
private

The documentation for this class was generated from the following file:

Copyright © 2012-2016 Basis Technology. Generated on: Mon May 7 2018
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.