From owner-freebsd-questions@FreeBSD.ORG Tue Nov 30 17:23:39 2010 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DC86A1065672 for ; Tue, 30 Nov 2010 17:23:39 +0000 (UTC) (envelope-from dan@dan.emsphone.com) Received: from email2.allantgroup.com (email2.emsphone.com [199.67.51.116]) by mx1.freebsd.org (Postfix) with ESMTP id 856A78FC14 for ; Tue, 30 Nov 2010 17:23:39 +0000 (UTC) Received: from dan.emsphone.com (dan.emsphone.com [199.67.51.101]) by email2.allantgroup.com (8.14.4/8.14.4) with ESMTP id oAUHNc1I034481 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 30 Nov 2010 11:23:38 -0600 (CST) (envelope-from dan@dan.emsphone.com) Received: from dan.emsphone.com (smmsp@localhost [127.0.0.1]) by dan.emsphone.com (8.14.4/8.14.4) with ESMTP id oAUHNcJp096763 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 30 Nov 2010 11:23:38 -0600 (CST) (envelope-from dan@dan.emsphone.com) Received: (from dan@localhost) by dan.emsphone.com (8.14.4/8.14.4/Submit) id oAUHNcGM096762; Tue, 30 Nov 2010 11:23:38 -0600 (CST) (envelope-from dan) Date: Tue, 30 Nov 2010 11:23:38 -0600 From: Dan Nelson To: kes-kes@yandex.ru Message-ID: <20101130172338.GJ58734@dan.emsphone.com> References: <7810389687.20101130091836@yandex.ru> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <7810389687.20101130091836@yandex.ru> X-OS: FreeBSD 8.1-STABLE User-Agent: Mutt/1.5.21 (2010-09-15) X-Virus-Scanned: clamav-milter 0.96.4 at email2.allantgroup.com X-Virus-Status: Clean X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.2.6 (email2.allantgroup.com [199.67.51.78]); Tue, 30 Nov 2010 11:23:38 -0600 (CST) X-Scanned-By: MIMEDefang 2.68 on 199.67.51.78 Cc: freebsd-questions@freebsd.org Subject: Re: snmp cpu X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Nov 2010 17:23:40 -0000 In the last episode (Nov 30): > Hi, > reading this: > http://old.nabble.com/Measuring-CPU-usage-via-SNMP-td23392403.html > > > So fetching the matching ssCpuRaw* oids and totaling them up should > > always equal 100% cpu. > > but when I fetch cpurawidle it is about 100, system 25 > totalling give me 125. What wrong I do? Hey! I recognize that post :) Note that ssCpuRawSystem is a synthetic value that net-snmp generates by adding ssCpuRawKernel and ssCpuRawInterrupt. If you are doing the totalling yourself, you should ignore it, or you'll be counting kernel time twice. In case anyone else reading is unclear: Totalling the raw values always gives 100% cpu, but the units aren't percent; they're ticks. You may get a different total on different machines, depending on Hz and the number of CPUs. If you want to graph the values as percentages, you'll need to record the previous values for each variable, then sum the differences to get the total number of ticks for your sampling period. Then divide each variable's difference by that total to get a percentage. Raw values on my machine using a ~ 5-second sampling period: User Nice Idle Kernel Interrupt 14993233 67689938 1943767096 171721693 11277468 14993237 67690250 1943768892 171722224 11277487 14993246 67690357 1943770991 171722649 11277495 Deltas: 4 312 1796 531 19 Total: 2662 9 107 2099 425 8 Total: 2648 Percent: 0.2 11.7 67.5 19.9 0.7 0.3 4.0 79.3 16.0 0.3 -- Dan Nelson dnelson@allantgroup.com