Changeset 37cace23f4db0b3b8de90f72ebec6308e97f991a
- Timestamp:
- 02/18/10 17:32:01
(3 years ago)
- Author:
- Mark Harrison <mark@omniti.com>
- git-committer:
- Mark Harrison <mark@omniti.com> 1266514321 +0000
- git-parent:
[0e5f64d7572f24c142e6ef6357ee94733dad2b54]
- git-author:
- Mark Harrison <mark@omniti.com> 1266514321 +0000
- Message:
Provide more metrics for the disk check
git-svn-id: https://labs.omniti.com/resmon/trunk@236 8c0face9-b7db-6ec6-c4b3-d5f7145c7d55
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| rdacf135 |
r37cace2 |
|
| 11 | 11 | my $output = cache_command("$dfcmd $devorpart", 120); |
|---|
| 12 | 12 | my ($line) = grep(/$devorpart\s*/, split(/\n/, $output)); |
|---|
| 13 | | if($line =~ /(\d+)\s+(\d+)%/) { |
|---|
| | 13 | if($line =~ /(\d+)\s+(\d+)\s+(\d+)%/) { |
|---|
| 14 | 14 | $status = "OK"; |
|---|
| 15 | 15 | # Check free space for an exact value in KB |
|---|
| 16 | | if(exists $arg->{'minkbfree'} && $1 < $arg->{'minkbfree'}) { |
|---|
| | 16 | if(exists $arg->{'minkbfree'} && $2 < $arg->{'minkbfree'}) { |
|---|
| 17 | 17 | $status = "BAD"; |
|---|
| 18 | 18 | } |
|---|
| 19 | | if(exists $arg->{'warnkbfree'} && $1 < $arg->{'warnkbfree'}) { |
|---|
| | 19 | if(exists $arg->{'warnkbfree'} && $2 < $arg->{'warnkbfree'}) { |
|---|
| 20 | 20 | $status = "WARNING"; |
|---|
| 21 | 21 | } |
|---|
| 22 | 22 | # Check for percentage used and alert over that value |
|---|
| 23 | | if(exists $arg->{'limit'} && $2 > $arg->{'limit'}) { |
|---|
| | 23 | if(exists $arg->{'limit'} && $3 > $arg->{'limit'}) { |
|---|
| 24 | 24 | $status = "BAD"; |
|---|
| 25 | 25 | } |
|---|
| 26 | | if(exists $arg->{'warnat'} && $2 > $arg->{'warnat'}) { |
|---|
| | 26 | if(exists $arg->{'warnat'} && $3 > $arg->{'warnat'}) { |
|---|
| 27 | 27 | $status = "WARNING" |
|---|
| 28 | 28 | } |
|---|
| 29 | | return $status, "$2% full -- $1KB free"; |
|---|
| | 29 | return $status, { |
|---|
| | 30 | "message" => "$3% full -- $2KB free", |
|---|
| | 31 | "usedkb" => "$1", |
|---|
| | 32 | "freekb" => "$2", |
|---|
| | 33 | "usedpercent" => "$3" |
|---|
| | 34 | } |
|---|
| 30 | 35 | } |
|---|
| 31 | 36 | return "BAD", "0 -- no data"; |
|---|