File tree Expand file tree Collapse file tree 2 files changed +8
-3
lines changed
Expand file tree Collapse file tree 2 files changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -159,7 +159,8 @@ module PuppetMetricsCollector
159159 'Defaults to 10.' ] ,
160160 [ '--output_dir DIR' ,
161161 'Write metrics to a timestamed file under DIR instead of' ,
162- 'printing to STDOUT' ] ] . freeze
162+ 'printing to STDOUT' ] ,
163+ [ '-p' , '--[no-]print' , 'Always print to STDOUT' ] ] . freeze
163164
164165 def initialize ( argv = [ ] )
165166 @action = :collect_data
@@ -172,7 +173,7 @@ module PuppetMetricsCollector
172173 @action = :show_help
173174 end
174175
175- parser . on_tail ( '--debug' , 'Enable backtraces from errors.' ) do
176+ parser . on_tail ( '-d' , '- -debug', 'Enable backtraces from errors.' ) do
176177 @options [ :debug ] = true
177178 end
178179 end
@@ -208,7 +209,9 @@ module PuppetMetricsCollector
208209 FileUtils . mkdir_p ( host_dir ) unless File . directory? ( host_dir )
209210 output_file = File . join ( host_dir , Time . now . utc . strftime ( '%Y%m%dT%H%M%SZ' ) + '.json' )
210211
211- File . write ( output_file , JSON . generate ( data ) )
212+ output = JSON . generate ( data )
213+ File . write ( output_file , output )
214+ $stdout. puts ( output ) if @options [ :print ]
212215 else
213216 $stdout. puts ( JSON . generate ( data ) )
214217 end
Original file line number Diff line number Diff line change 1212 String $metrics_ensure = $puppet_metrics_collector::system::system_metrics_ensure,
1313 Integer $collection_frequency = $puppet_metrics_collector::system::collection_frequency,
1414 Integer $retention_days = $puppet_metrics_collector::system::retention_days,
15+ String $metrics_shipping_command = $puppet_metrics_collector::system::metrics_shipping_command,
1516) {
1617 $metrics_output_dir = " ${puppet_metrics_collector::system::output_dir} /vmware"
1718 $metrics_output_dir_ensure = $metrics_ensure ? {
2728
2829 $metrics_command = [" ${puppet_metrics_collector::system::scripts_dir} /vmware_metrics" ,
2930 ' --output_dir' , $metrics_output_dir ,
31+ $metrics_shipping_command ,
3032 ' > /dev/null' ].join(' ' )
3133
3234 $tidy_command = " ${puppet_metrics_collector::system::scripts_dir} /metrics_tidy -d ${metrics_output_dir} -r ${retention_days} "
You can’t perform that action at this time.
0 commit comments