Alle systeeminformatie die bijna maar denkbaar is kun je middels dit script opvragen.
De enige afhankelijkheid is Coreutils, beschikbaar als ipkg pakket.
Application.cfg
text= SysInfo
description = System Information
type = embedded
path=/phpsrc/sysinfo/info.cgi
info.cgi
NB. Bijgewerkt met de beveiliging van Merty. Zie
http://synology.nl/forum/viewtopic.php?f=83&t=2274.
#!/bin/ash
# if not admin or no user at all...no authentication...so, bye-bye
user=$(/usr/syno/synoman/webman/modules/authenticate.cgi);
if [ "$user" != "admin" ] ;
then
echo "Content-type: text/html"
echo ""
echo "<HTML><HEAD><TITLE>Login Required</TITLE></HEAD><BODY>Please login as admin first, before using this webpage</BODY></HTML>"
exit
fi
cat <<EOT
Content-type: text/html
<html><head><title>System-Info</title></head><body>
<style>body{font:11px Arial;background-color:#ddf;}a{text-decoration:none}</style>
<a name="back">
<h3>General system information for host $(hostname -s)
[$(ifconfig eth0 | grep inet | sed 's/^ *..........//' | sed 's/ .*$//')]
</h3>
<a href="#cpu">CPU</a> |
<a href="#memory">Memory</a> |
<a href="#swap">Swap</a> |
<a href="#flash">Flash-Layout</a> |
<a href="#swap">Swap</a> |
<a href="#devices">Devices</a> |
<a href="#msgartitions">Partitions</a> |
<a href="#filesystems">File-Systems</a> |
<a href="#raid">RAID-Volumes</a> |
<a href="#hibernate">Disk Wake-Up Protocol</a> |
<a href="#mount">mounted Volumes</a> |
<a href="#fsusage">File-System Usage</a><br>
<a href="#linux">Installed Linux-Version</a> |
<a href="#modules">Installed Modules</a> |
<a href="#ipkg">Itsy Package Management System</a> |
<a href="#user">User</a> |
<a href="#msgrocesses">Processes</a> |
<a href="#cron">Cron</a><br>
<a href="#interfaces">Network Interfaces</a> |
<a href="#msgorts">Network Ports</a> |
<a href="#dns">Domain Name System</a> |
<a href="#netstat">Network Statistics</a> |
<a href="#nfs">NFS Mounts</a> |
<a href="#samba">Samba</a>
<h3><a name="cpu">CPU</h3><pre>$(cat /proc/cpuinfo)</pre>
<h3><a name="memory" href="#back">Memory</h3></a><pre>$(cat /proc/meminfo)</pre>
<img src="http://chart.apis.google.com/chart?cht=p3&chs=250x120&chco=0000ff&
chf=bg,s,efefef00&&chl=Used|Free|Shared|Buffers&chtt=Mem&
chd=$(free | awk 'NR==2{printf("t:%d,%d,%d,%d",$3/1000, $4/1000, $5/1000, $6/1000)}')">
<img src="http://chart.apis.google.com/chart?cht=p3&chs=250x120&chco=0000ff&
chf=bg,s,efefef00&chl=Used|Free&chtt=Swap&
chd=$(free | awk 'NR==3{printf("t:%d,%d",$3/1000, $4/1000)}')">
<pre>$(free)</pre>
<h3><a name="swap" href="#back">Swap</h3></a><pre>$(cat /proc/swaps)<hr>$(sysctl -a|grep swap)</pre>
<h3><a name="flash" href="#back">Flash-Layout</h3></a><pre>$(cat /proc/mtd) </pre>
<h3><a name="devices" href="#back">Devices (Major-#)</h3></a><pre>$(cat /proc/devices)<br>
USB devices:$(cat /proc/bus/usb/devices)</pre>
<h3><a name="partitions" href="#back">Partitions</h3><pre></a>$(cat /proc/partitions)<hr>
$(/sbin/sfdisk -l)</pre>
<h3><a name="filesystems" href="#back">File-Systems</h3></a><pre>$(cat /proc/filesystems)</pre>
<h3><a name="raid" href="#back">RAID-Volumes</h3></a><pre>$(cat /proc/mdstat)<hr>
$(for m in /dev/md?; do echo "$m"; /opt/sbin/dumpe2fs -h $m; done)<hr>
$(for m in /dev/md?; do echo ""; mdadm --query --detail $m; done)</pre>
<h3><a name="hibernate" href="#back">Disk Wake-Up Protocol</a></h3>
<pre>$(grep 'standbytimer=' /etc/synoinfo.conf|sed 's/"//'|sed 's/"/ Minutes/')<br>
$(grep 'wake up' /var/log/messages|awk '{print $1" "$2" "$3" "$6" "$7}'|tail -n 20)</pre>
<h3><a name="mount" href="#back">mounted Volumes</h3></a><pre>$(cat /proc/self/mounts)<hr>
$(mount)</pre>
<h3><a name="fsusage" href="#back">File-System Usage</h3></a><pre>$(df)</pre>
<img src="http://chart.apis.google.com/chart?cht=p3&chs=240x120&chco=0000ff&
chf=bg,s,efefef00&;chl=Used|Available&chtt=md0&
chd=$(df|awk '/rootfs/{printf("t:%d,%d",$3/$2*100, $4/$2*100)}')">
<img src="http://chart.apis.google.com/chart?cht=p3&chs=240x120&chco=0000ff&
chf=bg,s,efefef00&chl=Used|Available&chtt=md2&
chd=$(df|awk '/volume1$/{printf("t:%d,%d",$3/$2*100, $4/$2*100)}')">
<img src="http://chart.apis.google.com/chart?cht=p3&chs=240x120&chco=00ff00&
chf=bg,s,efefef00&chl=Used|Available&chtt=tmp&
chd=$(df|awk '/tmp/{printf("t:%d,%d",$3/$2*100, $4/$2*100)}')">
<h3><a name="linux" href="#back">Installed Linux-Version</h3></a><pre>$(cat /proc/version)</pre>
<h3><a name="modules" href="#back">Installed Modules</h3></a><pre>$(lsmod)</pre>
<h3><a name="ipkg" href="#back">Itsy Package Management System</h3></a><pre>$(ipkg list_installed)</pre>
<h3><a name="user" href="#back">User</h3></a><pre>$(cat /etc/passwd)<hr>$(who -a)</pre>
<h3><a name="processes" href="#back">Processes</h3></a><div style="float:left;padding-right:5px">
<pre>$(awk 'NR==1{u=($2+$3)/100;s=$4/100;g=u+s;i=$5/100;a=g+i;printf("User Process Time : %10.2f sec %5.2f %%
System Process Time: %10.2f sec %5.2f %%
--------------------------------------------
Busy Time : %10.2f sec %5.2f %%
Idle Time : %10.2f sec %5.2f %%n",u,u/a*100,s,s/a*100,g,g/a*100,i,i/a*100)}' /proc/stat)</pre></div>
<img style="margin-top:-30px"
src="http://chart.apis.google.com/chart?cht=p3&chs=250x120&chco=0000ff&
chf=bg,s,efefef00&chl=User|System|Idle&chtt=ProcessTime&
chd=$(awk 'NR==1{u=($2+$3);s=$4;i=$5;a=g+i;printf("t:%d,%d,%d",u/a*100,s/a*100,i/a*100)}' /proc/stat)">
<pre>$(ps)</pre>
<h3><a name="cron" href="#back">Cron</h3></a><pre>$(ps|grep crond|grep -v grep >/dev/null &&
echo "crond is running" || echo "crond is not running")<br><br>$(cat /etc/crontab)</pre>
<h3><a name="interfaces" href="#back">Network Interfaces</h3></a><pre>$(ifconfig -a)<hr>
$(synoethinfo)<hr>ARP
$(cat /proc/net/arp)<br><br>$(netstat -r)</pre>
<h3><a name="ports" href="#back">Network Ports</h3></a>
<pre>$(netstat -a|awk '/UNIX/{print "n"}{print $0}')</pre>
<h3><a name="dns" href="#back">Domain Name System</h3></a><pre>$(cat /etc/resolv.conf)</pre>
<h3><a name="netstat" href="#back">Network Statistics</h3></a><pre>$(ping -c 2 ipkg.nslu2-linux.org)<br>
$(</proc/net/dev sed 's/:/ /'|
awk 'NR>2{printf("%-4s Received: %10d kB Transmit: %10d kBn",$1,$2/1000,$10/1000)}')
<br>Average Packet-Size</br>
$(</proc/net/dev sed 's/:/ /'|
awk 'NR>2{printf("%-4s Received: %10d Bytes Transmit: %10d Bytesn",$1,$2/$3,$10/$11)}')
</pre>
<h3><a name="nfs" href="#back">NFS Mounts</h3></a><pre>$(showmount)</a></pre>
<h3><a name="samba" href="#back">Samba</h3></a><pre>$(net -V)<br>$(smbstatus -vS)<br>
$(net status sessions)<br>$(net status shares)</pre>
</body></html>
EOT
Bijbehorend plaatje:
Alleen apart dat 'ie mijn systeem (CS406) aangeeft als een DS-101g+
Denk wederom om de regeleindes (^M) in de bestanden en chmod 755 op info.cgi
Veel plezier!
Wizjos