Skip to content

Commit

Permalink
feat: added smartctl-exporter
Browse files Browse the repository at this point in the history
  • Loading branch information
mglants committed May 31, 2024
1 parent 78e0cb3 commit 4ac4022
Show file tree
Hide file tree
Showing 4 changed files with 75 additions and 0 deletions.
38 changes: 38 additions & 0 deletions apps/smartctl-exporter/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# syntax=docker/dockerfile:experimental

# Use the Alpine Linux 3 base image
FROM docker.io/alpine:3.20.0

# Define build arguments
ARG VERSION
ARG TARGETPLATFORM
ARG TARGETARCH
ARG TARGETOS

# Set the maintainer label
LABEL xyz.glants.image.target_platform=$TARGETPLATFORM
LABEL xyz.glants.image.target_architecture=$TARGETARCH
LABEL xyz.glants.image.target_os=$TARGETOS
LABEL org.opencontainers.image.title="smartctl-exporter"
LABEL org.opencontainers.image.source="https://github.com/prometheus-community/smartctl_exporter"
LABEL maintainer="The Prometheus Authors <prometheus-developers@googlegroups.com>"

# Install required packages
RUN apk add --no-cache smartmontools wget

# Download and extract the smartctl_exporter binary
RUN wget -O /tmp/smartctl_exporter.tar.gz https://github.com/prometheus-community/smartctl_exporter/releases/download/v${VERSION}/smartctl_exporter-${VERSION}.${TARGETOS}-${TARGETARCH}.tar.gz \
&& tar -xzf /tmp/smartctl_exporter.tar.gz -C /tmp \
&& mv /tmp/smartctl_exporter-${VERSION}.${TARGETOS}-${TARGETARCH}/smartctl_exporter /bin/smartctl_exporter \
&& chmod +x /bin/smartctl_exporter \
&& rm -r /tmp/smartctl_exporter-${VERSION}.${TARGETOS}-${TARGETARCH} /tmp/smartctl_exporter.tar.gz


# Expose the port for the smartctl_exporter
EXPOSE 9633

# Set the user to nobody
USER nobody

# Specify the entry point for the container
ENTRYPOINT ["/bin/smartctl_exporter"]
5 changes: 5 additions & 0 deletions apps/smartctl-exporter/ci/goss.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
# https://github.com/aelsabbahy/goss/blob/master/docs/manual.md#process
process:
smartctl_export:
running: true
19 changes: 19 additions & 0 deletions apps/smartctl-exporter/ci/latest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/usr/bin/env python

import requests
import json

# Get the latest version of matchbox

URL = "https://api.github.com/repos/prometheus-community/smartctl_exporter/releases/latest"

def get_latest(channel):
r = requests.get(URL)
data = json.loads(r.text)
version = data['tag_name'].removeprefix("v")
return version

if __name__ == "__main__":
import sys
channel = sys.argv[1]
print(get_latest(channel))
13 changes: 13 additions & 0 deletions apps/smartctl-exporter/metadata.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
app: "smartctl-exporter"
base: false
semantic_versioning: true
channels:
- name: "stable"
platforms:
- linux/arm64
- linux/amd64
stable: true
tests:
enabled: true
type: web

0 comments on commit 4ac4022

Please sign in to comment.