SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Using WMI for SQL agent alerts


Using WMI for SQL agent alerts

Author
Message
PayCheck
PayCheck
SSC Rookie
SSC Rookie (49 reputation)SSC Rookie (49 reputation)SSC Rookie (49 reputation)SSC Rookie (49 reputation)SSC Rookie (49 reputation)SSC Rookie (49 reputation)SSC Rookie (49 reputation)SSC Rookie (49 reputation)

Group: General Forum Members
Points: 49 Visits: 66
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!
PayCheck
PayCheck
SSC Rookie
SSC Rookie (49 reputation)SSC Rookie (49 reputation)SSC Rookie (49 reputation)SSC Rookie (49 reputation)SSC Rookie (49 reputation)SSC Rookie (49 reputation)SSC Rookie (49 reputation)SSC Rookie (49 reputation)

Group: General Forum Members
Points: 49 Visits: 66
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
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search