diff --git a/pandora_agents/unix/DEBIAN/make_deb_package.sh b/pandora_agents/unix/DEBIAN/make_deb_package.sh index ec9916c282..9cc42117db 100644 --- a/pandora_agents/unix/DEBIAN/make_deb_package.sh +++ b/pandora_agents/unix/DEBIAN/make_deb_package.sh @@ -42,6 +42,7 @@ mkdir -p temp_package/var/spool/pandora/data_out mkdir -p temp_package/usr/share/man/man1/ mkdir -p temp_package/usr/share/pandora_agent/plugins mkdir -p temp_package/tmp +mkdir -p temp_package/etc/logrotate.d/ echo "Make directory system tree for package." cp DEBIAN temp_package -R @@ -62,6 +63,7 @@ cp -aRf tentacle_client temp_package/usr/bin/ cp -aRf pandora_agent temp_package/usr/bin/ cp -aRf pandora_agent_exec temp_package/usr/bin/pandora_agent_exec cp -aRf pandora_agent_daemon temp_package/etc/init.d/pandora_agent_daemon +cp -aRf pandora_agent_logrotate temp_package/etc/logrotate.d/pandora_agent cp Linux/pandora_agent.conf temp_package/etc/pandora/ cp -aRf man/man1/* temp_package/usr/share/man/man1/ diff --git a/pandora_console/DEBIAN/make_deb_package.sh b/pandora_console/DEBIAN/make_deb_package.sh index 771122389f..46eb48429b 100644 --- a/pandora_console/DEBIAN/make_deb_package.sh +++ b/pandora_console/DEBIAN/make_deb_package.sh @@ -88,10 +88,12 @@ mkdir -p temp_package if [ $package_pandora -eq 1 ] then mkdir -p temp_package/var/www/pandora_console + mkdir -p temp_package/etc/logrotate.d echo "Make directory system tree for package." cp -R $(ls | grep -v temp_package | grep -v DEBIAN ) temp_package/var/www/pandora_console cp -R DEBIAN temp_package + cp -aRf pandora_console_logrotate_ubuntu temp_package/etc/logrotate.d/pandora_console find temp_package/var/www/pandora_console -name ".svn" | xargs rm -Rf rm -Rf temp_package/var/www/pandora_console/pandora_console.spec chmod 755 -R temp_package/DEBIAN diff --git a/pandora_console/pandora_console.redhat.spec b/pandora_console/pandora_console.redhat.spec index 9c56edebd5..9e0838b35e 100644 --- a/pandora_console/pandora_console.redhat.spec +++ b/pandora_console/pandora_console.redhat.spec @@ -51,7 +51,7 @@ mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/ cp -aRf * $RPM_BUILD_ROOT%{prefix}/pandora_console rm $RPM_BUILD_ROOT%{prefix}/pandora_console/*.spec rm $RPM_BUILD_ROOT%{prefix}/pandora_console/pandora_console_install -install -m 0644 pandora_console_logrotate $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/pandora_console +install -m 0644 pandora_console_logrotate_centos $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/pandora_console %clean rm -rf $RPM_BUILD_ROOT diff --git a/pandora_console/pandora_console.spec b/pandora_console/pandora_console.spec index 3d9fac2b0f..70fe0320e4 100644 --- a/pandora_console/pandora_console.spec +++ b/pandora_console/pandora_console.spec @@ -66,7 +66,7 @@ if [ -f %{prefix}/pandora_console/include/config.php ] ; then else echo "Please, now, point your browser to http://your_IP_address/pandora_console/install.php and follow all the steps described on it." fi -cp -aRf %{prefix}/pandora_console/pandora_console_logrotate /etc/logrotate.d/pandora_console +cp -aRf %{prefix}/pandora_console/pandora_console_logrotate_suse /etc/logrotate.d/pandora_console %preun diff --git a/pandora_console/pandora_console_install b/pandora_console/pandora_console_install old mode 100644 new mode 100755 index 2e8a653edc..050b85b1ba --- a/pandora_console/pandora_console_install +++ b/pandora_console/pandora_console_install @@ -183,7 +183,20 @@ install () { then [ -d $DESTDIR/etc/logrotate.d ] && mkdir -p $DESTDIR/etc/logrotate.d echo "Creating logrotate.d entry for Pandora FMS log management" - cp pandora_console_logrotate $DESTDIR/etc/logrotate.d/pandora_console + case $DISTRO in + SUSE) + cp pandora_console_logrotate_suse $DESTDIR/etc/logrotate.d/pandora_console + ;; + UBUNTU|DEBIAN) + cp pandora_console_logrotate_ubuntu $DESTDIR/etc/logrotate.d/pandora_console + ;; + FEDORA|RHEL_CENTOS|GENERIC) + cp pandora_console_logrotate_centos $DESTDIR/etc/logrotate.d/pandora_console + ;; + *) + echo "Please add a log rotation schedule manually to your log rotation daemon (if any)" + ;; + esac else echo "Please add a log rotation schedule manually to your log rotation daemon (if any)" fi diff --git a/pandora_console/pandora_console_logrotate b/pandora_console/pandora_console_logrotate deleted file mode 100644 index 1dee0374e7..0000000000 --- a/pandora_console/pandora_console_logrotate +++ /dev/null @@ -1,35 +0,0 @@ -# DEBIAN / UBUNTU -/var/www/pandora_console/pandora_console.log { - weekly - missingok - size 100000 - rotate 3 - maxage 15 - compress - notifempty - create 644 www-data www-data -} - -# OpenSUSE, SLES -/srv/www/htdocs/pandora_console/pandora_console.log { - weekly - missingok - size 100000 - rotate 3 - maxage 15 - compress - notifempty - create 644 wwwrun www -} - -# Centos, Redhat, Fedora -/var/www/html/pandora_console/pandora_console.log { - weekly - missingok - size 100000 - rotate 3 - maxage 15 - compress - notifempty - create 644 apache root -} diff --git a/pandora_console/pandora_console_logrotate_centos b/pandora_console/pandora_console_logrotate_centos new file mode 100644 index 0000000000..3666165272 --- /dev/null +++ b/pandora_console/pandora_console_logrotate_centos @@ -0,0 +1,11 @@ +# Centos, Redhat, Fedora +/var/www/html/pandora_console/pandora_console.log { + weekly + missingok + size 100000 + rotate 3 + maxage 15 + compress + notifempty + create 644 apache root +} diff --git a/pandora_console/pandora_console_logrotate_suse b/pandora_console/pandora_console_logrotate_suse new file mode 100644 index 0000000000..8f0380a4d5 --- /dev/null +++ b/pandora_console/pandora_console_logrotate_suse @@ -0,0 +1,11 @@ +# OpenSUSE, SLES +/srv/www/htdocs/pandora_console/pandora_console.log { + weekly + missingok + size 100000 + rotate 3 + maxage 15 + compress + notifempty + create 644 wwwrun www +} diff --git a/pandora_console/pandora_console_logrotate_ubuntu b/pandora_console/pandora_console_logrotate_ubuntu new file mode 100644 index 0000000000..a7acfaa6e5 --- /dev/null +++ b/pandora_console/pandora_console_logrotate_ubuntu @@ -0,0 +1,11 @@ +# DEBIAN / UBUNTU +/var/www/pandora_console/pandora_console.log { + weekly + missingok + size 100000 + rotate 3 + maxage 15 + compress + notifempty + create 644 www-data www-data +} diff --git a/pandora_console/pandora_console_upgrade b/pandora_console/pandora_console_upgrade index 9e9b3a2579..947a3a2553 100755 --- a/pandora_console/pandora_console_upgrade +++ b/pandora_console/pandora_console_upgrade @@ -17,6 +17,34 @@ fi MODE=$1 pandora_upgrade () { + + case `uname -s` in + Linux) + # Get Linux Distro type and version + if [ -f "/etc/SuSE-release" ] + then + DISTRO=SUSE + elif [ -f "/etc/lsb-release" ] && [ ! -f "/etc/redhat-release" ] + then + DISTRO=UBUNTU + elif [ -f "/etc/debian_version" ] + then + DISTRO=DEBIAN + elif [ -f "/etc/fedora-release" ] + then + DISTRO=FEDORA + elif [ -f "/etc/redhat-release" ] + then + DISTRO=RHEL_CENTOS + fi + ;; + FreeBSD) + DISTRO=FreeBSD + ;; + NetBSD) + DISTRO=NetBSD + ;; + esac if [ ! -e "$PANDORAPATH/index.php" ] then @@ -80,7 +108,20 @@ pandora_upgrade () { if [ -d /etc/logrotate.d ]; then echo "Creating logrotate.d entry for Pandora FMS log management" - cp pandora_console_logrotate /etc/logrotate.d/pandora_console + case $DISTRO in + SUSE) + cp pandora_console_logrotate_suse $DESTDIR/etc/logrotate.d/pandora_console + ;; + UBUNTU|DEBIAN) + cp pandora_console_logrotate_ubuntu $DESTDIR/etc/logrotate.d/pandora_console + ;; + FEDORA|RHEL_CENTOS|GENERIC) + cp pandora_console_logrotate_centos $DESTDIR/etc/logrotate.d/pandora_console + ;; + *) + echo "Please add a log rotation schedule manually to your log rotation daemon (if any)" + ;; + esac else echo "Please add a log rotation schedule manually to your log rotation daemon (if any)" fi diff --git a/pandora_server/DEBIAN/make_deb_package.sh b/pandora_server/DEBIAN/make_deb_package.sh index 8cd5230cc7..7b709c8b4a 100644 --- a/pandora_server/DEBIAN/make_deb_package.sh +++ b/pandora_server/DEBIAN/make_deb_package.sh @@ -81,6 +81,7 @@ then mkdir -p temp_package/usr/share/pandora_server/conf/ mkdir -p temp_package/usr/lib/perl5/ mkdir -p temp_package/usr/share/man/man1/ + mkdir -p temp_package/etc/logrotate.d/ cp -aRf bin/pandora_server temp_package/usr/bin/ cp -aRf bin/pandora_exec temp_package/usr/bin/pandora_exec.server @@ -96,6 +97,8 @@ then cp -aRf man/man1/* temp_package/usr/share/man/man1/ + cp -aRf util/pandora_server_logrotate temp_package/etc/logrotate.d/pandora_server + rm -f temp_package/usr/share/pandora_server/util/PandoraFMS rm -f temp_package/usr/share/pandora_server/bin/PandoraFMS rm -f temp_package/usr/share/pandora_server/util/recon_scripts/PandoraFMS