Репозиторий ALT Linux backports/2.4
Последнее обновление: 9 июля 2008 | Пакетов: 497 | Посещений: 1583453
 поиск   регистрация   авторизация 
 
Группа :: Система/Серверы
Пакет: zabbix

 Главная   Изменения   Спек   Патчи   Загрузить   Bugs and FR 

%define zabbix_user zabbix
%define zabbix_group zabbix
%define zabbix_home /dev/null

%def_with pgsql

Name: zabbix
Version: 1.1.7
Release: alt0.M24.1

Serial: 1

Summary: A network monitor
License: GPL
Group: System/Servers

Url: http://www.zabbix.com
Packager: Vladimir V Kamarzin <vvk at altlinux.ru>

# http://heanet.dl.sourceforge.net/sourceforge/%name/%name-%version.tar.gz

Source0: %name-%version.tar
Source1: %name.conf
Source2: %{name}_agentd.init
Source3: %{name}_mysql.init
Source4: %{name}_pgsql.init
Source5: %name.migrate.sh
Patch0: %name-%version-%release.patch

# ALT patches

#Patch0:

# Debian patches

#Patch1:

BuildPreReq: /proc
BuildRequires: libMySQL-devel libldap-devel libnet-snmp-devel libssl-devel zlib-devel rsync
%if_with pgsql
BuildRequires: postgresql-devel libpq3-devel
%endif

%package common
Summary: %name network monitor (common stuff)
Group: System/Servers

%package server-common
Summary: %name network monitor (server common stuff)
Group: System/Servers

%package server-mysql
Summary: %name network monitor (server, compiled with MySQL support)
Group: System/Servers
Requires: %name-common = %serial:%version-%release
Requires: %name-server-common = %serial:%version-%release
Obsoletes: %name-mysql < 1:1.1.7-alt1

%if_with pgsql
%package server-pgsql
Summary: %name network monitor (server, compiled with PostgreSQL support)
Group: System/Servers
Requires: %name-common = %serial:%version-%release
Requires: %name-server-common = %serial:%version-%release
Obsoletes: %name-pgsql < 1:1.1.7-alt1
%endif

%package agent
Summary: %name agent
Group: System/Servers
Requires: %name-common = %serial:%version-%release

%package phpfrontend-engine
Summary: zabbix web frontend (php)
Group: System/Servers
Obsoletes: %name-phpfrontend < 1:1.1.7-alt1

%package phpfrontend-php4
Summary: zabbix web frontend, edition for php4
Group: System/Servers
Requires: php-gd2

%package phpfrontend-php5
Summary: zabbix web frontend, edition for php5
Group: System/Servers
Requires: php5-gd2

%package phpfrontend-apache
Summary: %name-phpfrontend's apache config files
Group: System/Servers
Requires: %name-phpfrontend-engine = %serial:%version-%release, apache

%package phpfrontend-apache2
Summary: %name-phpfrontend's apache2 config files
Group: System/Servers
Requires: %name-phpfrontend-engine = %serial:%version-%release, apache2

%package doc
Summary: %name network monitor (README, ChangeLog)
Group: System/Servers

%package contrib
Summary: %name network monitor (additional scripts)
Group: System/Servers

%package contrib-agent-win32
Summary: %name network monitor (agent for win32)
Group: System/Servers

%package contrib-agent-win64
Summary: %name network monitor (agent for win64)
Group: System/Servers

%description
ZABBIX is software for monitoring of your applications, network and servers.
ZABBIX supports both polling and trapping techniques to collect data from
monitored hosts. A flexible notification mechanism allows easy and quickly
configure different types of notifications for pre-defined events.

%description common
Common files and docs for zabbix network monitor

ZABBIX is software for monitoring of your applications, network and servers.
ZABBIX supports both polling and trapping techniques to collect data from
monitored hosts. A flexible notification mechanism allows easy and quickly
configure different types of notifications for pre-defined events.

%description server-common
common stuff for zabbix server

%description server-mysql
zabbix server, compiled with MySQL support

ZABBIX is software for monitoring of your applications, network and servers.
ZABBIX supports both polling and trapping techniques to collect data from
monitored hosts. A flexible notification mechanism allows easy and quickly
configure different types of notifications for pre-defined events.

%if_with pgsql
%description server-pgsql
zabbix server, compiled with PostgreSQL support
%endif

%description agent
zabbix network monitor agent.

ZABBIX is software for monitoring of your applications, network and servers.
ZABBIX supports both polling and trapping techniques to collect data from
monitored hosts. A flexible notification mechanism allows easy and quickly
configure different types of notifications for pre-defined events.

%description phpfrontend-apache
zabbix's apache config files

%description phpfrontend-apache2
zabbix's apache2 config files

%description phpfrontend-engine
a php frontend for zabbix - core

%description phpfrontend-php4
zabbix web frontend, edition for php4

%description phpfrontend-php5
zabbix web frontend, edition for php5

%description doc
%name network monitor (README, ChangeLog)

%description contrib
%name network monitor (additional scripts)

%description contrib-agent-win32
%name network monitor (agent for win32)

%description contrib-agent-win64
%name network monitor (agent for win64)

%prep
%setup -q
%patch0 -p1

%build
%configure --with-mysql \
--with-net-snmp \
--enable-server \
--enable-agent \
--with-ldap
%make

mv src/%{name}_server/%{name}_server src/%{name}_server/%{name}_mysql
%make clean

%if_with pgsql
%configure --with-pgsql \
--with-net-snmp \
--enable-server \
--enable-agent \
--with-ldap
%make

mv src/%{name}_server/%{name}_server src/%{name}_server/%{name}_pgsql
%endif

# adjust in several files /home/zabbix

for file in misc/conf/*; do
 sed -i -e "s,/home/zabbix/bin,/usr/sbin,g" \
        -e "s,PidFile=/var/tmp,PidFile=%_var/run/zabbix,g" \
        -e "s,LogFile=/tmp,LogFile=%_logdir/zabbix,g" \
        -e "s,/home/zabbix/lock,%_var/lock/subsys/zabbix,g" \
-e "s,/tmp/mysql.sock,%_localstatedir/mysql/mysql.sock,g" $file
done

%install
# create directory structure
install -d -m1775 %buildroot%_logdir/%name
install -d -m1775 %buildroot%_var/run/%name
install -d -m0755 %buildroot%_sbindir
install -d -m0750 %buildroot%_sysconfdir/%name
install -d -m0755 %buildroot%_var/www/html/addon-modules/%name

# binaries

install -m0755 src/%{name}_*/%{name}_{mysql,get,agentd,sender} %buildroot%_sbindir
%if_with pgsql
install -m0755 src/%{name}_server/%{name}_pgsql %buildroot%_sbindir
%endif

# conf files

install -m0640 misc/conf/%{name}_{server,agentd,trapper}.conf %buildroot%_sysconfdir/%name

# frontends

cp -r frontends %buildroot%_var/www/html/addon-modules/%name/

# apache config

install -pD -m0644 %SOURCE1 %buildroot%_sysconfdir/httpd/conf/addon-modules.d/%name.conf

# apache2 config

install -pD -m0644 %SOURCE1 %buildroot%_sysconfdir/httpd2/conf/addon.d/A.%name.conf

# start scripts

install -pD -m0755 %SOURCE2 %buildroot%_initdir/%{name}_agentd
install -pD -m0755 %SOURCE3 %buildroot%_initdir/%{name}_mysql
%if_with pgsql
install -pD -m0755 %SOURCE4 %buildroot%_initdir/%{name}_pgsql
%endif

# migrator

install -m0755 %SOURCE5 migrate.sh

# database upgrades

mkdir tmp-{mysql,postgresql}
rsync -vaP --exclude=postgresql upgrades tmp-mysql
rsync -vaP --exclude=mysql upgrades tmp-postgresql
mv tmp-mysql/upgrades/dbpatches upgrades-mysql
mv tmp-postgresql/upgrades/dbpatches upgrades-postgresql

%pre common
/usr/sbin/groupadd -r -f %zabbix_group ||:
/usr/sbin/useradd -g %zabbix_group -G proc -c 'Zabbix' \
-d %zabbix_home -s /dev/null -r %zabbix_user >/dev/null 2>&1 ||:

%post server-mysql
%post_service zabbix_mysql

%preun server-mysql
%preun_service zabbix_mysql

%if_with pgsql
%post server-pgsql
%post_service zabbix_pgsql

%preun server-pgsql
%preun_service zabbix_pgsql
%endif

%post agent
%post_service zabbix_agentd
if [ $1 -eq 1 ]; then
sed -i -e "s,Hostname=localhost,Hostname=$HOSTNAME,g" \
%_sysconfdir/%name/%{name}_agentd.conf
fi

%preun agent
%preun_service zabbix_agentd

%post phpfrontend-apache
%_initdir/httpd reload

%postun phpfrontend-apache
%_initdir/httpd reload

%post phpfrontend-apache2
%_initdir/httpd2 reload

%postun phpfrontend-apache2
%_initdir/httpd2 reload

%files common
%dir %attr(1775,root,%zabbix_group) %_logdir/%name
%dir %attr(1775,root,%zabbix_group) %_var/run/%name
%dir %_sysconfdir/%name

%files server-common
%_sbindir/%{name}_get
%config(noreplace) %attr(0640,root,%zabbix_group) %_sysconfdir/%name/%{name}_server.conf
%config(noreplace) %attr(0640,root,%zabbix_group) %_sysconfdir/%name/%{name}_trapper.conf

%files server-mysql
%_sbindir/%{name}_mysql
%_initdir/%{name}_mysql
%doc create/mysql create/data/data.sql create/data/images.sql
%doc upgrades-mysql

%if_with pgsql
%files server-pgsql
%_sbindir/%{name}_pgsql
%_initdir/%{name}_pgsql
%doc create/postgresql create/data/images_pgsql.sql
%doc upgrades-postgresql
%endif

%files agent
%config(noreplace) %attr(0640,root,%zabbix_group) %_sysconfdir/%name/%{name}_agentd.conf
%_initdir/%{name}_agentd
%_sbindir/%{name}_agentd
%_sbindir/%{name}_sender

%files phpfrontend-engine
%config(noreplace) %_var/www/html/addon-modules/%name/frontends/php/include/db.inc.php
%_var/www/html/addon-modules/%name/*
%dir %_var/www/html/addon-modules/%name

%files phpfrontend-php4

%files phpfrontend-php5

%files phpfrontend-apache
%config(noreplace) %_sysconfdir/httpd/conf/addon-modules.d/%name.conf

%files phpfrontend-apache2
%config(noreplace) %_sysconfdir/httpd2/conf/addon.d/A.%name.conf

%files doc
%doc AUTHORS NEWS README INSTALL

%files contrib
%doc misc/snmptrap/* migrate.sh

%files contrib-agent-win32
%doc bin/ZabbixW32.exe

%files contrib-agent-win64
%doc bin/ZabbixW64.exe

%changelog

Полный changelog можно просмотреть здесь

 
design & coding: Vladimir Lettiev aka crux © 2004-2005