postgres_exporter icon indicating copy to clipboard operation
postgres_exporter copied to clipboard

Unable to get a shell

Open awesomescot-zz opened this issue 10 years ago • 8 comments

I'm trying to do some trouble shooting by getting a shell on the docker container. I've tried everything I can think of, but it seems that /bin/bash or /bin/sh don't exists on the image.

sudo docker run -t -i --entrypoint /bin/bash wrouesnel/postgres_exporter docker: Error response from daemon: Container command '/bin/bash' not found or does not exist..

Is there some other way I can get a shell, so that I can test if it's able to connect to the db? The actual error that I'm trying to solve is this, which I'm assuming is a connectivity issue:
time="2016-05-19T21:21:31Z" level=info msg="Error running query on database: pg_stat_database_conflicts missing "=" after "ubuntu:password@localhost:5432/db" in connection info string"" file="postgres_exporter.go" line=277 time="2016-05-19T21:21:31Z" level=info msg="Error running query on database: pg_stat_bgwriter missing "=" after "ubuntu:password@localhost:5432/db" in connection info string"" file="postgres_exporter.go" line=277 time="2016-05-19T21:21:31Z" level=info msg="Error running query on database: pg_stat_database missing "=" after "ubuntu:password@localhost:5432/db" in connection info string"" file="postgres_exporter.go" line=277

awesomescot-zz avatar May 19 '16 21:05 awesomescot-zz

The docker container is just the compiled executable and nothing else. If you need a shell you'd have to derive an image which included gnu tools.

Can you show your actual docker command line?

wrouesnel avatar May 19 '16 22:05 wrouesnel

Sure, the actual docker command I was using was something like this:

sudo docker run --net="host" -e DATA_SOURCE_NAME="ubuntu:password@localhost:5432/db" -p 9113:9113 -d wrouesnel/postgres_exporter

awesomescot-zz avatar May 19 '16 23:05 awesomescot-zz

Oh wow, my README.md documentation is atrocious - so the top line I give for a connection string is totally wrong. The correct command would be sudo docker run --net="host" -e DATA_SOURCE_NAME="postgresql://ubuntu:password@localhost:5432/db" -p 9113:9113 -d wrouesnel/postgres_exporter

You might also need to add ?sslmode=disable to the end of it if you don't have SSL turned on.

wrouesnel avatar May 20 '16 08:05 wrouesnel

Well, that did help. Now I'm getting these types of errors with or without the ?sslmode=disable at the end of the DATA_SOURCE_NAME. Any ideas? time="2016-05-24T16:50:08Z" level=error msg="Unexpected error parsing column: pg_stat_database_conflicts confl_snapshot " file="postgres_exporter.go" line=334 time="2016-05-24T16:50:08Z" level=error msg="Unexpected error parsing column: pg_stat_database_conflicts confl_bufferpin " file="postgres_exporter.go" line=334 time="2016-05-24T16:50:08Z" level=error msg="Unexpected error parsing column: pg_stat_database_conflicts confl_deadlock " file="postgres_exporter.go" line=334

awesomescot-zz avatar May 24 '16 16:05 awesomescot-zz

Any suggestion for the above errors? Or a work around. I would rather not install go, but it looks like I may need to.

awesomescot-zz avatar May 26 '16 16:05 awesomescot-zz

That's a separate bug with something which has changed with newer versions of postgres. I need to look into why the column types are different.

wrouesnel avatar May 26 '16 22:05 wrouesnel

Related to #8

wrouesnel avatar May 26 '16 22:05 wrouesnel

This should be resolved in the newest docker image on docker hub. docker pull wrouesnel/postgres_exporter:latest will get it for you.

wrouesnel avatar May 28 '16 05:05 wrouesnel