MetricsHub
MetricsHub Community Connectors 1.0.22
-
Home
- Connector Developer Guide Sources 19
beforeAll (Section)
When To Use
Use beforeAll when several monitor sources need the same pre-fetched data.
Typical use cases:
- Login/session bootstrap for HTTP connectors.
- Shared discovery lists reused by multiple monitor tasks.
- Expensive command output collected once per cycle.
beforeAll sources still return tables and can be referenced anywhere with ${source::beforeAll.<name>}.
Syntax
beforeAll:
session:
type: http
method: post
path: /rest/login-sessions
body: '{"username":"%{esc(json)::USERNAME}","password":"%{esc(json)::PASSWORD}"}'
resultContent: body
Properties
| Property | Required | Default | Description |
|---|---|---|---|
beforeAll |
Yes | None | Object containing named sources executed before monitor tasks. |
<sourceName> |
Yes | None | Standard source definition (http, commandLine, snmpTable, etc.). |
Recommended Pattern
- Keep
beforeAllfocused on reusable setup/data. - Use explicit source names (
session,inventory,deviceList) rather thansource(1)for new connectors. - Feed
executeForEachEntryOf.sourcefrom abeforeAlltable when fan-out is required.
Common Mistakes
- Putting monitor-specific business logic in
beforeAllinstead of monitor sources. - Fetching massive payloads and re-parsing them in every monitor.
- Returning unstable column layouts that break downstream mappings.
Community Examples
- Cassandra[1]
- LinuxFile[2]
- WindowsFile[3]
beforeAll
connector lifecycle
shared sources
metricshub
community
connector
hardware
system
Links:
- [1] https://github.com/metricshub/community-connectors/blob/main/src/main/connector/database/Cassandra/Cassandra.yaml
- [2] https://github.com/metricshub/community-connectors/blob/main/src/main/connector/system/LinuxFile/LinuxFile.yaml
- [3] https://github.com/metricshub/community-connectors/blob/main/src/main/connector/system/WindowsFile/WindowsFile.yaml
Search Results for {{siteSearch | truncate:'50'}}
{{resultArray.length}}
Searching...
No results.
