Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GetLinuxMem计算有误,导致负数 #8

Open
anhzhi opened this issue Aug 27, 2018 · 0 comments
Open

GetLinuxMem计算有误,导致负数 #8

anhzhi opened this issue Aug 27, 2018 · 0 comments

Comments

@anhzhi
Copy link

anhzhi commented Aug 27, 2018

代码位置: https://github.com/huanghuiru/sw/blob/028da948b98bb9195f8e00fdefa0308fdedc45df/memstat.go#L229
参考资料:
http://www.oidview.com/mibs/2021/UCD-SNMP-MIB.html
测试用例:

snmpwalk -v 2c -c public 127.0.0.1  1.3.6.1.4.1.2021.4
UCD-SNMP-MIB::memIndex.0 = INTEGER: 0
UCD-SNMP-MIB::memErrorName.0 = STRING: swap
UCD-SNMP-MIB::memTotalSwap.0 = INTEGER: 31249404 kB
UCD-SNMP-MIB::memAvailSwap.0 = INTEGER: 27851824 kB
UCD-SNMP-MIB::memTotalReal.0 = INTEGER: 32917640 kB
UCD-SNMP-MIB::memAvailReal.0 = INTEGER: 9685384 kB
UCD-SNMP-MIB::memTotalFree.0 = INTEGER: 37537208 kB
UCD-SNMP-MIB::memMinimumSwap.0 = INTEGER: 16000 kB
UCD-SNMP-MIB::memShared.0 = INTEGER: 5092 kB
UCD-SNMP-MIB::memBuffer.0 = INTEGER: 783476 kB
UCD-SNMP-MIB::memCached.0 = INTEGER: 3598188 kB
UCD-SNMP-MIB::memSwapError.0 = INTEGER: noError(0)
UCD-SNMP-MIB::memSwapErrorMsg.0 = STRING: 

修改建议:
oid修改为: 1.3.6.1.4.1.2021.4.6.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant