<?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: shell script using PING  command in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-using-ping-command/m-p/2834654#M89818</link>
    <description>Adding to Bill's thought.  I have not seen them but, have been told there are NIC's that will respond to a ping even if the system is down.  You do need something more interactive with the system like checking uptime.&lt;BR /&gt;</description>
    <pubDate>Wed, 30 Oct 2002 14:35:49 GMT</pubDate>
    <dc:creator>Dave Wherry</dc:creator>
    <dc:date>2002-10-30T14:35:49Z</dc:date>
    <item>
      <title>shell script using PING  command</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-using-ping-command/m-p/2834649#M89813</link>
      <description>I am looking for script &lt;BR /&gt;which will read the file(contains IP address only)&lt;BR /&gt;and check the each IPaddress responce from the PING command,&lt;BR /&gt;and generates/append the file output for each IP address log file&lt;BR /&gt;(MONTH_IPADDRESS.XLS).&lt;BR /&gt;(MMDDHHMI  - means MONTH date hours minutes - )&lt;BR /&gt;&lt;BR /&gt;MONTH_IPADDRESS.XLS&lt;BR /&gt;if the PING is successful(0% pocket loss),&lt;BR /&gt;then append the follwing data &lt;BR /&gt;&lt;BR /&gt;--------------------&lt;BR /&gt;MMDDHHMI   100&lt;BR /&gt;---------------------&lt;BR /&gt;&lt;BR /&gt;if the PING is not successful(100% pocket loss),&lt;BR /&gt;then append the follwing data &lt;BR /&gt;&lt;BR /&gt;--------------------&lt;BR /&gt;MMDDHHMI   0&lt;BR /&gt;---------------------&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;if the date is 1st of the month&lt;BR /&gt;the file (MONTH_IPADDRESS.XLS)&lt;BR /&gt;should be created , otherwise appended.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;$cat ipfile&lt;BR /&gt;IPADDRESS1&lt;BR /&gt;IPADDRESS2&lt;BR /&gt;IPADDRESS3&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;$cat MM_IPADDRESS1.xls&lt;BR /&gt;10281010    100&lt;BR /&gt;10281020    100&lt;BR /&gt;10281030    100        - 100 is uptime.&lt;BR /&gt;10281040     0         - 0 is downtime.&lt;BR /&gt;10281050     0&lt;BR /&gt;10281100    100&lt;BR /&gt;10281110    100&lt;BR /&gt;10281115    100&lt;BR /&gt;MMDDHHMI    100&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;(basically I am trying to generate excel file&lt;BR /&gt; to show the graph of UPTIME of all the servers)&lt;BR /&gt;&lt;BR /&gt;Thnx in Advance .&lt;BR /&gt;VB&lt;BR /&gt;</description>
      <pubDate>Mon, 28 Oct 2002 20:20:54 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-using-ping-command/m-p/2834649#M89813</guid>
      <dc:creator>vas  bolpali</dc:creator>
      <dc:date>2002-10-28T20:20:54Z</dc:date>
    </item>
    <item>
      <title>Re: shell script using PING  command</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-using-ping-command/m-p/2834650#M89814</link>
      <description>Try This!!&lt;BR /&gt;#! /bin/sh&lt;BR /&gt;&lt;BR /&gt;host=`cat ipfile`&lt;BR /&gt;for item in $host&lt;BR /&gt;do&lt;BR /&gt;echo "Checking  $host..."&lt;BR /&gt;ping_status=`ping $host 10|grep 'no answer'`&lt;BR /&gt;if [ "ping_status" ]; then&lt;BR /&gt;echo "$host NOT RESPONDING"&lt;BR /&gt;echo " "&lt;BR /&gt;continue&lt;BR /&gt;fi&lt;BR /&gt;echo "$host UP"&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Ofcourse this is going to generate a  TEXT file which you can import to Excel. You could also modify the echo commands to suit ur needs.&lt;BR /&gt;Cheers&lt;BR /&gt;Govind</description>
      <pubDate>Mon, 28 Oct 2002 20:36:43 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-using-ping-command/m-p/2834650#M89814</guid>
      <dc:creator>Govind</dc:creator>
      <dc:date>2002-10-28T20:36:43Z</dc:date>
    </item>
    <item>
      <title>Re: shell script using PING  command</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-using-ping-command/m-p/2834651#M89815</link>
      <description>I'll give you the key to this puzzle. A perl script called 'ping.pl'.&lt;BR /&gt;&lt;BR /&gt;ping.pl -t 10 remote_host &lt;BR /&gt;STAT=${?} &lt;BR /&gt;if [[ ${STAT} -eq 0 ]] &lt;BR /&gt;then &lt;BR /&gt;echo "Host ok" &lt;BR /&gt;else &lt;BR /&gt;echo "Host Bad" &lt;BR /&gt;fi &lt;BR /&gt;&lt;BR /&gt;and a timeout of 10 seconds is set. &lt;BR /&gt;&lt;BR /&gt;Invoke it as ping.pl -u for full usage. &lt;BR /&gt;&lt;BR /&gt;The idea is to call the perl script for each host and simply look at the return status - 0 means good. That's much easier than parsing for packet loss and it includes an adjustable timeout.&lt;BR /&gt;&lt;BR /&gt;The rest of the script should be very easy but is left as an exercise for the reader.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Regards, Clay&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 28 Oct 2002 20:59:12 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-using-ping-command/m-p/2834651#M89815</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2002-10-28T20:59:12Z</dc:date>
    </item>
    <item>
      <title>Re: shell script using PING  command</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-using-ping-command/m-p/2834652#M89816</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;Normally I don't reply with an entire script but here's one for you.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;&lt;BR /&gt;hostsfile=/tmp/hosts_to_ping&lt;BR /&gt;&lt;BR /&gt;DAY=`date +%d`&lt;BR /&gt;&lt;BR /&gt;cat $hostsfile | while read addr&lt;BR /&gt;do&lt;BR /&gt;        OUTFILE=`date +%b`_$addr.XLS&lt;BR /&gt;&lt;BR /&gt;        if [ $DAY = 1 ]&lt;BR /&gt;        then&lt;BR /&gt;                &amp;gt;$OUTFILE&lt;BR /&gt;        fi&lt;BR /&gt;&lt;BR /&gt;        /usr/sbin/ping $addr -n 3 | grep -q "100% packet loss"&lt;BR /&gt;        if [ $? != 0 ]&lt;BR /&gt;        then&lt;BR /&gt;                # location is up&lt;BR /&gt;                PCT=100&lt;BR /&gt;        else&lt;BR /&gt;                # location is down&lt;BR /&gt;                PCT=0&lt;BR /&gt;        fi&lt;BR /&gt;        echo `date +%m%d%H%M` $PCT &amp;gt;&amp;gt;$OUTFILE&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;I wouldn't trust the results of 1 single ping (hence -n 3).&lt;BR /&gt;&lt;BR /&gt;Darrell</description>
      <pubDate>Mon, 28 Oct 2002 21:13:09 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-using-ping-command/m-p/2834652#M89816</guid>
      <dc:creator>Darrell Allen</dc:creator>
      <dc:date>2002-10-28T21:13:09Z</dc:date>
    </item>
    <item>
      <title>Re: shell script using PING  command</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-using-ping-command/m-p/2834653#M89817</link>
      <description>If the true state of the machine is needed, ping is very poor metric. The response occurs at a low level in the kernel so you may get a ping from a badly locked up server. True, if the server is not responding to the network, ping will fail but that may also be a network (switch, router, cable) problem.&lt;BR /&gt;&lt;BR /&gt;What makes more sense is to use ping as a front end, then remsh (remote shell) or ssh to query the server for it's current uptime.</description>
      <pubDate>Tue, 29 Oct 2002 03:44:12 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-using-ping-command/m-p/2834653#M89817</guid>
      <dc:creator>Bill Hassell</dc:creator>
      <dc:date>2002-10-29T03:44:12Z</dc:date>
    </item>
    <item>
      <title>Re: shell script using PING  command</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-using-ping-command/m-p/2834654#M89818</link>
      <description>Adding to Bill's thought.  I have not seen them but, have been told there are NIC's that will respond to a ping even if the system is down.  You do need something more interactive with the system like checking uptime.&lt;BR /&gt;</description>
      <pubDate>Wed, 30 Oct 2002 14:35:49 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-using-ping-command/m-p/2834654#M89818</guid>
      <dc:creator>Dave Wherry</dc:creator>
      <dc:date>2002-10-30T14:35:49Z</dc:date>
    </item>
  </channel>
</rss>

