|
|
Need simple ping monitoring script
Gents,
I'm in a bit of a jam without the proper tools (I have no funds for).
Just need a script (on Sol 9 server) that well telnet to port 5101
(every 2 seconds) on a specific foreign host and write the results to
a log. (Dropping the connection after each telnet attempt).
Should I do this via cron or is there a better way?
Thanks in advance
Ron W.
|
|
0
|
|
|
|
Reply
|
unixzip (36)
|
5/5/2009 8:36:44 PM |
|
You might want to try a shell script using netcat (the tcp/ip
swiss army knife), or something like that.
I just checked, my copy is 10 years old...
Netcat 1.10 is an updated release of Netcat, a simple Unix utility
which reads and writes data across network connections using TCP or
UDP protocol. It is designed to be a reliable "back-end" tool that
can be used directly or easily driven by other programs and scripts.
At the same time it is a feature-rich network debugging and exploration
tool, since it can create almost any kind of connection you would
need and has several interesting built-in capabilities.
-Mike
unixzip@yahoo.com writes:
>Gents,
>I'm in a bit of a jam without the proper tools (I have no funds for).
>Just need a script (on Sol 9 server) that well telnet to port 5101
>(every 2 seconds) on a specific foreign host and write the results to
>a log. (Dropping the connection after each telnet attempt).
>Should I do this via cron or is there a better way?
>Thanks in advance
>Ron W.
|
|
0
|
|
|
|
Reply
|
Mike
|
5/5/2009 11:49:04 PM
|
|
Hello, unixzip@yahoo.com!
u> (every 2 seconds)
....
u> Should I do this via cron or is there a better way?
cron granularity is 1 minute.
----
A
|
|
0
|
|
|
|
Reply
|
Andrew
|
5/6/2009 2:33:19 AM
|
|
unixzip@yahoo.com wrote:
> Just need a script (on Sol 9 server) that well telnet to port 5101
> (every 2 seconds) on a specific foreign host and write the results to
> a log. (Dropping the connection after each telnet attempt).
install "nc" (netcat) if you don't have it.
You should find it on blastwave.org or opencsw.org or sunfreeware.com
#!/bin/sh
while true; do
nc hostname 5101 < /dev/null >> logfile
sleep 2
done
|
|
0
|
|
|
|
Reply
|
Oscar
|
5/6/2009 2:24:50 PM
|
|
On May 6, 10:24=A0am, Oscar del Rio <del...@mie.utoronto.ca> wrote:
> unix...@yahoo.com wrote:
> > Just need a script (on Sol 9 server) that well telnet to port 5101
> > (every 2 seconds) on a specific foreign host and write the results to
> > a log. (Dropping the connection after each telnet attempt).
>
> install "nc" (netcat) if you don't have it.
> You should find it on blastwave.org or opencsw.org or sunfreeware.com
>
> #!/bin/sh
> while true; do
> =A0 =A0nc hostname 5101 < /dev/null >> logfile
> =A0 =A0sleep 2
> done
Thanks. When I try to install the netcat package it tells me that "no
acceptable C compiler is found in $PATH.
|
|
0
|
|
|
|
Reply
|
unixzip
|
5/7/2009 3:04:35 PM
|
|
unixzip@yahoo.com wrote:
> On May 6, 10:24 am, Oscar del Rio <del...@mie.utoronto.ca> wrote:
>> unix...@yahoo.com wrote:
>>> Just need a script (on Sol 9 server) that well telnet to port 5101
>>> (every 2 seconds) on a specific foreign host and write the results to
>>> a log. (Dropping the connection after each telnet attempt).
>> install "nc" (netcat) if you don't have it.
>> You should find it on blastwave.org or opencsw.org or sunfreeware.com
>>
>> #!/bin/sh
>> while true; do
>> nc hostname 5101 < /dev/null >> logfile
>> sleep 2
>> done
>
> Thanks. When I try to install the netcat package it tells me that "no
> acceptable C compiler is found in $PATH.
Then you probably need to install either Sun Studio or GCC in order to
build the software!
|
|
0
|
|
|
|
Reply
|
Richard
|
5/7/2009 4:25:09 PM
|
|
unixzip@yahoo.com wrote:
> Thanks. When I try to install the netcat package it tells me that "no
> acceptable C compiler is found in $PATH.
What file did you grab? It sounds like you grabbed a source tarball. That
isn't strictly necessary, as Blastwave, OpenCSW, and Sunfreeware all provide
precompiled versions.
Do you have root on the machine?
--
Brandon Hume - hume -> BOFH.Ca, http://WWW.BOFH.Ca/
|
|
0
|
|
|
|
Reply
|
hume
|
5/7/2009 5:46:57 PM
|
|
On May 6, 10:24=A0am, Oscar del Rio <del...@mie.utoronto.ca> wrote:
> unix...@yahoo.com wrote:
> > Just need a script (on Sol 9 server) that well telnet to port 5101
> > (every 2 seconds) on a specific foreign host and write the results to
> > a log. (Dropping the connection after each telnet attempt).
>
> install "nc" (netcat) if you don't have it.
> You should find it on blastwave.org or opencsw.org or sunfreeware.com
>
> #!/bin/sh
> while true; do
> =A0 =A0nc hostname 5101 < /dev/null >> logfile
> =A0 =A0sleep 2
> done
ok. got the correct nc package. thanks.
The logfile though only contains one entry for first connect on the
port. Shouldn't there be an entry for every 2 seconds of connections.
This is what I need to track bad attempts.
|
|
0
|
|
|
|
Reply
|
unixzip
|
5/7/2009 9:27:30 PM
|
|
unixzip@yahoo.com wrote:
> The logfile though only contains one entry for first connect on the
> port. Shouldn't there be an entry for every 2 seconds of connections.
> This is what I need to track bad attempts.
Are you using '>' instead of '>>'?
If you change '#!/bin/sh' to '#!/bin/sh -x' the shell script will print its
actions before doing them as well, to trace what it's doing.
--
Brandon Hume - hume -> BOFH.Ca, http://WWW.BOFH.Ca/
|
|
0
|
|
|
|
Reply
|
hume
|
5/8/2009 12:03:49 AM
|
|
On May 7, 8:03=A0pm, hume.spamfil...@bofh.ca wrote:
> unix...@yahoo.com wrote:
> > The logfile though only contains one entry for first connect on the
> > port. Shouldn't there be an entry for every 2 seconds of connections.
> > This is what I need to track bad attempts.
>
> Are you using '>' instead of '>>'?
>
> If you change '#!/bin/sh' to '#!/bin/sh-x' the shell script will print it=
s
> actions before doing them as well, to trace what it's doing.
>
> --
> Brandon Hume =A0 =A0- hume -> BOFH.Ca,http://WWW.BOFH.Ca/
What's happening is that after:
nc hostname 5101 < /dev/null >> logfile
the script just stops and never goes to next line (sleep 2).
I think there needs to be some other command to force a disconnect
from the port it connected to.
|
|
0
|
|
|
|
Reply
|
unixzip
|
5/8/2009 2:21:47 AM
|
|
unixzip@yahoo.com writes:
>I think there needs to be some other command to force a disconnect
>from the port it connected to.
There's command line options (and examples in the README or however the
doc is packaged now...) that you can add to nc and it will do just
what you want...
-Mike
|
|
0
|
|
|
|
Reply
|
Mike
|
5/8/2009 1:40:10 PM
|
|
|
10 Replies
580 Views
(page loaded in 3.253 seconds)
Similiar Articles: newbie question: shell script to monitor server performance - comp ...I need a script that to monitor our Solaris 8 server performance. The script will ... I need the information to be simple and dispalyed like the disk usage and free ... newbie question: shell script to monitor server performance - comp ...I need the information to be simple and dispalyed like the disk usage and free ... I need a script that to monitor ... space, memory usage and free memory space, etc ... Shell script to monitor interface usage - comp.unix.admin ...I need a script that to monitor ... space, memory usage and free memory space, etc ... Today, we're going to take a look at a simple shell script to monitor disk space usage. ... how to ping to multiple ip address - comp.unix.solarisHi Guru, Need your assistance please..... I'd like to ping to many ip adress from ... Shell script to ping multiple hosts - comp ... ip address - comp.unix.solaris Simple Ping ... Bash script - telnet - comp.unix.shellI need a telnet script in bash. I need to log in a remote site ... In this case ping does not stop after count ... Using Expect - This is a nice simple bash shell script to ... script to install printers on multiple servers - comp.sys.hp.hpux ...We need a script to install printers on 300 HPUX ... Shell script to ping multiple hosts - comp.unix.shell ... script to supply username and password A simple shell script ... running a bash command with a timeout - comp.os.linux.misc ...Ping works. But there's other stuff I monitor with IPMI as well. e.g. sensor ... just wonderin if there was someting simple ... Bash script - telnet - comp.unix.shell ... embedded WMP, button to play in full screen - comp.lang.javascript ...Does the video need to be playing before it's ... Playing DVDs on the secondary monitor of an Extended ... in full screen - comp.lang.javascript ... simple email script ... PIX receives one ping, then drops - comp.dcom.sys.cisco... with several packets, in both normal and monitor ... Cisco VPN client connects but can't ping ... The network script gets a ... the modulation envelope can be obtained by simple ... Monitoring Cisco Total Memory and flash using SNMP - comp.dcom.sys ...Monitoring Cisco Total Memory and flash using SNMP - comp ... and SNMP error - comp.dcom.sys.cisco... cisco A Simple ... memory and flash sizes so I can determine if I need to ... Just Need a Simple PING monitor - System Center CentralIs there a way to configure a simple ping monitor to an ipaddress? ... com/mps), but if that is more than you need, here's all you need. The script Simple Linux and UNIX system monitoring with ping command and scriptsSimple Linux and UNIX system monitoring with ping ... Shell script to system monitoring with ping ... this script every 30 minutes (or as per your requirements), you need ... 7/22/2012 6:58:56 AM
|
|
|
|
|
|
|
|
|