Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

An introduction to the combined part of MSSQL/WMI/PowerShell (1)

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly introduces Windows's WMI and PowerShell to realize real-time alarm. If you find it troublesome, you can use MSSQL's WMI alerts, which is relatively simple.

Why consider the combination of MSSQL, WMI and PowerShell? What can they do?

WMI/PowerShell is the plug-in and function of Windows, and it is undoubtedly the most simple and convenient to use them to realize MSSQL monitoring, automation and so on.

Why not consider using monitoring tools?

Free tools can not meet the demand, powerful tools (SCOM) are too expensive, small and medium-sized companies rarely consider buying.

1. Real-time alarm mode

What is a real-time alarm? That is, once the alarm information is found, the corresponding personnel can be notified immediately. According to the receiving mode of real-time alarm information, by comparing SMS / email / QQ/ Wechat, Wechat is the most convenient and real-time under PowerShell.

II. WMI event

First make sure that the WMI service is started

1) EventFilter

Event filter, mainly used to filter event information of WMI

2) Consumer

Event consumers, mainly used to trigger actions, such as invoking scripts, logging, executing commands, etc.

3) Binding

Event binding, which is mainly used to bind EventFilter and Consumer to achieve real-time action.

For the combination of EventFilter, Consumer and Binding, and called WMI Monitor,PowerShell as PS, it is convenient to refer to below.

Third, the principle of real-time alarm

The general principle is as follows:

WMI Monitor- > Database Server (private network)-> PowerShell- > Monitoring server (private network)-> send Wechat

Register WMI Monitor on the MSSQL server and monitor the sending Wechat script on the server through PowerShell remote calls. Both PowerShell and WMI can be accessed remotely. As for why PowerShell is used, it is relatively simple and secure.

IV. Monitoring categories

MSSQL+WMI+PS

1) Database DDL operation

2) Database mirroring status change

3) deadlock

4) update/delete statement (data is collected by SQL Server and real-time alarm is triggered by WMI)

.

V. types of automation operations

MSSQL+PS

1) backup files are deleted periodically

2) backup file availability verification

3) backup files are restored periodically to check

.

The following chapters will introduce the functions and categories one by one.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report