Closed prasenforu closed 4 years ago
Hi, I added a Docker image which is available via Docker Hub: https://hub.docker.com/r/ricoberger/script_exporter
The image uses alpine:3.10
as the base image and can be used as follows:
docker run -p 9469:9469 -v ~/script_exporter:/opt ricoberger/script_exporter:v2.1.0 -config.file /opt/config.yaml
I would close the issue for now, but if you have any further questions or suggestions feel free to reopen the issue.
Thanks 👍
Hi ... again
I am running in kubernetes but getting following error
[root@kube-master kube-platform]# oc logs -f script-exporter-8db99d4cc-bxz8s
flag provided but not defined: -config.file /etc/config/config.yaml
Usage of /bin/script_exporter:
-config.file file
Configuration file in YAML format. (default "config.yaml")
-create-token
Create bearer token for authentication.
-timeout-offset seconds
Offset to subtract from Prometheus-supplied timeout in seconds. (default 0.5)
-version
Show version information.
-web.listen-address string
Address to listen on for web interface and telemetry. (default ":9469")
Hi @prasenforu, the Docker image doesn't include a config.yaml
file. To use your config file and scripts you can use the following Deployment and mount the config and scripts via ConfigMap:
---
apiVersion: v1
kind: Namespace
metadata:
name: script-exporter
---
kind: ConfigMap
apiVersion: v1
metadata:
name: script-exporter
namespace: script-exporter
labels:
app.kubernetes.io/name: script-exporter
data:
config.yaml: |
tls:
enabled: false
basicAuth:
enabled: false
bearerAuth:
enabled: false
scripts:
- name: test
script: sh /etc/script_exporter/test.sh
test.sh: |
#! /bin/bash
echo "# HELP test_first_test"
echo "# TYPE test_first_test gauge"
echo "first_test{label=\"test_1_label_1\"} 1"
echo ""
echo "# HELP test_second_test"
echo "# TYPE test_second_test gauge"
echo "second_test{label=\"test_2_label_1\",label=\"test_2_label_2\"} 2.71828182846"
echo ""
echo "# HELP test_third_test"
echo "# TYPE test_third_test gauge"
echo "third_test{} 3,14159265359"
echo ""
echo "Fourth test"
echo "fourth label=\"test_1_label_1\ 4"
echo ""
echo "Fifth test"
echo "fifth 5"
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: script-exporter
namespace: script-exporter
labels:
app.kubernetes.io/name: script-exporter
spec:
replicas: 1
selector:
matchLabels:
app.kubernetes.io/name: script-exporter
template:
metadata:
labels:
app.kubernetes.io/name: script-exporter
spec:
containers:
- name: script-exporter
image: ricoberger/script_exporter:v2.1.1
args:
- -config.file=/etc/script_exporter/config.yaml
ports:
- name: http
containerPort: 9469
protocol: TCP
livenessProbe:
failureThreshold: 3
httpGet:
path: /
port: 9469
scheme: HTTP
initialDelaySeconds: 10
periodSeconds: 10
successThreshold: 1
timeoutSeconds: 10
readinessProbe:
failureThreshold: 3
httpGet:
path: /
port: 9469
scheme: HTTP
periodSeconds: 10
successThreshold: 1
timeoutSeconds: 10
volumeMounts:
- name: config
mountPath: /etc/script_exporter
volumes:
- name: config
configMap:
name: script-exporter
defaultMode: 0777
To test this you can run the following command:
k port-forward script-exporter-xxxxxxxxxx-xxxxx 9469
And then you can open http://localhost:9469/probe?script=test&prefix=test in your browser.
Ah! I was missing argument "=" sign.
Anyway thanks.
Thanks for nice project!!
Looking for container based image (docker)