fix
This commit is contained in:
parent
d517313de7
commit
08be6c0950
|
@ -4,3 +4,7 @@ My custom Icinga2 checks.
|
|||
|
||||
Useful: https://nagios-plugins.org/doc/guidelines.html#AEN200
|
||||
https://icinga.com/docs/icinga-2/latest/doc/05-service-monitoring/#performance-data-metrics
|
||||
|
||||
`requirements.txt`: pip requirements for normal Linux hosts.
|
||||
|
||||
`requirements-global.txt` pip requirements for all Python 3 versions and Linux and BSD hosts.
|
|
@ -0,0 +1,31 @@
|
|||
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)
|
Loading…
Reference in New Issue