Using WMI for SQL agent alerts

  • Basically I want to be able to see what servers are up at any given time, and log the time they are offline, I need to be able to monitor when the services start, stop, or when the compter shuts down. If there is a way to do this please help.

    Right now I'm using powershell to look at what different win32 classes contain, but I'm in the very basic stages of developing this idea. Thanks for any help!

  • So if anyone is knowledgeable at all on this subject, I would appreciate any pointers. I've done ~10 hours of research on WMI, making event handlers, event consumer providers, and the like. I have never programmed in VB or C# before, but I've done a bit of Powershell and a lot of Java, so I can figure out a bit of what is going on. I was able to follow a tutorial on a temporary event listener, but it wasn't a permanent solution, just a backround program that listend for a discreet number of events.

    It looks as if I might need to make a COM object (using either VB or C#) that is an event consumer provider, which would somehow (how exactly??!?) get picked up by the SQL Agent. I guess the other way of doing this is to just skip the agent altogether, and pick up the event, and dump it directly into the database (I don't know enough T-SQL for that either, but it should be easier than the C#/VB code, I'm leaning towards C# as it is closer to java than VB). Anyway, if anyone has done anything even remotely similar to this and could help me out, I'd love it. Also, I've spent forever trying to get this tutorial to work http://msdn.microsoft.com/en-us/library/bb552512.aspx titled: How to: Listen for Events and Store Them in a SQL Database.

    I only have 1 error at compilation, where I can't get my program (.cx file) to recognize the the settings file (which is an xml file). If anyone could help me with that, it may pave the way to solving this whole mess. Currently I have two parts of the project, the code in the .cx, and the settings in a .xml, if I'm doing something wrong or need to add something please let me know, I was able to figure out how to add all the resource .dlls without much difficulty removing the other 54 errors... just one more to go!

    As a general rule I think I'm going about 95% trial and error here, because I only understand about 50% of what I'm reading on the subject - I have no prior knowledge of WMI, C#, COM objects, or even using C# scripts in SQL, everything is new to me, so please anything will help!

    Thanks a ton,

    -Josh

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

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