Implemented

Bug fix - Linux process monitoring failing because of Python bug

I have recently had a rather long support case open where we finally managed to resolve the issue by changing a smal portion of code on the monitored Linux server (Polling method: Agent). Case # 00150171

The problem is this Python bug causing both the "Real-Time Process Explorer" to only return "Process Explorer Error - Empty job result received" and any SAM Linux Process Monitor Component in Unknown state

Issue 10496: Python startup should not require passwd entry - Python tracker

The issue in short is simply that if the UID of ANY process is only numbers, it causes the Python script /opt/SolarWinds/Agent/bin/Plugins/APM/process_helper.py to fail with the error "getpwuid(): uid not found: 33"

Specifically this part of the code:

def get_user_name(cache, uid):

    if uid in cache.keys():

        return cache[uid]

   user = pwd.getpwuid(uid)[0]   <--- this command fails

   cache[uid] = user

   return user

What I did to resolve this issue was modifying the code to the following: (Note: I can not say I am very familiar with Python, so I am not suggesting using my exact code)

def get_user_name(cache, uid):

    try:

        user = pwd.getpwuid(uid)[0]

    except KeyError as name:

        user = 'root'

    return user

The main part is that if the command fails, it defaults to the root user.

Edit:

The change I did to the .py file reverted after some time, so for anyone else out there experiencing this issue, the fix noted above will only work a certain amount of time before reverting, until SolarWinds fixes the issue officially.