Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
# If the incoming payload has been transformed, use that,
# else the original payload
text = item.message
try:
# addrs is a list[] associated with a particular target.
# it can contain an arbitrary amount of entries that are just
# passed along to rrdtool
# mofified by otfdr @ github to accept abitray arguments with
# the payload and to not always add the 'N' in front
# 2017-06-05 - fix/enhancement for https://github.com/jpmens/mqttwarn/issues/248
if re.match( "^\d+$", text ):
rrdtool.update(item.addrs, "N:" + text)
else:
rrdtool.update(item.addrs + text.split())
except Exception as e:
srv.logging.warning("Cannot call rrdtool")
return False
return True
srv.logging.debug("*** MODULE=%s: service=%s, target=%s", __file__, item.service, item.target)
# If the incoming payload has been transformed, use that,
# else the original payload
text = item.message
try:
# addrs is a list[] associated with a particular target.
# it can contain an arbitrary amount of entries that are just
# passed along to rrdtool
# mofified by otfdr @ github to accept abitray arguments with
# the payload and to not always add the 'N' in front
# 2017-06-05 - fix/enhancement for https://github.com/jpmens/mqttwarn/issues/248
if re.match( "^\d+$", text ):
rrdtool.update(item.addrs, "N:" + text)
else:
rrdtool.update(item.addrs + text.split())
except Exception as e:
srv.logging.warning("Cannot call rrdtool")
return False
return True