NMIS Graphs showing fractional number while integers expected

NMIS is collecting a value throw SNMP. The value came as an integer number. 

But the graph shows fractional numbers, the same as they are saved in the RRD file. Why is this happening?

RRD saves the data in a timed period. As the rate periods are not always constant, RRD has a "Normalisation" phase where it normalises the data obtained and the intervals. It usually makes an average about the expected result based in other collected values. 

This behaviour is explained more detailed in the following link.

How can we change this?

This is how RRD works. But if you need to show integer numbers, we can manipulate how this data is shown in the graphs, doing some calculations. 

There are a couple of functions for this purpose:

  • FLOOR, CEIL: Round down or up to the nearest integer.

In the following example we can see how to use them: 

 'DEF:monkey=$database:monkey:AVERAGE',
 'DEF:banana=$database:banana:LAST',
  
 'CDEF:monkeywhole=monkey,CEIL',
 'CDEF:bananawhole=banana,FLOOR',

 'LINE1:monkeywhole#00CED1:monkey',
 'GPRINT:monkeywhole:AVERAGE:Current %3.0lf',
 'GPRINT:monkeywhole:MIN:Min. %3.0lf',
 'GPRINT:monkeywhole:AVERAGE:Avg. %3.0lf',

Another important thing to remark is how these numbers are formatted. In this case, %3.0lf means: Show 3 digits in the integer, show 0 digits as the fraction.