Zabbix monitoring memory usage of processes on Windows servers

Source: Internet
Author: User

Zabbix monitoring memory usage of processes on Windows servers


It is not easy to get a process's memory or CPU usage on a Windows server because the Windows Server cannot use top like Linux, or is similar to the data information in the/pro directory.

Here, the memory usage value of the process is obtained by using a Python script on the Windows Server, passed to the Zabbix client via key, which is the Zabbix client installed on this machine.

There are many articles on Windows that are installed on the Zabbix client network and are no longer recorded here.


1, first install the Python environment:

Click here to download the Python version of Windows, here is the 2.7.6 version, double-click Install, and modify the PATH environment variable, my computer----environment variable----The system variable is added after path ; C: \ Python27 (appears to have been added automatically after installation)

At the same time modify the Pathext, add ;. PY;. PYM (looks like it already has)

You can test if the Python installation is successful in DOS and enter the python command directly to complete the test.


2. Install the Psutil module:

Click here to download psutil-2.1.1.win32-py2.7.exe, directly double-click the installation.

The Psutil module can be used across platforms to obtain server Cpu,memory,disks,network,system info,process Management information. The module needs to be installed in advance on the machine. This article describes in more detail the Psutil module: https://pypi.python.org/pypi/psutil


3, Monitoring script:

Import psutilimport reimport sysdef processinfo (ProcessName):                     pids =  psutil.get_process_list ()                      for pid in pids:                          STRPID = STR (PID)                          f = re.compile (ProcessName,re. I)                          if f.search (strpid):                             zabbixpid =  Strpid.split (' pid= ') [1].split (', ') [0]                                return zabbixpid                             zabbixpid = int ( ProcessInfo (sys.argv[1])             p =  psutil. Process (Zabbixpid) a, b = p.memory_info ()      #a为进程使用的实际内存rss, b for use of virtual memory Vmsprint a

Put the script in a directory, such as C:\script\, the name of the script is processzabbix.py, the execution of scripts to pass a parameter, both monitoring process names, such as Notepad++.exe


4. In the Zabbix configuration file, add:

Userparameter=manager_memory_usage, Python C:\script\processZabbix.py notepad++.exe

5. Restart the Zabbix client

You can get the value through the Zabbix_get command on the Zabbix server.


The CPU usage of the process can be monitored by psutil, as in the same way.

This article from "Three O elder brother" blog, declined reprint!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.