zabbix-vl.spec 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532
  1. %define ver 4.0.7
  2. %define rel 1
  3. %define only_agent 0
  4. %if %{only_agent}
  5. %bcond_with server
  6. %bcond_with proxy
  7. %bcond_with frontend
  8. %else
  9. %bcond_without server
  10. %bcond_without proxy
  11. %bcond_without frontend
  12. %endif
  13. %bcond_without agent
  14. Summary: The Enterprise-class Monitoring Solution for Everyone
  15. Name: zabbix
  16. Version: %{ver}
  17. Release: %{rel}%{?_dist_release}
  18. License: GPLv2
  19. Group: Applications/Services
  20. URL: https://www.zabbix.com/
  21. Source0: %{name}-%{version}.tar.gz
  22. Source1: zabbix_server.init
  23. Source2: zabbix_proxy.init
  24. Source3: zabbix_agentd.init
  25. Source4: zabbix_server.logrotate
  26. Source5: zabbix_proxy.logrotate
  27. Source6: zabbix_agentd.logrotate
  28. Patch1: 0001-change-the-font-for-Vine-Linux.patch
  29. Patch2: 0002-modified-config-files-for-Vine-Linux.patch
  30. BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot
  31. %if %{with server}%{with proxy}
  32. BuildRequires: libpq-devel
  33. BuildRequires: libmariadb-devel
  34. %endif
  35. BuildRequires: libevent-devel
  36. BuildRequires: pcre-devel
  37. BuildRequires: curl-devel
  38. BuildRequires: net-snmp-devel
  39. BuildRequires: OpenIPMI-devel
  40. BuildRequires: unixODBC-devel
  41. BuildRequires: libssh2-devel
  42. Requires(pre): glibc-common
  43. Requires(pre): shadow-utils
  44. Vendor: Project Vine
  45. Distribution: Vine Linux
  46. Packager: iwaim
  47. %description
  48. The Enterprise-class Monitoring Solution for Everyone.
  49. %if %{with server}
  50. %package server-common
  51. Summary: common files for Zabbix Server
  52. Requires: %{name} == %{version}-%{release}
  53. Requires(post,preun): chkconfig
  54. Requires(preun,postun): initscripts
  55. %description server-common
  56. This package include common files for Zabbix Server.
  57. %package server-mysql
  58. Summary: Zabbix Server for MySQL/MariaDB
  59. Provides: %{name}-server
  60. Requires: %{name}-server-common == %{version}-%{release}
  61. %description server-mysql
  62. Zabbix Server for MySQL/MariaDB
  63. %package server-postgresql
  64. Summary: Zabbix Server for PostgreSQL
  65. Provides: %{name}-server
  66. Requires: %{name}-server-common == %{version}-%{release}
  67. %description server-postgresql
  68. Zabbix Server for PostgreSQL
  69. %endif
  70. %if %{with agent}
  71. %package agent
  72. Summary: Zabbix Agent
  73. Requires: %{name} == %{version}-%{release}
  74. Requires(post,preun): chkconfig
  75. Requires(preun,postun): initscripts
  76. %description agent
  77. Zabbix Agent
  78. %endif
  79. %if %{with proxy}
  80. %package proxy-common
  81. Summary: common files for Zabbix Proxy
  82. Requires: %{name} == %{version}-%{release}
  83. Requires(post,preun): chkconfig
  84. Requires(preun,postun): initscripts
  85. %description proxy-common
  86. This package include common files for Zabbix Proxy
  87. %package proxy-mysql
  88. Summary: Zabbix Proxy for MySQL/MariaDB
  89. Provides: %{name}-proxy
  90. Requires: %{name}-proxy-common == %{version}-%{release}
  91. %description proxy-mysql
  92. Zabbix Proxy for MySQL/MariaDB
  93. %package proxy-postgresql
  94. Summary: Zabbix Proxy for PostgreSQL
  95. Provides: %{name}-proxy
  96. Requires: %{name}-proxy-common == %{version}-%{release}
  97. %description proxy-postgresql
  98. Zabbix Proxy for PostgreSQL
  99. %endif
  100. %if %{with frontend}
  101. %package frontend-php
  102. Summary: Zabbix web frontend with PHP
  103. Group: Applications/Internet
  104. Requires: php5
  105. Requires: TrueType-vlgothic
  106. %description frontend-php
  107. Zabbix web frontend with PHP.
  108. %package frontend-php-mysql
  109. Summary: Zabbix web frontend with PHP and MySQL/MariaDB
  110. Group: Applications/Internet
  111. Provides: %{name}-frontend-php == %{version}-%{release}
  112. Requires: php5-mysql
  113. %description frontend-php-mysql
  114. Zabbix web frontend with PHP and MySQL/MariaDB.
  115. %package frontend-php-postgresql
  116. Summary: Zabbix web frontend with PHP and PostgreSQL
  117. Group: Applications/Internet
  118. Provides: %{name}-frontend-php == %{version}-%{release}
  119. Requires: php5-pgsql
  120. %description frontend-php-postgresql
  121. Zabbix web frontend with PHP and PostgreSQL.
  122. %endif
  123. %prep
  124. %setup -q -T -a 0 -c -n zabbix-%{version}
  125. mv zabbix-%{version} zabbix_mysql
  126. pushd zabbix_mysql
  127. %patch1 -p 1
  128. %patch2 -p 1
  129. popd
  130. %if %{with server}%{with proxy}
  131. %setup -q -D -T -a 0 -n zabbix-%{version}
  132. mv zabbix-%{version} zabbix_pgsql
  133. pushd zabbix_pgsql
  134. %patch1 -p 1
  135. %patch2 -p 1
  136. popd
  137. %endif
  138. %build
  139. Build()
  140. {
  141. perl -pi -e 's|/usr/bin/traceroute|/bin/traceroute|' \
  142. ./database/{ibm_db2,mysql,oracle,postgresql,sqlite3}/data.sql
  143. %configure \
  144. %{?with_server:--enable-server} \
  145. %{?with_proxy:--enable-proxy} \
  146. %{?with_agent:--enable-agent} \
  147. --enable-ipv6 \
  148. --sysconfdir=%{_sysconfdir}/zabbix \
  149. --with-libcurl \
  150. --with-openipmi \
  151. --with-net-snmp \
  152. --with-unixodbc \
  153. --with-ssh2 \
  154. $@
  155. %__make
  156. }
  157. %if %{with server}%{with proxy}
  158. pushd zabbix_mysql
  159. Build --with-mysql
  160. popd
  161. pushd zabbix_pgsql
  162. Build --with-postgresql
  163. popd
  164. %else
  165. pushd zabbix_mysql
  166. Build
  167. popd
  168. %endif
  169. %install
  170. %__rm -rf $RPM_BUILD_ROOT
  171. pushd zabbix_mysql
  172. make DESTDIR=$RPM_BUILD_ROOT install
  173. %if %{with server}
  174. mv -f %{buildroot}%{_sbindir}/zabbix_server %{buildroot}%{_sbindir}/zabbix_server.mysql
  175. %endif
  176. %if %{with proxy}
  177. mv -f %{buildroot}%{_sbindir}/zabbix_proxy %{buildroot}%{_sbindir}/zabbix_proxy.mysql
  178. %endif
  179. # make directories
  180. %__mkdir_p $RPM_BUILD_ROOT%{_localstatedir}/{log,run}/%{name}
  181. # DB
  182. %__mkdir_p $RPM_BUILD_ROOT%{_datadir}/zabbix
  183. %if %{with server}%{with proxy}
  184. %__cp -a database/postgresql $RPM_BUILD_ROOT%{_datadir}/zabbix/
  185. %__cp -a database/mysql $RPM_BUILD_ROOT%{_datadir}/zabbix/
  186. %endif
  187. # init.d
  188. %__mkdir_p $RPM_BUILD_ROOT%{_initddir}
  189. %if %{with server}
  190. %__cp %{SOURCE1} $RPM_BUILD_ROOT%{_initddir}/zabbix_server
  191. %endif
  192. %if %{with proxy}
  193. %__cp %{SOURCE2} $RPM_BUILD_ROOT%{_initddir}/zabbix_proxy
  194. %endif
  195. %if %{with agent}
  196. %__cp %{SOURCE3} $RPM_BUILD_ROOT%{_initddir}/zabbix_agentd
  197. %endif
  198. # logrotate
  199. %__mkdir_p $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d
  200. %if %{with server}
  201. %__cp %{SOURCE4} $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/zabbix_server
  202. %endif
  203. %if %{with proxy}
  204. %__cp %{SOURCE5} $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/zabbix_proxy
  205. %endif
  206. %if %{with agent}
  207. %__cp %{SOURCE6} $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/zabbix_agentd
  208. %endif
  209. %if %{with frontend}
  210. # frontend-php
  211. %__mkdir_p $RPM_BUILD_ROOT%{_datadir}/zabbix-frontend
  212. %__cp -a frontends/php $RPM_BUILD_ROOT%{_datadir}/zabbix-frontend/
  213. %__rm -f $RPM_BUILD_ROOT%{_datadir}/zabbix-frontend/php/fonts/DejaVuSans.ttf
  214. ln -s /usr/share/fonts/TrueType-vlgothic/VL-Gothic-Regular.ttf \
  215. $RPM_BUILD_ROOT%{_datadir}/zabbix-frontend/php/fonts/
  216. %endif
  217. %if %{with proxy}
  218. # proxy
  219. mkdir -p %{buildroot}%{_datadir}/zabbix-proxy
  220. ln -sf ../zabbix/mysql %{buildroot}%{_datadir}/zabbix-proxy/
  221. ln -sf ../zabbix/postgresql %{buildroot}%{_datadir}/zabbix-proxy/
  222. %endif
  223. popd
  224. %if %{with server}%{with proxy}
  225. pushd zabbix_pgsql
  226. install -m755 src/zabbix_server/zabbix_server %{buildroot}%{_sbindir}/zabbix_server.pgsql
  227. install -m755 src/zabbix_proxy/zabbix_proxy %{buildroot}%{_sbindir}/zabbix_proxy.pgsql
  228. popd
  229. %endif
  230. %clean
  231. %__rm -rf $RPM_BUILD_ROOT
  232. %pre
  233. getent group zabbix >/dev/null || groupadd -r zabbix
  234. getent passwd zabbix >/dev/null || \
  235. useradd -r -g zabbix -d %{_sysconfdir}/zabbix -s /sbin/nologin \
  236. -c "Zabbix Monitoring Solution" zabbix
  237. exit 0
  238. %if %{with server}
  239. %post server-mysql
  240. /sbin/update-alternatives --install /usr/sbin/zabbix_server \
  241. zabbix_server /usr/sbin/zabbix_server.mysql 10
  242. /sbin/chkconfig --add zabbix_server
  243. %post server-postgresql
  244. /sbin/update-alternatives --install /usr/sbin/zabbix_server \
  245. zabbix_server /usr/sbin/zabbix_server.pgsql 10
  246. /sbin/chkconfig --add zabbix_server
  247. %endif
  248. %if %{with proxy}
  249. %post proxy-mysql
  250. /sbin/update-alternatives --install /usr/sbin/zabbix_proxy \
  251. zabbix_proxy /usr/sbin/zabbix_proxy.mysql 10
  252. /sbin/chkconfig --add zabbix_proxy
  253. %post proxy-postgresql
  254. /sbin/update-alternatives --install /usr/sbin/zabbix_proxy \
  255. zabbix_proxy /usr/sbin/zabbix_proxy.pgsql 10
  256. /sbin/chkconfig --add zabbix_proxy
  257. %endif
  258. %if %{with agent}
  259. %post agent
  260. /sbin/chkconfig --add zabbix_agentd
  261. %endif
  262. %if %{with server}
  263. %preun server-mysql
  264. if [ "$1" -eq 0 ]; then
  265. /sbin/service zabbix_server stop >/dev/null 2>&1
  266. /sbin/chkconfig --del zabbix_server
  267. /sbin/update-alternatives --remove zabbix_server \
  268. /usr/sbin/zabbix_server.mysql
  269. fi
  270. %preun server-postgresql
  271. if [ "$1" -eq 0 ]; then
  272. /sbin/service zabbix_server stop >/dev/null 2>&1
  273. /sbin/chkconfig --del zabbix_server
  274. /sbin/update-alternatives --remove zabbix_server \
  275. /usr/sbin/zabbix_server.pgsql
  276. fi
  277. %endif
  278. %if %{with proxy}
  279. %preun proxy-mysql
  280. if [ "$1" -eq 0 ]; then
  281. /sbin/service zabbix_proxy stop >/dev/null 2>&1
  282. /sbin/chkconfig --del zabbix_proxy
  283. /sbin/update-alternatives --remove zabbix_proxy \
  284. /usr/sbin/zabbix_proxy.mysql
  285. fi
  286. %preun proxy-postgresql
  287. if [ "$1" -eq 0 ]; then
  288. /sbin/service zabbix_proxy stop >/dev/null 2>&1
  289. /sbin/chkconfig --del zabbix_proxy
  290. /sbin/update-alternatives --remove zabbix_proxy \
  291. /usr/sbin/zabbix_proxy.pgsql
  292. fi
  293. %endif
  294. %if %{with agent}
  295. %preun agent
  296. if [ "$1" -eq 0 ]; then
  297. /sbin/service zabbix_agentd stop >/dev/null 2>&1
  298. /sbin/chkconfig --del zabbix_agentd
  299. fi
  300. %endif
  301. %if %{with server}
  302. %postun server-mysql
  303. if [ "$1" -ge "1" ]; then
  304. /sbin/service zabbix_server condrestart >/dev/null 2>&1 || :
  305. fi
  306. %postun server-postgresql
  307. if [ "$1" -ge "1" ]; then
  308. /sbin/service zabbix_server condrestart >/dev/null 2>&1 || :
  309. fi
  310. %endif
  311. %if %{with proxy}
  312. %postun proxy-mysql
  313. if [ "$1" -ge "1" ]; then
  314. /sbin/service zabbix_proxy condrestart >/dev/null 2>&1 || :
  315. fi
  316. %postun proxy-postgresql
  317. if [ "$1" -ge "1" ]; then
  318. /sbin/service zabbix_proxy condrestart >/dev/null 2>&1 || :
  319. fi
  320. %postun agent
  321. if [ "$1" -ge "1" ]; then
  322. /sbin/service zabbix_agentd condrestart >/dev/null 2>&1 || :
  323. fi
  324. %endif
  325. %files
  326. %defattr(-,root,root,-)
  327. %license zabbix_mysql/COPYING
  328. %doc zabbix_mysql/AUTHORS zabbix_mysql/ChangeLog zabbix_mysql/NEWS zabbix_mysql/README
  329. %attr(0755,zabbix,zabbix) %dir %{_localstatedir}/log/%{name}
  330. %attr(0755,zabbix,zabbix) %dir %{_localstatedir}/run/%{name}
  331. %dir %{_datadir}/zabbix
  332. %if %{with server}%{with proxy}
  333. %{_datadir}/zabbix/mysql
  334. %{_datadir}/zabbix/postgresql
  335. %endif
  336. %if %{with server}
  337. %files server-common
  338. %defattr(-,root,root,-)
  339. %dir %{_sysconfdir}/zabbix
  340. %config(noreplace) %{_sysconfdir}/zabbix/zabbix_server.conf
  341. %config(noreplace) %{_sysconfdir}/logrotate.d/zabbix_server
  342. %{_initddir}/zabbix_server*
  343. %{_mandir}/man8/zabbix_server.8*
  344. %files server-mysql
  345. %defattr(-,root,root,-)
  346. %{_sbindir}/zabbix_server.mysql
  347. %files server-postgresql
  348. %defattr(-,root,root,-)
  349. %{_sbindir}/zabbix_server.pgsql
  350. %endif
  351. %if %{with agent}
  352. %files agent
  353. %defattr(-,root,root,-)
  354. %dir %{_sysconfdir}/zabbix
  355. %config(noreplace) %{_sysconfdir}/zabbix/zabbix_agentd.conf
  356. %config(noreplace) %{_sysconfdir}/logrotate.d/zabbix_agentd
  357. %{_bindir}/zabbix_get
  358. %{_bindir}/zabbix_sender
  359. %{_sbindir}/zabbix_agentd
  360. %{_initddir}/zabbix_agentd
  361. %{_mandir}/man1/zabbix_get.1*
  362. %{_mandir}/man1/zabbix_sender.1*
  363. %{_mandir}/man8/zabbix_agentd.8*
  364. %endif
  365. %if %{with proxy}
  366. %files proxy-common
  367. %defattr(-,root,root,-)
  368. %dir %{_sysconfdir}/zabbix
  369. %config(noreplace) %{_sysconfdir}/zabbix/zabbix_proxy.conf
  370. %config(noreplace) %{_sysconfdir}/logrotate.d/zabbix_proxy
  371. %{_initddir}/zabbix_proxy
  372. %{_mandir}/man8/zabbix_proxy.8*
  373. %{_datadir}/zabbix-proxy
  374. %files proxy-mysql
  375. %defattr(-,root,root,-)
  376. %{_sbindir}/zabbix_proxy.mysql
  377. %files proxy-postgresql
  378. %defattr(-,root,root,-)
  379. %{_sbindir}/zabbix_proxy.pgsql
  380. %endif
  381. %if %{with frontend}
  382. %files frontend-php
  383. %defattr(-,root,root,-)
  384. %license zabbix_mysql/COPYING
  385. %doc zabbix_mysql/AUTHORS zabbix_mysql/ChangeLog zabbix_mysql/NEWS zabbix_mysql/README
  386. %dir %{_datadir}/zabbix-frontend
  387. %{_datadir}/zabbix-frontend/php
  388. %files frontend-php-mysql
  389. %files frontend-php-postgresql
  390. %endif
  391. %changelog
  392. * Wed May 08 2019 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 4.0.7-1
  393. - new upstream release.
  394. - switched to 4.0 LTS.
  395. - dropped Patch0: made to get same effect by another method.
  396. - updated Patch1 and 2.
  397. * Wed Nov 07 2018 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 3.0.23-1
  398. - new upstream release.
  399. * Tue Jun 12 2018 IWAI, Masaharu <iwaim.sub@gmail.com> 3.0.13-2
  400. - accept building only agent
  401. * Thu Dec 21 2017 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 3.0.13-1
  402. - new upstream release.
  403. * Fri Apr 21 2017 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 3.0.8-1
  404. - new upstream release.
  405. * Fri Mar 18 2016 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 3.0.1-1
  406. - new upstream release.
  407. - disabled jabber support.
  408. * Wed Sep 9 2015 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 2.4.6-1
  409. - new upstream release.
  410. * Sat Apr 11 2015 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 2.2.9-1
  411. - new upstream release.
  412. * Sun Jul 6 2014 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 2.2.4-1
  413. - new upstream release.
  414. - built with both of mysql and postgresql.
  415. * Mon Oct 07 2013 Daisuke SUZUKI <daisuke@linux.or.jp> 2.0.8-1
  416. - update to 2.0.8
  417. * Wed Feb 20 2013 Daisuke SUZUKI <daisuke@linux.or.jp> 2.0.5-2
  418. - use %%bcond_with mysql to build with mysql
  419. * Tue Feb 19 2013 IWAI, Masaharu <iwai@alib.jp> 2.0.5-1
  420. - update to 2.0.5
  421. - add using MySQL client library switch: default no
  422. - define use_postfix and use_mysql
  423. - add BuildRequires: MySQL-devel
  424. - add configure option: --with-mysql
  425. * Thu Feb 7 2013 IWAI, Masaharu <iwai@alib.jp> 2.0.4-1
  426. - initial build for Vine Linux