Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase 12»»

Using the UPTIME Utility to Monitor Servers Expand / Collapse
Author
Message
Posted Tuesday, June 22, 2010 9:48 PM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Tuesday, March 2, 2010 8:19 AM
Points: 10, Visits: 16
Comments posted to this topic are about the item Using the UPTIME Utility to Monitor Servers
Post #941473
Posted Tuesday, June 22, 2010 10:35 PM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Monday, July 21, 2014 7:00 AM
Points: 13, Visits: 47
For SQL Server 2008 you can execute the following query to obtain the server start time. This is a lot simpler than running a command line utility.

SELECT sqlserver_start_time FROM sys.dm_os_sys_info
Post #941485
Posted Wednesday, June 23, 2010 1:06 AM
SSCommitted

SSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommitted

Group: General Forum Members
Last Login: Today @ 7:57 AM
Points: 1,610, Visits: 5,480
drikusvd (6/22/2010)
For SQL Server 2008 you can execute the following query to obtain the server start time. This is a lot simpler than running a command line utility.


Well, except that gives you the time the SQL Server started, which isn't necessarily the same as the time the server started. Secondly, that won't work for a server that you might want to monitor that doesn't actually have SQL Server installed on it!
Post #941537
Posted Wednesday, June 23, 2010 3:05 AM


SSC Eights!

SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!

Group: General Forum Members
Last Login: 2 days ago @ 3:51 AM
Points: 928, Visits: 1,112

Secondly, that won't work for a server that you might want to monitor that doesn't actually have SQL Server installed on it!


Since I'm a DBA, i'm only interested in servers which have SQL installed (I only get payed for that)
Another way to determine the uptime for SQL Server is to query the creation time from TempDB


Wilfred
The best things in life are the simple things
Post #941599
Posted Wednesday, June 23, 2010 3:14 AM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Friday, June 20, 2014 3:51 AM
Points: 139, Visits: 4,615
As you said in the article, enable xp_cmdshell is not the best option and a solution would be to create a CLR function to get the uptime.

But, as the uptime it has nothing to do with SQL Server, because it's a Windows "function", it might be a good idea to get the information using a PowerShell script.
Post #941604
Posted Wednesday, June 23, 2010 4:04 AM


SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Sunday, July 20, 2014 9:06 PM
Points: 2,693, Visits: 1,202
Powershell would be a good option and the one I'd pursue.

However for those that don't want to dabble in Powershell and don't want to enable xp_cmdshell, you can pipe the output from uptime into a text file and then use osql/sqlcmd to import the file into the DB.



Hope this helps
Phill Carter
--------------------
Colt 45 - the original point and click interface

Australian SQL Server User Groups - My profile
Phills Philosophies
Murrumbeena Cricket Club
Post #941625
Posted Wednesday, June 23, 2010 6:45 AM
SSC Eights!

SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!

Group: General Forum Members
Last Login: Monday, July 14, 2014 12:26 PM
Points: 964, Visits: 956
The one problem we have with measuring uptime is that the server uptime doesn't necessarily mean the SQL Server was accessible at all times. We made a custom check to run from a centralized server to check connectivity every 9 minutes to make sure a simple select runs against master. However, it's hard to measure the pct of uptime strictly of SQL Server.

The logic I currently try to use it 100-((num_of_connectivity_failures/160)*100) = pct_uptime_for_connectivty_to_sql

1440 minutes in a day / 9 minutes = 160 connectivity checks per day.

For our missions critical systems, we check connectivity to the individual databases every minute, so the checks would be more 1440 checks per day and the percentage becomes more accurate.

Any other thoughts / suggestions are always welcomed though.

Steve
Post #941708
Posted Wednesday, June 23, 2010 7:02 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Thursday, June 13, 2013 11:00 AM
Points: 43, Visits: 104
Good Article, uptime is sadly outdated and often crashes on Win2008


Post #941716
Posted Wednesday, June 23, 2010 7:05 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Tuesday, September 4, 2012 6:07 AM
Points: 6, Visits: 21
I would highly recommend against enabling xp_cmdshell, enabling this feature just opens up a can of worms - especially when the SQL Server service is running under a privileged account like the LocalSystem user.

We use EventSentry (http://www.eventsentry.com) to track server uptime - it keeps a log of all reboots, shows graphs of server's uptimes (e.g. for comparison), logs the longest uptime for a server and more.

It also monitors services, if one wants to track the SQL Server services themselves.
Post #941718
Posted Wednesday, June 23, 2010 7:10 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Tuesday, September 4, 2012 6:07 AM
Points: 6, Visits: 21
lake_xp: Check out the NTToolkit http://www.netikus.net/products_nttoolkit.html, it also includes a "uptime.exe". For a simple display, just run "uptime /onetime". Unfortunately it doesn't run against remote machines (yet).
Post #941721
« Prev Topic | Next Topic »

Add to briefcase 12»»

Permissions Expand / Collapse