File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -557,10 +557,15 @@ EOS
557557 # NOTE: A little odd, since tk_metrics uses the certname. But, this
558558 # matches what system_metrics does.
559559 hostname = PSQLMetrics ::Exec . exec_cmd ( '/bin/sh' , '-c' , 'hostname' ) . stdout . strip
560+ # Sanitized to accommodate the dot-delimited naming scheme used
561+ # by the Graphite time-series database. This is the wrong place to
562+ # do this as it destroys useful hostname info, but we do it anyway
563+ # to be consistent with the other metrics collection scripts.
564+ server_name = hostname . gsub ( '.' , '-' )
560565 timestamp = Time . now . utc
561566
562567 metrics = PSQLMetrics . new ( **@options )
563- data = { servers : { hostname . gsub ( '.' , '-' ) => { postgres : metrics . to_h } } ,
568+ data = { servers : { server_name => { postgres : metrics . to_h } } ,
564569 timestamp : timestamp . iso8601 }
565570
566571 if ( output_dir = @options [ :output_dir ] )
573578 $stdout. puts ( JSON . generate ( data ) )
574579 end
575580
576- if data [ :servers ] [ hostname ] [ :postgres ] . key? ( :error )
581+ if data [ :servers ] [ server_name ] [ :postgres ] . key? ( :error )
577582 return 1
578583 else
579584 return 0
You can’t perform that action at this time.
0 commit comments