Solaris ping report failed packet script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Solaris ping report failed packet script
# 1  
Old 10-08-2015
Solaris ping report failed packet script

Hello,
on Solaris ping command does not report failed packet as in i.e. Windows (Connection timeout)
Instead it reports the sequence of the sent packet:

Code:
64 bytes from 10.80.4.120: icmp_seq=11. time=36.0 ms
64 bytes from 10.80.4.120: icmp_seq=12. time=35.9 ms
64 bytes from 10.80.4.120: icmp_seq=13. time=38.0 ms
64 bytes from 10.80.4.120: icmp_seq=14. time=35.8 ms
64 bytes from 10.80.4.120: icmp_seq=15. time=35.9 ms
64 bytes from 10.80.4.120: icmp_seq=68. time=50.2 ms
64 bytes from 10.80.4.120: icmp_seq=69. time=35.2 ms
64 bytes from 10.80.4.120: icmp_seq=70. time=36.0 ms
64 bytes from 10.80.4.120: icmp_seq=71. time=35.4 ms
64 bytes from 10.80.4.120: icmp_seq=72. time=35.8 ms

I am trying to create a script ie. while read line in order to check differences icmp_seq so if next_seq-prev_seq > 1 give a message like ping failed. Can somebody please help ?

Moderator's Comments:
Mod Comment Use code tags, thanks.

Last edited by zaxxon; 10-08-2015 at 11:22 AM.. Reason: code tags
# 2  
Old 10-08-2015
Any attempts from your side?
# 3  
Old 10-08-2015
Sorry for the code tags. Since it not actually code but a command output I thought it is not required.

I tried while read line to store seq no in perform the subtraction but no luck.
# 4  
Old 10-08-2015
Howsoever, try
Code:
awk '
                {sub (/icmp_seq=/, "", $5) 
                }
NR==1           {last=$5
                } 
$5-last > 1     {print "ping failed"
                }
                {last=$5
                }
' file
ping failed

This User Gave Thanks to RudiC For This Post:
# 5  
Old 10-08-2015
Quote:
Originally Posted by drbiloukos
Sorry for the code tags. Since it not actually code but a command output I thought it is not required.

I tried while read line to store seq no in perform the subtraction but no luck.
Moderator's Comments:
Mod Comment You have been given 5 infractions with associated e-mail explicitly stating that CODE tags are required when displaying sample input, sample output, and code segments.

Please use CODE tags when displaying sample input. Please use CODE tags when displaying sample output. And, please use CODE tags when displaying code.
# 6  
Old 11-02-2015
Code:
awk: syntax error near line 2
awk: illegal statement near line 2

# 7  
Old 11-02-2015
As Don Cragun always says:
"If you are using a Solaris/SunOS system, use /usr/xpg4/bin/awk or nawk instead of awk ."
This User Gave Thanks to RudiC For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. AIX

Ping to remote host failed

Actually. I was getting a ping to remote host failed for one of my etherchannel. When I checked it was in backup adapter and again I use to faileover and brought to primary channel. But it was again going to backup channel and giving me the alert ping to remotehost failed. When I checked the load... (3 Replies)
Discussion started by: Mohamed Thamim
3 Replies

2. AIX

Packet loss coming with big packet size ping

(5 Replies)
Discussion started by: Vishal_dba
5 Replies

3. Linux

Ping check failed from Nagios master server on windows hosts in the same subnet

Hello All, We have added a windows host and its config files to Nagios master server and wanted to do a ping check alone at the moment however, the nagios master server identifies the host in its GUI and immediately disappears can anyone let me know the right approach to this one, We want to... (2 Replies)
Discussion started by: lovesaikrishna
2 Replies

4. Shell Programming and Scripting

Calculate packet in/out interval script

Hello I'm trying to find interval for packet IN/OUT for a gateway. log looks like: 02.12.2011 16.28.29:200 PDU IN CI:424 TRID:200 ID:N/A EID:N/A EX:N/A PDU:0000001f0000000100000000000000c874746f700074746f70000034010100 02.12.2011 16.28.29:228 PDU OU CI:424 TRID:200 ID:N/A EID:N/A EX:ACK... (3 Replies)
Discussion started by: samer.odeh
3 Replies

5. Shell Programming and Scripting

Animation Ping on Solaris Like Cisco Ping

Hi, I develop simple animation ping script on Solaris Platform. It is like Cisco ping. Examples and source code are below. bash-3.00$ gokcell 152.155.180.8 30 Sending 30 Ping Packets to 152.155.180.8 !!!!!!!!!!!!!.!!!!!!!!!!!!!!!. % 93.33 success... % 6.66 packet loss...... (1 Reply)
Discussion started by: gokcell
1 Replies

6. Solaris

Solaris 2.6 looking for ARP/RARP packet

Hi Everybody :) This is my first post concerning Solaris 2.6 trying to boot on a Tadpole SparcBook 3. I bought the laptop from somebody who configured it for his network. For the moment I want it as a non-networked standalone machine, or at least have that option. On trying to boot I get an... (0 Replies)
Discussion started by: JuBiLeE_50_05
0 Replies

7. Solaris

Need help with configuring large packet size on Solaris 7 / e6500

Greetings, I'm stuck in a time warp using ancient machines from the prehistoric era that should be rightfully displayed in the Smithsonian. We're running Solaris 7 on FDDI n/w on an E6500 host and wish to use MTU (packet size) > 1500, more like 3072 bytes to begin with and possibly up to 4096... (9 Replies)
Discussion started by: sharique
9 Replies

8. UNIX for Advanced & Expert Users

Need help with configuring large packet size on Solaris 7 / e6500

We're running Solaris 7 on FDDI n/w on an E6500 host and wish to use MTU (packet size) > 1500, more like 3072 bytes to begin with and possibly up to 4096 bytes. Linux has /etc/network/interfaces. Does ANYONE remember the equivalent in Unix? When I do ifconfig eth0 mtu 4000, I get the error... (0 Replies)
Discussion started by: sharique
0 Replies

9. Solaris

PLOGI failed state=Packet Transport error

Someone who can help me. the following error occur, what does it mean, and any possible solution you can give.thanks syslog: fp: NOTICE: fp(2): PLOGI to d5900 failed state=Packet Transport error , reason=No Connection (Database) $cat /var/adm/messages Nov 3 05:16:21 vfaus279 fp: ... (7 Replies)
Discussion started by: o_m_g
7 Replies

10. UNIX for Advanced & Expert Users

0821-077 ping: illegal packet size.

Hi, When i try this command ping ukblx151.ukhx.astrazeneca.net -n 3 | grep icmp it gives following error :mad:: 0821-077 ping: illegal packet size. But when i give command ping ukblx151.ukhx.astrazeneca.net It returns correct output.:D Could you please help? (2 Replies)
Discussion started by: vishal_ranjan
2 Replies
Login or Register to Ask a Question