diff --git a/collector/src/main/java/com/usthe/collector/collect/snmp/SnmpCollectImpl.java b/collector/src/main/java/com/usthe/collector/collect/snmp/SnmpCollectImpl.java index f83369f2eed..84709845b76 100644 --- a/collector/src/main/java/com/usthe/collector/collect/snmp/SnmpCollectImpl.java +++ b/collector/src/main/java/com/usthe/collector/collect/snmp/SnmpCollectImpl.java @@ -63,8 +63,6 @@ public class SnmpCollectImpl extends AbstractCollect { private final Map versionSnmpService = new ConcurrentHashMap<>(3); - public SnmpCollectImpl() { - } @Override public void collect(CollectRep.MetricsData.Builder builder, long appId, String app, Metrics metrics) { @@ -143,7 +141,7 @@ public void collect(CollectRep.MetricsData.Builder builder, long appId, String a builder.addValues(valueRowBuilder.build()); } catch (ExecutionException | InterruptedException ex) { String errorMsg = CommonUtil.getMessageFromThrowable(ex); - log.info("[snmp collect] error: {}", errorMsg); + log.warn("[snmp collect] error: {}", errorMsg, ex); builder.setCode(CollectRep.Code.UN_CONNECTABLE); builder.setMsg(errorMsg); } catch (Exception e) { @@ -159,7 +157,8 @@ public String supportProtocol() { return DispatchConstants.PROTOCOL_SNMP; } - private void validateParams(Metrics metrics) throws Exception { + + private void validateParams(Metrics metrics) { if (metrics == null || metrics.getSnmp() == null) { throw new IllegalArgumentException("Snmp collect must has snmp params"); } diff --git a/manager/src/main/resources/define/app/app-windows.yml b/manager/src/main/resources/define/app/app-windows.yml index d2b83d8ce93..61d4154bd4d 100644 --- a/manager/src/main/resources/define/app/app-windows.yml +++ b/manager/src/main/resources/define/app/app-windows.yml @@ -49,6 +49,8 @@ metrics: - field: responseTime type: 0 unit: ms + - field: location + type: 1 protocol: snmp snmp: host: ^_^host^_^ @@ -62,4 +64,105 @@ metrics: uptime: 1.3.6.1.2.1.25.1.1.0 numUsers: 1.3.6.1.2.1.25.1.5.0 services: 1.3.6.1.2.1.1.7.0 - processes: 1.3.6.1.2.1.25.1.6.0 \ No newline at end of file + processes: 1.3.6.1.2.1.25.1.6.0 + location: 1.3.6.1.2.1.1.6.0 + + - name: cpu + priority: 1 + fields: + - field: userCpu + type: 1 + - field: kernalCPU + type: 1 + - field: ssCpuRawUser + type: 1 + - field: ssCpuRawSystem + type: 1 + - field: ssCpuRawIdle + type: 1 + protocol: snmp + snmp: + host: ^_^host^_^ + port: ^_^port^_^ + timeout: ^_^timeout^_^ + community: ^_^community^_^ + version: ^_^version^_^ + oids: + userCpu: 1.3.6.1.4.1.2021.11.9.0 + kernalCPU: 1.3.6.1.4.1.2021.11.10.0 + cpu: 1.3.6.1.4.1.2021.11.11.0 + ssCpuRawUser: 1.3.6.1.4.1.2021.11.50.0 + ssCpuRawSystem: 1.3.6.1.4.1.2021.11.52.0 + ssCpuRawIdle: 1.3.6.1.4.1.2021.11.53.0 + + - name: memory + priority: 2 + fields: + - field: size + type: 1 + - field: swapSize + type: 1 + - field: availSwapSize + type: 1 + - field: totalRAM + type: 1 + - field: usedRAM + type: 1 + - field: freeRAM + type: 1 + - field: sharedRAM + type: 1 + - field: bufferedRAM + type: 1 + protocol: snmp + snmp: + host: ^_^host^_^ + port: ^_^port^_^ + timeout: ^_^timeout^_^ + community: ^_^community^_^ + version: ^_^version^_^ + oids: + size: 1.3.6.1.2.1.25.2.2.0 + swapSize: 1.3.6.1.4.1.2021.4.3.0 + availSwapSize: 1.3.6.1.4.1.2021.4.4.0 + totalRAM: 1.3.6.1.4.1.2021.4.5.0 + usedRAM: 1.3.6.1.4.1.2021.4.6.0 + freeRAM: 1.3.6.1.4.1.2021.4.11.0 + sharedRAM: 1.3.6.1.4.1.2021.4.13.0 + bufferedRAM: 1.3.6.1.4.1.2021.4.14.0 + + - name: disk + priority: 3 + fields: + - field: dskPath + type: 1 + - field: dskDevice + type: 1 + - field: dskTotal + type: 1 + protocol: snmp + snmp: + host: ^_^host^_^ + port: ^_^port^_^ + timeout: ^_^timeout^_^ + community: ^_^community^_^ + version: ^_^version^_^ + oids: + dskPath: 1.3.6.1.4.1.2021.9.1.2 + dskDevice: 1.3.6.1.4.1.2021.9.1.3 + dskTotal: 1.3.6.1.4.1.2021.9.1.6 + + - name: network + priority: 4 + fields: + - field: number + type: 1 + protocol: snmp + snmp: + host: ^_^host^_^ + port: ^_^port^_^ + timeout: ^_^timeout^_^ + community: ^_^community^_^ + version: ^_^version^_^ + oids: + number: 1.3.6.1.2.1.2.1.0