Closed fanis closed 10 months ago
Hey @fanis, thanks for your report.
I tested it the same way you did, I cloned the project to /usr/local/src and found this problem:
RUNDECK_TOKEN=..... /usr/local/src/rundeck_exporter/venv/bin/python /usr/local/src/rundeck_exporter/rundeck_exporter.py --host 0.0.0.0 --rundeck.url http://localhost:4440 --rundeck.skip_ssl --rundeck.api.version 41 --rundeck.projects.executions --rundeck.projects.executions.cache --rundeck.cpu.stats --rundeck.memory.stats
Traceback (most recent call last):
File "/usr/local/src/rundeck_exporter/rundeck_exporter.py", line 30, in <module>
__version__ = open('VERSION').read()
^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: 'VERSION'
After fixing this problem, I was able to run with the systemd service exactly as you did, the only difference is that I set the python from a venv, so you need to make sure that all the dependencies in requirements.txt
are installed:
# systemctl start rundeck_exporter
# systemctl status rundeck_exporter
● rundeck_exporter.service - Rundeck exporter service for Prometheus
Loaded: loaded (/etc/systemd/system/rundeck_exporter.service; disabled; preset: disabled)
Active: active (running) since Fri 2023-09-01 13:03:13 -03; 9s ago
Docs: https://github.com/phsmith/rundeck_exporter/
Main PID: 452693 (python)
Tasks: 2 (limit: 47100)
Memory: 17.6M
CPU: 92ms
CGroup: /system.slice/rundeck_exporter.service
└─452693 /usr/local/src/rundeck_exporter/venv/bin/python /usr/local/src/rundeck_exporter/rundeck_exporter.py --host 0.0.0.0 --rundeck.url http://localhost:4440 --rundeck.skip_ssl --rundeck.api.version 41 --rundeck.username admin --rundeck.projects.executions --rundeck.projects.executions.cache >
set 01 13:03:13 archlegion systemd[1]: Started Rundeck exporter service for Prometheus.
# cat /var/log/rundeck_exporter.log
2023-09-01 13:05:56,546 - INFO - Rundeck exporter server started at 0.0.0.0:9620...
I'll send the fix so you can test it.
Hey @phsmith , thanks for the fix, not sure why I hadn't gotten a notifciation from Github on your comments. I was just coming here to update that I just found the problem and fixed it, the systemd file just needed a WorkingDirectory
:
WorkingDirectory=/usr/local/src/rundeck_exporter
I noticed that when testing running the command manually I was already in that directory - moving out of it surfaced the error.
Perhaps this is a side-effect of what you fixed anyway, but it works for me :)
I used the example systemd service, set
RUNDECK_TOKEN
andOPTIONS
in a new/etc/default/rundeck_exporter
file, however it fails to start.I'm pasting below the files after editing out the token/ip/port/url.
/etc/default/rundeck_exporter
:/etc/systemd/system/rundeck_exporter.service
:/var/log/rundeckexporter.log
shows nothing./var/log/syslog
shows:Running the exact same command with hardcoded command parameters (the ones in the env variable
OPTIONS
from/etc/default/rundeck_exporter
) and the env variableRUNDECK_TOKEN
prefixed works just fine:RUNDECK_TOKEN=[token_here] /usr/local/src/rundeck_exporter/rundeck_exporter.py --host [ip] --port [port] --rundeck.url [rundeck_url] --rundeck.skip_ssl --rundeck.api.version 41 --rundeck.username exporter --rundeck.projects.executions --rundeck.projects.executions.cache --rundeck.cpu.stats --rundeck.memory.stats
Any help in determine what the issue is with the systemd configuration would be appreciated.