]>
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 |
117cc50b | 7 | Release: 3 |
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 | |
117cc50b ER |
45 | # iproute2 |
46 | Requires: /sbin/ss | |
b27658a9 ER |
47 | Requires: net-snmp |
48 | ||
49 | %description -n net-snmp-agent-tcpstat | |
50 | SNMPd agent to provide TCP Connection statistics. | |
51 | ||
04a0f80e | 52 | %prep |
42bd8d07 | 53 | %setup -qc |
663f87bc | 54 | %{__sed} -i -e 's,/bin/bash /var/www/htdocs/cacti/scripts/get_tcp_connections,%{scriptsdir}/%{template},' *.xml |
04a0f80e ER |
55 | |
56 | %install | |
57 | rm -rf $RPM_BUILD_ROOT | |
b27658a9 | 58 | install -d $RPM_BUILD_ROOT{%{resourcedir},%{scriptsdir},%{snmpdconfdir},%{_libdir}} |
04a0f80e | 59 | cp -a *.xml $RPM_BUILD_ROOT%{resourcedir} |
b27658a9 ER |
60 | install -p %{SOURCE1} $RPM_BUILD_ROOT%{scriptsdir}/%{template} |
61 | install -p %{SOURCE2} $RPM_BUILD_ROOT%{_libdir}/snmpd-agent-tcpstat | |
04a0f80e ER |
62 | |
63 | %post | |
42bd8d07 | 64 | %cacti_import_template %{resourcedir}/cacti_graph_template_tcp_connections.xml |
04a0f80e | 65 | |
b27658a9 ER |
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 | ||
04a0f80e ER |
80 | %clean |
81 | rm -rf $RPM_BUILD_ROOT | |
82 | ||
83 | %files | |
84 | %defattr(644,root,root,755) | |
663f87bc | 85 | %attr(755,root,root) %{scriptsdir}/%{template} |
04a0f80e | 86 | %{resourcedir}/cacti_graph_template_tcp_connections.xml |
b27658a9 ER |
87 | |
88 | %files -n net-snmp-agent-tcpstat | |
89 | %defattr(644,root,root,755) | |
90 | %attr(755,root,root) %{_libdir}/snmpd-agent-tcpstat |