]> git.pld-linux.org Git - packages/cacti-template-haproxy.git/blob - cacti-template-haproxy.spec
- drop obsolete and outdated manual inclusion of rpm macros
[packages/cacti-template-haproxy.git] / cacti-template-haproxy.spec
1 %define         plugin haproxy
2 Summary:        Template for Cacti - HAProxy
3 Name:           cacti-template-%{plugin}
4 # version from haproxy.pl
5 Version:        0.30
6 Release:        1
7 License:        GPL v2
8 Group:          Applications/WWW
9 # the templates were last modified Oct 25, 2010, there's no point using newer version tarball
10 Source0:        http://www.haproxy.org/download/1.6/src/haproxy-1.6.3.tar.gz
11 # Source0-md5:  3362d1e268c78155c2474cb73e7f03f9
12 Patch0:         bang.patch
13 URL:            https://github.com/haproxy/haproxy/tree/master/contrib/netsnmp-perl
14 BuildRequires:  rpm-perlprov >= 4.1-13
15 BuildRequires:  rpmbuild(macros) >= 1.554
16 Requires:       cacti >= 0.8.7e-8
17 BuildArch:      noarch
18 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
19
20 %define         snmpdconfdir    /etc/snmp
21 %define         cactidir                /usr/share/cacti
22 %define         resourcedir             %{cactidir}/resource
23 %define         scriptsdir              %{cactidir}/scripts
24 %define         _libdir                 %{_prefix}/lib
25
26 %description
27 Cacti snmp-query definition for backends.
28
29 %package -n net-snmp-agent-%{plugin}
30 Summary:        SNMPd agent to provide HAProxy statistics
31 Group:          Networking/Daemons
32 Requires:       haproxy
33 Requires:       net-snmp
34
35 %description -n net-snmp-agent-%{plugin}
36 SNMPd agent to provide HAProxy statistics
37
38 %prep
39 %setup -qc
40 mv haproxy-*/contrib/netsnmp-perl/* .
41 %patch0 -p1
42
43 %install
44 rm -rf $RPM_BUILD_ROOT
45 install -d $RPM_BUILD_ROOT{%{resourcedir},%{scriptsdir},%{snmpdconfdir},%{_libdir}}
46 cp -p *.xml $RPM_BUILD_ROOT%{resourcedir}
47 install -p haproxy.pl $RPM_BUILD_ROOT%{_libdir}/snmpd-agent-haproxy
48
49 %clean
50 rm -rf $RPM_BUILD_ROOT
51
52 %post
53 %cacti_import_template %{resourcedir}/cacti_data_query_haproxy_backends.xml
54 %cacti_import_template %{resourcedir}/cacti_data_query_haproxy_frontends.xml
55 %cacti_import_template %{resourcedir}/haproxy_backend.xml
56 %cacti_import_template %{resourcedir}/haproxy_frontend.xml
57 %cacti_import_template %{resourcedir}/haproxy_socket.xml
58
59 %post -n net-snmp-agent-%{plugin}
60 if ! grep -q "^disablePerl" %{snmpdconfdir}/snmpd.conf %{snmpdconfdir}/snmpd.local.conf 2>/dev/null; then
61         echo "disablePerl false" >> %{snmpdconfdir}/snmpd.conf
62         reload=1
63 fi
64 if ! grep -qF '%{_libdir}/snmpd-agent-haproxy' %{snmpdconfdir}/snmpd.local.conf; then
65         echo "perl do '%{_libdir}/snmpd-agent-haproxy';" >> %{snmpdconfdir}/snmpd.local.conf
66         reload=1
67 fi
68 if [ "$reload" = 1 ]; then
69         %service -q snmpd reload
70 fi
71
72 %preun -n net-snmp-agent-%{plugin}
73 if [ "$1" = 0 ]; then
74         if [ -f %{snmpdconfdir}/snmpd.local.conf ]; then
75                 %{__sed} -i -e "/^perl.*%(echo %{_libdir}/snmpd-agent-haproxy | sed -e 's,/,\\/,g')/d" %{snmpdconfdir}/snmpd.local.conf
76                 %service -q snmpd reload
77         fi
78 fi
79
80 %files
81 %defattr(644,root,root,755)
82 %doc README
83 %{resourcedir}/cacti_data_query_haproxy_backends.xml
84 %{resourcedir}/cacti_data_query_haproxy_frontends.xml
85 %{resourcedir}/haproxy_backend.xml
86 %{resourcedir}/haproxy_frontend.xml
87 %{resourcedir}/haproxy_socket.xml
88
89 %files -n net-snmp-agent-%{plugin}
90 %defattr(644,root,root,755)
91 %attr(755,root,root) %{_libdir}/snmpd-agent-haproxy
This page took 0.10051 seconds and 3 git commands to generate.