我正在使用工具 described here 对 Java 应用程序进行 SNMP 监控。
ACL 模板有一个关于格式的部分,描述了 access
和 managers
选项的含义:
##############################################################
# Format of the acl group
##############################################################
#
# communities: a list of SNMP community strings to which the
# access control applies separated by commas.
#
# access: either "read-only" or "read-write".
#
# managers: a list of hosts to be granted the access rights.
# Each can be expressed as any one of the following:
# - hostname: hubble
# - ip v4 and v6 addresses: 123.456.789.12 , fe80::a00:20ff:fe9b:ea82
# - ip v4 and v6 netmask prefix notation: 123.456.789.0/24,
# fe80::a00:20ff:fe9b:ea82/64
# see RFC 2373 (http://www.ietf.org/rfc/rfc2373.txt)
#
# An example of two community groups for multiple hosts:
# acl = {
# {
# communities = public, private
# access = read-only
# managers = hubble, snowbell, nanak
# }
# {
# communities = jerry
# access = read-write
# managers = hubble, telescope
# }
# }
如果我授予管理器access = read-write
,该管理器实际上可以在运行的 JVM 中写入或更改什么?
写访问是否允许管理器执行诸如触发 GC 或堆转储之类的操作?
最佳答案
您对 JVM SNMP 写入访问无能为力,但是可以调用 GC。
要查找 JVM 中可通过 SNMP 修改的所有内容,您可以浏览属于 JDK built-in SNMP server 的所有 Jvm*Meta
类。并寻找不平凡的 SnmpValue
setter :
public SnmpValue set(SnmpValue x, long var, Object data)
以下是 JDK 8u121 中所有可写 OID 的列表以及相应的 JMX 方法:
-
ClassLoadingMXBean.setVerbose
(1.3.6.1.4.1.42.2.145.3.163.1.1.1.4) -
MemoryMXBean.setVerbose
(1.3.6.1.4.1.42.2.145.3.163.1.1.2.2) -
MemoryMXBean.gc
(1.3.6.1.4.1.42.2.145.3.163.1.1.2.3) -
MemoryPoolMXBean.setCollectionUsageThreshold
(1.3.6.1.4.1.42.2.145.3.163.1.1.2.110.1.131) -
MemoryPoolMXBean.setUsageThreshold
(1.3.6.1.4.1.42.2.145.3.163.1.1.2.110.1.110) -
MemoryPoolMXBean.resetPeakUsage
(1.3.6.1.4.1.42.2.145.3.163.1.1.2.110.1.5) -
ThreadMXBean.setThreadContentionMonitoringEnabled
(1.3.6.1.4.1.42.2.145.3.163.1.1.3.5) -
ThreadMXBean.setThreadCpuTimeEnabled
(1.3.6.1.4.1.42.2.145.3.163.1.1.3.6) -
ThreadMXBean.resetPeakThreadCount
(1.3.6.1.4.1.42.2.145.3.163.1.1.3.7)
关于java - 使用 JVM SNMP 功能的读写访问可以做什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41967535/