From owner-freebsd-isp Sun Dec 2 23: 4: 4 2001 Delivered-To: freebsd-isp@freebsd.org Received: from blotto.phreak.net (blotto.phreak.net [207.250.188.230]) by hub.freebsd.org (Postfix) with ESMTP id 2521D37B419 for ; Sun, 2 Dec 2001 23:04:02 -0800 (PST) Received: from phreak.net (localhost.phreak.net [127.0.0.1]) by blotto.phreak.net (Postfix) with SMTP id 9318F189501 for ; Mon, 3 Dec 2001 01:04:01 -0600 (CST) Received: from 65.25.176.231 (SquirrelMail authenticated user operator) by mail.phreak.net with HTTP; Mon, 3 Dec 2001 01:04:01 -0600 (CST) Message-ID: <14844.65.25.176.231.1007363041.squirrel@mail.phreak.net> Date: Mon, 3 Dec 2001 01:04:01 -0600 (CST) Subject: Re: How to get uptime? From: "Steve Kaczkowski" To: freebsd-isp@freebsd.org In-Reply-To: <20011202143626.N56385@squall.waterspout.com> References: <20011202143626.N56385@squall.waterspout.com> X-Mailer: SquirrelMail (version 1.0.6) MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Sender: owner-freebsd-isp@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org > On Sun, Dec 02, 2001 at 08:12:14PM +0100, Thomas Krause, CI wrote: >> ist there an other way to get the system uptime then the "uptime" >> command? I need the uptime for a for a script which is called by mrtg. >> The output of "uptime" is difficult to parse, eg: > > Yes. sysctl kern.boottime. In C, you can get that via >syctlbyname(), then get the current time w/ time(), then use > difftime() to get the number of seconds difference. > Here's some MRTG scripts that might be useful: http://mrtg-pme.sourceforge.net/ Along with checking disk,paging,cpu,mem,etc they also display the uptime on the top of each page.. Good luck! -- Steve Kaczkowski operator@phreak.net To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-isp" in the body of the message