Subject: |
RE: User-supplied Python expression ((here.speed or 1e9) / 8 * .90) |
Author: |
Michael Rogers |
Posted: |
2021-05-27 19:46 |
Marcos,
I think the UI is lying to us a bit.
The code responsible for displaying interface speeds in the UI is correctly interpreting the interface speed and displaying "30.0Mb/s." What your variable declarations inserted into your code, however, wasn't a number; it was a string.
As a demonstration, here's me declaring 3 different speed variables and then multiplying each one by 10:
In [1]: speed1 = 1000
In [2]: speed2 = 100000
In [3]: speed3 = '10000000'
In [4]: speed1 * 10
Out[4]: 10000
In [5]: speed2 * 10
Out[5]: 1000000
In [6]: speed3 * 10
Out[6]: '10000000100000001000000010000000100000001000000010000000100000001000000010000000'
Your threshold is attempting to divide a string instead of a number which Python doesn't appreciate. You can run back through your zendmd code to reset the values, or you can alter your threshold expression to:
((int(here.speed) or 1e9) / 8 * .90)
I would recommend running back through the script over changing an out-of-box template.
I hope that helps!
------------------------------
Michael J. Rogers
Senior Instructor - Zenoss
Austin TX
------------------------------