Egis
Neophyte
4 days agoComplex datapoint - groovy script to calculate the value from the device property
Hi All,
I have a case where I need to take AWS device property called ##system.aws.bandwidth## that can have values 1Gbps, 10Gbps or 50Gbps, convert it to bytes and return the value to the datapoint. I'm trying to use groovy script for complex datapoint but can't get it to work even with the most simple scripts: "Error Invalid enum value, must be EXPRESSION".
Example script:
if ('##system.aws.bandwidth##' == '1Gbps') {
return 1000000000
} else if ('##system.aws.bandwidth##' == '10Gbps') {
return 10000000000
} else if ('##system.aws.bandwidth##' == '50Gbps') {
return 50000000000
} else {
return 0
}
Has anyone tried to create something similar? What I'm doing wrong?
Thanks.