diff options
Diffstat (limited to 'meta-webserver/recipes-webadmin/ajenti/ajenti/0003-plugins-sysload-fix-to-work-with-busybox.patch')
-rw-r--r-- | meta-webserver/recipes-webadmin/ajenti/ajenti/0003-plugins-sysload-fix-to-work-with-busybox.patch | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/meta-webserver/recipes-webadmin/ajenti/ajenti/0003-plugins-sysload-fix-to-work-with-busybox.patch b/meta-webserver/recipes-webadmin/ajenti/ajenti/0003-plugins-sysload-fix-to-work-with-busybox.patch new file mode 100644 index 000000000..1efec9b92 --- /dev/null +++ b/meta-webserver/recipes-webadmin/ajenti/ajenti/0003-plugins-sysload-fix-to-work-with-busybox.patch | |||
@@ -0,0 +1,47 @@ | |||
1 | From 552c46fb22fe336175c42612c33ceb0828ddd6aa Mon Sep 17 00:00:00 2001 | ||
2 | From: Paul Eggleton <paul.eggleton@linux.intel.com> | ||
3 | Date: Tue, 13 Mar 2012 01:54:09 +0000 | ||
4 | Subject: [PATCH 2/2] plugins/sysload: fix to work with busybox | ||
5 | |||
6 | The busybox free command does not support -b, so specify -k (which is | ||
7 | also ignored, but will help if real "free" is being used) and multiply | ||
8 | kb values by 1024. | ||
9 | |||
10 | Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> | ||
11 | --- | ||
12 | plugins/sysload/ss_linux.py | 18 +++++++++++------- | ||
13 | 1 files changed, 11 insertions(+), 7 deletions(-) | ||
14 | |||
15 | diff --git a/plugins/sysload/ss_linux.py b/plugins/sysload/ss_linux.py | ||
16 | index cab7708..be60c53 100644 | ||
17 | --- a/plugins/sysload/ss_linux.py | ||
18 | +++ b/plugins/sysload/ss_linux.py | ||
19 | @@ -11,14 +11,18 @@ class LinuxSysStat(Plugin): | ||
20 | return open('/proc/loadavg', 'r').read().split()[0:3] | ||
21 | |||
22 | def get_ram(self): | ||
23 | - s = shell('free -b | grep Mem').split()[1:] | ||
24 | - t = int(s[0]) | ||
25 | - u = int(s[1]) | ||
26 | - b = int(s[4]) | ||
27 | - c = int(s[5]) | ||
28 | + # busybox free doesn't support -b | ||
29 | + s = shell('free -k | grep Mem').split()[1:] | ||
30 | + t = int(s[0]) * 1024 | ||
31 | + u = int(s[1]) * 1024 | ||
32 | + b = int(s[4]) * 1024 | ||
33 | + if len(s) > 5: | ||
34 | + c = int(s[5]) * 1024 | ||
35 | + else: | ||
36 | + c = 0 | ||
37 | u -= c + b; | ||
38 | return (u, t) | ||
39 | |||
40 | def get_swap(self): | ||
41 | - s = shell('free -b | grep Swap').split()[1:] | ||
42 | - return (int(s[1]), int(s[0])) | ||
43 | + s = shell('free -k | grep Swap').split()[1:] | ||
44 | + return (int(s[1]) * 1024, int(s[0]) * 1024) | ||
45 | -- | ||
46 | 1.7.4.4 | ||
47 | |||