Sponsored Content
Top Forums Shell Programming and Scripting Animation Ping on Solaris Like Cisco Ping Post 302579015 by gokcell on Saturday 3rd of December 2011 09:40:25 PM
Old 12-03-2011
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.
Code:
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...
Start:04-12-2011-03:53:17
End :04-12-2011-03:54:08


bash-3.00$ gokcell 152.155.180.8 60
Sending 60 Ping Packets to 152.155.180.8
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
% 100.00 success... % 0 packet loss...
Start:04-12-2011-05:36:40
End :04-12-2011-05:37:44



bash-3.00$ more gokcell
#!/bin/bash
count1=0
count2=0
start=`date +"%d-%m-%Y-%T"`
#Developed by Goksel Yangin for STC Network 
echo
echo Sending $2 Ping Packets to $1
echo
for ((i=1; i<=$2; i++))
do
  sonuc=`/usr/sbin/ping -s $1 64 1 | grep packet | awk '{print $(NF-2)}'`
  sleep 1
  if [[ "$sonuc" == "0%" ]]
  then
    count1=`expr $count1 + 1`
    echo -n !
  else 
    count2=`expr $count2 + 1`
    echo -n .
  fi
done
end=`date +"%d-%m-%Y-%T"`
let "count1*=100"
#let "count1/=$2"
#let kalan=count1%$2 

let "count2*=100"
#let "count2/=$2"
#let kalan2=count2%$2

echo
num1=$(echo "scale=2; $count1 / $2" | bc) 
num2=$(echo "scale=2; $count2 / $2" | bc) 
#printf "\x1b[5m$num1..$num2\x1b[25m"
#echo -n % $num1 success... % $num2 packet loss...
echo -n "`tput blink`% $num1 success... % $num2 packet loss...`tput sgr0`"
echo 
echo Start:$start 
echo End :$end
echo

Regards,

Goksel Yangin
Computer Engineer

Last edited by Scott; 12-04-2011 at 07:44 AM.. Reason: Code tags, please...
 

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
AnyEvent::XMPP::Ext::Ping(3pm)				User Contributed Perl Documentation			    AnyEvent::XMPP::Ext::Ping(3pm)

NAME
AnyEvent::XMPP::Ext::Ping - Implementation of XMPP Ping XEP-0199 SYNOPSIS
use AnyEvent::XMPP::Ext::Ping; my $con = AnyEvent::XMPP::IM::Connection->new (...); $con->add_extension (my $ping = AnyEvent::XMPP::Ext::Ping->new); # this enables auto-timeout of a connection if it didn't answer # within 120 seconds to a ping with a reply $ping->enable_timeout ($con, 120); my $cl = AnyEvent::XMPP::Client->new (...); $cl->add_extension (my $ping = AnyEvent::XMPP::Ext::Ping->new); # this enables auto-timeout of newly created connections $ping->auto_timeout(120); $ping->ping ($con, 'ping_dest@server.tld', sub { my ($time, $error) = @_; if ($error) { # we got an error } # $time is a float (seconds) of the rtt if you got Time::HiRes }); DESCRIPTION
This extension implements XEP-0199: XMPP Ping. It allows you to define a automatic ping timeouter that will disconnect dead connections (which didn't reply to a ping after N seconds). See also the documentation of the "enable_timeout" method below. It also allows you to send pings to any XMPP entity you like and will measure the time it took if you got Time::HiRes. METHODS
new (%args) Creates a new ping handle. auto_timeout ($timeout) This method enables automatic connection timeout of new connections. It calls "enable_timeout" (see below) for every new connection that was connected and emitted a "stream_ready" event. This is useful if you want connections that have this extension automatically timeouted. In particular this is useful with modules like AnyEvent::XMPP::Client (see also SYNOPSIS above). enable_timeout ($con, $timeout) This enables a periodical ping on the connection $con. $timeout must be the seconds that the ping intervals last. If the server which is connected via $con didn't respond within $timeout seconds the connection $con will be disconnected. Please note that there already is a basic timeout mechanism for dead TCP connections in AnyEvent::XMPP::Connection, see also the "whitespace_ping_interval" configuration variable for a connection there. It then will depend on TCP timeouts to disconnect the connection. Use "enable_timeout" and "auto_timeout" only if you really feel like you need an explicit timeout for your connections. ping ($con, $dest, $cb, $timeout) This method sends a ping request to $dest via the AnyEvent::XMPP::Connection in $con. If $dest is undefined the ping will be sent to the connected server. $cb will be called when either the ping timeouts, an error occurs or the ping result was received. $timeout is an optional timeout for the ping request, if $timeout is not given the default IQ timeout for the connection is the relevant timeout. The first argument to $cb will be the seconds of the round trip time for that request (If you have Time::HiRes). If you don't have Time::HiRes installed the first argument will be undef. The second argument to $cb will be either undef if no error occured or a AnyEvent::XMPP::Error::IQ error object. ignore_pings ($bool) This method is mostly for testing, it tells this extension to ignore all ping requests and will prevent any response from being sent. AUTHOR
Robin Redeker, "<elmex at ta-sa.org>", JID: "<elmex at jabber.org>" COPYRIGHT &; LICENSE Copyright 2007, 2008 Robin Redeker, all rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.14.2 2012-01-23 AnyEvent::XMPP::Ext::Ping(3pm)
All times are GMT -4. The time now is 06:09 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy