2014-08-13 14:57:31 +02:00
#
2010-08-04 17:01:09 +02:00
# Pandora FMS Server
#
%define name pandorafms_server
2022-09-30 12:00:00 +02:00
%define version 7.0NG.765
2022-10-27 01:00:24 +02:00
%define release 221027
2010-08-04 17:01:09 +02:00
Summary: Pandora FMS Server
Name: %{name}
Version: %{version}
Release: %{release}
License: GPL
Vendor: ArticaST <http://www.artica.es>
Source0: %{name}-%{version}.tar.gz
URL: http://www.pandorafms.com
Group: System/Monitoring
Packager: Sancho Lerena <slerena@artica.es>
Prefix: %{_datadir}
BuildRoot: %{_tmppath}/%{name}-buildroot
BuildArchitectures: noarch
AutoReq: 0
Provides: %{name}-%{version}
2012-06-27 09:02:52 +02:00
Requires(pre): shadow-utils
2016-02-26 15:26:08 +01:00
Requires(post,preun): /sbin/chkconfig /sbin/service
2010-08-04 17:01:09 +02:00
Requires: coreutils
2016-02-26 15:26:08 +01:00
Requires: perl(DBI) perl(DBD::mysql)
Requires: perl(HTTP::Request::Common) perl(LWP::Simple) perl(LWP::UserAgent)
Requires: perl(XML::Simple) perl(XML::Twig) net-snmp-utils
Requires: perl(NetAddr::IP) net-snmp net-tools
2019-09-11 13:36:14 +02:00
Requires: perl(IO::Socket::INET6) perl(IO::Socket::SSL) perl(Net::Telnet)
2020-12-15 12:57:48 +01:00
Requires: fping nmap sudo perl(JSON)
2016-02-26 15:26:08 +01:00
Requires: perl(Time::HiRes) perl(Encode::Locale)
2022-06-14 16:55:25 +02:00
Requires: perl perl(Sys::Syslog) perl(HTML::Entities) perl(Geo::IP) expect
2010-08-04 17:01:09 +02:00
%description
Pandora FMS is a monitoring system for big IT environments. It uses remote tests, or local agents to grab information. Pandora supports all standard OS (Linux, AIX, HP-UX, Solaris and Windows XP,2000/2003), and support multiple setups in HA enviroments.
%prep
rm -rf $RPM_BUILD_ROOT
%setup -q -n pandora_server
%build
%install
rm -rf $RPM_BUILD_ROOT
2010-11-25 18:29:59 +01:00
mkdir -p $RPM_BUILD_ROOT%{_bindir}/
2010-08-04 17:01:09 +02:00
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/rc.d/init.d/
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/pandora/
2018-04-27 14:10:01 +02:00
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/tentacle/
2010-08-04 17:01:09 +02:00
mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/spool/pandora/data_in
mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/spool/pandora/data_in/conf
mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/spool/pandora/data_in/md5
2012-06-27 09:02:52 +02:00
mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/spool/pandora/data_in/collections
2014-03-13 14:42:47 +01:00
mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/spool/pandora/data_in/netflow
2019-11-21 18:21:46 +01:00
mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/spool/pandora/data_in/trans
mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/spool/pandora/data_in/commands
2010-08-04 17:01:09 +02:00
mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/log/pandora/
mkdir -p $RPM_BUILD_ROOT%{prefix}/pandora_server/conf/
mkdir -p $RPM_BUILD_ROOT%{_mandir}/man1/
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/
2013-04-01 03:28:14 +02:00
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/cron.hourly/
2010-08-04 17:01:09 +02:00
mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/lib/pandora/.ssh
2010-11-25 18:29:59 +01:00
mkdir -p $RPM_BUILD_ROOT/usr/lib/perl5/
2010-08-04 17:01:09 +02:00
# All binaries go to %{_bindir}
2010-11-25 18:29:59 +01:00
cp -aRf bin/pandora_server $RPM_BUILD_ROOT%{_bindir}/
cp -aRf bin/pandora_exec $RPM_BUILD_ROOT%{_bindir}/
2010-08-04 17:01:09 +02:00
install -m 0755 bin/tentacle_server $RPM_BUILD_ROOT%{_bindir}/
cp -aRf conf/* $RPM_BUILD_ROOT%{prefix}/pandora_server/conf/
cp -aRf util $RPM_BUILD_ROOT%{prefix}/pandora_server/
2021-06-14 13:56:42 +02:00
cp -aRf util/pandora_ha.pl $RPM_BUILD_ROOT/usr/bin/pandora_ha
2010-11-25 18:29:59 +01:00
cp -aRf lib/* $RPM_BUILD_ROOT/usr/lib/perl5/
2010-08-04 17:01:09 +02:00
install -m 0755 util/pandora_server $RPM_BUILD_ROOT%{_sysconfdir}/rc.d/init.d/
install -m 0755 util/tentacle_serverd $RPM_BUILD_ROOT%{_sysconfdir}/rc.d/init.d/
install -m 0444 man/man1/pandora_server.1.gz $RPM_BUILD_ROOT%{_mandir}/man1/
install -m 0444 man/man1/tentacle_server.1.gz $RPM_BUILD_ROOT%{_mandir}/man1/
rm -f $RPM_BUILD_ROOT%{prefix}/pandora_server/util/PandoraFMS
2010-11-01 13:34:39 +01:00
rm -f $RPM_BUILD_ROOT%{prefix}/pandora_server/util/recon_scripts/PandoraFMS
2010-08-04 17:01:09 +02:00
2021-03-31 18:38:14 +02:00
if [ ! -f $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/pandora_server ] ; then
install -m 0644 util/pandora_server_logrotate $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/pandora_server
fi
2013-05-22 18:58:14 +02:00
install -m 0640 conf/pandora_server.conf.new $RPM_BUILD_ROOT%{_sysconfdir}/pandora/pandora_server.conf.new
2018-04-27 14:10:01 +02:00
install -m 0640 conf/tentacle_server.conf.new $RPM_BUILD_ROOT%{_sysconfdir}/tentacle/tentacle_server.conf.new
2010-08-04 17:01:09 +02:00
2014-06-14 16:09:49 +02:00
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/sudoers.d
chmod 0750 $RPM_BUILD_ROOT%{_sysconfdir}/sudoers.d
cat <<EOF > $RPM_BUILD_ROOT%{_sysconfdir}/sudoers.d/pandora
2015-06-04 21:08:47 +02:00
Defaults:root !requiretty
2014-06-14 16:09:49 +02:00
EOF
chmod 0440 $RPM_BUILD_ROOT%{_sysconfdir}/sudoers.d/pandora
2013-04-01 03:28:14 +02:00
cat <<EOF > $RPM_BUILD_ROOT%{_sysconfdir}/cron.hourly/pandora_db
2010-08-04 17:01:09 +02:00
#!/bin/bash
%__perl %{prefix}/pandora_server/util/pandora_db.pl %{_sysconfdir}/pandora/pandora_server.conf
EOF
2013-04-01 03:28:14 +02:00
chmod 0755 $RPM_BUILD_ROOT%{_sysconfdir}/cron.hourly/pandora_db
2010-08-04 17:01:09 +02:00
%clean
rm -fr $RPM_BUILD_ROOT
%pre
2012-06-27 09:02:52 +02:00
getent passwd pandora >/dev/null || \
/usr/sbin/useradd -d %{prefix}/pandora_server -s /sbin/nologin -M -g 0 pandora
2010-08-04 17:01:09 +02:00
exit 0
%post
# Initial installation
2020-09-04 15:10:27 +02:00
# Run when not uninstalling
if [ "$1" -ge 1 ]
then
if [ `command -v systemctl` ]
2020-06-24 13:33:22 +02:00
then
2020-08-28 14:19:54 +02:00
echo "Copying new version for tentacle_serverd service"
cp -f /usr/share/pandora_server/util/tentacle_serverd.service /usr/lib/systemd/system/
2020-06-24 13:33:22 +02:00
chmod -x /usr/lib/systemd/system/tentacle_serverd.service
# Enable the services on SystemD
systemctl enable tentacle_serverd.service
else
/sbin/chkconfig --add tentacle_serverd
/sbin/chkconfig tentacle_serverd on
fi
2020-09-04 15:10:27 +02:00
/sbin/chkconfig --add pandora_server
/sbin/chkconfig pandora_server on
2020-06-24 13:33:22 +02:00
2020-09-04 15:10:27 +02:00
systemctl enable pandora_server.service
2010-08-04 17:01:09 +02:00
2020-09-04 15:10:27 +02:00
echo "Pandora FMS Server configuration is %{_sysconfdir}/pandora/pandora_server.conf"
echo "Pandora FMS Server main directory is %{prefix}/pandora_server/"
echo "The manual can be reached at: man pandora or man pandora_server"
echo "Pandora FMS Documentation is in: http://pandorafms.org"
echo " "
2010-08-04 17:01:09 +02:00
fi
2020-09-04 15:10:27 +02:00
# This will avoid config files overwritting on UPGRADES.
2018-04-27 14:10:01 +02:00
# Main configuration file
2013-05-22 18:58:14 +02:00
if [ ! -e "/etc/pandora/pandora_server.conf" ]
then
echo "Creating a new version of Pandora FMS Server config file at /etc/pandora/pandora_server.conf"
cat /etc/pandora/pandora_server.conf.new > /etc/pandora/pandora_server.conf
else
# Do a copy of current .conf, just in case.
echo "An existing version of pandora_server.conf is found."
cat /etc/pandora/pandora_server.conf > /etc/pandora/pandora_server.conf.old
fi
2018-04-27 14:10:01 +02:00
# Tentacle server
if [ ! -e "/etc/tentacle/tentacle_server.conf" ]
then
echo "Creating a new version of Tentacle Server config file at /etc/tentacle/tentacle_server.conf"
cat /etc/tentacle/tentacle_server.conf.new > /etc/tentacle/tentacle_server.conf
fi
2013-05-22 18:58:14 +02:00
2010-08-04 17:01:09 +02:00
echo "Don't forget to start Tentacle Server daemon if you want to receive"
echo "data using tentacle"
2020-09-08 11:53:53 +02:00
if [ "$1" -gt 1 ]
then
echo "If Tentacle Server daemon was running with init.d script,"
echo "please stop it manually and start the service with systemctl"
fi
2010-08-04 17:01:09 +02:00
%preun
# Upgrading
if [ "$1" = "1" ]; then
exit 0
fi
2016-02-26 15:45:57 +01:00
/sbin/service pandora_server stop >/dev/null 2>&1 || :
/sbin/service tentacle_serverd stop >/dev/null 2>&1 || :
2010-08-04 17:01:09 +02:00
/sbin/chkconfig --del pandora_server
/sbin/chkconfig --del tentacle_serverd
exit 0
%files
2020-01-08 15:35:03 +01:00
%defattr(750,root,root)
2014-09-15 11:33:53 +02:00
%doc AUTHORS COPYING README
2010-08-04 17:01:09 +02:00
%{_sysconfdir}/rc.d/init.d/pandora_server
%{_sysconfdir}/rc.d/init.d/tentacle_serverd
2013-04-01 03:28:14 +02:00
%{_sysconfdir}/cron.hourly/pandora_db
2014-06-14 16:09:49 +02:00
%config(noreplace) %{_sysconfdir}/sudoers.d/pandora
2010-08-04 17:01:09 +02:00
%config(noreplace) %{_sysconfdir}/logrotate.d/pandora_server
2010-11-25 18:29:59 +01:00
%defattr(755,pandora,root)
2010-08-04 17:01:09 +02:00
%{prefix}/pandora_server
2010-11-25 18:29:59 +01:00
/usr/lib/perl5/PandoraFMS
2010-08-04 17:01:09 +02:00
%{_mandir}/man1/pandora_server.1.gz
%{_mandir}/man1/tentacle_server.1.gz
2020-01-08 15:35:03 +01:00
%defattr(750,pandora,root)
2010-08-04 17:01:09 +02:00
%{_bindir}/pandora_exec
%{_bindir}/pandora_server
%{_bindir}/tentacle_server
2021-06-14 13:56:42 +02:00
%{_bindir}/pandora_ha
2020-01-08 15:35:03 +01:00
2010-08-04 17:01:09 +02:00
%dir %{_sysconfdir}/pandora
%dir %{_localstatedir}/spool/pandora
2018-05-31 20:16:09 +02:00
%defattr(-,pandora,root, 754)
%dir %{_localstatedir}/log/pandora
2013-05-22 18:58:14 +02:00
%defattr(600,root,root)
/etc/pandora/pandora_server.conf.new
2018-04-30 16:22:52 +02:00
%defattr(664,root,root)
2018-04-27 14:10:01 +02:00
/etc/tentacle/tentacle_server.conf.new
2013-05-22 18:58:14 +02:00
2017-02-27 13:06:19 +01:00
%defattr(-,pandora,apache,2770)
2013-06-12 14:16:44 +02:00
%{_localstatedir}/spool/pandora
2010-08-04 17:01:09 +02:00
%{_localstatedir}/spool/pandora/data_in
2013-06-13 13:58:30 +02:00
%{_localstatedir}/spool/pandora/data_in/md5
%{_localstatedir}/spool/pandora/data_in/collections
%{_localstatedir}/spool/pandora/data_in/conf
2014-03-13 14:42:47 +01:00
%{_localstatedir}/spool/pandora/data_in/netflow
2019-11-21 18:21:46 +01:00
%{_localstatedir}/spool/pandora/data_in/trans
%{_localstatedir}/spool/pandora/data_in/commands