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