def fetch_smb_statistics(self):
        measurements = {0: "clients", 2: "file_locks"}
        data = []
        now = int(time())
        this_node = None
        (status, raw_data) = getstatusoutput("/usr/bin/ctdb status")
        if status == 0:
            for line in raw_data.split("\n"):
                if line.find("THIS NODE") > 0:
                    this_node = line.split()[0].split(":")[1]
            if this_node is None: return
        (status, raw_data) = getstatusoutput("/usr/bin/smbstatus")
        if status != 0: return data
        for i, block in enumerate(raw_data.split("\n\n")):
            if i not in measurements.keys(): continue
            raw_data = block.split("\n")
            if this_node is not None: 
                this_node_count = [line.startswith(this_node + ":") for line in raw_data].count(True)
            else:
                this_node_count = len(raw_data) - 4
            if this_node_count < 0: this_node_count = 0
            data.append("smb.%s %d %d" % (measurements[i], this_node_count, now))
        return data
dataset/ETHPy150Open tmm1/graphite/contrib/demo-collector.py/Host.fetch_smb_statistics/original