From 0772413b752b0e81f9b6902e912c878f489a2807 Mon Sep 17 00:00:00 2001 From: Kenichi Ishigaki Date: Wed, 19 Dec 2012 03:13:52 +0900 Subject: [PATCH 1/2] nice if interval is configurable --- cloudforecast_sample.yaml | 2 ++ lib/CloudForecast/Radar.pm | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/cloudforecast_sample.yaml b/cloudforecast_sample.yaml index ba6c0ed..718a6ac 100644 --- a/cloudforecast_sample.yaml +++ b/cloudforecast_sample.yaml @@ -9,6 +9,8 @@ config: data_dir: data # 監視項目の設定ファイルを設置するディレクトリ。「/」から始まると絶対パス host_config_dir: host_config +# radarの実行間隔(秒) + interval: 300 component_config: # SNMPでデータを取得する時のオプション。communityとversion diff --git a/lib/CloudForecast/Radar.pm b/lib/CloudForecast/Radar.pm index a09c3b8..82b8398 100644 --- a/lib/CloudForecast/Radar.pm +++ b/lib/CloudForecast/Radar.pm @@ -39,7 +39,8 @@ sub run { } my $now = time; - my $next = $now - ( $now % 300 ) + 300; + my $interval = $global_config->{interval} || 300; + my $next = $now - ( $now % $interval ) + $interval; my $pid; my @signals_received; From 1c86b8bd27e7b2e848a8665e5d4c0a417e3deaee Mon Sep 17 00:00:00 2001 From: Kenichi Ishigaki Date: Mon, 8 Jul 2013 21:11:51 +0900 Subject: [PATCH 2/2] https://github.com/kazeburo/cloudforecast/pull/29#issuecomment-20599681 --- lib/CloudForecast/Radar.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/CloudForecast/Radar.pm b/lib/CloudForecast/Radar.pm index 82b8398..94f9d6d 100644 --- a/lib/CloudForecast/Radar.pm +++ b/lib/CloudForecast/Radar.pm @@ -77,7 +77,7 @@ sub run { $now = time; if ( $now >= $next ) { CloudForecast::Log->warn( sprintf( "(%s) radar start ", scalar localtime $next) ); - $next = $now - ( $now % 300 ) + 300; + $next = $now - ( $now % $interval ) + $interval; if ( $pid ) { CloudForecast::Log->warn( "Previous radar exists, skipping this time");