Skip to content
Release: Australia · Updated: 2026-03-12 · Official documentation · View source

LSOFParser- Global

The LSOFParser script include provides methods to parse the output of the lsof command: lsof -i4TCP -n -P -F pcnfT.

Use this script include with a discovery script when you need to parse lsof output.

Parent Topic:Server API reference

LSOFParser - error(String msg)

Generates the specified error message.

NameTypeDescription
msgStringThe error message
TypeDescription
void 

LSOFParser - initFileDescriptor()

Initializes the file descriptor process.

NameTypeDescription
None  
TypeDescription
void 

LSOFParser - initProcess()

Initializes the parser process.

NameTypeDescription
None  
TypeDescription
void 

LSOFParser - on_c(String line)

Sets the current command.

NameTypeDescription
lineStringThe command
TypeDescription
void 

LSOFParser - on_endFileDescriptor()

Closes the file descriptor process.

NameTypeDescription
None  
TypeDescription
void 

LSOFParser - on_endProcess()

Closes the parser process.

NameTypeDescription
None  
TypeDescription
void 

LSOFParser - on_f(String line)

Sets the current file descriptor.

NameTypeDescription
lineStringThe file descriptor
TypeDescription
void 

LSOFParser - on_n(String line)

Sets the current address.

NameTypeDescription
lineStringThe address
TypeDescription
void 

LSOFParser - on_p(String line)

Sets the current PID.

NameTypeDescription
lineStringThe PID
TypeDescription
void 

LSOFParser - on_T(String line)

Sets the current state.

NameTypeDescription
lineStringThe state
TypeDescription
void 

LSOFParser - parse(String lsofOutput)

Parses the specified lsof output.

Results are available in connections and listeners arrays, and errors are recorded in errorString() and isValid().

NameTypeDescription
lsofOutputStringThe lsof output
TypeDescription
void