mirror of
https://github.com/ClusterCockpit/cc-metric-collector.git
synced 2025-04-19 03:05:55 +02:00
* DiskstatCollector: cast part_max_used metric to int * Add uint types to GangliaSink and LibgangliaSink * Use new sink instances to allow multiple of same sink type * Update sink README and SampleSink * Use new receiver instances to allow multiple of same receiver type * Fix metric scope in likwid configuration script * Mention likwid config script in LikwidCollector README * Refactor: Embed Init() into New() function * Refactor: Embed Init() into New() function * Fix: MetricReceiver uses uninitialized values, when initialization fails * Use Ganglia configuration (#44) * Copy all metric configurations from original Ganglia code * Use metric configurations from Ganglia for some metrics * Format value string also for known metrics * Numa-aware memstat collector (#45) * Add samples for collectors, sinks and receivers * Ping InfluxDB server after connecting to recognize faulty connections * Add sink for Prometheus monitoring system (#46) * Add sink for Prometheus monitoring system * Add prometheus sink to README * Add scraper for Prometheus clients (#47) Co-authored-by: Holger Obermaier <holgerob@gmx.de> Co-authored-by: Holger Obermaier <40787752+ho-ob@users.noreply.github.com>
41 lines
1.4 KiB
Markdown
41 lines
1.4 KiB
Markdown
# CCMetric receivers
|
|
|
|
This folder contains the ReceiveManager and receiver implementations for the cc-metric-collector.
|
|
|
|
# Configuration
|
|
|
|
The configuration file for the receivers is a list of configurations. The `type` field in each specifies which receiver to initialize.
|
|
|
|
```json
|
|
{
|
|
"myreceivername" : {
|
|
<receiver-specific configuration>
|
|
}
|
|
}
|
|
```
|
|
|
|
## Type `nats`
|
|
|
|
```json
|
|
{
|
|
"type": "nats",
|
|
"address": "<nats-URI or hostname>",
|
|
"port" : "<portnumber>",
|
|
"subject": "<subscribe topic>"
|
|
}
|
|
```
|
|
|
|
The `nats` receiver subscribes to the topic `database` and listens on `address` and `port` for metrics in the InfluxDB line protocol.
|
|
|
|
# Contributing own receivers
|
|
A receiver contains a few functions and is derived from the type `Receiver` (in `metricReceiver.go`):
|
|
* `Start() error`
|
|
* `Close()`
|
|
* `Name() string`
|
|
* `SetSink(sink chan lp.CCMetric)`
|
|
* `New<Typename>(name string, config json.RawMessage)`
|
|
|
|
The data structures should be set up in `Init()` like opening a file or server connection. The `Start()` function should either start a go routine or issue some other asynchronous mechanism for receiving metrics. The `Close()` function should tear down anything created in `Init()`.
|
|
|
|
Finally, the receiver needs to be registered in the `receiveManager.go`. There is a list of receivers called `AvailableReceivers` which is a map (`receiver_type_string` -> `pointer to NewReceiver function`). Add a new entry with a descriptive name and the new receiver.
|