[Jifty-commit] jifty-plugin-monitoring branch, master, updated. 27ae7b58bde3b35b5da32d071cae3da2aca185be

Jifty commits jifty-commit at lists.jifty.org
Wed May 5 18:31:32 EDT 2010

The branch, master has been updated
       via  27ae7b58bde3b35b5da32d071cae3da2aca185be (commit)
      from  88d2a038ea49353ca78e38b546db06fda167a654 (commit)

Summary of changes:
 lib/Jifty/Plugin/Monitoring.pm              |    8 +++++---
 lib/Jifty/Plugin/Monitoring/Command/Cron.pm |    5 +++--
 2 files changed, 8 insertions(+), 5 deletions(-)

- Log -----------------------------------------------------------------
commit 27ae7b58bde3b35b5da32d071cae3da2aca185be
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Wed May 5 18:31:47 2010 -0400

    If a set of monitor names is supplied on the command-line, only run those

diff --git a/lib/Jifty/Plugin/Monitoring.pm b/lib/Jifty/Plugin/Monitoring.pm
index bcb64f8..aebb050 100644
--- a/lib/Jifty/Plugin/Monitoring.pm
+++ b/lib/Jifty/Plugin/Monitoring.pm
@@ -290,20 +290,22 @@ monitor is running.  Use this method to determine when "now" is.
-=head2 run_monitors
+=head2 run_monitors [NAME, [NAME, ...]]
-For each monitor that we know of, checks to see if it is due to be
-run, and runs it if it is.
+For each monitor that we know of (or the set of monitors given),
+checks to see if it is due to be run, and runs it if it is.
 sub run_monitors {
     my $self = shift;
+    my %only = map {+($_ => 1)} @_;
     return unless $self->lock;
     my $now = Jifty::DateTime->now->truncate( to => "minute" );
     for my $name (keys %{$self->monitors}) {
+        next if keys %only and not $only{$name};
         my $last = $self->last_run($name);
         my %monitor = %{$self->monitors->{$name}};
         my $next = $last->last_run->add( $monitor{unit}."s" => $monitor{count} );
diff --git a/lib/Jifty/Plugin/Monitoring/Command/Cron.pm b/lib/Jifty/Plugin/Monitoring/Command/Cron.pm
index 399351a..ada84e2 100644
--- a/lib/Jifty/Plugin/Monitoring/Command/Cron.pm
+++ b/lib/Jifty/Plugin/Monitoring/Command/Cron.pm
@@ -31,7 +31,8 @@ Takes no options.
 =head2 run
 Examines the application, looking for an instance of the monitoring
-plugin, and runs it.
+plugin, and runs it.  If a list of monitors is given to the command,
+it will only run those monitors.
@@ -41,7 +42,7 @@ sub run {
     my ($monitor) = Jifty->find_plugin('Jifty::Plugin::Monitoring');
     die "Monitoring is not enabled for @{[Jifty->app_class]}\n" unless $monitor;
-    $monitor->run_monitors;
+    $monitor->run_monitors(@_);
 =head2 filename


More information about the Jifty-commit mailing list