Log rotation to .deb and split pandora_console_logrotate

This commit is contained in:
fermin831 2015-11-16 17:29:58 +01:00
parent 3d798d424f
commit 6e1ca6fd53
11 changed files with 98 additions and 39 deletions

View File

@ -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/

View File

@ -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

View File

@ -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

View File

@ -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

15
pandora_console/pandora_console_install Normal file → Executable file
View File

@ -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

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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

View File

@ -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