Skip to content

Linux based system-level process monitoring tool with automated process killing enabled, ensuring system-critical processes remain untouched

Notifications You must be signed in to change notification settings

CodenWizFreak/proc_killer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Proc Killer - Intelligent Process Watcher & Auto Killer

Overview

Proc Killer is a cross-platform system-level process monitoring tool which continuously monitors CPU and memory usage of system processes, intelligently flags processes exceeding configurable thresholds, and optionally terminates them - all while ensuring system-critical processes remain untouched.

Currently set for Ubuntu/Linux-based systems. Change the protected process names to work on Windows/macOS.

Project Structure

proc_killer/
├── cmd/
│   └── procwatch/
│       └── main.go          # CLI entrypoint
├── internal/
│   ├── monitor/
│   │   ├── scanner.go       # Collects process metrics
│   │   └── watcher.go       # Polling & monitoring loop
│   ├── system/
│   │   └── signals.go       # SIGTERM / SIGKILL helpers
│   ├── engine/
│   │   ├── decision.go      # Connects Go with Python rules
│   │   └── python.go        # Executes kill actions safely
│   └── config/
│       └── config.go        # Thresholds, intervals, dry-run
├── python/
│   └── rules/
│       ├── rules.py         # Rule-based decision logic
│       └── models.py        # Optional heuristics
├── scripts/
│   └── install.sh           # Environment setup
├── go.mod                    # Go module
└── README.md

Installation

Prerequisites

  • Linux-based system (works on Windows/macOS too but protected process names must be adapted)
  • Go >= 1.21
  • Python >= 3.10

Setup

Clone the repository:

git clone https://github.com/CodenWizFreak/proc_killer.git
cd proc_killer

Run the installation script:

chmod +x scripts/install.sh
./scripts/install.sh

Activate Python virtual environment:

source venv/bin/activate

Install Go dependencies:

go get github.com/shirou/gopsutil/v3/process

Usage

Run the CLI:

go run cmd/procwatch/main.go

Example output (visualized):

Starting Process Watcher & Auto-Killer...
[SAFE] Skipping protected process systemd (1)
[DRY-RUN] Would kill chrome (5678)
[WARN] firefox (1234) CPU: 55.0 MEM: 600.0 MB

Configuration

Modify thresholds and intervals in internal/config/config.go:

CPUThreshold    float64       // CPU % to trigger action
MemoryThreshold float64       // Memory in MB to trigger action
PollInterval    time.Duration // e.g., 5 * time.Second
DryRun          bool          // safe testing mode

Add or modify protected processes:

ProtectedProcesses = []string{
    "init", "systemd", "bash", "sshd", "python3", "go",
}

Python Rules Engine

  • python/rules/rules.py receives process data in JSON and returns "KILL", "WARN", or "OK".
  • models.py can hold advanced heuristics or ML models for smarter decision-making.

Sample input/output:

Input: {"PID":1234,"Name":"firefox","CPU":90,"Memory":600}
Output: {"decision":"KILL"}

Safety Measures

  • Protected process list prevents killing critical system processes.
  • Dry-run mode allows safe testing.
  • Optionally, skip all system PIDs (PID<100) for extra safety.

About

Linux based system-level process monitoring tool with automated process killing enabled, ensuring system-critical processes remain untouched

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published