Writing a Jira Health Check API Using ScriptRunner Custom REST Endpoints -- Need help : )

Right now, I’m able to display the following with my initital pass:

server status (up or not)
security status (verifies that authentication is working)
uptime stats
memory usage info
cpu usage info

What I am struggling with for output are the following:
database status (can’t check to see if Jira can successfully connect to the database)
Jira Datacenter version (can’t seem to find out how to get this info)

Does any one have any suggestions on which libraries to use to get this information? Your help would be much appreciated!

Answering my own question again, but this came from ChatGPT :sweat_smile:

I had the right code, just copied the wrong package, but the BuildUitlsInfo.getVersion() will output the version information.

For Database, I had to change my code entirely and leveraged DatabaseAccessor.runInManagedTransaction()

Again, the solution came from ChatGPT, but I’ve tested it, and both these classes enable valid system output for the checks required. One thing to note, ChatGPT initially recommended using a getConnection() method, but it was an AI hallucination as that method is not exposed in the API. Still, it saved me time waiting for a response here and solved the problem.

Happy coding!