I've written a python module for ganglia that is returning response times. The raw times look like this:

0.0120489597321

I parse this with my python module and return the time as such:

return int(response_time)

If I run the script with python, it works fine:

[ DEBUG ]: returning: 0.0120489597321

However, gmond (ganglia) runs this module and it rounds the result to 0.0000. I am classifying it as a uint.

I've tried to return it as a float, and as long... but both methods of provided the same results. Anyone have any ideas here?

link|improve this question
feedback

1 Answer

Err - the int cast returns an integer. Not a float or decimal number. Not sure where that debug line is coming from, but it's probably coming back from a point before the int cast:

Python 2.5.5 (r255:77872, Nov 28 2010, 19:00:19) 
[GCC 4.4.5] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> int(0.0120489597321)
0

Python 2.7.1+ (r271:86832, Apr 11 2011, 18:13:53) 
[GCC 4.5.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> int(0.0120489597321)
0

Python 3.2 (r32:88445, Mar 25 2011, 19:56:22) 
[GCC 4.5.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> int(0.0120489597321)
0
link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.