This article mainly introduces Windows WMI and PowerShell to implement real-time alarm, if you feel trouble, the use of MSSQL WMI alerts, relatively simpler.
Why consider MSSQL combined with WMI and PowerShell? What can they do?
Wmi/powershell are all Windows plug-ins and functions, using them to achieve MSSQL monitoring, automation operations, and so on, is undoubtedly the simplest and most convenient.
Why not consider using a monitoring tool?
Free tools do not meet demand, powerful tools (SCOM) are too expensive, and small companies rarely consider buying.
First, the police type of real-time reporting
What is a real-time alarm? That is, once the alarm information is found, the corresponding personnel can be immediately notified. In order to receive the real-time alarm information, it is the most convenient and real-time in PowerShell by comparing the SMS/Mail/qq/.
Ii. WMI Events
First, make sure that the WMI service is started (some functions like Zabbix agent, specifically for data acquisition)
1) EventFilter
Event filters, which are used primarily to filter the WMI event information
2) Consumer
Event consumers, primarily for triggering actions such as invoking scripts, logging, executing commands, etc.
3) Binding
Event binding, primarily used to bind eventfilter with consumer to enable real-time actions
For the combination of EventFilter, consumer and binding, and known as WMI Monitor,powershell as PS, it is convenient to refer to the following
Three, real-time alarm realization principle
The general principle is as follows:
WMI monitor-> Database Server (intranet)->powershell-> monitoring Server (internal and external network), send
Register WMI Monitor on the MSSQL server and remotely invoke the send script on the monitoring server via PowerShell. Both PowerShell and WMI can be accessed remotely, and the reason for using PowerShell is relatively simple and secure.
Iv. Types of monitoring
Mssql+wmi+ps
1) Database DDL operations
2) Changes in database mirroring status
3) Deadlock
4) Update/delete statement (data collected by SQL Server, WMI triggers real-time alarms)
.....
V. Automation type of work
Mssql+ps
1) Backup files are deleted periodically
2) Backup file Availability Verification
3) Backup file periodic restore check
.....
The following chapters will cover each function and category.
This article is from the "Aimax" blog, make sure to keep this source http://aimax.blog.51cto.com/11610508/1965662
Mssql/wmi/powershell (a) Introduction