Skip to content

Latest commit

 

History

7 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 

Repository files navigation

Pipefail

A real-time, terminal-based network monitoring dashboard built with Python and urwid.

Monitor ICMP ping, HTTP/HTTPS endpoints, SSL/TLS certificate expiry, SNMP-enabled printers, and arbitrary SNMP OIDs — all from a single interactive TUI.


Features

  • Ping (ICMP) — per-target latency tracking with color-coded sparkline history
  • HTTP/HTTPS — polls URLs for response code and latency; warns on 4xx, fails on 5xx
  • SSL/TLS Certificate — tracks days until expiry; alerts at 30 days, warns at 7 days
  • SNMP Printer — polls printer status, active alerts, and toner/supply levels via standard Printer-MIB / HOST-RESOURCES-MIB OIDs
  • Custom OID (SNMP) — poll any arbitrary OID on any SNMP-capable device
  • SNMP Trap Receiver — passively listens on UDP port 162 for incoming SNMPv1/v2c traps and Inform requests; decodes and displays them in real time
  • SNMP Discovery — walk a MIB subtree to see what OIDs a device exposes; click any result to instantly create a Custom OID monitor from it
  • Config persistence — monitors are saved to monitors.conf alongside the script and restored on next launch
  • Mouse and keyboard support — all actions are reachable by both keyboard shortcuts and mouse clicks

Requirements

Requirement Notes
Python 3.7+ Standard library only (plus the deps below)
urwid Terminal UI framework — required
wcwidth Accurate wide-character/emoji column widths — optional but recommended
snmpget / snmpwalk Needed for any SNMP monitor type. Install net-snmp (e.g. apt install snmp)
Root / sudo Required to bind UDP port 162 for the trap receiver

Installation

# 1. Install Python dependencies
pip install urwid
pip install wcwidth          # optional

# 2. Install net-snmp tools (for SNMP features)
# Debian / Ubuntu
sudo apt install snmp

# RHEL / Fedora
sudo dnf install net-snmp-utils

# macOS (Homebrew)
brew install net-snmp

# 3. Run
python3 pipefail.py

# Or with sudo to enable SNMP trap receiving on port 162
sudo python3 pipefail.py

Usage

Keyboard shortcuts

Main menu

Key Action
S Start monitoring
A Add a new monitor target
D Remove selected monitor
V View details for selected monitor
O Discover SNMP OIDs on a device
M Open the SNMP trap monitor
E / Q / Esc Exit

Monitoring screen

Key Action
↑ / ↓ Select a monitor row
Enter Open detail view for selected monitor
A Add monitor
R Remove selected monitor
V View / edit selected monitor
O Discover SNMP
M SNMP trap monitor
Esc / S Return to main menu

Trap monitor screen

Key Action
C Clear trap list
Esc / M Return to previous screen

Monitor types

Ping (ICMP)

Sends a single ICMP echo request per interval using the system ping command. The detail panel shows:

  • Last result and latency
  • Packet counts, loss count, and success rate
  • Min / avg / max latency
  • A color-coded sparkline of the last 40 samples (green = <50 ms, yellow = 50–150 ms, red = ≥150 ms or dropped)

HTTP / HTTPS

Issues an HTTP HEAD request to the target URL. SSL certificate verification is intentionally disabled so self-signed and internal-CA certificates do not block the probe. The detail panel shows the HTTP status code, response time, and a rolling history of the last 10 responses.

Status thresholds:

HTTP code range Status
200–399 OK (green)
400–499 WARN (yellow)
500+ / unreachable FAIL (red)

SSL / TLS Certificate

Connects to the target host and port (default 443), retrieves the certificate in DER form, and decodes it. The detail panel shows subject, subject org, issuer, issuer org, expiry date, and days remaining.

Expiry thresholds:

Days remaining Status
> 30 OK (green)
8–30 WARN (yellow)
1–7 ALERT (yellow, bold)
0 FAIL — expired (red)

SNMP Printer

Polls the following standard MIB OIDs via snmpget / snmpwalk:

OID Purpose
1.3.6.1.2.1.1.1.0 sysDescr
1.3.6.1.2.1.1.6.0 sysLocation
1.3.6.1.2.1.25.3.5.1.1 hrPrinterStatus
1.3.6.1.2.1.43.18.1.1.8 prtAlertDescription
1.3.6.1.2.1.43.11.1.1.6/8/9 Supply name / max capacity / current level

Active printer alerts (paper jam, low toner, etc.) are surfaced directly in the monitor list row without needing to open the detail panel.

Custom OID (SNMP)

Polls a single user-specified OID on any SNMP device. The last 20 polled values are retained and shown in the detail panel with timestamps.


SNMP Trap Receiver

Pipefail includes a built-in passive SNMP trap receiver. It binds 0.0.0.0:162/UDP in a background daemon thread and decodes incoming packets using a minimal hand-written BER/ASN.1 parser — no external SNMP library required.

Supported PDU types:

  • SNMPv1 Trap-PDU
  • SNMPv2c snmpV2-Trap
  • SNMPv2c InformRequest

Each received trap displays: timestamp, source IP, SNMP version, community string, PDU type, and a summary of the first few variable bindings.

Note: Binding UDP port 162 requires root privileges. Run with sudo or use authbind / setcap if you want trap reception without a full root context. If the bind fails, all other monitoring features continue to work normally.


SNMP Discovery

The built-in discovery tool lets you explore what a device exposes before committing to a specific OID. Enter a target, community string, SNMP version, and a base OID subtree (or select one of the built-in presets), then click Scan. Pipefail walks the subtree via snmpwalk and lists up to 100 OID/value pairs. Clicking any result pre-fills the "Add Custom OID Monitor" form with that OID.

Built-in presets:

Preset Base OID
System info (sysDescr etc.) 1.3.6.1.2.1.1
Interfaces table 1.3.6.1.2.1.2.2.1
Host Resources (CPU/storage/devices) 1.3.6.1.2.1.25
Printer MIB 1.3.6.1.2.1.43
Full MIB-2 tree 1.3.6.1.2.1

Configuration file

Monitors are persisted automatically to monitors.conf in the same directory as pipefail.py. Each line encodes one monitor as a pipe-delimited record:

<target>|<interval_sec>|<type>|<community>|<snmp_version>|<custom_oid>

Example:

192.168.1.1|5|ping|||
192.168.1.100|10|printer|public|2c|
example.com|3600|cert|||
https://api.example.com/health|60|https|||
192.168.1.100|10|custom|public|2c|1.3.6.1.2.1.1.5.0

The file is read on startup and written on every add/remove/update operation. You can also edit it manually while Pipefail is not running.


License

MIT

About

A lightweight network and device monitor built with bash and a Tcl/Tk GUI.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages