Implicit Ping


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Implicit Ping
# 1  
Old 11-10-2004
Question Implicit Ping

Hi All

I want some help in writing a script that will:
1. Implicitly ping a server to see if it is up or not. (I have blocked all ICMP traffic on that box)
2. if the server is down send an alert mail to users

I have looked and looked but I could not get any way to do this. What I have thought of doing is:

1. Send an email to a particular user on the host box every 15 mins.
2. Have a script on the host to check the mailbox every 15 mins and delete that message.
3. If there is no mail in the mailbox... send the alert.

This will accomplish the implicit ping. But:
a. Is there a way to do this using shell/ perl scripts? - 2-3
b. Are there some security concerns in this kind of a solution?
c. Is there some other way I could accomplish implicit pinging of the server?

Any advise would be appreciated!

regards

KS
# 2  
Old 11-10-2004
There are myriad ways to do this at the application level. Most are actually better (from an information management) than ping because they use information at a higher level in the protocol stack.

You can either using (1) polling or (2) sending a trap. Ping is an example of a polling technique. An SNMP trap is an example of a trap, obviously.

Both have advantages and disadvantages.
# 3  
Old 11-11-2004
One of the best way is to do a rsh to the client.
Pinging -> Does not eliminate the possibility that the server id down at ok promp but network is alive.

If you have security concern regarding rsh, you can use ftp to do that.

You can check use .netrc to search google on how to automate ftp or look at my monitoring script below...

#!/bin/ksh
#
# Created: Steven Koh on Apr 1st 2004
# Last Amended: Steven Koh on Apr 1st 2004
# Last checked: Steven Koh on xxx
#
# Solaris Monitor Ftp Script
# Purpose: Monitors servers via use of the ftp command
# and notifies via email.
# Usage: Execute from crontab every 15 minutes.
# Dependencies: $HOME/.netrc
# Outputs: E-mail, SNMP
#***************************************************

CONF_FILE=/usr/local/scripts/monitor.conf

SCRIPTDIR=`grep "SCRIPTDIR" $CONF_FILE | awk -F= '{print $NF}'`

# The directory this script resides in
ADMINDIR=$SCRIPTDIR/monitorFTP

MAILADD=$LOGNAME@localhost
SMS_LIST=$HOME/sms.List

# Define the hostname of the server
SRVNM=`uname -n`

# Define the hostname of the SNMP server
SNMP_SRV=`grep "SNMP_SRV" $CONF_FILE | awk -F= '{print $NF}'`
SEND_TRAP=`grep "SEND_TRAP" $CONF_FILE | awk -F= '{print $NF}'`
SEND_SMS=`grep "SEND_SMS" $CONF_FILE | awk -F= '{print $NF}'`

touch ftp.test
grep machine $HOME/.netrc | awk '{print $2}' > $HOME/mon_ftp.dat

grep -v "#" $HOME/mon_ftp.dat |
while read -r SRVNM
do
echo "put ftp.test" | ftp $SRVNM

if test `echo "ls ftp.test" | ftp $SRVNM | grep -v "No such file or directory" | grep -c ftp.test` -ne
1; then

echo "Unable to FTP to $SRVNM"

# Wait 1 min before checking again
sleep 60

if test `echo "ls ftp.test" | ftp $SRVNM | grep -v "No such file or directory" | grep -c ftp.test` -
ne 1; then

echo "Unable to FTP to $SRVNM"

mail $MAILADD <<EOF
From: $0
To: $MAILADD
Subject: Unable to FTP to $SRVNM

Unable to FTP to $SRVNM

EOF

# Sending SMS
$SEND_SMS $SMS_LIST "FTP001_$SRVNM: Unable to FTP to $SRVNM. Check if network/ftp is down"

fi
fi

done
exit 0
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Programming

Ping test sends mail when ping fails

help with bash script! im am working on this script to make sure my server will stay online, so i made this script.. HOSTS="192.168.138.155" COUNT=4 pingtest(){ for myhost in "$@" do ping -c "$COUNT" "$myhost" &&return 1 done return 0 } if pingtest $HOSTS #100% failed... (4 Replies)
Discussion started by: mort3924
4 Replies

2. Shell Programming and Scripting

Implicit FTPS error on Citrix Sharefile

Hi, I have to upload a file to a remote Citrix Sharefile server using implicit FTPS. But the problem I'm facing is that when the FTPS UNIX script is called through a GUI tool; it keeps on running and after forcibly killing that job, if I try to connect the same server directly from the UNIX box... (1 Reply)
Discussion started by: dips_ag
1 Replies

3. UNIX for Advanced & Expert Users

FTP over implicit TLS

Here are the essentials: un: myuser pw: mypasswd site: sftp.somesite.com port: 990 type: FTPS enc: FTP over implicit TLS program used: Curl 7.1.x on Hpux 11.31 I would like to "put" 1 file on there server. Here is my syntax, what am I doing wrong? curl -3 -v --cacert... (4 Replies)
Discussion started by: olyanderson
4 Replies

4. UNIX for Dummies Questions & Answers

FTP over implicit TSL - for dummies

Here are the essentials: un: myuser pw: mypasswd site: sftp.somesite.com port: 990 type: FTPS enc: FTP over implicit TLS program used: Curl 7.1.x on Hpux 11.31 I would like to "put" 1 file on there server. Here is my syntax, what am I doing wrong? curl -3 -v --cacert... (5 Replies)
Discussion started by: olyanderson
5 Replies

5. SuSE

RPM implicit dependencies

Hi, I'm having issues with implicit dependencies for my RPM package. This is the error I'm getting: error: Failed dependencies: libclntsh.so.11.1()(64bit) is needed by geomatica-10.4-0.x86_64 Our software has a dynamically loaded library which links to the Oracle's libclntsh.so.11.1... (2 Replies)
Discussion started by: pneveu
2 Replies

6. UNIX for Dummies Questions & Answers

Automating ftp job using implicit ssl?

Can this be done? Or do you need some other program installed on the AIX box? (6 Replies)
Discussion started by: NycUnxer
6 Replies

7. Programming

implicit declaration of function 'reboot'

Hi, I'm tying to use the following function to reboot the system as part of my code #include <unistd.h> #include <linux/reboot.h> int restart(unsigned int delay) { sleep(delay); return reboot(LINUX_REBOOT_CMD_RESTART); } When I try to compile the code I get the warning in the... (2 Replies)
Discussion started by: galapogos
2 Replies

8. Shell Programming and Scripting

FTP/implicit SSL

Hi, I want to FTP can some one help me how do I do this manually from unix command line Thanks, (2 Replies)
Discussion started by: sridatos
2 Replies

9. AIX

Implicit login in AIX

only wanted to know .. if I have some tivoli jobs running with different user .. will this mean that everytime the job invokes .. the .profile runs for that user ... or is it that the .profile runs only at explicit LOGINs ... e.g if a cron calls a job under some user, does it run the .profile of... (1 Reply)
Discussion started by: rajesh_149
1 Replies

10. Programming

gcc warnings: implicit declaration of function...

I am having strange warnings from gcc compiler, which I don't think should come while cmpiling. Can anyone help? The warnings are: - warning: implicit declaration of function 'bzero' - warning: implicit declaration of function 'inet_addr' The code is as below: int main(int argc, char... (2 Replies)
Discussion started by: Ahsan
2 Replies
Login or Register to Ask a Question