How to use the mqttwarn.services.rrdtool.update function in mqttwarn

To help you get started, we’ve selected a few mqttwarn examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github jpmens / mqttwarn / mqttwarn / services / rrdtool.py View on Github external
# 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
github jpmens / mqttwarn / mqttwarn / services / rrdtool.py View on Github external
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