|
From: Matt D. <md...@us...> - 2004-05-27 05:45:30
|
Update of /cvsroot/acd/acd-1/web/arch/OpenBSD-3.4 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14764 Added Files: aging cpu diskspace memory Log Message: - Started the OpenBSD-3.4 arch, partly as an exercise, partly because JLo was talking about it today. diskspace worked as copied from the linux directory. I didn't really touch aging, but cpu and memory are kludgy and depend on dmesg. I haven't been able to get network_interfaces figured out yet. -MD --- NEW FILE: aging --- #!/bin/sh GET_TIME=/usr/local/bin/get_time if [ -x $GET_TIME ]; then TIME=`/usr/local/bin/get_time -m /etc/init.d` fi echo " <basic_info>" echo " <installed>$TIME</installed>" echo " </basic_info>" --- NEW FILE: cpu --- #!/bin/sh ARCH=`uname -m` CPU_LIST=`dmesg | grep MHz | grep cpu | cut -d: -f1 | uniq ` echo "<hostinfo>" # Below, I'm trying to get the cpu speed. The only thing I've # been able to do so far is to grep that info out of dmesg, # where there is a line that says a certain cpu is "597 MHz" # or some such. I'm expecting that "597 MHz" (e.g.) to be # at the very end of the line, and so I parse that line out # for each cpu, and then grab the next to last string in the # line, which should be the speed. With any luck. -MD for cpu in $CPU_LIST do MHZ=`dmesg | grep cpu0 | grep MHz | awk '{print $(NF-1)}'` echo " <cpu speed='$MHZ' architecture='$ARCH' />" done echo "</hostinfo>" --- NEW FILE: diskspace --- #!/usr/bin/env perl my $line; my $total_k=0; my $total_g; my @chunks; my $string; open DF, "/bin/df -lk|"; while(<DF>) { $line=$_; if(not /Filesystem/ and not /shm/ and not /\/dev\/fd0/) { $line =~ s/\/dev\/[\w]*\s*(\d*).*/$1/; $total_k+=$line; } } $total_g=$total_k/(1024*1024); $string=sprintf("%.0f",$total_g); print " <basic_info>\n"; print " <diskspace>$string</diskspace>\n"; print " </basic_info>\n"; --- NEW FILE: memory --- #!/bin/sh MLINE=`dmesg | grep "real mem" | awk {'print $5'} | sed s/\(// | sed s/K\)//` echo $MLINE MEM=`dc -e "$MLINE 1024 / p"` echo "<basic_info>" echo "<ram>$MEM</ram>" echo "</basic_info>" |