Prometheus Grafana Best Practices for IT Monitoring and Alerting 7

Mondo Technology Updated on 2024-01-31

Seeing the words, hello everyone, I am Xiaofei;Recently, I've been reading @弈心 @朱嘉盛 the articles of the two old brothers are getting better, and some things are slacking, so don't you continue to have a more prometheus-related today.

Today brings a brief description of the monitoring of the Windows Server server, the previous article presented the monitoring of Promethues, installation, data display, etc., you can directly view it through the collection.

There are also some Windows Server servers that need to be monitored and displayed, I think it is worth explaining Windows Server, I have some experience in Windows Server domain control and Exchange Server local construction and hybrid cloud deployment, and have built and maintained the formal environment of an enterprise, so I think Windows Server is not used a lot in the enterprise now, but it will not be very little, how much is a little, so a brief description of Windows Server monitoring, so this article is presented.

As mentioned earlier, the installation of node exporter, which is a collection of UNIX-like systems, such as Apple, Linux, OpenBSD, etc. But instead of using the Node Exporter, the collector for Windows Server utilizes the Windows Exporter maintained by the Prometheus community, as shown below:

First of all, install the package:

Windows Exporter supports Windows Server 2008R2 and later, as well as desktop Windows 7 and later.

Enter GitHub, **The installation package circled in the figure, MSI format can automatically install Windows services, so it is recommended to install MSI format, copy the software installation package to the server, double-click the dot to install, nothing is displayed, you can check whether the service has Windows Exporter in Windows Server, or netstat -ao to see if there is a 9182 port.

If you have hundreds or thousands of machines deployed, you can install and deploy directly with Ansible.

Once installed, the default port isport, add the installed machine to Prometheus through automatic file discovery, as shown in the following figure:

Simply demonstrate 5 machines, because there are dozens of Windows servers inside, so it is more difficult to install one by one, or Ansible batch installation operation is more appropriate, Ansible temporarily press and hold the table, and then do a separate best practice demonstration.

Add the following configuration file to prometheusYML file:

- job_name: "windows-host" metrics_path: /metrics scheme: http scrape_interval: 5s file_sd_configs: -files: -/root/monitor/prometheus/targets/windows-*.yml refresh interval: 2m relabel configs: label rewrite, port culling - source labels: -"__address__" regex: "(.*9182" target_label: "instance" action: replace replacement: "$1"
/root/monitor/prometheus/targets/windows-*.The YML file looks like this:

# windows-node.yml- labels: service: windows server brand: dell targets: -172.17.41.115:9182 - 172.17.41.84:9182 - 172.17.40.104:9182 - 172.17.40.202:9182 - 172.18.86.15:9182
Open the Grafana interface and import the template, here I use the template ID as:The template is as follows:

Click Import to import the template

Click load to load the template data, if your grafana does not open the public network, you can import it in the official website **json file, click upload json file, you can import the template without the public network. The following image shows the data presented in the template:

In the above figure, there is no data on the startup duration, the number of CPU cores and the total memory, when I import, because of the configuration query problem, and there is no data in the network part, so I will go to Prometheus to check whether there is data for relevant indicators. As shown in the figure below:

First of all, I need to eliminate other jobs through regular rules to keep the jobs I need.

There is no specific data on the startup duration, the number of CPU cores and the total memory, and the value field is selected because of the fields.

Value Options, for Options for Fields, select Numeric Fields.

For more details, you need to query the indicator data through promql to understand the meaning and logic of grafana panel editing, which is basically not a big problem.

This is the end of today's sharing, if you have any questions, you can directly send a private message or add my friends to communicate (Internet Xiaofei), and the bigwigs can add WeChat to communicate.

Related Pages