Ad Widget

Collapse

Does Zabbix have the capability to identify top 10 process usage on a system

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • pmurtey
    Member
    • Mar 2020
    • 91

    #1

    Does Zabbix have the capability to identify top 10 process usage on a system

    Hi All,
    Does Zabbix out of the box have the capability to select a host, and have it identify what the top cpu using processes are that are running on that system?
    TIA
  • pmurtey
    Member
    • Mar 2020
    • 91

    #2
    We are looking to have the alert when cpu utilization go above 90% to generate the alert currently in place, but add to the (email) alert the top 5 processes running at the time of the alert. Can anyone share how we can go about doing this?

    Comment

    • vladimir_lv
      Senior Member
      • May 2022
      • 240

      #3
      Hi!
      You can create a bash script, for example, ps_cpu.sh like this:

      Code:
      #!/usr/bin/bash
      ps -eo pcpu,pid,user,args | sort -k 1 -r | head -5 | awk '
      BEGIN { ORS = ""; print " [ "}
      { printf "%s{\"user\": \"%s\", \"pid\": \"%s\", \"cpu\": \"%s\"}",
      separator, $1, $2, $3
      separator = ", "
      }
      END { print " ] " }';
      This bash script converts ps output to JSON.

      Then add the line to the agent's config and restart the agent:
      Code:
      UserParameter=high.cpu.topprocess, /etc/zabbix/ps_cpu.sh
      Create a new item for the host =high.cpu.topprocess and a new trigger. Set dependency from your CPU 90% trigger there.

      Comment

      • pmurtey
        Member
        • Mar 2020
        • 91

        #4
        Hi Vladimir, We will definitely give this a try. Just to be clear, the script itself and the change to the config, has to be performed individually on each system? Correct?

        Comment


        • vladimir_lv
          vladimir_lv commented
          Editing a comment
          Yes, it should be created for each host on the agent side.
      Working...