LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Other *NIX Forums > Solaris / OpenSolaris
User Name
Password
Solaris / OpenSolaris This forum is for the discussion of Solaris, OpenSolaris, OpenIndiana, and illumos.
General Sun, SunOS and Sparc related questions also go here. Any Solaris fork or distribution is welcome.

Notices


Reply
  Search this Thread
Old 05-11-2015, 03:32 PM   #1
narddawg314
LQ Newbie
 
Registered: May 2015
Posts: 4

Rep: Reputation: Disabled
SunOS 5.10 Netstat monitoring/logging help


I'm looking for some assistance with logging connections to a server. I need to know when a connection is established and from where. It would be great if protocol or what the connection is for could also be logged.

My end goal is to identify what servers are connecting to this server and what they are doing. This server acts as our NAS and I need to do some maintenance and don't want to take it down during high traffic times. I also need to notify the other server owners to suspend any jobs that connect during the maintenance window.
 
Old 05-11-2015, 05:50 PM   #2
jlliagre
Moderator
 
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris 11.4, Oracle Linux, Mint, Debian/WSL
Posts: 9,789

Rep: Reputation: 492Reputation: 492Reputation: 492Reputation: 492Reputation: 492
You can use this script: http://www.brendangregg.com/DTrace/connections

Replace SS_TCP_FAST_ACCEPT by SS_DIRECT if you got an error about the former being undefined.
 
1 members found this post helpful.
Old 05-27-2015, 11:09 AM   #3
narddawg314
LQ Newbie
 
Registered: May 2015
Posts: 4

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by jlliagre View Post
You can use this script: http://www.brendangregg.com/DTrace/connections

Replace SS_TCP_FAST_ACCEPT by SS_DIRECT if you got an error about the former being undefined.
Thank you, and this worked great on the DEV box, but on the PROD server there is no /user/bin/ksh only /usr/bin/sh. Any hints to convert this to work in that shell?

This is the response:
Code:
./connections.sh: syntax error at line 87: `(' unexpected
I've tried removing the parenthesis it's referring to, but as expected that caused another error:
Code:
./connections.sh: print: cannot open
I tried escaping the parenthesis to see if that would do the trick, but no dice again:
Code:
./connections.sh: (: cannot open
 
Old 05-27-2015, 03:33 PM   #4
jlliagre
Moderator
 
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris 11.4, Oracle Linux, Mint, Debian/WSL
Posts: 9,789

Rep: Reputation: 492Reputation: 492Reputation: 492Reputation: 492Reputation: 492
Huh, ksh removed from a production server ??

Try /usr/xpg4/bin/sh which should just work, assuming it hasn't been removed too.
 
Old 05-28-2015, 11:23 AM   #5
narddawg314
LQ Newbie
 
Registered: May 2015
Posts: 4

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by jlliagre View Post
Huh, ksh removed from a production server ??

Try /usr/xpg4/bin/sh which should just work, assuming it hasn't been removed too.

..i'm a bonehead. it's there. anyway, I'm getting a different error in PROD now with this section:

Code:
### Process options
while getopts htvZ name
do
        case $name in
        t)      opt_time=1 ;;
        v)      opt_timestr=1 ;;
        Z)      opt_zone=1 ;;
        h|?)    cat <<-END >&2

It's complaining about the << saying there is no closing

Code:
./connections.sh[65]: syntax error at line 71 : `<<' unmatched
 
Old 05-28-2015, 11:34 AM   #6
narddawg314
LQ Newbie
 
Registered: May 2015
Posts: 4

Original Poster
Rep: Reputation: Disabled
well well well.... found this little snippet and decided to try it out:

Quote:
Make sure the 'EOF' is at the beginning of the line ... there should be no
white space prior to the EOF label.
I modified the closing "END" statement that appears below what I pasted above, by deleting all whitespace and it worked.

Would this be due to different ksh versions or something else at play here do you think?
 
Old 05-28-2015, 08:20 PM   #7
jlliagre
Moderator
 
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris 11.4, Oracle Linux, Mint, Debian/WSL
Posts: 9,789

Rep: Reputation: 492Reputation: 492Reputation: 492Reputation: 492Reputation: 492
That's odd. There should be no need to remove the leading spaces as << is used with the "-" modifier (ie. "<<-END" vs "<<END")
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Linux SIEM (Logging/Correlating/Monitoring) scucci Linux - Security 3 09-30-2010 02:51 PM
[SOLVED] Bandwidth logging and monitoring on interface lpallard Linux - Networking 10 06-27-2010 09:32 PM
Port monitoring using netstat ZAMO Linux - Networking 3 08-19-2008 08:17 AM
how to build a activities monitoring and logging system roamer_xk Programming 2 07-14-2005 05:49 PM
how to build a activities monitoring and logging system roamer_xk Linux - Security 1 07-14-2005 01:16 PM

LinuxQuestions.org > Forums > Other *NIX Forums > Solaris / OpenSolaris

All times are GMT -5. The time now is 12:19 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration