- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Need for a simple TCP port query tool
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-09-2006 08:13 PM
тАО04-09-2006 08:13 PM
Need for a simple TCP port query tool
To do this, I need a very simple "Port Query" command-line tool that will return an exit code (0 or non-zero) depending on the status of the port (Listening, rejected, time-out etc). The tool should only connect to the given TCP port and then close the connection immediately (no data should be sent or received).
I have looked at the "strobe" (A super optimised TCP port surveyor) utility at http://hpux.connect.org.uk/hppd/hpux/Networking/Admin/strobe-1.06/ but it didn't meet my requirements.
What I need is an HP-UX equivalent of the Windows "portqry" command ( http://support.microsoft.com/default.aspx?scid=kb;en-us;310099 ).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-09-2006 08:20 PM
тАО04-09-2006 08:20 PM
Re: Need for a simple TCP port query tool
You could take a look at lsof.
http://hpux.connect.org.uk/hppd/hpux/Sysadmin/lsof-4.76/
running lsof on a specific tcp/udp port will return if a port is in use and which processes are using the port.
# lsof -i tcp:1712
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
inetd 982 root 28u inet 0x41df2068 0t0 TCP *:registrar (LISTEN)
psmctd 1933 root 1u inet 0x416b3a68 0t45799 TCP dbxxx:56824->dbxxx:reg)
registrar 1973 root 0u inet 0x420aee68 0t45799 TCP dbxxx:registrar->dbxxx)
registrar 1973 root 1u inet 0x420aee68 0t45799 TCP dbxxx:registrar->dbxxx
Hope this helps,
Robert-Jan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-09-2006 08:23 PM
тАО04-09-2006 08:23 PM
Re: Need for a simple TCP port query tool
Since this will be an availability reporting tool, I am planning to run the scripts on separate (preferably multiple) hosts (ie, not on the hosts running the applications). I need a tool that will query the port status accross the network.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-09-2006 08:24 PM
тАО04-09-2006 08:24 PM
Re: Need for a simple TCP port query tool
netstat command would also meet your requirements, for example:
listening service:
# netstat -na | grep 3306
tcp 0 0 *.3306 *.* LISTEN
# echo $?
0
non-listening service:
# netstat -na | grep 1521
# echo $?
1
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-09-2006 08:27 PM
тАО04-09-2006 08:27 PM
Re: Need for a simple TCP port query tool
http://h20293.www2.hp.com/portal/swdepot/displayProductInfo.do?productNumber=T1471AA
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-09-2006 08:28 PM
тАО04-09-2006 08:28 PM
Re: Need for a simple TCP port query tool
The same response applies. I need to test the availability of these ports from separate hosts, i.e. across the network.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-09-2006 08:31 PM
тАО04-09-2006 08:31 PM
Re: Need for a simple TCP port query tool
The service ORASRV:1521 may be running perfectly, but ORASRV:22 (secure shell) may not be running!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-09-2006 09:01 PM
тАО04-09-2006 09:01 PM
Re: Need for a simple TCP port query tool
an alternative to remotely check services availability may be to use the attached script.
From your central test point, you run the script:
tstsvc.pl
For example:
tstsvc.pl ORASRV 1521
tstsvc.pl APPSRV 22
and check return code.
This should do the job,
regards,
antonio.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-09-2006 11:11 PM
тАО04-09-2006 11:11 PM
Re: Need for a simple TCP port query tool
Thank you very much for the effort. Writing a Perl script was my last resort also. I was wondering if there is a binary to do the same job.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-10-2006 01:29 AM
тАО04-10-2006 01:29 AM
Re: Need for a simple TCP port query tool
Thank you all...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-10-2006 01:35 AM
тАО04-10-2006 01:35 AM
Re: Need for a simple TCP port query tool
ftp://lsof.itap.purdue.edu/pub/tools/unix/lsof
His mail about that reached my inbox at 15:05:05 MET (09:05:08 -0400)
He mails me, because I (usually) check all releases on all available OS's, which in my case includes HP-UX 10.20 through 11.23
Enjoy, Have FUN! H.Merijn
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-10-2006 03:13 AM
тАО04-10-2006 03:13 AM
Re: Need for a simple TCP port query tool
monitoring. Configure a central server,
and install the remote agents on the other
servers. There are a variety of available
modules to test various protocols.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-10-2006 12:55 PM
тАО04-10-2006 12:55 PM
Re: Need for a simple TCP port query tool
Apart from that, if you look in stuff like Stevens' Unix Network Programming, you should be able to find examples of small programs that connect to a given hostname/ip and port. The code would not be all that long at all.
Depending on the scripting language you are using, that language may already have some support for sockets.