From owner-freebsd-questions Tue Feb 25 21:41:47 2003 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 E086537B401 for ; Tue, 25 Feb 2003 21:41:45 -0800 (PST) Received: from dan.emsphone.com (dan.emsphone.com [199.67.51.101]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4754943F3F for ; Tue, 25 Feb 2003 21:41:45 -0800 (PST) (envelope-from dan@dan.emsphone.com) Received: (from dan@localhost) by dan.emsphone.com (8.12.6/8.12.6) id h1Q5fiN4090107; Tue, 25 Feb 2003 23:41:44 -0600 (CST) (envelope-from dan) Date: Tue, 25 Feb 2003 23:41:44 -0600 From: Dan Nelson To: Adam Lofstedt Cc: freebsd-questions@FreeBSD.ORG Subject: Re: MRTG and aliased IP's Message-ID: <20030226054144.GA67012@dan.emsphone.com> References: <000b01c2dd03$f14f9480$6401a8c0@5adam5> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <000b01c2dd03$f14f9480$6401a8c0@5adam5> X-OS: FreeBSD 5.0-CURRENT X-message-flag: Outlook Error User-Agent: Mutt/1.5.3i Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG In the last episode (Feb 25), Adam Lofstedt said: > Hi all. I'm running FreeBSD 4.7 with net-snmp-5.0.3_2. > > I have two NICs, and one of them has several IP's bound to it through > ifconfig alias. When I try to run MRTG, it only gives me the statistics > for one of the aliased IPs (I think). > > System: my.domain.com in > Maintainer: nobody@no.where > Description: xl0 > ifType: ethernetCsmacd (6) > ifName: > Max Speed: 1250.0 kBytes/s > Ip: xxx.xxx.xxx.xxx (xxx-xxx-xxx-xxx.domain.com) > > xxx.xxx.xxx.xxx is the first aliased IP in /etc/rc.conf. Does anyone > know of a way to get statistics for each individual aliased IP? > > With the above output, does anyone know if I am actually getting > statistics for all bound IP's combined, or for just that one single > aliased IP? You're getting stats for the physical interface. I don't think net-snmp lets you get stats for a single IP. One workaround would be a get-alias-stats script that pulls info from netstat for a particular IP: #! /bin/sh # usage: get-alias-stats ip=$1 netstat -ibn -f inet | while read line ; do set -- $line if [ "$4" = "$ip" ] ; then echo $7 echo ${10} uptime | sed -e "s/.*up \(.*\), .*user.*/\1/" hostname fi done Call that in mrtg, and pass it the alias IP you're interested in: Target[alias1]: `get-alias-stats 1.2.3.4` -- Dan Nelson dnelson@allantgroup.com To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message