1 Summary: N2RRD/RRD2GRAPH Performance data collector and Graph generator
7 Source0: http://n2rrd.diglinks.com/download/n2rrd-%{version}.tar.gz
8 # Source0-md5: 6cf8b756272b3243fb9d8feae3ff7d72
9 URL: http://n2rrd.diglinks.com/
10 BuildRequires: rpm-perlprov >= 4.1-13
11 BuildRequires: sed >= 4.0
12 Requires: nagios-common
13 Requires: perl-RRD-Simple
14 Requires: perl-rrdtool
17 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
19 %define _sysconfdir /etc/nagios/n2rrd
20 %define nagiosconfdir /etc/nagios
21 %define nagiosdatadir /usr/share/nagios
23 %define nagioslibdir /usr/lib/nagios
24 %define nagioscgidir %{nagioslibdir}/cgi
25 %define nagios_status_file /var/lib/nagios/status.dat
28 Nagios to RRD = n2rrd, is a small perl script, which analyzes
29 perf-data string for one or more name=value pairs and creates/updates
30 RRA (Round Robin Archives).
32 The archive can later be viewed by any RRD database graph frontend
33 e.g. rrd2graph, Cacti, Drraw, etc.
36 %setup -q -n n2rrd-%{version}
38 find -name 'dist-*' -exec rename 'dist-' '' {} ';'
41 s|@BIN_PERL@|%{__perl} -w|
42 s|@VERSION@|%{version}|
43 s|@CONF_DIR@|%{_sysconfdir}|
44 s|@RRA_DIR@|/var/lib/nagios/rra|
45 s|@TEMPLATES_DIR@|%{_sysconfdir}/templates|
46 s|@SERVICE_NAME_MAPS@|templates/maps/service_name_maps|
47 s|@LOGFILE@|/var/log/nagios/n2rrd.log|
48 s|@DOCUMENT_ROOT@|/var/cache/n2rrd|
51 s|@RRDTOOL@|%{_bindir}/rrdtool|
52 s|@CGIBIN@|/nagios/cgi-bin|
53 s|@NAGIOS_STATUS_FILE@|%{nagios_status_file}|
54 ' n2rrd.pl rrd2graph.cgi n2rrd.conf
56 %{__sed} -i -e 's,@CGIBIN@,%{nagioscgidir},' js/zoom.js
58 cat > README.PLD <<'EOF'
59 Edit %{nagiosconfdir}/nagios.cfg to reflect the following variables
61 process_performance_data=1
62 host_perfdata_command=n2rrd-process-host-perfdata
63 service_perfdata_command=n2rrd-process-service-perfdata
65 Read more about how to integrate from:
66 <http://n2rrd.diglinks.com/cgi-bin/trac.fcgi/wiki/InstallationGuide140>
69 cat > n2rrd.cfg <<'EOF'
71 command_name n2rrd-process-host-perfdata
72 command_line %{nagioslibdir}/n2rrd -c %{_sysconfdir}/n2rrd.conf -D "HOST" -N "%{nagios_status_file}" -C '$HOSTCHECKCOMMAND$' -T $LASTHOSTCHECK$ -H $HOSTNAME$ -s "check_fping" -o "$HOSTPERFDATA$"
76 command_name n2rrd-process-service-perfdata
77 command_line %{nagioslibdir}/n2rrd -c %{_sysconfdir}/n2rrd.conf -N "%{nagios_status_file}" -C '$SERVICECHECKCOMMAND$' -e $SERVICEEXECUTIONTIME$ -l $SERVICELATENCY$ -T $LASTSERVICECHECK$ -H $HOSTNAME$ -s "$SERVICEDESC$" -o "$SERVICEPERFDATA$"
82 rm -rf $RPM_BUILD_ROOT
83 install -d $RPM_BUILD_ROOT{%{_sysconfdir},/var/lib/nagios/rra}
84 install -d $RPM_BUILD_ROOT{%{nagioslibdir},%{nagiosconfdir}/plugins,%{nagioscgidir},%{nagiosdatadir}/js}
85 install n2rrd.pl $RPM_BUILD_ROOT%{nagioslibdir}/n2rrd
86 cp -a n2rrd.conf $RPM_BUILD_ROOT%{_sysconfdir}
87 cp -a n2rrd.cfg $RPM_BUILD_ROOT%{nagiosconfdir}/plugins
90 install -d $RPM_BUILD_ROOT{/var/cache/n2rrd,%{_examplesdir}/%{name}-%{version}}
91 install rrd2graph.cgi $RPM_BUILD_ROOT%{nagioscgidir}
92 cp -a js/zoom.js $RPM_BUILD_ROOT%{nagiosdatadir}/js
93 # as default templates are too intrusive, we provide them as examples and
94 # package only essential.
95 install -d $RPM_BUILD_ROOT%{_sysconfdir}/templates/{maps,graph,rewrite,rra,code}
96 cp -a templates/environment.t $RPM_BUILD_ROOT%{_sysconfdir}/templates
97 cp -a templates/maps $RPM_BUILD_ROOT%{_sysconfdir}/templates
98 cp -a templates $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version}
101 rm -rf $RPM_BUILD_ROOT
104 %defattr(644,root,root,755)
105 %doc CHANGELOG UPGRADE README.PLD
107 %dir %{_sysconfdir}/templates
108 %dir %{_sysconfdir}/templates/code
109 %dir %{_sysconfdir}/templates/graph
110 %dir %{_sysconfdir}/templates/maps
111 %dir %{_sysconfdir}/templates/rewrite
112 %dir %{_sysconfdir}/templates/rra
113 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/n2rrd.conf
114 %config(noreplace) %verify(not md5 mtime size) %{nagiosconfdir}/plugins/n2rrd.cfg
115 %attr(755,root,root) %{nagioslibdir}/n2rrd
117 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/templates/environment.t
118 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/templates/maps/rgb.txt
119 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/templates/maps/rra_plugin_maps
120 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/templates/maps/service_name_maps
123 %attr(769,root,http) /var/cache/n2rrd
124 %attr(755,root,root) %{nagioscgidir}/rrd2graph.cgi
125 %dir %{nagiosdatadir}/js
126 %{nagiosdatadir}/js/zoom.js
127 %{_examplesdir}/%{name}-%{version}