Sisyphus repository
Last update: 18 october 2019 | SRPMs: 17501 | Visits: 15290280
en ru br
ALT Linux repos

Group :: Development/Other
RPM: telegraf

 Main   Changelog   Spec   Patches   Sources   Download   Gear   Bugs and FR  Repocop 

%global import_path
%global commit dda8079947be70b9cde4625ea2fcca7f5148a604

%global __find_debuginfo_files %nil
%global _unpackaged_files_terminate_build 1

%set_verify_elf_method unresolved=no
%add_debuginfo_skiplist %go_root %_bindir
%brp_strip_none %_bindir/*

Name: telegraf
Version: 1.9.2
Release: alt2
Summary: The plugin-driven server agent for collecting and reporting metrics

Group: Development/Other
License: MIT

Packager: Alexey Gladkov <legion at>

Source0: %name-%version.tar

Source101: telegraf.logrotate
Source102: telegraf.init
Source103: telegraf.service
Source104: telegraf.tmpfiles

ExclusiveArch:  %go_arches
BuildRequires(pre): rpm-build-golang
BuildRequires: golang-dep

Telegraf is an agent written in Go for collecting, processing, aggregating, and writing metrics.

Design goals are to have a minimal memory footprint with a plugin system so that developers
in the community can easily add support for collecting metrics from well known services
(like Hadoop, Postgres, or Redis) and third party APIs (like Mailchimp, AWS CloudWatch,
or Google Analytics).

%setup -q

# Important!!!
# The %builddir/.gopath created by the hands. It contains the dependencies required for your project.
# This is necessary because the gdm cannot work with the vendor directory and always tries to update
# all dependencies from the external servers. So, we can't use Makefile to compile.
# $ go get
# $ cd $HOME/go/src/
# $ git checkout %version
# $ dep ensure -vendor-only
# $ cd to_this_git_dir
# $ git rm -rf vendor
# $ cp -r $HOME/go/src/ ./
# $ git add -f vendor
# $ git commit -m "update go pkgs by dep ensure -vendor-only"

export BUILDDIR="$PWD/.gopath"
export IMPORT_PATH="%import_path"
export GOPATH="$BUILDDIR:%go_path"


cd .gopath/src/%import_path

export VERSION=%version
export COMMIT=%commit
export BRANCH=altlinux

go install -ldflags "-X main.version=$VERSION -X main.commit=$COMMIT -X main.branch=$BRANCH" ./...

export BUILDDIR="$PWD/.gopath"
export GOPATH="%go_path"

# cleanup

rm -rf -- %buildroot/%_datadir
rm -f %buildroot%_bindir/stress_test_write
rm -f %buildroot%_bindir/thrift_serialize

# Install config files

install -p -D -m 640 etc/telegraf.conf %buildroot%_sysconfdir/%name/%name.conf
install -d -m 750 %buildroot%_sysconfdir/%name/%name.d
# Setup directories
install -d -m 755 %buildroot%_logdir/%name
install -d -m 750 %buildroot%_sharedstatedir/%name
# Install pid directory
install -d -m 775 %buildroot%_runtimedir/%name
# Install logrotate
install -p -D -m 644 %SOURCE101 %buildroot%_logrotatedir/%name
# Install sysv init scripts
install -p -D -m 755 %SOURCE102 %buildroot%_initdir/%name
# Install systemd unit services
install -p -D -m 644 %SOURCE103 %buildroot%_unitdir/%name.service
install -p -D -m 644 %SOURCE104 %buildroot%_tmpfilesdir/%name.conf

%_sbindir/groupadd -r -f %name 2>/dev/null ||:
%_sbindir/useradd -r -g %name -G %name  -c 'Telegraf Agent Daemon' \
       -s /sbin/nologin  -d %_sharedstatedir/%name %name 2>/dev/null ||:
%post_service %name

%preun_service %name

%doc docs/*
%dir %attr(0750, root, %name) %_sysconfdir/%name
%dir %attr(0750, root, %name) %_sysconfdir/%name/%name.d
%config(noreplace) %attr(0640, root, %name) %_sysconfdir/%name/%name.conf
%config(noreplace) %_logrotatedir/%name
%dir %attr(0770, root, %name) %_logdir/%name
%dir %attr(0775, root, %name) %_runtimedir/%name
%dir %attr(0750, %name, %name) %_sharedstatedir/%name


Full changelog you can see here

design & coding: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
current maintainer: Michael Shigorin