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..94f9d6d 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; @@ -76,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");