aboutsummaryrefslogtreecommitdiffstats
path: root/meta-webserver/recipes-webadmin/ajenti/ajenti/0002-plugins-hddstat-fix-disk-usage-check-to-work-with-bu.patch
blob: 48c255dbb126bd41344354a6f0499006de0d851c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
From cde811cfffba48c148b60fb1083fe8fd409b8b24 Mon Sep 17 00:00:00 2001
From: Paul Eggleton <paul.eggleton@linux.intel.com>
Date: Tue, 13 Mar 2012 01:52:34 +0000
Subject: [PATCH 1/2] plugins/hddstat: fix disk usage check to work with
 busybox

busybox df does not have --total, so fake it using awk.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
---
 plugins/hddstat/usage.py |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/plugins/hddstat/usage.py b/plugins/hddstat/usage.py
index 3c84181..cf5f037 100644
--- a/plugins/hddstat/usage.py
+++ b/plugins/hddstat/usage.py
@@ -7,7 +7,7 @@ class DiskUsageMeter(LinearMeter):
     transform = 'percent'
     
     def get_usage(self):
-        u = int(shell('df --total | grep total').split().pop().strip('%'))
+        u = int(round(float(shell("df -P | awk 'NR > 1 {total+=$3+$4 ; used+=$3} END { print used/total*100}'").strip())))
         return u
     
     def get_value(self):
-- 
1.7.4.4