Giter Site home page Giter Site logo

Comments (4)

gree-gorey avatar gree-gorey commented on June 1, 2024

Hi @prasenforu

Please use 2.0.0 version of exporter from Docker or from releases.

You can use a script like this:

#!/bin/bash

hnm=`hostname`

if [ true ]
then
  result=1
else
  result=0
fi

if [ $result=1 ]
then
  echo "{\"labels\": {\"host\": \"$hnm\"}, \"results\": {\"my_system_health\": 1} }"
else
  echo "{\"labels\": {\"host\": \"$hnm\"}, \"results\": {\"my_system_health\": 0} }"
fi

exit 0

And run bash-exporter like this, pointing to the folder with this script:

$ ./bash-exporter -path ../scripts -labels host

Note the flag -labels. Here you must specify all the custom labels you want to use, comma-separated.

Then, your metrics will be available for Prometheus at :9300:

$ curl 127.1:9300/metrics -s | grep ^bash
bash{host="my-hostname",job="job-3",verb="my_system_health"} 1

from bash-exporter.

prasenforu avatar prasenforu commented on June 1, 2024

@gree-gorey

Thanks for your valuable input ...

My target environment is Kubernetes and I want to use this script in a kubernetes configmap so I can modify as much as possible without pushing script inside the container and rebuild container.

I just need to confirm that all scripts goes to /scripts/ inside the container. right!
And I can push multiple scripts...

one quick question is "bash" is default prefix for each metric.

is there anyway we can customized (as per my own choice)?

Let me deployed in my kubernetes cluster, may be will comeback again :)

from bash-exporter.

prasenforu avatar prasenforu commented on June 1, 2024

@gree-gorey

Looks like there are missing file job-3.sh in docker image version 2.0.0

from bash-exporter.

gree-gorey avatar gree-gorey commented on June 1, 2024

there was a problem with missing bash within the image, not script file

from bash-exporter.

Related Issues (9)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.