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.

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