<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Using Ping to verify status in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/using-ping-to-verify-status/m-p/2603986#M853137</link>
    <description>Hi Jeff,&lt;BR /&gt;&lt;BR /&gt;You posted you script before I saw.  Oops!&lt;BR /&gt;&lt;BR /&gt;ans=`ping addr -n 1 | grep "100% packet loss"`&lt;BR /&gt;if [ X"$ans" != X ] ; then&lt;BR /&gt;unreachable&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Darrell</description>
    <pubDate>Tue, 30 Oct 2001 14:35:35 GMT</pubDate>
    <dc:creator>Darrell Allen</dc:creator>
    <dc:date>2001-10-30T14:35:35Z</dc:date>
    <item>
      <title>Using Ping to verify status</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/using-ping-to-verify-status/m-p/2603979#M853130</link>
      <description>Has anybody ever used a ping command in a script to verify the up/down status of an interface using the ip address?&lt;BR /&gt;&lt;BR /&gt;Example:&lt;BR /&gt;In my script if interface 1 goes down my script captures the ip address &amp;amp; compares it to a static list of ip addresses.  If it does not find a match it exits.  &lt;BR /&gt;&lt;BR /&gt;On the other hand if interface 2 goes down the same comparison is done, this time there is a match so the script sleeps for 3 minutes.  After 3 minutes I want to ping the ip address of interface 2 to verify that it is still down before the rest of the script runs, which sends out a page and popup box.&lt;BR /&gt;&lt;BR /&gt;Foe some reason I can't seem to get the syntax right in the ping statment as well as the results for verification.&lt;BR /&gt;&lt;BR /&gt;Any and all help is appreciated.&lt;BR /&gt;&lt;BR /&gt;Thanks Jeff&lt;BR /&gt;</description>
      <pubDate>Tue, 30 Oct 2001 14:03:35 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/using-ping-to-verify-status/m-p/2603979#M853130</guid>
      <dc:creator>Jeff Paciolla_1</dc:creator>
      <dc:date>2001-10-30T14:03:35Z</dc:date>
    </item>
    <item>
      <title>Re: Using Ping to verify status</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/using-ping-to-verify-status/m-p/2603980#M853131</link>
      <description>You'll need to post a sniplet of your code, so that we can analize it (tear it apart  - just kidding).&lt;BR /&gt;&lt;BR /&gt;live free or die&lt;BR /&gt;harry</description>
      <pubDate>Tue, 30 Oct 2001 14:13:04 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/using-ping-to-verify-status/m-p/2603980#M853131</guid>
      <dc:creator>harry d brown jr</dc:creator>
      <dc:date>2001-10-30T14:13:04Z</dc:date>
    </item>
    <item>
      <title>Re: Using Ping to verify status</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/using-ping-to-verify-status/m-p/2603981#M853132</link>
      <description>fair enough - Here is the portion of the code.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;#Determining which interface is down in NNM&lt;BR /&gt;&lt;BR /&gt;HOSTNAME=$1&lt;BR /&gt;SERINT=$2&lt;BR /&gt;DATE=$3&lt;BR /&gt;TIME=$4&lt;BR /&gt;&lt;BR /&gt;#Capturing the right data from Database text file&lt;BR /&gt;&lt;BR /&gt;SERIALIP=`awk -v HOSTNAME="${HOSTNAME}" -F";" '{if($1==HOSTNAME) {print $7}}' /opt/OV/contrib/NNM/ov&lt;BR /&gt;alarm/configinfo.txt`&lt;BR /&gt;&lt;BR /&gt;#Verifying that the interface down is the serial interface&lt;BR /&gt;&lt;BR /&gt;if [ "$SERINT" =  "$SERIALIP" ] ; then&lt;BR /&gt;        #Waiting three minutes for true outage&lt;BR /&gt;        #sleep 180&lt;BR /&gt;&lt;BR /&gt;Here is where I need help!!&lt;BR /&gt;&lt;BR /&gt;        #Verifying that interface is still down&lt;BR /&gt;        #ping $SERINT&lt;BR /&gt;        if $SERINT unreachable ; then&lt;BR /&gt;        echo "$SERINT"&lt;BR /&gt;        fi&lt;BR /&gt;&lt;BR /&gt;else&lt;BR /&gt;    echo "$DATE | $TIME | Hostname:$HOSTNAME | Interface:$SERINT\n"  &amp;gt;&amp;gt; /home/root/scripts/log/ipche&lt;BR /&gt;ckdown.log&lt;BR /&gt;    exit 0&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;Thanks&lt;BR /&gt;Jeff</description>
      <pubDate>Tue, 30 Oct 2001 14:19:59 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/using-ping-to-verify-status/m-p/2603981#M853132</guid>
      <dc:creator>Jeff Paciolla_1</dc:creator>
      <dc:date>2001-10-30T14:19:59Z</dc:date>
    </item>
    <item>
      <title>Re: Using Ping to verify status</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/using-ping-to-verify-status/m-p/2603982#M853133</link>
      <description>Hey Jeff, how about a little more info such as:  is the script running on the same box that has the interfaces you want to check?  I don't grasp what you're trying to do yet.&lt;BR /&gt;&lt;BR /&gt;Darrell</description>
      <pubDate>Tue, 30 Oct 2001 14:20:10 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/using-ping-to-verify-status/m-p/2603982#M853133</guid>
      <dc:creator>Darrell Allen</dc:creator>
      <dc:date>2001-10-30T14:20:10Z</dc:date>
    </item>
    <item>
      <title>Re: Using Ping to verify status</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/using-ping-to-verify-status/m-p/2603983#M853134</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;'sed' the output of the ping command?&lt;BR /&gt;&lt;BR /&gt;E.</description>
      <pubDate>Tue, 30 Oct 2001 14:24:25 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/using-ping-to-verify-status/m-p/2603983#M853134</guid>
      <dc:creator>Eugen Cocalea</dc:creator>
      <dc:date>2001-10-30T14:24:25Z</dc:date>
    </item>
    <item>
      <title>Re: Using Ping to verify status</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/using-ping-to-verify-status/m-p/2603984#M853135</link>
      <description>Hi Jeff,&lt;BR /&gt;&lt;BR /&gt;How about:&lt;BR /&gt;&lt;BR /&gt;/etc/ping $SERINT 8 1 | grep 100% &amp;gt;/dev/null 2&amp;gt;&amp;amp;1&lt;BR /&gt;if [ $? -eq 0 ]; then&lt;BR /&gt;echo $SERINT unreachable&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;Rgds, Robin</description>
      <pubDate>Tue, 30 Oct 2001 14:28:20 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/using-ping-to-verify-status/m-p/2603984#M853135</guid>
      <dc:creator>Robin Wakefield</dc:creator>
      <dc:date>2001-10-30T14:28:20Z</dc:date>
    </item>
    <item>
      <title>Re: Using Ping to verify status</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/using-ping-to-verify-status/m-p/2603985#M853136</link>
      <description>There are several considerations to this task. ping works with IP addresses so if you use a list of hostnames, you will run the risk of failing because DNS may not be working.  I would recommend IP addresses for reliability.&lt;BR /&gt;&lt;BR /&gt;In 10.20, ping has a nice option: -m &lt;TIMEOUT&gt; so you can override the default wait time for a ping to return (ie, ping bambam -m 3) but unfortunately, -m was removed at 11.0 and later versions.&lt;BR /&gt;&lt;BR /&gt;So an interesting design for your script would be to start a ping in the background, obtain the PID for that process using something like: PINGPID=$!, then sleep for one second, check the status of that process ID using: ps -p $PINGPID. If the process has disappeared, then it finished and you can break out of the loop.&lt;BR /&gt;&lt;BR /&gt;After some number of loops (perhaps 5 or 10), and ping is still running, just issue: kill $PINGID and report that ping failed.  Be sure to use -n to limit the number of test pings (such as -n 1) and perhaps adjust the packet size as appropriate.&lt;/TIMEOUT&gt;</description>
      <pubDate>Tue, 30 Oct 2001 14:30:44 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/using-ping-to-verify-status/m-p/2603985#M853136</guid>
      <dc:creator>Bill Hassell</dc:creator>
      <dc:date>2001-10-30T14:30:44Z</dc:date>
    </item>
    <item>
      <title>Re: Using Ping to verify status</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/using-ping-to-verify-status/m-p/2603986#M853137</link>
      <description>Hi Jeff,&lt;BR /&gt;&lt;BR /&gt;You posted you script before I saw.  Oops!&lt;BR /&gt;&lt;BR /&gt;ans=`ping addr -n 1 | grep "100% packet loss"`&lt;BR /&gt;if [ X"$ans" != X ] ; then&lt;BR /&gt;unreachable&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Darrell</description>
      <pubDate>Tue, 30 Oct 2001 14:35:35 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/using-ping-to-verify-status/m-p/2603986#M853137</guid>
      <dc:creator>Darrell Allen</dc:creator>
      <dc:date>2001-10-30T14:35:35Z</dc:date>
    </item>
    <item>
      <title>Re: Using Ping to verify status</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/using-ping-to-verify-status/m-p/2603987#M853138</link>
      <description>hi .. here is what i use ..&lt;BR /&gt;You can modify to make it into a proccess. Or you can make it a cron job. Note that the file hostnames is a seperate file that has a list of the hosts names or IPs you are trying to test. like so&lt;BR /&gt;&lt;BR /&gt;host1&lt;BR /&gt;host2&lt;BR /&gt;host3&lt;BR /&gt;192.xxx.xx.xx&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;If you are going to do it by host make sure that dns works or you have the hostsname in /etc/hosts&lt;BR /&gt;&lt;BR /&gt;Here is the script&lt;BR /&gt;&lt;BR /&gt;#!/bin/sh &lt;BR /&gt;LANG=C &lt;BR /&gt;HOSTNAME_FILE=hostnames&lt;BR /&gt;for host in $(cat $HOSTNAME_FILE) &lt;BR /&gt;do &lt;BR /&gt;ping $host -n 1 | grep -q '1 packets received' &lt;BR /&gt;if [ $? = 0 ] &lt;BR /&gt;then &lt;BR /&gt;echo "$host: OK" &lt;BR /&gt;else &lt;BR /&gt;echo "$host: FAIL" &lt;BR /&gt;fi &lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;This one will send you an email &lt;BR /&gt;&lt;BR /&gt;#!/bin/sh&lt;BR /&gt;LANG=C&lt;BR /&gt;HOSTNAME_FILE=hostnames&lt;BR /&gt;for host in $(cat $HOSTNAME_FILE)&lt;BR /&gt;do&lt;BR /&gt;ping $host -n 1 | grep -q '1 packets received'&lt;BR /&gt;if [ $? = 0 ]&lt;BR /&gt;then&lt;BR /&gt;echo "$host: OK"&lt;BR /&gt;else&lt;BR /&gt;echo "$host: FAIL" | mailx -s "hostdown" user@domain&lt;BR /&gt;fi&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 30 Oct 2001 16:34:55 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/using-ping-to-verify-status/m-p/2603987#M853138</guid>
      <dc:creator>someone_4</dc:creator>
      <dc:date>2001-10-30T16:34:55Z</dc:date>
    </item>
    <item>
      <title>Re: Using Ping to verify status</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/using-ping-to-verify-status/m-p/2603988#M853139</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;I use like this&lt;BR /&gt;&lt;BR /&gt;  if [ -n "`ping $1 64 1 | grep icmp`" ]&lt;BR /&gt;    then echo "ALIVE"&lt;BR /&gt;    else echo "DEAD"&lt;BR /&gt;    fi ;;&lt;BR /&gt;&lt;BR /&gt;-USA..&lt;BR /&gt;</description>
      <pubDate>Tue, 30 Oct 2001 16:39:10 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/using-ping-to-verify-status/m-p/2603988#M853139</guid>
      <dc:creator>Uday_S_Ankolekar</dc:creator>
      <dc:date>2001-10-30T16:39:10Z</dc:date>
    </item>
    <item>
      <title>Re: Using Ping to verify status</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/using-ping-to-verify-status/m-p/2603989#M853140</link>
      <description>Hi Jeff,&lt;BR /&gt;Look this thread from yesterday.&lt;BR /&gt;Lauri was trying to do may be same thing as you want&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0x73bee7726eccd5118ff10090279cd0f9,00.html" target="_blank"&gt;http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0x73bee7726eccd5118ff10090279cd0f9,00.html&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Sachin</description>
      <pubDate>Tue, 30 Oct 2001 16:51:04 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/using-ping-to-verify-status/m-p/2603989#M853140</guid>
      <dc:creator>Sachin Patel</dc:creator>
      <dc:date>2001-10-30T16:51:04Z</dc:date>
    </item>
  </channel>
</rss>

