# Prometheus Node Exporter Recipe for Yocto Build of BrightSign OS

This project provides a bitbake recipe for the Prometheus Node Exporter service.

**The Node Exporter has had limited testing on an LS445 player.**

## Requirements

* [go v. 1.21.4](https://go.dev/doc/install)
* `upx` tool - `sudo apt install upx`

## Prebuild Binaries

This recipe relies on a pre-build binary for `node_exporter`.

To build:

```bash
mkdir -p /public/Software/Prometheus

git clone https://github.com/prometheus/node_exporter.git --branch v1.7.0
cd node_exporter

# build for host's native arch -- e.g. x86_64
# make build
GOOS=linux GOARCH=amd64 go build -ldflags="-s -w"
upx ./node_exporter
# store the binary in /private
mv node_exporter /private/oe-sources/node_exporter-linux-x86_64-v1.7.0

go clean

GOOS=linux GOARCH=arm64 go build -ldflags="-s -w"
upx ./node_exporter
mv node_exporter /private/oe-sources/node_exporter-linux-arm64-v1.7.0

# may need to be `jenkins` to write this
#sudo -u jenkins bash -c 'mv node_exporter /private/oe-sources/node_exporter-linux-*-v1.7.0
```

## Getting metrics from the player

To recover metrics from the player a simple curl command can recover the default set.

```bash
export player_ip=192.168.6.146
# or whatever your player is

curl http://${player_ip}:9100/metrics
```
