Changeset 7562
- Timestamp:
- 03/06/08 16:38:31 (5 years ago)
- Location:
- lang/perl/App-MadEye/trunk
- Files:
-
- 2 added
- 2 modified
-
config.yaml (modified) (4 diffs)
-
lib/App/MadEye.pm (modified) (2 diffs)
-
lib/App/MadEye/Rule (added)
-
lib/App/MadEye/Rule/DateTimeCron.pm (added)
Legend:
- Unmodified
- Added
- Removed
-
lang/perl/App-MadEye/trunk/config.yaml
r7560 r7562 10 10 - http://google.com/ 11 11 12 # - module: Worker::Simple 12 - module: Worker::Simple 13 config: 14 timeout: 1 15 16 # - module: Worker::Gearman 13 17 # config: 14 # timeout: 4 15 16 - module: Worker::Gearman 17 config: 18 fork_num: 3 19 gearman_servers: 20 - 127.0.0.1 18 # fork_num: 3 19 # gearman_servers: 20 # - 127.0.0.1 21 21 22 22 # - module: Agent::HTTP … … 28 28 config: 29 29 target: ftp.ring.gr.jp 30 message: FTP server ready. 30 message: FTP server raady. 31 rule: 32 - module: DateTimeCron 33 config: 34 crontab: "* 16 * * *" 35 type: ignore 31 36 32 37 # - module: Agent::HTTP … … 79 84 # - 127.0.0.1:1111 80 85 81 - module: Agent::SMTPTLS82 config:83 timeout: 184 target:85 - 127.0.0.186 - 192.168.1.186 # - module: Agent::SMTPTLS 87 # config: 88 # timeout: 1 89 # target: 90 # - 127.0.0.1 91 # - 192.168.1.1 87 92 88 93 # - module: Agent::Process … … 92 97 # pattern: /usr/bin/gearmandaa 93 98 94 - module: Agent::Ping95 config:96 target:97 - 127.0.0.198 - 192.168.2.399 # - module: Agent::Ping 100 # config: 101 # target: 102 # - 127.0.0.1 103 # - 192.168.2.3 99 104 100 - module: Agent::SMTP101 config:102 target:103 - 127.0.0.1104 - 192.168.2.3105 # - module: Agent::SMTP 106 # config: 107 # target: 108 # - 127.0.0.1 109 # - 192.168.2.3 105 110 106 111 - module: Notify::Debug -
lang/perl/App-MadEye/trunk/lib/App/MadEye.pm
r7560 r7562 6 6 use Class::Component; 7 7 use Params::Validate; 8 use UNIVERSAL::require; 8 9 __PACKAGE__->load_components(qw/Plaggerize Autocall::InjectMethod/); 9 10 … … 41 42 my $args = {@_}; 42 43 44 return unless $self->_should_add_result(target => $args->{target}, plugin => $args->{plugin}); 45 43 46 push @{$self->{results}->{ref $args->{plugin}}}, +{ 44 47 target => $args->{target}, 45 48 message => $args->{message}, 46 }; 49 }; 50 } 51 52 sub _should_add_result { 53 my $self = shift; 54 validate( 55 @_ => +{ 56 plugin => 1, 57 target => 1, 58 } 59 ); 60 my $args = {@_}; 61 62 if ($args->{plugin}->config->{rule}) { 63 for my $rule_conf ( @{ $args->{plugin}->config->{rule} } ) { 64 my $rule = $self->_load_rule($rule_conf); 65 my $ret = $rule->dispatch( 66 $self, 67 +{ 68 target => $args->{target}, 69 } 70 ); 71 return 0 if $ret; 72 } 73 } 74 return 1; 75 } 76 77 sub _load_rule { 78 my ($self, $rule) = @_; 79 80 my $class = $rule->{module}; 81 if ($class =~ /^\+/) { 82 $class =~ s/^\+//; 83 } else { 84 $class = __PACKAGE__ . '::Rule::' . $class; 85 } 86 $class->use or die $@; 87 return $class->new($rule->{config}); 47 88 } 48 89
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)