Skip to content

Commit a11583f

Browse files
committed
Add example Status Page
1 parent b5d0f9d commit a11583f

File tree

4 files changed

+69
-0
lines changed

4 files changed

+69
-0
lines changed

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ Examples include
1111
- [Amsterdam Internet Exchange](Amsterdam%20Internet%20Exchange) : scrapes data from the AMS-IX website for various locations, including Amsterdam, Bay Area, Caribbean, Chicago, Hong Kong, and Mumbai.
1212
- [Azure Data v2](Azure%20Data%20v2) : collects data on both active and deallocated Windows Server 2022 VMs in Azure.
1313
- [Coincap](Coincap) : fetches data from the CoinCap API, converting certain string values to floats, and sending the modified data to Data API.
14+
- [Status Page](Status%20Page) : retrieve status information from services using the Atlassian Status Page.
1415

1516
# Meta Data (for Skyline Communications)
1617

Status Page/README.md

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Status Page
2+
3+
These Scripted Connectors retrieve status information from the Atlassian Status Page API.
4+
5+
- **StatusPageStatus.py** fetches an indicator - one of none, minor, major, or critical, as well as a human description of the blended component status. Examples of the blended status include "All Systems Operational", "Partial System Outage", and "Major Service Outage".
6+
- **StatusPageComponents.py** fetches the components of the service. Each component is listed along with its status - one of operational, degraded_performance, partial_outage, or major_outage.

Status Page/StatusPageComponents.py

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import requests
2+
3+
def main():
4+
# Define the service for which we are checking the status
5+
# Example services using this API are GitHub, Dropbox, Discord, Vimeo
6+
service = "GitHub Status"
7+
8+
# Set the base URL of the status page API for the service
9+
# Example API URLs for these services are:
10+
# https://www.githubstatus.com, https://status.dropbox.com, https://discordstatus.com, https://www.vimeostatus.com/
11+
urlapi = "https://www.githubstatus.com"
12+
13+
# Define header parameters for the request to the local API
14+
header_params = {
15+
"identifier": service,
16+
"type": "Status Page",
17+
}
18+
19+
# Create a session object to manage and persist settings across requests
20+
session = requests.Session()
21+
22+
# Send a GET request to the status API to get the current status of the components in JSON format
23+
components = session.get(urlapi + "/api/v2/components.json")
24+
25+
# Send a PUT request to the local Data API with the status data
26+
# Include the header parameters for additional context
27+
session.put("http://localhost:34567/api/data/parameters", json=components.json(), headers=header_params)
28+
29+
# Execute the main function when the script is run
30+
if __name__ == "__main__":
31+
main()

Status Page/StatusPageStatus.py

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import requests
2+
3+
def main():
4+
# Define the service for which we are checking the status
5+
# Example services using this API are GitHub, Dropbox, Discord, Vimeo
6+
service = "GitHub Status"
7+
8+
# Set the base URL of the status page API for the service
9+
# Example API URLs for these services are:
10+
# https://www.githubstatus.com, https://status.dropbox.com, https://discordstatus.com, https://www.vimeostatus.com/
11+
urlapi = "https://www.githubstatus.com"
12+
13+
# Define header parameters for the request to the local API
14+
header_params = {
15+
"identifier": service,
16+
"type": "Status Page",
17+
}
18+
19+
# Create a session object to manage and persist settings across requests
20+
session = requests.Session()
21+
22+
# Send a GET request to the status API to get the current status in JSON format
23+
status = session.get(urlapi + "/api/v2/status.json")
24+
25+
# Send a PUT request to the local Data API with the status data
26+
# Include the header parameters for additional context
27+
session.put("http://localhost:34567/api/data/parameters", json=status.json(), headers=header_params)
28+
29+
# Execute the main function when the script is run
30+
if __name__ == "__main__":
31+
main()

0 commit comments

Comments
 (0)