[Resmon-devel] [resmon commit] r288 - branches/resmon2/lib/Resmon/Module

svn-commit at lists.omniti.com svn-commit at lists.omniti.com
Thu Mar 25 11:22:52 EDT 2010


Author: mark
Date: 2010-03-25 11:22:52 -0400 (Thu, 25 Mar 2010)
New Revision: 288

Modified:
   branches/resmon2/lib/Resmon/Module/Sample.pm
Log:
Change Sample.pm to use run_command instead of backticks

Modified: branches/resmon2/lib/Resmon/Module/Sample.pm
===================================================================
--- branches/resmon2/lib/Resmon/Module/Sample.pm	2010-03-25 15:22:48 UTC (rev 287)
+++ branches/resmon2/lib/Resmon/Module/Sample.pm	2010-03-25 15:22:52 UTC (rev 288)
@@ -5,6 +5,8 @@
 
 use base 'Resmon::Module';
 
+use Resmon::ExtComm qw(run_command cache_command);
+
 =pod
 
 =head1 NAME
@@ -92,9 +94,16 @@
 
     # This is an example of running an external command. There are much better
     # ways to get the current date.
-    my $date = `date +%d`;
+    my $date = run_command('date +%d');
     chomp $date;
 
+    # Another example of running an external command:
+    # This command caches the output for 600 seconds. You should probably
+    # rely on the check interval rather than cache_command unless you have
+    # the same command being run on multiple checks.
+
+    # my $output = cache_command('some_command', 600);
+
     return {
         "check_name" => [$self->{check_name}, "s"],
         "arg1" => [$config->{arg1}, "s"],



More information about the Resmon-devel mailing list