diff options
author | Emile Joubert <emile@rabbitmq.com> | 2010-09-24 14:29:34 +0100 |
---|---|---|
committer | Emile Joubert <emile@rabbitmq.com> | 2010-09-24 14:29:34 +0100 |
commit | c3a33bc31ef9e99a327e7a7b439c667a9e54dd9d (patch) | |
tree | f480bd30a5ea026058799f4ad87c647cf159dace | |
parent | 347ea71a8c20a8b76ccd753c4c4ab3fd30d5fb4d (diff) | |
download | rabbitmq-server-c3a33bc31ef9e99a327e7a7b439c667a9e54dd9d.tar.gz |
Query memory on AIXbug23290
(on the correct branch this time)
-rw-r--r-- | src/vm_memory_monitor.erl | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/vm_memory_monitor.erl b/src/vm_memory_monitor.erl index e658f005..220df4db 100644 --- a/src/vm_memory_monitor.erl +++ b/src/vm_memory_monitor.erl @@ -296,6 +296,12 @@ get_total_memory({unix, sunos}) -> Dict = dict:from_list(lists:map(fun parse_line_sunos/1, Lines)), dict:fetch('Memory size', Dict); +get_total_memory({unix, aix}) -> + File = cmd("/usr/bin/vmstat -v"), + Lines = string:tokens(File, "\n"), + Dict = dict:from_list(lists:map(fun parse_line_aix/1, Lines)), + dict:fetch('memory pages', Dict) * 4096; + get_total_memory(_OsType) -> unknown. @@ -341,6 +347,17 @@ parse_line_sunos(Line) -> [Name] -> {list_to_atom(Name), none} end. +%% Lines look like " 12345 memory pages" +%% or " 80.1 maxpin percentage" +parse_line_aix(Line) -> + [Value | NameWords] = string:tokens(Line, " "), + Name = string:join(NameWords, " "), + {list_to_atom(Name), + case lists:member($., Value) of + true -> trunc(list_to_float(Value)); + _ -> list_to_integer(Value) + end}. + freebsd_sysctl(Def) -> list_to_integer(cmd("/sbin/sysctl -n " ++ Def) -- "\n"). |