commit 714b69963bf51127f2b070ef4de8084bcde1fee0 Author: Rushmore75 Date: Mon Oct 20 15:24:11 2025 -0600 init diff --git a/README.md b/README.md new file mode 100644 index 0000000..34d7846 --- /dev/null +++ b/README.md @@ -0,0 +1,20 @@ +# Simple Metrics Generator + +Simple Prometheus metrics generator. + +## Usage + +```bash +cat metadata | generate_metrics tempurature 50 +``` + +with your metadata file looking something like + +``` +unit="F", computer="computer5" +``` + +--- + +From here you could then redirect stdout into a file, then host the file with something like Caddy for Prometheus to scrape. + diff --git a/generate_metrics b/generate_metrics new file mode 100755 index 0000000..dad5448 --- /dev/null +++ b/generate_metrics @@ -0,0 +1,26 @@ +#!/bin/bash + + +if [ -t 0 ]; then + echo You need to send your metadata to stdin + echo It should be in the syntax of {name}=\"{value}\" + exit +fi +META=$(cat) + +if [ -z "$1" ]; then + echo Argument 1 should be name + exit +fi +if [ -z "$2" ]; then + echo Argument 2 should be value + exit +fi + +NAME=$1 +VALUE=$2 + +echo "# TYPE ${NAME} guage" +echo "${NAME}{$META} ${VALUE}" + + diff --git a/metadata b/metadata new file mode 100644 index 0000000..581f3b9 --- /dev/null +++ b/metadata @@ -0,0 +1 @@ +value="metadata", name="computer5", unit="F"