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.

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