Commit c75ae673 authored by Martina Ferrari's avatar Martina Ferrari

A bunch of updates and fixes.

* debian/control: Update dependencies and Vcs-* links.
* debian/rules: Simplify with new dh_golang features; add version info.
* Add systemd service file.
* Add logrotate script.
* Enable the textfile collector by default.
* Remove rotated logs and textfile directory on purge.
parent 1653faba
Textfile Collector
The textfile collector is similar to the Pushgateway, in that it allows
exporting of statistics from batch jobs. It can also be used to export static
metrics, such as what role a machine has. The Pushgateway should be used for
service-level metrics. The textfile module is for metrics that are tied to a
machine.
To use it, create files in this directory that are readable by the prometheus
user. The collector will parse all files in matching the glob *.prom using the
text format.
To atomically push completion time for a cron job:
echo my_batch_job_completion_time $(date +%s) > /path/to/directory/my_batch_job.prom.$$
mv /path/to/directory/my_batch_job.prom.$$ /path/to/directory/my_batch_job.prom
To statically set roles for a machine using labels:
echo 'role{role="application_server"} 1' > /path/to/directory/role.prom.$$
mv /path/to/directory/role.prom.$$ /path/to/directory/role.prom
prometheus-node-exporter (0.12.0+ds+really0.12.0-2) UNRELEASED; urgency=medium
* debian/watch: Take into account RCs and current version hack.
* debian/control: Update dependencies and Vcs-* links.
* debian/rules: Simplify with new dh_golang features; add version info.
* Fix default configuration.
* Add systemd service file.
* Add logrotate script.
* Enable the textfile collector by default.
* Remove rotated logs and textfile directory on purge.
-- Martín Ferrari <tincho@debian.org> Sat, 07 May 2016 17:13:38 +0100
......
......@@ -3,7 +3,7 @@ Section: net
Priority: extra
Maintainer: Debian Go Packaging Team <pkg-go-maintainers@lists.alioth.debian.org>
Uploaders: Martín Ferrari <tincho@debian.org>
Build-Depends: debhelper (>= 9.0.0), dh-golang, golang-go,
Build-Depends: debhelper (>= 9.0.0), dh-golang (>= 1.17~), golang-any (>= 1.5~),
golang-dbus-dev,
golang-github-coreos-go-systemd-dev,
golang-github-kolo-xmlrpc-dev,
......@@ -14,7 +14,7 @@ Build-Depends: debhelper (>= 9.0.0), dh-golang, golang-go,
golang-procfs-dev (>= 0+git20150616),
golang-prometheus-client-dev (>= 0.7.0+ds-3),
Standards-Version: 3.9.8
Vcs-Git: git://anonscm.debian.org/pkg-go/packages/prometheus-node-exporter.git
Vcs-Git: http://anonscm.debian.org/git/pkg-go/packages/prometheus-node-exporter.git/
Vcs-Browser: http://anonscm.debian.org/cgit/pkg-go/packages/prometheus-node-exporter.git/
Homepage: https://github.com/prometheus/node_exporter
......
# Set the command-line arguments to pass to the server.
ARGS='-collector.diskstats.ignored-devices="^(ram|loop|fd)\\d+$"'
ARGS='-collector.diskstats.ignored-devices=^(ram|loop|fd)\d+$
-collector.textfile.directory=/var/lib/prometheus/node-exporter'
# Prometheus-node-exporter supports the following options:
# -auth.pass="": Password for basic auth.
......
var/lib/prometheus
var/lib/prometheus/node-exporter
var/log/prometheus
/var/log/prometheus/prometheus-node-exporter.log {
weekly
rotate 10
copytruncate
compress
delaycompress
notifempty
missingok
}
......@@ -6,7 +6,9 @@ set -e
case "$1" in
purge)
rm -rf /var/log/prometheus/prometheus-node-exporter.log \
rm -rf /var/lib/prometheus/node-exporter/ \
/var/log/prometheus/prometheus-node-exporter.log \
/var/log/prometheus/prometheus-node-exporter.log.* \
/var/run/prometheus/prometheus-node-exporter.pid
# We do NOT remove the system user.
;;
......
......@@ -2,37 +2,46 @@
export DH_VERBOSE=1
export DH_GOPKG := github.com/prometheus/node_exporter
export DH_GOLANG_INSTALL_EXTRA := collector/fixtures
DEBVERS ?= $(shell dpkg-parsechangelog | sed -n -e 's/^Version: //p')
BUILDDIR := $(CURDIR)/build
METAPKG := github.com/prometheus/common
DEBVERS ?= $(shell dpkg-parsechangelog -SVersion)
VERSION ?= $(shell echo '$(DEBVERS)' | sed 's/^[[:digit:]]*://; s/[-].*//')
DEBPKGNAME ?= $(shell dpkg-parsechangelog | sed -n -e 's/^Source: //p')
BUILDDIR := $(shell perl -w -MDebian::Debhelper::Buildsystem::golang -e \
'print Debian::Debhelper::Buildsystem::golang->new()->get_builddir()')
DEBPKGNAME ?= $(shell dpkg-parsechangelog -SSource)
DEBDATE ?= $(shell dpkg-parsechangelog -SDate)
REV := $(DEBVERS)
BRANCH := debian/sid
USER := pkg-go-maintainers@lists.alioth.debian.org
HOSTNAME := debian
BUILD_DATE := $(shell date --utc --date='$(DEBDATE)' +%Y%m%d-%H:%M:%S)
GO_VERSION := $(shell go version | sed 's/go version \(\S*\).*/\1/')
BUILDFLAGS := -ldflags \
" -X $(METAPKG)/version.Version=$(VERSION)\
-X $(METAPKG)/version.Revision=$(REV)\
-X $(METAPKG)/version.Branch=$(BRANCH)\
-X $(METAPKG)/version.BuildUser=$(USER)\
-X $(METAPKG)/version.BuildDate=$(BUILD_DATE)\
-X $(METAPKG)/version.GoVersion=$(GO_VERSION)"
%:
dh $@ --buildsystem=golang --with=golang
override_dh_auto_configure:
dh_auto_configure -O--buildsystem=golang
# Include vendored dependencies.
for i in github.com/beevik/ntp github.com/soundcloud/go-runit; do \
DEST=`dirname $(BUILDDIR)/src/$$i`; \
mkdir -p $$DEST; \
cp -av vendor/$$i $$DEST; \
done
# Copy test fixtures.
cp -av collector/fixtures $(BUILDDIR)/src/$(DH_GOPKG)/collector
dh $@ --buildsystem=golang --with=golang --builddirectory=$(BUILDDIR)
override_dh_auto_build:
dh_auto_build -O--buildsystem=golang -- $(BUILDFLAGS)
dh_auto_build -- $(BUILDFLAGS)
override_dh_auto_test:
chmod a+x $(BUILDDIR)/src/$(DH_GOPKG)/collector/fixtures/megacli
dh_auto_test
override_dh_auto_install:
dh_auto_install
# we don't want the golang source (yet?)
rm -r debian/$(DEBPKGNAME)/usr/share/gocode
mkdir -p debian/$(DEBPKGNAME)/usr/bin
# Rename the binary to match the debian package.
mv -v debian/$(DEBPKGNAME)/usr/bin/node_exporter \
cp -v $(BUILDDIR)/bin/node_exporter \
debian/$(DEBPKGNAME)/usr/bin/$(DEBPKGNAME)
cp -v debian/README.textfile \
debian/$(DEBPKGNAME)/var/lib/prometheus/node-exporter
gen-orig-tgz:
if [ ! -f ../$(DEBPKGNAME)_$(VERSION).orig.tar.gz ] ; then \
......
[Unit]
Description=Prometheus exporter for machine metrics
Documentation=https://github.com/prometheus/node_exporter
[Service]
Restart=always
User=prometheus
EnvironmentFile=/etc/default/prometheus-node-exporter
ExecStart=/usr/bin/prometheus-node-exporter $ARGS
ExecReload=/bin/kill -HUP $MAINPID
TimeoutStopSec=20s
SendSIGKILL=no
[Install]
WantedBy=multi-user.target
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment