flapane
04-12-2006, 17:25
ho fatto questo piccolo script che mostra:
flapane@a64:~$ stats
PC statistic
-=[ Kernel info: 2.6.15-27-amd64-k8 ]=-
-=[ Ubuntu 6.10 ]=-
-=[ CPU Info: AMD Athlon(tm) 64 X2 Dual Core Processor 3800+ ]=-
-=[ CPU Full: Detected 2565.530 MHz processor. ]=-
-=[ CPU Mhz: 1425.300 ]=-
-=[ CPU temperature: 35 C ]=-
-=[ Incoming/Outgoing: (81.6MiB) / (9.6MiB) ]=-
-=[ Used/Total memory: 562 MB / 1003 MB ]=-
-=[ Uptime: 2 hour, 7 min, 48 sec ]=-
magari può servire per chi è alle prime armi con superkaramba per estrarre direttamente da qua le statistiche, non so...
STATS.SH:
#!/bin/bash
b=`uname -r`
a=`cat /proc/cpuinfo | grep 'model name' | sed -e 's/.*: //' | tail --lines=1`
e=`cat /proc/acpi/thermal_zone/THRM/temperature | grep -i -F 'temperature:' | sed s/'.*erature: *'//`
f=`cat /etc/issue.net`
g=`/sbin/ifconfig eth0 | grep 'RX byte' | awk '{print $3 $4}'`
h=`/sbin/ifconfig eth0 | grep 'RX byte' | awk '{print $7 $8}'`
i=`free | grep '-' | awk '{print $3}'`
j=`free | grep 'Mem' | awk '{print $2}'`
k=`uptimemod`
l=`cat /proc/cpuinfo | grep 'cpu MHz' | sed -e 's/.*: //' | tail --lines=1`
x=`expr $i \/ 1024`
y=`expr $j \/ 1024`
m=`dmesg | grep -i -F 'processor.' | sed -e 's/.*] //' | tail --lines=1`
echo "PC statistic"
echo "-=[ Kernel info: $b ]=-"
echo "-=[ $f ]=-"
echo "-=[ CPU Info: $a ]=-"
echo "-=[ CPU Full: $m ]=-"
echo "-=[ CPU Mhz: $l ]=-"
echo "-=[ CPU Temperature: $e ]=-"
echo "-=[ Incoming/Outgoing: $g / $h ]=-"
echo "-=[ Used/Total memory: $x MB / $y MB ]=-"
echo "-=[ $k ]=-"
UPTIMEMOD.SH (preso dal web):
#!/bin/bash
# created by masterminds
a=`cat /proc/uptime | cut -d " " -f1`
b=`echo $a | cut -d "." -f1`
e=`expr $b \/ 86400`
f=`expr $b \% 86400`
g=`expr $f \/ 3600`
h=`expr $f \% 3600`
i=`expr $h \/ 60`
j=`expr $h \% 60`
if [ $e == 0 ]
then
if [ $g == 0 ]
then
echo "Uptime: $i min, $j sec"
else
echo "Uptime: $g hour, $i min, $j sec"
fi
else
if [ $g == 0 ]
then
echo "Uptime: $e day, $i min, $j sec"
else
echo "Uptime: $e day, $g hour, $i min, $j sec"
fi
fi
poi si rendono eseguibili e si mettono in /usr/bin
flapane@a64:~$ stats
PC statistic
-=[ Kernel info: 2.6.15-27-amd64-k8 ]=-
-=[ Ubuntu 6.10 ]=-
-=[ CPU Info: AMD Athlon(tm) 64 X2 Dual Core Processor 3800+ ]=-
-=[ CPU Full: Detected 2565.530 MHz processor. ]=-
-=[ CPU Mhz: 1425.300 ]=-
-=[ CPU temperature: 35 C ]=-
-=[ Incoming/Outgoing: (81.6MiB) / (9.6MiB) ]=-
-=[ Used/Total memory: 562 MB / 1003 MB ]=-
-=[ Uptime: 2 hour, 7 min, 48 sec ]=-
magari può servire per chi è alle prime armi con superkaramba per estrarre direttamente da qua le statistiche, non so...
STATS.SH:
#!/bin/bash
b=`uname -r`
a=`cat /proc/cpuinfo | grep 'model name' | sed -e 's/.*: //' | tail --lines=1`
e=`cat /proc/acpi/thermal_zone/THRM/temperature | grep -i -F 'temperature:' | sed s/'.*erature: *'//`
f=`cat /etc/issue.net`
g=`/sbin/ifconfig eth0 | grep 'RX byte' | awk '{print $3 $4}'`
h=`/sbin/ifconfig eth0 | grep 'RX byte' | awk '{print $7 $8}'`
i=`free | grep '-' | awk '{print $3}'`
j=`free | grep 'Mem' | awk '{print $2}'`
k=`uptimemod`
l=`cat /proc/cpuinfo | grep 'cpu MHz' | sed -e 's/.*: //' | tail --lines=1`
x=`expr $i \/ 1024`
y=`expr $j \/ 1024`
m=`dmesg | grep -i -F 'processor.' | sed -e 's/.*] //' | tail --lines=1`
echo "PC statistic"
echo "-=[ Kernel info: $b ]=-"
echo "-=[ $f ]=-"
echo "-=[ CPU Info: $a ]=-"
echo "-=[ CPU Full: $m ]=-"
echo "-=[ CPU Mhz: $l ]=-"
echo "-=[ CPU Temperature: $e ]=-"
echo "-=[ Incoming/Outgoing: $g / $h ]=-"
echo "-=[ Used/Total memory: $x MB / $y MB ]=-"
echo "-=[ $k ]=-"
UPTIMEMOD.SH (preso dal web):
#!/bin/bash
# created by masterminds
a=`cat /proc/uptime | cut -d " " -f1`
b=`echo $a | cut -d "." -f1`
e=`expr $b \/ 86400`
f=`expr $b \% 86400`
g=`expr $f \/ 3600`
h=`expr $f \% 3600`
i=`expr $h \/ 60`
j=`expr $h \% 60`
if [ $e == 0 ]
then
if [ $g == 0 ]
then
echo "Uptime: $i min, $j sec"
else
echo "Uptime: $g hour, $i min, $j sec"
fi
else
if [ $g == 0 ]
then
echo "Uptime: $e day, $i min, $j sec"
else
echo "Uptime: $e day, $g hour, $i min, $j sec"
fi
fi
poi si rendono eseguibili e si mettono in /usr/bin