Solved

Ping Servers Script

Posted on 2012-03-19
3
381 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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Greetings, Experts! First let me state that this website is top notch. I thoroughly enjoy the community that is shared here; those seeking help and those willing to sacrifice their time to help. It is fantastic. I am writing this article at th…
This article offers some helpful and general tips for safe browsing and online shopping. It offers simple and manageable procedures that help to ensure the safety of one's personal information and the security of any devices.
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

757 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now