Hello community, here is the log from the commit of package icinga for openSUSE:Factory checked in at 2012-07-23 10:11:58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/icinga (Old) and /work/SRC/openSUSE:Factory/.icinga.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "icinga", Maintainer is "" Changes: -------- --- /work/SRC/openSUSE:Factory/icinga/icinga.changes 2012-03-12 20:14:00.000000000 +0100 +++ /work/SRC/openSUSE:Factory/.icinga.new/icinga.changes 2012-07-23 10:15:48.000000000 +0200 @@ -1,0 +2,93 @@ +Wed Jun 20 10:06:31 UTC 2012 - thard...@suse.com + +- imported upstream version 1.7.1 + * core: use prefix in solaris service definition #2609 - TD/CF + * core: fix various memory leaks in downtime eventhandling on SIGHUP (Carlos Velasco) #2666 - MF + * classic ui: Fixed status.cgi time out when displaying hostgroups in large environments #2617 - RB + * classic ui: Fixed Invalid JSON output for hostgroup overview (Torsten Rehn) #2680 - RB + * classic ui: Fixed Confusing use of display_name in JSON and CSV output (Torsten Rehn) #2681 - RB + * classic ui: Fixed wrong totals in "Service Status Summary" on Status Summary page (Mark Ziesemer) #2689 - RB + * idoutils: fix small compiler issues #2620 - TD/CF + * idoutils: fix upgradedb script typos & past changes #2682 - MF + * config: check_ido2db_procs.cfg should not depend on local-service template #2616 - MF + * install: adapt lsb headers for icinga and ido2db #2637 - MF + * install: fix typo in contrib/eventhandlers/redundancy-scenario1/handle-master-proc-event (thanks uosiu) #2671 - MF + +------------------------------------------------------------------- +Tue Jun 19 17:56:21 UTC 2012 - thard...@suse.com + +- cleaned up rcicinga and added checkresult directory creation before start +- added patch to fix wrong fsf address in some license files +- extracted update_path_script parts from %post to a separate file located under doc + +------------------------------------------------------------------- +Fri Jun 15 18:38:48 UTC 2012 - thard...@suse.com + +- fixed icinga-create_mysqldb.sh - it granted icinga access to all dbs - so please check the permissions of your mysql icinga user +- removed all other ido2utils scripts since they are not supported by upstream +- updated readme - better distinguishable topics + +------------------------------------------------------------------- +Fri Jun 15 12:24:01 UTC 2012 - thard...@suse.com + +- updated readme - mysql example command granted icinga access to all dbs + +------------------------------------------------------------------- +Wed Jun 13 12:29:29 UTC 2012 - l...@linux-schulserver.de + +- added 'show-errors' to icinga init script as documented in the + wiki + +------------------------------------------------------------------- +Tue Jun 5 13:29:20 UTC 2012 - thard...@suse.com + +- changed eventhandlers directory from /usr/lib/nagios/plugins/eventhandler to /lib/icinga/eventhandler (unpackaged files do not get copied) +- moved remaining files and the checkresults directory from /var/lib/icinga to /var/spool/icinga +- moved /var/lib/icinga to /var/spool/icinga/ +- removed nagios directories from the packages (/var/lib/nagios/*) +- changed /var/spool/icinga/icinga.cmd to /var/run/icinga/icinga.cmd +- changed /var/spool/icinga/ido2db.sock to /var/run/icinga/ido2db.sock +- added post scripts to update the existing configuration files accordingly +- replaced the existing default http-passwd file with the one from upstream - user icingaadmin with password icingaadmin +- adapted the RHEL upstream icinga and icinga-idoutils readmes for SUSE and packaged them +- idoutils db schema has changed, check /usr/share/doc/packages/icinga-idoutils/README.SUSE.idoutils how to upgrade it +- imported upstream version 1.7.0 + * core: notifications: Create contact list after eventbroker callbacks (Andreas Ericsson) #2110 - MF + * core: fix event removal from queues with O(1) removal from doubly linked lists (Andreas Ericsson) #2183 - MF + * core: avoid senseless looping when free()'ing macros (Andreas Ericsson) #2184 - MF + * core: avoid insane looping through event list when rescheduling checks (Mathias Kettner, Andreas Ericsson) #2182 - MF + * core: allow empty host groups in service and host dependencies if allow_empty_hostgroup_assignment flag is set (Daniel Wittenberg) #2255 - MF + * core: fix compatibility problems on solaris 10 (affects core, cgis, ido) (Carl R. Friend) #2292 - MF/RB/TD + * core: add trigger_time to downtimes to allow calculating of flexible downtimes endtime #2537 - MF + * core: add nebmodule version/name check for idomod (this allows future version dependencies) #2569 - MF + + * classic ui: Added option for max log entries displayed in showlog.cgi #2145 - RB + * classic ui: Added config option for status totals in status.cgi #2018 - RB + * classic ui: Added multiple hosts/services to status.cgi GET #1981 - RB + * classic ui: Added nostatusheader in status.cgi as config option #2018 - RB + * classic ui: Added statusmap resizing with exclude/include button (thanks to Mat) #2186 - RB + * classic ui: Added Select hosts or services by clicking on line instead of box #2118 - RB + * classic ui: include graph icons by default in logos #2222 - MF + * classic ui: added missing comment tool tip box to outages.cgi #2396 - RB + * classic ui: add javascript to refresh page/pause easier #2119 - RB + * classic ui: Added Scheduling queue filter for specific host or service #2421 - RB + * classic ui: add display_status_totals as cgi.cfg option in order to allow the status totals to be shown again #2443 - RB + * classic ui: Changed reading of auth information from cgiauth.c to cgiutils.c #2524 - RB + * classic ui: Added readonly cgi.cfg view into the config section #1776 - RB + * classic ui: add is_in_effect and trigger_time to downtime view for html, csv, json #2538 - MF + * classic ui: add modified attributes row to extinfo.cgi showing diffs to original config (thx Sven Nierlein for the idea) #2473 - MF + * classic ui: add modified attributes reset command to extinfo.cgi allowing to reset to original config #2474 - MF + + * idoutils: add new index for state in table statehistory #2274 - TD + * idoutils: add is_in_effect and trigger_time to scheduleddowntime and downtimehistory tables #2539 - MF + * idoutils: change varchar(255) to TEXT in mysql (not cs and address rfc columns) #2181 - MF + * idoutils: enhance dbversion table with modified and created columns #2562 - MF + * idoutils: set module info in idomod, to be checked on neb module load in future versions #2569 - MF + +------------------------------------------------------------------- +Sun May 27 17:06:20 UTC 2012 - l...@linux-schulserver.de + +- init script: check configuration before restart to avoid a + non running service on config problems + +------------------------------------------------------------------- Old: ---- htpasswd.users icinga-1.6.1.tar.gz New: ---- README.SUSE README.SUSE.idoutils icinga-1.7.1.tar.gz icinga-fix-create_mysqldb.patch icinga-fix-fsf-address.patch update_icinga_paths.sh ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ icinga.spec ++++++ --- /var/tmp/diff_new_pack.jQavnP/_old 2012-07-23 10:15:51.000000000 +0200 +++ /var/tmp/diff_new_pack.jQavnP/_new 2012-07-23 10:15:51.000000000 +0200 @@ -17,20 +17,18 @@ %define apacheconfdir %{_sysconfdir}/apache2/conf.d -# overload eventhandlerdir with the original value for now to not break backward -# compatibility, this will be changed with the next upstream version integration -# to /usr/lib/icinga/eventhandler -%define icinga_eventhandlerdir %{_prefix}/lib/nagios/plugins/eventhandlers/ +%define apachegroup www +# Macro that print mesages to syslog at package (un)install time +%define logmsg logger -t %{name}/rpm Name: icinga -Version: 1.6.1 -Release: 2 -License: GPL-2.0 -# Macro that print mesages to syslog at package (un)install time -%define nnmmsg logger -t %{name}/rpm +Version: 1.7.1 +Release: 0 + Summary: Host/service/network monitoring program -Url: http://www.icinga.org/ +License: GPL-2.0 Group: System/Monitoring +Url: http://www.icinga.org/ Source0: %{name}-%{version}.tar.gz Source1: rc%{name} Source2: rcido2db @@ -41,11 +39,17 @@ Source7: icingastats.8 Source8: ido2db.8 Source9: mini_epn_icinga.8 -Source12: htpasswd.users +Source10: README.SUSE +Source11: README.SUSE.idoutils +Source12: update_icinga_paths.sh # PATCH-FIX-OPENSUSE icinga-add-ifdefine-to-apache.patch Patch0: icinga-add-ifdefine-to-apache.patch +# PATCH-FIX +Patch1: icinga-fix-create_mysqldb.patch +# PATCH-FIX +Patch2: icinga-fix-fsf-address.patch BuildRequires: apache2-devel -BuildRequires: nagios-rpm-macros +BuildRequires: nagios-rpm-macros >= 0.05 %if 0%{?suse_version} >= 1110 BuildRequires: fdupes %endif @@ -81,6 +85,7 @@ Recommends: %{name}-plugins-eventhandlers Recommends: %{name}-www Recommends: cron +Recommends: logrotate Recommends: nagios-plugins Recommends: net-snmp Recommends: openssl @@ -163,6 +168,8 @@ Recommends: mysql Recommends: mysql-client Provides: %{name}-idoutils-drivers-dbd = %{version} +Conflicts: idoutils-oracle +Conflicts: idoutils-pgsql %description idoutils-mysql This package requires all needed packages for using IDOUtils with MySQL. @@ -173,6 +180,8 @@ Requires: %{name}-idoutils = %{version} Recommends: oracle-client Provides: %{name}-idoutils-drivers-dbd = %{version} +Conflicts: idoutils-pgsql +Conflicts: idoutils-mysql %description idoutils-oracle This package requires all needed packages for using IDOUtils with OracleDB. @@ -185,6 +194,8 @@ Recommends: postgresql Recommends: postgresql-libs Provides: %{name}-idoutils-drivers-dbd = %{version} +Conflicts: idoutils-mysql +Conflicts: idoutils-oracle %description idoutils-pgsql This package requires all needed packages for using IDOUtils with PostgreSQL. @@ -210,47 +221,55 @@ %prep %setup -q %patch0 -p1 - -# replace default ido2db lock and socket file settings -sed -ie "s|@localstatedir@/ido2db.lock|%{icinga_ido2db_lockfile}|g; \ - s|@localstatedir@/ido.sock|%{icinga_ido2db_socketfile}|g;" \ - "module/idoutils/config/ido2db.cfg-sample.in" \ - "module/idoutils/config/idomod.cfg-sample.in"; +%patch1 -p1 +%patch2 -p1 # remove GPLv3+ source files which are not needed for this package -rm t-tap/*.c +rm "t-tap/"*.c %build export PATH_TO_TRACEROUTE="%{_sbindir}/traceroute" %configure \ + --prefix="%{icinga_datadir}" \ --exec-prefix="%{_sbindir}" \ --bindir="%{_sbindir}" \ - --sbindir="%{icinga_cgidir}" \ - --libexecdir="%{icinga_plugindir}" \ + --datadir="%{icinga_datadir}" \ --datarootdir="%{icinga_datadir}" \ - --sysconfdir="%{icinga_sysconfdir}" \ - --with-p1-file-dir="%{icinga_datadir}" \ - --with-init-dir="%{_sysconfdir}/init.d" \ + --libexecdir="%{icinga_plugindir}" \ --localstatedir="%{icinga_localstatedir}" \ - --with-checkresult-dir="%{icinga_localstatedir}/checkresults" \ + --libdir="%{icinga_libdir}" \ + --sbindir="%{icinga_cgidir}" \ + --sysconfdir="%{icinga_sysconfdir}" \ --with-cgiurl="/%{name}/cgi-bin" \ - --with-htmurl="/%{name}" \ - --with-httpd-conf="%{apacheconfdir}" \ - --with-lockfile="%{icinga_lockfile}" \ - --with-ext-cmd-file-dir="%{icinga_spooldir}" \ - --with-log-dir="%{icinga_logdir}" \ - --with-cgi-log-dir="%{icinga_logdir}/www" \ - --with-icinga-user="%{icinga_user}" \ - --with-icinga-group="%{icinga_group}" \ --with-command-user="%{icinga_command_user}" \ --with-command-group="%{icinga_command_group}" \ --with-gd-lib="%{_libdir}" \ --with-gd-inc="%{_includedir}" \ + --with-htmurl="/%{name}" \ + --with-init-dir="%{_initrddir}" \ + --with-lockfile="%{icinga_lockfile}" \ + --with-icinga-user="%{icinga_user}" \ + --with-icinga-group="%{icinga_group}" \ + --with-httpd-conf="%{apacheconfdir}" \ + --with-log-dir="%{icinga_logdir}" \ --with-perlcache \ + --enable-cgi-log \ --enable-event-broker \ --enable-embedded-perl \ --enable-idoutils \ - --enable-ssl + --enable-ssl \ + --with-cgi-log-dir="%{icinga_cgi_logdir}" \ + --with-plugin-dir="%{icinga_plugindir}" \ + --with-eventhandler-dir="%{icinga_eventhandlerdir}" \ + --with-p1-file-dir="%{icinga_datadir}" \ + --with-checkresult-dir="%{icinga_checkresultdir}" \ + --with-ext-cmd-file-dir="%{icinga_cmd_filedir}" \ + --with-http-auth-file="%{icinga_http_authfile}" \ + --with-icinga-chkfile="%{icinga_chkfile}" \ + --with-ido2db-lockfile="%{icinga_ido2db_lockfile}" \ + --with-ido-sockfile="%{icinga_ido2db_socketfile}" \ + --with-idomod-tmpfile="%{icinga_idomod_tmpfile}" \ + --with-state-dir="%{icinga_spooldir}" # # make daemonchk.cgi and event handlers @@ -259,14 +278,10 @@ make %{?_smp_mflags} -C contrib pushd contrib/eventhandlers 1>/dev/null for f in `find . -type f` ; do - sed -i "s=/usr/local/nagios/var/rw/=/var/spool/%{name}/=; \ - s=/usr/local/%{name}/var/rw/=/var/spool/%{name}/=; \ - s=NscaBin\=\"/usr/local/nagios/libexec/send_nsca\"=NscaBin\=/usr/bin/send_nsca=; \ - s=/usr/local/nagios/libexec/eventhandlers/=%{icinga_eventhandlerdir}/=; \ + sed -i "s=NscaBin\=\"/usr/local/%{name}/libexec/send_nsca\"=NscaBin\=/usr/bin/send_nsca=; \ s=/usr/local/%{name}/libexec/eventhandlers/=%{icinga_eventhandlerdir}/=; \ - s=/usr/local/nagios/libexec/=%{icinga_plugindir}/=; \ - s=/usr/local/nagios/etc/=%{icinga_sysconfdir}/=; \ - s=/usr/local/nagios/test/var=/var/log/%{name}=" ${f} + s=/usr/local/nagios/libexec/eventhandlers/=%{icinga_eventhandlerdir}/=; \ + s=/usr/local/%{name}/etc/=%{icinga_sysconfdir}/=" ${f} done popd 1>/dev/null # make daemonchk.cgi and event handlers @@ -274,38 +289,68 @@ make %install -install -d -m0775 "%{buildroot}%{_localstatedir}/log/%{name}/archives" -install -d -m0775 "%{buildroot}%{_localstatedir}/spool/%{name}" -install -d -m0775 "%{buildroot}%{_sbindir}" -install -d -m0755 "%{buildroot}%{_includedir}/%{name}" -install -d -m0755 "%{buildroot}%{_sysconfdir}/init.d" -install -d -m0755 "%{buildroot}%{_sysconfdir}/logrotate.d" -install -d -m0755 "%{buildroot}%{apacheconfdir}" -install -d -m0755 "%{buildroot}%{icinga_sysconfdir}/objects" -install -d -m0755 "%{buildroot}%{icinga_localstatedir}" -install -d -m0755 "%{buildroot}%{icinga_eventhandlerdir}" -make install install-commandmode install-idoutils install-config install-webconf install-cgis install-init \ +make \ + install-unstripped \ + install-init \ + install-commandmode \ + install-idoutils \ + install-config \ + install-webconf \ + install-eventhandlers \ DESTDIR=%{buildroot} \ INSTALL_OPTS="" \ - COMMAND_OPTS="" \ INSTALL_OPTS_WEB="" \ - CGIDIR="%{icinga_libdir}/cgi" \ - CGICFGDIR="%{icinga_sysconfdir}" \ + COMMAND_OPTS="" \ INIT_OPTS="" make install -C contrib \ DESTDIR=%{buildroot} \ - CGIDIR="%{icinga_libdir}/cgi" \ - CGICFGDIR="%{icinga_sysconfdir}" \ INSTALL_OPTS="" -### move idoutils sample configs to final name +# make SUSE readmes available +cp %{SOURCE10} ./ +cp %{SOURCE11} ./ + +# replace placeholders in the update_icinga_paths.sh script +sed -i "s=%%{logmsg}=%{logmsg}=; \ + s=%%{icinga_lockfile}=%{icinga_lockfile}=; \ + s=%%{icinga_sysconfdir}=%{icinga_sysconfdir}=; \ + s=%%{icinga_eventhandlerdir}=%{icinga_eventhandlerdir}=; \ + s=%%{icinga_spooldir}=%{icinga_spooldir}=; \ + s=%%{icinga_ido2db_lockfile}=%{icinga_ido2db_lockfile}=; \ + s=%%{icinga_ido2db_socketfile}=%{icinga_ido2db_socketfile}=; \ + s=%%{icinga_cmdfile}=%{icinga_cmdfile}=" %{SOURCE12} +# make update_icinga_paths.sh script available +chmod +x %{SOURCE12} +mkdir -p ./examples +cp %{SOURCE12} ./examples + +# make unsupported mysql db creation script available +pushd module/idoutils/db 1>/dev/null +mkdir -p examples +cp scripts/create_mysqldb.sh examples/ +popd 1>/dev/null + +# move idoutils sample configs to final name mv "%{buildroot}%{icinga_sysconfdir}/ido2db.cfg-sample" "%{buildroot}%{icinga_sysconfdir}/ido2db.cfg" mv "%{buildroot}%{icinga_sysconfdir}/idomod.cfg-sample" "%{buildroot}%{icinga_sysconfdir}/idomod.cfg" mv "%{buildroot}%{icinga_sysconfdir}/modules/idoutils.cfg-sample" "%{buildroot}%{icinga_sysconfdir}/modules/idoutils.cfg" -# install directory for event brokers like ndoutils -install -d -m0755 "%{buildroot}%{_prefix}/lib/nagios/brokers" +# fix resource.cfg eventhandler path - otherwise it creates problem with the update_config_files script +sed -i "s|/usr/lib/nagios/plugins/eventhandlers|%{icinga_eventhandlerdir}|g" "%{buildroot}%{icinga_sysconfdir}/resource.cfg" + +# remove unnecessary files from www log directory +rm "%{buildroot}/%{icinga_cgi_logdir}/"{.htaccess,index.htm} + +# remove setuid from %%{icinga_cmd_filedir} +chmod -s "%{buildroot}%{icinga_cmd_filedir}" + +# install logrotate rule +install -D -m 0644 icinga.logrotate %{buildroot}%{icinga_logrotatefile} + +# install sample htpasswd file +install -D -m 0644 icinga.htpasswd %{buildroot}%{icinga_http_authfile} + # install eventhandlers cp -r contrib/eventhandlers/* "%{buildroot}%{icinga_eventhandlerdir}" @@ -313,74 +358,62 @@ install -d -m0755 "%{buildroot}%{_includedir}/%{name}/" install -m0644 include/{config,snprintf,cgiutils,locations}.h "%{buildroot}%{_includedir}/%{name}" -# remove unnecessary files from www log directory -rm "%{buildroot}/%{icinga_logdir}/www/"{.htaccess,index.htm} - # REST of special SUSE stuff here, if needed.... # init-scripts # remove the default init script as SUSE uses an adapted one -test -f "%{buildroot}%{_sysconfdir}/init.d/%{name}" && rm -v "%{buildroot}%{_sysconfdir}/init.d/%{name}" -install -D -m0755 %{SOURCE1} "%{buildroot}%{_sysconfdir}/init.d/%{name}" -ln -sf ../../%{_sysconfdir}/init.d/%{name} "%{buildroot}%{_sbindir}/rc%{name}" -install -D -m0755 %{SOURCE2} "%{buildroot}%{_sysconfdir}/init.d/ido2db" -ln -sf ../../%{_sysconfdir}/init.d/ido2db "%{buildroot}%{_sbindir}/rcido2db" +install -D -m0755 %{SOURCE1} "%{buildroot}%{_initrddir}/%{name}" +ln -sf ../../%{_initrddir}/%{name} "%{buildroot}%{_sbindir}/rc%{name}" +install -D -m0755 %{SOURCE2} "%{buildroot}%{_initrddir}/ido2db" +ln -sf ../../%{_initrddir}/ido2db "%{buildroot}%{_sbindir}/rcido2db" # sysconfig script install -D -m 0644 %{SOURCE3} "%{buildroot}%{_localstatedir}/adm/fillup-templates/sysconfig.%{name}" # install cronjob (gzip' the logfiles) install -D -m 0640 %{SOURCE4} "%{buildroot}%{_sysconfdir}/cron.weekly/%{name}" %if 0%{?suse_version} >= 1110 -%fdupes -s %{buildroot} + %fdupes -s %{buildroot} %endif # fix documentation -rm -f sample-config/*.in -rm -f sample-config/template-object/*.in +rm "sample-config/"*.in +rm "sample-config/template-object/"*.in +rm "module/idoutils/config/"*.in # install manpages from Debian -mkdir -p %{buildroot}%{_mandir}/man8/ +install -d -m0755 "%{buildroot}%{_mandir}/man8/" install -m644 %{SOURCE6} "%{buildroot}%{_mandir}/man8/" install -m644 %{SOURCE7} "%{buildroot}%{_mandir}/man8/" install -m644 %{SOURCE8} "%{buildroot}%{_mandir}/man8/" install -m644 %{SOURCE9} "%{buildroot}%{_mandir}/man8/" -# install default www interface user -install -m644 %{SOURCE12} "%{buildroot}%{icinga_sysconfdir}/" - -# install ido2utils scripts -pushd module/idoutils/db/scripts >/dev/null -test -d "%{buildroot}/%{_bindir}" || mkdir -p "%{buildroot}/%{_bindir}" -for file in *; do - outfile=$(basename $file .in) - sed -e "s|@ido2db_perl@|%{_bindir}/perl|g; \ - s|../mysql|%{_defaultdocdir}/%{name}-idoutils-mysql/mysql|g" \ - $file > "%{buildroot}/%{_bindir}/%{name}-$outfile" - chmod +x "%{buildroot}/%{_bindir}/%{name}-$outfile" -done -popd >/dev/null - %pre +# add icinga user and groups groupadd -r %{icinga_group} 2>/dev/null || : groupadd -r %{icinga_command_group} 2>/dev/null || : /usr/sbin/useradd -c %{icinga_user} -s /sbin/nologin -r -d %{icinga_localstatedir} -G %{icinga_command_group} -g %{icinga_group} %{icinga_user} 2> /dev/null || : %post -%{fillup_and_insserv %{name}} -# New installation? -if [ ${1:-0} -eq 0 ]; then +if [ ${1:-0} -gt 1 ] +then +# On Update + %{_defaultdocdir}/%{name}/examples/update_icinga_paths.sh %{name} +else +# On installation # First installation: create an alias for the default nagiosadmin user if [ -r etc/aliases ]; then if ! grep -q "^%{name}:" etc/aliases; then echo -e "%{name}:\troot" >> etc/aliases - %{nnmmsg} "Added alias for user %{name} to /etc/aliases" + %{logmsg} "Added alias for user %{name} to /etc/aliases" if [ -x usr/bin/newaliases ]; then usr/bin/newaliases &>/dev/null || true else - %{nnmmsg} "Cannot execute newaliases. Please run it manually." + %{logmsg} "Cannot execute newaliases. Please run it manually." fi fi fi fi +%{fillup_and_insserv %{name}} + %preun %stop_on_removal %{name} @@ -395,18 +428,19 @@ else wwwusr=$(awk '/^[ \t]*User[ \t]+[a-zA-Z0-9]+/ {print $2}' etc/apache2/*.conf) fi -if [ "z" == "z$wwwusr" ]; then # otherwise, use the default +if [ "$wwwusr" == "" ]; then # otherwise, use the default wwwusr=%{icinga_command_user} fi # if apache user is not in cmdgrp, add it if /usr/bin/id -Gn $wwwusr 2>/dev/null | /bin/grep -q %{icinga_command_group} > /dev/null 2>&1 ; then - : # $wwwusr (default: %{icinga_command_user}) is already in %{icinga_command_group} group + : # $wwwusr (default: %%{icinga_command_user}) is already in %%{icinga_command_group} group else # modify apache user, adding it to cmdgrp groupmod -A $wwwusr %{icinga_command_group} 2>/dev/null - %nnmmsg "User $wwwusr added to group %{icinga_command_group} so sending commands to Icinga from the command CGI is possible." + %{logmsg} "User $wwwusr added to group %{icinga_command_group} so sending commands to Icinga from the command CGI is possible." fi -if [ "$1" = "1" ]; then +if [ ${1:-0} -eq 1 ] +then # this is the initial installation: enable icinga test -x %{_sbindir}/a2enflag && %{_sbindir}/a2enflag ICINGA >/dev/null fi @@ -423,14 +457,14 @@ fi %post idoutils -#post a db update notification in case of major updates -if [ "$1" == "2" ] && - [ "`rpm -q %{name}-idoutils | head -n1 | cut -d- -f3 | cut -d. -f-2`" != "`echo %{version} | cut -d. -f-2`" ]; then - echo "########################################################################################" - echo "Don't forget to update your database. Check /usr/share/doc/packages/icinga-idoutils-<db>" - echo "########################################################################################" +if [ ${1:-0} -gt 1 ] +then +# On Update + %{_defaultdocdir}/%{name}/examples/update_icinga_paths.sh %{name}-idoutils fi +%{logmsg} "icinga-idoutils installed: Don't forget to install/upgrade your db schema, check /usr/share/doc/packages/icinga-idoutils/README.SUSE.idoutils" + %{fillup_and_insserv ido2db} %preun idoutils @@ -442,10 +476,10 @@ %files %defattr(-,root,root) -%doc Changelog LEGAL LICENSE README UPGRADING sample-config/ +%doc README LICENSE Changelog UPGRADING LEGAL sample-config/ README.SUSE examples %{_mandir}/man8/icinga*.8* %{_mandir}/man8/mini_epn_icinga.8* -%{_sysconfdir}/init.d/%{name} +%{_initrddir}/%{name} %{_sbindir}/%{name} %{_sbindir}/icingastats %{_sbindir}/mini_epn @@ -453,17 +487,17 @@ %{_sbindir}/rc%{name} %{icinga_datadir}/p1.pl %{_localstatedir}/adm/fillup-templates/sysconfig.%{name} -%attr(0755,root,root) %config %{_sysconfdir}/cron.weekly/* +%attr(0755,root,root) %config %{_sysconfdir}/cron.weekly/%{name} %dir %{icinga_libdir} -%dir %{_prefix}/lib/nagios -%dir %{_prefix}/lib/nagios/brokers -%dir %{_prefix}/lib/nagios/plugins -%exclude %{icinga_libdir}/cgi +%exclude %{icinga_cgidir} +%exclude %{icinga_libdir}/idomod.so %{_sbindir}/convertcfg %dir %{icinga_sysconfdir} %dir %{icinga_sysconfdir}/modules %config(noreplace) %{icinga_sysconfdir}/icinga.cfg %dir %{icinga_sysconfdir}/objects +%dir %{_sysconfdir}/%{name}/conf.d +%config(noreplace) %{icinga_logrotatefile} %config(noreplace) %{icinga_sysconfdir}/objects/commands.cfg %config(noreplace) %{icinga_sysconfdir}/objects/contacts.cfg %config(noreplace) %{icinga_sysconfdir}/objects/notifications.cfg @@ -473,21 +507,38 @@ %config(noreplace) %{icinga_sysconfdir}/objects/templates.cfg %config(noreplace) %{icinga_sysconfdir}/objects/timeperiods.cfg %config(noreplace) %{icinga_sysconfdir}/objects/windows.cfg -%config(noreplace) %{icinga_sysconfdir}/resource.cfg +%config(noreplace) %attr(0640,icinga,icinga) %{icinga_sysconfdir}/resource.cfg %defattr(-,%{icinga_user},%{icinga_group}) -%dir %{icinga_localstatedir} -%dir %{icinga_localstatedir}/checkresults %dir %{icinga_logdir} %dir %{icinga_logdir}/archives -%attr(0755,%{icinga_user},%{icinga_command_group}) %dir %{icinga_spooldir} +%dir %{icinga_spooldir} +%dir %{icinga_spooldir}/checkresults +%ghost %{icinga_cmd_filedir} %files www %defattr(-,root,root) -%config(noreplace) %attr(-,root,root) %{apacheconfdir}/%{name}.conf -%config(noreplace) %{icinga_sysconfdir}/htpasswd.users +%config(noreplace) %{apacheconfdir}/%{name}.conf %config(noreplace) %{icinga_sysconfdir}/cgi.cfg %config(noreplace) %{icinga_sysconfdir}/cgiauth.cfg -%{icinga_libdir}/cgi +%config(noreplace) %attr(0640,root,%{apachegroup}) %{icinga_http_authfile} +%dir %{icinga_cgidir}/ +%{icinga_cgidir}/avail.cgi +%{icinga_cgidir}/cmd.cgi +%{icinga_cgidir}/config.cgi +%{icinga_cgidir}/extinfo.cgi +%{icinga_cgidir}/histogram.cgi +%{icinga_cgidir}/history.cgi +%{icinga_cgidir}/notifications.cgi +%{icinga_cgidir}/outages.cgi +%{icinga_cgidir}/showlog.cgi +%{icinga_cgidir}/status.cgi +%{icinga_cgidir}/statusmap.cgi +%{icinga_cgidir}/statuswml.cgi +%{icinga_cgidir}/statuswrl.cgi +%{icinga_cgidir}/summary.cgi +%{icinga_cgidir}/tac.cgi +%{icinga_cgidir}/trends.cgi +%{icinga_cgidir}/daemonchk.cgi %dir %{icinga_datadir} %{icinga_datadir}/contexthelp %{icinga_datadir}/images @@ -500,13 +551,13 @@ %{icinga_datadir}/sidebar.html %{icinga_datadir}/ssi %{icinga_datadir}/stylesheets -%attr(0775,%{icinga_command_user},%{icinga_command_group}) %dir %{icinga_logdir}/www +%attr(0775,%{icinga_command_user},%{icinga_command_group}) %dir %{icinga_cgi_logdir} %files idoutils %defattr(-,root,root) -%doc module/idoutils/db/queries module/idoutils/db/README module/idoutils/config +%doc module/idoutils/db/queries UPGRADING module/idoutils/db/README module/idoutils/config README.SUSE.idoutils %{_mandir}/man8/ido2db.8* -%{_sysconfdir}/init.d/ido2db +%{_initrddir}/ido2db %config(noreplace) %{icinga_sysconfdir}/ido2db.cfg %config(noreplace) %{icinga_sysconfdir}/idomod.cfg %config(noreplace) %{icinga_sysconfdir}/modules/idoutils.cfg @@ -514,25 +565,19 @@ %{_sbindir}/rcido2db %{_sbindir}/ido2db %{_sbindir}/log2ido -%{_sbindir}/idomod.o +%{icinga_libdir}/idomod.so %files idoutils-mysql %defattr(-,root,root) -%doc module/idoutils/db/mysql -%{_bindir}/%{name}-create_mysqldb.sh -%{_bindir}/%{name}-installdb -%{_bindir}/%{name}-prepsql -%{_bindir}/%{name}-upgradedb +%doc module/idoutils/db/mysql module/idoutils/db/examples %files idoutils-oracle %defattr(-,root,root) %doc module/idoutils/db/oracle -%{_bindir}/%{name}-create_oracledb.sh %files idoutils-pgsql %defattr(-,root,root) %doc module/idoutils/db/pgsql -%{_bindir}/%{name}-create_pgsqldb.sh %files devel %defattr(-,root,root) ++++++ README.SUSE ++++++ Introduction ------------ CHANGES for 1.7 * bindir/idomod.o => libdir/idomod.so * /var/lib/icinga => /var/spool/icinga * /usr/lib/nagios/plugins/eventhandlers => /usr/lib/icinga/eventhandler * /var/spool/icinga/icinga.cmd => /var/run/icinga/icinga.cmd * /var/spool/icinga/ido2db.sock => /var/run/icinga/ido2db.sock The packages are made as little dependend on each other as possible, to get the maximum flexibility in setting up distributed monitoring environments. This means, that you may have to install some additional packages manually. Zypper is your friend. Recommended OS Installation --------------------------- Repositories: https://build.opensuse.org/package/show?package=icinga&project=server%3Amonitoring Order of Installation --------------------- Keeping a certain order of installation will lead you to a working monitoring setup in a relatively short time. Use zypper to pull the proper dependencies automatically. 1. Install icinga 2. Install the needed nagios-plugins 3. If you need or want the classic gui, install icinga-www. If you want plain monitoring with icinga core and configure everything else by hand, you are done. 3.1 An example user icingaadmin with password icingaadmin is installed to /etc/icinga/htpasswd.users 3.1 Add a new basic auth user for apache: # htpasswd /etc/icinga/htpasswd.users youradmin 4. Optional: install icinga-idoutils. Icinga Data Output Utils are necessary for various database backed guis such as Icinga Web or Icinga Reporting. IDOUtils use the libdbi database abstraction layer and can use MySQL or Postgresql with this package. - icinga-idoutils-mysql - icinga-idoutils-pgsql 4.1 Create the idoutils database. For details see the README.SUSE.idoutils of the icinga-idoutils-* package. Detailed information can be found in the "Creation of Database and IDOUtils" section in the official docs as well as the wiki howtos. http://docs.icinga.org/latest/en/quickstart-idoutils.html https://wiki.icinga.org/display/howtos/Setting+up+Icinga+with+IDOUtils 5. Optional: install additional Icinga guis like Icinga Web or Icinga Reporting as well as addons such as PNP4Nagios, Check_MK or NagVis. For a suggested list please either consult the docs or the wiki, or ask community members at icinga-portal.org Troubleshooting --------------- - check if you have set SELinux to "disabled" mode - check that your local firewall rules contain appropriate rules for the webserver and non-local database-connections - start the components in the rigth order: database, ido2db, icinga, apache2 - check if idomod loads correctly (/var/log/icinga/icinga.log: idomod: Successfully connected to data sink) - check the apache2 error.log, the icinga.log and the syslog - in case of possible bugs, turn on debugging and refer to the debug logs Recommended Reading ------------------- http://docs.icinga.org http://wiki.icinga.org http://www.icinga-portal.org Suggestions and Bugreports -------------------------- If you want to make suggestions for the way this software is packaged or want to report bugs related to the packaging of this software, please report to the SUSE bug tracker by using the link "Report Bug" on https://build.opensuse.org/package/show?package=icinga&project=server%3Amonitoring ++++++ README.SUSE.idoutils ++++++ IDOUtils Notes for SUSE packages ================================ CHANGES for 1.7 * bindir/idomod.o => libdir/idomod.so * /var/lib/icinga => /var/spool/icinga * /usr/lib/nagios/plugins/eventhandlers => /usr/lib/icinga/eventhandler * /var/spool/icinga/icinga.cmd => /var/run/icinga/icinga.cmd * /var/spool/icinga/ido2db.sock => /var/run/icinga/ido2db.sock ============== = IDOMOD Setup ============== DO NOT EDIT icinga.cfg for broker_module entry!!! Icinga RPMs will use the /etc/icinga/modules/idoutils.cfg with the module definition automatically. Defining that twice can lead into unwanted errors! Verify that by looking into the modules/idoutils.cfg file # vim /etc/icinga/modules/idoutils.cfg Other event broker modules can be defined using this module definition as well. ============== = IDO2DB Setup ============== Edit your database credentials in ido2db.cfg ... # vim /etc/icinga/ido2db.cfg db_servertype=mysql #db_servertype=pgsql db_host=localhost db_port=3306 #db_port=5432 db_name=icinga db_prefix=icinga_ db_user=icinga db_pass=icinga ... and create the database like described below. ------- - MySQL ------- Create Database, User, Grants ----------------------------- # mysql -u root -p mysql> CREATE DATABASE icinga; Query OK, 1 row affected (0.01 sec) mysql> GRANT USAGE ON icinga.* TO 'icinga'@'localhost' IDENTIFIED BY 'icinga' WITH MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0 MAX_UPDATES_PER_HOUR 0; mysql> GRANT SELECT , INSERT , UPDATE , DELETE, DROP, CREATE VIEW ON icinga.* TO 'icinga'@'localhost'; mysql> FLUSH PRIVILEGES; mysql> quit Import database schema ---------------------- # cd /usr/share/doc/packages/icinga-idoutils-mysql/mysql # mysql -u root -p icinga < mysql.sql ------------ - Postgresql ------------ Create Database, User, Grants ----------------------------- # su - postgres postgres:~$ psql template1 template1=# create database icinga; template1=# \q postgres:~$ createlang plpgsql icinga postgres:~$ psql postgres=# create role icinga; postgres=# alter role icinga login; postgres=# grant all on database icinga to icinga; postgres=# \q Import database schema ---------------------- postgres:~$ cd /usr/share/doc/packages/icinga-idoutils-pgsql/pgsql postgres:~$ psql -U icinga -d icinga < pgsql.sql Setup trusted local icinga user ------------------------------- Now that Postgresql does use a local user to be trusted (insecure, but good as startup), edit pg_hba.conf accordingly. See Postgresql Manual for a more advanced setup on user auth and privilegues. # vim /var/lib/pgsql/data/pg_hba.conf # TYPE DATABASE USER CIDR-ADDRESS METHOD # "local" is for Unix domain socket connections only local all all trust # IPv4 local connections: host all all 127.0.0.1/32 trust # IPv6 local connections: host all all ::1/128 trust #icinga local icinga icinga trust and reload the Postgresql server. ========== = Upgrade ========== There is no db upgrade script like in Debian, so you need to keep track of that yourself. First, get the schema version # mysql -u root -p icinga mysql> SELECT * from icinga_dbversion; +--------------+----------+---------+ | dbversion_id | name | version | +--------------+----------+---------+ | 1 | idoutils | 1.6.0 | +--------------+----------+---------+ 1 row in set (0.01 sec) and then decide, what to do - based on the official upgrade docs: http://docs.icinga.org/latest/en/upgrading_idoutils.html Remember - the upgrade steps need to be applied incremential, version by version. e.g. # cd /usr/share/doc/packages/icinga-idoutils-mysql/mysql/upgrade/ # mysql -u root -p icinga < mysql-upgrade-1.7.0.sql =========== = Advanced =========== Advanced guides and upgrade information can be found in the docs and wiki: http://docs.icinga.org/latest/en/quickstart-idoutils.html http://docs.icinga.org/latest/en/upgrading_idoutils.html ++++++ icinga-1.6.1.tar.gz -> icinga-1.7.1.tar.gz ++++++ /work/SRC/openSUSE:Factory/icinga/icinga-1.6.1.tar.gz /work/SRC/openSUSE:Factory/.icinga.new/icinga-1.7.1.tar.gz differ: char 5, line 1 ++++++ icinga-add-ifdefine-to-apache.patch ++++++ --- /var/tmp/diff_new_pack.jQavnP/_old 2012-07-23 10:15:51.000000000 +0200 +++ /var/tmp/diff_new_pack.jQavnP/_new 2012-07-23 10:15:51.000000000 +0200 @@ -1,7 +1,7 @@ -Index: icinga-1.2.1/sample-config/httpd.conf.in +Index: icinga-1.7.0/sample-config/httpd.conf.in =================================================================== ---- icinga-1.2.1.orig/sample-config/httpd.conf.in -+++ icinga-1.2.1/sample-config/httpd.conf.in +--- icinga-1.7.0.orig/sample-config/httpd.conf.in ++++ icinga-1.7.0/sample-config/httpd.conf.in @@ -5,6 +5,7 @@ # configuration file. Customize the paths, etc. as # needed to fit your system. @@ -10,8 +10,8 @@ ScriptAlias @cgiurl@ "@sbindir@" <Directory "@sbindir@"> -@@ -38,4 +39,4 @@ Alias @htmurl@ "@datadir@/" - AuthUserFile @sysconfdir@/htpasswd.users +@@ -38,4 +39,4 @@ + AuthUserFile @HTTPAUTHFILE@ Require valid-user </Directory> - ++++++ icinga-fix-create_mysqldb.patch ++++++ diff -rupN icinga-1.7.0.orig/module/idoutils/db/scripts/create_mysqldb.sh icinga-1.7.0/module/idoutils/db/scripts/create_mysqldb.sh --- icinga-1.7.0.orig/module/idoutils/db/scripts/create_mysqldb.sh 2012-05-15 15:00:56.000000000 +0200 +++ icinga-1.7.0/module/idoutils/db/scripts/create_mysqldb.sh 2012-06-15 17:12:43.998353127 +0200 @@ -40,7 +40,7 @@ echo "create new DB $DB, user $DBUSER an mysql -u $DBADMIN -h $DBHOST $P --verbose >$WD/create_mysqldb.log mysql <<EOS2 CREATE DATABASE $DB; CREATE USER '$DBUSER'@'$DBHOST' IDENTIFIED BY '$DBPASS'; - GRANT USAGE ON *.* TO '$DBUSER'@'$DBHOST' WITH MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0 MAX_UPDATES_PER_HOUR 0; + GRANT USAGE ON $DB.* TO '$DBUSER'@'$DBHOST' WITH MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0 MAX_UPDATES_PER_HOUR 0; GRANT SELECT , INSERT , UPDATE , DELETE ON $DB.* to '$DBUSER'@'$DBHOST'; FLUSH PRIVILEGES ; use $DB; ++++++ icinga-fix-fsf-address.patch ++++++ diff -rupN icinga-1.7.0.orig/include/cgiutils.h icinga-1.7.0/include/cgiutils.h --- icinga-1.7.0.orig/include/cgiutils.h 2012-05-15 15:00:56.000000000 +0200 +++ icinga-1.7.0/include/cgiutils.h 2012-06-19 17:44:37.860755350 +0200 @@ -18,7 +18,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. ************************************************************************/ #ifndef _CGIUTILS_H diff -rupN icinga-1.7.0.orig/include/config.h.in icinga-1.7.0/include/config.h.in --- icinga-1.7.0.orig/include/config.h.in 2012-05-15 15:00:56.000000000 +0200 +++ icinga-1.7.0/include/config.h.in 2012-06-19 17:44:58.473517691 +0200 @@ -17,7 +17,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. ************************************************************************/ diff -rupN icinga-1.7.0.orig/include/locations.h.in icinga-1.7.0/include/locations.h.in --- icinga-1.7.0.orig/include/locations.h.in 2012-05-15 15:00:56.000000000 +0200 +++ icinga-1.7.0/include/locations.h.in 2012-06-19 17:44:15.783009899 +0200 @@ -16,7 +16,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. ************************************************************************/ #define DEFAULT_TEMP_FILE "@STATEDIR@/tempfile" diff -rupN icinga-1.7.0.orig/LICENSE icinga-1.7.0/LICENSE --- icinga-1.7.0.orig/LICENSE 2012-05-15 15:00:56.000000000 +0200 +++ icinga-1.7.0/LICENSE 2010-03-24 00:34:05.000000000 +0100 @@ -1,12 +1,12 @@ - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 - Copyright (C) 1989, 1991 Free Software Foundation, Inc. - 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Copyright (C) 1989, 1991 Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. - Preamble + Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public @@ -15,7 +15,7 @@ software--to make sure the software is f General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by -the GNU Library General Public License instead.) You can apply it to +the GNU Lesser General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not @@ -56,7 +56,7 @@ patent must be licensed for everyone's f The precise terms and conditions for copying, distribution and modification follow. - GNU GENERAL PUBLIC LICENSE + GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains @@ -255,7 +255,7 @@ make exceptions for this. Our decision of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. - NO WARRANTY + NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN @@ -277,9 +277,9 @@ YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - END OF TERMS AND CONDITIONS + END OF TERMS AND CONDITIONS - How to Apply These Terms to Your New Programs + How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it @@ -291,7 +291,7 @@ convey the exclusion of warranty; and ea the "copyright" line and a pointer to where the full notice is found. <one line to give the program's name and a brief idea of what it does.> - Copyright (C) 19yy <name of author> + Copyright (C) <year> <name of author> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -303,17 +303,16 @@ the "copyright" line and a pointer to wh MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: - Gnomovision version 69, Copyright (C) 19yy name of author + Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. @@ -336,5 +335,5 @@ necessary. Here is a sample; alter the This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Library General +library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. ++++++ rcicinga ++++++ --- /var/tmp/diff_new_pack.jQavnP/_old 2012-07-23 10:15:51.000000000 +0200 +++ /var/tmp/diff_new_pack.jQavnP/_new 2012-07-23 10:15:51.000000000 +0200 @@ -73,24 +73,9 @@ # check some default files and directories function check_files() { # remove some perhaps left over files - for file in "$command_file" "$lock_file" "$status_file" "$temp_file" "/var/lock/subsys/icinga"; do + for file in "$command_file" "$lock_file" "$status_file" "$temp_file"; do test -f "$file" && rm -f "$file" done - # set default access rights for files and directories - for file in "$log_file" "$state_retention_file" "$status_file"; do - if [ ! -e "$file" ]; then - touch "$file" - fi - chown $icinga_user:$icinga_cmdgrp "$file" - done - for dir in "$check_result_path" ; do - if [ ! -d "$dir" ]; then - mkdir -p "$dir" - fi - chown $icinga_user:$icinga_cmdgrp "$dir" - done - chmod 660 "$resource_file" - chown $icinga_user:$icinga_cmdgrp "$resource_file" } function check_lock_file() { @@ -153,7 +138,6 @@ state_retention_file="$(get_var state_retention_file)" command_file="$(get_var command_file)" resource_file="$(get_var resource_file)" -object_cache_file="$(get_var object_cache_file)" check_result_path="$(get_var check_result_path)" check_external_commands="$(get_var check_external_commands)" @@ -165,16 +149,15 @@ : ${icinga_cmdgrp:=icingacmd} : ${resource_file:=/etc/icinga/resource.cfg} # check ownership files -: ${check_result_path:=/var/spool/icinga} +: ${check_result_path:=/var/spool/icinga/checkresults} : ${log_file:=/var/log/icinga/icinga.log} -: ${state_retention_file:=/var/log/icinga/retention.dat} -: ${status_file:=/var/log/icinga/status.dat} +: ${state_retention_file:=/var/spool/icinga/retention.dat} +: ${status_file:=/var/spool/icinga/status.dat} : ${check_external_commands:=0} # files to remove -: ${command_file:=/var/spool/icinga/icinga.cmd} +: ${command_file:=/var/run/icinga/icinga.cmd} : ${lock_file:=/var/run/icinga/icinga.pid} -: ${object_cache_file:=/var/lib/icinga/objects.cache} -: ${temp_file:=/var/log/icinga/icinga.tmp} +: ${temp_file:=/tmp/icinga.tmp} # Reset status of this service rc_reset @@ -182,13 +165,21 @@ case "$1" in start) echo -n "Starting Icinga " + + # create checkresult dir if missing + if [ ! -d "$check_result_path" ]; then + mkdir -p "$check_result_path" + chown $icinga_user:$icinga_group "$check_result_path" + chmod 775 "$check_result_path" + fi + config_check if [ $? -eq 0 ]; then # check if icinga is already running ICINGAPID=$(pidof "$ICINGA_BIN") if [ -z "$ICINGAPID" ]; then check_files - check_lock_file + check_lock_file fi startproc $NICELEVEL -p "$lock_file" "$ICINGA_BIN" -d "$ICINGA_CFG" @@ -198,7 +189,6 @@ ICINGA_TIMEOUT=$[$ICINGA_TIMEOUT-1] done chgrp $icinga_cmdgrp "$command_file" - chown $icinga_user:$icinga_cmdgrp "$check_result_path" fi else echo "Error in configuration - please read $ICINGA_CFG_ERR_LOG" @@ -249,6 +239,7 @@ rc_status ;; restart) + $0 check $0 stop $0 start rc_status @@ -285,7 +276,7 @@ fi rc_status -v ;; - check_verbose) + check_verbose|show-errors) echo "Running verbose configuration check..." config_check verbose exitcode=$? @@ -295,7 +286,7 @@ rc_exit ;; *) - echo "Usage: $0 {start|stop|status|try-restart|restart|reload|check|check_verbose}" + echo "Usage: $0 {start|stop|status|try-restart|restart|reload|check|check_verbose|show-errors}" exit 1 ;; esac ++++++ update_icinga_paths.sh ++++++ #!/bin/bash update_config_files () { package="$1" config_file="$2" old_path="$3" new_path="$4" if [ -f "${config_file}" ] && /bin/grep -q "${old_path}" "${config_file}" > /dev/null 2>&1; then DATE=$(date +"%Y%m%d%H%M") #create backup if there wasn't one created this minute if [ ! -f "${config_file}_rpm_update-${DATE}" ] then cp "${config_file}" "${config_file}_rpm_update-${DATE}" || { %{logmsg} "Could not create backup file ${config_file}_rpm_update-${DATE}" >&2; exit 1; } fi sed -i "s|${old_path}|${new_path}|g" "${config_file}" \ || { %{logmsg} "Could not adapt ${config_file} - please do manually" >&2 ; exit 1; } %{logmsg} "WARNING: ${config_file} adapted to new configuration" %{logmsg} " (see >rpm -q ${package} --changelog | less<)" %{logmsg} " Backup file is: ${config_file}_rpm_update-$DATE" fi if [ -e "${old_path}" ] then %{logmsg} "WARNING: ${old_path} has been moved" %{logmsg} " to ${new_path}" %{logmsg} " Please check/adapt your configuration/scripts and move the still needed files to the new directory!" fi } move_file_to_new_location () { old_path="$1" new_path="$2" if [ -f "${old_path}" ] then cp -ua "${old_path}" "${new_path}" || \ { %{logmsg} "Could not copy ${old_path} to ${new_path} \ because a newer version already exists" >&2; exit 1; } rm "${old_path}" fi } # update icinga config files if [ "$1" == "icinga" ] then # determine if service was running to be able to restart it after the update [ -f %{icinga_lockfile} ] && service_was_running=true [ $service_was_running ] && rcicinga stop &>/dev/null || : ############################################# # update paths to new run directory update_config_files "icinga" "%{icinga_sysconfdir}/icinga.cfg" "/var/spool/icinga/icinga.cmd" "%{icinga_cmdfile}" # update paths to new run directory ############################################# ############################################# # update paths to new eventhandler directory update_config_files "icinga" "%{icinga_sysconfdir}/resource.cfg" "/usr/lib/nagios/plugins/eventhandlers" "%{icinga_eventhandlerdir}" # update paths to new eventhandler directory ############################################# ############################################# # update paths to new spool directory update_config_files "icinga" "%{icinga_sysconfdir}/icinga.cfg" "/var/lib/icinga" "%{icinga_spooldir}" update_config_files "icinga" "%{icinga_sysconfdir}/objects/commands.cfg" "/var/lib/icinga" "%{icinga_spooldir}" # update paths to new spool directory ############################################# ############################################# # move necessary data to new spool directory move_file_to_new_location "/var/lib/icinga/retention.dat" "%{icinga_spooldir}/" move_file_to_new_location "/var/lib/icinga/idomod.tmp" "%{icinga_spooldir}/" move_file_to_new_location "/var/lib/icinga/objects.precache" "%{icinga_spooldir}/" # move necessary data to new spool directory ############################################# ############################################# # cleanup remaining unneeded files test -e "/var/spool/icinga/icinga.cmd" && rm "/var/spool/icinga/icinga.cmd" test -f "/var/lib/icinga/status.dat" && rm "/var/lib/icinga/status.dat" test -f "/var/lib/icinga/objects.cache" && rm "/var/lib/icinga/objects.cache" # remove /var/lib if empty if [ -d "/var/lib/icinga" ] && [ -z $(ls "/var/lib/icinga") ] then rmdir "/var/lib/icinga" fi # cleanup remaining unneeded files ############################################# # start service if it was running before [ $service_was_running ] && rcicinga start &>/dev/null || : fi # update icinga-idoutils config files if [ "$1" == "icinga-idoutils" ] then # determine if service was running [ -f %{icinga_ido2db_lockfile} ] && service_was_running=true [ $service_was_running ] && rcido2db stop &>/dev/null || : ############################################# # update paths to new run directory update_config_files "icinga-idoutils" "%{icinga_sysconfdir}/ido2db.cfg" "/var/spool/icinga/ido2db.sock" "%{icinga_ido2db_socketfile}" update_config_files "icinga-idoutils" "%{icinga_sysconfdir}/idomod.cfg" "/var/spool/icinga/ido2db.sock" "%{icinga_ido2db_socketfile}" # cleanup old socket file test -e "/var/spool/icinga/ido2db.sock" && rm "/var/spool/icinga/ido2db.sock" # update paths to new spool directory ############################################# # start service if it was running before and there wasn't a major upgrade [ $service_was_running ] && rcido2db start &>/dev/null || : fi -- To unsubscribe, e-mail: opensuse-commit+unsubscr...@opensuse.org For additional commands, e-mail: opensuse-commit+h...@opensuse.org