Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Ping Servers Script

Posted on 2012-03-19
3
Medium Priority
?
398 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Prepare for your VMware VCP6-DCV exam.

Josh Coen and Jason Langer have prepared the latest edition of VCP study guide. Both authors have been working in the IT field for more than a decade, and both hold VMware certifications. This 163-page guide covers all 10 of the exam blueprint sections.

Question has a verified solution.

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

A brief overview to explain gateways, default gateways and static routes OR NO - you CANNOT have two default gateways on the same server, PC or other Windows-based network device. In simple terms a gateway is formed when a computer such as a serv…
An article on effective troubleshooting
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…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…

715 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