Database Reference
In-Depth Information
the state change occurred, and you can also find the old and new state of the object. In
other words, the monitored object transitioned from the health state indicated by the
OldHealthState
column to the health state indicated by the
NewHealthState
column at the date/time indicated by the
DateTime
column.
You can join
vManagedEntityMonitor
on
ManagedEntityMonitorRowId
to
retrieve information about the managed entity and the monitor, and you can join
vHealthState
on the
OldHealthState
and
NewHealthState
columns to re-
trieve health state information.
In the following example, we will retrieve a list of all state changes that are associated
with a specific monitored object and a specific monitor. You can use the
vMan-
agedEntityMonitor
,
vManagedEntity
, and
vMonitor
views to select a sample
managed entity and a sample monitor from your environment. You must replace the value
for
ManagedEntityRowId
and
MonitorRowId
with the IDs from your environ-
ment, as shown in the following query:
SELECT
M.MonitorDefaultName,
ME.FullName,
S.DateTime,
HSOld.HealthStateDefaultName AS OldState,
HSNew.HealthStateDefaultName AS NewState
FROM
State.vStateRaw S
INNER JOIN vManagedEntityMonitor MEM ON
S.ManagedEntityMonitorRowId =
MEM.ManagedEntityMonitorRowId
INNER JOIN vManagedEntity ME ON
MEM.ManagedEntityRowId = ME.ManagedEntityRowId
INNER JOIN vMonitor M ON
MEM.MonitorRowId = M.MonitorRowId
INNER JOIN vHealthState HSOld ON
S.OldHealthState = HSOld.HealthStateRowId
INNER JOIN vHealthState HSNew ON
S.NewHealthState = HSNew.HealthStateRowId
WHERE
ME.ManagedEntityRowId = 1299
AND M.MonitorRowId = 1