Search code examples
pythonrrdtool

Python RRDTool update error Function update_pdp_prep, case DST_GAUGE - Cannot convert '' to float


def updateRRD(self,fname,value):
        PATH_TO_RRD_FILES = "/home/nms/SNMP-DATA/RRD-DB/" 
        rrdtool.update(str(PATH_TO_RRD_FILES)+str(fname)+".rrd","N:"+str(value))

Above is my rrdtool update function that takes value returned by snmp commands(value) and the filename in the db.

At first it was running but now it always shows this error and as i m new to this tool aI cant figure it out.

Any suggestions?


Solution

  • The error message indicates that, while rrdupdate needs a floating-point value, it in fact received nothing.

    I suspect that value is null or blank, and so str(value) is blank, resulting in this error.

    You need to have additional logic so that a null/unknown value is converted to 'U', which rrdupdate can handle correctly.