You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

402 lines
12 KiB

  1. #
  2. # Copyright (C) 2006-2016 OpenWrt.org
  3. #
  4. # This is free software, licensed under the GNU General Public License v2.
  5. # See /LICENSE for more information.
  6. #
  7. include $(TOPDIR)/rules.mk
  8. PKG_NAME:=collectd
  9. PKG_VERSION:=5.8.1
  10. PKG_RELEASE:=3
  11. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
  12. PKG_SOURCE_URL:=https://collectd.org/files/ \
  13. https://github.com/collectd/collectd/releases/download/collectd-$(PKG_VERSION)
  14. PKG_HASH:=e796fda27ce06377f491ad91aa286962a68c2b54076aa77a29673d53204453da
  15. PKG_FIXUP:=autoreconf
  16. PKG_REMOVE_FILES:=aclocal.m4 libltdl/aclocal.m4
  17. PKG_MAINTAINER:=Jo-Philipp Wich <jo@mein.io>, Hannu Nyman <hannu.nyman@iki.fi>
  18. PKG_INSTALL:=1
  19. PKG_BUILD_PARALLEL:=1
  20. PKG_USE_MIPS16:=0
  21. COLLECTD_PLUGINS_DISABLED:= \
  22. amqp \
  23. apple_sensors \
  24. aquaero \
  25. barometer \
  26. battery \
  27. ceph \
  28. cgroups \
  29. cpusleep \
  30. curl_json \
  31. curl_xml \
  32. dbi \
  33. dpdkevents \
  34. dpdkstat \
  35. drbd \
  36. fhcount \
  37. genericjmx \
  38. gmond \
  39. gps \
  40. grpc \
  41. hddtemp \
  42. hugepages \
  43. intel_pmu \
  44. intel_rdt \
  45. ipc \
  46. ipmi \
  47. ipvs \
  48. java \
  49. log_logstash \
  50. lua \
  51. lvm \
  52. lpar \
  53. madwifi \
  54. mbmon \
  55. mcelog \
  56. md \
  57. memcachec \
  58. memcached \
  59. mic \
  60. monitorus \
  61. multimeter \
  62. netapp \
  63. nfs \
  64. notify_desktop \
  65. notify_email \
  66. notify_nagios \
  67. numa \
  68. openldap \
  69. openvz \
  70. oracle \
  71. ovs_events \
  72. ovs_stats \
  73. perl \
  74. pf \
  75. pinba \
  76. python \
  77. redis \
  78. routeros \
  79. rrdcached \
  80. serial \
  81. sigrok \
  82. smart \
  83. snmp_agent \
  84. statsd \
  85. swap \
  86. synproxy \
  87. tape \
  88. tokyotyrant \
  89. turbostat \
  90. uuid \
  91. varnish \
  92. virt \
  93. vserver \
  94. write_kafka \
  95. write_log \
  96. write_mongodb \
  97. write_prometheus \
  98. write_redis \
  99. write_riemann \
  100. write_sensu \
  101. write_tsdb \
  102. xencpu \
  103. xmms \
  104. zfs_arc \
  105. zone \
  106. zookeeper
  107. COLLECTD_PLUGINS_SELECTED:= \
  108. apache \
  109. apcups \
  110. ascent \
  111. bind \
  112. chrony \
  113. conntrack \
  114. contextswitch \
  115. cpu \
  116. cpufreq \
  117. csv \
  118. curl \
  119. df \
  120. disk \
  121. dns \
  122. email \
  123. entropy \
  124. ethstat \
  125. exec \
  126. filecount \
  127. fscache \
  128. interface \
  129. iptables \
  130. irq \
  131. iwinfo \
  132. load \
  133. logfile \
  134. match_empty_counter \
  135. match_hashed \
  136. match_regex \
  137. match_timediff \
  138. match_value \
  139. memory \
  140. modbus \
  141. mqtt \
  142. mysql \
  143. netlink \
  144. network \
  145. nginx \
  146. ntpd \
  147. nut \
  148. olsrd \
  149. onewire \
  150. openvpn \
  151. ping \
  152. postgresql \
  153. powerdns \
  154. processes \
  155. protocols \
  156. rrdtool \
  157. sensors \
  158. snmp \
  159. syslog \
  160. table \
  161. tail \
  162. tail_csv \
  163. tcpconns \
  164. teamspeak2 \
  165. ted \
  166. thermal \
  167. unixsock \
  168. uptime \
  169. users \
  170. vmem \
  171. wireless \
  172. write_graphite \
  173. write_http \
  174. PKG_CONFIG_DEPENDS:= \
  175. $(patsubst %,CONFIG_PACKAGE_collectd-mod-%,$(subst _,-,$(COLLECTD_PLUGINS_SELECTED))) \
  176. include $(INCLUDE_DIR)/package.mk
  177. include $(INCLUDE_DIR)/kernel.mk
  178. # collectd-mod-mysql needs iconv
  179. include $(INCLUDE_DIR)/nls.mk
  180. define Package/collectd/Default
  181. SECTION:=utils
  182. CATEGORY:=Utilities
  183. TITLE:=Lightweight system statistics collection daemon
  184. URL:=https://collectd.org/
  185. endef
  186. define Package/collectd
  187. $(call Package/collectd/Default)
  188. DEPENDS:= +libpthread +zlib +libltdl +libip4tc
  189. MENU:=1
  190. endef
  191. define Package/collectd/description
  192. collectd is a small daemon which collects system information periodically
  193. and provides mechanismns to store the values in a variety of ways.
  194. endef
  195. define Package/collectd/config
  196. config PACKAGE_COLLECTD_ENCRYPTED_NETWORK
  197. bool "Enable ability to use encrypted networking"
  198. default n
  199. depends on PACKAGE_collectd
  200. select PACKAGE_collectd-mod-network
  201. endef
  202. # common configure args
  203. CONFIGURE_ARGS+= \
  204. --disable-werror \
  205. --disable-debug \
  206. --enable-daemon \
  207. --with-nan-emulation \
  208. --with-libyajl=no \
  209. --without-perl-bindings \
  210. --without-libudev
  211. CONFIGURE_VARS+= \
  212. CFLAGS="$$$$CFLAGS $(FPIC)" \
  213. LDFLAGS="$$$$LDFLAGS -lm -lz" \
  214. KERNEL_DIR="$(LINUX_DIR)" \
  215. ifneq ($(CONFIG_PACKAGE_COLLECTD_ENCRYPTED_NETWORK),)
  216. CONFIGURE_ARGS+= \
  217. --with-libgcrypt=$(STAGING_DIR)/usr
  218. CONFIGURE_VARS+= \
  219. GCRYPT_LIBS="-lgcrypt"
  220. else
  221. CONFIGURE_ARGS+= \
  222. --without-libgcrypt
  223. endif
  224. CONFIGURE_PLUGIN= \
  225. $(foreach m, $(1), \
  226. $(if $(CONFIG_PACKAGE_collectd-mod-$(subst _,-,$(m))),--enable-$(m),--disable-$(m)) \
  227. )
  228. CONFIGURE_ARGS+= \
  229. $(call CONFIGURE_PLUGIN,$(COLLECTD_PLUGINS_SELECTED)) \
  230. $(call CONFIGURE_PLUGIN,$(COLLECTD_PLUGINS_DISABLED)) \
  231. # exception: mod-ascent needs libxml2
  232. ifneq ($(CONFIG_PACKAGE_collectd-mod-ascent),)
  233. CONFIGURE_VARS+= \
  234. CPPFLAGS="$$$$CPPFLAGS -I$(STAGING_DIR)/usr/include/libxml2"
  235. endif
  236. ifneq ($(CONFIG_BIG_ENDIAN),)
  237. CONFIGURE_ARGS+= --with-fp-layout=endianflip
  238. else
  239. CONFIGURE_ARGS+= --with-fp-layout=nothing
  240. endif
  241. ifneq ($(CONFIG_PACKAGE_collectd-mod-postgresql),)
  242. CONFIGURE_ARGS+= --with-libpq="$(STAGING_DIR)/usr/"
  243. endif
  244. ifneq ($(CONFIG_PACKAGE_collectd-mod-mysql),)
  245. CONFIGURE_ARGS+= --with-libmysql="$(STAGING_DIR)/usr/"
  246. endif
  247. # exception: mod-netlink needs libnetlink from iproute
  248. ifneq ($(CONFIG_PACKAGE_collectd-mod-netlink),)
  249. CONFIGURE_ARGS+= --with-libnetlink="$(STAGING_DIR)/usr"
  250. endif
  251. # exception: mod-modbus needs libmodbus
  252. ifneq ($(CONFIG_PACKAGE_collectd-mod-modbus),)
  253. CONFIGURE_ARGS+= --with-libmodbus="$(STAGING_DIR)/usr"
  254. endif
  255. # exception: mod-onewire needs libow-capi
  256. ifneq ($(CONFIG_PACKAGE_collectd-mod-onewire),)
  257. CONFIGURE_ARGS+= --with-libowcapi="$(STAGING_DIR)/usr"
  258. endif
  259. # exception: mod-rrdtool needs rrdtool-1.0.x
  260. ifneq ($(CONFIG_PACKAGE_collectd-mod-rrdtool),)
  261. CONFIGURE_ARGS+= --with-librrd="$(STAGING_DIR)/usr/lib/rrdtool-1.0"
  262. endif
  263. define Package/collectd/conffiles
  264. /etc/collectd.conf
  265. endef
  266. define Package/collectd/install
  267. $(INSTALL_DIR) $(1)/usr/sbin
  268. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/collectd $(1)/usr/sbin/
  269. $(INSTALL_DIR) $(1)/usr/share/collectd
  270. $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/collectd/types.db $(1)/usr/share/collectd/
  271. $(INSTALL_DIR) $(1)/etc
  272. $(INSTALL_CONF) ./files/collectd.conf $(1)/etc/
  273. $(INSTALL_DIR) $(1)/etc/init.d
  274. $(INSTALL_BIN) ./files/collectd.init $(1)/etc/init.d/collectd
  275. $(INSTALL_DIR) $(1)/etc/collectd/conf.d
  276. endef
  277. # 1: plugin name
  278. # 2: plugin title/description
  279. # 3: files
  280. # 4: extra dependency
  281. define BuildPlugin
  282. PKG_CONFIG_DEPENDS+= CONFIG_PACKAGE_collectd-mod-$(1)
  283. define Package/collectd-mod-$(1)
  284. $$(call Package/collectd/Default)
  285. TITLE:=$(2) plugin
  286. DEPENDS:= collectd $(4)
  287. endef
  288. define Package/collectd-mod-$(1)/install
  289. $(INSTALL_DIR) $$(1)/usr/lib/collectd
  290. for m in $(3); do \
  291. $(CP) \
  292. $(PKG_INSTALL_DIR)/usr/lib/collectd/$$$$$$$${m}.so \
  293. $$(1)/usr/lib/collectd/ ; \
  294. done
  295. endef
  296. $$(eval $$(call BuildPackage,collectd-mod-$(1)))
  297. endef
  298. $(eval $(call BuildPackage,collectd))
  299. #$(eval $(call BuildPlugin,NAME,DESCRIPTION,FILES,DEPENDENCIES))
  300. $(eval $(call BuildPlugin,apache,apache status input,apache,+PACKAGE_collectd-mod-apache:libcurl))
  301. $(eval $(call BuildPlugin,apcups,apcups status input,apcups,))
  302. $(eval $(call BuildPlugin,ascent,ascent status input,ascent,+PACKAGE_collectd-mod-ascent:libcurl +PACKAGE_collectd-mod-ascent:libxml2))
  303. $(eval $(call BuildPlugin,bind,BIND server/zone input,bind,+PACKAGE_collectd-mod-bind:libcurl +PACKAGE_collectd-mod-bind:libxml2))
  304. $(eval $(call BuildPlugin,chrony,chrony status input,chrony,))
  305. $(eval $(call BuildPlugin,conntrack,connection tracking table size input,conntrack,))
  306. $(eval $(call BuildPlugin,contextswitch,context switch input,contextswitch,))
  307. $(eval $(call BuildPlugin,cpu,CPU input,cpu,))
  308. $(eval $(call BuildPlugin,cpufreq,CPU Freq input,cpufreq,@(TARGET_x86||TARGET_x86_64||TARGET_mvebu||TARGET_ipq806x||TARGET_armvirt))) # Only enable on x86 mvebu ipq806x armvirt
  309. $(eval $(call BuildPlugin,csv,CSV output,csv,))
  310. $(eval $(call BuildPlugin,curl,cURL input,curl,+PACKAGE_collectd-mod-curl:libcurl))
  311. #$(eval $(call BuildPlugin,dbi,relational database input,dbi,+PACKAGE_collectd-mod-dbi:libdbi))
  312. $(eval $(call BuildPlugin,df,disk space input,df,))
  313. $(eval $(call BuildPlugin,disk,disk usage/timing input,disk,))
  314. $(eval $(call BuildPlugin,dns,DNS traffic input,dns,+PACKAGE_collectd-mod-dns:libpcap))
  315. $(eval $(call BuildPlugin,email,email output,email,))
  316. $(eval $(call BuildPlugin,entropy,Entropy amount input,entropy,))
  317. $(eval $(call BuildPlugin,ethstat,Ethernet adapter statistics input,ethstat,))
  318. $(eval $(call BuildPlugin,exec,process exec input,exec,))
  319. $(eval $(call BuildPlugin,filecount,file count input,filecount,))
  320. $(eval $(call BuildPlugin,fscache,file-system based caching framework input,fscache,))
  321. $(eval $(call BuildPlugin,interface,network interfaces input,interface,))
  322. $(eval $(call BuildPlugin,iptables,iptables status input,iptables,+PACKAGE_collectd-mod-iptables:iptables +libiptc))
  323. $(eval $(call BuildPlugin,irq,interrupt usage input,irq,))
  324. $(eval $(call BuildPlugin,iwinfo,libiwinfo wireless statistics,iwinfo,+PACKAGE_collectd-mod-iwinfo:libiwinfo))
  325. $(eval $(call BuildPlugin,load,system load input,load,))
  326. $(eval $(call BuildPlugin,logfile,log files output,logfile,))
  327. $(eval $(call BuildPlugin,match-empty-counter,empty-counter match,match_empty_counter,))
  328. $(eval $(call BuildPlugin,match-hashed,hashed match,match_hashed,))
  329. $(eval $(call BuildPlugin,match-regex,regex match,match_regex,))
  330. $(eval $(call BuildPlugin,match-timediff,timediff match,match_timediff,))
  331. $(eval $(call BuildPlugin,match-value,value match,match_value,))
  332. $(eval $(call BuildPlugin,mysql,MySQL status input,mysql,+PACKAGE_collectd-mod-mysql:libmysqlclient-r))
  333. $(eval $(call BuildPlugin,memory,physical memory usage input,memory,))
  334. $(eval $(call BuildPlugin,modbus,read variables through libmodbus,modbus,+PACKAGE_collectd-mod-modbus:libmodbus))
  335. $(eval $(call BuildPlugin,mqtt,transmit data with MQTT,mqtt,+PACKAGE_collectd-mod-mqtt:libmosquitto))
  336. $(eval $(call BuildPlugin,netlink,netlink input,netlink,+PACKAGE_collectd-mod-netlink:libmnl))
  337. $(eval $(call BuildPlugin,network,network input/output,network,+PACKAGE_COLLECTD_ENCRYPTED_NETWORK:libgcrypt))
  338. $(eval $(call BuildPlugin,nginx,nginx status input,nginx,+PACKAGE_collectd-mod-nginx:libcurl))
  339. $(eval $(call BuildPlugin,ntpd,NTP daemon status input,ntpd,))
  340. $(eval $(call BuildPlugin,nut,UPS monitoring input,nut,+PACKAGE_collectd-mod-nut:nut-common))
  341. $(eval $(call BuildPlugin,olsrd,OLSRd status input,olsrd,))
  342. $(eval $(call BuildPlugin,onewire,onewire sensor input,onewire,+PACKAGE_collectd-mod-onewire:libow-capi @BROKEN))
  343. $(eval $(call BuildPlugin,openvpn,OpenVPN traffic/compression input,openvpn,))
  344. $(eval $(call BuildPlugin,ping,ping status input,ping,+PACKAGE_collectd-mod-ping:liboping))
  345. $(eval $(call BuildPlugin,postgresql,PostgreSQL status input,postgresql,+PACKAGE_collectd-mod-postgresql:libpq))
  346. $(eval $(call BuildPlugin,powerdns,PowerDNS server status input,powerdns,))
  347. $(eval $(call BuildPlugin,processes,process status input,processes,))
  348. $(eval $(call BuildPlugin,protocols,network protocols input,protocols,))
  349. $(eval $(call BuildPlugin,rrdtool,RRDtool output,rrdtool,+PACKAGE_collectd-mod-rrdtool:librrd1))
  350. $(eval $(call BuildPlugin,sensors,lm_sensors input,sensors,+PACKAGE_collectd-mod-sensors:libsensors))
  351. $(eval $(call BuildPlugin,snmp,SNMP input,snmp,+PACKAGE_collectd-mod-snmp:libnetsnmp))
  352. $(eval $(call BuildPlugin,syslog,syslog output,syslog,))
  353. $(eval $(call BuildPlugin,tail,tail input,tail,))
  354. $(eval $(call BuildPlugin,tail-csv,tail CSV input,tail_csv,))
  355. $(eval $(call BuildPlugin,table,table-like structured file input,table,))
  356. $(eval $(call BuildPlugin,teamspeak2,TeamSpeak2 input,teamspeak2,))
  357. $(eval $(call BuildPlugin,ted,The Energy Detective input,ted,))
  358. $(eval $(call BuildPlugin,tcpconns,TCP connection tracking input,tcpconns,))
  359. $(eval $(call BuildPlugin,thermal,system temperatures input,thermal,))
  360. $(eval $(call BuildPlugin,unixsock,unix socket output,unixsock,))
  361. $(eval $(call BuildPlugin,uptime,uptime status input,uptime,))
  362. $(eval $(call BuildPlugin,users,user logged in status input,users,))
  363. $(eval $(call BuildPlugin,vmem,virtual memory usage input,vmem,))
  364. $(eval $(call BuildPlugin,wireless,wireless status input,wireless,))
  365. $(eval $(call BuildPlugin,write-graphite,Carbon/Graphite output,write_graphite,+PACKAGE_collectd-mod-write-graphite:libpthread))
  366. $(eval $(call BuildPlugin,write-http,HTTP POST output,write_http,+PACKAGE_collectd-mod-write-http:libcurl))