Changeset db0d94e2c95fb4b8565a345193809127b3f2f2b0
- Timestamp:
- 04/24/10 18:27:46
(8 years ago)
- Author:
- Jason Dixon <jdixon@omniti.com>
- git-committer:
- Jason Dixon <jdixon@omniti.com> 1272133666 +0000
- git-parent:
[6def6ce6e555df7891fb0d270dd5d69f6d43636e]
- git-author:
- Jason Dixon <jdixon@omniti.com> 1272133666 +0000
- Message:
be consistent with path vars, use the built-in error handling now that we have it
git-svn-id: https://labs.omniti.com/resmon/branches/resmon2@321 8c0face9-b7db-6ec6-c4b3-d5f7145c7d55
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
r93a3227 |
rdb0d94e |
|
17 | 17 | |
---|
18 | 18 | Core::Cpu { |
---|
19 | | local : path_to_vmstat => /usr/bin/vmstat |
---|
| 19 | local : vmstat_path => /usr/bin/vmstat |
---|
20 | 20 | } |
---|
21 | 21 | |
---|
… | … | |
32 | 32 | Arbitrary name of the check. |
---|
33 | 33 | |
---|
34 | | =item path_to_vmstat |
---|
| 34 | =item vmstat_path |
---|
35 | 35 | |
---|
36 | 36 | Optional path to the vmstat executable. |
---|
37 | 37 | |
---|
38 | | =item path_to_tail |
---|
| 38 | =item tail_path |
---|
39 | 39 | |
---|
40 | 40 | Optional path to the tail executable. |
---|
… | … | |
52 | 52 | =item idle (time) |
---|
53 | 53 | |
---|
54 | | =item error_msg |
---|
55 | | |
---|
56 | 54 | =back |
---|
57 | 55 | |
---|
… | … | |
61 | 59 | my $self = shift; |
---|
62 | 60 | my $config = $self->{'config'}; |
---|
63 | | my $path_to_vmstat = $config->{'path_to_vmstat'} || 'vmstat'; |
---|
64 | | my $path_to_tail = $config->{'path_to_tail'} || 'tail'; |
---|
65 | | my $output = run_command("$path_to_vmstat 1 2 | $path_to_tail -1"); |
---|
| 61 | my $vmstat_path = $config->{'vmstat_path'} || 'vmstat'; |
---|
| 62 | my $tail_path = $config->{'tail_path'} || 'tail'; |
---|
| 63 | my $output = run_command("$vmstat_path 1 2 | $tail_path -1"); |
---|
66 | 64 | my $osname = $^O; |
---|
67 | 65 | my %metrics; |
---|
… | … | |
80 | 78 | @values = (split($output))[16..18]; |
---|
81 | 79 | } else { |
---|
82 | | return { 'error_msg' => 'unknown operating system' }; |
---|
| 80 | die "Unknown platform: $osname"; |
---|
83 | 81 | } |
---|
84 | 82 | |
---|