Determining system info

2006-11-05 Thread Don O'Neil
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!

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Determining system info

2006-11-05 Thread Josh Carroll

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


uptime | sed 's/.*load averages: //g' | cut -d, -f2 | sed 's/.*\.//g'
uptime | sed 's/.*load averages: //g' | cut -d, -f3 | sed 's/.*\.//g'



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


top -d 1 | grep ' processes:' | awk '{print $1}'
top -d 1 | grep ' processes:' | sed 's/.*processes: *//g' | awk '{print $1}'


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


I'd use snmpd for this one.


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


swapinfo -k | grep -v '^Device' | awk '{print $4}'
swapinfo -k | grep -v '^Device' | awk '{print $3}'
(note: this assumes you only have one swap device)


if [ $TYPE = uptime ]; then
INDATA=`cat /proc/uptime |  cut -d ' ' -f1`
OUTDATA=`cat /proc/uptime | cut -d ' ' -f2`
fi


You'd probably want some magic to parse the output of uptime and
convert the time value into an integer here.


if [ $TYPE = memory ]; then
INDATA=`free -bt | grep buffers\/cache | awk '{print $3}'`
OUTDATA=`free -bt | grep buffers\/cache | awk '{print $4}'`
fi


vmstat | grep -vE '^ *(procs|r b)' | awk '{print $4}'
vmstat | grep -vE '^ *(procs|r b)' | awk '{print $5}'


Good luck,
Josh
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


system info

2003-07-03 Thread Morten
Hi all,

Is there a command line utility that I can use to get info on installed 
ram, CPU etc?



Cheers,



-Morten

___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: system info

2003-07-03 Thread Luke Kearney
top

LK

- Original Message -
From: "Morten" [EMAIL PROTECTED]
Cc: 
Sent: Thursday, July 03, 2003 7:00 PM
Subject: system info


 Hi all,


 Is there a command line utility that I can use to get info on installed
 ram, CPU etc?



 Cheers,



 -Morten

 ___
 [EMAIL PROTECTED] mailing list
 http://lists.freebsd.org/mailman/listinfo/freebsd-questions
 To unsubscribe, send any mail to
"[EMAIL PROTECTED]"



___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

Re: system info

2003-07-03 Thread Morten
Hi,

Well, yeah, sort of. But it doesn't tell me cpu speed...



Cheers,



-Morten

Luke Kearney wrote:

top

LK

- Original Message -
From: Morten [EMAIL PROTECTED]
Cc: 
Sent: Thursday, July 03, 2003 7:00 PM
Subject: system info


  

Hi all,


Is there a command line utility that I can use to get info on installed
ram, CPU etc?



Cheers,



-Morten

___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to


[EMAIL PROTECTED]
  



___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]
  


___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: system info

2003-07-03 Thread Fox
Le Thu, Jul 03, 2003 at 12:11:29PM +0200, Morten ecrivait:
 Hi,
 
 Well, yeah, sort of. But it doesn't tell me cpu speed...
less /var/run/dmesg.boot


Regards.

-- 
[EMAIL PROTECTED]
Claranet France
--
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: system info

2003-07-03 Thread Matthew Seaman
On Thu, Jul 03, 2003 at 12:00:13PM +0200, Morten wrote:

 Is there a command line utility that I can use to get info on installed 
 ram, CPU etc?

less(1), as in

% less /var/run/dmesg.boot

Cheers,

Matthew

-- 
Dr Matthew J Seaman MA, D.Phil.   26 The Paddocks
  Savill Way
PGP: http://www.infracaninophile.co.uk/pgpkey Marlow
Tel: +44 1628 476614  Bucks., SL7 1TH UK


pgp0.pgp
Description: PGP signature


Re: system info

2003-07-03 Thread Sunil Sunder Raj
Hi,
/var/run/dmesg.boot is the file you need. Just go through the bootup 
messages in teh file. You will get all the details of your server.

Regards
SSR

From: Morten [EMAIL PROTECTED]
Reply-To: [EMAIL PROTECTED]
CC: [EMAIL PROTECTED]
Subject: system info
Date: Thu, 03 Jul 2003 12:00:13 +0200
Hi all,

Is there a command line utility that I can use to get info on installed 
ram, CPU etc?



Cheers,



-Morten

___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to 
[EMAIL PROTECTED]
_
Reconnect with old pals. Relive the happy times. 
http://www.batchmates.com/msn.asp With just one click.

___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]