2df2ad18c9
hbc_mini.c is a full port of scripts/hbc_mini.py requiring only zlib,
pthreads, and a C11 compiler. Supports Linux, FreeBSD, NetBSD, and
DragonFly BSD with platform-specific plugin backends:
- cpu_monitor: /proc/stat (Linux) or kern.cp_time sysctl (BSD)
- memory_monitor: /proc/meminfo (Linux), vm.stats.vm.* (FreeBSD),
struct uvmexp (NetBSD)
- network_monitor:/proc/net/dev (Linux) or getifaddrs()+if_data (BSD)
- disk_monitor: df -P (all platforms)
- ping_monitor: ping subprocess (all platforms)
- nagios_runner: shell commands with perfdata parsing (all platforms)
- os_info: uname() + /etc/os-release (Linux) or kern.osrelease (BSD)
Build: cc -O2 -o hbc_mini hbc_mini.c -lz -lpthread -lm
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
22 lines
467 B
Makefile
22 lines
467 B
Makefile
CC ?= cc
|
|
CFLAGS = -O2 -Wall -Wextra -std=c11
|
|
LDFLAGS = -lz -lpthread -lm
|
|
TARGET = hbc_mini
|
|
SRC = hbc_mini.c
|
|
|
|
# FreeBSD/NetBSD keep zlib in base; no extra flags needed.
|
|
# On some NetBSD installs pthreads may need -lpthread from pkgsrc.
|
|
|
|
.PHONY: all clean debug
|
|
|
|
all: $(TARGET)
|
|
|
|
$(TARGET): $(SRC)
|
|
$(CC) $(CFLAGS) -o $@ $< $(LDFLAGS)
|
|
|
|
debug: $(SRC)
|
|
$(CC) -g -fsanitize=address,undefined -o $(TARGET)_dbg $< $(LDFLAGS)
|
|
|
|
clean:
|
|
rm -f $(TARGET) $(TARGET)_dbg
|