Ad Widget

Collapse

snmp - create item for total cpu usage across server

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • brdr
    Junior Member
    • Apr 2014
    • 13

    #1

    snmp - create item for total cpu usage across server

    Hello,

    I'm using Zabbix v2.2.3. I'm trying to create an item using snmpv2 that shows a single percentage for total CPU utilization across a multi-core Linux system. How can I achieve this in Zabbix?

    Please let me know. Thanks!


    CPU related OIDs (NOTE: not one for total cpu util across server)
    percentage of user CPU time: .1.3.6.1.4.1.2021.11.9.0
    raw user cpu time: .1.3.6.1.4.1.2021.11.50.0
    percentages of system CPU time: .1.3.6.1.4.1.2021.11.10.0
    raw system cpu time: .1.3.6.1.4.1.2021.11.52.0
    percentages of idle CPU time: .1.3.6.1.4.1.2021.11.11.0
    raw idle cpu time: .1.3.6.1.4.1.2021.11.53.0
    raw nice cpu time: .1.3.6.1.4.1.2021.11.51.0
  • steveboyson
    Senior Member
    • Jul 2013
    • 582

    #2
    Why not use "Template SNMP Processors"?

    CPU Load (1 min)
    UCD-SNMP-MIB::laLoad.1

    CPU Load (5 min)
    UCD-SNMP-MIB::laLoad.2

    systemLoad.min15
    UCD-SNMP-MIB::laLoad.3

    Comment

    • brdr
      Junior Member
      • Apr 2014
      • 13

      #3
      Thanks for the reply.

      I do not see an item in Template SNMP Processors for total CPU utilization at the server level, only at individual CPU.

      These items you pointed out represent load on the system, not CPU utilization.

      Comment

      • steveboyson
        Senior Member
        • Jul 2013
        • 582

        #4
        Well, then invent a formula for calculating the value out of the previously mentioned SNMP counters and apply that via a "calculated item".

        Comment

        • aib
          Senior Member
          • Jan 2014
          • 1615

          #5
          Take a look on script "check SNMP CPU load"
          It can give you some hints or even you can use it as external script for Zabbix.
          Sincerely yours,
          Aleksey

          Comment

          • brdr
            Junior Member
            • Apr 2014
            • 13

            #6
            Thanks for the hint steveboyson!

            Zabbix has item prototype in Template SNMP Processors as:

            Its name is : 'Utilization of processor #$1'
            Its key is: hrProcessorLoad[{#SNMPINDEX}]
            Its OID is: HOST-RESOURCES-MIB::hrProcessorLoad.{#SNMPINDEX}
            This item prototype grabs individual CPUs utilization. I can see utilization for each in CPU in Latest Data.

            I need help in with defining the right key and formula for the new calculated item for total CPU at server level. How would I do this?

            Thanks

            Comment

            • aib
              Senior Member
              • Jan 2014
              • 1615

              #7
              In my case I have four CPU cores.
              Attached Files
              Sincerely yours,
              Aleksey

              Comment

              • brdr
                Junior Member
                • Apr 2014
                • 13

                #8
                Thanks aib for the reply.

                The problem here is that we have hundreds of linux servers that range from 1 cpu to 24 cpus. The formula needs to be created dynamicaly in a way to account for varying CPUs across a given server. With your approach (which is helpful) i would have to know the number of CPUs (which could change) for each server, then assign the appropriate item to that server.

                We have other tools that provide SNMP total CPU utilization across a server, a very important metric (much more useful that individual CPU metric). We just want Zabbix to produce it too.

                Comment

                • aib
                  Senior Member
                  • Jan 2014
                  • 1615

                  #9
                  Well, if you have "a power of scripting", you can create an external script which will
                  - take two parameters (community string & IP_address)
                  - send SNMP request to IP_address to collect data about ALL CPU usage and quantity of CPU's
                  - calculate the final, average CPU usage
                  - return one number - CPU usage across the server

                  After you will have such a nice external script, you can create additional Item in "Template OS Linux" which will collect CPU usage across the server using your own external script. Also you can include some triggers (CPU usage more than 90% for last 90 days!!!) and Graphs.

                  Then you can apply your tuned template to as many Linux servers as you like.

                  Keep in mind that nothing can stop you from using the external scripts made for different Monitoring system (for example, Check CPU Usage over SNMP for Nagios) with a small polishing. (ex. reduce output to only one number without any additional text/formatting/etc)
                  Sincerely yours,
                  Aleksey

                  Comment

                  • brdr
                    Junior Member
                    • Apr 2014
                    • 13

                    #10
                    Thanks Aleksey! Appreciate the responses back from you and steveboyson.

                    I look forward to getting into External Checks.

                    For now, I've created an item that retreives the value for UCD-SNMP-MIB::ssCpuIdle.0 (.1.3.6.1.4.1.2021.11.11.0). Then created another calculated item that uses this formula:

                    100 - last (ssCpuIdle.0)

                    This gets me total cpu utilization.

                    Cheers

                    Comment

                    Working...