Screenshots of the sensors
Every sensor kind has pictures of the real product watching a real target, in the light and the dark theme, embedded in its page under docs/sensors/. A person does not take them: a Playwright spec does, so they can be made again whenever the interface changes.
What is photographed
For each entry in ui/e2e/sensor-shots.ts the spec ui/e2e/91-sensor-screenshots.spec.ts writes four pictures into ui/e2e/screenshots/sensors/:
| File | Shows |
|---|---|
<kind>-form-light.png, <kind>-form-dark.png | The "Add sensor" form with the kind's parameters filled in, so a reader sees what there is to set. |
<kind>-sensor-light.png, <kind>-sensor-dark.png | The sensor's own page after at least three successful polls: health, channels, the charts and the last scans. |
The spec makes the group, device and sensor through the API, so every case gets exactly the parameters it lists, and waits until the sensor has polled. The poll interval is a few seconds for local targets and ten seconds for Windows, so the whole run takes a few minutes.
Adding a sensor kind
Add one entry to SENSOR_SHOTS:
{ kind: 'win_disk', target: 'winrm', params: () => ({ volume: 'C:' }) },kind is the key from GET /api/v1/sensor-kinds; the display name for the form is read from there. target says where the sensor looks (below). params gives the parameters, and receives the ports of the web and TCP targets that the e2e runtime starts. name is optional and defaults to the kind's display name. Then embed the light picture in the kind's page under a "What it looks like" heading, as the existing pages do, and link the other three.
Targets
A target is defined in ui/e2e/sensor-targets.ts.
noneis the e2e runtime's own web and TCP targets (ui/e2e/harness.ts). Cases for it always run.winrmis a Windows Server reached over WinRM. It is described only by environment variables, the same ones the live Rust tests use:PROBEWARD_TEST_WINRM_HOST(an address, optionally with:port),PROBEWARD_TEST_WINRM_USER(user,DOMAIN\useroruser@realm) andPROBEWARD_TEST_WINRM_PASSWORD. Without them the Windows cases are skipped and say why.PROBEWARD_TEST_WINRM_HIDEis an optional comma-separated list of further names to hide, such as the machine's host name.hypervis a Windows Server with the Hyper-V role and one small guest, for thewin_hyperv_*kinds. It is described likewinrm, withPROBEWARD_TEST_HYPERV_HOST,_USERand_PASSWORD, plusPROBEWARD_TEST_HYPERV_VM(the guest's name, forwin_hyperv_vm; a case without it is skipped).PROBEWARD_TEST_HYPERV_HIDEis a comma-separated list of names to hide, eachnameorname=what to show instead(lab-host=hyperv-host,lab-vm=app-guest); a bare name is shown ashyperv-host. The address becomes192.0.2.10, the domainEXAMPLEand the accountmonitor.vsphereis an ESXi host or vCenter reached through its API, again described only by environment variables, the same ones the live Rust tests use:PROBEWARD_TEST_VSPHERE_HOST(an address),PROBEWARD_TEST_VSPHERE_USERandPROBEWARD_TEST_VSPHERE_PASSWORD. A case may also need names of the lab:PROBEWARD_TEST_VSPHERE_VM(a powered-on machine, forvmware_vm) andPROBEWARD_TEST_VSPHERE_DATASTORE(defaultdatastore1). A case that needs a variable that is not set is skipped and says which.PROBEWARD_TEST_VSPHERE_HIDEis a comma-separated list of the host and machine names to hide; each entry isnameorname=what to show instead(lab-host=esx1,lab-vm=app-vm), and a name also hides when DNS labels follow it. The root account of an ESXi host is not hidden, as it names nobody.awsis a CloudWatch-compatible endpoint such as AWS Emulator in a container on this machine, described by the variables of the live tests:PROBEWARD_TEST_AWS_ENDPOINT(a URL with an IP address),_REGION,_KEY_ID,_SECRETand_PIN(the certificate's fingerprint). The run seeds the metrics it shows (a namespaceExample/Web, 55 minutes of datapoints) with a signedPutMetricData, and the sensor's credential is made the group's AWS credential. The endpoint's address and port are shown as192.0.2.10:9297. The key is only ever in a password field, which a picture does not show.postgres,mysqlandmssqlare database servers. Each is described byPROBEWARD_TEST_PGQ_*,PROBEWARD_TEST_MYSQL_*orPROBEWARD_TEST_MSSQL_*withADDR(host:port),USERandPASSWORD, the same variables the live tests use, and the login is made the group'ssecretcredential asuser:password. The first two are containers on the machine that takes the pictures and show their own address. The SQL Server target is a lab machine and is masked like the Windows one: its address becomes192.0.2.10, the loginmonitor, and the names inPROBEWARD_TEST_MSSQL_HIDEDBSERVER.netsvcis a machine that runs the protocol services: a directory, a RADIUS server, NTP, DHCP and SIP. It is described by environment variables too; the sensors of the LDAP, RADIUS, NTP, DHCP and SIP kinds look at it.PROBEWARD_TEST_NETSVC_HOST(an address) andPROBEWARD_TEST_NETSVC_PASSWORD(the one password every account has) are the machine;PROBEWARD_TEST_LDAP_BASEandPROBEWARD_TEST_LDAP_USER(the bind name, startinguid=) say where to search, as in the live tests;PROBEWARD_TEST_RADIUS_USERis the account for RADIUS;PROBEWARD_TEST_DHCP_VENDORis the vendor class the DHCP server answers, with the optionalPROBEWARD_TEST_DHCP_INTERFACEandPROBEWARD_TEST_DHCP_SERVERas in the live tests.PROBEWARD_TEST_NETSVC_HIDEis a comma-separated list of names to hide (host name, domain, organisation), andPROBEWARD_TEST_NETSVC_ACCOUNTSof account names to hide; the address and the rest of its network are rewritten to the documentation range. The bind login goes in as the group's secret credential and the RADIUS login as its RADIUS credential. The DHCP picture needs port 68, which the server the runtime starts may not bind as an ordinary user. Give the built binary the capability before the run, for instance from a container, and do not rebuild in between (a build replaces the file and the capability with it):docker run --rm -v "$PWD/target/debug:/t" python:3-slim python3 -c "import os, struct; os.setxattr('/t/probeward', 'security.capability', struct.pack('<IIIII', 0x02000001, 1 << 10, 0, 0, 0))". Without it the DHCP sensor fails with the message that says what it needs.netem_ping,netem_trace,netem_portsandnetem_qosare one lab machine with an address for each network impairment, described by the variables the live tests of the network quality sensors use (listed indocs/sensors/qos.md):PROBEWARD_TEST_NETEM_DELAY80J_LOSS2for the ping picture,_CLEANfor the traceroute and port range pictures with_OPEN_PORT, and_DELAY100Jwith_REFLECTOR_PORTfor the QoS picture. Every address of the machine's network is shown as the same host of192.0.2.0/24.Receivers. The
snmp_trapandsyslogkinds look atnone: the runtime server the e2e harness starts listens for traps and syslog on loopback ports it picks (trapPortandsyslogPortin the state), and the entry'sfeedfunction sends them messages from the loopback address, which is the device's address, once the sensor has polled (a receiver sensor watches a device from its first poll on).receiver-feed.tshas the senders. The addresses inside the messages are in the documentation ranges. Nothing about a lab is needed.Flow collectors. The
netflowandsflowkinds look atnoneas well: the runtime server's NetFlow and sFlow collectors listen on loopback ports the harness picks (flowPortandsflowPortin the state), with 5-second intervals (PROBEWARD_FLOW_INTERVAL_SECS), and the entry'sfeedfunction sends them half a minute of made-up traffic (IPFIX and sFlow datagrams,flow-feed.ts) between hosts of the documentation ranges, from the loopback address, once the sensor has polled. Nothing about a lab is needed.iotis a machine that runs an MQTT broker, a Modbus TCP device and an OPC UA server; the sensors of themqtt_broker,mqtt_topic,modbusandopcuakinds look at it. It is described by the variables the live Rust tests read:PROBEWARD_TEST_MQTT_HOST(the machine's address, which the Modbus and OPC UA cases use too),PROBEWARD_TEST_MQTT_USERandPROBEWARD_TEST_MQTT_PASSWORD(the broker login, made the group'slogincredential),PROBEWARD_TEST_MQTT_TOPIC(a topic holding a number) and the optionalPROBEWARD_TEST_MQTT_ROUNDTRIP_TOPICandPROBEWARD_TEST_MQTT_NAME;PROBEWARD_TEST_MODBUS_HOSTand_PORT;PROBEWARD_TEST_OPCUA_HOST,_PORTand_NODE. The broker is reached over TLS without verifying its certificate, which comes from the lab's own authority.PROBEWARD_TEST_IOT_HIDEis a comma-separated list of names to hide (the lab's name, the machine's name), which topics and the broker's name may carry; the address becomes192.0.2.40and the loginmonitor. A case whosePROBEWARD_TEST_MODBUS_HOSTorPROBEWARD_TEST_OPCUA_HOSTis not set is skipped.snmpsim_nas,snmpsim_printerandsnmpsim_envare recordings of real devices (a Synology DiskStation, a Dell laser printer, an APC environment monitor) replayed by the lab's SNMP simulator, which answers each recording under an SNMPv2c community named after it. They are described by the variables the live Rust tests read:PROBEWARD_TEST_SNMPSIM_HOST(an address) and the optionalPROBEWARD_TEST_SNMPSIM_PORT. The community, which is the recording's name, goes in as the group's SNMP credential; the address, the rest of its network and the community are rewritten in the pictures. The recordings are GPL and are never copied into the repository.snmp_exampleis an agent the spec starts itself, for the sensor kinds that no recording of a real device exists for (the Cisco QoS class): net-snmp'ssnmpdon a loopback port servingcrates/probeward-sensors/fixtures/snmprec/cisco-qos-example.snmprec, a recording written for the purpose, through thepass-agent.pynext to it. Needssnmpdandpython3on the path, and nothing else; the case is skipped without them. The picture is of a made-up router and says so on its documentation page.websvcis a web server with an identity server on it: the page load sensor looks at its HTTPS site, and the transaction sensor signs in to the identity server through the authorisation code flow. It is described byPROBEWARD_TEST_WEB_HOST(an address),PROBEWARD_TEST_WEB_USERandPROBEWARD_TEST_WEB_PASSWORD(an account of the identity server, made the group's login credential),PROBEWARD_TEST_WEB_REALMandPROBEWARD_TEST_WEB_CLIENT(the realm and a public client that allows the redirect addresshttp://localhost/cb), and optionallyPROBEWARD_TEST_WEB_KEYCLOAK_PORT(default 8080).PROBEWARD_TEST_WEB_HIDEis a comma-separated list of host and domain names to hide. The address becomes192.0.2.10, the accountmonitor, the clientweb-appand the realm and the listed namesexample. The page load picture does not check the lab's certificate.sshscriptis a Linux server with a test account that has a normal shell and a small program, for thessh_scriptkind, described by the variables of its live tests:PROBEWARD_TEST_SSH_SCRIPT_HOST,_USER,_PASSWORD(made the group's SSH credential),_COMMAND(the program's path) and_HOST_KEY(its fingerprint, shown as a made-up one).PROBEWARD_TEST_SSH_SCRIPT_HIDElists names to hide. The address becomes192.0.2.30and the accountmonitor.dockersvcis a Docker host with its API on the TLS port, for thedocker_containerkind:PROBEWARD_TEST_DOCKER_HOST,_CERT_FILE,_KEY_FILEand_CA_FILE(PEM files, made the group's TLS client credential) andPROBEWARD_TEST_DOCKER_SHOT, the container to photograph, shown asorders-api.PROBEWARD_TEST_DOCKER_HIDElists names to hide,PROBEWARD_TEST_DOCKER_PORTis the port if it is not 2376, and the address becomes192.0.2.31.
A new kind of lab machine is a new key in TargetName (in sensor-shots.ts) and a new entry in TARGETS: what it is called, its group and intervals, the credential to create, and the words to hide. Read the values from the environment and never write them into a file.
Keeping the lab out of the pictures
Addresses, host names, domain names and account names of a lab machine must not appear in a picture. The device is named neutrally (Windows server), and before each shot the spec rewrites the text of the page: the address becomes 192.0.2.10, the domain EXAMPLE, the account monitor and the names in PROBEWARD_TEST_WINRM_HIDE WINSERVER, including any DNS suffix after them. Only whole words are rewritten, so a name that is also an ordinary word leaves the product's text alone. A built-in account (administrator, admin, guest) is hidden only together with its domain (DOMAIN\administrator): on its own it names nobody, and hiding it turned "administrators" into "monitors". A mutation observer keeps doing so while the live stream redraws. The spec then reads the page text back and fails the test if anything that should be hidden is still there. This cannot see the inside of a chart, so choose parameters whose output does not name the machine, and always look at every picture before committing it.
Regenerating
just dev-up
cd ui
PROBEWARD_TEST_WINRM_HOST=... PROBEWARD_TEST_WINRM_USER=... PROBEWARD_TEST_WINRM_PASSWORD=... \
pnpm e2e --project=runtime -g "sensor screenshots"Run on its own like this, the spec creates the administrator itself. The whole suite (pnpm e2e) produces the same pictures at its end.
The variables of every target, and the _HIDE lists, are described in live tests.