Community discussions

MikroTik App
 
brodie7838
just joined
Topic Author
Posts: 18
Joined: Thu Oct 20, 2011 5:10 pm

Can't get 'rounding' to work in The Dude

Tue Apr 20, 2021 5:21 am

I'm trying to monitor the toner levels in a HP JetDirect printer. There are two separate OID's needed per toner; one is the max level of the toner and the second is the current level. You're supposed to take the latter, divide it by the former, and multiply that by 100 to get the correct % value. I have all of that working and now I want to incorporate rounding to round up or down to the nearest whole value (eg 93.865632 to 94).

But I can't seem to get the rounding to work. Here's what I've tried (placing these in the Device's Appearance > Label):
[(oid("1.3.6.1.2.1.43.11.1.1.9.1.1"))/(oid("1.3.6.1.2.1.43.11.1.1.8.1.1"))*(100)]%          <works (no rounding)
[round(oid("1.3.6.1.2.1.43.11.1.1.9.1.1"))/(oid("1.3.6.1.2.1.43.11.1.1.8.1.1"))*(100)]%     <does not round
[round((oid("1.3.6.1.2.1.43.11.1.1.9.1.1"))/(oid("1.3.6.1.2.1.43.11.1.1.8.1.1")))*(100)]%   <returns 0%
Anyone have any ideas on what I'm missing?
 
brodie7838
just joined
Topic Author
Posts: 18
Joined: Thu Oct 20, 2011 5:10 pm

Re: Can't get 'rounding' to work in The Dude  [SOLVED]

Tue Apr 20, 2021 7:20 am

Thanks to /u/Ardric on Reddit for solving this:
[round((oid("1.3.6.1.2.1.43.11.1.1.9.1.1"))/(oid("1.3.6.1.2.1.43.11.1.1.8.1.1"))*(100))]%

Who is online

Users browsing this forum: No registered users and 4 guests