aboutsummaryrefslogtreecommitdiff
path: root/utils/telegraf/Makefile
blob: c0a5676b2d3d61371f00b604a562f4df2de783a9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# SPDX-License-Identifier: GPL-2.0-or-later

include $(TOPDIR)/rules.mk

PKG_NAME:=telegraf
PKG_VERSION:=1.23.4
PKG_RELEASE:=1

PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://codeload.github.com/influxdata/telegraf/tar.gz/v$(PKG_VERSION)?
PKG_HASH:=05188b5f0c0dfa204dc6bd8429ebc5366b73e42c7bdd4f1a50fffa2a1e75616f

PKG_MAINTAINER:=Jonathan Pagel <jonny_tischbein@systemli.org>
PKG_LICENSE:=MIT
PKG_LICENSE_FILES:=LICENSE

PKG_BUILD_DEPENDS:=golang/host
PKG_BUILD_PARALLEL:=1
PKG_USE_MIPS16:=0

GO_PKG:=github.com/influxdata/telegraf
GO_PKG_BUILD_PKG:=github.com/influxdata/telegraf/cmd/telegraf
GO_PKG_LDFLAGS_X:=main.version=$(PKG_VERSION)

include $(INCLUDE_DIR)/package.mk
include ../../lang/golang/golang-package.mk

define Package/telegraf/Default
	SECTION:=utils
	CATEGORY:=Utilities
	TITLE:=Telegraf
	DEPENDS:=$(GO_ARCH_DEPENDS)
endef

define Package/telegraf-full
	$(call Package/telegraf/Default)
	TITLE+= (Full)
	VARIANT:=full
endef

define Package/telegraf
	$(call Package/telegraf/Default)
	TITLE+= (Small)
	VARIANT:=small
endef

define Package/telegraf/description/Default
	Telegraf is a plugin-driven agent for collecting and sending metrics and events.
	It supports various inputs (including prometheus endpoints) and is able to send data into InfluxDB.
endef

define Package/telegraf/description
	$(call Package/telegraf/description/Default)
	(Small build. Most plugins excluded)
endef

define Package/telegraf-full/description
	$(call Package/telegraf/description/Default)
	(Full build. including all plugins)
endef

define Package/telegraf/conffiles
/etc/telegraf.conf
endef

Package/telegraf-full/conffiles = $(Package/telegraf/conffiles)

define Build/Prepare
	$(call Build/Prepare/Default)
ifeq ($(BUILD_VARIANT),small)
	$(CP) ./variant-$(BUILD_VARIANT)/* $(PKG_BUILD_DIR)/
endif
endef

define Package/telegraf/install
	$(call GoPackage/Package/Install/Bin,$(1))
	$(INSTALL_DIR) $(1)/etc/init.d $(1)/etc/config
	$(INSTALL_BIN) ./files/etc/init.d/telegraf $(1)/etc/init.d/telegraf
	$(INSTALL_CONF) $(PKG_BUILD_DIR)/etc/telegraf.conf $(1)/etc/telegraf.conf
endef

define Package/telegraf-full/install
	$(call Package/telegraf/install,$(1))
endef

$(eval $(call GoBinPackage,telegraf))
$(eval $(call BuildPackage,telegraf))

$(eval $(call GoBinPackage,telegraf-full))
$(eval $(call BuildPackage,telegraf-full))