diff options
Diffstat (limited to 'lib/os_mon/src/disksup.erl')
-rw-r--r-- | lib/os_mon/src/disksup.erl | 30 |
1 files changed, 25 insertions, 5 deletions
diff --git a/lib/os_mon/src/disksup.erl b/lib/os_mon/src/disksup.erl index f5f76f1488..278da26a20 100644 --- a/lib/os_mon/src/disksup.erl +++ b/lib/os_mon/src/disksup.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1996-2012. All Rights Reserved. +%% Copyright Ericsson AB 1996-2013. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -263,10 +263,10 @@ check_disk_space({unix, dragonfly}, Port, Threshold) -> Result = my_cmd("/bin/df -k -t ufs,hammer", Port), check_disks_solaris(skip_to_eol(Result), Threshold); check_disk_space({unix, freebsd}, Port, Threshold) -> - Result = my_cmd("/bin/df -k -t ufs", Port), + Result = my_cmd("/bin/df -k -l", Port), check_disks_solaris(skip_to_eol(Result), Threshold); check_disk_space({unix, openbsd}, Port, Threshold) -> - Result = my_cmd("/bin/df -k -t ffs", Port), + Result = my_cmd("/bin/df -k -l", Port), check_disks_solaris(skip_to_eol(Result), Threshold); check_disk_space({unix, netbsd}, Port, Threshold) -> Result = my_cmd("/bin/df -k -t ffs", Port), @@ -275,8 +275,8 @@ check_disk_space({unix, sunos4}, Port, Threshold) -> Result = my_cmd("df", Port), check_disks_solaris(skip_to_eol(Result), Threshold); check_disk_space({unix, darwin}, Port, Threshold) -> - Result = my_cmd("/bin/df -k -t ufs,hfs", Port), - check_disks_solaris(skip_to_eol(Result), Threshold). + Result = my_cmd("/bin/df -i -k -t ufs,hfs", Port), + check_disks_susv3(skip_to_eol(Result), Threshold). % This code works for Linux and FreeBSD as well check_disks_solaris("", _Threshold) -> @@ -298,6 +298,26 @@ check_disks_solaris(Str, Threshold) -> check_disks_solaris(skip_to_eol(Str),Threshold) end. +% Parse per SUSv3 specification, notably recent OS X +check_disks_susv3("", _Threshold) -> + []; +check_disks_susv3("\n", _Threshold) -> + []; +check_disks_susv3(Str, Threshold) -> + case io_lib:fread("~s~d~d~d~d%~d~d~d%~s", Str) of + {ok, [_FS, KB, _Used, _Avail, Cap, _IUsed, _IFree, _ICap, MntOn], RestStr} -> + if + Cap >= Threshold -> + set_alarm({disk_almost_full, MntOn}, []); + true -> + clear_alarm({disk_almost_full, MntOn}) + end, + [{MntOn, KB, Cap} | + check_disks_susv3(RestStr, Threshold)]; + _Other -> + check_disks_susv3(skip_to_eol(Str),Threshold) + end. + %% Irix: like Linux with an extra FS type column and no '%'. check_disks_irix("", _Threshold) -> []; check_disks_irix("\n", _Threshold) -> []; |