packages: cacti-template-snmp_tcp_connection_status/cacti-template-snmp_tcp...

glen glen at pld-linux.org
Fri Oct 23 16:27:03 CEST 2009


Author: glen                         Date: Fri Oct 23 14:27:03 2009 GMT
Module: packages                      Tag: HEAD
---- Log message:
- v0.2: add server side collector

---- Files affected:
packages/cacti-template-snmp_tcp_connection_status:
   cacti-template-snmp_tcp_connection_status.spec (1.4 -> 1.5) 

---- Diffs:

================================================================
Index: packages/cacti-template-snmp_tcp_connection_status/cacti-template-snmp_tcp_connection_status.spec
diff -u packages/cacti-template-snmp_tcp_connection_status/cacti-template-snmp_tcp_connection_status.spec:1.4 packages/cacti-template-snmp_tcp_connection_status/cacti-template-snmp_tcp_connection_status.spec:1.5
--- packages/cacti-template-snmp_tcp_connection_status/cacti-template-snmp_tcp_connection_status.spec:1.4	Fri Mar 27 07:54:41 2009
+++ packages/cacti-template-snmp_tcp_connection_status/cacti-template-snmp_tcp_connection_status.spec	Fri Oct 23 16:26:58 2009
@@ -4,7 +4,7 @@
 %define		template	snmp_tcp_connection_status
 Summary:	TCP Connection Status template for Cacti
 Name:		cacti-template-%{template}
-Version:	0.1
+Version:	0.2
 Release:	1
 License:	GPL v2
 Group:		Applications/WWW
@@ -12,6 +12,7 @@
 Source0:	tcp-connections.zip
 # Source0-md5:	72fd9adfafcecec0b6f5a23ec6db8e57
 Source1:	%{name}.sh
+Source2:	tcpstat
 URL:		http://forums.cacti.net/viewtopic.php?t=12766
 BuildRequires:	sed >= 4.0
 Requires:	cacti >= 0.8.6j
@@ -24,25 +25,57 @@
 %define		cactidir		/usr/share/cacti
 %define		resourcedir		%{cactidir}/resource
 %define		scriptsdir		%{cactidir}/scripts
+%define		snmpdconfdir	/etc/snmp
+%define		_libdir			%{_prefix}/lib
+# This is officially registered: http://www.oid-info.com/get/1.3.6.1.4.1.16606
+%define		snmpoid			.1.3.6.1.4.1.16606.1
 
 %description
 Template for Cacti - Monitor TCP Connection Status.
 
+This is improved version which uses SNMPd server side calculation
+instead of fetching all data over slow SNMP protocol.
+
+You need net-snmp-agent-tcpstat installed on SNMP server side.
+
+%package -n net-snmp-agent-tcpstat
+Summary:	SNMPd agent to provide TCP Connection statistics
+Group:		Networking/Daemons
+Requires:	awk
+Requires:	iproute2
+Requires:	net-snmp
+
+%description -n net-snmp-agent-tcpstat
+SNMPd agent to provide TCP Connection statistics.
+
 %prep
 %setup -q -c
-mv get_tcp_connections{,.orig}
-install %{SOURCE1} get_tcp_connections
 %{__sed} -i -e 's,/bin/bash /var/www/htdocs/cacti/scripts/get_tcp_connections,%{scriptsdir}/%{template},' *.xml
 
 %install
 rm -rf $RPM_BUILD_ROOT
-install -d $RPM_BUILD_ROOT{%{resourcedir},%{scriptsdir}}
+install -d $RPM_BUILD_ROOT{%{resourcedir},%{scriptsdir},%{snmpdconfdir},%{_libdir}}
 cp -a *.xml $RPM_BUILD_ROOT%{resourcedir}
-install get_tcp_connections $RPM_BUILD_ROOT%{scriptsdir}/%{template}
+install -p %{SOURCE1} $RPM_BUILD_ROOT%{scriptsdir}/%{template}
+install -p %{SOURCE2} $RPM_BUILD_ROOT%{_libdir}/snmpd-agent-tcpstat
 
 %post
 %{_sbindir}/cacti-add_template %{resourcedir}/cacti_graph_template_tcp_connections.xml
 
+%post -n net-snmp-agent-tcpstat
+if ! grep -qF %{snmpoid} %{snmpdconfdir}/snmpd.local.conf; then
+	echo "extend %{snmpoid} tcpstat %{_libdir}/snmpd-agent-tcpstat" >> %{snmpdconfdir}/snmpd.local.conf
+	%service -q snmpd reload
+fi
+
+%preun -n net-snmp-agent-tcpstat
+if [ "$1" = 0 ]; then
+	if [ -f %{snmpdconfdir}/snmpd.local.conf ]; then
+		%{__sed} -i -e "/extend %(echo %{snmpoid} | sed -e 's,\.,\\.,g')/d" %{snmpdconfdir}/snmpd.local.conf
+		%service -q snmpd reload
+	fi
+fi
+
 %clean
 rm -rf $RPM_BUILD_ROOT
 
@@ -51,12 +84,19 @@
 %attr(755,root,root) %{scriptsdir}/%{template}
 %{resourcedir}/cacti_graph_template_tcp_connections.xml
 
+%files -n net-snmp-agent-tcpstat
+%defattr(644,root,root,755)
+%attr(755,root,root) %{_libdir}/snmpd-agent-tcpstat
+
 %define date	%(echo `LC_ALL="C" date +"%a %b %d %Y"`)
 %changelog
 * %{date} PLD Team <feedback at pld-linux.org>
 All persons listed below can be reached at <cvs_login>@pld-linux.org
 
 $Log$
+Revision 1.5  2009/10/23 14:26:58  glen
+- v0.2: add server side collector
+
 Revision 1.4  2009/03/27 06:54:41  glen
 - rename to cacti-template-; rel 1
 
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/cacti-template-snmp_tcp_connection_status/cacti-template-snmp_tcp_connection_status.spec?r1=1.4&r2=1.5&f=u



More information about the pld-cvs-commit mailing list