bigcyy commented on issue #3384: URL: https://github.com/apache/hertzbeat/issues/3384#issuecomment-2900022409
> > 在协议级别,收集的指标映射到 aliasField - value,然后使用计算表达式进一步处理以生成 realField - realValue。如果我正确理解了代码,希望这对您有所帮助。 > > ``` > > fields: > > - field: myStatus > > type: 1 > > i18n: > > zh-CN: 状态 > > en-US: Status > > > > aliasFields: > > - memoryDeviceStatus > > > > calculates: > > - myStatus = (memoryDeviceStatus == 1 ? "ABSENT" : (memoryDeviceStatus == 2 ? "OK" : (memoryDeviceStatus == 3 ? "WARNING" : "CRITICAL"))) > > ``` > > > > > > > > > > > > > > > > > > > > > > > > 指: > > > > * [SnmpCollectImpl.java](https://github.com/apache/hertzbeat/blob/master/hertzbeat-collector/hertzbeat-collector-basic/src/main/java/org/apache/hertzbeat/collector/collect/snmp/SnmpCollectImpl.java) > > * [MetricsCollect.java calculateFields](https://github.com/apache/hertzbeat/blob/master/hertzbeat-collector/hertzbeat-collector-collector/src/main/java/org/apache/hertzbeat/collector/dispatch/MetricsCollect.java) > >  或许这是一个不太正确的写法? ``` "myStatus = (memoryDeviceStatus == 1 ? 'ABSENT' : (memoryDeviceStatus == 2 ? 'OK' : (memoryDeviceStatus == 3 ? 'WARNING' : 'CRITICAL')))" ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
