32 lines
763 B
Python
Executable File
32 lines
763 B
Python
Executable File
import requests
|
|
import json
|
|
|
|
# Define the Icinga2 API URL
|
|
api_url = "http://your_icinga2_api_url"
|
|
|
|
# Define the headers for the API request
|
|
headers = {
|
|
'Accept': 'application/json',
|
|
'X-HTTP-Method-Override': 'GET'
|
|
}
|
|
|
|
# Define the API username and password
|
|
username = "your_username"
|
|
password = "your_password"
|
|
|
|
# Define the node for which to fetch the IO delay stats
|
|
node = "your_node"
|
|
|
|
# Define the API endpoint to fetch the IO delay stats
|
|
endpoint = "/v1/objects/services/" + node + "!io_delay"
|
|
|
|
# Send the API request
|
|
response = requests.get(api_url + endpoint, headers=headers, auth=(username, password))
|
|
|
|
# Parse the API response
|
|
data = json.loads(response.text)
|
|
|
|
# Print the IO delay stats
|
|
print("IO delay stats for node " + node + ":")
|
|
print(data)
|