Skip to content

Commit a10ea7f

Browse files
committed
Add CI badge and Linux end-to-end health check job
1 parent 8e1159d commit a10ea7f

2 files changed

Lines changed: 102 additions & 1 deletion

File tree

.github/workflows/ci.yml

Lines changed: 95 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,4 +64,98 @@ jobs:
6464

6565
- name: Import Flask App
6666
working-directory: python/dashboard
67-
run: python -c "from app import app; print(app.url_map)"
67+
run: python -c "from app import app; print(app.url_map)"
68+
69+
health-check:
70+
name: linux-e2e-health-check
71+
runs-on: ubuntu-latest
72+
73+
steps:
74+
- name: Checkout
75+
uses: actions/checkout@v4
76+
77+
- name: Configure CMake
78+
run: cmake -S . -B build
79+
80+
- name: Build Native Targets
81+
run: cmake --build build --config Release
82+
83+
- name: Start Server and Agent
84+
shell: bash
85+
run: |
86+
./build/sysnetmon-server 9090 > /tmp/sysnetmon-server.log 2>&1 &
87+
echo $! > /tmp/sysnetmon-server.pid
88+
sleep 1
89+
./build/sysnetmon-agent 127.0.0.1 9090 ci-agent-1 1 > /tmp/sysnetmon-agent.log 2>&1 &
90+
echo $! > /tmp/sysnetmon-agent.pid
91+
sleep 4
92+
93+
- name: Validate Live Snapshot
94+
shell: bash
95+
run: |
96+
python3 - <<'PY'
97+
import json
98+
import socket
99+
100+
sock = socket.create_connection(("127.0.0.1", 9090), timeout=5)
101+
register = {"type": "register", "role": "dashboard", "host": "ci-health-check"}
102+
sock.sendall((json.dumps(register) + "\n").encode("utf-8"))
103+
sock.settimeout(4)
104+
105+
chunks = []
106+
try:
107+
while True:
108+
data = sock.recv(4096)
109+
if not data:
110+
break
111+
chunks.append(data.decode("utf-8"))
112+
if "\"type\":\"snapshot\"" in chunks[-1] or "\"type\": \"snapshot\"" in chunks[-1]:
113+
break
114+
except socket.timeout:
115+
pass
116+
finally:
117+
sock.close()
118+
119+
lines = []
120+
for chunk in chunks:
121+
lines.extend([line for line in chunk.splitlines() if line.strip()])
122+
123+
snapshot = None
124+
for line in lines:
125+
try:
126+
obj = json.loads(line)
127+
except Exception:
128+
continue
129+
if obj.get("type") == "snapshot":
130+
snapshot = obj
131+
break
132+
133+
if snapshot is None:
134+
raise SystemExit("No snapshot event received from server")
135+
136+
metrics = snapshot.get("metrics", [])
137+
if not metrics:
138+
raise SystemExit("Snapshot did not contain host metrics")
139+
140+
hosts = {m.get("host") for m in metrics}
141+
if "ci-agent-1" not in hosts:
142+
raise SystemExit("Expected ci-agent-1 in snapshot metrics")
143+
144+
print("Health check passed. Hosts:", sorted(hosts))
145+
PY
146+
147+
- name: Dump logs on failure
148+
if: failure()
149+
shell: bash
150+
run: |
151+
echo "===== server log ====="
152+
cat /tmp/sysnetmon-server.log || true
153+
echo "===== agent log ====="
154+
cat /tmp/sysnetmon-agent.log || true
155+
156+
- name: Stop Processes
157+
if: always()
158+
shell: bash
159+
run: |
160+
if [ -f /tmp/sysnetmon-agent.pid ]; then kill $(cat /tmp/sysnetmon-agent.pid) 2>/dev/null || true; fi
161+
if [ -f /tmp/sysnetmon-server.pid ]; then kill $(cat /tmp/sysnetmon-server.pid) 2>/dev/null || true; fi

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# SysNetMon
22

3+
## CI Status
4+
5+
[![Cross-Platform CI](https://github.com/dev-rajnishg/SysNetMon/actions/workflows/ci.yml/badge.svg)](https://github.com/dev-rajnishg/SysNetMon/actions/workflows/ci.yml)
6+
37
SysNetMon is a distributed system monitor built as an infra-focused monorepo for systems and networking roles. It combines a low-level C++ TCP server, cross-platform C++ monitoring daemons, a Python Flask dashboard with Plotly, and AWS alert delivery using S3 and SNS.
48

59
The native code now targets Windows, macOS, and Linux. The socket layer uses portable `select`-based TCP handling, while metric collection switches to each platform's native APIs: `/proc` on Linux, Mach and `getifaddrs` on macOS, and Win32 or IP Helper APIs on Windows.
@@ -140,6 +144,9 @@ GitHub Actions workflow `.github/workflows/ci.yml` validates the repo on:
140144
- macOS
141145
- Linux
142146

147+
It includes a lightweight Linux end-to-end health check that starts the C++ server and one agent, then validates that a dashboard socket client receives a snapshot containing live metrics.
148+
- Linux
149+
143150
CI builds `sysnetmon-server` and `sysnetmon-agent` with CMake on each OS, and runs Flask dashboard dependency plus import checks.
144151

145152
## AWS Configuration

0 commit comments

Comments
 (0)