Monitoring Jira Align Connectors via API
Platform Notice: Cloud and Data Center - This article applies equally to both cloud and data center platforms.
Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Summary
This article provides a comprehensive overview of how to utilize the Jira Align API for monitoring the health and status of your connectors.
Proactive monitoring is critical for enabling automated checks and alerts, thereby preventing data synchronization issues. By implementing scripts, organizations can integrate connector monitoring into their existing monitoring systems, ensuring the integrity of data and facilitating a seamless flow of information between Jira Align and connected systems.
This proactive strategy significantly reduces the risk of disruptions while enhancing overall system reliability.
Solution
Jira Align connectors play a vital role in synchronizing data between Jira Align and other systems like Jira, Azure DevOps, etc. A malfunctioning connector can lead to data inconsistencies, reporting errors, and disruptions to workflows. Therefore, actively monitoring connector status is essential. This KB article demonstrates how to use the Jira Align API to check connector status, enabling you to create automated monitoring scripts.
Why API-Based Monitoring?
Proactive Monitoring: Regularly checking connector status allows you to identify and address issues before they impact users.
Automation: Scripts can be scheduled to run automatically, eliminating manual checks and saving time.
Integration: Integrate connector monitoring into your existing monitoring tools and dashboards.
Alerting: Configure alerts to notify you immediately of connector failures.
We can use various scripting languages to interact with the Jira Align API. Below are examples of using Python and PowerShell.
(Please note that the scripts below are only examples of usage that you can use as a starting point)
Python Script
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import requests
import json
def check_connector_status(base_url, connector_id, api_token):
url = f"{base_url}/rest/align/api/2/connectors/{connector_id}"
headers = {
"Authorization": f"Bearer {api_token}",
"Content-Type": "application/json"
}
try:
response = requests.get(url, headers=headers)
response.raise_for_status() # Raise an exception for bad status codes
connector_data = response.json()
return connector_data.get("serviceStatus")
except requests.exceptions.RequestException as e:
print(f"Error checking connector status: {e}")
return None
# Example usage:
base_url = "https://<your_jira_align_instance>" # Replace with your Jira Align URL
connector_id = "<your_connector_id>" # Replace with the connector ID
api_token = "<your_api_token>" # Replace with your API token
status = check_connector_status(base_url, connector_id, api_token)
if status:
print(f"Connector status: {status}")
else:
print("Failed to retrieve connector status.")
PowerShell Script
1
2
3
4
5
6
7
8
9
10
11
12
$url = "https://<your_jira_align_instance>/rest/align/api/2/connectors/<connector_id>"
$headers = @{
"Authorization" = "Bearer <your_api_token>"
"Content-Type" = "application/json"
}
try {
$response = Invoke-RestMethod -Uri $url -Headers $headers -Method Get
Write-Host "Connector Status: $($response.serviceStatus)" # Adapt 'status' to the correct field name
}
catch {
Write-Error "Error checking connector status: $($_.Exception.Message)"
}
Integrating into Monitoring Systems:
These scripts can be integrated into your existing monitoring systems. For example, you can:
Schedule Scripts: Use task schedulers (Windows Task Scheduler, cron) to run the scripts periodically.
Monitoring Tools: Integrate the scripts with monitoring tools (like Nagios, Zabbix, or DataDog).
Alerting: Configure alerts based on the connector status returned by the script.
Was this helpful?