Teamcity Exporter
Export Teamcity builds metrics to Prometheus.
To build it:
$ docker run --rm -v "$PWD":/go/src/github.com/guidewire/teamcity_exporter -w /go/src/github.com/guidewire/teamcity_exporter -e GOOS=linux -e GOARCH=amd64 golang:1.8 go build -o bin/teamcity_exporter -v
To run it:
$ ./teamcity_exporter [flags]
Exported Metrics
Export all the metrics that Teamcity's /statistics endpoint provides.
Flags
./teamcity_exporter --help
config
: Path to configuration file
web.listen-address
: Address to listen on for web interface and telemetry
web.telemetry-path
: Path under which to expose metrics
log.level
: Only log messages with the given severity or above. Valid levels: [debug, info, warn, error, fatal]
log.format
: Set the log target and format. Example: logger:syslog?appname=bob&local=7
or logger:stdout?json=true
(default logger:stderr
)
version
: Print current version
Configuration
Configuration template:
instances:
- name: prod
url: https://teamcity-prod.com
username: login
password: password
scrape_interval: 100 # seconds
concurrency_limit: 10 # simultaneous Teamcity connections
builds_filters:
- name: prod-filter1
filter:
status: success
running: false
canceled: false
- name: dev
url: https://teamcity-dev.com
username: login
password: password
scrape_interval: 80 # seconds
concurrency_limit: 10 # simultaneous Teamcity connections
builds_filters:
- name: dev-filter1
filter:
build_type: buildtype1
status: failure
running: false
canceled: false
- name: dev-filter2
filter:
build_type: buildtype2
branch: master
status: success
running: false
canceled: false
Available builds filters
Filter name |
Possible values |
Description |
build_type |
depends on your setup, example myBuildConfiguration |
builds of the specified build configuration. By default, the filter will run against all available configurations. |
branch |
depends on your setup, example master |
limit the builds by branch |
status |
success /failure /error |
list builds with the specified status only |
running |
true /false /any |
limit builds by the running flag. By default, running builds are not included. |
canceled |
true /false /any |
limit builds by the canceled flag. By default, canceled builds are not included. |
For more details, read official Teamcity documentation. At the moment not all the filters' parameters are available in this project.