Ad Widget

Collapse

CPU load percentage

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Villain
    Member
    • Aug 2006
    • 84

    #1

    CPU load percentage

    Is it possible to get the CPU load percentage, instead of a decimal value (0.01, etc.)?

    I would like to know if I'm using 10% of the CPU or 100% of the CPU, instead of the values that I am currently receiving. This would be similar to the Windows Task Manager value, only for the linux agent.

    Is there a key for this?
  • Villain
    Member
    • Aug 2006
    • 84

    #2
    nvm, I think I found it. Testing out: system.cpu.util[<cpu> <,type> <,mode>]

    Comment

    • ravibhure
      Junior Member
      • Aug 2008
      • 7

      #3
      Petition for someone to fix the unix agents so we can get total cpu utilization
      in the meantime, you can create an item such as the following to get cpu usage:
      system.run[sar -P ALL 1 2 | grep 'Average.*all' | awk -F" " '{ print 100.0-$NF }']

      you have to enable remote commands on agent

      Comment

      • bbrendon
        Senior Member
        • Sep 2005
        • 870

        #4
        You can delete your system.cpu.load items and replace with this gem

        system.run[echo $((10#`cut -d' ' -f1 /proc/loadavg|tr -d .`/`grep -c processor /proc/cpuinfo`))]

        You're welcome. That'll be $110 (1 hr minimum)
        Last edited by bbrendon; 07-10-2008, 20:22.
        Unofficial Zabbix Expert
        Blog, Corporate Site

        Comment

        • ittec
          Member
          • Mar 2008
          • 73

          #5
          Really?

          Hi

          Im really interested about last answer. Is this output of echo a trust feedback of what is happening at cpu level on linux machine?

          If is yes, is very good! Can someone confirm that?

          Thanks!

          Comment

          • rue
            Member
            Zabbix Certified Specialist
            • May 2006
            • 43

            #6
            Originally posted by ittec
            Hi

            Im really interested about last answer. Is this output of echo a trust feedback of what is happening at cpu level on linux machine?

            If is yes, is very good! Can someone confirm that?

            Thanks!
            Well, I'd say it's sort of interesting, but not quite correct (or I didn't get it ). Let's see:

            "cut -d' ' -f1 /proc/loadavg|tr -d ." will give you load average of the machine without decimal point, eg.: load of 1.29 will give you 129.

            "grep -c processor /proc/cpuinfo" will give you the number of processors installed.

            The rest is for calculating, so basically we have:

            result=(load without decimal point)/(number of processors)

            Hm, don't know, what exactly should be meassured with that... . Not CPU Usage I assume ... .

            I'd try sar, as mentioned above, but you need to enable sar (sysstat) on the machine you want to meassure on... .

            cheers



            PS: this one worked for me on Ubuntu 8.10 Zabbix-Agent 1.6.4:

            as Userparameter: linux.cpu.usage,sar -P ALL 1 2 | grep 'Average.*all' | awk -F' ' '{ print 100.0-$NF }'
            Last edited by rue; 20-04-2009, 16:53. Reason: moved to Userparam

            Comment

            • bbrendon
              Senior Member
              • Sep 2005
              • 870

              #7
              What I posted is CPU load as a percent which was the original request.

              It uses bash to do the math conversion.
              Unofficial Zabbix Expert
              Blog, Corporate Site

              Comment

              • rue
                Member
                Zabbix Certified Specialist
                • May 2006
                • 43

                #8
                Originally posted by bbrendon
                What I posted is CPU load as a percent which was the original request.
                OK, my misconception was, that I assumed max CPU-Load could only be 100%. For reference: Load under UNIX is a bit more sophisticated than that and gives you a lot more details for capacity planing.

                For anybody interested: http://www.teamquest.com/resources/g...ay/5/index.htm

                Always nice to learn something

                cheers

                Comment

                Working...