Changeset 05e72aab2592abb86657ba9c041689fc94c8bb23
- Timestamp:
- 03/25/10 15:22:52
(3 years ago)
- Author:
- Mark Harrison <mark@omniti.com>
- git-committer:
- Mark Harrison <mark@omniti.com> 1269530572 +0000
- git-parent:
[a417f742bacb15ab9439a9a01f7f91ee3bd19e8b]
- git-author:
- Mark Harrison <mark@omniti.com> 1269530572 +0000
- Message:
Change Sample.pm to use run_command instead of backticks
git-svn-id: https://labs.omniti.com/resmon/branches/resmon2@288 8c0face9-b7db-6ec6-c4b3-d5f7145c7d55
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| rbd4339d |
r05e72aa |
|
| 5 | 5 | |
|---|
| 6 | 6 | use base 'Resmon::Module'; |
|---|
| | 7 | |
|---|
| | 8 | use Resmon::ExtComm qw(run_command cache_command); |
|---|
| 7 | 9 | |
|---|
| 8 | 10 | =pod |
|---|
| … | … | |
| 93 | 95 | # This is an example of running an external command. There are much better |
|---|
| 94 | 96 | # ways to get the current date. |
|---|
| 95 | | my $date = `date +%d`; |
|---|
| | 97 | my $date = run_command('date +%d'); |
|---|
| 96 | 98 | chomp $date; |
|---|
| | 99 | |
|---|
| | 100 | # Another example of running an external command: |
|---|
| | 101 | # This command caches the output for 600 seconds. You should probably |
|---|
| | 102 | # rely on the check interval rather than cache_command unless you have |
|---|
| | 103 | # the same command being run on multiple checks. |
|---|
| | 104 | |
|---|
| | 105 | # my $output = cache_command('some_command', 600); |
|---|
| 97 | 106 | |
|---|
| 98 | 107 | return { |
|---|