Friday 18 December 2009

Server uptime

Server uptime:

Select cs.Name0, DateDiff(hour,os.LastBootUpTime0,ws.LastHWScan) as 'Uptime (in Hours)', os.LastBootUpTime0 as 'Last Reboot Date/Time', ws.LastHWScan as 'Last Hardware Inventory'From dbo.v_GS_WORKSTATION_STATUS ws Left Outer Join dbo.v_GS_Operating_System os on ws.ResourceID = os.ResourceID left outer join dbo.v_GS_COMPUTER_SYSTEM cs on cs.ResourceID = os.ResourceID left outer join dbo.v_GS_SYSTEM sys on sys.ResourceID = os.ResourceID Where Sys.SystemRole0='Server'Order by Cs.Name0

1 comment:

  1. Silly me... I was looking for a "tracked" uptime stat rather than just calculating the datediff as you did here. The one change I made would be to calculate the datediff from last boot until Now() rather than the diff from last boot to last hardware inventory.

    ReplyDelete