Image

Well !! Most of us are worried about whether our server had a sudden reboot !! Though there are many tools that can be used to Monitor the same , however if in case you do not have any of these tools then the same can be monitored using the below script :

 

SELECT

os.Caption0 as ‘Server Type’,

cs.Name0 as ‘Server Name’,

DateDiff(hour,os.LastBootUpTime0,ws.LastHWScan) as ‘Uptime (in Hours)’,

os.LastBootUpTime0 as ‘Last Reboot Date’,

ws.LastHWScan as ‘Last Hardware Inventory’

FROM v_GS_COMPUTER_SYSTEM cs

INNER JOIN v_GS_Operating_System os

ON cs.ResourceID = os.ResourceID

LEFT OUTER JOIN v_GS_WORKSTATION_STATUS ws

ON ws.ResourceID = os.ResourceID

WHERE os.Caption0 LIKE ‘%server%’

AND ws.LastHWScan <> 0 AND cs.Name0 IS NOT NULL

 

Advertisements