]> git.pld-linux.org Git - packages/cacti-template-snmp_tcp_connection_status.git/blob - cacti-template-snmp_tcp_connection_status.spec
execute bits
[packages/cacti-template-snmp_tcp_connection_status.git] / cacti-template-snmp_tcp_connection_status.spec
1 # TODO
2 # - release modifications upstream/forum
3 %define         template        snmp_tcp_connection_status
4 Summary:        TCP Connection Status template for Cacti
5 Name:           cacti-template-%{template}
6 Version:        0.2
7 Release:        2
8 License:        GPL v2
9 Group:          Applications/WWW
10 # Source0Download: http://forums.cacti.net/download.php?id=5198
11 Source0:        tcp-connections.zip
12 # Source0-md5:  72fd9adfafcecec0b6f5a23ec6db8e57
13 Source1:        %{name}.sh
14 Source2:        tcpstat
15 URL:            http://forums.cacti.net/viewtopic.php?t=12766
16 BuildRequires:  rpmbuild(macros) >= 1.554
17 BuildRequires:  sed >= 4.0
18 BuildRequires:  unzip
19 Requires:       cacti >= 0.8.7e-9
20 Requires:       net-snmp-utils
21 Obsoletes:      cacti-plugin-snmp_tcp_connection_status
22 BuildArch:      noarch
23 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
24
25 %define         cactidir                /usr/share/cacti
26 %define         resourcedir             %{cactidir}/resource
27 %define         scriptsdir              %{cactidir}/scripts
28 %define         snmpdconfdir    /etc/snmp
29 %define         _libdir                 %{_prefix}/lib
30 # This is officially registered: http://www.oid-info.com/get/1.3.6.1.4.1.16606
31 %define         snmpoid                 .1.3.6.1.4.1.16606.1
32
33 %description
34 Template for Cacti - Monitor TCP Connection Status.
35
36 This is improved version which uses SNMPd server side calculation
37 instead of fetching all data over slow SNMP protocol.
38
39 You need net-snmp-agent-tcpstat installed on SNMP server side.
40
41 %package -n net-snmp-agent-tcpstat
42 Summary:        SNMPd agent to provide TCP Connection statistics
43 Group:          Networking/Daemons
44 Requires:       awk
45 Requires:       iproute2
46 Requires:       net-snmp
47
48 %description -n net-snmp-agent-tcpstat
49 SNMPd agent to provide TCP Connection statistics.
50
51 %prep
52 %setup -qc
53 %{__sed} -i -e 's,/bin/bash /var/www/htdocs/cacti/scripts/get_tcp_connections,%{scriptsdir}/%{template},' *.xml
54
55 %install
56 rm -rf $RPM_BUILD_ROOT
57 install -d $RPM_BUILD_ROOT{%{resourcedir},%{scriptsdir},%{snmpdconfdir},%{_libdir}}
58 cp -a *.xml $RPM_BUILD_ROOT%{resourcedir}
59 install -p %{SOURCE1} $RPM_BUILD_ROOT%{scriptsdir}/%{template}
60 install -p %{SOURCE2} $RPM_BUILD_ROOT%{_libdir}/snmpd-agent-tcpstat
61
62 %post
63 %cacti_import_template %{resourcedir}/cacti_graph_template_tcp_connections.xml
64
65 %post -n net-snmp-agent-tcpstat
66 if ! grep -qF %{snmpoid} %{snmpdconfdir}/snmpd.local.conf; then
67         echo "extend %{snmpoid} tcpstat %{_libdir}/snmpd-agent-tcpstat" >> %{snmpdconfdir}/snmpd.local.conf
68         %service -q snmpd reload
69 fi
70
71 %preun -n net-snmp-agent-tcpstat
72 if [ "$1" = 0 ]; then
73         if [ -f %{snmpdconfdir}/snmpd.local.conf ]; then
74                 %{__sed} -i -e "/extend %(echo %{snmpoid} | sed -e 's,\.,\\.,g')/d" %{snmpdconfdir}/snmpd.local.conf
75                 %service -q snmpd reload
76         fi
77 fi
78
79 %clean
80 rm -rf $RPM_BUILD_ROOT
81
82 %files
83 %defattr(644,root,root,755)
84 %attr(755,root,root) %{scriptsdir}/%{template}
85 %{resourcedir}/cacti_graph_template_tcp_connections.xml
86
87 %files -n net-snmp-agent-tcpstat
88 %defattr(644,root,root,755)
89 %attr(755,root,root) %{_libdir}/snmpd-agent-tcpstat
This page took 0.087882 seconds and 3 git commands to generate.