Ikke's Blog

Post details: Sysstats.sh

May 17
Sysstats.sh

I wrote a little Bash script this morning, which gives a quick overview of your system.
As mentioned in the help text, this can be very usefull for server administrators, eg allowing you to let an overview be sent to your mailbox every 24h using a cronjob.

This is a sample of the current output:

================================================================
* System statistics for:        foo.baar.be
* Generated on:                 Tue May 17 15:00:49 CEST 2005
* Running as:                   root

=================== Uptime =====================================
* Uptime:                       4 days, 04:37:29
* High score:                   151 days, 19:15:18
* Load average:                 0.32 0.24 0.22

=================== Users ======================================
* Active users:                 2
* User information
        USER     TTY        LOGIN@   IDLE   JCPU   PCPU WHAT
        someone pts/0     12:15    2.00s  0.62s  0.05s sshd: ntrangez [priv]
        someone pts/1     13:30    5:19   1.17s  0.05s sshd: ntrangez [priv]

=================== Tasks ======================================
* Number of running tasks:      62
* Running programs:
agetty          events/0        kjournald       lockd           portmap         sh
aio/0           fcron           kseriod         mysqld          ps              sshd
apache2         init            ksoftirqd/0     mysqld_safe     rpc.mountd      su
bash            kblockd/0       kswapd0         nfsd            rpc.statd       syslog-ng
boa             khelper         kthread         pdflush         rpciod/0        uptimed

* CPU load:                     2%
* Process state:
        Running:                1
        Sleeping:               60
        Zombie:                 0
        Stopped:                0

=================== Networking ================================
* Routing table:
        Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
        192.168.2.0     wifi.vtk.ugent. 255.255.255.0   UG    0      0        0 eth0
        192.168.1.0     *               255.255.255.0   U     0      0        0 eth0
        loopback        webvtk.vtk.ugen 255.0.0.0       UG    0      0        0 lo
        default         fire.vtk.ugent. 0.0.0.0         UG    0      0        0 eth0

=================== Hard Disc =================================
* Disk Information:
        Filesystem            Size  Used Avail Use% Mounted on
        /dev/hdc4             4.5G  3.2G  1.1G  75% /
        /dev/hdc5              14G   11G  2.4G  82% /var/www

* Mounts:
        /dev/hdc4 on / type ext3 (rw,noatime)
        none on /proc type proc (rw)
        none on /sys type sysfs (rw)
        none on /dev type ramfs (rw)
        none on /dev/pts type devpts (rw)
        /dev/hdc5 on /var/www type ext3 (rw,noexec,nosuid,nodev,noatime,acl)
        none on /dev/shm type tmpfs (rw)
        nfsd on /proc/fs/nfs type nfsd (rw)

=================== MD5Sum Check ==============================
* Checking MD5 Sums
        /etc/passwd:                            [OK]
        /etc/shadow:                            [OK]
        /etc/group:                             [OK]

===============================================================
* Brought to you by Ikke - http://www.eikke.com

A TODO is included in the script source.

I made the script available here (enscript version here). If you use it, please let me know something :-) Or even better, if you add more support, please send me a patch so everyone can make use of it :-)

It has no special dependencies, next to Bash and some standard utilities like wc, bc, tail, md5sum, awk and grep.
The "record uptime" is only displayed if you got uprecords (/usr/bin/uprecords) installed.
Make sure you check the md5sum part, can be very usefull :-)

Comments:

Comment from: BaSS [Visitor] · http://www.josealberto.org
mmm... i saw this script before :P

regards
PermalinkPermalink 05/23/05 @ 20:37
Comment from: Ikke [Member] · http://www.eikke.com
Hey, it's not the same thing... I did take some of your ideas (although I implemented them differently), making some things easier to read, and added new stuff...
PermalinkPermalink 05/23/05 @ 23:32
Comment from: BaSS [Visitor] · http://www.josealberto.org
yes i see :)
so you can do the same with me script: "recursos.sh summary" and you have a plain text otuput :)
so don't worry just was a joke.
I added new stuff see http://www.josealberto.org/blog/?p=31 can be interesting for you
so i will be glad if you put that based on my script :P

regards
PermalinkPermalink 05/23/05 @ 23:37
Comment from: gi5geg [Visitor] · http://www.google.com/sf905hf
dshf95g be$t rulez http://www.google.com/345gfrw dshf95g rockz
brin http://www.google.com/349gfff 45hgfhg rulez 45hgfhg brin
gi5geg brin http://www.google.com/sf905hf gi5geg brin brin
PermalinkPermalink 04/21/06 @ 00:06
Comment from: wtifmafo [Visitor] · http://nyguaqrg.com
zjedswrw xrqnbbry http://nmfltvez.com ykhnkfnr vjlflxcq
PermalinkPermalink 05/06/06 @ 01:33

Leave a comment:

Your email address will not be displayed on this site.
Your URL will be displayed.

Allowed XHTML tags: <p, ul, ol, li, dl, dt, dd, address, blockquote, ins, del, span, bdo, br, em, strong, dfn, code, samp, kdb, var, cite, abbr, acronym, q, sub, sup, tt, i, b, big, small>
(Line breaks become <br />)
(Set cookies for name, email and url)
(Allow users to contact you through a message form (your email will NOT be displayed.))

Categories

Who's Online?

  • Guest Users: 471

Misc

XML Feeds

What is RSS?