Gentoo Archives: gentoo-commits

From: Gilles Dartiguelongue <eva@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] dev/eva:master commit in: app-admin/collectd/files/
Date: Sun, 29 Apr 2012 14:22:59
Message-Id: 1335709359.f8c833665d74486f6fce02204533e7d63814ff0f.eva@gentoo
1 commit: f8c833665d74486f6fce02204533e7d63814ff0f
2 Author: Gilles Dartiguelongue <eva <AT> gentoo <DOT> org>
3 AuthorDate: Sun Apr 29 14:22:39 2012 +0000
4 Commit: Gilles Dartiguelongue <eva <AT> gentoo <DOT> org>
5 CommitDate: Sun Apr 29 14:22:39 2012 +0000
6 URL: http://git.overlays.gentoo.org/gitweb/?p=dev/eva.git;a=commit;h=f8c83366
7
8 add missing support files
9
10 ---
11 app-admin/collectd/files/collectd.confd | 22 +++++++++++
12 app-admin/collectd/files/collectd.initd | 60 +++++++++++++++++++++++++++++++
13 app-admin/collectd/files/logrotate | 9 +++++
14 3 files changed, 91 insertions(+), 0 deletions(-)
15
16 diff --git a/app-admin/collectd/files/collectd.confd b/app-admin/collectd/files/collectd.confd
17 new file mode 100644
18 index 0000000..ebb18ef
19 --- /dev/null
20 +++ b/app-admin/collectd/files/collectd.confd
21 @@ -0,0 +1,22 @@
22 +# Copyright 1999-2011 Gentoo Foundation
23 +# Distributed under the terms of the GNU General Public License v2
24 +# $Header: /var/cvsroot/gentoo-x86/app-admin/collectd/files/collectd.confd,v 1.2 2011/04/24 17:10:05 dilfridge Exp $
25 +
26 +# Nice value used to launch collectd, to change priority of the process. As
27 +# you usually will want to run it in background, a default of 5 is used.
28 +#
29 +#COLLECTD_NICELVL='5'
30 +
31 +# Location of configuration file. Modify if you don't like the standard one.
32 +#
33 +#COLLECTD_CFGFILE='/etc/collectd.conf'
34 +
35 +# File used to store the PID file. Usually you won't need to touch it.
36 +#
37 +#COLLECTD_PIDFILE='/var/run/collectd/collectd.pid'
38 +
39 +# User to run collectd as (default is collectd, change to root or give
40 +# collectd user appropriate privileges if you use one of the plugins that
41 +# require it, as e.g. ping or iptables plugins)
42 +#
43 +#COLLECTD_USER='collectd'
44
45 diff --git a/app-admin/collectd/files/collectd.initd b/app-admin/collectd/files/collectd.initd
46 new file mode 100644
47 index 0000000..1dd6e51
48 --- /dev/null
49 +++ b/app-admin/collectd/files/collectd.initd
50 @@ -0,0 +1,60 @@
51 +#!/sbin/runscript
52 +# Copyright 1999-2012 Gentoo Foundation
53 +# Distributed under the terms of the GNU General Public License v2
54 +# $Header: /var/cvsroot/gentoo-x86/app-admin/collectd/files/collectd.initd,v 1.6 2012/02/07 20:12:03 dilfridge Exp $
55 +
56 +: ${COLLECTD_PIDFILE:='/var/run/collectd/collectd.pid'}
57 +: ${COLLECTD_CFGFILE:='/etc/collectd.conf'}
58 +: ${COLLECTD_NICELVL:='5'}
59 +: ${COLLECTD_USER:='collectd'}
60 +
61 +extra_commands="configtest"
62 +
63 +depend() {
64 + use net
65 +}
66 +
67 +configtest() {
68 + ebegin "Checking ${SVCNAME} configuration"
69 + checkconfig
70 + eend $?
71 +}
72 +
73 +checkconfig() {
74 + if [[ $(sed '/^$\|^#/d' ${COLLECTD_CFGFILE} | grep -c 'LoadPlugin\w\+oracle') != 0 ]] ; then
75 + if [[ -e /etc/env.d/50oracle-instantclient-basic ]] ; then
76 + source /etc/env.d/50oracle-instantclient-basic
77 + export ORACLE_HOME
78 + export TNS_ADMIN
79 + else
80 + ewarn "Unable to set Oracle environment, Oracle plugin wont work"
81 + fi
82 + fi
83 +
84 + /usr/sbin/collectd -t -C "${COLLECTD_CFGFILE}" 1>/dev/null 2>&1
85 + ret=$?
86 + if [ $ret -ne 0 ]; then
87 + eerror "${SVCNAME} has detected an error in your setup:"
88 + /usr/sbin/collectd -t -C "${COLLECTD_CFGFILE}"
89 + fi
90 +
91 + return $ret
92 +}
93 +
94 +start() {
95 + checkconfig || return 1
96 + [ -d /var/run/collectd ] || mkdir /var/run/collectd && chown collectd:collectd /var/run/collectd
97 +
98 + ebegin "Starting collectd"
99 + start-stop-daemon --start --user "${COLLECTD_USER}:collectd" \
100 + --nicelevel "${COLLECTD_NICELVL}" --exec /usr/sbin/collectd -- \
101 + -P "${COLLECTD_PIDFILE}" -C "${COLLECTD_CFGFILE}"
102 + eend $? "Failed to start collectd"
103 +}
104 +
105 +stop() {
106 + ebegin "Stopping collectd"
107 + start-stop-daemon --stop \
108 + --pidfile "${COLLECTD_PIDFILE}"
109 + eend $? "Failed to stop collectd"
110 +}
111
112 diff --git a/app-admin/collectd/files/logrotate b/app-admin/collectd/files/logrotate
113 new file mode 100644
114 index 0000000..5d344f6
115 --- /dev/null
116 +++ b/app-admin/collectd/files/logrotate
117 @@ -0,0 +1,9 @@
118 +#
119 +# /etc/logrotate.d/collectd
120 +#
121 +/var/log/collectd.log {
122 + daily
123 + rotate 5
124 + notifempty
125 + missingok
126 +}