Convert Figma logo to code with AI

microsoft logoProcMon-for-Linux

A Linux version of the Procmon Sysinternals tool

4,138
264
4,138
21

Top Related Projects

syzkaller is an unsupervised coverage-guided kernel fuzzer

Performance analysis tools based on Linux perf_events (aka perf) and ftrace

20,877

BCC - Tools for BPF-based Linux IO analysis, networking, monitoring, and more

7,956

Linux system exploration and troubleshooting tool with first class support for containers

73,875

X-Ray Vision for your infrastructure!

27,435

Glances an Eye on your system. A top/htop alternative for GNU/Linux, BSD, Mac OS and Windows operating systems.

Quick Overview

ProcMon for Linux is an open-source process monitoring tool developed by Microsoft. It provides real-time visibility into Linux system calls, file system operations, and registry activity, similar to the Windows Sysinternals Process Monitor. This tool is designed to help developers and system administrators diagnose and troubleshoot issues on Linux systems.

Pros

  • Offers detailed, real-time monitoring of system activities
  • Provides a familiar interface for Windows users transitioning to Linux
  • Supports filtering and searching capabilities for efficient analysis
  • Open-source project backed by Microsoft

Cons

  • Currently in beta stage, may have stability issues
  • Limited documentation compared to its Windows counterpart
  • Requires root privileges to run, which may pose security concerns
  • Performance impact on the system being monitored

Getting Started

To get started with ProcMon for Linux:

  1. Clone the repository:

    git clone https://github.com/microsoft/ProcMon-for-Linux.git
    
  2. Install dependencies:

    sudo apt-get install cmake g++ libssl-dev libmnl-dev
    
  3. Build the project:

    cd ProcMon-for-Linux
    mkdir build && cd build
    cmake ..
    make
    
  4. Run ProcMon with root privileges:

    sudo ./procmon
    

Note: Ensure you have the necessary permissions and understand the implications of running a monitoring tool with root privileges.

Competitor Comparisons

syzkaller is an unsupervised coverage-guided kernel fuzzer

Pros of syzkaller

  • More comprehensive: Focuses on kernel fuzzing and bug detection
  • Active development: Frequent updates and contributions
  • Cross-platform: Supports multiple operating systems

Cons of syzkaller

  • Steeper learning curve: Requires more technical expertise
  • Resource-intensive: May require significant computational power
  • Narrower focus: Primarily for kernel testing, not general system monitoring

Code comparison

ProcMon-for-Linux (monitoring system calls):

int main(int argc, char **argv) {
    struct procmon_user_input input = {0};
    parse_args(argc, argv, &input);
    start_monitoring(&input);
    return 0;
}

syzkaller (fuzzing example):

func (p *Proc) fuzzer() {
    for {
        p.executeProgram(p.generateProgram())
        if p.needRestart() {
            p.restartMachine()
        }
    }
}

Summary

ProcMon-for-Linux is a system monitoring tool for Linux, providing real-time insights into system processes. syzkaller, on the other hand, is a kernel fuzzer designed to find bugs in operating system kernels. While ProcMon-for-Linux is more user-friendly and focused on system monitoring, syzkaller offers advanced kernel testing capabilities but requires more expertise to use effectively.

Performance analysis tools based on Linux perf_events (aka perf) and ftrace

Pros of perf-tools

  • Lightweight and modular collection of performance analysis tools
  • Extensive coverage of various performance aspects (CPU, memory, I/O, etc.)
  • Highly customizable and scriptable for specific use cases

Cons of perf-tools

  • Requires more manual intervention and command-line expertise
  • Less user-friendly interface compared to ProcMon-for-Linux
  • May require additional tools or dependencies for comprehensive analysis

Code Comparison

ProcMon-for-Linux:

int main(int argc, char** argv)
{
    procmon_init();
    procmon_start_capture();
    // ... capture and analysis logic
    procmon_stop_capture();
}

perf-tools (example using iosnoop):

#!/bin/bash
# ... tool-specific options and setup
while read event; do
    # ... event processing and output
done < <(perf script -i $file)

The code snippets highlight the different approaches: ProcMon-for-Linux uses a structured C program with initialization and capture functions, while perf-tools often utilize shell scripts that process perf events directly.

ProcMon-for-Linux provides a more integrated solution with a graphical interface, while perf-tools offer a collection of specialized command-line tools for various performance analysis tasks. The choice between them depends on the user's needs, expertise, and preference for GUI vs. CLI tools.

20,877

BCC - Tools for BPF-based Linux IO analysis, networking, monitoring, and more

Pros of BCC

  • More comprehensive tracing and performance analysis capabilities
  • Extensive collection of pre-built tools for various use cases
  • Supports multiple programming languages (Python, Lua, C++)

Cons of BCC

  • Steeper learning curve due to its complexity
  • Requires more system resources for operation
  • May require kernel modifications or specific kernel versions

Code Comparison

BCC example (Python):

from bcc import BPF

program = """
int hello(void *ctx) {
    bpf_trace_printk("Hello, World!\\n");
    return 0;
}
"""

b = BPF(text=program)
b.attach_kprobe(event="sys_clone", fn_name="hello")
b.trace_print()

ProcMon-for-Linux example (C):

#include "procmon.h"

int main(int argc, char **argv) {
    procmon_init();
    procmon_start();
    // ... monitoring logic ...
    procmon_stop();
    return 0;
}

BCC offers more flexibility and powerful tracing capabilities, while ProcMon-for-Linux provides a simpler, more focused approach to process monitoring. BCC is better suited for advanced users and complex scenarios, whereas ProcMon-for-Linux may be more accessible for basic process monitoring tasks.

7,956

Linux system exploration and troubleshooting tool with first class support for containers

Pros of sysdig

  • More comprehensive system visibility, including network traffic and container monitoring
  • Broader ecosystem with additional tools like Falco for security monitoring
  • Active community and frequent updates

Cons of sysdig

  • Steeper learning curve due to more complex features
  • Potentially higher resource usage for extensive monitoring

Code comparison

ProcMon-for-Linux:

static int handle_syscall_enter(struct trace_event_raw_sys_enter *ctx)
{
    struct task_struct *task;
    unsigned int syscall_nr;
    // ... (truncated)
}

sysdig:

int sysdig_probe_syscall_enter(struct pt_regs *regs, long id)
{
    struct event_filler_arguments args;
    int res;
    // ... (truncated)
}

Key differences

  • ProcMon-for-Linux focuses on process monitoring and is more similar to the Windows ProcMon tool
  • sysdig offers a wider range of system observability features, including network and container monitoring
  • ProcMon-for-Linux may be easier to use for those familiar with the Windows version
  • sysdig provides more advanced analysis capabilities and integrations with other tools

Use cases

  • ProcMon-for-Linux: Ideal for Windows admins transitioning to Linux and focusing on process monitoring
  • sysdig: Better suited for comprehensive system observability, especially in containerized environments
73,875

X-Ray Vision for your infrastructure!

Pros of netdata

  • Comprehensive system monitoring with real-time, high-resolution metrics
  • User-friendly web interface with customizable dashboards
  • Extensive plugin system for monitoring various services and applications

Cons of netdata

  • Higher resource usage due to continuous data collection and processing
  • Steeper learning curve for advanced configurations and custom plugins
  • Primarily focused on monitoring rather than process tracing

Code comparison

ProcMon-for-Linux:

static int handle_syscall_enter(struct trace_event_raw_sys_enter *ctx)
{
    struct task_struct *task;
    unsigned int syscall_nr;
    syscall_nr = ctx->id;
    task = (struct task_struct *)bpf_get_current_task();
    // ...
}

netdata:

static inline void rrdset_done(RRDSET *st) {
    if(unlikely(!st)) return;
    RRDDIM *rd;
    int added = 0;
    // ...
}

ProcMon-for-Linux focuses on system call tracing and process monitoring, while netdata provides a broader system monitoring solution with a user-friendly interface. ProcMon-for-Linux is more lightweight and specific to process analysis, whereas netdata offers comprehensive metrics but with higher resource usage. The code snippets reflect their different approaches, with ProcMon-for-Linux handling system calls and netdata managing data collection and visualization.

27,435

Glances an Eye on your system. A top/htop alternative for GNU/Linux, BSD, Mac OS and Windows operating systems.

Pros of Glances

  • Cross-platform support (Linux, macOS, Windows)
  • More comprehensive system monitoring, including network, disk I/O, and sensors
  • Web-based interface and REST API for remote monitoring

Cons of Glances

  • Less detailed process-specific information
  • May have higher resource usage due to its comprehensive monitoring

Code Comparison

ProcMon-for-Linux:

static int handle_proc_event(enum proc_cn_event_type ev_type, struct proc_event *ev)
{
    switch (ev_type) {
    case PROC_EVENT_FORK:
        return handle_fork(ev);
    case PROC_EVENT_EXEC:
        return handle_exec(ev);
    // ...
}

Glances:

def update(self):
    self.stats = psutil.cpu_times_percent(interval=0.0)
    self.stats_time = time.time()
    self.stats_cpu_previous = self.stats

def get(self):
    return self.stats

ProcMon-for-Linux focuses on specific process events, while Glances provides a broader system overview using Python's psutil library. ProcMon-for-Linux offers more granular process monitoring, whereas Glances excels in providing a comprehensive system snapshot with cross-platform compatibility and remote monitoring capabilities.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

Process Monitor for Linux (Preview) Build Status

Process Monitor (Procmon) is a Linux reimagining of the classic Procmon tool from the Sysinternals suite of tools for Windows. Procmon provides a convenient and efficient way for Linux developers to trace the syscall activity on the system.

Procmon in use

Installation & Usage

Requirements

  • OS: Ubuntu 18.04 lts
  • cmake >= 3.14 (build-time only)
  • libsqlite3-dev >= 3.22 (build-time only)

Install Procmon

Please see installation instructions here.

Build Procmon

Please see build instructions here.

Usage

Usage: procmon [OPTIONS]
   OPTIONS
      -h/--help                Prints this help screen
      -p/--pids                Comma separated list of process IDs to monitor
      -e/--events              Comma separated list of system calls to monitor
      -c/--collect [FILEPATH]  Option to start Procmon in a headless mode
      -f/--file FILEPATH       Open a Procmon trace file
      -l/--log FILEPATH        Log debug traces to file

Examples

The following traces all processes and syscalls on the system:

sudo procmon

The following traces processes with process id 10 and 20:

sudo procmon -p 10,20

The following traces process 20 only syscalls read, write and open at:

sudo procmon -p 20 -e read,write,openat

The following traces process 35 and opens Procmon in headless mode to output all captured events to file procmon.db:

sudo procmon -p 35 -c procmon.db

The following opens a Procmon tracefile, procmon.db, within the Procmon TUI:

sudo procmon -f procmon.db

Feedback

  • Ask a question on Stack Overflow (tag with ProcmonForLinux)
  • Request a new feature on GitHub
  • Vote for popular feature requests
  • File a bug in GitHub Issues

Contributing

If you are interested in fixing issues and contributing directly to the code base, please see the document How to Contribute, which covers the following:

  • How to build and run from the source
  • The development workflow, including debugging and running tests
  • Coding Guidelines
  • Submitting pull requests

Please see also our Code of Conduct.

License

Copyright (c) Microsoft Corporation. All rights reserved.

Licensed under the MIT License.