cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
2221
Views
0
Helpful
2
Replies

Help with large counters

rychaney
Cisco Employee
Cisco Employee

Hi,

As part of an EEM script I am collecting the bytes downloaded on my WAN interface, formatting it and using it to create a banner with the monthly usage. The numbers get quite large and I am getting the following message:

%HA_EM-6-FMPD_OPERAND_INVALID: Invalid operand in action, expected value within range -2147483648 to 2147483647, received: 4824555627

Is there anyway around this?

Ryan

Author - Securing Enterprise Networks with Cisco Meraki
https://www.ciscopress.com/store/securing-enterprise-networks-with-cisco-meraki-9780138298180
2 Replies 2

Rolf Fischer
Level 11
Level 11

Hi Ryan,

I don't know it it's recommendable, but if you really want to do calculations with such large numbers, you could use floating-point values instead of integers:

R1(tcl)#set x 4824555627

4824555627

R1(tcl)#puts [expr $x]

integer value too large to represent

R1(tcl)#puts [expr [format "%.1f" $x]]

4824555627.0

R1(tcl)#puts [expr [format "%.1f" $x] * 10]

48245556270.0

Perhaps you should wait a while for other answers or a confirmation as I'm not very experienced with TCL.

Regards

Rolf

Yep, this is the way to go.  You need to use Tcl, and you need to convert to floating point.  One easy way to do the conversion is with:

set num "${num}.0"

Then you can operate on $num like an FP.  This doesn't work with applets, so Tcl is the only way to go.