From nobody Tue Dec 19 17:37:48 2023 X-Original-To: freebsd-stable@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4SvkRn2Rb9z54cNn; Tue, 19 Dec 2023 17:37:57 +0000 (UTC) (envelope-from yuri@aetern.org) Received: from out5-smtp.messagingengine.com (out5-smtp.messagingengine.com [66.111.4.29]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4SvkRm3Mppz4KXc; Tue, 19 Dec 2023 17:37:56 +0000 (UTC) (envelope-from yuri@aetern.org) Authentication-Results: mx1.freebsd.org; dkim=pass header.d=aetern.org header.s=fm1 header.b=kdq5cZSd; dkim=pass header.d=messagingengine.com header.s=fm2 header.b="o nYHKwh"; spf=pass (mx1.freebsd.org: domain of yuri@aetern.org designates 66.111.4.29 as permitted sender) smtp.mailfrom=yuri@aetern.org Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id 7F59D5C01EF; Tue, 19 Dec 2023 12:37:55 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute3.internal (MEProxy); Tue, 19 Dec 2023 12:37:55 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aetern.org; h=cc :cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm1; t=1703007475; x=1703093875; bh=sb8fs01Mh8HeVd6w507W10o2R7WDFMcrVklUOg21L4I=; b= kdq5cZSdxsCVHVyNrl+BjbOQc3Cxpa7SHxYbVu3q8JCtfEcGUR7OcWIUGdAlfP5C 5aYVgcvNW14KmEiMIvPETilubvsG0R1fK8kSEdDn48LQElZYH3XeH6k/sHejqdnl sV3yBZzjDx297FkAGtBc3boXPzNmXLLY1yt8VtqguJ5tZktLf0+rYHAyWGm8HE69 MhTT6i+waVzN4wMHrAYdvgjg7JhoE63qiZX9ykZn0IxknZCN9n/67ETMkommMSFL 1EIZ4RPRk8dzLA3fMVusKoZ6XcuIOMYpfsYnGvjVswl/Wq6+40Dq8BdHZp/0A/oz /UgZZRD+2qRGD9T5+69tQA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=1703007475; x= 1703093875; bh=sb8fs01Mh8HeVd6w507W10o2R7WDFMcrVklUOg21L4I=; b=o nYHKwhgOqv4EXqbD8jORgcy6TtOeNUDtgYPkNDgF45hFy+9IuoaiZgTbhCoGVjIr thETd6JScUdj3BYqw1AELSbCCRFyRhkzpr5Ey/DTzKfaLUBq7M0gNSoRwPJDxFDx yVt3i8Xysd6d7OMycV1Yzm14LTKUfQRAiN1kC4pAJRcp1I40rbNI4d1v3uE4I+5Q SZHotE2x14ek+gJuIrl2pXrp35msGnl1xR0ZmvTAUAhb9Dlu86ER2cPjfYHjTdCU 6XCs1ff67xhOiIj7Nr2okq9MAhhOIwuFVqvo7Q5SLyy/NhDeaVJqyzYkQSEzF+xu 4N8NDbJbA29Qbi46K66ag== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrvddutddguddtudcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpefkffggfgfuhffvvehfjggtgfesthejredttddvjeenucfhrhhomhepjghu rhhiuceohihurhhisegrvghtvghrnhdrohhrgheqnecuggftrfgrthhtvghrnhepgeekte duudeluefgieeihefguddvgedvveethfduieetkeetgfdufefgfffgvedtnecuvehluhhs thgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhephihurhhisegrvghtvg hrnhdrohhrgh X-ME-Proxy: Feedback-ID: i0d79475b:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 19 Dec 2023 12:37:53 -0500 (EST) Message-ID: <5f884312-4a66-43d6-b0bc-b3d70c4337ab@aetern.org> Date: Wed, 20 Dec 2023 00:37:48 +0700 List-Id: Production branch of FreeBSD source code List-Archive: https://lists.freebsd.org/archives/freebsd-stable List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-stable@freebsd.org X-BeenThere: freebsd-stable@freebsd.org MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Odd values for various memory metrics via SNMP Content-Language: en-US From: Yuri To: "Patrick M. Hausen" Cc: FreeBSD-STABLE Mailing List , FreeBSD Net References: <1EDAF2AC-3A2B-43BE-B66B-E095F5A80C2C@punkt.de> <84B7C7D7-BC06-4944-A7E0-5AFC47B6BC0E@punkt.de> <8f4cf72e-8320-4bfd-a4d9-3db34db4580d@aetern.org> In-Reply-To: <8f4cf72e-8320-4bfd-a4d9-3db34db4580d@aetern.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Rspamd-Pre-Result: action=no action; module=multimap; Matched map: local_wl_from X-Spamd-Result: default: False [-0.39 / 15.00]; R_SPF_ALLOW(-0.20)[+ip4:66.111.4.29]; R_DKIM_ALLOW(-0.20)[aetern.org:s=fm1,messagingengine.com:s=fm2]; XM_UA_NO_VERSION(0.01)[]; DKIM_TRACE(0.00)[aetern.org:+,messagingengine.com:+]; ASN(0.00)[asn:19151, ipnet:66.111.4.0/24, country:US]; local_wl_from(0.00)[yuri@aetern.org] X-Spamd-Bar: / X-Rspamd-Queue-Id: 4SvkRm3Mppz4KXc Yuri wrote: > Patrick M. Hausen wrote: >> HI Yuri, >> >>> Am 19.12.2023 um 09:50 schrieb Yuri : >>> Let's start with OIDs, which ones exactly you are looking at (numeric or >>> textual will do)? >> >> To start I'll post the 4 odd ones of my OPNsense system, FreeBSD 13.2-p7, net-snmp 5.9.1_4,1: > > OK, guess the following (physical memory) looks correct for you as well? > > --- > HOST-RESOURCES-MIB::hrStorageIndex.1 = INTEGER: 1 > HOST-RESOURCES-MIB::hrStorageType.1 = OID: > HOST-RESOURCES-TYPES::hrStorageRam > HOST-RESOURCES-MIB::hrStorageDescr.1 = STRING: Physical memory > HOST-RESOURCES-MIB::hrStorageAllocationUnits.1 = INTEGER: 4096 Bytes > HOST-RESOURCES-MIB::hrStorageSize.1 = INTEGER: 4183816 > HOST-RESOURCES-MIB::hrStorageUsed.1 = INTEGER: 1499092 > HOST-RESOURCES-MIB::hrStorageAllocationFailures.1 = Counter32: 0 > --- > >> HOST-RESOURCES-MIB::hrStorageIndex.2 = INTEGER: 2 >> HOST-RESOURCES-MIB::hrStorageType.2 = OID: HOST-RESOURCES-TYPES::hrStorageRam >> HOST-RESOURCES-MIB::hrStorageDescr.2 = STRING: Real memory >> HOST-RESOURCES-MIB::hrStorageAllocationUnits.2 = INTEGER: 4096 Bytes >> HOST-RESOURCES-MIB::hrStorageSize.2 = INTEGER: 191414 >> HOST-RESOURCES-MIB::hrStorageUsed.2 = INTEGER: 189988 >> HOST-RESOURCES-MIB::hrStorageAllocationFailures.2 = Counter32: 0 >> --- >> HOST-RESOURCES-MIB::hrStorageIndex.9 = INTEGER: 9 >> HOST-RESOURCES-MIB::hrStorageType.9 = OID: HOST-RESOURCES-TYPES::hrStorageOther >> HOST-RESOURCES-MIB::hrStorageDescr.9 = STRING: Shared real memory >> HOST-RESOURCES-MIB::hrStorageAllocationUnits.9 = INTEGER: 4096 Bytes >> HOST-RESOURCES-MIB::hrStorageSize.9 = INTEGER: 25627 >> HOST-RESOURCES-MIB::hrStorageUsed.9 = INTEGER: 24175 >> HOST-RESOURCES-MIB::hrStorageAllocationFailures.9 = Counter32: 0 >> --- >> HOST-RESOURCES-MIB::hrStorageIndex.8 = INTEGER: 8 >> HOST-RESOURCES-MIB::hrStorageType.8 = OID: HOST-RESOURCES-TYPES::hrStorageOther >> HOST-RESOURCES-MIB::hrStorageDescr.8 = STRING: Shared virtual memory >> HOST-RESOURCES-MIB::hrStorageAllocationUnits.8 = INTEGER: 4096 Bytes >> HOST-RESOURCES-MIB::hrStorageSize.8 = INTEGER: 54962 >> HOST-RESOURCES-MIB::hrStorageUsed.8 = INTEGER: 41268 >> HOST-RESOURCES-MIB::hrStorageAllocationFailures.8 = Counter32: 0 >> --- >> HOST-RESOURCES-MIB::hrStorageIndex.3 = INTEGER: 3 >> HOST-RESOURCES-MIB::hrStorageType.3 = OID: HOST-RESOURCES-TYPES::hrStorageVirtualMemory >> HOST-RESOURCES-MIB::hrStorageDescr.3 = STRING: Virtual memory >> HOST-RESOURCES-MIB::hrStorageAllocationUnits.3 = INTEGER: 4096 Bytes >> HOST-RESOURCES-MIB::hrStorageSize.3 = INTEGER: 1279129 >> HOST-RESOURCES-MIB::hrStorageUsed.3 = INTEGER: 1258824 >> HOST-RESOURCES-MIB::hrStorageAllocationFailures.3 = Counter32: 0 > > I took a look at FreeBSD-specific interface for getting memory values > (agent/mibgroup/hardware/memory/memory_freebsd.c) and all it does is > parsing the following sysctl (vm.vmtotal) output: > > --- > vm.vmtotal: > System wide totals computed every five seconds: (values in kilobytes) > =============================================== > Processes: (RUNQ: 2 Disk Wait: 0 Page Wait: 0 Sleep: 30) > Virtual Memory: (Total: 538434716K Active: 538414860K) > Real Memory: (Total: 78488K Active: 75752K) > Shared Virtual Memory: (Total: 52052K Active: 32236K) > Shared Real Memory: (Total: 27284K Active: 24588K) > Free Memory: 9474964K > --- > > So I guess what net-snmp reports makes sense and the only value that > should be used for alerts is that "physical memory" one. OTOH, using the other way to get these values (the code checks for VM_TOTAL define) seems to provide somewhat saner values, try editing agent/mibgroup/hardware/memory/memory_freebsd.c after doing `make patch` and add the #undef as below (not providing diff output as it won't make much sense here): --- #if HAVE_SYS_VMPARAM_H #include #else #include #endif #undef VM_TOTAL ---