Skip to content

Commit

Permalink
Make PGO backwards compatible with older crunchy-postgres-exporter im…
Browse files Browse the repository at this point in the history
…ages.
  • Loading branch information
dsessler7 committed Sep 21, 2023
1 parent e51f118 commit f948634
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions internal/pgmonitor/exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,17 @@ func GenerateDefaultExporterQueries(ctx context.Context, cluster *v1beta1.Postgr
// the source queries files.
func ExporterStartCommand(commandFlags []string) []string {
script := strings.Join([]string{
// Check to see if the postgres_exporter command is successful. If it is, we are
// using an image that has the command on the PATH. If it isn't, we have an older
// image that does not have it on the PATH and we should find the directory that
// holds the postgres_exporter binary and add it to the PATH.
`rc=0`,
`postgres_exporter --version || rc=$?`,
`if [ $rc -ne 0 ]; then`,
` dir=$(find /opt/cpm/bin/postgres_exporter* -type d)`,
` export PATH=$PATH:$dir`,
`fi`,

// Set up temporary file to hold postgres_exporter process id
`POSTGRES_EXPORTER_PIDFILE=/tmp/postgres_exporter.pid`,

Expand Down

0 comments on commit f948634

Please sign in to comment.