]> git.pld-linux.org Git - SPECS.git/blob - nagios-n2rrd.spec
SPECS updated Wed 28 Jul 14:48:01 CEST 2021
[SPECS.git] / nagios-n2rrd.spec
1 Summary:        N2RRD/RRD2GRAPH Performance data collector and Graph generator
2 Name:           nagios-n2rrd
3 Version:        1.4.2
4 Release:        0.1
5 License:        GPL v2
6 Group:          Applications
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
15 Requires:       rrdtool
16 BuildArch:      noarch
17 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
18
19 %define         _sysconfdir             /etc/nagios/n2rrd
20 %define         nagiosconfdir   /etc/nagios
21 %define         nagiosdatadir   /usr/share/nagios
22 # argh XXX lib64?
23 %define         nagioslibdir    /usr/lib/nagios
24 %define         nagioscgidir    %{nagioslibdir}/cgi
25 %define         nagios_status_file      /var/lib/nagios/status.dat
26
27 %description
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).
31
32 The archive can later be viewed by any RRD database graph frontend
33 e.g. rrd2graph, Cacti, Drraw, etc.
34
35 %prep
36 %setup -q -n n2rrd-%{version}
37
38 find -name 'dist-*' -exec rename 'dist-' '' {} ';'
39
40 %{__sed} -i -e '
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|
49         s|@CACHE_DIR@|tmp|
50         s|@TMPDIR@|/tmp|
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
55
56 %{__sed} -i -e 's,@CGIBIN@,%{nagioscgidir},' js/zoom.js
57
58 cat > README.PLD <<'EOF'
59 Edit %{nagiosconfdir}/nagios.cfg to reflect the following variables
60
61 process_performance_data=1
62 host_perfdata_command=n2rrd-process-host-perfdata
63 service_perfdata_command=n2rrd-process-service-perfdata
64
65 Read more about how to integrate from:
66 <http://n2rrd.diglinks.com/cgi-bin/trac.fcgi/wiki/InstallationGuide140>
67 EOF
68
69 cat > n2rrd.cfg <<'EOF'
70 define command {
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$"
73 }
74
75 define command {
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$"
78 }
79 EOF
80
81 %install
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
88
89 # rrd2graph
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}
99
100 %clean
101 rm -rf $RPM_BUILD_ROOT
102
103 %files
104 %defattr(644,root,root,755)
105 %doc CHANGELOG UPGRADE README.PLD
106 %dir %{_sysconfdir}
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
116
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
121
122 # rrd2graph
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}
This page took 0.842461 seconds and 3 git commands to generate.