cc-metric-collector's receivers
Documentation of cc-metric-collector’s receivers
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.
{
"myreceivername" : {
"type": "receiver-type",
<receiver-specific configuration>
}
}
This allows to specify
Available receivers
nats
: Receive metrics from the NATS networkprometheus
: Scrape data from a Prometheus clienthttp
: Listen for HTTP Post requests transporting metrics in InfluxDB line protocolipmi
: Read IPMI sensor readingsredfish
Use the Redfish (specification) to query thermal and power metrics
Contributing own receivers
A receiver contains a few functions and is derived from the type Receiver
(in metricReceiver.go
):
For an example, check the sample receiver
1 - http receiver
Toplevel httpReceiver
http
receiver
The http
receiver can be used receive metrics through HTTP POST requests.
Configuration structure
{
"<name>": {
"type": "http",
"address" : "",
"port" : "8080",
"path" : "/write",
"idle_timeout": "120s",
"username": "myUser",
"password": "myPW"
}
}
type
: makes the receiver a http
receiveraddress
: Listen addressport
: Listen portpath
: URL path for the write endpointidle_timeout
: Maximum amount of time to wait for the next request when keep-alives are enabled should be larger than the measurement interval to keep the connection openkeep_alives_enabled
: Controls whether HTTP keep-alives are enabled. By default, keep-alives are enabled.username
: username for basic authenticationpassword
: password for basic authentication
The HTTP endpoint listens to http://<address>:<port>/<path>
Debugging
2 - IPMI Receiver
Toplevel ipmiReceiver
IPMI Receiver
The IPMI Receiver uses ipmi-sensors
from the FreeIPMI project to read IPMI sensor readings and sensor data repository (SDR) information. The available metrics depend on the sensors provided by the hardware vendor but typically contain temperature, fan speed, voltage and power metrics.
Configuration structure
{
"<IPMI receiver name>": {
"type": "ipmi",
"interval": "30s",
"fanout": 256,
"username": "<Username>",
"password": "<Password>",
"endpoint": "ipmi-sensors://%h-bmc",
"exclude_metrics": [ "fan_speed", "voltage" ],
"client_config": [
{
"host_list": "n[1,2-4]"
},
{
"host_list": "n[5-6]",
"driver_type": "LAN",
"cli_options": [ "--workaround-flags=..." ],
"password": "<Password 2>"
}
]
}
}
Global settings:
interval
: How often the IPMI sensor metrics should be read and send to the sink (default: 30 s)
Global and per IPMI device settings (per IPMI device settings overwrite the global settings):
exclude_metrics
: list of excluded metrics e.g. fan_speed, power, temperature, utilization, voltagefanout
: Maximum number of simultaneous IPMI connections (default: 64)driver_type
: Out of band IPMI driver (default: LAN_2_0)username
: User name to authenticate withpassword
: Password to use for authenticationendpoint
: URL of the IPMI device (placeholder %h
gets replaced by the hostname)
Per IPMI device settings:
host_list
: List of hosts with the same client configurationcli_options
: Additional command line options for ipmi-sensors
3 - nats receiver
Toplevel natsReceiver
nats
receiver
The nats
receiver can be used receive metrics from the NATS network. The nats
receiver subscribes to the topic database
and listens on address
and port
for metrics in the InfluxDB line protocol.
Configuration structure
{
"<name>": {
"type": "nats",
"address" : "nats-server.example.org",
"port" : "4222",
"subject" : "subject",
"user": "natsuser",
"password": "natssecret",
"nkey_file": "/path/to/nkey_file"
}
}
type
: makes the receiver a nats
receiveraddress
: Address of the NATS control serverport
: Port of the NATS control serversubject
: Subscribes to this subject and receive metricsuser
: Connect to nats using this userpassword
: Connect to nats using this passwordnkey_file
: Path to credentials file with NKEY
Debugging
Install NATS server and command line client
Start NATS server
nats-server --net nats-server.example.org --port 4222
Check NATS server works as expected
nats --server=nats-server-db.example.org:4222 server check
Use NATS command line client to subscribe to all messages
nats --server=nats-server-db.example.org:4222 sub ">"
Use NATS command line client to send message to NATS receiver
nats --server=nats-server-db.example.org:4222 pub subject \
"myMetric,hostname=myHost,type=hwthread,type-id=0,unit=Hz value=400000i 1694777161164284635
myMetric,hostname=myHost,type=hwthread,type-id=1,unit=Hz value=400001i 1694777161164284635"
4 - prometheus receiver
Toplevel prometheusReceiver
prometheus
receiver
The prometheus
receiver can be used to scrape the metrics of a single prometheus
client. It does not use any official Golang library but making simple HTTP get requests and parse the response.
Configuration structure
{
"<name>": {
"type": "prometheus",
"address" : "testpromhost",
"port" : "12345",
"path" : "/prometheus",
"interval": "5s",
"ssl" : true,
}
}
type
: makes the receiver a prometheus
receiveraddress
: Hostname or IP of the Prometheus agentport
: Port of Prometheus agentpath
: Path to the Prometheus endpointinterval
: Scrape the Prometheus endpoint in this interval (default ‘5s’)ssl
: Use SSL or not
The receiver requests data from http(s)://<address>:<port>/<path>
.
5 - Redfish receiver
Toplevel redfishReceiver
Redfish receiver
The Redfish receiver uses the Redfish (specification) to query thermal and power metrics. Thermal metrics may include various fan speeds and temperatures. Power metrics may include the current power consumption of various hardware components. It may also include the minimum, maximum and average power consumption of these components in a given time interval. The receiver will poll each configured redfish device once in a given interval. Multiple devices can be accessed in parallel to increase throughput.
Configuration structure
{
"<redfish receiver name>": {
"type": "redfish",
"username": "<Username>",
"password": "<Password>",
"endpoint": "https://%h-bmc",
"exclude_metrics": [ "min_consumed_watts" ],
"client_config": [
{
"host_list": "n[1,2-4]"
},
{
"host_list": "n5",
"disable_power_metrics": true,
"disable_processor_metrics": true,
"disable_thermal_metrics": true
},
{
"host_list": "n6" ],
"username": "<Username 2>",
"password": "<Password 2>",
"endpoint": "https://%h-BMC",
"disable_sensor_metrics": true
}
]
}
}
Global settings:
fanout
: Maximum number of simultaneous redfish connections (default: 64)interval
: How often the redfish power metrics should be read and send to the sink (default: 30 s)http_insecure
: Control whether a client verifies the server’s certificate (default: true == do not verify server’s certificate)http_timeout
: Time limit for requests made by this HTTP client (default: 10 s)
Global and per redfish device settings (per redfish device settings overwrite the global settings):
disable_power_metrics
:
disable collection of power metrics
(/redfish/v1/Chassis/{ChassisId}/Power
)disable_processor_metrics
:
disable collection of processor metrics
(/redfish/v1/Systems/{ComputerSystemId}/Processors/{ProcessorId}/ProcessorMetrics
)disable_sensors
:
disable collection of fan, power and thermal sensor metrics
(/redfish/v1/Chassis/{ChassisId}/Sensors/{SensorId}
)disable_thermal_metrics
:
disable collection of thermal metrics
(/redfish/v1/Chassis/{ChassisId}/Thermal
)exclude_metrics
: list of excluded metricsusername
: User name to authenticate withpassword
: Password to use for authenticationendpoint
: URL of the redfish service (placeholder %h
gets replaced by the hostname)
Per redfish device settings:
host_list
: List of hosts with the same client configuration