]>
Commit | Line | Data |
---|---|---|
663f87bc ER |
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} | |
b27658a9 | 6 | Version: 0.2 |
42bd8d07 | 7 | Release: 2 |
04a0f80e ER |
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 | |
b27658a9 | 14 | Source2: tcpstat |
04a0f80e | 15 | URL: http://forums.cacti.net/viewtopic.php?t=12766 |
42bd8d07 | 16 | BuildRequires: rpmbuild(macros) >= 1.554 |
04a0f80e | 17 | BuildRequires: sed >= 4.0 |
b7a220b5 | 18 | BuildRequires: unzip |
42bd8d07 | 19 | Requires: cacti >= 0.8.7e-9 |
04a0f80e | 20 | Requires: net-snmp-utils |
663f87bc | 21 | Obsoletes: cacti-plugin-snmp_tcp_connection_status |
04a0f80e ER |
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 | |
b27658a9 ER |
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 | |
04a0f80e ER |
32 | |
33 | %description | |
663f87bc | 34 | Template for Cacti - Monitor TCP Connection Status. |
04a0f80e | 35 | |
b27658a9 ER |
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 | ||
04a0f80e | 51 | %prep |
42bd8d07 | 52 | %setup -qc |
663f87bc | 53 | %{__sed} -i -e 's,/bin/bash /var/www/htdocs/cacti/scripts/get_tcp_connections,%{scriptsdir}/%{template},' *.xml |
04a0f80e ER |
54 | |
55 | %install | |
56 | rm -rf $RPM_BUILD_ROOT | |
b27658a9 | 57 | install -d $RPM_BUILD_ROOT{%{resourcedir},%{scriptsdir},%{snmpdconfdir},%{_libdir}} |
04a0f80e | 58 | cp -a *.xml $RPM_BUILD_ROOT%{resourcedir} |
b27658a9 ER |
59 | install -p %{SOURCE1} $RPM_BUILD_ROOT%{scriptsdir}/%{template} |
60 | install -p %{SOURCE2} $RPM_BUILD_ROOT%{_libdir}/snmpd-agent-tcpstat | |
04a0f80e ER |
61 | |
62 | %post | |
42bd8d07 | 63 | %cacti_import_template %{resourcedir}/cacti_graph_template_tcp_connections.xml |
04a0f80e | 64 | |
b27658a9 ER |
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 | ||
04a0f80e ER |
79 | %clean |
80 | rm -rf $RPM_BUILD_ROOT | |
81 | ||
82 | %files | |
83 | %defattr(644,root,root,755) | |
663f87bc | 84 | %attr(755,root,root) %{scriptsdir}/%{template} |
04a0f80e | 85 | %{resourcedir}/cacti_graph_template_tcp_connections.xml |
b27658a9 ER |
86 | |
87 | %files -n net-snmp-agent-tcpstat | |
88 | %defattr(644,root,root,755) | |
89 | %attr(755,root,root) %{_libdir}/snmpd-agent-tcpstat |