Archive for Utilities

What is going on… or, why is the server slow when your not around.

I’ve been called in the middle of the night with “the server is slow” being the emphasis of the call. Sometimes it’s not obvious using standard utilties, or sometimes it only happens during certain times.

I’ve used a simple script to eliminate this issue, and run it from cron every minute or 5 minutes to give me output on whats going on with the system.

This is ment for temporary use only, or at least make sure you clear the files every once and a while, because they get pretty big, thus I wrote a cyclecheck script and even a cyclerebootcheck script to see why a machine rebooted.



check script:

#!/bin/sh
echo “——————-” >> /data/`/bin/hostname`.load
echo “——————-” >> /data/`/bin/hostname`.psaux
/bin/date >> /data/`/bin/hostname`.load
/bin/date >> /data/`/bin/hostname`.psaux
/usr/bin/w >> /data/`/bin/hostname`.load
/usr/bin/w >> /data/`/bin/hostname`.psaux
ps -awux >> /data/`/bin/hostname`.psaux



cyclecheck script:
mv /data/`/bin/hostname`.psaux /data/`/bin/hostname`.psauwx.old
mv /data/`/bin/hostname`.load /data/`/bin/hostname`.load.old


cyclerebootcheck script:

mv /data/`/bin/hostname`.psaux /data/`/bin/hostname`.psauwx.reboot
mv /data/`/bin/hostname`.load /data/`/bin/hostname`.load.reboot
echo `hostname` rebooted `date` | mail pageadmin@site.com



install script:

echo “*/1 * * * * root /root/scripts/check” >> /etc/crontab
echo “1 0 * * * root /root/scripts/cyclecheck” >> /etc/crontab
echo “/root/scripts/cyclerebootcheck” /etc/rc.local
killall -HUP crond



I place them all in /root/scripts and chmod -R 755 /root/scripts, then run /root/scripts/install to place these things into the crontab.

Then you can view the output in /data/hostname-of-server.load or /data/hostname-of-server.psaux each with a timestamped entry.

——————-
Wed Nov 2 00:02:00 EDT 2005
12:02AM up 123 days, 23:45, 0 users, load averages: 0.15, 0.28, 0.24
(what users are logged on listed here)
USER TTY FROM LOGIN@ IDLE WHAT
USER PID %CPU %MEM VSZ RSS TT STAT STARTED TIME COMMAND
root 24498 0.0 0.0 984 224 ?? R 12:02AM 0:00.00 ps -awux

It works at least.. edit for directories you need, this is written for freebsd in this case.

Comments

Simple Web Statistics — awstats

I run a bunch of virtual hosted sites for friends and they’re always asking me for statistics on how many people are hitting their page.

One of the simplest programs I’ve setup is awstats..

Once you’ve downloaded the program I simply run it from the crontab every 15 minutes and let it clunk away on their stats.

I’ll post a full config howto shortly.

Comments

Knoppix — The Linux Lifesaver

Knoppix is a great bootable live operating system for x86 machines (ya know, intel boxes, windows boxes) that gives you a full XWindows implementation with utiltiies, network connectivity, and more..

I’ve used this to save my butt so many times when an OS won’t boot and I need to get to the data on the drives, or edit a config file, or even just to troubleshoot a friends PC.. I suggest getting it up on your USB keychain device and BURNING A FEW SPARE CD’S WITH IT.

I keep one in the car, in a ziplock bag just in case :)

Go Grab Knoppix now.

Comments

Putty.exe - The windows SSH Client

Everyone has used a windows machine at one point or another.. and one of the annoying thigns is that you can’t SSH using a built in program… thats why one of the first things I put onto my USB Flashdrive is Putty.exe.

This is a very straightforward SSH program for windows thats only like 200k and self contained, no installers, no nothing. I just copy the file over to C:\WINNT or whatever their windows directory is and Start->Run->Putty[ENTER] it’s perfect.

You can grab a copy here, or directly link to the exe file here.

Comments

Get A USB Flash Device

Ok, I hate to say it, and I’ve resisted this for many years, but I think the time is right that every admin should have a simple USB Flash Drive
. You can load so many useful utilities onto the damn thing that you’ll have with you at any time.

There are a bunch on the market, I’m a big fan of the 1GB Mobile Key USB Flash Drive because the damn thing is so small.. I can fit one into my wallet and never even notice it’s there, that is unless you need to use it :)

Comments

· Next entries »