]> git.pld-linux.org Git - packages/cacti-template-snmp_tcp_connection_status.git/blob - cacti-template-snmp_tcp_connection_status.spec
snmp agent: require ss tool directy so iproute2 would not be shadowed by vserver...
[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:        3
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 # iproute2
46 Requires:       /sbin/ss
47 Requires:       net-snmp
48
49 %description -n net-snmp-agent-tcpstat
50 SNMPd agent to provide TCP Connection statistics.
51
52 %prep
53 %setup -qc
54 %{__sed} -i -e 's,/bin/bash /var/www/htdocs/cacti/scripts/get_tcp_connections,%{scriptsdir}/%{template},' *.xml
55
56 %install
57 rm -rf $RPM_BUILD_ROOT
58 install -d $RPM_BUILD_ROOT{%{resourcedir},%{scriptsdir},%{snmpdconfdir},%{_libdir}}
59 cp -a *.xml $RPM_BUILD_ROOT%{resourcedir}
60 install -p %{SOURCE1} $RPM_BUILD_ROOT%{scriptsdir}/%{template}
61 install -p %{SOURCE2} $RPM_BUILD_ROOT%{_libdir}/snmpd-agent-tcpstat
62
63 %post
64 %cacti_import_template %{resourcedir}/cacti_graph_template_tcp_connections.xml
65
66 %post -n net-snmp-agent-tcpstat
67 if ! grep -qF %{snmpoid} %{snmpdconfdir}/snmpd.local.conf; then
68         echo "extend %{snmpoid} tcpstat %{_libdir}/snmpd-agent-tcpstat" >> %{snmpdconfdir}/snmpd.local.conf
69         %service -q snmpd reload
70 fi
71
72 %preun -n net-snmp-agent-tcpstat
73 if [ "$1" = 0 ]; then
74         if [ -f %{snmpdconfdir}/snmpd.local.conf ]; then
75                 %{__sed} -i -e "/extend %(echo %{snmpoid} | sed -e 's,\.,\\.,g')/d" %{snmpdconfdir}/snmpd.local.conf
76                 %service -q snmpd reload
77         fi
78 fi
79
80 %clean
81 rm -rf $RPM_BUILD_ROOT
82
83 %files
84 %defattr(644,root,root,755)
85 %attr(755,root,root) %{scriptsdir}/%{template}
86 %{resourcedir}/cacti_graph_template_tcp_connections.xml
87
88 %files -n net-snmp-agent-tcpstat
89 %defattr(644,root,root,755)
90 %attr(755,root,root) %{_libdir}/snmpd-agent-tcpstat
This page took 0.083432 seconds and 3 git commands to generate.