Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 16 May 2014 08:32:54 GMT
From:      Pavel Volkov <pavelivolkov@gmail.com>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   conf/189854: Improved /etc/periodic/daily/420.status-network
Message-ID:  <201405160832.s4G8WscZ015215@cgiserv.freebsd.org>
Resent-Message-ID: <201405160840.s4G8e0L8080153@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         189854
>Category:       conf
>Synopsis:       Improved /etc/periodic/daily/420.status-network
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Fri May 16 08:40:00 UTC 2014
>Closed-Date:
>Last-Modified:
>Originator:     Pavel Volkov
>Release:        9.2-RELEASE-p6
>Organization:
>Environment:
FreeBSD be.dns4soho.net 9.2-RELEASE-p6 FreeBSD 9.2-RELEASE-p6 #8 r266094: Thu May 15 11:17:52 MSK 2014     root@be.dns4soho.net:/usr/obj/usr/src/sys/ext  amd64
>Description:
How I get other statistics from netstat with daily reports?
>How-To-Repeat:

>Fix:


Patch attached with submission follows:

--- /etc/periodic/daily/420.status-network.orig	2014-05-16 09:11:11.000000000 +0400
+++ /etc/periodic/daily/420.status-network	2014-05-16 12:06:02.000000000 +0400
@@ -14,14 +14,28 @@
 case "$daily_status_network_enable" in
     [Yy][Ee][Ss])
 	echo ""
-	echo "Network interface status:"
+	echo "Network status:"
 
-	case "$daily_status_network_usedns" in
-	    [Yy][Ee][Ss])
-		netstat -id && rc=0 || rc=3;;
-	    *)
-		netstat -idn && rc=0 || rc=3;;
-	esac;;
+	rc=3
+	: ${daily_status_network_netstat_reports:="if mem"}
+	: ${daily_status_network_netstat_if_header:="Display per-interface statistics:"}
+	: ${daily_status_network_netstat_if_flags:="-i -W -d -b -h -n"}
+	: ${daily_status_network_netstat_mem_header:="Show memory statistics:"}
+	: ${daily_status_network_netstat_mem_flags:="-m"}
+	for _var in ${daily_status_network_netstat_reports}; do
+		eval _flags=daily_status_network_netstat_${_var}_flags
+		eval _flags=\${${_flags}}
+		eval _header=daily_status_network_netstat_${_var}_header
+		eval _header=\${${_header}}
+		if [ -n "${_flags}" ]; then
+			if [ -n "${_header}" -a "${_header}" != "undefined" ]; then
+				echo ""
+				echo "${_header}"
+			fi
+			netstat ${_flags} && rc=0 || rc=3
+		fi
+	done
+	;;
 
     *)  rc=0;;
 esac


>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201405160832.s4G8WscZ015215>