Search code examples
apirundeck

Rundeck : How to check Rundeck health status?


We have a few jobs in production rundeck, due to other application running and throttling CPU, rundeck sometimes goes slow and lag sometimes nearly dead but rundeckd process will be still running. I wanted to set up cron(which I know) to query rundeck healthcheck and report if its sluggish till we migrate rundeck to dedicated VM. I found rundeck3.3 has api enabled by default and I am able to query in browser like http://rundesckhost:4440/metrics/ping which will return pong. Apparently http://rundeckhost:4440/metrics/healthcheck shows json

{"dataSource.connection.time":{"healthy":true,"message":"Datasource connection healthy with timeout 5 seconds"},"quartz.scheduler.threadPool":{"healthy":true}}

I have generated API token of admin user for authentication in scripting purpose. All I wanted to know how to use API to curl with token to get the result ? I tried following but couldn't get the required result.

curl --location --request GET 'http://rundeckhost:4440/metrics/ping' \
--header 'Accept: application/json' \
--header 'X-Rundeck-Auth-Token: <generated token here>'

My ENV spec: OS : Centos 8 | Java : 8 | Rundeck: 3.3 community edition | Scripting Language : curl, bash


Solution

  • More insight answer to my own question :

    if anyone is having issues in using URL http://rundeckhost:4440/api/35/metrics/ping then it would be wrong api version which could be different for different versions of rundeck. so you can find out the right version by accessing your own rundeck http://rundeckhostIP:4440/api/ which will show up xml with api version in it as follows:

    api version

    Use that version number in the querying URL in which in my case its 35.