Script: Query Value from SQL Database and Log Event
By Pete Zerger on 7/9/2009 9:22:05 AM • Rank (4743) • Views 6069
1

1

This sample monitoring script illustrates how run a T-SQL query on a database and log an event based on value returned. Good example of how to dynamically create the connection string when database server & database name must be discovered at runtime.

In this sample, we actually run a query to retrieve the 'Pending Actions' count from the SCOM 2007 Operational database. Since the name and server location are up to the administrator, this script actually retrieves the server and database name from the registry (when run on Mgmt Server or RMS), and runs the query.

If the count of Pending Actions is greater than your user defined threshold, an event is logged. This could be used with an alert-generating rule to create an alert.

To see this script in action, try the sample OpsMgr 2007 Extensions MP, which will raise an alert when you have pending actions waiting for your attention in the Operations Console.

Download

"Only registered users may download. Registration is free."

Version: 1.0
Importance: Optional
Guide:
Latest Media - View All Media (1)
   
Read More
Map Location


GPS Latitude: 0.00000 Longitude: 0.00000
Comments - Comment RSS
Add your Comment


Who Viewed
Who Reviewed
Categories
Tags
SCOM, Scripts, Scripts, Monitoring Scripts
Related Pages
Shortened URL
http://tinyurl.com/ygc6zzt

Top Contributors
Featured Members
Pete Zerger
Points: 65502
Level: System Center Expert
Tommy Gunn
Points: 42718
Level: System Center Expert
Simon Skinner
Points: 40744
Level: System Center Expert
Stefan Koell
Points: 28999
Level: System Center Expert
Andreas Zuckerhut
Points: 27584
Level: System Center Expert