Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions instana/fsm.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,11 +148,17 @@ def announce_sensor(self, e):

# If we're on a system with a procfs
if os.path.exists("/proc/"):
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.connect((self.agent.options.agent_host, self.agent.options.agent_port))
path = "/proc/%d/fd/%d" % (pid, sock.fileno())
d.fd = sock.fileno()
d.inode = os.readlink(path)
try:
# In CentOS 7, some odd things can happen such as:
# PermissionError: [Errno 13] Permission denied: '/proc/6/fd/8'
# Use a try/except as a safety
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.connect((self.agent.options.agent_host, self.agent.options.agent_port))
path = "/proc/%d/fd/%d" % (pid, sock.fileno())
d.fd = sock.fileno()
d.inode = os.readlink(path)
except:
logger.debug("Error generating file descriptor: ", exc_info=True)

response = self.agent.announce(d)

Expand Down