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.

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