1 # Copyright 1999-2018 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
6 inherit depend.apache eutils multilib pax-utils toolchain-funcs user versionator
8 DESCRIPTION="Nagios Fork - Check daemon, CGIs, docs, IDOutils"
9 HOMEPAGE="http://www.icinga.org/"
10 SRC_URI="https://github.com/${PN}/${PN}-core/archive/v${PV}/${P}.tar.gz"
11 S="${WORKDIR}/${PN}-core-${PV}"
15 KEYWORDS="amd64 ~arm ~hppa ppc ppc64 x86"
16 IUSE="+apache2 contrib eventhandler +idoutils lighttpd +mysql perl +plugins postgres ssl +vim-syntax +web"
17 DEPEND="idoutils? ( dev-db/libdbi-drivers[mysql?,postgres?] )
18 perl? ( dev-lang/perl:= )
21 media-libs/gd[jpeg,png]
22 lighttpd? ( www-servers/lighttpd )
24 !net-analyzer/nagios-core"
27 net-analyzer/monitoring-plugins
28 net-analyzer/nagios-plugins
35 depend.apache_pkg_setup
38 enewuser icinga -1 -1 /var/lib/icinga "icinga,nagios"
44 myconf="$(use_enable perl embedded-perl)
45 $(use_with perl perlcache)
46 $(use_enable idoutils)
48 --with-cgiurl=/icinga/cgi-bin
49 --with-log-dir=/var/log/icinga
50 --libdir=/usr/$(get_libdir)
52 --sbindir=/usr/$(get_libdir)/icinga/cgi-bin
53 --datarootdir=/usr/share/icinga/htdocs
54 --localstatedir=/var/lib/icinga
55 --sysconfdir=/etc/icinga
56 --with-lockfile=/var/run/icinga/icinga.lock
57 --with-temp-dir=/tmp/icinga
58 --with-temp-file=/tmp/icinga/icinga.tmp"
60 if use idoutils ; then
61 myconf+=" --with-ido2db-lockfile=/var/run/icinga/ido2db.lock
62 --with-icinga-chkfile=/var/lib/icinga/icinga.chk
63 --with-ido-sockfile=/var/lib/icinga/ido.sock
64 --with-idomod-tmpfile=/tmp/icinga/idomod.tmp"
67 if use eventhandler ; then
68 myconfig+=" --with-eventhandler-dir=/etc/icinga/eventhandlers"
72 myconf+=" --with-plugin-dir=/usr/$(get_libdir)/nagios/plugins"
74 myconf+=" --with-plugin-dir=/usr/$(get_libdir)/nagios/plugins"
77 if use !apache2 && use !lighttpd ; then
78 myconf+=" --with-command-group=icinga"
81 myconf+=" --with-httpd-conf=/etc/apache2/conf.d"
82 myconf+=" --with-command-group=apache"
83 elif use lighttpd ; then
84 myconf+=" --with-command-group=lighttpd"
97 emake DESTDIR="${D}" cgis
100 if use contrib ; then
101 emake DESTDIR="${D}" -C contrib
104 if use idoutils ; then
105 emake DESTDIR="${D}" idoutils
110 dodoc Changelog README UPGRADING
113 sed -i -e '/cd $(SRC_\(CGI\|HTM\))/d' Makefile
116 emake DESTDIR="${D}" install{,-config,-commandmode}
118 if use idoutils ; then
119 emake DESTDIR="${D}" install-idoutils
122 if use contrib ; then
123 emake DESTDIR="${D}" -C contrib install
126 if use eventhandler ; then
127 emake DESTDIR="${D}" install-eventhandlers
130 newinitd "${FILESDIR}"/icinga-init.d icinga
131 newconfd "${FILESDIR}"/icinga-conf.d icinga
132 if use idoutils ; then
133 newinitd "${FILESDIR}"/ido2db-init.d ido2db
134 newconfd "${FILESDIR}"/ido2db-conf.d ido2db
135 insinto /usr/share/icinga/contrib/db
136 doins -r module/idoutils/db/*
140 if use apache2 ; then
141 insinto "${APACHE_MODULES_CONFDIR}"
142 newins "${FILESDIR}"/icinga-apache.conf 99_icinga.conf
143 elif use lighttpd ; then
144 insinto /etc/lighttpd
145 newins "${FILESDIR}"/icinga-lighty.conf lighttpd_icinga.conf
147 ewarn "${CATEGORY}/${PF} only supports Apache-2.x or Lighttpd webserver"
148 ewarn "out-of-the-box. Since you are not using one of them, you"
149 ewarn "have to configure your webserver accordingly yourself."
151 fowners -R root:root /usr/$(get_libdir)/icinga
153 find usr/$(get_libdir)/icinga -type d -exec fperms 755 {} +
154 find usr/$(get_libdir)/icinga/cgi-bin -type f -exec fperms 755 {} +
157 if use eventhandler ; then
158 dodir /etc/icinga/eventhandlers
159 # fowners icinga:icinga /etc/icinga/eventhandlers
163 keepdir /var/lib/icinga
164 keepdir /var/lib/icinga/archives
165 keepdir /var/lib/icinga/rw
166 keepdir /var/lib/icinga/spool/checkresults
168 if use apache2 ; then
170 elif use lighttpd ; then
176 fowners icinga:icinga /var/lib/icinga
177 fowners -R icinga:${webserver} /var/lib/icinga/rw
179 fperms 6755 /var/lib/icinga/rw
182 fowners -R root:root /etc/icinga
183 fperms 0750 /etc/icinga
184 fowners -R root:root /usr/sbin
185 fowners -R root:root /usr/$(get_libdir)
186 fowners -R root:root /usr/share/icinga/htdocs
189 if use idoutils ; then
190 pax-mark m usr/sbin/ido2db
196 elog "This does not include cgis that are perl-dependent"
197 elog "Currently traceroute.cgi is perl-dependent"
198 elog "Note that the user your webserver is running as needs"
199 elog "read-access to /etc/icinga."
201 if use apache2 || use lighttpd ; then
202 elog "There are several possible solutions to accomplish this,"
203 elog "choose the one you are most comfortable with:"
205 if use apache2 ; then
206 elog " usermod -G icinga apache"
208 elog " chown icinga:apache /etc/icinga"
210 elog "Also edit /etc/conf.d/apache2 and add a line like"
211 elog "APACHE2_OPTS=\"\$APACHE2_OPTS -D ICINGA\""
213 elog "Icinga web service needs user authentication. If you"
214 elog "use the base configuration, you need a password file"
215 elog "with a password for user \"icingaadmin\""
216 elog "You can create this file by executing:"
217 elog "htpasswd -c /etc/icinga/htpasswd.users icingaadmin"
219 elog "you may want to also add apache to the icinga group"
220 elog "to allow it access to the AuthUserFile"
222 elif use lighttpd ; then
223 elog " usermod -G icinga lighttpd "
225 elog " chown icinga:lighttpd /etc/icinga"
226 elog "Also edit /etc/lighttpd/lighttpd.conf and add 'include \"lighttpd_icinga.conf\"'"
229 elog "That will make icinga's web front end visable via"
230 elog "http://localhost/icinga/"
233 elog "IMPORTANT: Do not forget to add the user your webserver"
234 elog "is running as to the icinga group!"
237 ewarn "Please note that you have installed Icinga without web interface."
238 ewarn "Please don't file any bugs about having no web interface when you do this."
242 elog "If you want icinga to start at boot time"
243 elog "remember to execute:"
244 elog " rc-update add icinga default"
246 elog "If your kernel has /proc protection, icinga"
247 elog "will not be happy as it relies on accessing the proc"
248 elog "filesystem. You can fix this by adding icinga into"
249 elog "the group wheel, but this is not recomended."
251 if [ -d "${ROOT}"/var/icinga ] ; then
253 ewarn "/var/icinga was moved to /var/lib/icinga"
254 ewarn "please move the files if this was an upgrade"
255 if use idoutils ; then
256 ewarn "and edit /etc/ido2db.cfg to change the location of the files"
258 ewarn "update your db with the scripts under the directory"
259 ewarn "/usr/share/icinga/contrib/db/"
262 ewarn "The \"mv /var/icinga /var/lib/\" command works well to move the files"
263 ewarn "remove /var/icinga afterwards to make this warning disappear"