Accepting request 201898 from home:jsjhb:branches:devel:languages:python
- add rrdtools-cached package including systemd service - add full documentation (txt, html) - clean up the ruby header workaround using site install OBS-URL: https://build.opensuse.org/request/show/201898 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/rrdtool?expand=0&rev=43
This commit is contained in:
parent
e280542d7b
commit
786c95fae1
45
rrdcached-systemd-pre
Normal file
45
rrdcached-systemd-pre
Normal file
@ -0,0 +1,45 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# script to create the file system environment for rrdcached
|
||||
# from rrdtool package. This is needed, as openSUSE >= 13.1
|
||||
# enforces use of systemd, and does not allow the old-style
|
||||
# init.d script.
|
||||
# Hence, the content here is shamelessly ripped from the
|
||||
# init.d script.
|
||||
#
|
||||
|
||||
# Check for existence of needed config file and read it
|
||||
RRDCACHED_CONFIG='/etc/sysconfig/rrdcached'
|
||||
test -r $RRDCACHED_CONFIG || { echo "$RRDCACHED_CONFIG not existing";
|
||||
if [ "$1" = "stop" ]; then exit 0;
|
||||
else exit 6; fi; }
|
||||
|
||||
RRDCACHED_PID='/var/lib/rrdtool/rrdcached/rrdcached.pid'
|
||||
|
||||
# Read config
|
||||
. $RRDCACHED_CONFIG
|
||||
|
||||
function check_and_create_dir(){
|
||||
local DIR=$1
|
||||
test -d "$DIR" || mkdir -p "$DIR"
|
||||
}
|
||||
|
||||
check_and_create_dir "$(dirname $RRDCACHED_PID)"
|
||||
chown $RRDCACHED_USER:$RRDCACHED_GROUP "$(dirname $RRDCACHED_PID)"
|
||||
case "$RRDCACHED_ADDRESS" in
|
||||
^unix:)
|
||||
SOCKETDIR=$(dirname ${RRDCACHED_ADDRESS/unix:/})
|
||||
check_and_create_dir "$SOCKETDIR"
|
||||
chgrp $RRDCACHED_GROUP "$SOCKETDIR"
|
||||
;;
|
||||
esac
|
||||
case "$RRDCACHED_CHROOT_DIR" in
|
||||
/tmp)
|
||||
echo "Warning: starting with chroot dir $RRDCACHED_CHROOT_DIR" >&2
|
||||
;;
|
||||
*)
|
||||
check_and_create_dir "$RRDCACHED_CHROOT_DIR"
|
||||
chown $RRDCACHED_USER:$RRDCACHED_GROUP "$RRDCACHED_CHROOT_DIR"
|
||||
;;
|
||||
esac
|
||||
|
133
rrdcached.init
Normal file
133
rrdcached.init
Normal file
@ -0,0 +1,133 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# /etc/init.d/rrdcached
|
||||
# and its symbolic link
|
||||
# /(usr/)sbin/rcrrdcached
|
||||
#
|
||||
### BEGIN INIT INFO
|
||||
# Provides: rrdcached
|
||||
# Required-Start: $local_fs $syslog $remote_fs
|
||||
# Should-Start: $time
|
||||
# Required-Stop: $local_fs $syslog $remote_fs
|
||||
# Should-Stop: $null
|
||||
# Default-Start: 3 5
|
||||
# Default-Stop: 0 1 2 6
|
||||
# Short-Description: Start and stop rrdtool caching daemon
|
||||
# Description: rrdcached is a caching daemon to aggregate
|
||||
# updates to rrd files
|
||||
### END INIT INFO
|
||||
|
||||
RRDCACHED_BIN='/usr/bin/rrdcached'
|
||||
test -x $RRDCACHED_BIN || { echo "$RRDCACHED_BIN not installed";
|
||||
if [ "$1" = "stop" ]; then exit 0;
|
||||
else exit 5; fi; }
|
||||
|
||||
# Check for existence of needed config file and read it
|
||||
RRDCACHED_CONFIG='/etc/sysconfig/rrdcached'
|
||||
test -r $RRDCACHED_CONFIG || { echo "$RRDCACHED_CONFIG not existing";
|
||||
if [ "$1" = "stop" ]; then exit 0;
|
||||
else exit 6; fi; }
|
||||
|
||||
RRDCACHED_PID='/var/lib/rrdtool/rrdcached/rrdcached.pid'
|
||||
|
||||
# Read config
|
||||
. $RRDCACHED_CONFIG
|
||||
|
||||
# Source LSB init functions
|
||||
. /etc/rc.status
|
||||
|
||||
# Reset status of this service
|
||||
rc_reset
|
||||
|
||||
function check_and_create_dir(){
|
||||
local DIR=$1
|
||||
test -d "$DIR" || mkdir -p "$DIR"
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
echo -n "Starting rrdcached "
|
||||
check_and_create_dir "$(dirname $RRDCACHED_PID)"
|
||||
chown $RRDCACHED_USER:$RRDCACHED_GROUP "$(dirname $RRDCACHED_PID)"
|
||||
case "$RRDCACHED_ADDRESS" in
|
||||
^unix:)
|
||||
SOCKETDIR=$(dirname ${RRDCACHED_ADDRESS/unix:/})
|
||||
check_and_create_dir "$SOCKETDIR"
|
||||
chgrp $RRDCACHED_GROUP "$SOCKETDIR"
|
||||
;;
|
||||
esac
|
||||
case "$RRDCACHED_CHROOT_DIR" in
|
||||
/tmp)
|
||||
echo "Warning: starting with chroot dir $RRDCACHED_CHROOT_DIR" >&2
|
||||
;;
|
||||
*)
|
||||
check_and_create_dir "$RRDCACHED_CHROOT_DIR"
|
||||
chown $RRDCACHED_USER:$RRDCACHED_GROUP "$RRDCACHED_CHROOT_DIR"
|
||||
;;
|
||||
esac
|
||||
/sbin/startproc -u $RRDCACHED_USER $RRDCACHED_BIN \
|
||||
-s $RRDCACHED_GROUP \
|
||||
-b "$RRDCACHED_CHROOT_DIR" \
|
||||
-p "$RRDCACHED_PID" \
|
||||
-l $RRDCACHED_ADDRESS \
|
||||
-m $RRDCACHED_SOCKET_MASK \
|
||||
-w $RRDCACHED_DISKWRITE \
|
||||
-z $RRDCACHED_DELAY \
|
||||
-t $RRDCACHED_WRITE_THREADS \
|
||||
$RRDCACHED_OPTIONS
|
||||
# workaround for wrong socket ownership and permission after stArt
|
||||
case "$RRDCACHED_ADDRESS" in
|
||||
^unix:)
|
||||
SOCKET=${RRDCACHED_ADDRESS/unix:/}
|
||||
chown $RRDCACHED_USER:$RRDCACHED_GROUP "$SOCKET"
|
||||
chmod $RRDCACHED_SOCKET_MASK "$SOCKET"
|
||||
;;
|
||||
esac
|
||||
rc_status -v
|
||||
;;
|
||||
stop)
|
||||
echo -n "Shutting down rrdcached "
|
||||
/sbin/killproc -p $RRDCACHED_PID -t 10 $RRDCACHED_BIN
|
||||
rc_status -v
|
||||
;;
|
||||
try-restart|condrestart)
|
||||
if test "$1" = "condrestart"; then
|
||||
echo "${attn} Use try-restart ${done}(LSB)${attn} rather than condrestart ${warn}(RH)${norm}"
|
||||
fi
|
||||
$0 status
|
||||
if test $? = 0; then
|
||||
$0 restart
|
||||
else
|
||||
rc_reset # Not running is not a failure.
|
||||
fi
|
||||
rc_status
|
||||
;;
|
||||
restart)
|
||||
$0 stop
|
||||
$0 start
|
||||
rc_status
|
||||
;;
|
||||
force-reload)
|
||||
echo -n "Reload service rrdcached "
|
||||
/sbin/killproc -p $RRDCACHED_PID -HUP $RRDCACHED_BIN
|
||||
rc_status -v
|
||||
;;
|
||||
reload)
|
||||
echo -n "Reload service rrdcached "
|
||||
/sbin/killproc -p $RRDCACHED_PID -HUP $RRDCACHED_BIN
|
||||
rc_status -v
|
||||
;;
|
||||
status)
|
||||
echo -n "Checking for service rrdcached "
|
||||
/sbin/checkproc $RRDCACHED_BIN
|
||||
rc_status -v
|
||||
;;
|
||||
probe)
|
||||
test $RRDCACHED_CONFIG -nt $RRDCACHED_PID && echo reload
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $0 {start|stop|status|try-restart|restart|force-reload|reload|probe}"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
rc_exit
|
25
rrdcached.service
Normal file
25
rrdcached.service
Normal file
@ -0,0 +1,25 @@
|
||||
# This file is part of package rrdtool.
|
||||
#
|
||||
# Description:
|
||||
#
|
||||
# Used to start rrdcached Data caching daemon for rrdtool
|
||||
#
|
||||
|
||||
[Unit]
|
||||
Description=RRDcached RRD Data Caching Service
|
||||
Requires=var-run.mount
|
||||
Wants=network.target
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
ExecStartPre=-/bin/echo 'Starting RRD data caching service (rrdtools - rrdcached)'
|
||||
ExecStartPre=/bin/sh -c "/usr/share/rrdcached/rrdcached-systemd-pre"
|
||||
EnvironmentFile=-/etc/sysconfig/rrdcached
|
||||
ExecStart=/usr/bin/rrdcached -s $RRDCACHED_GROUP -b "$RRDCACHED_CHROOT_DIR" -p "$RRDCACHED_PID" -l $RRDCACHED_ADDRESS -m $RRDCACHED_SOCKET_MASK -w $RRDCACHED_DISKWRITE -z $RRDCACHED_DELAY -t $RRDCACHED_WRITE_THREADS $RRDCACHED_OPTIONS
|
||||
Restart=always
|
||||
RestartSec=1
|
||||
PIDFile="$RRDCACHED_PID"
|
||||
TimeoutStopSec=10
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
@ -1,3 +1,8 @@
|
||||
-------------------------------------------------------------------
|
||||
Wed Oct 2 13:40:14 UTC 2013 - obs@botter.cc
|
||||
|
||||
- add systemd service for rrdcached
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Wed Jul 10 15:02:53 UTC 2013 - dvaleev@suse.com
|
||||
|
||||
|
99
rrdtool.spec
99
rrdtool.spec
@ -43,6 +43,9 @@ BuildRequires: autoconf
|
||||
BuildRequires: automake
|
||||
BuildRequires: libtool
|
||||
BuildRequires: tcpd-devel
|
||||
%if 0%{?suse_version} >= 1210
|
||||
BuildRequires: systemd
|
||||
%endif
|
||||
Requires: perl = %{perl_version}
|
||||
Version: 1.4.7
|
||||
Release: 0
|
||||
@ -53,12 +56,17 @@ Patch2: rrdtool-tclversion.patch
|
||||
Patch3: rrdtool-tclsegfault.patch
|
||||
Source1: http://www.infodrom.org/projects/cgilib/download/cgilib-%{cgilib_version}.tar.gz
|
||||
Patch11: cgilib-fix_automake.patch
|
||||
Source2: sysconfig.rrdcached
|
||||
Source3: rrdcached.init
|
||||
Source4: rrdcached-systemd-pre
|
||||
Source5: rrdcached.service
|
||||
Url: http://oss.oetiker.ch/rrdtool/
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||||
Summary: A tool for data logging and analysis
|
||||
License: GPL-2.0+
|
||||
Group: Productivity/Scientific/Math
|
||||
Requires: dejavu
|
||||
Requires(pre): pwdutils
|
||||
|
||||
%description
|
||||
A tool to log and analyze data gathered from all kinds of data sources.
|
||||
@ -102,8 +110,12 @@ if [ ! -d m4 ]; then mkdir m4; fi
|
||||
#autoreconf -i -f
|
||||
export LDFLAGS="-L`pwd`/lb/lib" CPPFLAGS="-I`pwd`/lb/include" \
|
||||
%configure --disable-static --with-pic --enable-shared \
|
||||
--enable-tcl-site \
|
||||
--with-tcllib=%{_libdir} \
|
||||
--with-gnu-ld \
|
||||
--enable-python \
|
||||
--enable-ruby \
|
||||
--enable-ruby-site-install \
|
||||
--disable-rpath \
|
||||
--with-rrd-default-font="monospace"
|
||||
make %{?jobs:-j %jobs} V=1
|
||||
@ -119,8 +131,6 @@ make \
|
||||
examplesdir=%{_docdir}/%{name}/examples/ \
|
||||
libdir=%{_libdir} \
|
||||
pkglibdir=%tcl_archdir/tclrrd%version \
|
||||
hdrdir=%{_includedir}/ruby-2.0.0 \
|
||||
rubyhdrdir=%{_includedir}/ruby-2.0.0 \
|
||||
install
|
||||
# we install this later again
|
||||
rm -r $RPM_BUILD_ROOT%{_prefix}/lib/perl
|
||||
@ -142,8 +152,32 @@ popd
|
||||
#sed 's/[[:space:]]*-L\/usr\/src\/packages\/BUILD\/%{name}-%{version}\/lb\/lib[[:space:]]*/ /' $RPM_BUILD_ROOT/%{_libdir}/librrd_th.la > tmp
|
||||
#mv tmp $RPM_BUILD_ROOT/%{_libdir}/librrd_th.la
|
||||
find "%{buildroot}" -type f -name '*.la' -exec %__rm {} \;
|
||||
# install ruby bindings
|
||||
pushd bindings/ruby
|
||||
make DESTDIR=%{buildroot} install
|
||||
popd
|
||||
# documentation
|
||||
install -m 644 CHANGES CONTRIBUTORS COPYING COPYRIGHT README TODO $RPM_BUILD_ROOT/%{_docdir}/%{name}
|
||||
pushd doc
|
||||
mkdir txt
|
||||
mkdir html
|
||||
mv *.txt txt/
|
||||
mv *.html html/
|
||||
popd
|
||||
rm examples/rrdcached/Makefile*
|
||||
chmod -x examples/*
|
||||
chmod +x examples/rrdcached
|
||||
# install rrdcached specials
|
||||
install -Dm644 %{SOURCE2} %{buildroot}%{_localstatedir}/adm/fillup-templates/sysconfig.rrdcached
|
||||
install -Dm755 %{SOURCE3} %{buildroot}%{_sysconfdir}/init.d/rrdcached
|
||||
%if 0%{?suse_version} >= 1210
|
||||
# install systemd specific files
|
||||
install -Dm755 %{SOURCE4} %{buildroot}%{_datadir}/rrdcached/rrdcached-systemd-pre
|
||||
install -Dm644 %{SOURCE5} %{buildroot}%{_unitdir}/rrdcached.service
|
||||
%endif
|
||||
mkdir -p %{buildroot}%{_sbindir}
|
||||
ln -s %{_sysconfdir}/init.d/rrdcached %{buildroot}%{_sbindir}/rcrrdcached
|
||||
mkdir -p %{buildroot}%{_localstatedir}/lib/rrdtool/rrdcached
|
||||
|
||||
%clean
|
||||
rm -rf $RPM_BUILD_ROOT
|
||||
@ -157,6 +191,7 @@ rm -rf $RPM_BUILD_ROOT
|
||||
%doc %{_docdir}/rrdtool
|
||||
%doc %{_mandir}/*/*
|
||||
/usr/bin/*
|
||||
%exclude %{_bindir}/rrdcached
|
||||
%{_libdir}/librrd.so.*
|
||||
%{_libdir}/librrd_th.so.*
|
||||
%{perl_vendorlib}/RRDp.pm
|
||||
@ -243,6 +278,7 @@ This package contains the Tcl bindings
|
||||
%{tcl_archdir}/*
|
||||
%{_libdir}/tclrrd*.so
|
||||
|
||||
#%{!?rb_sitearchdir: %define rb_sitearchdir %(ruby -rrbconfig -e 'puts RbConfig::CONFIG["sitearchdir"]')}
|
||||
%package -n ruby-rrdtool
|
||||
Summary: Ruby bindings for rrdtool
|
||||
Group: Productivity/Scientific/Math
|
||||
@ -258,6 +294,63 @@ This package contains the Ruby bindings
|
||||
|
||||
%files -n ruby-rrdtool
|
||||
%defattr(-, root, root)
|
||||
%{rb_archdir}/RRD.so
|
||||
%{rb_sitearchdir}/RRD.so
|
||||
|
||||
%package cached
|
||||
Summary: Data caching daemon for RRDtool
|
||||
Group: Productivity/Scientific/Math
|
||||
Requires: %{name} = %{version}
|
||||
Requires(pre): %insserv_prereq
|
||||
Requires(pre): %fillup_prereq
|
||||
%define rrdcached_user rrdcached
|
||||
%define rrdcached_group rrdcached
|
||||
|
||||
%description cached
|
||||
rrdcached is a daemon that receives updates to existing RRD files,
|
||||
accumulates them and, if enough have been received or a defined time has
|
||||
passed, writes the updates to the RRD file. The daemon was written with
|
||||
big setups in mind which usually runs into I/O related problems. This
|
||||
daemon was written to alleviate these problems.
|
||||
|
||||
%files cached
|
||||
%defattr(-, root, root)
|
||||
%{_bindir}/rrdcached
|
||||
%{_sysconfdir}/init.d/rrdcached
|
||||
%{_sbindir}/rcrrdcached
|
||||
%{_localstatedir}/adm/fillup-templates/sysconfig.rrdcached
|
||||
%dir %{_localstatedir}/lib/rrdtool
|
||||
%attr(-,%rrdcached_user,%rrdcached_group) %dir %{_localstatedir}/lib/rrdtool/rrdcached
|
||||
%if 0%{?suse_version} >= 1210
|
||||
%{_datadir}/rrdcached
|
||||
%{_datadir}/rrdcached/rrdcached-systemd-pre
|
||||
%{_unitdir}/rrdcached.service
|
||||
%endif
|
||||
|
||||
%pre cached
|
||||
getent group %rrdcached_group >/dev/null || groupadd %rrdcached_group
|
||||
getent passwd %rrdcached_user >/dev/null || useradd -s /sbin/nologin -g %rrdcached_group -c %rrdcached_user -d %{_localstatedir}/lib %rrdcached_user
|
||||
%if 0%{?suse_version} >= 1210
|
||||
%service_add_pre rrdcached.service
|
||||
%endif
|
||||
|
||||
%post cached
|
||||
%fillup_and_insserv rrdcached
|
||||
%restart_on_update rrdcached
|
||||
%if 0%{?suse_version} >= 1210
|
||||
%service_add_post rrdcached.service
|
||||
%endif
|
||||
|
||||
%preun cached
|
||||
%stop_on_removal rrdcached
|
||||
%if 0%{?suse_version} >= 1210
|
||||
%service_del_preun rrdcached.service
|
||||
%endif
|
||||
|
||||
%postun cached
|
||||
%restart_on_update
|
||||
%insserv_cleanup
|
||||
%if 0%{?suse_version} >= 1210
|
||||
%service_del_postun rrdcached.service
|
||||
%endif
|
||||
|
||||
%changelog
|
||||
|
104
sysconfig.rrdcached
Normal file
104
sysconfig.rrdcached
Normal file
@ -0,0 +1,104 @@
|
||||
# Settings for rrdcached
|
||||
#OPTIONS="-l unix:/var/rrdtool/rrdcached/rrdcached.sock -s rrdcached -m 664 -b /var/rrdtool/rrdcached"
|
||||
#OPTIONS="-w 1800 -z 1800 -p /tmp/rrdcached.pid -j /tmp -s nagios -m 0660 -l unix:/tmp/rrdcached.sock"
|
||||
## Path: Network/WWW/RRDCached
|
||||
## Description: Start parameters for RRDCached
|
||||
## Type: string
|
||||
## Default: "rrdcached"
|
||||
## Config: rrdcached
|
||||
## ServiceRestart: rrdcached
|
||||
#
|
||||
# username rrdcached should run as
|
||||
#
|
||||
RRDCACHED_USER="nagios"
|
||||
|
||||
|
||||
## Type: string
|
||||
## Default: "rrdcached"
|
||||
## Config: rrdcached
|
||||
## ServiceRestart: rrdcached
|
||||
#
|
||||
# group rrdcached should be run as
|
||||
#
|
||||
RRDCACHED_GROUP="nagios"
|
||||
|
||||
|
||||
## Type: string
|
||||
## Default: "unix:/var/rrdtool/rrdcached/rrdcached.sock"
|
||||
## Config: rrdcached
|
||||
## ServiceRestart: rrdcached
|
||||
#
|
||||
# Bind to address and accept incoming connections on that socket.
|
||||
#
|
||||
# If address begins with "unix:", everything following that prefix is
|
||||
# interpreted as the path to a UNIX domain socket.
|
||||
#
|
||||
# If the address is an IPv4 address or a fully qualified domain name
|
||||
# the square brackets can be omitted, resulting in the (simpler)
|
||||
# "address:port" pattern.
|
||||
#
|
||||
# The default port is 42217/tcp.
|
||||
#
|
||||
RRDCACHED_ADDRESS="unix:/tmp/rrdcached.sock"
|
||||
|
||||
|
||||
## Type: integer
|
||||
## Default: 0664
|
||||
## Config: rrdcached
|
||||
## ServiceRestart: rrdcached
|
||||
#
|
||||
# File permissions of a UNIX domain socket, if given via
|
||||
# RRDCACHED_ADDRESS="unix:/"
|
||||
#
|
||||
RRDCACHED_SOCKET_MASK="0660"
|
||||
|
||||
|
||||
## Type: integer
|
||||
## Default: 300
|
||||
## Config: rrdcached
|
||||
## ServiceRestart: rrdcached
|
||||
#
|
||||
# How often should data be written to disk
|
||||
# in seconds.
|
||||
#
|
||||
RRDCACHED_DISKWRITE="300"
|
||||
|
||||
|
||||
## Type: integer
|
||||
## Default: 300
|
||||
## Config: rrdcached
|
||||
## ServiceRestart: rrdcached
|
||||
#
|
||||
# Delay writing of each RRD for a random number of
|
||||
# seconds in the range [0,delay)
|
||||
#
|
||||
RRDCACHED_DELAY="300"
|
||||
|
||||
|
||||
## Type: integer
|
||||
## Default: 4
|
||||
## Config: rrdcached
|
||||
## ServiceRestart: rrdcached
|
||||
#
|
||||
# Number of threads used for writing RRD files.
|
||||
#
|
||||
RRDCACHED_WRITE_THREADS="4"
|
||||
|
||||
## Type: string
|
||||
## Default: "/var/rrdtool/rrdcached"
|
||||
## Config: rrdcached
|
||||
## ServiceRestart: rrdcached
|
||||
#
|
||||
# Change into a specific directory at startup.
|
||||
# If not given the default, "/tmp", will be used.
|
||||
#
|
||||
RRDCACHED_CHROOT_DIR="/tmp"
|
||||
|
||||
## Type: string
|
||||
## Default: ""
|
||||
## Config: rrdcached
|
||||
## ServiceRestart: rrdcached
|
||||
#
|
||||
# Other options - see man 1 rrdcached
|
||||
#
|
||||
RRDCACHED_OPTIONS=""
|
Loading…
Reference in New Issue
Block a user