beescrape
v1.1.0
Published
Scrapes /metrics and /peers from a range of localhost ports and POSTs the results to the ingress service.
Maintainers
Readme
beescrape
Collects metrics from local Ethereum Swarm Bee nodes.
Walks BEE_COUNT localhost ports starting at BEE_START_PORT, and for each port
fetches GET /metrics and GET /peers, forwarding each body to the ingress
service as a named file.
Setup
pnpm install
pnpm buildConfiguration
All four variables are required; the run aborts at startup if any is missing or malformed.
| Variable | Purpose |
| ------------------- | ------------------------------------------------------------- |
| BEE_START_PORT | Port the first node listens on, e.g. 1633 |
| BEE_COUNT | How many consecutive ports to scrape, e.g. 128 |
| NAMESPACE | Cluster name embedded in every forwarded filename |
| ETHERSAAS_API_KEY | Sent as X-API-Key on every request to the ingress service |
NAMESPACE becomes part of a filename, so it is restricted to letters, digits,
dots, dashes and underscores.
Run
BEE_START_PORT=1633 BEE_COUNT=128 NAMESPACE=alpha ETHERSAAS_API_KEY=… pnpm startBehaviour
- Each port serves a Bee node's debug API;
/metricsis Prometheus text and/peersis the connected-peer list. - For each of the
BEE_COUNTports fromBEE_START_PORTupwards, it fetches/metricsthen/peers. - Each fetched body is POSTed verbatim to
https://ethersaas.com/?filename=<name>-<namespace>-<port>.txt(e.g.metrics-alpha-1633.txt,peers-alpha-1633.txt). - Every request — scrapes and forwards alike — runs serially, with a 15 second timeout each.
- A dead or failing port never sinks the run: every fetch failure is logged and the scan moves on. Forward failures cause a non-zero exit so cron mails them.
Cron
cron runs with a minimal environment, so use absolute paths and set the
variables in the crontab itself. Every five minutes:
BEE_START_PORT=1633
BEE_COUNT=128
NAMESPACE=alpha
ETHERSAAS_API_KEY=…
*/5 * * * * /path/to/node /path/to/beescrape/dist/index.jsUse the absolute path from which node — under a version manager such as nvm it will
look like /Users/you/.nvm/versions/node/v24.13.0/bin/node.
Layout
| File | Purpose |
| --------------- | ------------------------------------------------------- |
| src/config.ts | Environment loading, timeout, endpoints, ingress URLs |
| src/scrape.ts | Per-endpoint fetch from a single port |
| src/report.ts | Forwarding a fetched body to the ingress service |
| src/index.ts | Entry point: the serial scrape/forward loop, exit codes |
| src/types.ts | Config, endpoint and fetch-result types |
