Skip to content

Commit

Permalink
[task]support more window metrics (#676)
Browse files Browse the repository at this point in the history
Co-authored-by: hudongdong <hudongdong9406@zto.com>
  • Loading branch information
hudongdong129 and hudongdong authored Feb 27, 2023
1 parent c97e76d commit 85a63ac
Show file tree
Hide file tree
Showing 2 changed files with 107 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,6 @@ public class SnmpCollectImpl extends AbstractCollect {

private final Map<Integer, Snmp> versionSnmpService = new ConcurrentHashMap<>(3);

public SnmpCollectImpl() {
}

@Override
public void collect(CollectRep.MetricsData.Builder builder, long appId, String app, Metrics metrics) {
Expand Down Expand Up @@ -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) {
Expand All @@ -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");
}
Expand Down
105 changes: 104 additions & 1 deletion manager/src/main/resources/define/app/app-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ metrics:
- field: responseTime
type: 0
unit: ms
- field: location
type: 1
protocol: snmp
snmp:
host: ^_^host^_^
Expand All @@ -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
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

0 comments on commit 85a63ac

Please sign in to comment.