()
| 21 | |
| 22 | |
| 23 | def main(): |
| 24 | entries = getHealthChecksData("systemThresholds") |
| 25 | data = {} |
| 26 | if entries is not None and len(entries) == 1: |
| 27 | data = entries[0] |
| 28 | |
| 29 | if "minDiskNeeded" not in data: |
| 30 | print("Missing minDiskNeeded in health_checks_data systemThresholds, skipping") |
| 31 | exit(3) |
| 32 | |
| 33 | minDiskNeeded = float(data["minDiskNeeded"]) * 1024 |
| 34 | s = statvfs('/') |
| 35 | freeSpace = (s.f_bavail * s.f_frsize) / 1024 |
| 36 | |
| 37 | if (freeSpace < minDiskNeeded): |
| 38 | print("Insufficient free space is " + str(freeSpace/1024) + " MB") |
| 39 | exit(1) |
| 40 | else: |
| 41 | print("Sufficient free space is " + str(freeSpace/1024) + " MB") |
| 42 | exit(0) |
| 43 | |
| 44 | |
| 45 | if __name__ == "__main__": |
no test coverage detected