Skip to content

Commit b14a03d

Browse files
authored
Improve README for clearer setup and feature overview (#308)
* Add metrics screenshot to README * Improve README for clearer setup and feature overview
1 parent a462d09 commit b14a03d

14 files changed

Lines changed: 252 additions & 470 deletions

README.md

Lines changed: 206 additions & 470 deletions
Large diffs are not rendered by default.

screenshots/add_decision.png

2.34 KB
Loading

screenshots/alert_details.png

3.29 KB
Loading

screenshots/alerts.png

2.95 KB
Loading

screenshots/capture-screenshots.mjs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -347,6 +347,9 @@ async function main() {
347347
await clickByText(cdp, "Add Decision");
348348
await screenshot(cdp, "add_decision.png");
349349

350+
await navigate(cdp, "/metrics");
351+
await screenshot(cdp, "metrics.png");
352+
350353
await navigate(cdp, "/notifications");
351354
await screenshot(cdp, "notifications.png");
352355

screenshots/dashboard.png

3.57 KB
Loading

screenshots/decisions.png

1.57 KB
Loading

screenshots/demo-server.ts

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,45 @@ import { CrowdsecDatabase } from '../server/database';
77
const dbDir = process.env.DB_DIR || path.join(process.env.TMPDIR || '/tmp', 'crowdsec-web-ui-screenshots');
88
const port = Number(process.env.CROWDSEC_SCREENSHOT_BACKEND_PORT || process.env.PORT || 3001);
99
const database = new CrowdsecDatabase({ dbDir });
10+
const demoPrometheusMetrics = `
11+
# HELP cs_lapi_bouncer_requests_total number of calls
12+
# TYPE cs_lapi_bouncer_requests_total counter
13+
cs_lapi_bouncer_requests_total{bouncer="edge-firewall",route="/v1/decisions",method="GET"} 1842
14+
cs_lapi_bouncer_requests_total{bouncer="edge-firewall",route="/v1/decisions/stream",method="GET"} 428
15+
cs_lapi_bouncer_requests_total{bouncer="nginx-bouncer",route="/v1/decisions",method="GET"} 936
16+
cs_lapi_decisions_ok_total{bouncer="edge-firewall"} 721
17+
cs_lapi_decisions_ko_total{bouncer="edge-firewall"} 38
18+
cs_lapi_decisions_ok_total{bouncer="nginx-bouncer"} 318
19+
cs_lapi_decisions_ko_total{bouncer="nginx-bouncer"} 14
20+
cs_lapi_machine_requests_total{machine="edge-gateway-01",route="/v1/alerts",method="GET"} 312
21+
cs_lapi_machine_requests_total{machine="edge-gateway-01",route="/v1/watchers/login",method="POST"} 18
22+
cs_lapi_machine_requests_total{machine="proxy-01",route="/v1/alerts",method="GET"} 244
23+
cs_lapi_machine_requests_total{machine="appsec-01",route="/v1/alerts",method="GET"} 126
24+
cs_appsec_reqs_total{source="0.0.0.0:7422",appsec_engine="public-web"} 4821
25+
cs_appsec_block_total{source="0.0.0.0:7422",appsec_engine="public-web"} 143
26+
cs_filesource_hits_total{source="/var/log/auth.log"} 12844
27+
cs_filesource_hits_total{source="/var/log/nginx/access.log"} 9142
28+
cs_parser_hits_total{source="/var/log/auth.log",type="syslog"} 12780
29+
cs_parser_hits_ok_total{source="/var/log/auth.log",type="syslog",acquis_type="file"} 12631
30+
cs_parser_hits_ko_total{source="/var/log/auth.log",type="syslog",acquis_type="file"} 149
31+
cs_parser_hits_total{source="/var/log/nginx/access.log",type="nginx"} 9087
32+
cs_parser_hits_ok_total{source="/var/log/nginx/access.log",type="nginx",acquis_type="file"} 8998
33+
cs_parser_hits_ko_total{source="/var/log/nginx/access.log",type="nginx",acquis_type="file"} 89
34+
cs_bucket_poured_total{name="crowdsecurity/ssh-bf",source="/var/log/auth.log",type="syslog"} 612
35+
cs_bucket_poured_total{name="crowdsecurity/http-probing",source="/var/log/nginx/access.log",type="nginx"} 418
36+
cs_node_wl_hits_ok_total{name="crowdsecurity/whitelists",source="/var/log/auth.log",type="syslog",reason="private",stage="s02-enrich",acquis_type="file"} 74
37+
cs_node_wl_hits_total{name="crowdsecurity/whitelists",source="/var/log/auth.log",type="syslog",reason="private",stage="s02-enrich",acquis_type="file"} 226
38+
cs_node_hits_total{name="crowdsecurity/sshd-logs",source="/var/log/auth.log",type="syslog",stage="s01-parse",acquis_type="file"} 12780
39+
cs_node_hits_ok_total{name="crowdsecurity/sshd-logs",source="/var/log/auth.log",type="syslog",stage="s01-parse",acquis_type="file"} 12631
40+
cs_node_hits_ko_total{name="crowdsecurity/sshd-logs",source="/var/log/auth.log",type="syslog",stage="s01-parse",acquis_type="file"} 149
41+
cs_node_hits_total{name="crowdsecurity/nginx-logs",source="/var/log/nginx/access.log",type="nginx",stage="s01-parse",acquis_type="file"} 9087
42+
cs_node_hits_ok_total{name="crowdsecurity/nginx-logs",source="/var/log/nginx/access.log",type="nginx",stage="s01-parse",acquis_type="file"} 8998
43+
cs_node_hits_ko_total{name="crowdsecurity/nginx-logs",source="/var/log/nginx/access.log",type="nginx",stage="s01-parse",acquis_type="file"} 89
44+
cs_parsing_time_seconds_count{source="/var/log/auth.log",type="syslog"} 12780
45+
cs_parsing_time_seconds_sum{source="/var/log/auth.log",type="syslog"} 24.921
46+
cs_parsing_time_seconds_count{source="/var/log/nginx/access.log",type="nginx"} 9087
47+
cs_parsing_time_seconds_sum{source="/var/log/nginx/access.log",type="nginx"} 13.812
48+
`;
1049

1150
const config = createRuntimeConfig({
1251
...process.env,
@@ -18,6 +57,7 @@ const config = createRuntimeConfig({
1857
CROWDSEC_HEARTBEAT_INTERVAL: '0',
1958
CROWDSEC_BOOTSTRAP_RETRY_ENABLED: 'false',
2059
CROWDSEC_SIMULATIONS_ENABLED: 'true',
60+
CROWDSEC_PROMETHEUS_URL: process.env.CROWDSEC_PROMETHEUS_URL || 'http://screenshot-demo.local/metrics',
2161
VITE_VERSION: process.env.VITE_VERSION || '2026.06.05',
2262
VITE_BRANCH: process.env.VITE_BRANCH || 'main',
2363
VITE_COMMIT_HASH: process.env.VITE_COMMIT_HASH || 'screenshot',
@@ -64,6 +104,9 @@ const controller = createApp({
64104
lapiClient: fakeLapiClient as never,
65105
startBackgroundTasks: false,
66106
updateChecker,
107+
metricsFetchImpl: async () => new Response(demoPrometheusMetrics, {
108+
headers: { 'content-type': 'text/plain; version=0.0.4' },
109+
}),
67110
notificationFetchImpl: async () => new Response('ok', { status: 200 }),
68111
mqttPublishImpl: async () => {},
69112
});

screenshots/metrics.png

157 KB
Loading

screenshots/notification_rule.png

2.39 KB
Loading

0 commit comments

Comments
 (0)