SNMP defines hrSystemUptime RFC2790-Host Resources MIB, but hrSystemUptime returns to 0 in approximately 497 days (one count up every 1/100 seconds).4294967295/100/3600/24=>497)
Therefore, I am thinking of using the value obtained from /proc/uptime.Use the left of the two values shown below.
%cat/proc/uptime
24939.24 78721.83
Also, the uptime command seems to use the /proc/uptime value (https://gitlab.com/procps-ng/procps/blob/master/uptime.c#L47 https://gitlab.com/procps-ng/procps/blob/master/proc/sysinfo.c#L106).
And I'm thinking of adding a new private MIB and defining SYNTAX in the MIB as Counter64.
In a Linux implementation, the value to the left of /proc/uptime is obtained in tv_sec and output in unsigned long (linux/uptime.cat master·torvalds/linux).For 64-bit CPUs, unsigned long is a 64-bit representation of the 64MP bit.
Selfless
yes
RFC 2578 7.1.10.Counter64 For https://www.rfc-editor.org/rfc/rfc2578#section-7.1.10, use
It only says
yes
The value ASN_COUNTER64 is used for snmp_set_var_value().
https://sourceforge.net/p/net-snmp/code/ci/master/tree/snmplib/snmp_client.c#l968
Since the implementation sets the value to structure counter64, pass the structure counter64 to snmp_set_var_value().
structure counter64 is defined in asn1.h.
https://sourceforge.net/p/net-snmp/code/ci/master/tree/include/net-snmp/library/asn1.h#l79
structure counter64 {
u_long high;
u_long low;
};
u_long is unsigned long
© 2024 OneMinuteCode. All rights reserved.