File tree Expand file tree Collapse file tree 1 file changed +11
-5
lines changed Expand file tree Collapse file tree 1 file changed +11
-5
lines changed Original file line number Diff line number Diff line change @@ -148,11 +148,17 @@ def announce_sensor(self, e):
148148
149149 # If we're on a system with a procfs
150150 if os .path .exists ("/proc/" ):
151- sock = socket .socket (socket .AF_INET , socket .SOCK_STREAM )
152- sock .connect ((self .agent .options .agent_host , self .agent .options .agent_port ))
153- path = "/proc/%d/fd/%d" % (pid , sock .fileno ())
154- d .fd = sock .fileno ()
155- d .inode = os .readlink (path )
151+ try :
152+ # In CentOS 7, some odd things can happen such as:
153+ # PermissionError: [Errno 13] Permission denied: '/proc/6/fd/8'
154+ # Use a try/except as a safety
155+ sock = socket .socket (socket .AF_INET , socket .SOCK_STREAM )
156+ sock .connect ((self .agent .options .agent_host , self .agent .options .agent_port ))
157+ path = "/proc/%d/fd/%d" % (pid , sock .fileno ())
158+ d .fd = sock .fileno ()
159+ d .inode = os .readlink (path )
160+ except :
161+ logger .debug ("Error generating file descriptor: " , exc_info = True )
156162
157163 response = self .agent .announce (d )
158164
You can’t perform that action at this time.
0 commit comments