September 21, 2016 at 10:30 pm
Comments posted to this topic are about the item Monitor up-time and connectivity with Powershell
September 22, 2016 at 6:32 am
Nice work, thanks.
September 22, 2016 at 8:53 am
Thanks for the share. Might especially be good for people/companies that don't have budget for 3rd-party platform polling applications. Could loop list of servers\instances + have another PS process that scans logs for the errors and sends alerts.
September 22, 2016 at 9:05 am
I had a similar need to monitor that a database was accessible, but it also needed to check that web servers were also up. I wrote a Windows service in C# .Net that ran at periodic intervals to check the health of a systems that I supported. There was a service for each system being monitored. One system has three web servers to check (one was a failover server), four databases, and an Active Directory system.
If there was a database failure, it would notify the DBA team by email; if there was a network error, it would also notify the server hosting team. The server hosting team would be notified of web server errors.
September 23, 2016 at 12:23 am
Good start ... very useful for places where there is no budget for monitoring SQL. You could even bundle in a couple of example SQL scripts. Like backup taken within last 24hrs, etc...
Couple of suggestions for improvement.
1) include the Comment Based Help (https://technet.microsoft.com/en-us/library/hh847834.aspx). This works in with the get-help cmdlet to provide documentation for your script.
2) add a finally { ... } block to your try { ... } catch { ... }. In there you would check if the SQL connection is still open and close it.
eg:
finally {
if ($cn.State -eq "Open") {
$cn.Close()
}
}
3) Change your SQL Server, database, login variables to parameters. See http://ss64.com/ps/syntax-args.html
Cheers
Phil
--------------------
Colt 45 - the original point and click interface
September 23, 2016 at 3:41 am
Thanks. Great article and script.
Just one question, is there a way to do this without revealing the users password in the script or in the run command if using parameters?
Rgds, Dave.
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy