You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
Next: Root
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
The Atlassian Community can help you and your team get more value out of Atlassian products and practices.
Has anyone ever written a script that touches an external (to Jira) webpage every hour or so, and performs some action in Jira based on the response code?
I manage a bunch of web apps, and would love to get Jira issues sent to me when a site responds with something other than a 200? Create a new issue in a project with details on the site that failed the status check.
Ideally, I would have a bunch of parent issues for the sites, and if there is a problem with a site, a subtask is created under the site’s parent issue. That way, I could add more sites to the checker over time, and let the script loop through all of the main issues.
We are running Jira Server v9.7, and the latest Scriptrunner & Automation plugins.
Anyone have experience touching external sites with scriptrunner? Even though I’m not fluent with groovy, I could probably piece together the rest of the script myself using previous community posts and the Adaptivist Library (and ChatGPT…LOL).
Thanks all!
Hello @Timothy Ryner
Is Jira the right place to be monitoring health of another system though?
If you have scriptrunner then you can create a Job that is scheduled.
There are a number of ways to do this but I guess as this is in groovy lets use this.
Have a look at groovyx.net.http.HttpResponseDecorator
import groovyx.net.http.ContentType
import groovyx.net.http.HTTPBuilder
import groovyx.net.http.Method
import groovyx.net.http.HttpResponseDecorator
log.info("Checking if the system is running.")
def host = 'https://host.domain.com'
def http = new HTTPBuilder(host)
http.request(Method.GET) { req ->
uri.path = '/rest/api/latest/myself'
headers.'APIKEY' = 'i-need-a-key'
response.success = { HttpResponseDecorator resp, data ->
log.info "System running: ${resp.statusLine}"
}
response.failure = { HttpResponseDecorator resp ->
// create an issue in Jira
createIssue(
}
}
def createIssue(String code, String system...) {
}
HTTP utilities aside, I would focus on the point Graham mentioned - you don't want to turn Jira into a monitoring tool, because it isn't suited for it and it's just a "tool" between monitoring and the target site. Whatever it is you're about to do, there are better apps to do it, rather than creating some inline scripts you have virtually zero control of. What if the jobs stop working? How will you solve logging? What if Jira isn't working, is the monitoring in turn also not working? What if the automation user gets inactivated / loses permissions? This is prone to a lot of chained issues that you would be trying to solve over a long period of time and it still will have a room for error. Jira is not the right tool to do monitoring from, and by using it so you will eventually, most likely, hit some of the guardrails and degrade performance of the instance.
I had my experience with people trying to make their projects work as databases, monitorings, log collectors, and it was always ugly and resulted in them going away using proper tools for the job, rather than pulling the entire instance down because of their rather dull automation (which they found to be failing on several occasions). Guardrails are real, and they do bite if you use Jira for something it wasn't meant to do.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks Graham for the start! I'll fiddle with this over the coming weeks!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I’m Madeleine, the Product Manager of a new ScriptRunner for integrations app by Adaptavist called Stitch It.
As the others have said, Jira may not be an optimal monitoring tool. If you do however decide to proceed with your implementation Stitch It could facilitate this for you (and any other integrations you might need between your bespoke tools and your Jira On-Premise).
We don’t have a bespoke template (Stitch It equivalent to a ScriptRunner Library script) that does exactly what you need, but we have a template that demonstrated how to hit a URL and inspect the status code and a template to create an issue in Jira on-prem, if you look at these templates hopefully you can stitch together a script and hook them up with our scheduled trigger to run your integration periodically. In case you need to connect to Jira on-prem instance behind the firewall, here are instructions on how to achieve it.
If you want to learn more about Stitch It you can also head over to our website here.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
This is a neat tool! I work in an interesting environment with many of the exact issues outlined in the marketing slick. Now knowing this exists, I'll look at our processes through a different lens, and I might see about getting funding. Thanks!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Great, I'm very glad to hear it! You can test the app for free for a few more months until we come out of Beta, otherwise feel free to contact us via the website or via email directly (mvironda@adaptavist.com) and we'd be happy to arrange a demo!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.