Connectivity testing script

If you have a program or script that you'd like to give away or sell, this is the place to do it. All offers should include contact info.

Moderators: BBear, theunknownhost, flaguy

Post Reply
User avatar
Arf
Official Test Penquin
Posts: 9103
Joined: Tue Apr 09, 2002 12:00 am
Location: IDAHO, USA
Contact:

Connectivity testing script

Post by Arf » Wed Jan 02, 2008 11:15 pm

Problem: dedicated server connectivity is continuously and intermittently failing. Site randomly but regularly time out. Reload and then they do. Navisite cannot reproduce problem.

Solution: sitechecker.sh script
This script uses wget to download the home page from every single site on the server. When site takes longer than 9 seconds it logs it. When site times out, it logs it. Now I can prove to you NOC that there really is a problem and I can reproduce it all day long.

SITECHECKER.SH (main script)

Code: Select all

#!/bin/bash
# Tests site loading on an off network server for failures
# SiteChecker by Thomas Leo
PATH="/root/"  #Path to program
SITELIST="sitelist.txt" #test file with list of sites http://sitename.com
MAXTIME="9"  # delay in seconds before site is logged
TIMEOUT="15" # seconds before timeout

while read SITENAME; do
        > $PATH/wgetresults.txt

        BEFORE=`/bin/date +%s`
        /usr/bin/wget -S -T$TIMEOUT -O $PATH/index.html -o $PATH/wgetresults.txt $SITENAME/
        /bin/rm $PATH/index.html
        AFTER=`/bin/date +%s`

        LOADTIME=`echo $(($AFTER-$BEFORE))`
        if [ $LOADTIME -gt $MAXTIME ]; then
                echo -e "======================================\n$SITENAME\tTime to load: $LOADTIME\t`/bin/date`\n" >> $PATH/sitechecker.log
                echo -e "======================================\n$SITENAME\tTime to load: $LOADTIME\n"
                /bin/cat $PATH/wgetresults.txt >> $PATH/sitechecker.log
                /bin/cat $PATH/wgetresults.txt
        fi

        /bin/rm -f $PATH/index.html*

done < $PATH/$SITELIST


Other files required:

sitelist.txt - text file that lists one site per line

Code: Select all

http://siteone.com
http://sitetwo.com
http://sitethree.com


Program can be run as a cron. I suggest every 12 to 14 minutes. results are logged in a file named sitechecker.log

Now you can provide your NOC with a log showing problems rather than having them check the sites in their browser and dismissing your experience because they cannot reproduce the issue.

User avatar
Okidoki
Official Test Penquin
Posts: 2179
Joined: Mon Jan 13, 2003 12:48 pm

Post by Okidoki » Thu Jan 03, 2008 12:57 am

Thanks Arf.

I sent in 2 weeks 50 tracert (outage) any answer of Navisite
Okidoki

User avatar
Arf
Official Test Penquin
Posts: 9103
Joined: Tue Apr 09, 2002 12:00 am
Location: IDAHO, USA
Contact:

Post by Arf » Thu Jan 03, 2008 2:40 am

Okidoki wrote:Thanks Arf.

I sent in 2 weeks 50 tracert (outage) any answer of Navisite

The next thing they asked for were traceroutes. I told them that they aren't showing anything but an intermittent problem and I explained that the problem is occurring from 3 completely different locations and ISPs. But maybe the traces will help, maybe not. However, I can now prove to them that there is an ongoing, repeatable, testable, problem. That was the goal.

They can go and get a server off network if they wish to test it themselves. They can use my script here as well. It's up to the NOC to figure it out from there.

User avatar
Arf
Official Test Penquin
Posts: 9103
Joined: Tue Apr 09, 2002 12:00 am
Location: IDAHO, USA
Contact:

Post by Arf » Thu Jan 03, 2008 7:21 pm

Update: I installed the script on a Navisite dedicated server and guess what? It revealed that you don't have to be off network to experience the problem. I'm not sure what the points to? Anyway, at least now they can test it directly and see the result. Maybe this will help them in figuring out the problem. I sure hope so.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest