summaryrefslogtreecommitdiff
path: root/netmrg.spec
blob: c9fef53e06b56c63274450d4bc3eb830a8745b2e (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
# TODO
# - use webapps
# warning: Installed (but unpackaged) file(s) found:
#   /etc/netmrg.conf
Summary:	Network Monitoring package using PHP, MySQL, and RRDtool
Summary(pl):	Monitor sieci używający PHP, MySQL i RRDtool
Name:		netmrg
Version:	0.19
Release:	1
License:	MIT
Group:		Applications/Networking
Source0:	http://www.netmrg.net/download/devel/%{name}-%{version}.tar.gz
# Source0-md5:	a380390425f8f97cadaee3809042ca51
Source1:	%{name}-httpd.conf
Source2:	%{name}-cron
Patch0:		%{name}-config.patch
URL:		http://www.netmrg.net/
BuildRequires:	automake
BuildRequires:	libxml2-devel
BuildRequires:	mysql-devel
BuildRequires:	net-snmp-devel
BuildRequires:	rpmbuild(macros) >= 1.268
BuildRequires:	rrdtool-devel >= 1.2.10
Requires:	libxml2
Requires:	php(mysql)
Requires:	rrdtool >= 1.2.10
Requires:	webserver
BuildRoot:	%{tmpdir}/%{name}-%{version}-root-%(id -u -n)

%define		_pkglibdir		/var/lib/%{name}
%define		_wwwuser		http
%define		_wwwgroup		http
%define		_wwwrootdir		%{_datadir}/%{name}/webfiles

%description
NetMRG is a tool for network monitoring, reporting, and graphing.
Based on RRDTOOL, the best of open source graphing systems, NetMRG is
capable of creating graphs of any parameter of your network.

%description -l pl
NetMRG służy do monitorowania sieci, raportowania i kreślenia
wykresów. Jest on oparty na RRDTOOL, najlepszym spośród systemów
graficznych o dostępnym kodzie źródłowym. NetMRG potrafi tworzyć
wykresy przedstawiające dowolne parametry sieci.

%prep
%setup -q
%patch0 -p1

%build
install /usr/share/automake/config.* .
%{__gettextize}
%{__libtoolize}
%{__aclocal}
%{__autoconf}
%{__autoheader}
%{__automake}
%configure \
	--with-snmp-lib-dir=%{_libdir}
%{__make}

%install
rm -rf $RPM_BUILD_ROOT
install -d $RPM_BUILD_ROOT%{_wwwrootdir}

%{__make} install \
	DESTDIR=$RPM_BUILD_ROOT

install -D %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/httpd/%{name}.conf
install -D %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/cron.d/%{name}
mv -f $RPM_BUILD_ROOT/var/www/%{name} $RPM_BUILD_ROOT%{_wwwrootdir}/%{name}
touch $RPM_BUILD_ROOT/var/log/%{name}/lastrun.err
touch $RPM_BUILD_ROOT/var/log/%{name}/lastrun.log
touch $RPM_BUILD_ROOT/var/log/%{name}/runtime

%clean
rm -rf $RPM_BUILD_ROOT

%post
if [ -f /etc/httpd/httpd.conf ] && ! grep -q "^Include.*%{name}.conf" /etc/httpd/httpd.conf; then
	echo "Include /etc/httpd/%{name}.conf" >> /etc/httpd/httpd.conf
elif [ -d /etc/httpd/httpd.conf ]; then
	mv -f /etc/httpd/%{name}.conf /etc/httpd/httpd.conf/99_%{name}.conf
fi
%service httpd reload
%service crond restart
if [ -f /var/lock/subsys/crond ]; then
	/etc/rc.d/init.d/crond restart 1>&2
fi
echo "Before first run read %{_docdir}/%{name}-%{version}/INSTALL how to put
%{_datadir}/netmrg/db/netmrg.mysql in your mysql server"


%preun
if [ "$1" = "0" ]; then
	umask 027
	if [ -d /etc/httpd/httpd.conf ]; then
		rm -f /etc/httpd/httpd.conf/99_%{name}.conf
	else
		grep -v "^Include.*%{name}.conf" /etc/httpd/httpd.conf > \
			etc/httpd/httpd.conf.tmp
		mv -f /etc/httpd/httpd.conf.tmp /etc/httpd/httpd.conf
		%service httpd reload
	fi
fi

%files
%defattr(644,root,root,755)
%doc %{_docdir}/%{name}-%{version}
%attr(640,root,root) /etc/cron.d/netmrg
%config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/netmrg.xml
%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/httpd/%{name}.conf
%attr(755,root,root) %{_bindir}/netmrg-gatherer
%attr(755,root,root) %{_bindir}/rrdedit
%{_datadir}/%{name}
%dir %{_pkglibdir}
%attr(700,http,http) %dir %{_pkglibdir}/rrd
%attr(700,http,http) %{_pkglibdir}/rrd/*
%attr(770,http,http) %dir /var/log/netmrg
%attr(660,http,http) /var/log/netmrg/*
%dir %{_libdir}/%{name}
%attr(755,root,root) %{_libdir}/%{name}/*
%{_mandir}/*/*