summaryrefslogtreecommitdiffstats
path: root/meta-oe/recipes-extended/collectd
diff options
context:
space:
mode:
authorTudor Florea <tudor.florea@enea.com>2015-10-08 22:51:41 +0200
committerTudor Florea <tudor.florea@enea.com>2015-10-08 22:51:41 +0200
commit1219bf8a90a7bf8cd3a5363551ef635d51e8fc8e (patch)
treea21a5fc103bb3bd65ecd85ed22be5228fc54e447 /meta-oe/recipes-extended/collectd
downloadmeta-openembedded-1219bf8a90a7bf8cd3a5363551ef635d51e8fc8e.tar.gz
initial commit for Enea Linux 5.0 arm
Signed-off-by: Tudor Florea <tudor.florea@enea.com>
Diffstat (limited to 'meta-oe/recipes-extended/collectd')
-rw-r--r--meta-oe/recipes-extended/collectd/collectd/collectd-version.patch31
-rw-r--r--meta-oe/recipes-extended/collectd/collectd/collectd.init212
-rw-r--r--meta-oe/recipes-extended/collectd/collectd/collectd.service12
-rw-r--r--meta-oe/recipes-extended/collectd/collectd/glibc-2.20-compatiblity.patch102
-rw-r--r--meta-oe/recipes-extended/collectd/collectd/no-gcrypt-badpath.patch30
-rw-r--r--meta-oe/recipes-extended/collectd/collectd_5.4.1.bb74
6 files changed, 461 insertions, 0 deletions
diff --git a/meta-oe/recipes-extended/collectd/collectd/collectd-version.patch b/meta-oe/recipes-extended/collectd/collectd/collectd-version.patch
new file mode 100644
index 000000000..1e2b7c159
--- /dev/null
+++ b/meta-oe/recipes-extended/collectd/collectd/collectd-version.patch
@@ -0,0 +1,31 @@
1Don't pick up version string from parent git repository
2
3If the collectd source is extracted from a tarball underneath a
4directory structure that includes another git repository, that
5repository will be picked up by "git describe" which is not
6desirable. Check whether collectd itself is a git repository and just
7use the default version if not.
8
9Upstream-Status: Pending
10
11Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
12
13diff --git a/version-gen.sh b/version-gen.sh
14index e344541..d1c0929 100755
15--- a/version-gen.sh
16+++ b/version-gen.sh
17@@ -2,7 +2,10 @@
18
19 DEFAULT_VERSION="5.2.2.git"
20
21-VERSION="`git describe 2> /dev/null | sed -e 's/^collectd-//'`"
22+VERSION=""
23+if test -d .git ; then
24+ VERSION="`git describe 2> /dev/null | sed -e 's/^collectd-//'`"
25+fi
26
27 if test -z "$VERSION"; then
28 VERSION="$DEFAULT_VERSION"
29--
301.7.10.4
31
diff --git a/meta-oe/recipes-extended/collectd/collectd/collectd.init b/meta-oe/recipes-extended/collectd/collectd/collectd.init
new file mode 100644
index 000000000..95f5f73c6
--- /dev/null
+++ b/meta-oe/recipes-extended/collectd/collectd/collectd.init
@@ -0,0 +1,212 @@
1#!/bin/sh
2#
3# collectd - start and stop the statistics collection daemon
4# http://collectd.org/
5#
6# Copyright (C) 2005-2006 Florian Forster <octo@verplant.org>
7# Copyright (C) 2006-2009 Sebastian Harl <tokkee@debian.org>
8#
9
10### BEGIN INIT INFO
11# Provides: collectd
12# Required-Start: $local_fs $remote_fs
13# Required-Stop: $local_fs $remote_fs
14# Should-Start: $network $named $syslog $time cpufrequtils
15# Should-Stop: $network $named $syslog
16# Default-Start: 2 3 4 5
17# Default-Stop: 0 1 6
18# Short-Description: manage the statistics collection daemon
19# Description: collectd is the statistics collection daemon.
20# It is a small daemon which collects system information
21# periodically and provides mechanisms to monitor and store
22# the values in a variety of ways.
23### END INIT INFO
24
25. /etc/init.d/functions
26
27export PATH=/sbin:/bin:/usr/sbin:/usr/bin
28
29DISABLE=0
30
31NAME=collectd
32DAEMON=/usr/sbin/collectd
33
34CONFIGFILE=/etc/collectd.conf
35PIDFILE=/var/run/collectd.pid
36
37USE_COLLECTDMON=1
38COLLECTDMON_DAEMON=/usr/sbin/collectdmon
39COLLECTDMON_PIDFILE=/var/run/collectdmon.pid
40
41MAXWAIT=30
42
43# Gracefully exit if the package has been removed.
44test -x $DAEMON || exit 0
45
46if [ -r /etc/default/$NAME ]; then
47 . /etc/default/$NAME
48fi
49
50if test "$ENABLE_COREFILES" == 1; then
51 ulimit -c unlimited
52fi
53
54if test "$USE_COLLECTDMON" == 1; then
55 _PIDFILE="$COLLECTDMON_PIDFILE"
56else
57 _PIDFILE="$PIDFILE"
58fi
59
60# return:
61# 0 if config is fine
62# 1 if there is a syntax error
63# 2 if there is no configuration
64check_config() {
65 if test ! -e "$CONFIGFILE"; then
66 return 2
67 fi
68 if ! $DAEMON -t -C "$CONFIGFILE"; then
69 return 1
70 fi
71 return 0
72}
73
74# return:
75# 0 if the daemon has been started
76# 1 if the daemon was already running
77# 2 if the daemon could not be started
78# 3 if the daemon was not supposed to be started
79d_start() {
80 if test "$DISABLE" != 0; then
81 # we get here during restart
82 echo "disabled by /etc/default/$NAME"
83 return 3
84 fi
85
86 if test ! -e "$CONFIGFILE"; then
87 # we get here during restart
88 echo "disabled, no configuration ($CONFIGFILE) found"
89 return 3
90 fi
91
92 check_config
93 rc="$?"
94 if test "$rc" -ne 0; then
95 echo "not starting, configuration error"
96 return 2
97 fi
98
99 if test "$USE_COLLECTDMON" == 1; then
100 start-stop-daemon --start --quiet --oknodo --pidfile "$_PIDFILE" \
101 --exec $COLLECTDMON_DAEMON -- -P "$_PIDFILE" -- -C "$CONFIGFILE" \
102 || return 2
103 else
104 start-stop-daemon --start --quiet --oknodo --pidfile "$_PIDFILE" \
105 --exec $DAEMON -- -C "$CONFIGFILE" -P "$_PIDFILE" \
106 || return 2
107 fi
108 return 0
109}
110
111still_running_warning="
112WARNING: $NAME might still be running.
113In large setups it might take some time to write all pending data to
114the disk. You can adjust the waiting time in /etc/default/collectd."
115
116# return:
117# 0 if the daemon has been stopped
118# 1 if the daemon was already stopped
119# 2 if daemon could not be stopped
120d_stop() {
121 PID=$( cat "$_PIDFILE" 2> /dev/null ) || true
122
123 start-stop-daemon --stop --quiet --oknodo --pidfile "$_PIDFILE"
124 rc="$?"
125
126 if test "$rc" -eq 2; then
127 return 2
128 fi
129
130 sleep 1
131 if test -n "$PID" && kill -0 $PID 2> /dev/null; then
132 i=0
133 while kill -0 $PID 2> /dev/null; do
134 i=$(( $i + 2 ))
135 echo -n " ."
136
137 if test $i -gt $MAXWAIT; then
138 echo "$still_running_warning"
139 return 2
140 fi
141
142 sleep 2
143 done
144 return "$rc"
145 fi
146 return "$rc"
147}
148
149# return:
150# 0 if the daemon is running
151# 3 if the daemon is stopped
152d_status(){
153 if test "$USE_COLLECTDMON" == 1; then
154 status $COLLECTDMON_DAEMON
155 else
156 status $DAEMON
157 fi
158}
159
160case "$1" in
161 start)
162 echo -n "Starting $NAME"
163 d_start
164 case "$?" in
165 0|1) echo "." ;;
166 *) exit 1 ;;
167 esac
168 ;;
169 stop)
170 echo -n "Stopping $NAME"
171 d_stop
172 case "$?" in
173 0|1) echo "." ;;
174 *) exit 1 ;;
175 esac
176 ;;
177 status)
178 d_status
179 ;;
180 restart|force-reload)
181 echo -n "Restarting $NAME"
182 check_config
183 rc="$?"
184 if test "$rc" -eq 1; then
185 echo "not restarting, configuration error"
186 exit 1
187 fi
188 d_stop
189 rc="$?"
190 case "$rc" in
191 0|1)
192 sleep 1
193 d_start
194 rc2="$?"
195 case "$rc2" in
196 0|1) echo "." ;;
197 *) exit 1 ;;
198 esac
199 ;;
200 *)
201 exit 1
202 ;;
203 esac
204 ;;
205 *)
206 echo "Usage: $0 {start|stop|restart|force-reload|status}" >&2
207 exit 3
208 ;;
209esac
210
211# vim: syntax=sh noexpandtab sw=4 ts=4 :
212
diff --git a/meta-oe/recipes-extended/collectd/collectd/collectd.service b/meta-oe/recipes-extended/collectd/collectd/collectd.service
new file mode 100644
index 000000000..d835b735f
--- /dev/null
+++ b/meta-oe/recipes-extended/collectd/collectd/collectd.service
@@ -0,0 +1,12 @@
1[Unit]
2Description=Collectd
3After=local-fs.target network.target
4Requires=local-fs.target network.target
5
6[Service]
7ExecStart=@SBINDIR@/collectd -C /etc/collectd.conf -f
8Restart=always
9RestartSec=10
10
11[Install]
12WantedBy=multi-user.target
diff --git a/meta-oe/recipes-extended/collectd/collectd/glibc-2.20-compatiblity.patch b/meta-oe/recipes-extended/collectd/collectd/glibc-2.20-compatiblity.patch
new file mode 100644
index 000000000..2596bedf9
--- /dev/null
+++ b/meta-oe/recipes-extended/collectd/collectd/glibc-2.20-compatiblity.patch
@@ -0,0 +1,102 @@
1This makes it forward compatible with glibc 2.20+ where _BSD_SOURCE
2macro has been deprecated.
3
4Fixes warnings like
5
6usr/include/features.h:148:3: error: #warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE" [-Werror=cpp]
7| # warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE"
8
9Signed-off-by: Khem Raj <raj.khem@gmail.com>
10Upstream-Status: Pending
11Index: collectd-5.4.1/configure.ac
12===================================================================
13--- collectd-5.4.1.orig/configure.ac 2014-09-03 01:21:10.666084244 -0700
14+++ collectd-5.4.1/configure.ac 2014-09-03 01:31:27.794084244 -0700
15@@ -1288,6 +1288,7 @@
16
17 AC_CHECK_MEMBERS([struct udphdr.uh_dport, struct udphdr.uh_sport], [], [],
18 [#define _BSD_SOURCE
19+#define _DEFAULT_SOURCE 1
20 #if HAVE_STDINT_H
21 # include <stdint.h>
22 #endif
23@@ -1309,6 +1310,7 @@
24 ])
25 AC_CHECK_MEMBERS([struct udphdr.dest, struct udphdr.source], [], [],
26 [#define _BSD_SOURCE
27+#define _DEFAULT_SOURCE 1
28 #if HAVE_STDINT_H
29 # include <stdint.h>
30 #endif
31Index: collectd-5.4.1/src/dns.c
32===================================================================
33--- collectd-5.4.1.orig/src/dns.c 2014-01-26 00:09:14.856391886 -0800
34+++ collectd-5.4.1/src/dns.c 2014-09-03 01:32:37.666084244 -0700
35@@ -22,6 +22,7 @@
36 **/
37
38 #define _BSD_SOURCE
39+#define _DEFAULT_SOURCE 1
40
41 #include "collectd.h"
42 #include "common.h"
43Index: collectd-5.4.1/src/exec.c
44===================================================================
45--- collectd-5.4.1.orig/src/exec.c 2014-01-26 00:09:14.860391963 -0800
46+++ collectd-5.4.1/src/exec.c 2014-09-03 01:32:28.874084244 -0700
47@@ -24,6 +24,7 @@
48 **/
49
50 #define _BSD_SOURCE /* For setgroups */
51+#define _DEFAULT_SOURCE 1
52
53 #include "collectd.h"
54 #include "common.h"
55Index: collectd-5.4.1/src/load.c
56===================================================================
57--- collectd-5.4.1.orig/src/load.c 2014-01-26 00:09:23.532559941 -0800
58+++ collectd-5.4.1/src/load.c 2014-09-03 01:32:51.462084244 -0700
59@@ -22,6 +22,7 @@
60 **/
61
62 #define _BSD_SOURCE
63+#define _DEFAULT_SOURCE 1
64
65 #include "collectd.h"
66 #include "common.h"
67Index: collectd-5.4.1/src/network.c
68===================================================================
69--- collectd-5.4.1.orig/src/network.c 2014-01-26 00:09:23.532559941 -0800
70+++ collectd-5.4.1/src/network.c 2014-09-03 01:32:44.522084244 -0700
71@@ -23,6 +23,7 @@
72 **/
73
74 #define _BSD_SOURCE /* For struct ip_mreq */
75+#define _DEFAULT_SOURCE 1
76
77 #include "collectd.h"
78 #include "plugin.h"
79Index: collectd-5.4.1/src/ntpd.c
80===================================================================
81--- collectd-5.4.1.orig/src/ntpd.c 2014-01-26 00:09:14.880392351 -0800
82+++ collectd-5.4.1/src/ntpd.c 2014-09-03 01:32:20.350084244 -0700
83@@ -20,6 +20,7 @@
84 **/
85
86 #define _BSD_SOURCE /* For NI_MAXHOST */
87+#define _DEFAULT_SOURCE 1
88
89 #include "collectd.h"
90 #include "common.h"
91Index: collectd-5.4.1/src/utils_dns.c
92===================================================================
93--- collectd-5.4.1.orig/src/utils_dns.c 2014-01-26 00:09:14.908392893 -0800
94+++ collectd-5.4.1/src/utils_dns.c 2014-09-03 01:31:47.062084244 -0700
95@@ -34,6 +34,7 @@
96 */
97
98 #define _BSD_SOURCE
99+#define _DEFAULT_SOURCE 1
100
101 #include "collectd.h"
102 #include "plugin.h"
diff --git a/meta-oe/recipes-extended/collectd/collectd/no-gcrypt-badpath.patch b/meta-oe/recipes-extended/collectd/collectd/no-gcrypt-badpath.patch
new file mode 100644
index 000000000..0e876ae85
--- /dev/null
+++ b/meta-oe/recipes-extended/collectd/collectd/no-gcrypt-badpath.patch
@@ -0,0 +1,30 @@
1Disable defaulting of GCRYPT_LDFLAGS to -L/usr/lib
2
3Prevents "unsafe for cross compilation" warnings that cause
4do_qa_configure to fail.
5
6Upstream-Status: Inappropriate [configuration]
7
8Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
9
10Index: collectd-5.4.1/configure.ac
11===================================================================
12--- collectd-5.4.1.orig/configure.ac 2014-09-03 01:20:22.062084244 -0700
13+++ collectd-5.4.1/configure.ac 2014-09-03 01:20:22.058084244 -0700
14@@ -1867,11 +1867,11 @@
15 GCRYPT_CPPFLAGS=`"$with_libgcrypt_config" --cflags 2>/dev/null`
16 fi
17
18- if test "x$GCRYPT_LDFLAGS" = "x"
19- then
20- gcrypt_exec_prefix=`"$with_libgcrypt_config" --exec-prefix 2>/dev/null`
21- GCRYPT_LDFLAGS="-L$gcrypt_exec_prefix/lib"
22- fi
23+# if test "x$GCRYPT_LDFLAGS" = "x"
24+# then
25+# gcrypt_exec_prefix=`"$with_libgcrypt_config" --exec-prefix 2>/dev/null`
26+# GCRYPT_LDFLAGS="-L$gcrypt_exec_prefix/lib"
27+# fi
28
29 if test "x$GCRYPT_LIBS" = "x"
30 then
diff --git a/meta-oe/recipes-extended/collectd/collectd_5.4.1.bb b/meta-oe/recipes-extended/collectd/collectd_5.4.1.bb
new file mode 100644
index 000000000..46752c895
--- /dev/null
+++ b/meta-oe/recipes-extended/collectd/collectd_5.4.1.bb
@@ -0,0 +1,74 @@
1SUMMARY = "Collects and summarises system performance statistics"
2DESCRIPTION = "collectd is a daemon which collects system performance statistics periodically and provides mechanisms to store the values in a variety of ways, for example in RRD files."
3LICENSE = "GPLv2"
4LIC_FILES_CHKSUM = "file://COPYING;md5=751419260aa954499f7abaabaa882bbe"
5
6DEPENDS = "rrdtool curl mysql5 libpcap libxml2 yajl libgcrypt libtool lvm2 libmnl"
7
8SRC_URI = "http://collectd.org/files/collectd-${PV}.tar.bz2 \
9 file://no-gcrypt-badpath.patch \
10 file://collectd-version.patch \
11 file://glibc-2.20-compatiblity.patch \
12 file://collectd.init \
13 file://collectd.service"
14SRC_URI[md5sum] = "6f56c71c96573a7f4f7fb3bfab185974"
15SRC_URI[sha256sum] = "75452129f271cb0aad28e57f12a49070618bbb7b6a9d64cf869e8766fa2f66e0"
16
17inherit autotools pythonnative update-rc.d pkgconfig systemd
18
19SYSTEMD_SERVICE_${PN} = "collectd.service"
20
21# Floatingpoint layout, architecture dependent
22# 'nothing', 'endianflip' or 'intswap'
23FPLAYOUT ?= "--with-fp-layout=nothing"
24
25PACKAGECONFIG ??= ""
26PACKAGECONFIG[snmp] = "--enable-snmp,--disable-snmp --with-libnetsnmp=no,net-snmp"
27PACKAGECONFIG[libmemcached] = "--with-libmemcached,--without-libmemcached,libmemcached"
28PACKAGECONFIG[iptables] = "--enable-iptables,--disable-iptables,iptables"
29PACKAGECONFIG[postgresql] = "--enable-postgresql --with-libpq=yes, \
30 --disable-postgresql --with-libpq=no,postgresql"
31PACKAGECONFIG[dbi] = "--enable-dbi,--disable-dbi,libdbi"
32PACKAGECONFIG[modbus] = "--enable-modbus,--disable-modbus,libmodbus"
33PACKAGECONFIG[libowcapi] = "--with-libowcapi,--without-libowcapi,owfs"
34PACKAGECONFIG[sensors] = "--enable-sensors --with-libsensors=yes, \
35 --disable-sensors --with-libsensors=no,lmsensors"
36PACKAGECONFIG[amqp] = "--enable-amqp --with-librabbitmq=yes, \
37 --disable-amqp --with-librabbitmq=no,rabbitmq-c"
38# protobuf-c that is currently only available in meta-virtualization layer
39PACKAGECONFIG[pinba] = "--enable-pinba,--disable-pinba,protobuf-c-native protobuf-c"
40
41EXTRA_OECONF = " \
42 ${FPLAYOUT} \
43 --disable-perl --with-libperl=no --with-perl-bindings=no \
44 --with-libgcrypt=${STAGING_BINDIR_CROSS}/libgcrypt-config \
45 --disable-notify_desktop \
46"
47
48do_install_append() {
49 install -d ${D}${sysconfdir}/init.d
50 install -m 0755 ${WORKDIR}/collectd.init ${D}${sysconfdir}/init.d/collectd
51 sed -i 's!/usr/sbin/!${sbindir}/!g' ${D}${sysconfdir}/init.d/collectd
52 sed -i 's!/etc/!${sysconfdir}/!g' ${D}${sysconfdir}/init.d/collectd
53 sed -i 's!/var/!${localstatedir}/!g' ${D}${sysconfdir}/init.d/collectd
54 sed -i 's!^PATH=.*!PATH=${base_sbindir}:${base_bindir}:${sbindir}:${bindir}!' ${D}${sysconfdir}/init.d/collectd
55
56 # Fix configuration file to allow collectd to start up
57 sed -i 's!^#FQDNLookup[ \t]*true!FQDNLookup false!g' ${D}${sysconfdir}/collectd.conf
58
59 rmdir "${D}${localstatedir}/run"
60 rmdir --ignore-fail-on-non-empty "${D}${localstatedir}"
61
62 # Install systemd unit files
63 install -d ${D}${systemd_unitdir}/system
64 install -m 0644 ${WORKDIR}/collectd.service ${D}${systemd_unitdir}/system
65 sed -i -e 's,@SBINDIR@,${sbindir},g' \
66 ${D}${systemd_unitdir}/system/collectd.service
67}
68
69INITSCRIPT_NAME = "collectd"
70INITSCRIPT_PARAMS = "defaults"
71
72# threshold.so load.so are also provided by gegl
73# disk.so is also provided by libgphoto2-camlibs
74PRIVATE_LIBS = "threshold.so load.so disk.so"