From owner-freebsd-bugs@FreeBSD.ORG Fri May 16 08:40:00 2014 Return-Path: Delivered-To: freebsd-bugs@smarthost.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id A987318B for ; Fri, 16 May 2014 08:40:00 +0000 (UTC) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:1900:2254:206c::16:87]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 871552773 for ; Fri, 16 May 2014 08:40:00 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.8/8.14.8) with ESMTP id s4G8e0uL080154 for ; Fri, 16 May 2014 08:40:00 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.8/8.14.8/Submit) id s4G8e0L8080153; Fri, 16 May 2014 08:40:00 GMT (envelope-from gnats) Resent-Date: Fri, 16 May 2014 08:40:00 GMT Resent-Message-Id: <201405160840.s4G8e0L8080153@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Pavel Volkov Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 1D13DFFA for ; Fri, 16 May 2014 08:32:55 +0000 (UTC) Received: from cgiserv.freebsd.org (cgiserv.freebsd.org [IPv6:2001:1900:2254:206a::50:4]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0AE42270E for ; Fri, 16 May 2014 08:32:55 +0000 (UTC) Received: from cgiserv.freebsd.org ([127.0.1.6]) by cgiserv.freebsd.org (8.14.8/8.14.8) with ESMTP id s4G8WsVF015220 for ; Fri, 16 May 2014 08:32:54 GMT (envelope-from nobody@cgiserv.freebsd.org) Received: (from nobody@localhost) by cgiserv.freebsd.org (8.14.8/8.14.8/Submit) id s4G8WscZ015215; Fri, 16 May 2014 08:32:54 GMT (envelope-from nobody) Message-Id: <201405160832.s4G8WscZ015215@cgiserv.freebsd.org> Date: Fri, 16 May 2014 08:32:54 GMT From: Pavel Volkov To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Subject: conf/189854: Improved /etc/periodic/daily/420.status-network X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 May 2014 08:40:00 -0000 >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: