Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-12-SP1:Update
net-snmp.22266
net-snmp-5.7.3-ucd-snmp-mib-add-64-bit-mem-obj....
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File net-snmp-5.7.3-ucd-snmp-mib-add-64-bit-mem-obj.patch of Package net-snmp.22266
From 0dc151a72ce495d3d94704efba609505e465292b Mon Sep 17 00:00:00 2001 From: Niels Baggesen <nba@users.sourceforge.net> Date: Mon, 13 Jun 2016 16:50:08 +0200 Subject: [PATCH] UCD-SNMP-MIB: Add 64-bit memory objects for large servers. --- agent/mibgroup/ucd-snmp/memory.c | 100 +++++++++++++++++++++++++++++++-- agent/mibgroup/ucd-snmp/memory.h | 9 +++ mibs/UCD-SNMP-MIB.txt | 116 ++++++++++++++++++++++++++++++++++++++- 3 files changed, 220 insertions(+), 5 deletions(-) diff --git a/agent/mibgroup/ucd-snmp/memory.c b/agent/mibgroup/ucd-snmp/memory.c index 742186f3a..a7f060a50 100644 --- a/agent/mibgroup/ucd-snmp/memory.c +++ b/agent/mibgroup/ucd-snmp/memory.c @@ -26,7 +26,7 @@ init_memory(void) netsnmp_create_handler_registration("memory", handle_memory, memory_oid, OID_LENGTH(memory_oid), HANDLER_CAN_RONLY), - 1, 17); + 1, 26); netsnmp_register_scalar( netsnmp_create_handler_registration("memSwapError", handle_memory, memSwapError_oid, OID_LENGTH(memSwapError_oid), @@ -59,7 +59,9 @@ handle_memory(netsnmp_mib_handler *handler, netsnmp_request_info *requests) { netsnmp_memory_info *mem_info; - int val; + unsigned long val; + struct counter64 c64; + int type = ASN_INTEGER; char buf[1024]; /* @@ -184,6 +186,92 @@ handle_memory(netsnmp_mib_handler *handler, val = (mem_info->size - mem_info->free); /* cached */ val *= (mem_info->units/1024); break; + case MEMORY_SWAP_TOTAL_X: + type = ASN_COUNTER64; + mem_info = netsnmp_memory_get_byIdx( NETSNMP_MEM_TYPE_SWAP, 0 ); + if (!mem_info) + goto NOSUCH; + val = mem_info->size; + val *= (mem_info->units/1024); + c64.low = val & 0xFFFFFFFF; + c64.high = val >>32; + break; + case MEMORY_SWAP_AVAIL_X: + type = ASN_COUNTER64; + mem_info = netsnmp_memory_get_byIdx( NETSNMP_MEM_TYPE_SWAP, 0 ); + if (!mem_info) + goto NOSUCH; + val = mem_info->free; + val *= (mem_info->units/1024); + c64.low = val & 0xFFFFFFFF; + c64.high = val >>32; + break; + case MEMORY_REAL_TOTAL_X: + type = ASN_COUNTER64; + mem_info = netsnmp_memory_get_byIdx( NETSNMP_MEM_TYPE_PHYSMEM, 0 ); + if (!mem_info) + goto NOSUCH; + val = mem_info->size; + val *= (mem_info->units/1024); + c64.low = val & 0xFFFFFFFF; + c64.high = val >>32; + break; + case MEMORY_REAL_AVAIL_X: + type = ASN_COUNTER64; + mem_info = netsnmp_memory_get_byIdx( NETSNMP_MEM_TYPE_PHYSMEM, 0 ); + if (!mem_info) + goto NOSUCH; + val = mem_info->free; + val *= (mem_info->units/1024); + c64.low = val & 0xFFFFFFFF; + c64.high = val >>32; + break; + case MEMORY_SWAP_MIN_X: + type = ASN_COUNTER64; + val = minimum_swap; + c64.low = val & 0xFFFFFFFF; + c64.high = val >>32; + break; + case MEMORY_FREE_X: + type = ASN_COUNTER64; + mem_info = netsnmp_memory_get_byIdx( NETSNMP_MEM_TYPE_VIRTMEM, 0 ); + if (!mem_info) + goto NOSUCH; + val = mem_info->free; + val *= (mem_info->units/1024); + c64.low = val & 0xFFFFFFFF; + c64.high = val >>32; + break; + case MEMORY_SHARED_X: + type = ASN_COUNTER64; + mem_info = netsnmp_memory_get_byIdx( NETSNMP_MEM_TYPE_SHARED, 0 ); + if (!mem_info) + goto NOSUCH; + val = mem_info->size; + val *= (mem_info->units/1024); + c64.low = val & 0xFFFFFFFF; + c64.high = val >>32; + break; + case MEMORY_BUFFER_X: + type = ASN_COUNTER64; + mem_info = netsnmp_memory_get_byIdx( NETSNMP_MEM_TYPE_MBUF, 0 ); + if (!mem_info) + goto NOSUCH; + val = mem_info->size - mem_info->free; + val *= (mem_info->units/1024); + c64.low = val & 0xFFFFFFFF; + c64.high = val >>32; + break; + case MEMORY_CACHED_X: + type = ASN_COUNTER64; + mem_info = netsnmp_memory_get_byIdx( NETSNMP_MEM_TYPE_CACHED, 0 ); + if (!mem_info) + goto NOSUCH; + val = mem_info->size - mem_info->free; + val *= (mem_info->units/1024); + c64.low = val & 0xFFFFFFFF; + c64.high = val >>32; + break; case MEMORY_SWAP_ERROR: mem_info = netsnmp_memory_get_byIdx( NETSNMP_MEM_TYPE_SWAP, 0 ); if (!mem_info) @@ -213,8 +301,12 @@ NOSUCH: * All non-integer objects (and errors) have already been * processed. So return the integer value. */ - snmp_set_var_typed_value(requests->requestvb, ASN_INTEGER, - (u_char *)&val, sizeof(val)); + if (type == ASN_INTEGER) + snmp_set_var_typed_value(requests->requestvb, ASN_INTEGER, + (u_char *)&val, sizeof(val)); + else + snmp_set_var_typed_value(requests->requestvb, ASN_COUNTER64, + (u_char *)&c64, sizeof(c64)); break; default: diff --git a/agent/mibgroup/ucd-snmp/memory.h b/agent/mibgroup/ucd-snmp/memory.h index a44d82e51..ded214022 100644 --- a/agent/mibgroup/ucd-snmp/memory.h +++ b/agent/mibgroup/ucd-snmp/memory.h @@ -32,6 +32,15 @@ Netsnmp_Node_Handler handle_memory; #define MEMORY_CACHED 15 #define MEMORY_STXT_USED 16 #define MEMORY_RTXT_USED 17 +#define MEMORY_SWAP_TOTAL_X 18 +#define MEMORY_SWAP_AVAIL_X 19 +#define MEMORY_REAL_TOTAL_X 20 +#define MEMORY_REAL_AVAIL_X 21 +#define MEMORY_FREE_X 22 +#define MEMORY_SWAP_MIN_X 23 +#define MEMORY_SHARED_X 24 +#define MEMORY_BUFFER_X 25 +#define MEMORY_CACHED_X 26 #define MEMORY_SWAP_ERROR 100 #define MEMORY_SWAP_ERRMSG 101 #endif /* MEMORY_H */ diff --git a/mibs/UCD-SNMP-MIB.txt b/mibs/UCD-SNMP-MIB.txt index e8acc8c0d..cde67feb5 100644 --- a/mibs/UCD-SNMP-MIB.txt +++ b/mibs/UCD-SNMP-MIB.txt @@ -33,11 +33,14 @@ IMPORTS Integer32, Opaque, enterprises, Counter32, Unsigned32 FROM SNMPv2-SMI + CounterBasedGauge64 + FROM HCNUM-TC + TEXTUAL-CONVENTION, DisplayString, TruthValue FROM SNMPv2-TC; ucdavis MODULE-IDENTITY - LAST-UPDATED "201407310000Z" + LAST-UPDATED "201606100000Z" ORGANIZATION "University of California, Davis" CONTACT-INFO "This mib is no longer being maintained by the University of @@ -55,6 +58,10 @@ ucdavis MODULE-IDENTITY DESCRIPTION "This file defines the private UCD SNMP MIB extensions." + REVISION "201606100000Z" + DESCRIPTION + "New 64-bit memory objects" + REVISION "201407310000Z" DESCRIPTION "New object for number of CPUs as counted by the agent" @@ -632,6 +639,113 @@ memUsedRealTXT OBJECT-TYPE pages from other uses of physical memory." ::= { memory 17 } +memTotalSwapX OBJECT-TYPE + SYNTAX CounterBasedGauge64 + UNITS "kB" + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The total amount of swap space configured for this host." + ::= { memory 18 } + +memAvailSwapX OBJECT-TYPE + SYNTAX CounterBasedGauge64 + UNITS "kB" + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The amount of swap space currently unused or available." + ::= { memory 19 } + +memTotalRealX OBJECT-TYPE + SYNTAX CounterBasedGauge64 + UNITS "kB" + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The total amount of real/physical memory installed + on this host." + ::= { memory 20 } + +memAvailRealX OBJECT-TYPE + SYNTAX CounterBasedGauge64 + UNITS "kB" + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The amount of real/physical memory currently unused + or available." + ::= { memory 21 } + + +memTotalFreeX OBJECT-TYPE + SYNTAX CounterBasedGauge64 + UNITS "kB" + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The total amount of memory free or available for use on + this host. This value typically covers both real memory + and swap space or virtual memory." + ::= { memory 22 } + +memMinimumSwapX OBJECT-TYPE + SYNTAX CounterBasedGauge64 + UNITS "kB" + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The minimum amount of swap space expected to be kept + free or available during normal operation of this host. + + If this value (as reported by 'memAvailSwap(4)') falls + below the specified level, then 'memSwapError(100)' will + be set to 1 and an error message made available via + 'memSwapErrorMsg(101)'." + ::= { memory 23 } + +memSharedX OBJECT-TYPE + SYNTAX CounterBasedGauge64 + UNITS "kB" + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The total amount of real or virtual memory currently + allocated for use as shared memory. + + This object will not be implemented on hosts where the + underlying operating system does not explicitly identify + memory as specifically reserved for this purpose." + ::= { memory 24 } + +memBufferX OBJECT-TYPE + SYNTAX CounterBasedGauge64 + UNITS "kB" + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The total amount of real or virtual memory currently + allocated for use as memory buffers. + + This object will not be implemented on hosts where the + underlying operating system does not explicitly identify + memory as specifically reserved for this purpose." + ::= { memory 25 } + +memCachedX OBJECT-TYPE + SYNTAX CounterBasedGauge64 + UNITS "kB" + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The total amount of real or virtual memory currently + allocated for use as cached memory. + + This object will not be implemented on hosts where the + underlying operating system does not explicitly identify + memory as specifically reserved for this purpose." + ::= { memory 26 } + memSwapError OBJECT-TYPE SYNTAX UCDErrorFlag MAX-ACCESS read-only -- 2.16.4
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor