summaryrefslogtreecommitdiffstats
path: root/zabbix.spec
blob: f7c08f5e81f0b1d3c979c716347e33ee0d44b51a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
%define apxs    /usr/sbin/apxs2
%define apache_datadir          %(%{apxs} -q DATADIR)
%define apache_sysconfdir       %(%{apxs} -q SYSCONFDIR)

Name: zabbix
Version: 1.1alpha6
Release: 1
Group: System Environment/Daemons
License: GPL
Source: %{name}-%{version}.tar.gz
BuildRoot: %{_tmppath}/%{name}-root
BuildPrereq: mysql-client, mysql-devel, ucdsnmp
Requires: mysql-client, ucdsnmp
Summary: A network monitor.

%define zabbix_prefix           /opt/%{name}
%define zabbix_bindir 		%{zabbix_prefix}/bin
%define zabbix_confdir 		%{_sysconfdir}/%{name}
%define zabbix_phpfrontend	%{zabbix_prefix}/frontends/php

%description
zabbix is a network monitor.

%package agent
Summary: Zabbix agent
Group: System Environment/Daemons

%description agent
the zabbix network monitor agent.

%package phpfrontend
Summary: Zabbix web frontend (php).
Group: System Environment/Daemons
Requires: php

%description phpfrontend
a php frontend for zabbix.

%prep
%setup -q

%build
%configure --with-mysql --with-ucd-snmp
make

# adjust in several files /home/zabbix
for zabbixfile in misc/conf/* misc/init.d/suse/*/zabbix_agentd src/zabbix_server/{alerter,server}.c; do
  sed -i -e "s#/home/zabbix/bin#%{zabbix_bindir}#g" \
         -e "s#PidFile=/var/tmp#PidFile=%{_localstatedir}/run#g" \
         -e "s#LogFile=/tmp#LogFile=%{_localstatedir}/log#g" \
         -e "s#/home/zabbix/lock#%{_localstatedir}/lock#g" $zabbixfile
done

# adjust /home/zabbix to /usr/share/doc/packages/
sed -i -e "s#/home/zabbix#%{_defaultdocdir}#g" create/data/images.sql

%pre
if [ -z "`grep zabbix etc/group`" ]; then
  usr/sbin/groupadd zabbix >/dev/null 2>&1
fi
if [ -z "`grep zabbix etc/passwd`" ]; then
  usr/sbin/useradd -g zabbix zabbix >/dev/null 2>&1
fi

%pre agent
if [ -z "`grep zabbix etc/group`" ]; then
  usr/sbin/groupadd zabbix >/dev/null 2>&1
fi
if [ -z "`grep zabbix etc/passwd`" ]; then
  usr/sbin/useradd -g zabbix zabbix >/dev/null 2>&1
fi

%post agent
%{fillup_and_insserv -f zabbix_agentd}

if [ -z "`grep zabbix_agent etc/services`" ]; then
  cat >>etc/services <<EOF
zabbix_agent	10050/tcp
EOF
fi

if [ -z "`grep zabbix_trap etc/services`" ]; then
  cat >>etc/services <<EOF
zabbix_trap	10051/tcp
EOF
fi

%postun agent
%{insserv_cleanup}

%clean
rm -fr $RPM_BUILD_ROOT

%install
rm -fr $RPM_BUILD_ROOT
#make install DESTDIR=$RPM_BUILD_ROOT

# create directory structure
install -d %{buildroot}%{zabbix_bindir}
install -d %{buildroot}%{zabbix_confdir}
install -d %{buildroot}%{_sysconfdir}/init.d
install -d %{buildroot}%{apache_sysconfdir}/conf.d

# copy binaries
install -m 755 bin/zabbix_* %{buildroot}%{zabbix_bindir}

# copy conf files
install -m 755 misc/conf/zabbix_*.conf %{buildroot}%{zabbix_confdir}

# copy frontends
cp -r frontends %{buildroot}%{zabbix_prefix}

# apache2 config
cat >zabbix.conf <<EOF
Alias /%{name} %{zabbix_phpfrontend}

<Directory "%{zabbix_phpfrontend}">
    Options FollowSymLinks
    AllowOverride None
    Order allow,deny
    Allow from all
</Directory>
EOF

install -m 644 zabbix.conf %{buildroot}%{apache_sysconfdir}/conf.d

# SuSE Start Scripts
install -m 755 misc/init.d/suse/9.1/zabbix_* %{buildroot}%{_sysconfdir}/init.d/

%files
%defattr(-,root,root)
%doc AUTHORS COPYING NEWS README INSTALL create upgrades
%dir %attr(0755,root,root) %{zabbix_confdir}
%attr(0644,root,root) %config(noreplace) %{zabbix_confdir}/zabbix_server.conf
%dir %attr(0755,root,root) %{zabbix_prefix}
%dir %attr(0755,root,root) %{zabbix_bindir}
%attr(0755,root,root) %{zabbix_bindir}/zabbix_server

%files agent 
%defattr(-,root,root)
%dir %attr(0755,root,root) %{zabbix_confdir}
%attr(0644,root,root) %config(noreplace) %{zabbix_confdir}/zabbix_agent.conf
%attr(0644,root,root) %config(noreplace) %{zabbix_confdir}/zabbix_agentd.conf
%config(noreplace) %{_sysconfdir}/init.d/zabbix_agentd
%dir %attr(0755,root,root) %{zabbix_prefix}
%dir %attr(0755,root,root) %{zabbix_bindir}
%attr(0755,root,root) %{zabbix_bindir}/zabbix_agent
%attr(0755,root,root) %{zabbix_bindir}/zabbix_agentd
%attr(0755,root,root) %{zabbix_bindir}/zabbix_sender

%files phpfrontend
%defattr(-,root,root)
%attr(0644,root,root) %config(noreplace) %{apache_sysconfdir}/conf.d/zabbix.conf
%dir %attr(0755,root,root) %{zabbix_prefix}
%dir %attr(0755,root,root) %{zabbix_prefix}/frontends
%attr(0755,root,root) %{zabbix_phpfrontend}

%changelog
* Fri Jan 29 2005 Dirk Datzert <dirk@datzert.de>
- update to 1.1aplha6

* Tue Jun 01 2003 Alexei Vladishev <alexei.vladishev@zabbix.com>
- update to 1.0beta10 

* Tue Jun 01 2003 Harald Holzer <hholzer@may.co.at>
- update to 1.0beta9
- move phpfrontend config to /etc/zabbix

* Tue May 23 2003 Harald Holzer <hholzer@may.co.at>
- split the php frontend in a extra package

* Tue May 20 2003 Harald Holzer <hholzer@may.co.at>
- 1.0beta8
- initial packaging