Saturday, July 29, 2006

How to Buy A Hard Drive

I purchased a 250GB Parallel ATA drive recently for $75 from NewEgg. I'm quite pleased with the drive, and installed it into an external enclosure.

If you want to purchase a new consumer or prosumer-grade drive, here are some points to keep in mind:

1. Make sure the drive has at least a 3-year warranty.

2. Browse hard drive reviews and product recommendations, including those from magazine publishers. If you're in the market for a low cost drive while getting the most storage capacity for your dollar, buy a drive that's been on the market for a few months.

3. Check with small local PC shops & colleagues, and online ratings to find out which drives and/or manufacturers should be avoided. Verify the manufacturer and/or reseller has a good reputation and established procedures for returning broken or defective drives.

4. Calculate the cost per gigabyte of the drive by dividing the total price(including any applicable taxes or shipping surcharges) by the drive's capacity in gigabytes. I'll use the 250GB drive I purchased as an example:

250GB 7200 RPM 8MB Cache IDE Ultra ATA133 Hard Drive    74.99
shipping & handling    +  5.64
 $80.63
÷  250GB
=$0.32 per gigabyte


Compare the price per GB(in this case 32 cents) to other drives with similar features(SATA or PATA, noise levels, RPM, areal density). Take into account the aforementioned points and make your purchase.

Internal or External?

If you need an external storage device, then go buy an internal hard drive and put it inside an external enclosure. Works well for hard drives and DVD/CD Burners...

Friday, July 14, 2006

memused.AGI Example Script

This AGI was used in today's Sokol & Associates class, on day 5 of their bootcamp for the AGI module I taught.

It's a bash shell script that can be used with an AGI() application call in an extension on Asterisk to read back the amount of memory in use, average ping time in milliseconds, and packet loss to an external IP(4.2.2.2 - it was easy to remember).


#!/bin/sh

# Set a variable called stdin to help us
# get the variables from Asterisk
stdin="0"

# Read in the variables from Asterisk,
# and write them to a log file
while [ "$stdin" != "" ]
do
read stdin
if [ "$stdin" != EOF ]
then
echo $stdin >> /tmp/logfile.txt
fi
done

# check the amount of memory in use in megabytes
# and assign the value to a variable named memused
memused=`free -mto | grep Mem: | awk '{print $3}'`

# check the amount of average ping time
# and assign the value to a variable named avgping
avgping=`ping -q -c5 4.2.2.2 | grep = | awk '{print $4}' | cut -d / -f 2`

# check the amount of packet loss
# and assign the value to a variable named packetloss
packetloss=`ping -q -c5 4.2.2.2 | grep received | awk '{print $6}'`


# Execute the SayNumber command to verbalize
# the $memused variable
echo "EXEC SayNumber $memused"
# Execute the PlayBack command add the word "megabytes"
echo "EXEC PlayBack \"megabytes\" "
echo "EXEC PlayBack \"with\" "

echo "EXEC SayNumber $avgping"
echo "EXEC PlayBack \"ms\" "
echo "EXEC PlayBack \"ping\" "
echo "EXEC PlayBack \"time\" "
echo "EXEC PlayBack \"and\" "

echo "EXEC SayNumber $packetloss"

# Execute the PlayBack command add the word "loss"
echo "EXEC PlayBack \"percent\" "
echo "EXEC PlayBack \"loss\" "

# Execute the SayUnixTime command to verbalize a timestamp
echo "EXEC SayUnixTime \",,IMp\""


# Now read the response back from Asterisk,
# and write it to the log file
read response
echo $response >> /tmp/logfile.txt

exit 0