5/8/2023 0 Comments Zabbix process monitoring![]() ![]() #Private memory for each process is sent to Zabbix $ws = “- perprocess.WS ” + $objItem.WorkingSet #The working set for each process is sent to Zabbix #The CPU% values will then be sent to Zabbix ![]() #Finally, we calculate the subtraction between each process t1 and t0 and we’ll divide it by the wait time and the number of logical processors to get the CPU% time $nrproc = (Get-WmiObject “Win32_ComputerSystem”).numberoflogicalprocessors #To be able to calculate the CPU% time we will need to get the number of logical processors on our $val1.Add($objItem.Id,$proccputime3.TotalSeconds) ![]() ![]() $proccputime3 = ::FromSeconds(($proc.UserModeTime + $proc.KernelModeTime) / 10000000) #Get the processes that run on the machine from a certain path # The keys parameter determines whether the script will populate items or retrieve values The script will contain two parts, one that populates Zabbix hosts with the desired items and the second one which will retrieve the values for these items: I will just paste the code and explain each line so you can understand the logic behind my script. Note that I’ve used Windows PowerShell Integrated Scripting Environment (ISE) which helps you a lot in developing Powershell scripts. Data will be send to Zabbix monitoring System in Json format. In this article I will show you how to use Windows Powershell to implement per process monitoring and calculate CPU % and memory usage of your Windows Servers. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |