Sponsored Content
Top Forums Shell Programming and Scripting Animation Ping on Solaris Like Cisco Ping Post 302579035 by kshji on Sunday 4th of December 2011 04:12:59 AM
Old 12-04-2011
Tested in Linux:
Code:
#!/bin/bash 
#or ksh93
[ $# -lt 2 ] && echo "usage:$0 count dest " >&2 && exit 1

Cnt=$1
Dest=$2
Bold=$(tput bold )
BoldOff=$(tput sgr0 )
ok=0
notok=0

start=$(date '+%Y-%m-%d %T' )
echo "Sending $Cnt Ping Packets to $Dest"
i=1
while ((i<=Cnt))
do
        data=$(ping -n -c 1 $Dest | grep "1 packets transmitted" )
        case "$data" in
                *100%*packet*loss*)
                        ((notok+=1))
                        echo -n !
                        ;;
                *)      ((ok+=1))
                        echo -n .
                        ;;
        esac
        sleep 1
        ((i+=1))
done
echo
end=$(date '+%Y-%m-%d %T' )
((success=ok*100 / Cnt ))
((loss=notok*100 / Cnt ))
echo "$Bold % $success success... % $loss packet loss... $BoldOff"
echo "$start - $end "

 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Solaris Based Ping Sweeper

good morning, anybody know of a good Freeware ping sweeper for Solaris, I've been given the job of finding active IP's on the network, would like a tool which can search for range or address's do you know of anything cheers Kie (2 Replies)
Discussion started by: kie
2 Replies

2. Shell Programming and Scripting

Perl telnet to cisco router and compare the ping ms

All Please help, i will telnet to router to obain the ping status and compare, if higher than normal latency, i will have further action.. if i do the telent and in perl script then .... e.g the result i obtain from the router will be =' Success rate is 100 percent (5/5), round-trip... (4 Replies)
Discussion started by: optimus
4 Replies

3. Solaris

Can't ping using hostname on Solaris 10

I recently installed Solaris 10 on my Sun workstation. I cannot ping using hostname from another computer on the same network. But I can ping using the IP address. Also I can ping other systems using their hostnames. Can anyone give some information regarding how to resolve this issue. (4 Replies)
Discussion started by: alpha123
4 Replies

4. Solaris

Can not ping from Solaris VMWare to Windows

Dear All, I have installed Sun Solaris 10 on VMWare 6.5 completely and i have configured IP address already. Solaris's IP Address (on VMWare) is 192.168.10.241 and Windows xp that contain VMWare IP address is 192.168.10.125, but when i ping from solaris to my windows it didn't response at all.... (3 Replies)
Discussion started by: veasnabee
3 Replies

5. Solaris

Ping Sun Solaris 10 on VmWare

Hi, i installed Sun Solaris 10 on VmWare Workstation 6.5 on my Windwos Vista PC. I would to ping solaris virtual machin froma my pc, but i can't do that. Can help me?! I'm sorry for my bad English. akela87 (2 Replies)
Discussion started by: akela87
2 Replies

6. Solaris

solaris ping timeout

Hi, I have two solaris 9 servers on the same switch, primary int0: 10.35.65.51 int1: 10.35.65.53 warm standby int0: 10.35.65.52 int1: 10.35.65.54 Primary server communicates with the other for db replication on int0 interfaces. But meanwhile we are using web interface running... (8 Replies)
Discussion started by: magnimious
8 Replies

7. Solaris

Unable to ping Solaris VM from Xp host

Hi All, I am using Vmware Workstation 6.0.3 build-80004. Guest OS: Solaris 10 Host OS : Win XP I am getting request time out when i am trying to ping from XP ( cmd line) to Solaris VM - I have assigned IP 192.168.50.5 in Solaris VM ( Hostname: Tower1) and it is in UP status. ... (4 Replies)
Discussion started by: saurabh84g
4 Replies

8. Solaris

Solaris 10 - ping network issue

Hi, I'am begineer in this OS. I've installed it few days ago only to perform project "Managing users in Solaris". I have to create two virtual systems in eg. vmware , connect them and eg. rlogin from user1/machine1 to user2/machine2, give them some permissions to write read etc (this is... (1 Reply)
Discussion started by: michael.pelc
1 Replies

9. Shell Programming and Scripting

How to get reason for ping failure using perls Net::Ping->new("icmp");?

Hi I am using perl to ping a list of nodes - with script below : $p = Net::Ping->new("icmp"); if ($p->ping($host,1)){ print "$host is alive.\n"; } else { print "$host is unreacheable.\n"; } $p->close();... (4 Replies)
Discussion started by: tavanagh
4 Replies

10. 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
Smokeping_probes_IOSPing(3)					     SmokePing					       Smokeping_probes_IOSPing(3)

NAME
Smokeping::probes::IOSPing - Cisco IOS Probe for SmokePing SYNOPSIS
*** Probes *** +IOSPing binary = /usr/bin/rsh # mandatory forks = 5 offset = 50% packetsize = 56 step = 300 timeout = 15 # The following variables can be overridden in each target section ioshost = my.cisco.router # mandatory iosint = Ethernet 1/0 iosuser = admin pings = 5 # [...] *** Targets *** probe = IOSPing # if this should be the default probe # [...] + mytarget # probe = IOSPing # if the default probe is something else host = my.host ioshost = my.cisco.router # mandatory iosint = Ethernet 1/0 iosuser = admin pings = 5 DESCRIPTION
Integrates Cisco IOS as a probe into smokeping. Uses the rsh / remsh protocol to run a ping from an IOS device. VARIABLES
Supported probe-specific variables: binary The binary option specifies the path of the binary to be used to connect to the IOS device. Commonly used binaries are /usr/bin/rsh and /usr/bin/remsh, although any script or binary should work if can be called as /path/to/binary [ -l user ] router ping to produce the IOS ping dialog on stdin & stdout. Example value: /usr/bin/rsh This setting is mandatory. forks Run this many concurrent processes at maximum Example value: 5 Default value: 5 offset If you run many probes concurrently you may want to prevent them from hitting your network all at the same time. Using the probe- specific offset parameter you can change the point in time when each probe will be run. Offset is specified in % of total interval, or alternatively as 'random', and the offset from the 'General' section is used if nothing is specified here. Note that this does NOT influence the rrds itself, it is just a matter of when data acqusition is initiated. (This variable is only applicable if the variable 'concurrentprobes' is set in the 'General' section.) Example value: 50% packetsize The (optional) packetsize option lets you configure the packetsize for the pings sent. Default value: 56 step Duration of the base interval that this probe should use, if different from the one specified in the 'Database' section. Note that the step in the RRD files is fixed when they are originally generated, and if you change the step parameter afterwards, you'll have to delete the old RRD files or somehow convert them. (This variable is only applicable if the variable 'concurrentprobes' is set in the 'General' section.) Example value: 300 timeout How long a single 'ping' takes at maximum Example value: 15 Default value: 5 Supported target-specific variables: ioshost The ioshost option specifies the IOS device which should be used for the ping. Example value: my.cisco.router This setting is mandatory. iosint The (optional) iosint option allows you to specify the source address or interface in the IOS device. The value should be an IP address or an interface name such as "Ethernet 1/0". If this option is omitted, the IOS device will pick the IP address of the outbound interface to use. Example value: Ethernet 1/0 iosuser The (optional) iosuser option allows you to specify the remote username the IOS device. If this option is omitted, the username defaults to the default user used by the remsh command (usually the user running the remsh command, ie the user running SmokePing). Example value: admin pings How many pings should be sent to each target, if different from the global value specified in the Database section. Note that the number of pings in the RRD files is fixed when they are originally generated, and if you change this parameter afterwards, you'll have to delete the old RRD files or somehow convert them. Example value: 5 AUTHORS
Paul J Murphy <paul@murph.org> based on Smokeping::probes::FPing by Tobias Oetiker <tobi@oetiker.ch> NOTES
IOS Configuration The IOS device must have rsh enabled and an appropriate trust defined, eg: ! ip rcmd rsh-enable ip rcmd remote-host smoke 192.168.1.2 smoke enable ! Some IOS devices have a maximum of 5 VTYs available, so be careful not to hit a limit with the 'forks' variable. Password authentication It is not possible to use password authentication with rsh or remsh due to fundamental limitations of the protocol. Ping packet size The FPing manpage has the following to say on the topic of ping packet size: Number of bytes of ping data to send. The minimum size (normally 12) allows room for the data that fping needs to do its work (sequence number, timestamp). The reported received data size includes the IP header (normally 20 bytes) and ICMP header (8 bytes), so the minimum total size is 40 bytes. Default is 56, as in ping. Maximum is the theoretical maximum IP datagram size (64K), though most systems limit this to a smaller, system-dependent number. 2.6.8 2013-03-17 Smokeping_probes_IOSPing(3)
All times are GMT -4. The time now is 11:15 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy