[collectd] [PATCH] Add RPM .spec file and startup script for AIX

Aurelien Reynaud collectd at wattapower.net
Thu Oct 14 21:18:47 CEST 2010


Signed-off-by: Aurelien Reynaud <collectd at wattapower.net>
---
 contrib/aix/aix.spec        |   75 ++++++++++++++++++++++++++++++++++++++++++
 contrib/aix/init.d-collectd |   76 +++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 151 insertions(+), 0 deletions(-)
 create mode 100644 contrib/aix/aix.spec
 create mode 100755 contrib/aix/init.d-collectd

diff --git a/contrib/aix/aix.spec b/contrib/aix/aix.spec
new file mode 100644
index 0000000..c148d79
--- /dev/null
+++ b/contrib/aix/aix.spec
@@ -0,0 +1,75 @@
+
+%define name    collectd
+%define version 4.10.1
+%define release 1
+
+Name:           %{name}
+Summary:        Statistics collection daemon for filling RRD files.
+Version:        %{version}
+Release:        %{release}
+#Source:         http://collectd.org/files/%{name}-%{version}.tar.gz
+Source0:        %{name}-%{version}.tar.gz
+Group:          System Environment/Daemons
+BuildRoot:      %{_tmppath}/%{name}-%{version}-buildroot
+License:        GPL
+BuildPrereq:    rrdtool-devel,net-snmp-devel
+Requires:       rrdtool,net-snmp
+Packager:       Aurelien Reynaud <collectd at wattapower.net>
+Vendor:         collectd development team <collectd at verplant.org>
+
+%description
+collectd is a small daemon which collects system information periodically and
+provides mechanisms to monitor and store the values in a variety of ways. It
+is written in C for performance. Since the daemon doesn't need to startup
+every time it wants to update the values it's very fast and easy on the
+system. Also, the statistics are very fine grained since the files are updated
+every 10 seconds.
+
+%prep
+%setup
+
+%build
+# The RM variable in the RPM environment conflicts with that of the build environment,
+# at least when building on AIX 6.1. This is definitely a bug in one of the tools but
+# for now we work around it by unsetting the variable below.
+[ -n "$RM" ] && unset RM
+./configure LDFLAGS="-Wl,-brtl" --prefix=/opt/freeware --mandir=/opt/freeware/man --disable-dns --with-libnetsnmp=/opt/freeware/bin/net-snmp-config
+make
+
+%install
+make install DESTDIR=$RPM_BUILD_ROOT
+mkdir -p $RPM_BUILD_ROOT/%{_localstatedir}/lib/%{name}
+mkdir -p $RPM_BUILD_ROOT/%{_localstatedir}/run
+mkdir -p $RPM_BUILD_ROOT/etc/rc.d/init.d
+cp contrib/aix/init.d-collectd $RPM_BUILD_ROOT/etc/rc.d/init.d/collectd
+
+%clean
+[ "$RPM_BUILD_ROOT" != "/" ] && rm -rf "$RPM_BUILD_ROOT"
+
+%files
+%defattr(-,root,system)
+%doc AUTHORS COPYING ChangeLog INSTALL NEWS README
+%config(noreplace) %attr(0644,root,system) %{_sysconfdir}/collectd.conf
+%attr(0755,root,system) /etc/rc.d/init.d/collectd
+%attr(0755,root,system) %{_sbindir}/collectd
+%attr(0755,root,system) %{_bindir}/collectd-nagios
+%attr(0755,root,system) %{_sbindir}/collectdmon
+%attr(0644,root,system) %{_mandir}/man1/*
+%attr(0644,root,system) %{_mandir}/man5/*
+
+# client
+%attr(0644,root,system) %{_includedir}/%{name}/client.h
+%attr(0644,root,system) %{_includedir}/%{name}/lcc_features.h
+
+%attr(0644,root,system) %{_libdir}/libcollectdclient.*
+%attr(0644,root,system) %{_libdir}/pkgconfig/libcollectdclient.pc
+
+%attr(0444,root,system) %{_libdir}/%{name}/*.so
+%attr(0444,root,system) %{_libdir}/%{name}/*.a
+%attr(0444,root,system) %{_libdir}/%{name}/*.la
+
+%attr(0644,root,system) %{_datadir}/%{name}/types.db
+
+%dir %{_localstatedir}/lib/%{name}
+%dir %{_localstatedir}/run
+
diff --git a/contrib/aix/init.d-collectd b/contrib/aix/init.d-collectd
new file mode 100755
index 0000000..07ebbac
--- /dev/null
+++ b/contrib/aix/init.d-collectd
@@ -0,0 +1,76 @@
+#!/bin/sh
+#
+# description: collectd startup script
+#
+# March 2010, A. Reynaud
+#
+
+# Some plugins need libs in non-standard paths
+case `uname` in
+	SunOS)
+		LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib:/usr/local/ssl/lib
+		export LD_LIBRARY_PATH
+		;;
+	*)
+		;;
+esac
+
+# Set umask
+umask 022
+
+COLLECTD_BIN=/opt/freeware/sbin/collectd
+PIDFILE=/opt/freeware/var/run/collectd.pid
+
+# Check for missing binaries (stale symlinks should not happen)
+test -x $COLLECTD_BIN || { echo "$COLLECTD_BIN not installed";
+	if [ "$1" = "stop" ]; then exit 0;
+	else exit 5; fi; }
+
+# Check for existence of needed config file and read it
+COLLECTD_CONFIG=/opt/freeware/etc/collectd.conf
+test -r $COLLECTD_CONFIG || { echo "$COLLECTD_CONFIG not existing";
+	if [ "$1" = "stop" ]; then exit 0;
+	else exit 6; fi; }
+
+case "$1" in
+    start)
+	if [ -r $PIDFILE ]; then
+	    echo "collectd daemon is already running with PID "`cat $PIDFILE`"."
+	    exit 1
+	fi
+	echo "Starting collectd..."
+
+	## Start daemon
+	$COLLECTD_BIN
+	;;
+    stop)
+	echo "Shutting down collectd daemon... "
+	## Stop daemon.
+	if [ -r $PIDFILE ]; then
+	    pid=`cat $PIDFILE`
+	    kill -15 $pid
+	    while ps -p $pid >/dev/null; do
+	        sleep 1
+	    done
+	    rm -f $PIDFILE
+	fi
+	;;
+    status)
+	if [ -r $PIDFILE ]; then
+	    echo "collectd daemon is running with PID "`cat $PIDFILE`"."
+	else
+	    echo "collectd daemon is not running."
+	fi
+	;;
+    restart)
+	## Stop the service and regardless of whether it was
+	## running or not, start it again.
+	$0 stop
+	$0 start
+	;;
+    *)
+	echo "Usage: $0 {start|stop|status|restart}"
+	exit 1
+	;;
+esac
+
-- 
1.7.2.2




More information about the collectd mailing list