Solved

Ping Servers Script

Posted on 2012-03-19
3
394 Views
Last Modified: 2012-03-19
Hi experts

We have some guys refitting our server room, this week, im concearned they could knock a cable out so im looking for a script to monitor the servers.

Im thinking a constant ping which emails me if a server stops responding. Any help would be greatly appreciated, IP's below.

Thanks

192.168.0.10
192.168.0.11
192.168.0.16
192.168.0.228
192.168.0.13
192.168.0.15
192.168.0.225
192.168.0.250
0
Comment
Question by:corecc
  • 2
3 Comments
 
LVL 43

Accepted Solution

by:
Steve Knight earned 500 total points
ID: 37738434
The one thing I would say is.... where is your mail server, in the server room?  What about if they knock out one of the switches, or power to it, then also no email :-)

You can certainly do this but you might be better off just having something running on a workstation.  This is a simple script I use for instance for quick checking... just add your ip's in as lines here, with a description of each.  If you add in an external IP or two then it will tell you if they have knocked out your external comms too..

KeepPinging.cmd

@Echo off
setlocal enabledelayedexpansion
set pinglog=pinglog.txt
set fail=0
CLS

echo %date%,%time%,Log Started
echo %date%,%time%,Log Started >>%pinglog%
                               
:next

REM ping some hosts

Call :pingit 158.43.128.1 "PIPEX DNS"
call :pingit 192.168.199.1, "ROUTER"
call :pingit 192.168.199.10, "SERVER1"

REM The dot on the next line is Control G "BEL" which beeps... add is using EDIT from CMD prompt.
if "%fail%"=="1" echo 

REM Wait 2 mins

call :delay10 3
goto next

exit /b

:delay10
  echo.
  echo WAITING...
  ping 192.168.200.1 -w 10000 -n %~1 >NUL 2>&1
exit /b

:pingit
echo PING %~2 [%1]
ping %1 -n 1 -w 200 >NUL || (
  echo     %date%,%time%,FAIL,%1,%~2 >> %pinglog%
  echo     %date%,%time%,FAIL,%1,%~2
  set fail=1
)
exit /b

Open in new window


Think I have a few other examples on http://scripts.dragon-it.co.uk/ , if not I will do once I upload some!

Steve
0
 
LVL 1

Author Closing Comment

by:corecc
ID: 37738551
this does the job, thanks for your help.
0
 
LVL 43

Expert Comment

by:Steve Knight
ID: 37738564
No problem, been caught out by customers' well meaning server-check scripts that email... which of course don't work when you most want them to - dns, router, internet connection, mail server down etc..
0

Featured Post

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Have you ever set up your wireless router at home or in the office to find that you little pop-up bubble in the bottom right-hand corner of Windows read "IP Conflict - One of more computers on the network have been assigned the following IP address"…
YESTERDAY YESTERDAY.BAT is inspired by a previous article I wrote entitled: TOMORROW.BAT (http://www.experts-exchange.com/OS/Microsoft_Operating_Systems/MS_DOS/A_4196-Advanced-Batch-File-Programming-TOMORROW-BAT.html). The crux of this batch f…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

820 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question