Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Load env datas from .env file #75

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,15 @@ This exporter uses the prometheus_client and requests Python module to expose Ru
This code was tested on Rundeck API version 31+.

> **Warning**:
> Since version 4.x.x. the `/api/V/metrics` endpoint is disabled, so you need to enable it in `rundeck-config.properties` to get the exporter to work. See [config-file-reference.html#metrics-capturing](https://docs.rundeck.com/docs/administration/configuration/config-file-reference.html#metrics-capturing)
> Since version 4.x.x. the `/api/V/metrics` endpoint is disabled, so you need to enable it in `rundeck-config.properties` to get the exporter to work. See [config-file-reference.html#metrics-capturing](https://docs.rundeck.com/docs/administration/configuration/config-file-reference.html#metrics-capturing)
>
> If your rundeck is running in a docker container, it needs to set configuration settings through environments as in the example below
> ```yaml
> environment:
> RUNDECK_METRICS_HEALTHCHECKS_ENABLED: 'true'
> RUNDECK_METRICS_ENABLED: 'true'
> ```


## Metrics

Expand Down
5 changes: 5 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
cachetools==4.2.2
certifi==2023.7.22
charset-normalizer==3.3.1
idna==3.4
prometheus-client==0.11.0
python-dotenv==1.0.0
requests==2.31.0
urllib3==2.0.7
10 changes: 10 additions & 0 deletions rundeck_exporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
from enum import Enum
from os import getenv, path
from time import sleep
from dotenv import load_dotenv

from cachetools import cached, TTLCache
from prometheus_client import start_http_server
Expand All @@ -32,6 +33,15 @@
# Disable InsecureRequestWarning
requests.urllib3.disable_warnings()

# Load envs from .evn file
'''
Create .env file in main directory and put all the credentials in the file as shown below.

RUNDECK_TOKEN=My_Hard_Rundeck_Token
RUNDECK_USERPASSWORD=My_Hard_RUNDECK_USERPASSWORD
etc
'''
load_dotenv()

class RundeckProjectExecution(Enum):
'''Class for mapping Rundeck projects execution attributes'''
Expand Down