Ejemplo n.º 1
0
def _checkDiskSpace():

    minspace = float(config.Config.mindiskspace)
    if minspace == 0.0:
        return

    for (node, dfs) in control.getDf(config.Config.nodes()).items():
        for df in dfs:
            fs = df[0]
            total = float(df[1])
            used = float(df[2])
            avail = float(df[3])
            perc = used * 100.0 / (used + avail)
            key = ("disk-space-%s%s" % (node, fs.replace("/", "-"))).lower()

            if perc > 100 - minspace:
                try:
                    if float(config.Config.state[key]) > 100 - minspace:
                        # Already reported.
                        continue
                except KeyError:
                    pass

                util.output("Disk space low on %s:%s - %.1f%% used." % (node, fs, perc))

            config.Config.state[key] = "%.1f" % perc
Ejemplo n.º 2
0
def _checkDiskSpace():

    minspace = float(config.Config.mindiskspace)
    if minspace == 0.0:
        return

    results = control.getDf(config.Config.hosts())
    for (nodehost, dfs) in results:
        host = nodehost.split("/")[1]

        for df in dfs:
            if df[0] == "FAIL":
                # A failure here is normally caused by a host that is down, so
                # we don't need to output the error message.
                continue

            fs = df[0]
            perc = df[4]
            key = ("disk-space-%s%s" % (host, fs.replace("/", "-"))).lower()

            if perc > 100 - minspace:
                if key in config.Config.state:
                    if float(config.Config.state[key]) > 100 - minspace:
                        # Already reported.
                        continue

                util.output("Disk space low on %s:%s - %.1f%% used." % (host, fs, perc))

            config.Config.state[key] = "%.1f" % perc
Ejemplo n.º 3
0
def _checkDiskSpace():

    minspace = float(config.Config.mindiskspace)
    if minspace == 0.0:
        return

    for (node, dfs) in control.getDf(config.Config.nodes()).items():
        for df in dfs:
            fs = df[0]
            total = float(df[1])
            used = float(df[2])
            avail = float(df[3])
            perc = used * 100.0 / (used + avail)
            key = "disk-space-%s%s" % (node, fs.replace("/", "-"))

            if perc > 100 - minspace:
                try:
                    if float(config.Config.state[key]) > 100 - minspace:
                        # Already reported.
                        continue
                except KeyError:
                    pass

                util.output("Disk space low on %s:%s - %.1f%% used." % (node, fs, perc))

            config.Config.state[key] = "%.1f" % perc