Applications Systems

Python bug causes Real-Time Process Explorer to Linux component monitors into Unknown state in SAM

A Python bug causes results in the Real-Time Process Explorer (RTPE) to place SAM Linux Process Monitor components into an unknown state and return the error message: Process Explorer Error-Empty job result received. This issue was fixed in SAM 6.8.

First published date

11/14/2018 5:39 PM

Last published date

1/15/2020 3:17 PM

Overview

This article details a resolution to the issue that occurs in SAM in which a bug in Python causes the Real-Time Process Explorer (RTPE) to place any SAM Linux Process Monitor components into an unknown state and return the following error message: Process Explorer Error - Empty job result received.

Product section

Server Application Monitor

Cause

If the user identifier (UID) of any Linux process consists only of numbers, the Python script /opt/SolarWinds/Agent/bin/Plugins/APM/process_helper.py fails with the error message:

getpwuid(): uid not found:33

 

Specifically, the bug affects the following section of Python code:

def get_user_name(cache, uid):
    if uid in cache.keys():
        return cache[uid]
   user = pwd.getpwuid(uid)[0]
   cache[uid] = user
   return user
 

The line user = pwd.getpwuid(uid)[0] is what is causing the Python script to fail when using a numerical UID.

Resolution

  • Upgrade to SAM 6.8, which fixed this issue.
  • Alternatively, modify the Python code to read:
def get_user_name(cache, uid):
    try:
        user = pwd.getpwuid(uid)[0]
    except KeyError as name:
        user = 'root'
    return user
  • As a result, if a numerical UID cannot be found, the Python command instead defaults the UID to the root user ID.