Skip to content

Commit 4c8b970

Browse files
committed
Merge branch 'local_changes'
2 parents bb26a64 + 054d825 commit 4c8b970

File tree

119 files changed

+26609
-144
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

119 files changed

+26609
-144
lines changed

Dockerfile

-4
This file was deleted.

Makefile

+14-15
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
1-
# Copyright 2015 The Prometheus Authors
2-
# Licensed under the Apache License, Version 2.0 (the "License");
3-
# you may not use this file except in compliance with the License.
4-
# You may obtain a copy of the License at
5-
#
6-
# http://www.apache.org/licenses/LICENSE-2.0
7-
#
8-
# Unless required by applicable law or agreed to in writing, software
9-
# distributed under the License is distributed on an "AS IS" BASIS,
10-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11-
# See the License for the specific language governing permissions and
12-
# limitations under the License.
131

14-
VERSION := 0.1.0
15-
TARGET := postgres_exporter
2+
# Simple go build
3+
postgres_exporter: postgres_exporter.go
4+
go build -o postgres_exporter .
165

17-
include Makefile.COMMON
6+
# Do a self-contained docker build - we pull the official upstream container,
7+
# then template out a dockerfile which builds the real image.
8+
docker:
9+
docker run -v $(shell pwd):/go/src/github.com/wrouesnel/postgres_exporter \
10+
golang:1.6-wheezy \
11+
/go/src/github.com/wrouesnel/postgres_exporter/docker-build.bsh /postgres_exporter /go/src/github.com/wrouesnel/postgres_exporter | \
12+
docker import --change "EXPOSE 9113" \
13+
--change 'ENTRYPOINT [ "/postgres_exporter" ]' \
14+
- wrouesnel/postgres_exporter
15+
16+
.PHONY: docker

Makefile.COMMON

-121
This file was deleted.

README.md

+22-4
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,29 @@
33
Prometheus exporter for PostgresSQL server metrics.
44
Supported Postgres versions: 9.1 and up.
55

6+
## Quick Start
7+
This package is available for Docker:
8+
```
9+
docker run -e DATA_SOURCE_NAME="login:password@(hostname:port)/dbname" -p 9113:9113 wrouesnel/postgres_exporter
10+
```
11+
612
## Building and running
13+
The default make file behavior is to build the binary:
14+
```
15+
make
16+
export DATA_SOURCE_NAME="login:password@(hostname:port)/dbname"
17+
./postgres_exporter <flags>
18+
```
719

8-
make
9-
export DATA_SOURCE_NAME="postgres://postgres:password@localhost/?sslmode=disable"
10-
./postgres_exporter <flags>
20+
To build the dockerfile, run `make docker`.
1121

12-
See the [github.com/lib/pq](http://github.com/lib/pq) module for other ways to format the connection string.
22+
This will build the docker image as `wrouesnel/postgres_exporter:latest`. This
23+
is a minimal docker image containing *just* postgres_exporter. By default no SSL
24+
certificates are included, if you need to use SSL you should either bind-mount
25+
`/etc/ssl/certs/ca-certificates.crt` or derive a new image containing them.
26+
27+
### Vendoring
28+
Package vendoring is handled with [`govendor`](https://github.com/kardianos/govendor)
1329

1430
### Flags
1531

@@ -27,6 +43,8 @@ For running it locally on a default Debian/Ubuntu install, this will work (trans
2743

2844
sudo -u postgres DATA_SOURCE_NAME="user=postgres host=/var/run/postgresql/ sslmode=disable" postgres_exporter
2945

46+
See the [github.com/lib/pq](http://github.com/lib/pq) module for other ways to format the connection string.
47+
3048
### Adding new metrics
3149

3250
The exporter will attempt to dynamically export additional metrics if they are added in the

docker-build.bsh

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/bash
2+
cd $2
3+
CGO_ENABLED=0 GOOS=linux go build -a -ldflags '-extldflags "-static"' -o $1 . 1>&2
4+
tar -cf - $1

vendor/github.com/Sirupsen/logrus/CHANGELOG.md

+55
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/Sirupsen/logrus/LICENSE

+21
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)