Need some help with perfmon logging directly to SQL server..

  • I know most people advise logging to log files, and then moving them from log files into SQL Server.

    I will do that as a LAST RESORT, but I really need real time monitoring as well as unlimited historical storage.

    I'm only monitoring a handful of servers, and less than 10 counters per server.

    The issue I have is that if the server being monitored reboots perfmon does not seem to ever restart the counter.

    I am looking for some way to make that happen.

    Ideally a setting in perfmon itself to do that, but I don't think I will have any luck with that.

    My setup:

    work station has counter logs from 6 servers going to an SQL Server database.

    It is set to close the log every 5 minutes and open a new one. I did that in the hopes it might cause it to auto-restart a "dead" log on its own.

    It samples every 15 seconds.

    Any advice here?

    Perhaps I need to setup an alert to look for an error that perfmon may raise in the workstation's event monitor? And then restart the log via a batch file?

    Or perhaps I could setup a job on SQL server and have it kick off a sproc every 5 minutes, if that sproc can't find any data having been logged for any of the servers in the last 5 minutes, it kicks off a script to somehow tell perfmon to start logging again.

    I don't want to have to go all out to something like SCOM 2007 R2 just for some basic server monitoring.

    I also looked at RRdtool and MRTD, but all of those log to their own format, and won't log to SQL server from what I am seeing.

  • I absolutely recommend going to a file and then importing to the database. It's just cleaner and easier.

    However, depending on the counters you're interested in, you can get them from sys.dm_os_performance_counters. You can query that in real time, do whatever you need with the data returned.

    "The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
    - Theodore Roosevelt

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning

  • Grant Fritchey (10/21/2009)


    I absolutely recommend going to a file and then importing to the database. It's just cleaner and easier.

    However, depending on the counters you're interested in, you can get them from sys.dm_os_performance_counters. You can query that in real time, do whatever you need with the data returned.

    I ended up using perfmon, logman to start the counters after reboot, and then I have a sproc that runs and alerts me if the counters stop for more than 3 minutes so I can check on it.

    It logs direct to SQL that way so I get "real time" data (well every 15 seconds)... but so far it is working very nicely.

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply