Skip to Content
GuidesUse casesCheck every machine from a program

Check every machine from a program

One program walks your machines and prints the memory available and the disk space left on each. It only reads, so the agent token it uses needs no extra classes.

When to use this

A cron job, a status page or a script that should notice a full disk before you do.

Steps

  1. Install the SDK (Python or TypeScript).

  2. Create an agent token on your page and set the two variables. Treat the token like a password.

  3. Run:

    import cmdop with cmdop.connect() as c: # CMDOP_TOKEN, CMDOP_URL for m in c.machines_list(): if m.state != "online": continue info = c.machine(m.name).sys_info() root = next(d for d in info.disks if d.mount == "/") print(m.name, info.memory_available // 2**20, "MiB available,", root.available // 2**30, "GiB left on /")

Check

One line per online machine, with numbers you can compare with the system’s own settings.

If it fails

sys_info · Use from your product · Tokens