From owner-freebsd-questions@FreeBSD.ORG Sun Nov 5 19:49:37 2006 Return-Path: X-Original-To: freebsd-questions@freebsd.org Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id B0E7A16A407 for ; Sun, 5 Nov 2006 19:49:37 +0000 (UTC) (envelope-from don@lizardhill.com) Received: from kermit.lizardhill.com (kermit.lizardhill.com [64.69.41.217]) by mx1.FreeBSD.org (Postfix) with ESMTP id 846E143D7B for ; Sun, 5 Nov 2006 19:49:35 +0000 (GMT) (envelope-from don@lizardhill.com) Received: from ip72-193-85-114.lv.lv.cox.net ([72.193.85.114] helo=mickey) by kermit.lizardhill.com with esmtp (Exim 4.62) (envelope-from ) id 1Ggnzx-000Jgu-HI for freebsd-questions@freebsd.org; Sun, 05 Nov 2006 11:49:41 -0800 From: "Don O'Neil" To: Date: Sun, 5 Nov 2006 11:49:34 -0800 Message-ID: <06ca01c70113$84c07400$0400020a@mickey> MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook 11 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2962 Thread-Index: AccBE4SXHwhDK7PDS5+yJdagxQdzOA== Subject: Determining system info X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Nov 2006 19:49:37 -0000 I am trying to get someones MRTG script that was evidently written for a Linux system of some sort working on 6.1.... Here's his script: #!/bin/sh TYPE=$1 PARAM=$2 if [ "$TYPE" = "load" ]; then INDATA=`cat /proc/loadavg | cut -d ' ' -f2 | sed 's/\.//g' | sed 's/^0//g'` OUTDATA=`cat /proc/loadavg | cut -d ' ' -f3 | sed 's/\.//g' | sed 's/^0//g'` fi if [ "$TYPE" = "processes" ]; then INDATA=`cat /proc/loadavg | cut -d ' ' -f4 | cut -d '/' -f 2` OUTDATA=`cat /proc/loadavg | cut -d ' ' -f4 | cut -d '/' -f 1` fi if [ "$TYPE" = "network" ]; then LINE=`cat /proc/net/dev | grep $PARAM | sed s/$PARAM://` INDATA=`echo $LINE | awk '{print $1}' ` OUTDATA=`echo $LINE | awk '{print $9}' ` fi if [ "$TYPE" = "swap" ]; then SWAPFREE=`cat /proc/meminfo | grep "SwapFree" | sed 's/ //g' | cut -d ':' -f2 | cut -d 'k' -f1` SWAPTOTAL=`cat /proc/meminfo | grep "SwapTotal" | sed 's/ //g' | cut -d ':' -f2 | cut -d 'k' -f1` SWAPUSED=`expr $SWAPTOTAL - $SWAPFREE` INDATA=$SWAPFREE OUTDATA=$SWAPUSED fi if [ "$TYPE" = "uptime" ]; then INDATA=`cat /proc/uptime | cut -d ' ' -f1` OUTDATA=`cat /proc/uptime | cut -d ' ' -f2` fi if [ "$TYPE" = "memory" ]; then INDATA=`free -bt | grep buffers\/cache | awk '{print $3}'` OUTDATA=`free -bt | grep buffers\/cache | awk '{print $4}'` fi echo $INDATA echo $OUTDATA echo `uptime | cut -d"," -f1,2` echo $TYPE Now, how can I recreate the same data gathering in 6.1? Are there utilities I can run to get the load, # of processes, network, free swap, etc... Thanks!