Custom Search

Wednesday, October 14, 2015

Find service/client connected to contrail vrouter agent port 9090

1)
Check the service/client which connected to vrouter agent port 9090
#netstat -pant | grep 9090
tcp        0      0 0.0.0.0:9090            0.0.0.0:*               LISTEN      56238/contrail-vrou
tcp        0      0 127.0.0.1:9090          127.0.0.1:52856         ESTABLISHED 56238/contrail-vrou
tcp        0      0 127.0.0.1:52856         127.0.0.1:9090          ESTABLISHED 64005/python


2)
Check the service/client which connected to vrouter agent port 9090
$lsof -i :9090
COMMAND     PID USER   FD   TYPE   DEVICE SIZE/OFF NODE NAME
contrail- 15486 root   51u  IPv4 13415815      0t0  TCP *:9090 (LISTEN)
contrail- 15486 root   53u  IPv4 13432972      0t0  TCP localhost:9090->localhost:41731 (ESTABLISHED)
nova-comp 55059 nova   52u  IPv4 13439027      0t0  TCP localhost:41731->localhost:9090 (ESTABLISHED)

2a)
How to map an ephemeral port to a pid
$sudo lsof -i :41731
$sudo lsof -i tcp:41731 <--- pid="" show="" span="">

$sudo fuser 41731

3)
Find the service/client using PID
$ps -aux | grep 55059
root     42138  0.0  0.0  10460   936 pts/6    S+   16:00   0:00 grep --color=auto 55059
nova     55059  1.1  0.0 2827008 88796 ?       Ssl  02:28   9:23 /usr/bin/python /usr/bin/nova-compute --config-file=/etc/nova/nova.conf --config-file=/etc/nova/nova-compute.conf


4)
Stop nova compute
$service nova-compute stop
nova-compute stop/waiting

5)
Check the service/client which connected to vrouter agent port 9090
$lsof -i :9090
COMMAND     PID USER   FD   TYPE   DEVICE SIZE/OFF NODE NAME
contrail- 15486 root   51u  IPv4 13415815      0t0  TCP *:9090 (LISTEN)

6)
Find vrouter agent process
$ps -aux | grep 15486
root     15486  1.6  0.0 2434356 88660 ?       Sl   13:59   2:16 /usr/bin/contrail-vrouter-agent --config_file /etc/contrail/contrail-vrouter-agent.conf













4 comments:

  1. Almost all clients uses a high port numbers for short term use. This is also known as an ephemeral port.

    http://www.cyberciti.biz/faq/linux-unix-open-ports/

    ReplyDelete
  2. The port numbers are divided into three ranges:
    * Well Known Ports: those from 0 through 1023.
    * Registered Ports: those from 1024 through 49151
    * Dynamic and/or Private Ports: those from 49152 through 65535

    ReplyDelete
  3. How to map an ephemeral port to a pid
    $sudo lsof -i :51945
    $sudo lsof -i tcp:51945
    $sudo fuser 51945

    ReplyDelete
  4. https://www.caktusgroup.com/blog/2013/10/30/using-strace-debug-stuck-celery-tasks/ <--- IMP

    ReplyDelete