Last Visible or Last Successful Heartbeat
Any chance we can get a date/time field in PDQ Inventory for the last time a computer was online or a last successful heartbeat?
-
I was wrong about what LastIsOnlineTime represents. I did some experimentation and figured out that it's the last time the target went from offline to online.
- LastIsOnlineTime - The last time IsOnline changed from 0 to 1
- LastIsOfflineTime - The last time IsOnline changed from 1 to 0
- HeartbeatDate - The last time a Heartbeat was sent to the target
If IsOnline = 1, then HeartbeatDate is the last successful Heartbeat. If IsOnline = 0, then LastIsOfflineTime is when the target went offline. Here's a SQL Report that pulls that logic into 1 field. Technically, when IsOnline = 0, this report is off by whatever your Heartbeat Interval is since it will show the Heartbeat after the last successful one, but hopefully it's close enough. You can remove the extra fields if you don't want them.
SELECT
Name
, IsOnline
, LastIsOnlineTime
, LastIsOfflineTime
, HeartbeatDate
, CASE
WHEN IsOnline = 0 THEN
LastIsOfflineTime
ELSE
HeartbeatDate
END 'Last Heartbeat'
FROM
Computers
WHERE
<ComputerFilter>
Please sign in to leave a comment.
Comments
4 comments