diff --git a/modules/kubernetes/monitoring/Dockerfile b/modules/kubernetes/monitoring/Dockerfile new file mode 100644 index 00000000..d2ca99c9 --- /dev/null +++ b/modules/kubernetes/monitoring/Dockerfile @@ -0,0 +1,26 @@ +# dockerhub: viktorbarzin/redfish-exporter +FROM golang:rc-bullseye AS builder + +LABEL maintainer="Viktor Barzin " + +ARG ARCH=amd64 + +ENV GOROOT /usr/local/go +ENV GOPATH /go +ENV PATH "$GOROOT/bin:$GOPATH/bin:$PATH" +ENV GO_VERSION 1.15.2 +ENV GO111MODULE=on + + +# Build dependencies +RUN mkdir -p /go/src/github.com/ && \ + git clone https://github.com/jenningsloy318/redfish_exporter /go/src/github.com/jenningsloy318/redfish_exporter && \ + cd /go/src/github.com/jenningsloy318/redfish_exporter && \ + make build + +FROM golang:rc-bullseye + +COPY --from=builder /go/src/github.com/jenningsloy318/redfish_exporter/build/redfish_exporter /usr/local/bin/redfish_exporter +RUN mkdir /etc/prometheus +# config file mounter at runtime +CMD ["/usr/local/bin/redfish_exporter", "--config.file", "/etc/prometheus/redfish_exporter.yml"] diff --git a/modules/kubernetes/monitoring/main.tf b/modules/kubernetes/monitoring/main.tf index d08262b2..a52e92ee 100644 --- a/modules/kubernetes/monitoring/main.tf +++ b/modules/kubernetes/monitoring/main.tf @@ -344,9 +344,11 @@ resource "kubernetes_deployment" "idrac-redfish" { } spec { container { - image = "viktorbarzin/redfish-exporter:latest" - name = "redfish-exporter" - command = ["/bin/sh", "-c", "redfish-exporter --config.file /app/config.yml"] + image = "viktorbarzin/redfish-exporter:latest" + name = "redfish-exporter" + # command = ["/bin/sh", "-c", "redfish-exporter --config.file /app/config.yml"] + # command = ["/usr/local/bin/redfish_exporter", "--config.file", "/etc/prometheus/redfish_exporter.yml"] + command = ["/usr/local/bin/redfish_exporter", "--config.file", "/app/config.yml"] port { container_port = 9610 } @@ -354,7 +356,8 @@ resource "kubernetes_deployment" "idrac-redfish" { volume_mount { name = "redfish-exporter-config" mount_path = "/app/config.yml" - sub_path = "config.yml" + # mount_path = "/etc/prometheus/redfish_exporter.yml" + sub_path = "config.yml" } } volume { diff --git a/modules/kubernetes/monitoring/prometheus_chart_values.tpl b/modules/kubernetes/monitoring/prometheus_chart_values.tpl index b18cdd76..6e1b9261 100644 --- a/modules/kubernetes/monitoring/prometheus_chart_values.tpl +++ b/modules/kubernetes/monitoring/prometheus_chart_values.tpl @@ -309,11 +309,11 @@ extraScrapeConfigs: | replacement: 'r730_idrac_$${1}' - job_name: 'redfish-idrac' scrape_interval: 5m - scrape_timeout: 2m + scrape_timeout: 4m metrics_path: /redfish static_configs: - targets: - - idrac.viktorbarzin.lan + - 192.168.1.4 relabel_configs: - source_labels: [__address__] target_label: __param_target