Ad Widget

Collapse

What's taking up CPU usage?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • authex
    Member
    • Jan 2014
    • 32

    #1

    What's taking up CPU usage?

    Hi there,
    I am trying to come up with a simple way to receive email notifications with additional information on a particular server.

    So far I have an item/trigger/action sending notifications when 80% of CPU Util is reached, but how would I go about adding the process that is using more than 20% CPU Util? (Windows Server 2008 R2)

    Thanks!
  • coreychristian
    Senior Member
    Zabbix Certified Specialist
    • Jun 2012
    • 159

    #2
    So you would need two items to do something like this.

    Item 1 - track the cpu utilization
    Item 2 - track the processes running over 20%

    Then you would need to create a trigger where Item1 > 80% and Item2 is null or contains data.

    Then you should be able to use the macro {ITEM.VALUE2} to display the text in your notification.

    Here is an example powershell that might help as well.

    Code:
    get-wmiobject Win32_PerfFormattedData_PerfProc_Process | select name,  PercentProcessorTime | where { $_.PercentProcessorTime -gt 20 -and $_.name -ne "Idle" -and $_.name -ne "_Total" } | select name

    Comment

    • authex
      Member
      • Jan 2014
      • 32

      #3
      Thanks for the reply coreychristian,
      I have Item1 already set (system.cpu.util[0,system,avg1]) how would I go about creating Item2?

      Comment

      • coreychristian
        Senior Member
        Zabbix Certified Specialist
        • Jun 2012
        • 159

        #4
        Originally posted by authex
        Thanks for the reply coreychristian,
        I have Item1 already set (system.cpu.util[0,system,avg1]) how would I go about creating Item2?
        I would deploy a powershell script to the hosts you wanted to run it against.

        Then I would either setup a UserParameter on the agents to run the script, run the script locally via a task scheduler and use zabbix sender to insert the data.

        Option 1 would be a normal character/text zabbix agent item, option 2 would be a trapper item.

        Comment

        • authex
          Member
          • Jan 2014
          • 32

          #5
          Originally posted by coreychristian
          I would deploy a powershell script to the hosts you wanted to run it against.

          Then I would either setup a UserParameter on the agents to run the script, run the script locally via a task scheduler and use zabbix sender to insert the data.

          Option 1 would be a normal character/text zabbix agent item, option 2 would be a trapper item.
          sorry coreychristian,
          I don't think I quite understand; I have a batch file that displays what I need, I can run it locally and it works well.
          Code:
          (wmic path win32_perfformatteddata_perfproc_process where (PercentProcessorTime ^> 50) get Name, Caption, PercentProcessorTime, IDProcess /format:list)
          I guess the question is, when the CPU spikes, how would I get that entry to display in Zabbix?

          I know that using zabbix_sender would send it to my Zabbix server, but I've tried the following command that it hasn't worked for me:
          Code:
          C:\zabbix_sender -c zabbix_agentd.conf -i highcpuprocess.bat
          Server Response: info from server: "processed: 0; failed: 1; total: 1; seconds spent: 0.000031"
          sent: 1; skipped: 0; total: 1

          is there something I'm missing? Also, how would I get this particular response to my specific item?

          Sorry for being such a n00b.

          Comment

          • coreychristian
            Senior Member
            Zabbix Certified Specialist
            • Jun 2012
            • 159

            #6
            So for zabbix sender to work, you will need to create a trapper item that is configured text/character data. I think in this case though it would be easier for you to use a user parameter.

            Also I don't think you can use '-i' on zabbix sender to run a batch file, it requires a specifically formatted file.

            So since you already have the batch file here is what I would do.

            Edit your zabbix_agentd.conf with the following line.

            Assuming your batch is on the root of your D drive.

            UserParameter=highcpu.process,D:\highcpuprocess.ba t

            Then on the zabbix server, configure a 'zabbix agent' item for the specified host with 'highcpu.process' as the item key and 'text' as the data type, and configure it with a similar interval to your cpu utilization item.

            Once you have that let me know and I can assist with the trigger you will need.

            Here is the link to the zabbix documentation for user parameters.

            Last edited by coreychristian; 03-02-2015, 22:45.

            Comment

            Working...