From 08be6c09509fb3376b52e6fa2de73a23237e8275 Mon Sep 17 00:00:00 2001 From: Cyberes Date: Tue, 30 Jan 2024 11:13:31 -0700 Subject: [PATCH] fix --- README.md | 6 +++- check_proxmox_iowait.py | 31 +++++++++++++++++++ ...s-global.txt => requirements-everybody.txt | 0 3 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 check_proxmox_iowait.py rename requirements-global.txt => requirements-everybody.txt (100%) diff --git a/README.md b/README.md index 1f3a6a8..eb74baa 100644 --- a/README.md +++ b/README.md @@ -3,4 +3,8 @@ 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 \ No newline at end of file +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. \ No newline at end of file diff --git a/check_proxmox_iowait.py b/check_proxmox_iowait.py new file mode 100644 index 0000000..f85e8ca --- /dev/null +++ b/check_proxmox_iowait.py @@ -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) diff --git a/requirements-global.txt b/requirements-everybody.txt similarity index 100% rename from requirements-global.txt rename to requirements-everybody.txt