forked from collectd/collectd
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add RPM .spec file and startup script for AIX
Change-Id: Ic6187891e2014d84f8b2926df1c8b2012f26923f Signed-off-by: Aurelien Reynaud <[email protected]> Signed-off-by: Florian Forster <[email protected]>
- Loading branch information
Showing
2 changed files
with
154 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 <[email protected]> | ||
Vendor: collectd development team <[email protected]> | ||
|
||
%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 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
#!/bin/sh | ||
# | ||
# description: collectd startup script | ||
# | ||
# March 2010, Aurelien Reynaud <[email protected]> | ||
# | ||
|
||
# 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) | ||
if [ ! -x $COLLECTD_BIN ]; then | ||
echo "$COLLECTD_BIN not installed" | ||
[ "$1" = "stop" ] && exit 0 | ||
exit 5 | ||
fi | ||
|
||
# Check for existence of needed config file and read it | ||
COLLECTD_CONFIG=/opt/freeware/etc/collectd.conf | ||
if [ ! -r $COLLECTD_CONFIG ]; then | ||
echo "$COLLECTD_CONFIG not existing" | ||
[ "$1" = "stop" ] && exit 0 | ||
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 |