Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Ping Servers Script

Posted on 2012-03-19
3
Medium Priority
?
400 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 2000 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

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

Many of us in IT utilize a combination of roaming profiles and folder redirection to ensure user information carries over from one workstation to another; in my environment, it was to enable virtualization without needing a separate desktop for each…
This is the first one of a series of articles I’ll be writing to address technical issues that are always referred to as network problems. The network boundaries have changed, therefore having an understanding of how each piece in the network  puzzl…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…

885 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