Added disk capacity to api
This commit is contained in:
parent
468a7c37b0
commit
8f28e7a096
1 changed files with 2 additions and 1 deletions
3
main.py
3
main.py
|
|
@ -60,7 +60,8 @@ def temps():
|
|||
|
||||
@app.route("/api/disks")
|
||||
def disks():
|
||||
out = subprocess.run(["iostat", "-d", "-o", "JSON"], capture_output = True, text = True).stdout
|
||||
out = '{"disks":[' + subprocess.getoutput("df -P --total -x squashfs | awk \'BEGIN {printf\"{\\\"discarray\\\":[\"}{if($1==\"Filesystem\")next;if(a)printf\",\";printf\"{\\\"mount\\\":\\\"\"$6\"\\\",\\\"size\\\":\\\"\"$2\"\\\",\\\"used\\\":\\\"\"$3\"\\\",\\\"avail\\\":\\\"\"$4\"\\\",\\\"use%\\\":\\\"\"$5\"\\\"}\";a++;}END{print\"]}\";}\'")
|
||||
out += "," + subprocess.run(["iostat", "-d", "-o", "JSON"], capture_output = True, text = True).stdout + "]}"
|
||||
return jsonify(remove_empty_lists(json.loads(out)))
|
||||
|
||||
@app.route("/api/memory")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue