@@ -7,6 +7,45 @@ import { CrowdsecDatabase } from '../server/database';
77const dbDir = process . env . DB_DIR || path . join ( process . env . TMPDIR || '/tmp' , 'crowdsec-web-ui-screenshots' ) ;
88const port = Number ( process . env . CROWDSEC_SCREENSHOT_BACKEND_PORT || process . env . PORT || 3001 ) ;
99const 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
1150const 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} ) ;
0 commit comments