1 |
Summary: NagiosGrapher collects the output of NagiosPlugins and generates graphs. |
2 |
%define name smeserver-nagiosgrapher |
3 |
%define NagiosGrapher NagiosGrapher-1.6.1-rc5-0.3 |
4 |
Name: %{name} |
5 |
%define version 1.0.1 |
6 |
%define release 0 |
7 |
Version: %{version} |
8 |
Release: %{release}%{?dist} |
9 |
License: GPL |
10 |
Group: Applications/System |
11 |
URL: http://www.nagiosexchange.org/NagiosGrapher.84.0.html |
12 |
Source: %{name}-%{version}.tar.gz |
13 |
Source1: %{NagiosGrapher}.tar.gz |
14 |
BuildRoot: /var/tmp/%{name}-buildroot/ |
15 |
BuildArch: noarch |
16 |
Requires: nagios |
17 |
Requires: smeserver-release >= 7.1.2 |
18 |
Requires: perl-Calendar-Simple |
19 |
Requires: ImageMagick-perl |
20 |
Requires: perl-GD |
21 |
Requires: perl-rrdtool |
22 |
AutoReq: no |
23 |
|
24 |
%changelog |
25 |
* Mon Dec 03 2007 Michael Weinberger <mweinber@neddix.de> |
26 |
Version 1.0.1 |
27 |
fixed icon_image_tag definition ngraph.ncfg |
28 |
* Tue Nov 20 2007 Michael Weinberger <mweinber@neddix.de> |
29 |
- Initial release |
30 |
|
31 |
%description |
32 |
NagiosGrapher collects the output of NagiosPlugins and generates graphs. |
33 |
|
34 |
%prep |
35 |
%setup -q -n %{name}-%{version} |
36 |
|
37 |
%build |
38 |
tar xzf %{SOURCE1} |
39 |
cd %{NagiosGrapher} |
40 |
autoconf |
41 |
cat >> config.layout <<EOF |
42 |
<Layout sme_server> |
43 |
prefix: /usr/lib/nagios |
44 |
datadir: /usr/share |
45 |
libdir: /usr/lib |
46 |
nagios_config: /etc/nagios/nagios |
47 |
nagios_config_cgi: /etc/nagios/cgi.cfg |
48 |
nagios_images: \${datadir}/nagios/images |
49 |
nagios_images_logos: \${datadir}/nagios/images/logos |
50 |
nagios_folder_cgi: \${libdir}/nagios/cgi |
51 |
perl_inc: /usr/lib/perl5/site_perl/ |
52 |
ng_config: /etc/nagios |
53 |
ng_config_sub: \${ng_config}/ngraph.d |
54 |
ng_daemon: /var/lib/nagios/nagios_grapher |
55 |
ng_srvext_file: /etc/nagios/serviceextinfo.cfg |
56 |
ng_srvext_dir: /etc/nagios/serviceext |
57 |
ng_interface_pipe: /var/log/nagios/rw/ |
58 |
ng_logfile: /var/log/nagios/ngraph.log |
59 |
ng_rrd: /var/lib/nagios/rrd |
60 |
ng_rrd_font: /usr/share/rrdtool/fonts/DejaVuSansMono-Roman.ttf |
61 |
ng_cgi: /nagios/cgi-bin |
62 |
ng_logos: /nagios/images/logos |
63 |
ng_pid_file: \${ng_daemon}/nagios_grapher.pid |
64 |
init_script_dir: /etc/init.d |
65 |
logrotate_conf_dir: /etc/logrotate.d |
66 |
</Layout> |
67 |
EOF |
68 |
|
69 |
./configure --with-layout=sme_server |
70 |
#%{__make} testdeps |
71 |
|
72 |
%install |
73 |
%{__rm} -rf $RPM_BUILD_ROOT |
74 |
%{__mkdir} -p $RPM_BUILD_ROOT |
75 |
(cd root ; find . -depth -print | cpio -dump $RPM_BUILD_ROOT) |
76 |
|
77 |
cp %{NagiosGrapher}/sbin/rrd2-graph.cgi $RPM_BUILD_ROOT/usr/lib/nagios/cgi |
78 |
cp %{NagiosGrapher}/sbin/rrd2-system.cgi $RPM_BUILD_ROOT/usr/lib/nagios/cgi |
79 |
sed -e 's#NETWAYS GmbH"),#NETWAYS GmbH")," (SME Server ",$q->a({-href=>"http://wiki.contribs.org/NagiosGrapher/", -target=>"_blank"}, "contrib")," by Michael Weinberger)",#' < %{NagiosGrapher}/sbin/graphs.cgi > $RPM_BUILD_ROOT/usr/lib/nagios/cgi/graphs.cgi |
80 |
cp %{NagiosGrapher}/bin/fifo_write.pl %{NagiosGrapher}/bin/collect2.pl $RPM_BUILD_ROOT/usr/share/nagios/ |
81 |
cp %{NagiosGrapher}/doc/* ${RPM_BUILD_ROOT}/usr/share/nagios/nagiosgrapher/doc/ |
82 |
cp %{NagiosGrapher}/graph.png $RPM_BUILD_ROOT/usr/share/nagios/images/logos/ |
83 |
cp %{NagiosGrapher}/dot.png $RPM_BUILD_ROOT/usr/share/nagios/images/logos/ |
84 |
cp %{NagiosGrapher}/lib/NagiosGrapher/HTML.pm $RPM_BUILD_ROOT/usr/lib/perl5/site_perl/NagiosGrapher/ |
85 |
cp %{NagiosGrapher}/lib/NagiosGrapher/Hooks/*.pm $RPM_BUILD_ROOT/usr/lib/perl5/site_perl/NagiosGrapher/Hooks/ |
86 |
cp %{NagiosGrapher}/lib/NagiosGrapher.pm $RPM_BUILD_ROOT/usr/lib/perl5/site_perl/ |
87 |
ln -fs /usr/lib/perl5/site_perl/NagiosGrapher.pm $RPM_BUILD_ROOT/usr/lib/nagios/cgi |
88 |
cp -r %{NagiosGrapher}/cfg/templates/* $RPM_BUILD_ROOT/etc/nagios/ngraph.d/samples |
89 |
|
90 |
|
91 |
|
92 |
rm -f %{name}-%{version}-filelist |
93 |
find $RPM_BUILD_ROOT -depth -type f -print |\ |
94 |
sed -e "s@^$RPM_BUILD_ROOT@@g" \ |
95 |
-e "s@^/etc/rc.d/@%attr(0755,root,root) &@"\ |
96 |
-e "s@^/usr/lib/perl5/site_perl/@%attr(0755,root,root) &@"\ |
97 |
-e "s@^/etc/nagios/ngraph.ncfg@%attr(0644,nagios,root) %config(noreplace)&@"\ |
98 |
-e "s@^/etc/nagios/nmgraph.ncfg@%attr(0644,nagios,root) %config(noreplace)&@"\ |
99 |
-e "s@^/etc/nagios/ngraph.d/@%attr(0755,nagios,root) &@"\ |
100 |
-e "s@^/usr/share/nagios/images/@%attr(0644,nagios,www) &@"\ |
101 |
-e "s@^/usr/share/nagios/@%attr(0755,root,root) &@"\ |
102 |
-e "s@^/usr/lib/nagios/cgi/@%attr(0755,nagios,root) &@"\ |
103 |
-e "s@^/etc/logrotate.d/nagiosgrapher@%attr(0644,root,root) &@"\ |
104 |
>> %{name}-%{version}-filelist |
105 |
|
106 |
find $RPM_BUILD_ROOT -depth -type l -print |\ |
107 |
sed "s@^$RPM_BUILD_ROOT@@g" >> %{name}-%{version}-filelist |
108 |
|
109 |
echo "%dir %attr(0755,nagios,root) /etc/nagios/serviceext/" >> %{name}-%{version}-filelist |
110 |
echo "%dir %attr(0755,nagios,root) /var/lib/nagios/nagios_grapher/" >> %{name}-%{version}-filelist |
111 |
echo "%dir %attr(0755,nagios,root) /var/lib/nagios/rrd/" >> %{name}-%{version}-filelist |
112 |
|
113 |
%clean |
114 |
rm -rf $RPM_BUILD_ROOT |
115 |
|
116 |
%pre |
117 |
NAGIOSUSER=`id -u nagios ` |
118 |
if [ -z "$NAGIOSUSER" ] ; then |
119 |
echo "Error: User 'nagios' does not exist." |
120 |
exit -1 |
121 |
fi |
122 |
|
123 |
%post |
124 |
if [ "x`/bin/cat /proc/1/cmdline`" = "xinit [7]" ] ; then |
125 |
/sbin/e-smith/service nagiosgrapher restart |
126 |
fi |
127 |
|
128 |
%preun |
129 |
if [ "x`/bin/cat /proc/1/cmdline`" = "xinit [7]" ] ; then |
130 |
if [ $1 = 0 ] ; then # uninstall |
131 |
/sbin/e-smith/service nagiosgrapher stop |
132 |
fi |
133 |
fi |
134 |
|
135 |
%files -f %{name}-%{version}-filelist |
136 |
%defattr(-,root,root) |