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.

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