Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 574858 | Differences between
and this patch

Collapse All | Expand All

(-)zabbix-2.2.5.ebuild (-140 / +118 lines)
Lines 2-12 Link Here
2
# Distributed under the terms of the GNU General Public License v2
2
# Distributed under the terms of the GNU General Public License v2
3
# $Id$
3
# $Id$
4
4
5
EAPI="5"
5
EAPI="6"
6
6
7
# needed to make webapp-config dep optional
7
# needed to make webapp-config dep optional
8
WEBAPP_OPTIONAL="yes"
8
WEBAPP_OPTIONAL="yes"
9
inherit flag-o-matic webapp autotools java-pkg-opt-2 user systemd toolchain-funcs
9
inherit flag-o-matic webapp java-pkg-opt-2 user systemd toolchain-funcs
10
10
11
DESCRIPTION="ZABBIX is software for monitoring of your applications, network and servers"
11
DESCRIPTION="ZABBIX is software for monitoring of your applications, network and servers"
12
HOMEPAGE="http://www.zabbix.com/"
12
HOMEPAGE="http://www.zabbix.com/"
Lines 16-23 Link Here
16
LICENSE="GPL-2"
16
LICENSE="GPL-2"
17
SLOT="0"
17
SLOT="0"
18
WEBAPP_MANUAL_SLOT="yes"
18
WEBAPP_MANUAL_SLOT="yes"
19
KEYWORDS="amd64 x86"
19
KEYWORDS="~amd64 ~x86"
20
IUSE="agent java curl frontend ipv6 xmpp ldap libxml2 mysql openipmi oracle postgres proxy server ssh snmp sqlite odbc static"
20
IUSE="agent java curl frontend ipv6 xmpp ldap libxml2 mysql openipmi oracle postgres proxy server ssh snmp sqlite odbc static"
21
REQUIRED_USE="|| ( agent frontend proxy server )
22
	proxy? ( ^^ ( mysql oracle postgres sqlite odbc ) )
23
	server? ( ^^ ( mysql oracle postgres sqlite odbc ) )
24
	static? ( !oracle !snmp )"
21
25
22
COMMON_DEPEND="snmp? ( net-analyzer/net-snmp )
26
COMMON_DEPEND="snmp? ( net-analyzer/net-snmp )
23
	ldap? (
27
	ldap? (
Lines 38-109 Link Here
38
	odbc? ( dev-db/unixODBC )"
42
	odbc? ( dev-db/unixODBC )"
39
43
40
RDEPEND="${COMMON_DEPEND}
44
RDEPEND="${COMMON_DEPEND}
41
	proxy? ( <=net-analyzer/fping-2.9 )
45
	proxy? ( net-analyzer/fping )
42
	server? ( <=net-analyzer/fping-2.9
46
	server? ( net-analyzer/fping
43
		app-admin/webapp-config )
47
		app-admin/webapp-config )
44
	java?	(
48
	java?	(
45
		>=virtual/jre-1.4
49
		>=virtual/jre-1.4
46
		dev-java/slf4j-api
50
		dev-java/slf4j-api
47
		dev-java/json-simple
48
	)
51
	)
49
	frontend? (
52
	frontend? (
50
		>=dev-lang/php-5.3.0[bcmath,ctype,sockets,gd,truetype,xml,session,xmlreader,xmlwriter,nls,sysvipc,unicode]
53
		>=dev-lang/php-5.3.0[bcmath,ctype,sockets,gd,truetype,xml,session,xmlreader,xmlwriter,nls,sysvipc,unicode]
51
		|| ( dev-lang/php[apache2] dev-lang/php[cgi] dev-lang/php[fpm] )
54
		|| ( dev-lang/php[apache2] dev-lang/php[cgi] dev-lang/php[fpm] )
55
		mysql? ( dev-lang/php[mysqli] )
56
		odbc? ( dev-lang/php[odbc] )
57
		oracle? ( dev-lang/php[oci8-instant-client] )
58
		postgres? ( dev-lang/php[postgres] )
59
		sqlite? ( dev-lang/php[sqlite] )
52
		media-libs/gd[png]
60
		media-libs/gd[png]
53
		app-admin/webapp-config )"
61
		app-admin/webapp-config )"
54
DEPEND="${COMMON_DEPEND}
62
DEPEND="${COMMON_DEPEND}
63
	static? (
64
		ldap? (
65
			net-nds/openldap[static-libs]
66
			=dev-libs/cyrus-sasl-2*[static-libs]
67
			net-libs/gnutls[static-libs]
68
		)
69
	mysql? ( >=virtual/mysql-5.0.3[static-libs] )
70
	sqlite? ( >=dev-db/sqlite-3.3.5[static-libs] )
71
	postgres? ( dev-db/postgresql:*[static-libs] )
72
	libxml2? ( dev-libs/libxml2[static-libs] )
73
	curl? ( net-misc/curl[static-libs] )
74
	ssh? ( net-libs/libssh2[static-libs] )
75
	odbc? ( dev-db/unixODBC[static-libs] )
76
	)
55
	virtual/pkgconfig"
77
	virtual/pkgconfig"
56
78
57
S=${WORKDIR}/${MY_P}
79
S=${WORKDIR}/${MY_P}
58
80
59
ZABBIXJAVA_BASE="opt/zabbix_java"
81
ZABBIXJAVA_BASE="opt/zabbix_java"
60
82
61
java_prepare() {
62
	cd "${S}/src/zabbix_java/lib"
63
	rm -v *.jar || die
64
65
	java-pkg_jar-from slf4j-api
66
	java-pkg_jar-from json-simple
67
}
68
69
src_prepare() {
70
	eautoreconf
71
}
72
73
pkg_setup() {
83
pkg_setup() {
74
	if use server || use proxy ; then
84
	if use oracle; then
75
		local dbnum dbtypes="mysql oracle postgres sqlite" dbtype
85
		if [ -z "${ORACLE_HOME}" ]; then
76
		declare -i dbnum=0
77
		for dbtype in ${dbtypes}; do
78
			use ${dbtype} && let dbnum++
79
		done
80
		if [ ${dbnum} -gt 1 ]; then
81
			eerror
82
			eerror "You can't use more than one database type in Zabbix."
83
			eerror "Select exactly one database type out of these: ${dbtypes}"
84
			eerror
85
			die "Multiple database types selected."
86
		elif [ ${dbnum} -lt 1 ]; then
87
			eerror
86
			eerror
88
			eerror "Select exactly one database type out of these: ${dbtypes}"
87
			eerror "The environment variable ORACLE_HOME must be set"
88
			eerror "and point to the correct location."
89
			eerror "It looks like you don't have Oracle installed."
89
			eerror
90
			eerror
90
			die "No database type selected."
91
			die "Environment variable ORACLE_HOME is not set"
91
		fi
92
		fi
92
		if use oracle; then
93
		if has_version 'dev-db/oracle-instantclient-basic'; then
93
			if [ -z "${ORACLE_HOME}" ]; then
94
			ewarn
94
				eerror
95
			ewarn "Please ensure you have a full install of the Oracle client."
95
				eerror "The environment variable ORACLE_HOME must be set"
96
			ewarn "dev-db/oracle-instantclient* is NOT sufficient."
96
				eerror "and point to the correct location."
97
			ewarn
97
				eerror "It looks like you don't have Oracle installed."
98
				eerror
99
				die "Environment variable ORACLE_HOME is not set"
100
			fi
101
			if has_version 'dev-db/oracle-instantclient-basic'; then
102
				ewarn
103
				ewarn "Please ensure you have a full install of the Oracle client."
104
				ewarn "dev-db/oracle-instantclient* is NOT sufficient."
105
				ewarn
106
			fi
107
		fi
98
		fi
108
	fi
99
	fi
109
100
Lines 115-212 Link Here
115
	enewuser zabbix -1 -1 /var/lib/zabbix/home zabbix
106
	enewuser zabbix -1 -1 /var/lib/zabbix/home zabbix
116
}
107
}
117
108
118
pkg_postinst() {
109
java_prepare() {
119
	if use server || use proxy ; then
110
	cd "${S}/src/zabbix_java/lib"
120
		elog
111
	rm -v *.jar || die
121
		elog "You may need to configure your database for Zabbix,"
122
		elog "if you have not already done so. "
123
		elog
124
125
		zabbix_homedir=$(egethome zabbix)
126
		if [ -n "${zabbix_homedir}" ] && \
127
		   [ "${zabbix_homedir}" != "/var/lib/zabbix/home" ]; then
128
			ewarn
129
			ewarn "The user 'zabbix' should have his homedir changed"
130
			ewarn "to /var/lib/zabbix/home if you want to use"
131
			ewarn "custom alert scripts."
132
			ewarn
133
			ewarn "A real homedir might be needed for configfiles"
134
			ewarn "for custom alert scripts (e.g. ~/.sendxmpprc when"
135
			ewarn "using sendxmpp for Jabber alerts)."
136
			ewarn
137
			ewarn "To change the homedir use:"
138
			ewarn "  usermod -d /var/lib/zabbix/home zabbix"
139
			ewarn
140
		fi
141
	fi
142
143
	if use server; then
144
		elog
145
		elog "For distributed monitoring you have to run:"
146
		elog
147
		elog "zabbix_server -n <nodeid>"
148
		elog
149
		elog "This will convert database data for use with Node ID"
150
		elog "and also adds a local node."
151
		elog
152
	fi
153
154
	elog "--"
155
	elog
156
	elog "You may need to add these lines to /etc/services:"
157
	elog
158
	elog "zabbix-agent     10050/tcp Zabbix Agent"
159
	elog "zabbix-agent     10050/udp Zabbix Agent"
160
	elog "zabbix-trapper   10051/tcp Zabbix Trapper"
161
	elog "zabbix-trapper   10051/udp Zabbix Trapper"
162
	elog
163
164
	elog "Feel free to download or contribute gentoo specific zabbix templates"
165
	elog "via https://github.com/deploylinux/gentooZabbixTemplates (WIP)."
166
167
	# repeat fowners/fperms functionality from src_install()
168
	# here to catch wrong permissions on existing files in
169
	# the live filesystem (yeah, that sucks).
170
	chown -R zabbix:zabbix \
171
		"${ROOT}"/etc/zabbix \
172
		"${ROOT}"/var/lib/zabbix \
173
		"${ROOT}"/var/lib/zabbix/home \
174
		"${ROOT}"/var/lib/zabbix/scripts \
175
		"${ROOT}"/var/log/zabbix
176
	chmod 0750 \
177
		"${ROOT}"/etc/zabbix \
178
		"${ROOT}"/var/lib/zabbix \
179
		"${ROOT}"/var/lib/zabbix/home \
180
		"${ROOT}"/var/lib/zabbix/scripts \
181
		"${ROOT}"/var/log/zabbix
182
112
183
	chmod 0640 \
113
	java-pkg_jar-from slf4j-api
184
		"${ROOT}"/etc/zabbix/zabbix_*
114
}
185
115
186
	if use server || use proxy ; then
116
src_prepare() {
187
		# check for fping
117
	default
188
		fping_perms=$(stat -c %a /usr/sbin/fping 2>/dev/null)
189
		case "${fping_perms}" in
190
			4[157][157][157])
191
				;;
192
			*)
193
				ewarn
194
				ewarn "If you want to use the checks 'icmpping' and 'icmppingsec',"
195
				ewarn "you have to make /usr/sbin/fping setuid root and executable"
196
				ewarn "by everyone. Run the following command to fix it:"
197
				ewarn
198
				ewarn "  chmod u=rwsx,g=rx,o=rx /usr/sbin/fping"
199
				ewarn
200
				ewarn "Please be aware that this might impose a security risk,"
201
				ewarn "depending on the code quality of fping."
202
				ewarn
203
				;;
204
		esac
205
	fi
206
}
118
}
207
119
208
src_configure() {
120
src_configure() {
209
210
	econf \
121
	econf \
211
		$(use_enable server) \
122
		$(use_enable server) \
212
		$(use_enable proxy) \
123
		$(use_enable proxy) \
Lines 229-234 Link Here
229
		|| die "econf failed"
140
		|| die "econf failed"
230
}
141
}
231
142
143
src_compile() {
144
	if [ -f Makefile ] || [ -f GNUmakefile ] || [ -f makefile ]; then
145
		emake AR="$(tc-getAR)" RANLIB="$(tc-getRANLIB)" || die "emake failed"
146
	fi
147
}
148
232
src_install() {
149
src_install() {
233
	dodir \
150
	dodir \
234
		/etc/zabbix \
151
		/etc/zabbix \
Lines 345-351 Link Here
345
		src/zabbix_java/lib/logback-console.xml \
262
		src/zabbix_java/lib/logback-console.xml \
346
		src/zabbix_java/lib/logback-core-0.9.27.jar \
263
		src/zabbix_java/lib/logback-core-0.9.27.jar \
347
		src/zabbix_java/lib/logback.xml \
264
		src/zabbix_java/lib/logback.xml \
348
		src/zabbix_java/lib/org-json-2010-12-28.jar \
265
		src/zabbix_java/lib/android-json-4.3_r3.1.jar \
349
		src/zabbix_java/lib/slf4j-api-1.6.1.jar
266
		src/zabbix_java/lib/slf4j-api-1.6.1.jar
350
	   exeinto /${ZABBIXJAVA_BASE}/
267
	   exeinto /${ZABBIXJAVA_BASE}/
351
	   doexe \
268
	   doexe \
Lines 354-364 Link Here
354
		src/zabbix_java/shutdown.sh
271
		src/zabbix_java/shutdown.sh
355
	   fowners -R zabbix:zabbix /${ZABBIXJAVA_BASE}
272
	   fowners -R zabbix:zabbix /${ZABBIXJAVA_BASE}
356
	fi
273
	fi
357
358
}
274
}
359
275
360
src_compile() {
276
pkg_postinst() {
361
	if [ -f Makefile ] || [ -f GNUmakefile ] || [ -f makefile ]; then
277
	if use server || use proxy ; then
362
		emake AR="$(tc-getAR)" RANLIB="$(tc-getRANLIB)" || die "emake failed"
278
		elog
279
		elog "You may need to configure your database for Zabbix,"
280
		elog "if you have not already done so. "
281
		elog
282
283
		zabbix_homedir=$(egethome zabbix)
284
		if [ -n "${zabbix_homedir}" ] && \
285
		   [ "${zabbix_homedir}" != "/var/lib/zabbix/home" ]; then
286
			ewarn
287
			ewarn "The user 'zabbix' should have his homedir changed"
288
			ewarn "to /var/lib/zabbix/home if you want to use"
289
			ewarn "custom alert scripts."
290
			ewarn
291
			ewarn "A real homedir might be needed for configfiles"
292
			ewarn "for custom alert scripts (e.g. ~/.sendxmpprc when"
293
			ewarn "using sendxmpp for Jabber alerts)."
294
			ewarn
295
			ewarn "To change the homedir use:"
296
			ewarn "  usermod -d /var/lib/zabbix/home zabbix"
297
			ewarn
298
		fi
299
	fi
300
301
	if use server; then
302
		elog
303
		elog "For distributed monitoring you have to run:"
304
		elog
305
		elog "zabbix_server -n <nodeid>"
306
		elog
307
		elog "This will convert database data for use with Node ID"
308
		elog "and also adds a local node."
309
		elog
310
	fi
311
312
	elog "--"
313
	elog
314
	elog "You may need to add these lines to /etc/services:"
315
	elog
316
	elog "zabbix-agent     10050/tcp Zabbix Agent"
317
	elog "zabbix-agent     10050/udp Zabbix Agent"
318
	elog "zabbix-trapper   10051/tcp Zabbix Trapper"
319
	elog "zabbix-trapper   10051/udp Zabbix Trapper"
320
	elog
321
322
	if use server || use proxy ; then
323
		# check for fping
324
		fping_perms=$(stat -c %a /usr/sbin/fping 2>/dev/null)
325
		case "${fping_perms}" in
326
			4[157][157][157])
327
				;;
328
			*)
329
				ewarn
330
				ewarn "If you want to use the checks 'icmpping' and 'icmppingsec',"
331
				ewarn "you have to make /usr/sbin/fping setuid root and executable"
332
				ewarn "by everyone. Run the following command to fix it:"
333
				ewarn
334
				ewarn "  chmod u=rwsx,g=rx,o=rx /usr/sbin/fping"
335
				ewarn
336
				ewarn "Please be aware that this might impose a security risk,"
337
				ewarn "depending on the code quality of fping."
338
				ewarn
339
				;;
340
		esac
363
	fi
341
	fi
364
}
342
}

Return to bug 574858