10

I've got a MediaTemple DV server. I've been seeing a lot of QOS alerts for "numothersock" which is defined as:

The number of sockets other than TCP ones. Local (UNIX-domain) sockets are used for communications inside the system. UDP sockets are used, for example, for Domain Name Service (DNS) queries. UDP and other sockets may also be used in some very specialized applications (SNMP agents and others).

How can I determine what application/daemon/etc is creating these sockets? The limit is 300 and we're hitting that several times a day recently.

Thanks in advance.

Encoderer
  • 267
  • 1
  • 2
  • 11

5 Answers5

16
netstat -nap
p shows the process id 
silviud
  • 2,687
  • 2
  • 18
  • 19
11

netstat -an | grep ESTABLISHED | wc -l

This will count all opened sockets in the system and will output just the total. You can of course also change ESTABLISHED for whatever you need, for example a port or a communication status like CONNECTED or LISTENING.

b13n1u
  • 980
  • 9
  • 14
Luis Parada
  • 111
  • 1
  • 2
4

To watch live MySQL opened connections through UNIX socket, run (as root):

watch -n1 'netstat -np | grep -i mysqld'

stamster
  • 190
  • 5
3

with ss

netstat is deprecated, its replacement is ss.

For your case, ss -pun might be useful that shows UDP (-u) sockets with process information (-p) and doesn't turn port numbers into service names (-n).

I use ss -ptln a lot whichs shows listening (-l) TCP sockets (-t).

It's useful with watch when you want to make sure your web application cleans up its TCP sockets:

watch ss -ptln

Here are some more examples with ss.

Matthias Braun
  • 225
  • 1
  • 8
1

netstat -a shows'em all. Or you can study its manual page to filter out only those types of connections you're interested in.

poige
  • 9,448
  • 2
  • 25
  • 52